From 3f580f3da807c336f7098922e2b33e68972c0bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E8=B1=86=E8=B1=86?= <13356128+sunandmoon60@user.noreply.gitee.com> Date: Fri, 7 Nov 2025 12:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E8=B4=A7=E8=A1=A5=E8=B4=A7=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/pm/ReceiptNoticeSavePlugin.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java b/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java index e69de29..5c84883 100644 --- a/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java +++ b/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java @@ -0,0 +1,57 @@ +package tqq9.lc123.cloud.app.plugin.operate.pm; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.botp.runtime.BFRow; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.BeforeOperationArgs; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.botp.BFTrackerServiceHelper; +import kd.sdk.plugin.Plugin; +import tqq9.lc123.cloud.app.plugin.utils.AutoFixLinkUtil; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 单据操作插件 + */ +public class ReceiptNoticeSavePlugin extends AbstractOperationServicePlugIn implements Plugin { + private final static Log logger = LogFactory.getLog(OtherInWareSaveOpPlugin.class); + private static String RECEIPTNOTICE = "pm_receiptnotice";//收货通知单 + private static String PM_PURORDERBILL = "pm_purorderbill";//采购订单 + private static String billentry = "billentry";//分录标识 + + @Override + public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { + super.beforeExecuteOperationTransaction(e); + DynamicObject[] dataEntities1 = e.getDataEntities(); + if (dataEntities1.length > 0) { + + DynamicObject dynamicObject = dataEntities1[0]; + Map> id = BFTrackerServiceHelper.findDirtSourceBills(PM_PURORDERBILL, new Long[]{dynamicObject.getLong("id")}); + if (id==null||id.isEmpty()) { + DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry"); + if (billentry1.size() > 0) { + DynamicObject dynamicObject1 = billentry1.get(0); + String srcbillnumber = dynamicObject1.getString("srcbillnumber"); + DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle(PM_PURORDERBILL, new QFilter[]{new QFilter("billno", QCP.equals, srcbillnumber)}); + DynamicObjectCollection dynamicObjects = new DynamicObjectCollection(); + dynamicObjects.add(pm_purorderbill); + dynamicObjects.stream().collect(Collectors.toList()); + AutoFixLinkUtil fixLinkHelp = new AutoFixLinkUtil(); + fixLinkHelp.linkSourceRow(dynamicObject, dynamicObjects.stream().collect(Collectors.toList()), RECEIPTNOTICE, billentry, "srcbillentryid", + PM_PURORDERBILL, billentry, "", "billentry_lk"); + } + + } + } + + } + +} \ No newline at end of file