From ce36ea97587a33e60fa15c279a95a8b5c3cdf1d6 Mon Sep 17 00:00:00 2001 From: ljw Date: Thu, 31 Oct 2024 20:48:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=E8=A3=85=E7=AE=B1=E5=8D=95=E6=95=88?= =?UTF-8?q?=E9=AA=8C=202.=E5=8F=91=E8=BF=90=E6=98=8E=E7=BB=86=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=95=88=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/es/encasement/from/EncaseMentEdit.java | 206 +++++----- .../op/ShippingDetailsAuditOp.java | 383 +++++++++--------- 2 files changed, 317 insertions(+), 272 deletions(-) diff --git a/src/main/java/com/yem/wm/es/encasement/from/EncaseMentEdit.java b/src/main/java/com/yem/wm/es/encasement/from/EncaseMentEdit.java index 8a4e990c..0701749f 100644 --- a/src/main/java/com/yem/wm/es/encasement/from/EncaseMentEdit.java +++ b/src/main/java/com/yem/wm/es/encasement/from/EncaseMentEdit.java @@ -150,13 +150,23 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before deleteEntryRow(); break; case "statusconvertpjqr": - lockAccessoriesPackaging(false); + String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed"); + if (!yemWeightconfirmed.isEmpty()) { + lockAccessoriesPackaging(false); + } else { + this.getView().showMessage("锁定重量是否确认为空!!!"); + } break; case "statusconvertpjfqr": lockAccessoriesPackaging(true); break; case "statusconvertqrzj": - lockRemovable(false); + String yemWeightconfirmeds = (String) this.getModel().getValue("yem_weightconfirmed"); + if (!yemWeightconfirmeds.isEmpty()) { + lockRemovable(false); + } else { + this.getView().showMessage("锁定重量是否确认为空!!!"); + } break; case "statusconvertfqrzj": lockRemovable(true); @@ -175,98 +185,102 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before IDataModel model = this.getModel(); DynamicObject dataEntity = model.getDataEntity(true); if ("statusconvertpjqr".equals(operateKey) || "statusconvertqrzj".equals(operateKey)) { - - DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_im_packinginfor_pi"); - StringBuilder sb = new StringBuilder(); - for (DynamicObject dynamicObject : collection) { - int index = collection.indexOf(dynamicObject); - // 整柜重量 - BigDecimal wholew = dynamicObject.getBigDecimal("yem_wholew"); - if (YEM.isNotEmpty(wholew) && wholew.compareTo(new BigDecimal(25000)) > 0) { - sb.append(String.format("装柜信息第 [ %S ] 行的整柜重量超出25吨!", index + 1)).append("\r\n"); - } - } - - if ("statusconvertqrzj".equals(operateKey)) { - auditValidator(dataEntity); - - BigDecimal qty = BigDecimal.ZERO; - BigDecimal weight = BigDecimal.ZERO; - DynamicObjectCollection imMaterialinfoMi = dataEntity.getDynamicObjectCollection("yem_im_materialinfo_mi"); - BigDecimal sumwholenum = dataEntity.getBigDecimal("yem_sumwholenum"); - BigDecimal sumwholew = dataEntity.getBigDecimal("yem_sumwholew"); - StringBuilder sbStr = new StringBuilder(); - HashSet sourceIds = Sets.newHashSet(); - - for (DynamicObject dynamicObject : imMaterialinfoMi) { - int index = imMaterialinfoMi.indexOf(dynamicObject); - sourceIds.add(dynamicObject.getLong("yem_sourceentryid")); - BigDecimal totalqty = dynamicObject.getBigDecimal("yem_totalqty"); - BigDecimal netweightsum = dynamicObject.getBigDecimal("yem_netweightsum"); - qty = qty.add(totalqty); - weight = weight.add(netweightsum); - String businesssort = dynamicObject.getString("yem_businesssort"); - BigDecimal singlestandardqty = dynamicObject.getBigDecimal("yem_singlestandardqty"); - if ("Z".equals(businesssort) && singlestandardqty.compareTo(BigDecimal.ZERO) <= 0) { - sbStr.append(String.format("明细信息第 %s 行,单台标准件数必录,请检查!!", index + 1)).append("\r\n"); + String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed"); + if (!yemWeightconfirmed.isEmpty()) { + DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_im_packinginfor_pi"); + StringBuilder sb = new StringBuilder(); + for (DynamicObject dynamicObject : collection) { + int index = collection.indexOf(dynamicObject); + // 整柜重量 + BigDecimal wholew = dynamicObject.getBigDecimal("yem_wholew"); + if (YEM.isNotEmpty(wholew) && wholew.compareTo(new BigDecimal(25000)) > 0) { + sb.append(String.format("装柜信息第 [ %S ] 行的整柜重量超出25吨!", index + 1)).append("\r\n"); } } - if (qty.compareTo(sumwholenum) > 0) { - sbStr.append("明细信息总件数合计值不允许超过整机总件数,请检查!!\r\n"); + + if ("statusconvertqrzj".equals(operateKey)) { + auditValidator(dataEntity); + + BigDecimal qty = BigDecimal.ZERO; + BigDecimal weight = BigDecimal.ZERO; + DynamicObjectCollection imMaterialinfoMi = dataEntity.getDynamicObjectCollection("yem_im_materialinfo_mi"); + BigDecimal sumwholenum = dataEntity.getBigDecimal("yem_sumwholenum"); + BigDecimal sumwholew = dataEntity.getBigDecimal("yem_sumwholew"); + StringBuilder sbStr = new StringBuilder(); + HashSet sourceIds = Sets.newHashSet(); + + for (DynamicObject dynamicObject : imMaterialinfoMi) { + int index = imMaterialinfoMi.indexOf(dynamicObject); + sourceIds.add(dynamicObject.getLong("yem_sourceentryid")); + BigDecimal totalqty = dynamicObject.getBigDecimal("yem_totalqty"); + BigDecimal netweightsum = dynamicObject.getBigDecimal("yem_netweightsum"); + qty = qty.add(totalqty); + weight = weight.add(netweightsum); + String businesssort = dynamicObject.getString("yem_businesssort"); + BigDecimal singlestandardqty = dynamicObject.getBigDecimal("yem_singlestandardqty"); + if ("Z".equals(businesssort) && singlestandardqty.compareTo(BigDecimal.ZERO) <= 0) { + sbStr.append(String.format("明细信息第 %s 行,单台标准件数必录,请检查!!", index + 1)).append("\r\n"); + } + } + if (qty.compareTo(sumwholenum) > 0) { + sbStr.append("明细信息总件数合计值不允许超过整机总件数,请检查!!\r\n"); // throw new KDBizException("明细信息总件数合计值不允许超过整机总件数,请检查!!"); - } - if (weight.compareTo(sumwholew) > 0) { - sbStr.append("明细信息总净重合计值不允许超过整机总重量,请检查!!"); + } + if (weight.compareTo(sumwholew) > 0) { + sbStr.append("明细信息总净重合计值不允许超过整机总重量,请检查!!"); // throw new KDBizException("明细信息总净重合计值不允许超过整机总重量,请检查!!"); - } + } - if (sbStr.length() > 0) { - throw new KDBizException(sbStr.toString()); - } + if (sbStr.length() > 0) { + throw new KDBizException(sbStr.toString()); + } - String selectfields = DynamicObjectUtil.getSelectfields("yem_es_storagetrans"); - String storagetransSelectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_storagetrans", "yem_es_materialinfo"); - DynamicObject[] load = BusinessDataServiceHelper.load("yem_es_storagetrans", storagetransSelectfields, new QFilter[]{new QFilter("yem_es_materialinfo.id", "in", sourceIds)}); - for (DynamicObject dynamicObject : load) { - DynamicObjectCollection sourceCollection = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo"); - for (DynamicObject source : sourceCollection) { - long existId = source.getLong("id"); - for (DynamicObject target : imMaterialinfoMi) { - long sourceentryid = target.getLong("yem_sourceentryid"); - if (existId == sourceentryid) { - BigDecimal totalqty = target.getBigDecimal("yem_totalqty");//总件数 - BigDecimal netweightsum = target.getBigDecimal("yem_netweightsum");//总净重 - BigDecimal grossweightsum = target.getBigDecimal("yem_grossweightsum");//总毛重 + String selectfields = DynamicObjectUtil.getSelectfields("yem_es_storagetrans"); + String storagetransSelectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_storagetrans", "yem_es_materialinfo"); + DynamicObject[] load = BusinessDataServiceHelper.load("yem_es_storagetrans", storagetransSelectfields, new QFilter[]{new QFilter("yem_es_materialinfo.id", "in", sourceIds)}); + for (DynamicObject dynamicObject : load) { + DynamicObjectCollection sourceCollection = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo"); + for (DynamicObject source : sourceCollection) { + long existId = source.getLong("id"); + for (DynamicObject target : imMaterialinfoMi) { + long sourceentryid = target.getLong("yem_sourceentryid"); + if (existId == sourceentryid) { + BigDecimal totalqty = target.getBigDecimal("yem_totalqty");//总件数 + BigDecimal netweightsum = target.getBigDecimal("yem_netweightsum");//总净重 + BigDecimal grossweightsum = target.getBigDecimal("yem_grossweightsum");//总毛重 - if (totalqty.compareTo(BigDecimal.ZERO) > 0) { - source.set("yem_piece", totalqty); + if (totalqty.compareTo(BigDecimal.ZERO) > 0) { + source.set("yem_piece", totalqty); + } + if (netweightsum.compareTo(BigDecimal.ZERO) > 0) { + source.set("yem_netweightsum", netweightsum); + } + if (grossweightsum.compareTo(BigDecimal.ZERO) > 0) { + source.set("yem_grossweightsum", grossweightsum); + } + BigDecimal piece = source.getBigDecimal("yem_piece"); + netweightsum = source.getBigDecimal("yem_netweightsum"); + grossweightsum = source.getBigDecimal("yem_grossweightsum"); + source.set("yem_netweight", BigDecimalUtils.div(netweightsum, piece, 2)); + source.set("yem_grossweight", BigDecimalUtils.div(grossweightsum, piece, 2)); } - if (netweightsum.compareTo(BigDecimal.ZERO) > 0) { - source.set("yem_netweightsum", netweightsum); - } - if (grossweightsum.compareTo(BigDecimal.ZERO) > 0) { - source.set("yem_grossweightsum", grossweightsum); - } - BigDecimal piece = source.getBigDecimal("yem_piece"); - netweightsum = source.getBigDecimal("yem_netweightsum"); - grossweightsum = source.getBigDecimal("yem_grossweightsum"); - source.set("yem_netweight", BigDecimalUtils.div(netweightsum, piece, 2)); - source.set("yem_grossweight", BigDecimalUtils.div(grossweightsum, piece, 2)); } } } + if (load.length > 0) { + SaveServiceHelper.save(load); + } } - if (load.length > 0) { - SaveServiceHelper.save(load); - } - } - if (sb.length() > 0) { - sb.append("请确认是否继续?"); - ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(operateKey, this); - this.getView().showConfirm(sb.toString(), MessageBoxOptions.YesNo, confirmCallBackListener); + if (sb.length() > 0) { + sb.append("请确认是否继续?"); + ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(operateKey, this); + this.getView().showConfirm(sb.toString(), MessageBoxOptions.YesNo, confirmCallBackListener); + } else { + doConfirm(operateKey); + } } else { - doConfirm(operateKey); + this.getView().showMessage("锁定重量是否确认为空!!!"); } } @@ -344,19 +358,24 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); long currentUserId = YEM.getCurrentUserId(); DynamicObject user = BusinessDataServiceHelper.loadSingle(currentUserId, "bos_user"); - if ("statusconvertpjqr".equals(operateKey)) { + String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed"); + if (!yemWeightconfirmed.isEmpty()) { + if ("statusconvertpjqr".equals(operateKey)) { - dataEntity.set("yem_completionstatuspj", "B"); - dataEntity.set("yem_affirmmanpj", user); - dataEntity.set("yem_affirmdatepj", new Date()); + dataEntity.set("yem_completionstatuspj", "B"); + dataEntity.set("yem_affirmmanpj", user); + dataEntity.set("yem_affirmdatepj", new Date()); + } + if ("statusconvertqrzj".equals(operateKey)) { + + dataEntity.set("yem_completionstatuszj", "B"); + dataEntity.set("yem_affirmmanzj", user); + dataEntity.set("yem_affirmdatezj", new Date()); + } + } else { + this.getView().showMessage("锁定重量是否确认为空!!!"); } - if ("statusconvertqrzj".equals(operateKey)) { - - dataEntity.set("yem_completionstatuszj", "B"); - dataEntity.set("yem_affirmmanzj", user); - dataEntity.set("yem_affirmdatezj", new Date()); - } SaveServiceHelper.save(new DynamicObject[]{dataEntity}); this.getView().invokeOperation("refresh"); this.getView().showSuccessNotification("确认完成"); @@ -413,7 +432,12 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before if (MessageBoxResult.Yes.equals(result)) { if ("statusconvertpjqr".equals(callBackId) || "statusconvertqrzj".equals(callBackId)) { - doConfirm(callBackId); + String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed"); + if (!yemWeightconfirmed.isEmpty()) { + doConfirm(callBackId); + } else { + this.getView().showMessage("锁定重量是否确认为空!!!"); + } } } } diff --git a/src/main/java/com/yem/wm/es/shippingdetails/op/ShippingDetailsAuditOp.java b/src/main/java/com/yem/wm/es/shippingdetails/op/ShippingDetailsAuditOp.java index ca786b80..829e6f02 100644 --- a/src/main/java/com/yem/wm/es/shippingdetails/op/ShippingDetailsAuditOp.java +++ b/src/main/java/com/yem/wm/es/shippingdetails/op/ShippingDetailsAuditOp.java @@ -3,9 +3,11 @@ package com.yem.wm.es.shippingdetails.op; import com.alibaba.csp.sentinel.util.StringUtil; import com.yem.wm.es.contractamtlist.util.FunUtil; import com.yem.wm.es.shippingdetails.util.PaymentControlUtil; +import com.yem.wm.es.shippingdetails.validator.ShippingDetailsAuditValidator; import com.yem.wm.utils.YEM; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs; @@ -33,7 +35,7 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { @Override public void onAddValidators(AddValidatorsEventArgs e) { super.onAddValidators(e); -// e.addValidator(new ShippingDetailAuditValidator()); +// e.addValidator(new ShippingDetailsAuditValidator()); } @Override @@ -43,27 +45,100 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName()); collect(dataEntitie); arrearsAmt(dataEntitie); - SaveServiceHelper.save(new DynamicObject[]{dataEntitie}); +// if (dataEntitie.getDynamicObjectType().getName().equals("yem_xshippingdetails")) { +// DynamicObjectCollection yemEsSalesorderTotal = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total"); +// if (!yemEsSalesorderTotal.isEmpty()) { +// for (DynamicObject dynamicObject : yemEsSalesorderTotal) { +// BigDecimal yemQtyTl = dynamicObject.getBigDecimal("yem_qty_tl"); +// BigDecimal yemAllocateqtyTl = dynamicObject.getBigDecimal("yem_allocateqty_tl"); +// int i = dynamicObject.getInt("seq"); +// String yemAccesmaterial = dynamicObject.getString("yem_accesmaterial_tl.name"); +// boolean yemIsgifitTl = dynamicObject.getBoolean("yem_isgifit_tl"); +// +// if (yemQtyTl.compareTo(yemAllocateqtyTl) < 0&&!yemIsgifitTl&&) { +// this.getOperationResult().setSuccess(true); +// this.getOperationResult().setMessage("出运汇总页签,第" + i + "行物料" + yemAccesmaterial + ",已调数量" + yemQtyTl + ",出运数量" + yemAllocateqtyTl + ",不允许审核,请修改调拨后处理!"); // 提示内容 +// this.getOperationResult().setShowMessage(true); // 是否显示提示消息 +// } +// } +// } +// } + + SaveServiceHelper.save(new DynamicObject[]{dataEntitie}); + } } - } - /** - * @description 审核时生成出运汇总分录 - * @author power - */ - public static void collect(DynamicObject dataEntitie) { - DynamicObjectCollection materialinfos = dataEntitie.getDynamicObjectCollection("yem_es_materialinfo"); - DynamicObjectCollection followcars = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_p"); - DynamicObjectCollection collects = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total"); - if (materialinfos != null) { - for (DynamicObject materialinfo : materialinfos) { - if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) { - String businesssort = materialinfo.getString("yem_businesssort"); + /** + * @description 审核时生成出运汇总分录 + * @author power + */ + public static void collect (DynamicObject dataEntitie){ + DynamicObjectCollection materialinfos = dataEntitie.getDynamicObjectCollection("yem_es_materialinfo"); + DynamicObjectCollection followcars = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_p"); + DynamicObjectCollection collects = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total"); + if (materialinfos != null) { + for (DynamicObject materialinfo : materialinfos) { + if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) { + String businesssort = materialinfo.getString("yem_businesssort"); - boolean yemIfgift = materialinfo.getBoolean("yem_ifgift"); - if ("Z".equals(businesssort)&&!yemIfgift) { - DynamicObjectCollection completemachines = materialinfo.getDynamicObjectCollection("yem_es_salesorder_z"); - for (DynamicObject completemachine : completemachines) { + boolean yemIfgift = materialinfo.getBoolean("yem_ifgift"); + if ("Z".equals(businesssort) && !yemIfgift) { + DynamicObjectCollection completemachines = materialinfo.getDynamicObjectCollection("yem_es_salesorder_z"); + for (DynamicObject completemachine : completemachines) { + DynamicObject newEntryEntity = collects.addNew(); + + newEntryEntity.set("yem_isgifit_tl", yemIfgift); + newEntryEntity.set("yem_classification_tl", businesssort); + if (materialinfo.getDynamicObject("yem_materiel") != null) { + newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); + } + if (completemachine.getDynamicObject("yem_resourcescode") != null) { + newEntryEntity.set("yem_resource_tl", completemachine.getLong("yem_resourcescode.id")); + } + if (completemachine.getDynamicObject("yem_milltype") != null) { + newEntryEntity.set("yem_basicmodel_tl", completemachine.getLong("yem_milltype.id")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { + newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) { + newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) { + newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification")); + } + if (materialinfo.getDynamicObject("yem_unit") != null) { + newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); + } + newEntryEntity.set("yem_qty_tl", BigDecimal.ONE); + newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); + //销售单价(价格条款) + newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); + newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase")); + //销售金额(价格条款) + newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause")); + newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba")); + + if (materialinfo.getDynamicObject("yem_baseunit") != null) { + newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id")); + } + newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); + newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); + + if (StringUtil.isNotEmpty(completemachine.getString("yem_vehicleno"))) { + newEntryEntity.set("yem_zjnumber_tl", completemachine.getString("yem_vehicleno")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { + newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); + } + newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id")); + newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid")); + + // 汇总影响调拨价 + newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); + } + } + if ("P".equals(businesssort) && !yemIfgift) { DynamicObject newEntryEntity = collects.addNew(); newEntryEntity.set("yem_isgifit_tl", yemIfgift); @@ -71,11 +146,11 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { if (materialinfo.getDynamicObject("yem_materiel") != null) { newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); } - if (completemachine.getDynamicObject("yem_resourcescode") != null) { - newEntryEntity.set("yem_resource_tl", completemachine.getLong("yem_resourcescode.id")); + if (materialinfo.getDynamicObject("yem_resourcenog") != null) { + newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id")); } - if (completemachine.getDynamicObject("yem_milltype") != null) { - newEntryEntity.set("yem_basicmodel_tl", completemachine.getLong("yem_milltype.id")); + if (materialinfo.getDynamicObject("yem_productmodel") != null) { + newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id")); } if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); @@ -89,7 +164,7 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { if (materialinfo.getDynamicObject("yem_unit") != null) { newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); } - newEntryEntity.set("yem_qty_tl", BigDecimal.ONE); + newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty")); newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); //销售单价(价格条款) newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); @@ -104,9 +179,59 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); - if (StringUtil.isNotEmpty(completemachine.getString("yem_vehicleno"))) { - newEntryEntity.set("yem_zjnumber_tl", completemachine.getString("yem_vehicleno")); + if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { + newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); } + newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id")); + newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid")); + + // 汇总影响调拨价 + newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); + } + if (yemIfgift) { + DynamicObject newEntryEntity = collects.addNew(); + + newEntryEntity.set("yem_isgifit_tl", yemIfgift); + newEntryEntity.set("yem_classification_tl", businesssort); + if (materialinfo.getDynamicObject("yem_materiel") != null) { + newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); + } + if (materialinfo.getDynamicObject("yem_resourcenog") != null) { + newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id")); + } + if (materialinfo.getDynamicObject("yem_productmodel") != null) { + newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { + newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) { + newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname")); + } + if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) { + newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification")); + } + if (materialinfo.getDynamicObject("yem_unit") != null) { + newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); + } + newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty")); + newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); + //销售单价(价格条款) + newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); + newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase")); + //销售金额(价格条款) + newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause")); + newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba")); + + if (materialinfo.getDynamicObject("yem_baseunit") != null) { + newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id")); + } + newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); + newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); + +// if (materialinfo.getDynamicObject("yem_materiel")!=null) { +// newEntryEntity.set("yem_zjnumber_tl", materialinfo.getLong("yem_materiel.id")); +// } if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); } @@ -117,166 +242,62 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn { newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); } } - if ("P".equals(businesssort)&&!yemIfgift) { - DynamicObject newEntryEntity = collects.addNew(); - - newEntryEntity.set("yem_isgifit_tl", yemIfgift); - newEntryEntity.set("yem_classification_tl", businesssort); - if (materialinfo.getDynamicObject("yem_materiel") != null) { - newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); - } - if (materialinfo.getDynamicObject("yem_resourcenog") != null) { - newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id")); - } - if (materialinfo.getDynamicObject("yem_productmodel") != null) { - newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { - newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) { - newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) { - newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification")); - } - if (materialinfo.getDynamicObject("yem_unit") != null) { - newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); - } - newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty")); - newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); - //销售单价(价格条款) - newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); - newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase")); - //销售金额(价格条款) - newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause")); - newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba")); - - if (materialinfo.getDynamicObject("yem_baseunit") != null) { - newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id")); - } - newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); - newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); - - if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { - newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); - } - newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id")); - newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid")); - - // 汇总影响调拨价 - newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); - } - if (yemIfgift){ - DynamicObject newEntryEntity = collects.addNew(); - - newEntryEntity.set("yem_isgifit_tl", yemIfgift); - newEntryEntity.set("yem_classification_tl", businesssort); - if (materialinfo.getDynamicObject("yem_materiel") != null) { - newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); - } - if (materialinfo.getDynamicObject("yem_resourcenog") != null) { - newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id")); - } - if (materialinfo.getDynamicObject("yem_productmodel") != null) { - newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { - newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) { - newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname")); - } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) { - newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification")); - } - if (materialinfo.getDynamicObject("yem_unit") != null) { - newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); - } - newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty")); - newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); - //销售单价(价格条款) - newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); - newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase")); - //销售金额(价格条款) - newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause")); - newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba")); - - if (materialinfo.getDynamicObject("yem_baseunit") != null) { - newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id")); - } - newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); - newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); - -// if (materialinfo.getDynamicObject("yem_materiel")!=null) { -// newEntryEntity.set("yem_zjnumber_tl", materialinfo.getLong("yem_materiel.id")); -// } - if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { - newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); - } - newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id")); - newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid")); - - // 汇总影响调拨价 - newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); - } } } - } - if (followcars != null) { - for (DynamicObject followcar : followcars) { - DynamicObject newEntryEntity = collects.addNew(); - newEntryEntity.set("yem_isgifit_tl", true); - newEntryEntity.set("yem_classification_tl", "A"); - if (followcar.getDynamicObject("yem_accessorytype") != null) { - newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id")); - } - if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) { - newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype")); - } - if (followcar.getDynamicObject("yem_accesmaterial") != null) { - newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id")); - newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name")); - newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen")); - newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum")); - } - if (followcar.getDynamicObject("yem_acunit") != null) { - newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id")); - newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id")); - } - if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) { - newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p")); - } - newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty")); - newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty")); - newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p")); - newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id")); + if (followcars != null) { + for (DynamicObject followcar : followcars) { + DynamicObject newEntryEntity = collects.addNew(); + newEntryEntity.set("yem_isgifit_tl", true); + newEntryEntity.set("yem_classification_tl", "A"); + if (followcar.getDynamicObject("yem_accessorytype") != null) { + newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id")); + } + if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) { + newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype")); + } + if (followcar.getDynamicObject("yem_accesmaterial") != null) { + newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id")); + newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name")); + newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen")); + newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum")); + } + if (followcar.getDynamicObject("yem_acunit") != null) { + newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id")); + newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id")); + } + if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) { + newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p")); + } + newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty")); + newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty")); + newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p")); + newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id")); + } } + + } + /** + * @description 计算欠款金额 + * @author xwudd + * @param[1] dataEntity + * return + * @time 2023/11/9 14:24 + */ + + public static void arrearsAmt (DynamicObject dataEntity){ + String sourceBillType = dataEntity.getString("yem_sourcebilltype"); + long sourceBillId = dataEntity.getLong("yem_sourcebillid"); + DynamicObject saleOrder = BusinessDataServiceHelper.loadSingle(sourceBillId, sourceBillType); + String saleorderno = dataEntity.getString("yem_saleorderno"); + if (YEM.isEmpty(saleorderno)) return; + DynamicObject[] shipBills = getShipBills(saleOrder, dataEntity, "A");//出运 + DynamicObject[] payBills = getPayBills(saleOrder, dataEntity, "B");//收款单 + BigDecimal thisRealityAmt = PaymentControlUtil.getThisRealityAmt(saleOrder, shipBills, payBills, dataEntity); + dataEntity.set("yem_arrearsamt", thisRealityAmt);//本次发运欠款金额 + dataEntity.set("yem_arrearsamtapply", FunUtil.getAbs(thisRealityAmt));//本次发运应申请欠条金额 + } } - - - /** - * @description 计算欠款金额 - * @author xwudd - * @param[1] dataEntity - * return - * @time 2023/11/9 14:24 - */ - - public static void arrearsAmt(DynamicObject dataEntity) { - String sourceBillType = dataEntity.getString("yem_sourcebilltype"); - long sourceBillId = dataEntity.getLong("yem_sourcebillid"); - DynamicObject saleOrder = BusinessDataServiceHelper.loadSingle(sourceBillId, sourceBillType); - String saleorderno = dataEntity.getString("yem_saleorderno"); - if (YEM.isEmpty(saleorderno)) return; - DynamicObject[] shipBills = getShipBills(saleOrder, dataEntity, "A");//出运 - DynamicObject[] payBills = getPayBills(saleOrder, dataEntity, "B");//收款单 - BigDecimal thisRealityAmt = PaymentControlUtil.getThisRealityAmt(saleOrder, shipBills, payBills, dataEntity); - dataEntity.set("yem_arrearsamt", thisRealityAmt);//本次发运欠款金额 - dataEntity.set("yem_arrearsamtapply", FunUtil.getAbs(thisRealityAmt));//本次发运应申请欠条金额 - } -}