From fdcdab5ee770d3198a72579f2f56145cf47d04b9 Mon Sep 17 00:00:00 2001 From: sez Date: Thu, 11 Dec 2025 12:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=87=BA=E5=BA=93=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E9=80=89=E6=8B=A9=E6=89=B9=E5=8F=B7=E5=B8=A6=E5=87=BA?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=97=A5=E6=9C=9F=EF=BC=8C=E5=88=B0=E6=9C=9F?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E3=80=81=E7=94=9F=E4=BA=A7=E5=95=86=E3=80=81?= =?UTF-8?q?=E8=AE=B8=E5=8F=AF=E8=AF=81=E3=80=81=E6=B3=A8=E5=86=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/im/OtherOutApplyBillPlugin.java | 62 +++++++++++++++++-- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java index a6445be..4dd7d3a 100644 --- a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java +++ b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java @@ -13,12 +13,13 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import java.math.BigDecimal; +import java.util.Date; import java.util.EventObject; /** * 其他出库申请界面插件 */ -public class OtherOutApplyBillPlugin extends AbstractBillPlugIn { +public class OtherOutApplyBillPlugin extends AbstractBillPlugIn { @Override public void registerListener(EventObject e) { super.registerListener(e); @@ -92,14 +93,14 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn { if (StringUtils.equals("tqq9_materiel", name)) { ChangeData[] changeSet = e.getChangeSet(); DynamicObject newValue = (DynamicObject) changeSet[0].getNewValue();//物料库存信息 - if(newValue != null){ + if (newValue != null) { DynamicObject masterid = newValue.getDynamicObject("masterid");//物料 - if(masterid != null){ + if (masterid != null) { QFilter purinbillF = new QFilter("billentry.material.id", QCP.equals, newValue.getLong("id")); purinbillF = purinbillF.and("billstatus", QCP.equals, "C"); //price DynamicObject[] purinbills = BusinessDataServiceHelper.load("im_purinbill", "id,billno,billentry.material,billentry.price", purinbillF.toArray(), "auditdate desc"); - if(purinbills != null && purinbills.length > 0){ + if (purinbills != null && purinbills.length > 0) { DynamicObject purinbill = purinbills[0]; DynamicObjectCollection billentry = purinbill.getDynamicObjectCollection("billentry"); for (DynamicObject dynamicObject : billentry) { @@ -114,8 +115,59 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn { } } } - } + if (StringUtils.equals("tqq9_lotnumber", name)) { + ChangeData[] changeSet = e.getChangeSet(); + int rowIndex = changeSet[0].getRowIndex(); + String lotNumber = (String) changeSet[0].getNewValue(); + DynamicObject tqq9_materiel = (DynamicObject) this.getModel().getValue("tqq9_materiel"); + if (StringUtils.isNotBlank(lotNumber) && null != tqq9_materiel) { + DynamicObject[] objects = BusinessDataServiceHelper.load("im_inv_realbalance", + "id,keycol,material,lotnum,producedate,expirydate,tqq9_goods,tqq9_registration" + , new QFilter[]{new QFilter("lotnum", QCP.equals, lotNumber), new QFilter("material", QCP.equals, tqq9_materiel.getDynamicObject("masterid").getLong("id"))}); + if (null != objects && objects.length > 0) { + if (objects.length == 1) { + DynamicObject object = objects[0]; + Date producedate = object.getDate("producedate"); + Date expirydate = object.getDate("expirydate"); + DynamicObject tqq9_registration = object.getDynamicObject("tqq9_registration"); + StringBuilder tqq9_cs = new StringBuilder(); + StringBuilder tqq9_licenseno = new StringBuilder(); + if (null != tqq9_registration) { + tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", + "id,number,tqq9_entry.tqq9_e_supplier,tqq9_entry.tqq9_e_supno,tqq9_proxy,tqq9_proxyno" + , new QFilter[]{new QFilter("id", QCP.equals, tqq9_registration.getLong("id"))}); + DynamicObjectCollection tqq9_entry = tqq9_registration.getDynamicObjectCollection("tqq9_entry"); + for (int i = 0; i < tqq9_entry.size(); i++) { + DynamicObject dynamicObject = tqq9_entry.get(i); + DynamicObject tqq9_e_supplier = dynamicObject.getDynamicObject("tqq9_e_supplier"); + if (null != tqq9_e_supplier) { + tqq9_cs.append(tqq9_e_supplier.getString("name")); + if (i != tqq9_entry.size() - 1) { + tqq9_cs.append("#"); + } + } + String tqq9_e_supno = dynamicObject.getString("tqq9_e_supno"); + if (StringUtils.isNotBlank(tqq9_e_supno)) { + tqq9_licenseno.append(tqq9_e_supno); + if (i != tqq9_entry.size() - 1) { + tqq9_licenseno.append("#"); + } + } + } + } + this.getModel().setValue("tqq9_producedate", producedate, rowIndex); + this.getModel().setValue("tqq9_expirydate", expirydate, rowIndex); + this.getModel().setValue("tqq9_cs", tqq9_cs.toString(), rowIndex); + this.getModel().setValue("tqq9_licenseno", tqq9_licenseno.toString(), rowIndex); + this.getModel().setValue("tqq9_zczh", tqq9_registration, rowIndex); + } + } + + } + } + + } // /**