From 0e9fc7c25aec7cf5d59362d5ad40f5b4451cd916 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: Mon, 22 Dec 2025 11:21:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=87=87=E8=B4=AD=E9=80=80=E8=B4=A7=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=88=96=E6=8F=90=E4=BA=A4=E6=97=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E9=80=89=E6=8B=A9=E9=80=80=E8=B4=A7=E5=88=86=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/PurRefundApplySaveOpPlugin.java | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/lc123/cloud/app/plugin/operate/pm/PurRefundApplySaveOpPlugin.java b/lc123/cloud/app/plugin/operate/pm/PurRefundApplySaveOpPlugin.java index ccfc7f4..5460929 100644 --- a/lc123/cloud/app/plugin/operate/pm/PurRefundApplySaveOpPlugin.java +++ b/lc123/cloud/app/plugin/operate/pm/PurRefundApplySaveOpPlugin.java @@ -10,9 +10,11 @@ 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.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; import tqq9.lc123.cloud.app.plugin.utils.AutoFixLinkUtil; +import java.util.ListIterator; import java.util.stream.Collectors; /** @@ -31,11 +33,11 @@ public class PurRefundApplySaveOpPlugin extends AbstractOperationServicePlugIn i super.beforeExecuteOperationTransaction(e); DynamicObject[] dataEntities1 = e.getDataEntities(); logger.info("PurRefundApplySaveOpPlugin-start"); - logger.info("PurRefundApplySaveOpPlugin:单据数量"+dataEntities1.length); + logger.info("PurRefundApplySaveOpPlugin:单据数量" + dataEntities1.length); String operationKey = e.getOperationKey(); - if (dataEntities1.length > 0 && StringUtils.equals("save",operationKey)) { + if (dataEntities1.length > 0 && StringUtils.equals("save", operationKey)) { DynamicObject dynamicObject = dataEntities1[0]; - logger.info("PurRefundApplySaveOpPlugin:单据号"+dynamicObject.getString("billno")); + logger.info("PurRefundApplySaveOpPlugin:单据号" + dynamicObject.getString("billno")); DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry"); if (billentry1.size() > 0) { DynamicObject dynamicObject1 = billentry1.get(0); @@ -54,7 +56,32 @@ public class PurRefundApplySaveOpPlugin extends AbstractOperationServicePlugIn i } logger.info("PurRefundApplySaveOpPlugin-end"); - - + if (StringUtils.equals("save", operationKey)) { + for (DynamicObject dynamicObject : dataEntities1) { + DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry"); + ListIterator iterator = billentry.listIterator(); + while (iterator.hasNext()) { + DynamicObject next = iterator.next(); + Boolean tqq9_isreturn = next.getBoolean("tqq9_isreturn"); + if (!tqq9_isreturn) { + iterator.remove(); + } + } + } + } + if (StringUtils.equals("submit", operationKey)) { + for (DynamicObject dynamicObject : dataEntities1) { + DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry"); + ListIterator iterator = billentry.listIterator(); + while (iterator.hasNext()) { + DynamicObject next = iterator.next(); + Boolean tqq9_isreturn = next.getBoolean("tqq9_isreturn"); + if (!tqq9_isreturn) { + iterator.remove(); + } + } + } + SaveServiceHelper.save(dataEntities1); + } } } \ No newline at end of file