diff --git a/lc123/cloud/app/plugin/operate/im/PurOrderPushReceiptNoticePlugin.java b/lc123/cloud/app/plugin/operate/im/PurOrderPushReceiptNoticePlugin.java index 452ea8b..2e9c705 100644 --- a/lc123/cloud/app/plugin/operate/im/PurOrderPushReceiptNoticePlugin.java +++ b/lc123/cloud/app/plugin/operate/im/PurOrderPushReceiptNoticePlugin.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.metadata.IDataEntityProperty; +import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection; import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.ExtendedDataEntitySet; import kd.bos.entity.botp.plugin.AbstractConvertPlugIn; @@ -15,6 +17,7 @@ import kd.sdk.plugin.Plugin; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; +import java.util.ListIterator; import java.util.Map; /** @@ -35,8 +38,10 @@ public class PurOrderPushReceiptNoticePlugin extends AbstractConvertPlugIn imple //收货通知单 DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("billentry"); - for (DynamicObject dynamicObject : dynamicObjectCollection) { - String mainbillentryid = dynamicObject.getString("mainbillentryid"); + ListIterator iterator = dynamicObjectCollection.listIterator(); + while (iterator.hasNext()) { + DynamicObject entry = iterator.next(); + String mainbillentryid = entry.getString("mainbillentryid"); //核心单据号一致,修改补货数量 if (variables.containsKey(mainbillentryid)) { String jsonString = variables.get(mainbillentryid); @@ -51,8 +56,25 @@ public class PurOrderPushReceiptNoticePlugin extends AbstractConvertPlugIn imple for (int i = 0; i < jsonList.size(); i++) { HashMap jsonMap = jsonList.get(i); BigDecimal entry_qty = new BigDecimal(jsonMap.get("qty").toString()).negate();//入库数量 - dynamicObject.set("qty", entry_qty);//数量 - dynamicObject.set("baseqty", entry_qty);//基本数量 + if (i == 0) { + entry.set("qty", entry_qty);//数量 + entry.set("baseqty", entry_qty);//基本数量 + DynamicObjectCollection billentry_lk = entry.getDynamicObjectCollection("billentry_lk"); + billentry_lk.clear(); + }else{ + DataEntityPropertyCollection properties = entry.getDataEntityType().getProperties(); + // 后续循环复制entry并赋值 + DynamicObject newEntry = new DynamicObject(dynamicObjectCollection.getDynamicObjectType()); + for (IDataEntityProperty property : properties) { + newEntry.set(property.getName(), entry.get(property.getName())); + } + entry.set("qty", entry_qty);//数量 + entry.set("baseqty", entry_qty);//基本数量 + DynamicObjectCollection billentry_lk = newEntry.getDynamicObjectCollection("billentry_lk"); + billentry_lk.clear(); + // 处理完新entry后的逻辑(比如加入集合或其他操作) + iterator.add(newEntry); + } } } diff --git a/lc123/cloud/app/plugin/operate/pm/OtherInWareSaveOpPlugin.java b/lc123/cloud/app/plugin/operate/pm/OtherInWareSaveOpPlugin.java index 410867d..fd4490b 100644 --- a/lc123/cloud/app/plugin/operate/pm/OtherInWareSaveOpPlugin.java +++ b/lc123/cloud/app/plugin/operate/pm/OtherInWareSaveOpPlugin.java @@ -2,6 +2,7 @@ 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; @@ -9,9 +10,12 @@ 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; /** @@ -30,7 +34,8 @@ public class OtherInWareSaveOpPlugin extends AbstractOperationServicePlugIn impl if (dataEntities1.length > 0) { DynamicObject dynamicObject = dataEntities1[0]; - if (dynamicObject.getBoolean("tqq9_isrebulidlink")) { + Map> id = BFTrackerServiceHelper.findDirtSourceBills(TQQ9_OTHERINAPPLY, new Long[]{dynamicObject.getLong("id")}); + if (id==null||id.isEmpty()) { DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry"); if (billentry1.size() > 0) { DynamicObject dynamicObject1 = billentry1.get(0); diff --git a/lc123/cloud/app/plugin/operate/pm/PurInWareSaveOpPlugin.java b/lc123/cloud/app/plugin/operate/pm/PurInWareSaveOpPlugin.java index 9dbcad5..00d5d35 100644 --- a/lc123/cloud/app/plugin/operate/pm/PurInWareSaveOpPlugin.java +++ b/lc123/cloud/app/plugin/operate/pm/PurInWareSaveOpPlugin.java @@ -20,7 +20,6 @@ import java.util.stream.Collectors; public class PurInWareSaveOpPlugin extends AbstractOperationServicePlugIn implements Plugin { private final static Log logger = LogFactory.getLog(PurInWareSaveOpPlugin.class); private static String IM_PURINBILL = "im_purinbill";//采购入库单 - private static String PM_RECEIPTNOTICE = "pm_receiptnotice";//收货通知 private static String billentry = "billentry";//分录标识 @Override diff --git a/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java b/lc123/cloud/app/plugin/operate/pm/ReceiptNoticeSavePlugin.java new file mode 100644 index 0000000..e69de29 diff --git a/lc123/cloud/app/plugin/operate/pm/SaleOutWareSaveOpPlugin.java b/lc123/cloud/app/plugin/operate/pm/SaleOutWareSaveOpPlugin.java index 58fea9c..88feb63 100644 --- a/lc123/cloud/app/plugin/operate/pm/SaleOutWareSaveOpPlugin.java +++ b/lc123/cloud/app/plugin/operate/pm/SaleOutWareSaveOpPlugin.java @@ -19,8 +19,8 @@ import java.util.stream.Collectors; */ public class SaleOutWareSaveOpPlugin extends AbstractOperationServicePlugIn implements Plugin { private final static Log logger = LogFactory.getLog(PurInWareSaveOpPlugin.class); - private static String IM_OTHEROUTBILL = "im_otheroutbill";//其他出库 - private static String TQQ9_OTHEROUTAPPLY = "tqq9_otheroutapply";//其他出库申请 + private static String SM_DELIVERNOTICE = "sm_delivernotice";//发货通知单 + private static String IM_SALOUTBILL = "im_saloutbill";//销售出库单 private static String billentry = "billentry";//分录标识 @Override @@ -41,7 +41,7 @@ public class SaleOutWareSaveOpPlugin extends AbstractOperationServicePlugIn impl dynamicObjects.add(pm_purorderbill); dynamicObjects.stream().collect(Collectors.toList()); AutoFixLinkUtil fixLinkHelp = new AutoFixLinkUtil(); - fixLinkHelp.linkSourceRow(dynamicObject, dynamicObjects.stream().collect(Collectors.toList()), IM_OTHEROUTBILL, billentry, "srcbillentryid", + fixLinkHelp.linkSourceRow(dynamicObject, dynamicObjects.stream().collect(Collectors.toList()), IM_SALOUTBILL, billentry, "srcbillentryid", srcbillentity, billentry, "", "billentry_lk"); }