diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index f9a0d3317..4b5dd94fe 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -462,6 +462,9 @@ public class ExceptionConstants { //单据明细-单据中存在批号,需要到新增界面关联单据 public static final int DEPOT_ITEM_EXIST_BATCH_NUMBER_FAILED_CODE = 9000006; public static final String DEPOT_ITEM_EXIST_BATCH_NUMBER_FAILED_MSG = "抱歉,单据:%s里面存在批号,需要到新增界面关联单据"; + //原关联单据已被修改,请重新关联 + public static final int DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE = 9000007; + public static final String DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG = "抱歉,原关联单据已被修改,请重新关联"; /** * 财务信息 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index d7d2747f2..ee8f3ee17 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -551,11 +551,16 @@ public class DepotItemService { BigDecimal preNumber = getPreItemByHeaderIdAndMaterial(linkStr, depotItem.getMaterialExtendId(), depotItem.getLinkId()).getOperNumber(); //除去此单据之外的已入库|已出库 BigDecimal realFinishNumber = getRealFinishNumber(currentSubType, depotItem.getMaterialExtendId(), depotItem.getLinkId(), preHeaderId, headerId, unitInfo, unit); - if (preNumber!=null && depotItem.getOperNumber().add(realFinishNumber).compareTo(preNumber) > 0) { - if (!systemConfigService.getOverLinkBillFlag()) { - throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE, - String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, barCode)); + if(preNumber!=null) { + if (depotItem.getOperNumber().add(realFinishNumber).compareTo(preNumber) > 0) { + if (!systemConfigService.getOverLinkBillFlag()) { + throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE, + String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, barCode)); + } } + } else { + throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE, + ExceptionConstants.DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG); } } }