From 09b4a836018261b2d7b2ff5281c908def680a961 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, 17 Nov 2025 18:15:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BA=93=E5=8C=BA=202.=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/WMSPurInController.java | 15 ++++- .../api/controller/WMSSaleOutController.java | 12 ++++ .../form/im/OtherOutApplyBillPlugin.java | 64 +++++++++++-------- .../plugin/form/sys/SupplierFormPlugin.java | 2 - .../OtherInApplyPushOtherInConvertPlugin.java | 19 ++++++ ...therOutApplyPushOtherOutConvertPlugin.java | 19 ++++++ .../plugin/operate/im/PurInConvertPlugin.java | 19 ++++++ .../im/PurOrderPushPurRefundConverPlugin.java | 27 +++++--- .../operate/im/SaleOutBillConvertPlugin.java | 19 ++++++ .../operate/sys/RebateRuleOpPlugin.java | 40 ++++++++++++ 10 files changed, 194 insertions(+), 42 deletions(-) diff --git a/lc123/cloud/app/api/controller/WMSPurInController.java b/lc123/cloud/app/api/controller/WMSPurInController.java index 5f07590..a0fe190 100644 --- a/lc123/cloud/app/api/controller/WMSPurInController.java +++ b/lc123/cloud/app/api/controller/WMSPurInController.java @@ -118,7 +118,6 @@ public class WMSPurInController { errormsg = "传入参数 VoucherType 为无效值"; resultExt = ApiResultExt.errorRetrun(entityType, errormsg, error, resultExt); return CustomApiResult.success(resultExt); - } //必填项校验 if (ApiResultExt.validateRequired(VoucherType, "String")) { @@ -203,7 +202,6 @@ public class WMSPurInController { detailObject.put("VoucherType", VoucherType); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject); - } //开始下推 String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则"); @@ -232,7 +230,6 @@ public class WMSPurInController { resultBean.setId(next.toString()); resultBean.setBillStatus(true); } -// results.add(resultBean); //开始提交 OperateOption operateOption = OperateOption.create(); OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption); @@ -612,6 +609,7 @@ public class WMSPurInController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String toZone = orderLine.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -637,6 +635,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -655,6 +654,7 @@ public class WMSPurInController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String toZone = orderLine1.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -680,6 +680,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -777,6 +778,7 @@ public class WMSPurInController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String toZone = orderLine.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -802,6 +804,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -820,6 +823,7 @@ public class WMSPurInController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String toZone = orderLine1.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -845,6 +849,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -945,6 +950,7 @@ public class WMSPurInController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String toZone = orderLine.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -970,6 +976,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -988,6 +995,7 @@ public class WMSPurInController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String toZone = orderLine1.getString("toZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -1013,6 +1021,7 @@ public class WMSPurInController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("toZone", toZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); diff --git a/lc123/cloud/app/api/controller/WMSSaleOutController.java b/lc123/cloud/app/api/controller/WMSSaleOutController.java index 4be83e4..97693cd 100644 --- a/lc123/cloud/app/api/controller/WMSSaleOutController.java +++ b/lc123/cloud/app/api/controller/WMSSaleOutController.java @@ -605,6 +605,7 @@ public class WMSSaleOutController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String fromZone = orderLine.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -630,6 +631,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -648,6 +650,7 @@ public class WMSSaleOutController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String fromZone = orderLine1.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -673,6 +676,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -770,6 +774,7 @@ public class WMSSaleOutController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String fromZone = orderLine.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -795,6 +800,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -813,6 +819,7 @@ public class WMSSaleOutController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String fromZone = orderLine1.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -838,6 +845,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -949,6 +957,7 @@ public class WMSSaleOutController { Date productDate = orderLine.getDate("productDate");//生产日期 Date expireDate = orderLine.getDate("expireDate");//失效期 String batchCode = orderLine.getString("batchCode");//批次 + String fromZone = orderLine.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -974,6 +983,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); @@ -992,6 +1002,7 @@ public class WMSSaleOutController { Date productDate = orderLine1.getDate("productDate");//生产日期 Date expireDate = orderLine1.getDate("expireDate");//失效期 String batchCode = orderLine1.getString("batchCode");//批次 + String fromZone = orderLine1.getString("fromZone");//库区 String key1 = null;//注册证号 String key3 = null;//生产许可证 String key2 = null;//生产厂商 @@ -1017,6 +1028,7 @@ public class WMSSaleOutController { detailObject.put("manufactureDate", productDate); detailObject.put("expirationDate", expireDate); detailObject.put("batch", batchCode); + detailObject.put("fromZone", fromZone); detailObject.put("registrationCode", key1); detailObject.put("licenceCode", key3); detailObject.put("producer", key2); diff --git a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java index ddaec83..11d3d57 100644 --- a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java +++ b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java @@ -1,12 +1,9 @@ package tqq9.lc123.cloud.app.plugin.form.im; -import kd.bos.algo.DataSet; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.utils.StringUtils; -import kd.bos.db.DB; -import kd.bos.db.DBRoute; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; @@ -16,10 +13,10 @@ import kd.bos.form.field.BasedataEdit; import kd.bos.form.field.events.BeforeF7SelectEvent; import kd.bos.form.field.events.BeforeF7SelectListener; import kd.bos.list.ListShowParameter; -import kd.bos.orm.ORM; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; import java.math.BigDecimal; import java.util.Date; @@ -127,30 +124,30 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor } } } - //批号带出批次可用量 - if (StringUtils.equals("tqq9_lot", name)) { - ChangeData changeData = e.getChangeSet()[0]; - int rowIndex = changeData.getRowIndex(); - DynamicObject material = (DynamicObject)model.getValue("tqq9_materiel", rowIndex);//物料库存信息 - DynamicObject tqq9_lot = (DynamicObject)model.getValue("tqq9_lot", rowIndex);//批号 - if(material!=null){ - DynamicObject masterid = material.getDynamicObject("masterid");//物料 - if(masterid!=null&&tqq9_lot!=null){ - String id = masterid.getString("id"); - String tqq9_phno = tqq9_lot.getString("number");//批号 - String sql = "/*dialect*/ select sum(fbaseqty) useqty from t_im_inv_realbalance where fmaterialid ='"+id+"' and flotnum ='"+tqq9_phno+"'" ; - DataSet pzDataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("scm"), sql); - DataSet copy = pzDataSet.copy(); - DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy); - if(dynamicObjects.size()>0){ - BigDecimal useqty = dynamicObjects.get(0).getBigDecimal("useqty"); - model.setValue("tqq9_pckyamount",useqty,rowIndex); - this.getView().updateView(); - } - } - - } - } +// //批号带出批次可用量 +// if (StringUtils.equals("tqq9_lot", name)) { +// ChangeData changeData = e.getChangeSet()[0]; +// int rowIndex = changeData.getRowIndex(); +// DynamicObject material = (DynamicObject)model.getValue("tqq9_materiel", rowIndex);//物料库存信息 +// DynamicObject tqq9_lot = (DynamicObject)model.getValue("tqq9_lot", rowIndex);//批号 +// if(material!=null){ +// DynamicObject masterid = material.getDynamicObject("masterid");//物料 +// if(masterid!=null&&tqq9_lot!=null){ +// String id = masterid.getString("id"); +// String tqq9_phno = tqq9_lot.getString("number");//批号 +// String sql = "/*dialect*/ select sum(fbaseqty) useqty from t_im_inv_realbalance where fmaterialid ='"+id+"' and flotnum ='"+tqq9_phno+"'" ; +// DataSet pzDataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("scm"), sql); +// DataSet copy = pzDataSet.copy(); +// DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy); +// if(dynamicObjects.size()>0){ +// BigDecimal useqty = dynamicObjects.get(0).getBigDecimal("useqty"); +// model.setValue("tqq9_pckyamount",useqty,rowIndex); +// this.getView().updateView(); +// } +// } +// +// } +// } } @@ -170,6 +167,17 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor map.put("billno", billno); this.getView().returnDataToParent(map); this.getView().close(); + }else if(StringUtils.equals("submit", itemKey)){ + DynamicObject dataEntity = this.getModel().getDataEntity(true); + DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity"); + for (DynamicObject dynamicObject : entryentity) { + String tqq9_lotnumber = dynamicObject.getString("tqq9_lotnumber");//批号 + DynamicObject bd_lot= BusinessDataServiceHelper.loadSingle("bd_lot", new QFilter[]{new QFilter("number", QCP.equals, tqq9_lotnumber)}); + dynamicObject.set("tqq9_lot",bd_lot); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + + + } } } diff --git a/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java b/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java index 89ce889..f530373 100644 --- a/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java +++ b/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java @@ -66,8 +66,6 @@ public class SupplierFormPlugin extends AbstractListPlugin implements Plugin { param.setCustomParam("ids", ids.toString()); param.getOpenStyle().setShowType(ShowType.Modal); this.getView().showForm(param); - } else { - this.getView().showErrorNotification("请先选中供应商数据"); } } diff --git a/lc123/cloud/app/plugin/operate/im/OtherInApplyPushOtherInConvertPlugin.java b/lc123/cloud/app/plugin/operate/im/OtherInApplyPushOtherInConvertPlugin.java index 6d031e6..e34869c 100644 --- a/lc123/cloud/app/plugin/operate/im/OtherInApplyPushOtherInConvertPlugin.java +++ b/lc123/cloud/app/plugin/operate/im/OtherInApplyPushOtherInConvertPlugin.java @@ -27,6 +27,17 @@ public class OtherInApplyPushOtherInConvertPlugin extends AbstractConvertPlugIn private final static Log logger = LogFactory.getLog(OtherInApplyPushOtherInConvertPlugin.class); private static String OTHERINBILL = "im_otherinbill"; + private final static HashMap wareTypeMap = new HashMap() {{ + put("地堆区", "SHZC01"); + put("存储区", "SHZC01"); + put("立库区", "SHZC01"); + put("新仓", "SHZC01"); + put("破损区", "SHZC02"); + put("零拣区", "SHZC02"); + put("收货中转", "SHZC03"); + put("退货中转", "SHZC03"); + put("虚拟区", "SHZC03"); + }}; /** @@ -81,6 +92,12 @@ public class OtherInApplyPushOtherInConvertPlugin extends AbstractConvertPlugIn BigDecimal quantity = new BigDecimal(jsonMap.get("quantity").toString());//入库数量 String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次 + String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区 + DynamicObject bd_warehouse=null; + if(toZone!=null){ + String wareNumber = wareTypeMap.get(toZone); + bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)}); + } String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码 String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号 @@ -98,6 +115,7 @@ public class OtherInApplyPushOtherInConvertPlugin extends AbstractConvertPlugIn entry.set("producedate", manufactureDate); entry.set("expirydate", expirationDate); entry.set("lotnumber", batch); + entry.set("warehouse", bd_warehouse); entry.set("tqq9_wmsdetailid", wmsDetailId); entry.set("tqq9_licenseno", licenceCode); entry.set("tqq9_zczh", tqq9_registration); @@ -117,6 +135,7 @@ public class OtherInApplyPushOtherInConvertPlugin extends AbstractConvertPlugIn newEntry.set("producedate", manufactureDate); newEntry.set("expirydate", expirationDate); newEntry.set("lotnumber", batch); + newEntry.set("warehouse", bd_warehouse); newEntry.set("tqq9_wmsdetailid", wmsDetailId); newEntry.set("tqq9_licenseno", licenceCode); newEntry.set("tqq9_zczh", tqq9_registration); diff --git a/lc123/cloud/app/plugin/operate/im/OtherOutApplyPushOtherOutConvertPlugin.java b/lc123/cloud/app/plugin/operate/im/OtherOutApplyPushOtherOutConvertPlugin.java index 07347dc..004963f 100644 --- a/lc123/cloud/app/plugin/operate/im/OtherOutApplyPushOtherOutConvertPlugin.java +++ b/lc123/cloud/app/plugin/operate/im/OtherOutApplyPushOtherOutConvertPlugin.java @@ -27,6 +27,17 @@ public class OtherOutApplyPushOtherOutConvertPlugin extends AbstractConvertPlugI private final static Log logger = LogFactory.getLog(OtherOutApplyPushOtherOutConvertPlugin.class); private static String IM_OTHEROUTBILL = "im_otheroutbill"; + private final static HashMap wareTypeMap = new HashMap() {{ + put("地堆区", "SHZC01"); + put("存储区", "SHZC01"); + put("立库区", "SHZC01"); + put("新仓", "SHZC01"); + put("破损区", "SHZC02"); + put("零拣区", "SHZC02"); + put("收货中转", "SHZC03"); + put("退货中转", "SHZC03"); + put("虚拟区", "SHZC03"); + }}; /** @@ -81,6 +92,12 @@ public class OtherOutApplyPushOtherOutConvertPlugin extends AbstractConvertPlugI BigDecimal quantity = new BigDecimal(jsonMap.get("quantity").toString());//入库数量 String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次 + String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区 + DynamicObject bd_warehouse=null; + if(fromZone!=null){ + String wareNumber = wareTypeMap.get(fromZone); + bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)}); + } String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码 String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号 @@ -98,6 +115,7 @@ public class OtherOutApplyPushOtherOutConvertPlugin extends AbstractConvertPlugI entry.set("producedate", manufactureDate); entry.set("expirydate", expirationDate); entry.set("lotnumber", batch); + entry.set("warehouse", bd_warehouse); entry.set("tqq9_wmsdetailid", wmsDetailId); entry.set("tqq9_licenseno", licenceCode); entry.set("tqq9_zczh", tqq9_registration); @@ -117,6 +135,7 @@ public class OtherOutApplyPushOtherOutConvertPlugin extends AbstractConvertPlugI newEntry.set("producedate", manufactureDate); newEntry.set("expirydate", expirationDate); newEntry.set("lotnumber", batch); + newEntry.set("warehouse", bd_warehouse); newEntry.set("tqq9_wmsdetailid", wmsDetailId); newEntry.set("tqq9_licenseno", licenceCode); newEntry.set("tqq9_zczh", tqq9_registration); diff --git a/lc123/cloud/app/plugin/operate/im/PurInConvertPlugin.java b/lc123/cloud/app/plugin/operate/im/PurInConvertPlugin.java index 7ace034..08d681a 100644 --- a/lc123/cloud/app/plugin/operate/im/PurInConvertPlugin.java +++ b/lc123/cloud/app/plugin/operate/im/PurInConvertPlugin.java @@ -28,6 +28,17 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin private final static Log logger = LogFactory.getLog(PurInConvertPlugin.class); private static String IM_PURINBILL = "im_purinbill"; + private final static HashMap wareTypeMap = new HashMap() {{ + put("地堆区", "SHZC01"); + put("存储区", "SHZC01"); + put("立库区", "SHZC01"); + put("新仓", "SHZC01"); + put("破损区", "SHZC02"); + put("零拣区", "SHZC02"); + put("收货中转", "SHZC03"); + put("退货中转", "SHZC03"); + put("虚拟区", "SHZC03"); + }}; /** @@ -86,6 +97,12 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin quantity = new BigDecimal(jsonMap.get("quantity").toString()).negate();//入库数量 } String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次 + String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区 + DynamicObject bd_warehouse=null; + if(toZone!=null){ + String wareNumber = wareTypeMap.get(toZone); + bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)}); + } String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码 String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号 @@ -103,6 +120,7 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin entry.set("producedate", manufactureDate); entry.set("expirydate", expirationDate); entry.set("lotnumber", batch); + entry.set("warehouse", bd_warehouse); entry.set("tqq9_wmsdetailid", wmsDetailId); entry.set("tqq9_licenseno", licenceCode); entry.set("tqq9_registration", tqq9_registration); @@ -122,6 +140,7 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin newEntry.set("producedate", manufactureDate); newEntry.set("expirydate", expirationDate); newEntry.set("lotnumber", batch); + newEntry.set("warehouse", bd_warehouse); newEntry.set("tqq9_wmsdetailid", wmsDetailId); newEntry.set("tqq9_licenseno", licenceCode); newEntry.set("tqq9_registration", tqq9_registration); diff --git a/lc123/cloud/app/plugin/operate/im/PurOrderPushPurRefundConverPlugin.java b/lc123/cloud/app/plugin/operate/im/PurOrderPushPurRefundConverPlugin.java index 23b906e..380258d 100644 --- a/lc123/cloud/app/plugin/operate/im/PurOrderPushPurRefundConverPlugin.java +++ b/lc123/cloud/app/plugin/operate/im/PurOrderPushPurRefundConverPlugin.java @@ -15,10 +15,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.sdk.plugin.Plugin; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.ListIterator; -import java.util.Map; +import java.util.*; /** * 单据转换插件 @@ -63,7 +60,7 @@ public class PurOrderPushPurRefundConverPlugin extends AbstractConvertPlugIn imp BigDecimal zero = BigDecimal.ZERO; dynamicObjectCollection.clear(); if (im_purinblil != null) { - HashMap map = new HashMap<>(); + HashMap> map = new HashMap<>(); for (DynamicObject dynamicObject : im_purinblil) { DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry"); String billid = dynamicObject.getString("id"); @@ -199,20 +196,32 @@ public class PurOrderPushPurRefundConverPlugin extends AbstractConvertPlugIn imp dynamicObject1.set("tqq9_expiredate", expirydate); dynamicObject1.set("tqq9_shbillno", srcbillnumber); } else { - map.put(tqq9_inwarebillentryid, qty); + if (map.containsKey(tqq9_inwarebillentryid)) { + ArrayList entry_qty = map.get(tqq9_inwarebillentryid); + entry_qty.add(qty); + map.put(tqq9_inwarebillentryid, entry_qty); + }else{ + ArrayList objects = new ArrayList<>(); + objects.add(qty); + map.put(tqq9_inwarebillentryid, objects); + } } } } - for (Map.Entry entrySet : map.entrySet()) { + for (Map.Entry> entrySet : map.entrySet()) { String id = entrySet.getKey(); - BigDecimal qty1 = entrySet.getValue(); + ArrayList qtylist = entrySet.getValue(); ListIterator iterator = dynamicObjectCollection.listIterator(); while (iterator.hasNext()) { DynamicObject dynamicObject1 = iterator.next(); String inwarebillentryid = dynamicObject1.getString("tqq9_inwarebillentryid"); if (StringUtils.equals(inwarebillentryid, id)) { BigDecimal qty2 = dynamicObject1.getBigDecimal("qty"); - BigDecimal add = qty2.add(qty1); + BigDecimal add = qty2; + + for (BigDecimal bigDecimal : qtylist) { + add=add.add(bigDecimal); + } if (add.compareTo(BigDecimal.ZERO) > 0) { dynamicObject1.set("tqq9_inwarebillentryqty", add); dynamicObject1.set("tqq9_maxqty", add); diff --git a/lc123/cloud/app/plugin/operate/im/SaleOutBillConvertPlugin.java b/lc123/cloud/app/plugin/operate/im/SaleOutBillConvertPlugin.java index 75b5fc1..cd96984 100644 --- a/lc123/cloud/app/plugin/operate/im/SaleOutBillConvertPlugin.java +++ b/lc123/cloud/app/plugin/operate/im/SaleOutBillConvertPlugin.java @@ -27,6 +27,17 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P private final static Log logger = LogFactory.getLog(SaleOutBillConvertPlugin.class); private static String IM_SALOUTBILL = "im_saloutbill"; + private final static HashMap wareTypeMap = new HashMap() {{ + put("地堆区", "SHZC01"); + put("存储区", "SHZC01"); + put("立库区", "SHZC01"); + put("新仓", "SHZC01"); + put("破损区", "SHZC02"); + put("零拣区", "SHZC02"); + put("收货中转", "SHZC03"); + put("退货中转", "SHZC03"); + put("虚拟区", "SHZC03"); + }}; /** @@ -85,6 +96,12 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P quantity = new BigDecimal(jsonMap.get("quantity").toString()).negate();//入库数量 } String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次 + String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区 + DynamicObject bd_warehouse=null; + if(fromZone!=null){ + String wareNumber = wareTypeMap.get(fromZone); + bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)}); + } String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码 String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号 @@ -102,6 +119,7 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P entry.set("producedate", manufactureDate); entry.set("expirydate", expirationDate); entry.set("lotnumber", batch); + entry.set("warehouse", bd_warehouse); entry.set("tqq9_wmsdetailid", wmsDetailId); entry.set("tqq9_licenseno", licenceCode); entry.set("tqq9_registration", tqq9_registration); @@ -121,6 +139,7 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P newEntry.set("producedate", manufactureDate); newEntry.set("expirydate", expirationDate); newEntry.set("lotnumber", batch); + newEntry.set("warehouse", bd_warehouse); newEntry.set("tqq9_wmsdetailid", wmsDetailId); newEntry.set("tqq9_licenseno", licenceCode); newEntry.set("tqq9_registration", tqq9_registration); diff --git a/lc123/cloud/app/plugin/operate/sys/RebateRuleOpPlugin.java b/lc123/cloud/app/plugin/operate/sys/RebateRuleOpPlugin.java index cc274e0..2862b82 100644 --- a/lc123/cloud/app/plugin/operate/sys/RebateRuleOpPlugin.java +++ b/lc123/cloud/app/plugin/operate/sys/RebateRuleOpPlugin.java @@ -14,6 +14,7 @@ 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.eip.iscb.LCLogService; import tqq9.lc123.cloud.app.eip.iscb.impl.LCLogServiceImpl; @@ -205,6 +206,9 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement bodyMap.put("startTime", startTimeString); bodyMap.put("endTime", tqq9_enddateString); bodyMap.put("supplierIds", (supplierIds.length() == 0) ? null : supplierIds.substring(1)); + if(tqq9_estimatepro!=null&&tqq9_estimatepro.compareTo(BigDecimal.ZERO)>0){ + tqq9_estimatepro=tqq9_estimatepro.multiply(new BigDecimal(100)); + } bodyMap.put("predictedProportion", tqq9_estimatepro); bodyMap.put("predictedAggregateMoney", tqq9_targetamount); bodyMap.put("brandIds", (rebatebrandIds.length() == 0) ? null : rebatebrandIds.substring(1)); @@ -283,11 +287,47 @@ public class RebateRuleOpPlugin extends AbstractOperationServicePlugIn implement Integer data = map.getInteger("data"); if (data == null) { lcLogService.savelog("创建返利规则",Push_URL,true,false, bodyMap.toString(), bodyString); + dataEntity.set("tqq9_status","C"); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract");//采购合同 + tqq9_conm_purcontract = BusinessDataServiceHelper.loadSingle("v", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))}); + DynamicObjectCollection tqq9_entryentity = tqq9_conm_purcontract.getDynamicObjectCollection("tqq9_entryentity"); + for (DynamicObject dynamicObject : tqq9_entryentity) { + String rulename = dynamicObject.getString("tqq9_rulename"); + if(StringUtils.equals(rulename,name)){ + dynamicObject.set("tqq9_status","C"); + SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + } + } }else{ lcLogService.savelog("创建返利规则",Push_URL,true,true, bodyMap.toString(), bodyString); + dataEntity.set("tqq9_status","B"); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract");//采购合同 + tqq9_conm_purcontract = BusinessDataServiceHelper.loadSingle("v", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))}); + DynamicObjectCollection tqq9_entryentity = tqq9_conm_purcontract.getDynamicObjectCollection("tqq9_entryentity"); + for (DynamicObject dynamicObject : tqq9_entryentity) { + String rulename = dynamicObject.getString("tqq9_rulename"); + if(StringUtils.equals(rulename,name)){ + dynamicObject.set("tqq9_status","B"); + SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + } + } } } catch (IOException ex) { lcLogService.savelog("创建返利规则",Push_URL,true,false, bodyMap.toString(), "接口调用报错,无返回值"); + dataEntity.set("tqq9_status","C"); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract");//采购合同 + tqq9_conm_purcontract = BusinessDataServiceHelper.loadSingle("v", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))}); + DynamicObjectCollection tqq9_entryentity = tqq9_conm_purcontract.getDynamicObjectCollection("tqq9_entryentity"); + for (DynamicObject dynamicObject : tqq9_entryentity) { + String rulename = dynamicObject.getString("tqq9_rulename"); + if(StringUtils.equals(rulename,name)){ + dynamicObject.set("tqq9_status","C"); + SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + } + } throw new RuntimeException(ex); }