完善单据保存的时候的判断逻辑:如果开启出入库管理,则在采购销售相关单据情况下则跳过判断

This commit is contained in:
季圣华
2023-12-05 23:36:48 +08:00
parent a0745cf4c7
commit 8693a61129
2 changed files with 53 additions and 9 deletions

View File

@@ -464,15 +464,24 @@ public class DepotItemService {
} }
} else { } else {
//入库或出库 //入库或出库
if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) || if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) ||
BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) { BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
//序列号不能为空 //序列号不能为空
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
//如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
if(systemConfigService.getInOutManageFlag() &&
(BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
//跳过
} else {
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_CODE, throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_CODE,
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_MSG, barCode)); String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_MSG, barCode));
} }
} }
} }
}
if (StringUtil.isExist(rowObj.get("batchNumber"))) { if (StringUtil.isExist(rowObj.get("batchNumber"))) {
depotItem.setBatchNumber(rowObj.getString("batchNumber")); depotItem.setBatchNumber(rowObj.getString("batchNumber"));
} else { } else {
@@ -481,11 +490,20 @@ public class DepotItemService {
BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) { BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
//批号不能为空 //批号不能为空
if (BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) { if (BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) {
//如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
if(systemConfigService.getInOutManageFlag() &&
(BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
//跳过
} else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE, throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode)); String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode));
} }
} }
} }
}
if (StringUtil.isExist(rowObj.get("expirationDate"))) { if (StringUtil.isExist(rowObj.get("expirationDate"))) {
depotItem.setExpirationDate(rowObj.getDate("expirationDate")); depotItem.setExpirationDate(rowObj.getDate("expirationDate"));
} }
@@ -629,12 +647,21 @@ public class DepotItemService {
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) { if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
//判断商品是否开启序列号,开启的售出序列号,未开启的跳过 //判断商品是否开启序列号,开启的售出序列号,未开启的跳过
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) { if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
//如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
if(systemConfigService.getInOutManageFlag() &&
(BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
//跳过
} else {
//售出序列号,获得当前操作人 //售出序列号,获得当前操作人
User userInfo=userService.getCurrentUser(); User userInfo = userService.getCurrentUser();
serialNumberService.checkAndUpdateSerialNumber(depotItem, depotHead.getNumber(), userInfo, StringUtil.toNull(depotItem.getSnList())); serialNumberService.checkAndUpdateSerialNumber(depotItem, depotHead.getNumber(), userInfo, StringUtil.toNull(depotItem.getSnList()));
} }
} }
} }
}
this.insertDepotItemWithObj(depotItem); this.insertDepotItemWithObj(depotItem);
//更新当前库存 //更新当前库存
updateCurrentStock(depotItem); updateCurrentStock(depotItem);

View File

@@ -464,4 +464,21 @@ public class SystemConfigService {
} }
return multiLevelApprovalFlag; return multiLevelApprovalFlag;
} }
/**
* 获取出入库管理开关
* @return
* @throws Exception
*/
public boolean getInOutManageFlag() throws Exception {
boolean inOutManageFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getInOutManageFlag();
if(("1").equals(flag)) {
inOutManageFlag = true;
}
}
return inOutManageFlag;
}
} }