|
@@ -746,6 +746,17 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
|
|
for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
|
|
boolean warehouseStatus = "SJRK".equals(billsType) || "SJCK".equals(billsType) || WarehouseTypeEnum.CKDB.getType().equals(billsType) ||
|
|
boolean warehouseStatus = "SJRK".equals(billsType) || "SJCK".equals(billsType) || WarehouseTypeEnum.CKDB.getType().equals(billsType) ||
|
|
WarehouseTypeEnum.HWTG.getType().equals(billsType) || "CDZZ".equals(billsType);
|
|
WarehouseTypeEnum.HWTG.getType().equals(billsType) || "CDZZ".equals(billsType);
|
|
|
|
+ // 判断出库明细审批参数是否开启
|
|
|
|
+ if (CKDetailsSwitch()) {
|
|
|
|
+ // 实际出库时判断
|
|
|
|
+ if ("SJCK".equals(billsType)) {
|
|
|
|
+ // 不装载前端传的数据,而是后端已改的数据
|
|
|
|
+ TWarehousebillsitems tbis = tWarehousebillsitemsMapper.selectTWarehousebillsitemsById(wbItem.getfId());
|
|
|
|
+ if (StringUtils.isNotNull(tbis)) {
|
|
|
|
+ wbItem.setfItemstatus(tbis.getfItemstatus());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 仓储计费日期
|
|
// 仓储计费日期
|
|
wbItem.setfBilltype(billsType);
|
|
wbItem.setfBilltype(billsType);
|
|
if ("SJRK".equals(billsType) && warehouseBills.getfId() != null && "0".equals(warehouseBills.getfChargetype())) {
|
|
if ("SJRK".equals(billsType) && warehouseBills.getfId() != null && "0".equals(warehouseBills.getfChargetype())) {
|
|
@@ -875,6 +886,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
return AjaxResult.success("成功", map);
|
|
return AjaxResult.success("成功", map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 出库明细审批参数是否开启
|
|
|
|
+ * @return 开启为 true 未开启为 false
|
|
|
|
+ */
|
|
|
|
+ public boolean CKDetailsSwitch() {
|
|
|
|
+ // 出库明细是否开启审批流 key 值
|
|
|
|
+ String key = "warehouse.outStockItem.ApprovalFlow";
|
|
|
|
+ return AuditItemsAbout.sysConfigKeyTrue(key);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int insertTWarehousebills(TWarehouseBills tWarehousebills) {
|
|
public int insertTWarehousebills(TWarehouseBills tWarehousebills) {
|
|
return tWarehouseBillsMapper.insertTWarehousebills(tWarehousebills);
|
|
return tWarehouseBillsMapper.insertTWarehousebills(tWarehousebills);
|
|
@@ -3811,16 +3832,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
if (StringUtils.isEmpty(warehousebillsitemsList)) {
|
|
if (StringUtils.isEmpty(warehousebillsitemsList)) {
|
|
return AjaxResult.error("未找到仓储库存明细信息,请确认是否存在");
|
|
return AjaxResult.error("未找到仓储库存明细信息,请确认是否存在");
|
|
}
|
|
}
|
|
- if (tWarehouseBills.getfItemstatus().longValue() == 4L
|
|
|
|
- || tWarehouseBills.getfItemstatus().longValue() == 5L
|
|
|
|
- || tWarehouseBills.getfItemstatus().longValue() == 6L) {
|
|
|
|
- return AjaxResult.error("该单明细已提交审核,请勿重复提交");
|
|
|
|
- }
|
|
|
|
- for (TWarehousebillsitems item : warehousebillsitemsList) {
|
|
|
|
- if (item.getfBillstatus() != 40L || item.getfBillstatus() == 50L) {
|
|
|
|
- return AjaxResult.error("库存明细中存在审核中数据,无法再次提交请核");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
boolean isApprove;
|
|
boolean isApprove;
|
|
long itemStatus = 6L;
|
|
long itemStatus = 6L;
|
|
Long actId = 0L;
|
|
Long actId = 0L;
|
|
@@ -3829,6 +3840,18 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
actId = 170L;
|
|
actId = 170L;
|
|
} else if (billsType.equals("SJCKITEM")) {
|
|
} else if (billsType.equals("SJCKITEM")) {
|
|
actId = 180L;
|
|
actId = 180L;
|
|
|
|
+ if (CKDetailsSwitch()) {
|
|
|
|
+ if (tWarehouseBills.getfItemstatus().longValue() == 4L
|
|
|
|
+ || tWarehouseBills.getfItemstatus().longValue() == 5L
|
|
|
|
+ || tWarehouseBills.getfItemstatus().longValue() == 6L) {
|
|
|
|
+ return AjaxResult.error("该单明细已提交过审核,请勿重复提交");
|
|
|
|
+ }
|
|
|
|
+ /*for (TWarehousebillsitems item : warehousebillsitemsList) {
|
|
|
|
+ if (item.getfBillstatus() != 40L || item.getfBillstatus() == 50L) {
|
|
|
|
+ return AjaxResult.error("库存明细中存在审核中数据,无法再次提交请核");
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
SysConfig sysConfig = queryWarehouseConfig(billsType);
|
|
SysConfig sysConfig = queryWarehouseConfig(billsType);
|
|
@@ -3848,7 +3871,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
tWarehouseBills.setUpdateBy(SecurityUtils.getUsername());
|
|
tWarehouseBills.setUpdateBy(SecurityUtils.getUsername());
|
|
}
|
|
}
|
|
tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
|
|
tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
|
|
|
|
+ List<String> fsrcBillno = new ArrayList<>();
|
|
for (TWarehousebillsitems item : warehousebillsitemsList) {
|
|
for (TWarehousebillsitems item : warehousebillsitemsList) {
|
|
|
|
+ fsrcBillno.add(item.getfBillno());
|
|
item.setUpdateTime(new Date());
|
|
item.setUpdateTime(new Date());
|
|
item.setUpdateBy(SecurityUtils.getUsername());
|
|
item.setUpdateBy(SecurityUtils.getUsername());
|
|
item.setfItemstatus(itemStatus);
|
|
item.setfItemstatus(itemStatus);
|
|
@@ -3877,6 +3902,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
auditItems.setAuditStatus("O");
|
|
auditItems.setAuditStatus("O");
|
|
auditItems.setFidStatus("f_itemstatus");
|
|
auditItems.setFidStatus("f_itemstatus");
|
|
auditItems.setTimes(tWarehouseBills.getfTimes());
|
|
auditItems.setTimes(tWarehouseBills.getfTimes());
|
|
|
|
+ auditItems.setfSrcBillnos(fsrcBillno);// 装载一下业务编号数据
|
|
AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
|
|
AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
|
|
// Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
|
|
// Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
|
|
String code = approvalFlow.get("code").toString();
|
|
String code = approvalFlow.get("code").toString();
|
|
@@ -3959,6 +3985,19 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
if (StringUtils.isNull(tWarehouseBills.getfCorpid())) {
|
|
if (StringUtils.isNull(tWarehouseBills.getfCorpid())) {
|
|
throw new WarehouseException("库存明细第" + i + "行请检查客户信息,操作终止");
|
|
throw new WarehouseException("库存明细第" + i + "行请检查客户信息,操作终止");
|
|
}
|
|
}
|
|
|
|
+ // 判断出库明细审批参数是否开启
|
|
|
|
+ if (CKDetailsSwitch()) {
|
|
|
|
+ TWarehousebillsitems tbs = tWarehousebillsitemsMapper.selectTWarehousebillsitemsById(wbItem.getfId());
|
|
|
|
+ if (tbs.getfItemstatus() == 2L) { // 判断仓库明细从表数据明细审批状态是否为 2 ,则是未发起明细请核过
|
|
|
|
+ throw new WarehouseException("存在出库明细数据,请发起明细请核并通过后重试");
|
|
|
|
+ } else if (tbs.getfItemstatus() == 3L) {
|
|
|
|
+ throw new WarehouseException("明细请核被驳回,请重新提交请核");
|
|
|
|
+ } else if (tbs.getfItemstatus() == 4L || tWarehousebillsitems.getfItemstatus() == 5L) {
|
|
|
|
+ throw new WarehouseException("明细请核还在审批中,耐心等待");
|
|
|
|
+ }
|
|
|
|
+ // 将被更改的明细请核状态装进传递
|
|
|
|
+ wbItem.setfItemstatus(tbs.getfItemstatus());
|
|
|
|
+ }
|
|
//校验计费日期是等于库存总帐计费日,如果不相等则报错
|
|
//校验计费日期是等于库存总帐计费日,如果不相等则报错
|
|
checkWhgenleg(wbItem, tWhgenle);
|
|
checkWhgenleg(wbItem, tWhgenle);
|
|
// 1、 库存 < 调拨件数 提示库存不足
|
|
// 1、 库存 < 调拨件数 提示库存不足
|
|
@@ -6464,6 +6503,15 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
if (Objects.nonNull(item.getfStorageFeeDeadline())) {
|
|
if (Objects.nonNull(item.getfStorageFeeDeadline())) {
|
|
throw new WarehouseException("明细信息已计算仓储费不允许撤销");
|
|
throw new WarehouseException("明细信息已计算仓储费不允许撤销");
|
|
}
|
|
}
|
|
|
|
+ // 判断出库明细审批参数是否开启
|
|
|
|
+ if (CKDetailsSwitch()) {
|
|
|
|
+ if (item.getfItemstatus() == 6L) {
|
|
|
|
+ throw new WarehouseException("请先将明细请核撤销,再进行撤销出库操作");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotNull(item.getfItemstatus())) {
|
|
|
|
+ wb.setfItemstatus(item.getfItemstatus());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 查询库存总账
|
|
// 查询库存总账
|
|
TWhgenleg tWhgenle = queryWhgenlegService.stockWhgenleg(tWarehousebills, wb, goods.getIfCntrno(), WarehouseTypeEnum.UNDO_OPERATION.getType());
|
|
TWhgenleg tWhgenle = queryWhgenlegService.stockWhgenleg(tWarehousebills, wb, goods.getIfCntrno(), WarehouseTypeEnum.UNDO_OPERATION.getType());
|
|
if (StringUtils.isNotNull(tWhgenle)) { // 非空
|
|
if (StringUtils.isNotNull(tWhgenle)) { // 非空
|