From 3e200c85e61b3ab5c15cff5ae4830e44340852a5 Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Thu, 18 Dec 2025 11:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=94=B6=E8=B4=A7=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BF=9D=E5=AD=98&=E5=88=A0=E9=99=A4=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E3=80=91=20=E6=93=8D=E4=BD=9C=E5=AE=8C=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=8F=8D=E5=86=99=E4=B8=8A=E6=B8=B8=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E3=80=90=E6=98=AF=E5=90=A6=E5=8F=AF=E5=81=9A?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E9=80=9A=E7=9F=A5=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eiptNoticeSaveAndDeleteToUpdPurbillOp.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSaveAndDeleteToUpdPurbillOp.java diff --git a/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSaveAndDeleteToUpdPurbillOp.java b/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSaveAndDeleteToUpdPurbillOp.java new file mode 100644 index 0000000..95044bc --- /dev/null +++ b/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSaveAndDeleteToUpdPurbillOp.java @@ -0,0 +1,65 @@ +package tqq9.lc123.cloud.app.plugin.operate.pm; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.operate.result.OperationResult; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.botp.BFTrackerServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; + +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +/** + * 收货通知单 保存 & 删除插件 + * 操作后上查采购订单,判断该采购订单是否全部下推收获通知 + * 如果采购订单明细行的采购数量 != 关联数量,则将采购订单下拉字段【是否可做收获通知 tqq9_sfkzsh】赋值为“true”,否则赋值为“false” + */ +public class ReceiptNoticeSaveAndDeleteToUpdPurbillOp extends AbstractOperationServicePlugIn { + + + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + OperationResult operationResult = this.getOperationResult(); + List successPkIds = operationResult.getSuccessPkIds(); + for (Object successPkId : successPkIds) { + Long id = (Long) successPkId; + Long[] idArr = new Long[]{id}; + Map> map = BFTrackerServiceHelper.findSourceBills("pm_receiptnotice", idArr); + for (String s : map.keySet()) { + if("pm_purorderbill".equals(s)){ + HashSet longs = map.get(s); + for (Long aLong : longs) { + DynamicObject bill = BusinessDataServiceHelper.loadSingle(aLong, s); + DynamicObjectCollection entries = bill.getDynamicObjectCollection("billentry"); + boolean isEquals = true;//采购订单分录中是否所有行中,采购数量 = 关联数量 + for (DynamicObject entry : entries) { + BigDecimal qty = entry.getBigDecimal("qty"); + BigDecimal joinqty = entry.getBigDecimal("joinqty"); + if(qty.compareTo(joinqty) != 0){ + isEquals = false; + break; + } + } + if(isEquals){ + bill.set("tqq9_sfkzsh", "false"); + }else{ + bill.set("tqq9_sfkzsh", "true"); + } + SaveServiceHelper.save(new DynamicObject[]{bill}); + } + } + + } + + + } + + + } +}