diff --git a/lc123/cloud/app/plugin/form/sys/GetGoodsByMaterialBillPlugin.java b/lc123/cloud/app/plugin/form/sys/GetGoodsByMaterialBillPlugin.java index 91a9ec4..e88b04e 100644 --- a/lc123/cloud/app/plugin/form/sys/GetGoodsByMaterialBillPlugin.java +++ b/lc123/cloud/app/plugin/form/sys/GetGoodsByMaterialBillPlugin.java @@ -3,9 +3,11 @@ package tqq9.lc123.cloud.app.plugin.form.sys; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; -import tqq9.lc123.cloud.app.plugin.utils.BaseDataMatchUtils; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; import java.util.Date; import java.util.Set; @@ -20,7 +22,8 @@ public class GetGoodsByMaterialBillPlugin extends AbstractBillPlugIn { private static Set materialFieldNameSet_1; private static Set materialFieldNameSet_2; private static Set materialFieldNameSet_3; - static{ + + static { materialFieldNameSet_1 = Stream.of("pm_purorderbill", "pm_receiptnotice", "im_purinbill", "sm_salorder", "sm_delivernotice", "im_saloutbill", "im_otheroutbill", "tqq9_otherinapply", "im_otherinbill", "im_adjustbill", "tqq9_shortagebill").collect(Collectors.toSet());//material materialFieldNameSet_2 = Stream.of("ar_busbill", "ar_finarbill", "ap_payapply", "ar_busbill", "ar_finarbill").collect(Collectors.toSet());//e_material @@ -36,41 +39,54 @@ public class GetGoodsByMaterialBillPlugin extends AbstractBillPlugIn { String materialFieldName = "material"; DynamicObject dataEntity = this.getModel().getDataEntity(true); String dataEntityName = dataEntity.getDataEntityType().getName(); - if(materialFieldNameSet_1.contains(dataEntityName)){ + if (materialFieldNameSet_1.contains(dataEntityName)) { materialFieldName = "material"; - }else if (materialFieldNameSet_2.contains(dataEntityName)){ + } else if (materialFieldNameSet_2.contains(dataEntityName)) { materialFieldName = "e_material"; - }else if (materialFieldNameSet_3.contains(dataEntityName)){ + } else if (materialFieldNameSet_3.contains(dataEntityName)) { materialFieldName = "tqq9_materiel"; } - - if(materialFieldName.equals(name) || "lotnumber".equals(name) || "producedate".equals(name) || "expirydate".equals(name)){ + if (materialFieldName.equals(name)) { DynamicObject material = (DynamicObject) this.getModel().getValue(materialFieldName, rowIndex); - String lotnumber = (String) this.getModel().getValue("lotnumber", rowIndex); - Date producedate = (Date) this.getModel().getValue("producedate", rowIndex); - Date expirydate = (Date) this.getModel().getValue("expirydate", rowIndex); - if(material != null){ - DynamicObject[] goodsArr = BaseDataMatchUtils.materialMatchGoods(material.getString("number"), lotnumber, producedate, expirydate, false); - if (goodsArr!=null&&goodsArr.length>0) { - this.getModel().setValue("tqq9_goods", goodsArr[0], rowIndex); + if (material != null) { + String number=null; + if (StringUtils.equals("bd_material", material.getDynamicObjectType().getName())) { + number = material.getString("number"); + }else{ + DynamicObject masterid = material.getDynamicObject("masterid"); + number = masterid.getString("number"); } + QFilter f1 = new QFilter("tqq9_mater.number", "=", number); + QFilter f5 = new QFilter("tqq9_isauto", "=", true); + DynamicObject[] goodsA = BusinessDataServiceHelper.load("tqq9_goodspackage", + "id,number,name,tqq9_mater.baseunit,tqq9_mater.modelnum,tqq9_isauto", + new QFilter[]{f1, f5}); + if (goodsA != null && goodsA.length > 0) { + this.getModel().setValue("tqq9_goods", goodsA[0], rowIndex); + } + } } // 形态转换单子明细 - if("im_adjustbill".equals(dataEntityName) ){ + if ("im_adjustbill".equals(dataEntityName)) { int parentRowIndex = changeSet[0].getParentRowIndex(); - if ("material1".equals(name) || "lotnumber".equals(name) || "producedate".equals(name) || "expirydate".equals(name)){ + if ("material1".equals(name) || "lotnumber".equals(name) || "producedate".equals(name) || "expirydate".equals(name)) { DynamicObject material = (DynamicObject) this.getModel().getValue("material1", rowIndex); String lotnumber = (String) this.getModel().getValue("lotnumber", rowIndex); Date producedate = (Date) this.getModel().getValue("producedate", rowIndex); Date expirydate = (Date) this.getModel().getValue("expirydate", rowIndex); - if(material != null){ - DynamicObject[] goodsArr = BaseDataMatchUtils.materialMatchGoods(material.getString("number"), lotnumber, producedate, expirydate, false); - this.getModel().setValue("tqq9_goods", goodsArr[0], rowIndex, parentRowIndex); + if (material != null) { + QFilter f1 = new QFilter("tqq9_mater.number", "=", material.getString("number")); + QFilter f5 = new QFilter("tqq9_isauto", "=", true); + DynamicObject[] goodsA = BusinessDataServiceHelper.load("tqq9_goodspackage", + "id,number,name,tqq9_mater.baseunit,tqq9_mater.modelnum,tqq9_isauto", + new QFilter[]{f1, f5}); + if (goodsA != null && goodsA.length > 0) { + this.getModel().setValue("tqq9_goods", goodsA[0], rowIndex); + } } } - } } } diff --git a/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java b/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java index be5fb28..6856a39 100644 --- a/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java +++ b/lc123/cloud/app/plugin/form/sys/SupplierFormPlugin.java @@ -142,13 +142,15 @@ public class SupplierFormPlugin extends AbstractListPlugin implements Plugin { stringBuilder.append(",").append("编码为 ").append(supNumber).append(" 的供应商反审核失败," + message); } String message = unauditResult.getMessage(); - String simpleMessage = unauditResult.getInteractionContext().getSimpleMessage(); - if (message != null) { + if(unauditResult.getInteractionContext().getSimpleMessage()!=null){ + String simpleMessage = unauditResult.getInteractionContext().getSimpleMessage(); + if (message != null) { + stringBuilder.append(",").append(simpleMessage); + } + } if (message != null) { stringBuilder.append(",").append(message); } - if (message != null) { - stringBuilder.append(",").append(simpleMessage); - } + } List successPkIds = unauditResult.getSuccessPkIds(); DynamicObject[] bd_suppliers1 = new DynamicObject[successPkIds.size()]; @@ -166,13 +168,16 @@ public class SupplierFormPlugin extends AbstractListPlugin implements Plugin { stringBuilder.append(",").append("编码为 ").append(supNumber).append(" 的供应商提交失败," + message); } String message = sumbitResult.getMessage(); - String simpleMessage = sumbitResult.getInteractionContext().getSimpleMessage(); + if(sumbitResult.getInteractionContext().getSimpleMessage()!=null){ + String simpleMessage = sumbitResult.getInteractionContext().getSimpleMessage(); + if (message != null) { + stringBuilder.append(",").append(simpleMessage); + } + } if (message != null) { stringBuilder.append(",").append(message); } - if (message != null) { - stringBuilder.append(",").append(simpleMessage); - } + } if (stringBuilder.length() > 0) { this.getView().showErrorNotification(stringBuilder.substring(1));