From c2d403c9baa1a916aabbc92db523f08be4b6374a Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 21 Oct 2025 18:36:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B4=9F=E8=AE=A1=E5=88=92=EF=BC=88?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E6=A0=A1=E9=AA=8C=E6=9C=80?= =?UTF-8?q?=E7=BB=88=E9=9C=80=E6=B1=82=E6=95=B0=E9=87=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nc/impl/ic/m45/action/InsertAction.java | 34 ++++++++++++++ .../action/rule/XbPushTo45BeforeProcess.java | 44 +++++++++++++++++++ .../service/InboundPubServiceImpl.java | 6 +-- 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 ic/src/private/nc/impl/ic/m45/action/InsertAction.java create mode 100644 ic/src/private/nc/impl/ic/m45/action/rule/XbPushTo45BeforeProcess.java diff --git a/ic/src/private/nc/impl/ic/m45/action/InsertAction.java b/ic/src/private/nc/impl/ic/m45/action/InsertAction.java new file mode 100644 index 00000000..89a672db --- /dev/null +++ b/ic/src/private/nc/impl/ic/m45/action/InsertAction.java @@ -0,0 +1,34 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.impl.ic.m45.action; + +import nc.bs.ic.m45.insert.InsertBP; +import nc.bs.pu.m23.plugin.ArriveActionPlugInPoint; +import nc.impl.ic.general.InsertActionTemplate; +import nc.impl.ic.m45.action.rule.XbPushTo45BeforeProcess; +import nc.impl.ic.m45.base.ActionPlugInPoint; +import nc.impl.pu.m23.maintain.rule.CheckBillDateRule; +import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; +import nc.vo.ic.m45.entity.PurchaseInVO; +import nc.vo.pu.m23.entity.ArriveVO; + +public class InsertAction { + public InsertAction() { + } + + public PurchaseInVO[] insert(PurchaseInVO[] bills) { + + AroundProcesser processer = new AroundProcesser(ActionPlugInPoint.InsertAction); + addBeforeRule(processer); + InsertActionTemplate insertAction = new InsertActionTemplate(ActionPlugInPoint.InsertAction, new InsertBP()); + + return (PurchaseInVO[])insertAction.insert(bills); + } + private void addBeforeRule(AroundProcesser processer) { + processer.addBeforeRule(new XbPushTo45BeforeProcess()); + + } +} diff --git a/ic/src/private/nc/impl/ic/m45/action/rule/XbPushTo45BeforeProcess.java b/ic/src/private/nc/impl/ic/m45/action/rule/XbPushTo45BeforeProcess.java new file mode 100644 index 00000000..5ff9f796 --- /dev/null +++ b/ic/src/private/nc/impl/ic/m45/action/rule/XbPushTo45BeforeProcess.java @@ -0,0 +1,44 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.impl.ic.m45.action.rule; + +import nc.impl.pubapp.pattern.rule.IFilterRule; +import nc.vo.ic.m45.entity.PurchaseInBodyVO; +import nc.vo.ic.m45.entity.PurchaseInVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDouble; + +public class XbPushTo45BeforeProcess implements IFilterRule { + + + public XbPushTo45BeforeProcess() { + + } + + public PurchaseInVO[] process(PurchaseInVO[] vos) { + PurchaseInVO[] retvos = vos; + if(retvos == null || retvos.length == 0){ + return retvos; + } + for (PurchaseInVO vo : vos) { + if(vo.getHead().getPrimaryKey() == null){ + for (PurchaseInBodyVO body:vo.getBodys()){ + if(null!=body.getAttributeValue("vbdef33") && body.getNshouldnum().compareTo(new UFDouble(String.valueOf(body.getAttributeValue("vbdef33"))))>0){ + try { + throw new BusinessException("入库数量大于最终需求数量不能生成采购入库!"); + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + } + } + } + + return retvos; + } + + +} diff --git a/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java b/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java index 187a863b..dd0b1334 100644 --- a/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java +++ b/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java @@ -190,9 +190,9 @@ public class InboundPubServiceImpl implements IInboundPubService { for(ArriveItemVO body : bodys) { body.setTs((UFDateTime)Bid_ts1.get(body.getPk_arriveorder_b())); - if(null!=body.getAttributeValue("vbdef33") && body.getNastnum().compareTo(body.getAttributeValue("vbdef33"))<0){ - throw new BusinessException("入库数量大于最终需求数量不能生成采购入库!"); - } + // if(null!=body.getAttributeValue("vbdef33") && body.getNastnum().compareTo(new UFDouble(String.valueOf(body.getAttributeValue("vbdef33"))))>0){ + // throw new BusinessException("入库数量大于最终需求数量不能生成采购入库!"); + // } } } From 509fab347dc6e50344ba0374abcab38dbea5e0a4 Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 21 Oct 2025 18:43:19 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B4=9F=E8=AE=A1=E5=88=92=EF=BC=88?= =?UTF-8?q?=E5=88=B0=E8=B4=A7=E5=8D=95=E4=BF=9D=E5=AD=98=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=9C=80=E7=BB=88=E9=9C=80=E6=B1=82=E6=95=B0=E9=87=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transfer/action/TransferOrderAction.java | 7 ++-- .../maintain/action/ArriveInsertAction.java | 3 ++ .../m23/maintain/rule/CheckFinalNumRule.java | 42 +++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 pu/src/private/nc/impl/pu/m23/maintain/rule/CheckFinalNumRule.java diff --git a/pu/src/client/nccloud/web/pu/arrival/transfer/action/TransferOrderAction.java b/pu/src/client/nccloud/web/pu/arrival/transfer/action/TransferOrderAction.java index 5555472b..110dbba4 100644 --- a/pu/src/client/nccloud/web/pu/arrival/transfer/action/TransferOrderAction.java +++ b/pu/src/client/nccloud/web/pu/arrival/transfer/action/TransferOrderAction.java @@ -30,6 +30,7 @@ import nc.vo.pub.BusinessException; import nc.vo.pub.compiler.PfParameterVO; import nc.vo.pub.lang.UFBoolean; import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; import nc.vo.scmpub.util.ArrayUtil; import nc.vo.scmpub.util.BillBodySortUtils; import nc.vo.scmpub.util.TransferSortUtil; @@ -163,9 +164,9 @@ public class TransferOrderAction implements ICommonAction { for (OrderVO vo : sorceVOs) { for (OrderItemVO itemVO:vo.getBVO()){ - if(null != itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(itemVO.getAttributeValue("vbdef33"))<0){ - throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!"); - } + // if(null != itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(new UFDouble(String.valueOf(itemVO.getAttributeValue("vbdef33"))))>0){ + // throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!"); + // } } } AggregatedValueObject[] arrivos = service.runChangeDataAry("21", "23", sorceVOs, (PfParameterVO)null); diff --git a/pu/src/private/nc/impl/pu/m23/maintain/action/ArriveInsertAction.java b/pu/src/private/nc/impl/pu/m23/maintain/action/ArriveInsertAction.java index a80f51fd..3f6dd263 100644 --- a/pu/src/private/nc/impl/pu/m23/maintain/action/ArriveInsertAction.java +++ b/pu/src/private/nc/impl/pu/m23/maintain/action/ArriveInsertAction.java @@ -8,6 +8,7 @@ package nc.impl.pu.m23.maintain.action; import nc.bs.pu.m23.maintain.ArriveInsertBP; import nc.bs.pu.m23.plugin.ArriveActionPlugInPoint; import nc.impl.pu.m23.maintain.rule.CheckBillDateRule; +import nc.impl.pu.m23.maintain.rule.CheckFinalNumRule; import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; import nc.vo.pu.m23.entity.ArriveVO; import nc.vo.pu.m23.env.ArrivalUIToBSEnv; @@ -19,6 +20,7 @@ public class ArriveInsertAction { public ArriveVO[] insertArrive(ArriveVO[] voArray, ArrivalUIToBSEnv env) { AroundProcesser processer = new AroundProcesser(ArriveActionPlugInPoint.ArriveInsertAction); addBeforeRule(processer); + processer.addBeforeRule(new CheckBillDateRule()); processer.before(voArray); ArriveInsertBP bp = new ArriveInsertBP(env); @@ -28,5 +30,6 @@ public class ArriveInsertAction { } private void addBeforeRule(AroundProcesser processer) { processer.addBeforeFinalRule(new CheckBillDateRule()); + processer.addBeforeRule(new CheckFinalNumRule()); } } diff --git a/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckFinalNumRule.java b/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckFinalNumRule.java new file mode 100644 index 00000000..b5e4606d --- /dev/null +++ b/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckFinalNumRule.java @@ -0,0 +1,42 @@ +package nc.impl.pu.m23.maintain.rule; + +import nc.vo.pu.m23.entity.ArriveItemVO; +import nc.vo.pu.m23.entity.ArriveVO; +import nc.impl.pubapp.pattern.rule.IRule; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; + +/** + * 最终需求数量校验 + */ +public class CheckFinalNumRule implements IRule { + public CheckFinalNumRule() { + } + + + public void process(ArriveVO[] arriveVOS) { + for (ArriveVO vo : arriveVOS) { + if (vo.getPrimaryKey() != null) { + continue; + } + if (vo == null || vo.getHVO() == null) { + try { + throw new BusinessException("到货单主信息不能为空"); + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + ArriveItemVO[] bodys=vo.getBVO(); + for(ArriveItemVO body : bodys) { + if(null!=body.getAttributeValue("vbdef33") && body.getNastnum().compareTo(new UFDouble(String.valueOf(body.getAttributeValue("vbdef33"))))>0){ + try { + throw new BusinessException("数量大于最终需求数量不能生成到货单!"); + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + } + } + } +} From 6dbe4d310fbfc597c3802efba5148917d7f65e77 Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 21 Oct 2025 18:45:03 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=88=B0=E8=B4=A7=E5=8D=95=E5=88=B6?= =?UTF-8?q?=E5=8D=95=E6=97=A5=E6=9C=9F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m23/maintain/rule/CheckBillDateRule.java | 209 ++++++++++-------- 1 file changed, 116 insertions(+), 93 deletions(-) diff --git a/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckBillDateRule.java b/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckBillDateRule.java index 554ee9c0..ded0e348 100644 --- a/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckBillDateRule.java +++ b/pu/src/private/nc/impl/pu/m23/maintain/rule/CheckBillDateRule.java @@ -6,6 +6,7 @@ package nc.impl.pu.m23.maintain.rule; import nc.bs.framework.common.NCLocator; +import nc.bs.trade.business.HYPubBO; import nc.impl.pubapp.pattern.rule.IRule; import nc.pubitf.so.m30.api.ISaleOrderQueryAPI; import nc.vo.pu.m21.entity.OrderItemVO; @@ -18,6 +19,7 @@ import nc.vo.so.m30.entity.SaleOrderBVO; import org.apache.commons.lang3.StringUtils; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; public class CheckBillDateRule implements IRule { @@ -30,112 +32,117 @@ public class CheckBillDateRule implements IRule { // 提取API服务实例到循环外,提升性能 - try{for (ArriveVO vo : vos) { - // 校验到货单主信息是否存在 - if (vo == null || vo.getHVO() == null) { - throw new BusinessException("到货单主信息不能为空"); - } + try{for (ArriveVO vo : vos) { + // 校验到货单主信息是否存在 + if (vo == null || vo.getHVO() == null) { + throw new BusinessException("到货单主信息不能为空"); + } +// 只校验箱变 + HYPubBO hybo = new HYPubBO(); + String org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = 'C030' ") + ""; + if(!vo.getHVO().getPk_org().equals(org)){ + continue; + } + Date arriveMakeDate = null != vo.getHVO().getDbilldate() ? vo.getHVO().getDbilldate().toDate(): new Date() ; + // 校验制单日期是否存在 + if (arriveMakeDate == null) { + throw new BusinessException("到货单制单日期不能为空"); + } - Date arriveMakeDate = null != vo.getHVO().getDmakedate() ? vo.getHVO().getDmakedate().toDate(): new Date() ; - // 校验制单日期是否存在 - if (arriveMakeDate == null) { - throw new BusinessException("到货单制单日期不能为空"); - } + // 遍历到货单明细 + ArriveItemVO[] itemVOs = vo.getBVO(); + if (itemVOs == null || itemVOs.length==0) { + continue; // 没有明细则跳过当前到货单处理 + } - // 遍历到货单明细 - ArriveItemVO[] itemVOs = vo.getBVO(); - if (itemVOs == null || itemVOs.length==0) { - continue; // 没有明细则跳过当前到货单处理 - } + for (ArriveItemVO itemVO : itemVOs) { + // 校验明细必要字段 + if (itemVO == null) { + throw new BusinessException("到货单明细不能为空"); + } + String pkOrder = itemVO.getPk_order(); + String pkOrderB = itemVO.getPk_order_b(); + if (StringUtils.isEmpty(pkOrder) || StringUtils.isEmpty(pkOrderB)) { + throw new BusinessException("采购订单ID或订单明细ID不能为空"); + } - for (ArriveItemVO itemVO : itemVOs) { - // 校验明细必要字段 - if (itemVO == null) { - throw new BusinessException("到货单明细不能为空"); - } - String pkOrder = itemVO.getPk_order(); - String pkOrderB = itemVO.getPk_order_b(); - if (StringUtils.isEmpty(pkOrder) || StringUtils.isEmpty(pkOrderB)) { - throw new BusinessException("采购订单ID或订单明细ID不能为空"); - } - - try { - // 查询对应的销售订单 - OrderVO[] orderVOs =new BillQuery(OrderVO.class).query(new String[]{pkOrder}); - if (orderVOs == null || orderVOs.length == 0) { - return; + try { + // 查询对应的销售订单 + OrderVO[] orderVOs =new BillQuery(OrderVO.class).query(new String[]{pkOrder}); + if (orderVOs == null || orderVOs.length == 0) { + return; // throw new BusinessException("未找到ID为" + pkOrder + "的采购订单"); - } + } - // 获取订单明细 - OrderVO o = orderVOs[0]; - OrderItemVO[] orderItemVOs = o.getBVO(); - if (orderItemVOs == null || orderItemVOs.length == 0) { - return; + // 获取订单明细 + OrderVO o = orderVOs[0]; + OrderItemVO[] orderItemVOs = o.getBVO(); + if (orderItemVOs == null || orderItemVOs.length == 0) { + return; // throw new BusinessException("采购订单" + pkOrder + "没有明细数据"); - } + } - // 查找匹配的订单明细 - boolean found = false; - for (OrderItemVO orderItem : orderItemVOs) { - if (orderItem != null && pkOrderB.equals(orderItem.getPk_order_b())) { - found = true; - Date expectArriveDate = orderItem.getDplanarrvdate().toDate(); - if (expectArriveDate == null) { - throw new BusinessException("采购订单明细" + pkOrderB + "的计划到货时间不能为空"); - } + // 查找匹配的订单明细 + boolean found = false; + for (OrderItemVO orderItem : orderItemVOs) { + if (orderItem != null && pkOrderB.equals(orderItem.getPk_order_b())) { + found = true; + Date expectArriveDate = orderItem.getDplanarrvdate().toDate(); + if (expectArriveDate == null) { + throw new BusinessException("采购订单明细" + pkOrderB + "的计划到货时间不能为空"); + } - // 核心逻辑:只允许提前3天到货 - // 1. 计算预计到货时间前3天的日期(最早允许的制单日期) - Date earliestAllowedDate = addDays(expectArriveDate, -3); + // 核心逻辑:只允许提前3天到货 + // 1. 计算预计到货时间前3天的日期(最早允许的制单日期) + Date earliestAllowedDate = addDays(expectArriveDate, -3); - // 2. 判断规则 - boolean isTooEarly = arriveMakeDate.before(earliestAllowedDate); - boolean isTooLate = arriveMakeDate.after(expectArriveDate); + // 2. 判断规则 + boolean isTooEarly =clearTime(arriveMakeDate).before(clearTime(earliestAllowedDate)); +// boolean isTooLate = arriveMakeDate.after(expectArriveDate); - if (isTooEarly || isTooLate) { - String errorMsg; - if (isTooEarly) { - errorMsg = String.format( - "到货单制单日期(%s)早于采购订单预计到货时间(%s)超过3天,不允许保存。最早允许制单日期为%s。订单编号:%s,明细行号:%s", - formatDate(arriveMakeDate), - formatDate(expectArriveDate), - formatDate(earliestAllowedDate), - o.getHVO().getVbillcode(), - orderItem.getCrowno() - ); - } else { // isTooLate - errorMsg = String.format( - "到货单制单日期(%s)晚于采购订单预计到货时间(%s),不符合提前到货规则,不允许保存。订单编号:%s,明细行号:%s", - formatDate(arriveMakeDate), - formatDate(expectArriveDate), - o.getHVO().getVbillcode(), - orderItem.getCrowno() - ); - } - throw new BusinessException(errorMsg); - } - break; // 找到匹配明细后退出循环 - } - } +// if (isTooEarly || isTooLate) { + String errorMsg; + if (isTooEarly) { + errorMsg = String.format( + "到货单制单日期(%s)早于采购订单预计到货时间(%s)超过3天,不允许保存。最早允许制单日期为%s。订单编号:%s,明细行号:%s", + formatDate(arriveMakeDate), + formatDate(expectArriveDate), + formatDate(earliestAllowedDate), + o.getHVO().getVbillcode(), + orderItem.getCrowno() + ); +// } else { // isTooLate +// errorMsg = String.format( +// "到货单制单日期(%s)晚于采购订单预计到货时间(%s),不符合提前到货规则,不允许保存。订单编号:%s,明细行号:%s", +// formatDate(arriveMakeDate), +// formatDate(expectArriveDate), +// o.getHVO().getVbillcode(), +// orderItem.getCrowno() +// ); +// } + throw new BusinessException(errorMsg); + } + break; // 找到匹配明细后退出循环 + } + } - if (!found) { - throw new BusinessException("未找到采购订单" + pkOrder + "中ID为" + pkOrderB + "的明细"); - } + if (!found) { + throw new BusinessException("未找到采购订单" + pkOrder + "中ID为" + pkOrderB + "的明细"); + } - } catch (BusinessException e) { - // 直接抛出业务异常,中断流程 - throw e; - } catch (Exception e) { - // 捕获其他异常并包装为业务异常 - throw new BusinessException("校验采购订单与到货单时间关系时发生错误:" + e.getMessage(), e); - } - } - } + } catch (BusinessException e) { + // 直接抛出业务异常,中断流程 + throw e; + } catch (Exception e) { + // 捕获其他异常并包装为业务异常 + throw new BusinessException("校验采购订单与到货单时间关系时发生错误:" + e.getMessage(), e); + } + } + } - } catch (Exception e) { - throw new RuntimeException(e); - } + } catch (Exception e) { + throw new RuntimeException(e); + } @@ -160,6 +167,22 @@ public class CheckBillDateRule implements IRule { return DATE_FORMATTER.format(date); } } + /** + * 清除日期中的时间部分,只保留年月日 + */ + private static Date clearTime(Date date) { + if (date == null) { + return null; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + // 将时间部分设置为0 + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTime(); + } } From b265c73384bb4e36733ac95088e6097274d0cd8e Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 21 Oct 2025 18:48:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B4=9F=E8=AE=A1=E5=88=92=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=9C=80=E7=BB=88=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transfer/action/Transfer20To21Action.java | 7 +- .../nc/bs/pu/m21/maintain/OrderSaveBP.java | 150 ++++++++++++++++++ .../rule/save/CheckOrderFinalNumRule.java | 37 +++++ 3 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 pu/src/private/nc/bs/pu/m21/maintain/OrderSaveBP.java create mode 100644 pu/src/private/nc/bs/pu/m21/maintain/rule/save/CheckOrderFinalNumRule.java diff --git a/pu/src/client/nccloud/web/pu/poorder/transfer/action/Transfer20To21Action.java b/pu/src/client/nccloud/web/pu/poorder/transfer/action/Transfer20To21Action.java index b7028010..2bdb93c6 100644 --- a/pu/src/client/nccloud/web/pu/poorder/transfer/action/Transfer20To21Action.java +++ b/pu/src/client/nccloud/web/pu/poorder/transfer/action/Transfer20To21Action.java @@ -26,6 +26,7 @@ import nc.vo.pub.CircularlyAccessibleValueObject; import nc.vo.pub.compiler.PfParameterVO; import nc.vo.pub.lang.UFDate; import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; import nc.vo.pubapp.pattern.exception.ExceptionUtils; import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill; import nc.vo.scmpub.res.billtype.POBillType; @@ -51,9 +52,9 @@ public class Transfer20To21Action extends AbstractTransferAction { PraybillVO[] sorceVOs = this.getAggVO(read); for (PraybillVO vo : sorceVOs) { for (PraybillItemVO itemVO:vo.getBVO()){ - if(null!=itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(itemVO.getAttributeValue("vbdef33"))<0){ - throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!"); - } + // if(null!=itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(new UFDouble(String.valueOf(itemVO.getAttributeValue("vbdef33"))))>0){ + // throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!"); + // } } } IPfExchangeService service = (IPfExchangeService)ServiceLocator.find(IPfExchangeService.class); diff --git a/pu/src/private/nc/bs/pu/m21/maintain/OrderSaveBP.java b/pu/src/private/nc/bs/pu/m21/maintain/OrderSaveBP.java new file mode 100644 index 00000000..0fb66842 --- /dev/null +++ b/pu/src/private/nc/bs/pu/m21/maintain/OrderSaveBP.java @@ -0,0 +1,150 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.bs.pu.m21.maintain; + +import nc.bs.pu.m21.maintain.rule.ATPBeforeUpdateRule; +import nc.bs.pu.m21.maintain.rule.ATPUpdateRule; +import nc.bs.pu.m21.maintain.rule.FeeGoodsMaterialBeforeRule; +import nc.bs.pu.m21.maintain.rule.MaintainMPPCtrlChkRule; +import nc.bs.pu.m21.maintain.rule.NumAndPriceCheckRule; +import nc.bs.pu.m21.maintain.rule.OrderScaleCheckRule; +import nc.bs.pu.m21.maintain.rule.PrayToPoLimitRule; +import nc.bs.pu.m21.maintain.rule.WriteBackSourceRule; +import nc.bs.pu.m21.maintain.rule.save.*; +import nc.bs.pu.m21.plugin.OrderPluginPoint; +import nc.bs.scmpub.rule.CrossRuleValidateRule; +import nc.bs.scmpub.rule.VOSagaFrozenValidateRule; +import nc.impl.pu.m21.action.rule.RowNoRule; +import nc.impl.pu.m21.action.rule.revise.DeleteRule; +import nc.impl.pubapp.bd.userdef.UserDefSaveRule; +import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; +import nc.vo.pu.m21.context.OrderContext; +import nc.vo.pu.m21.entity.OrderHeaderVO; +import nc.vo.pu.m21.entity.OrderItemVO; +import nc.vo.pu.m21.entity.OrderVO; +import nc.vo.pu.pub.rule.NewestOrgVersionFillRule; +import nc.vo.pu.pub.rule.TrantypeNotNullCheckRule; +import nc.vo.pu.pub.rule.pf.NoPassUpdateRule; +import nc.vo.pu.pub.sagas.PUSagasOperationEnum; +import nc.vo.pu.pub.util.BillInsert; +import nc.vo.pu.pub.util.BillUpdate; +import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.scmpub.msg.rule.UpdateMessageStatusRule; +import nc.vo.scmpub.res.billtype.POBillType; +import nc.vo.scmpub.rule.AutoMaterialAssignRule; +import nc.vo.scmpub.rule.PurchaseOrgEnableCheckRule; + +public class OrderSaveBP { + private OrderContext ctx; + + public OrderSaveBP(OrderContext ctx) { + this.ctx = ctx; + } + + public OrderVO[] save(OrderVO[] clientVos, OrderVO[] originVos) { + OrderVO[] returnedVos = null; + if (clientVos[0].getHVO().getStatus() != 2) { + CompareAroundProcesser processer = new CompareAroundProcesser(OrderPluginPoint.UPDATE); + this.addBeforeRule(processer, clientVos); + this.addAfterRule(processer); + processer.before(clientVos, originVos); + + try { + returnedVos = (OrderVO[])(new BillUpdate()).update(clientVos, originVos, "pk_order"); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + processer.after(returnedVos, originVos); + } else { + CompareAroundProcesser processer = new CompareAroundProcesser(OrderPluginPoint.INSERT); + this.addBeforeRule(processer, clientVos); + this.addAfterRule(processer); + processer.before(clientVos, originVos); + + try { + returnedVos = (OrderVO[])(new BillInsert()).insert(clientVos, "pk_order"); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + processer.after(returnedVos, null); + } + + return returnedVos; + } + + private void addAfterRule(CompareAroundProcesser processer) { + processer.addAfterRule(new BillCodeUniqueRule()); + processer.addAfterRule(new OrderSagasForzenAndCompensateRule("Save", PUSagasOperationEnum.OREDERSAVE)); + processer.addAfterRule(new PresentStocksChkRule(this.ctx)); + processer.addAfterRule(new EffectdateValidateRule()); + processer.addAfterRule(new DocVisibilityChkRule()); + processer.addAfterRule(new TranTypeChkRule()); + processer.addAfterRule(new CntPurMaterialChkRule()); + processer.addAfterRule(new MaxPriceChkRule(this.ctx)); + processer.addAfterRule(new WriteBackSourceRule(this.ctx)); + processer.addAfterRule(new WriteBackPriceForET()); + processer.addAfterRule(new ATPUpdateRule()); + processer.addAfterRule(new MaxStocksChkRule(this.ctx)); + processer.addAfterRule(new SaveEventAfterRule()); + processer.addAfterRule(new SourceToOrderMsgRule()); + processer.addAfterRule(new SaveTransferMsgRule()); + } + + private void addBeforeRule(CompareAroundProcesser processer, OrderVO[] orgUpdateVos) { + if (orgUpdateVos[0].getHVO().getStatus() != 2) { + processer.addBeforeRule(new VOSagaFrozenValidateRule(true)); + } + + processer.addBeforeRule(new CrossRuleValidateRule(POBillType.Order.getCode())); + processer.addBeforeRule(new SaveVOValidateRule()); + processer.addBeforeRule(new AccrateCheckRule()); + processer.addBeforeRule(new IsdepositCheckRule()); + processer.addBeforeRule(new RowNoRule()); + processer.addBeforeFinalRule(new NewestOrgVersionFillRule("pk_order")); + processer.addBeforeRule(new ItemEmptyRule()); + processer.addBeforeRule(new OrderScaleCheckRule()); + processer.addBeforeFinalRule(new TrantypeNotNullCheckRule()); + processer.addBeforeFinalRule(new NoPassUpdateRule()); + processer.addBeforeRule(new AutoMaterialAssignRule("pk_material", (String[])null, new String[]{"pk_org", "pk_apfinanceorg", "pk_apliabcenter", "pk_arrliabcenter", "pk_arrvstoorg", "pk_psfinanceorg", "pk_reqstoorg"})); + processer.addBeforeRule(new MaterialInStorckOrgRule()); + processer.addBeforeFinalRule(new ArrliabCenterRule()); + processer.addBeforeRule(new NumAndPriceCheckRule()); + processer.addBeforeRule(new PurchaseOrgEnableCheckRule()); + processer.addBeforeRule(new ArrvPlanChkRule(orgUpdateVos)); + processer.addBeforeRule(new PlanArriveDateCheckRule()); + processer.addBeforeRule(new DirectOrgCheckRule()); + processer.addBeforeRule(new DeleteRule()); + processer.addBeforeRule(new NecessaryFillRule()); + processer.addBeforeRule(new OrderDirectPurchaseUpdateRule()); + processer.addBeforeRule(new PrePayLimitCheckRule()); + processer.addBeforeRule(new OrderCodeProceRule()); + processer.addBeforeRule(new PrayToPoLimitRule()); + processer.addBeforeRule(new ATPBeforeUpdateRule()); + processer.addBeforeRule(new ConfirmOrderBiztypeRule()); + processer.addBeforeRule(new MaintainMPPCtrlChkRule()); + processer.addBeforeRule(new PurtypeSetterRule()); + processer.addBeforeRule(new UserDefSaveRule(new Class[]{OrderHeaderVO.class, OrderItemVO.class})); + processer.addBeforeFinalRule(new BorrowpurSetterRule()); + processer.addBeforeRule(new BatchCodeBeforeRule()); + processer.addBeforeRule(new SaveEventBeforeRule()); + processer.addBeforeRule(new IsBlistBeforeRule()); + processer.addBeforeRule(new PaymentCheckDataBeforeRule()); + processer.addBeforeRule(new AccountCheckBeforeRule()); + processer.addBeforeRule(new UpdateMessageStatusRule("csourceid", "csourcebid")); + processer.addBeforeRule(new FeeGoodsMaterialBeforeRule()); + processer.addBeforeRule(new PuCtExistCheckRule()); + processer.addBeforeRule(new PUOrderChkNumAndMnyRule()); + processer.addBeforeRule(new CheckMaterialOvidRule()); + processer.addBeforeRule(new CheckMaterialSaleRule()); + processer.addBeforeRule(new CheckFeeRule()); + processer.addBeforeRule(new FillNfeetaxmnyRule()); + processer.addBeforeRule(new FiterFeffdatetypeRule()); + processer.addBeforeRule(new CheckOrderFinalNumRule()); + } +} diff --git a/pu/src/private/nc/bs/pu/m21/maintain/rule/save/CheckOrderFinalNumRule.java b/pu/src/private/nc/bs/pu/m21/maintain/rule/save/CheckOrderFinalNumRule.java new file mode 100644 index 00000000..64963f75 --- /dev/null +++ b/pu/src/private/nc/bs/pu/m21/maintain/rule/save/CheckOrderFinalNumRule.java @@ -0,0 +1,37 @@ +package nc.bs.pu.m21.maintain.rule.save; + +import nc.impl.pubapp.pattern.rule.IRule; +import nc.vo.ml.NCLangRes4VoTransl; +import nc.vo.pu.m21.entity.OrderItemVO; +import nc.vo.pu.m21.entity.OrderVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.scmpub.util.ArrayUtil; + +/** + * 采购订单最终需求数量校验 + */ +public class CheckOrderFinalNumRule implements IRule { + public CheckOrderFinalNumRule() { + } + + public void process(OrderVO[] orderVOS) { + if (!ArrayUtil.isEmpty(orderVOS)) { + for (OrderVO vo : orderVOS) { + if(vo.getPrimaryKey()!=null){ + continue; + } + for (OrderItemVO itemVO:vo.getBVO()){ + if(null != itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(new UFDouble(String.valueOf(itemVO.getAttributeValue("vbdef33"))))>0){ + try { + throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!"); + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + } + } + } + } +} From 042de4bb85af6aeb67f89750efc47677f0efeb33 Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 21 Oct 2025 18:49:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A4=87=E6=96=99=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=B8=AD=EF=BC=88=E8=AE=A1=E5=88=92=E5=87=BA=E5=BA=93-?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E5=87=BA=E5=BA=93=EF=BC=89=E4=B8=BA=E8=B4=9F?= =?UTF-8?q?=E6=95=B0=E6=97=B6=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=AE=8C=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java b/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java index 6cd51bc5..d1bd24d1 100644 --- a/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java +++ b/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java @@ -78,7 +78,7 @@ public class ReWrite20ForOrderBP { for(PraybillItemVO itemvo : itemvos) { if (lbids.contains(itemvo.getPk_praybill_b())) { - if (itemvo.getNaccumulatenum().compareTo(itemvo.getNnum()) < 0 && ( null != itemvo.getAttributeValue("vbdef33") && itemvo.getNaccumulatenum().compareTo(new UFDouble((BigDecimal)itemvo.getAttributeValue("vbdef33"))) == 0)) { + if (itemvo.getNaccumulatenum().compareTo(itemvo.getNnum()) < 0 && ( null != itemvo.getAttributeValue("vbdef33") && itemvo.getNaccumulatenum().compareTo(new UFDouble(new UFDouble(String.valueOf(itemvo.getAttributeValue("vbdef33"))))) == 0)) { itemvo.setStatus(1); itemvo.setBrowclose(UFBoolean.FALSE); } else {