From 30cc6ecb30b9ec4208feff6a87a7ad2c8b700737 Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Fri, 31 Oct 2025 13:27:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E6=B3=9B=E5=BE=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=91=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lc123/cloud/app/plugin/utils/FWRestfulUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lc123/cloud/app/plugin/utils/FWRestfulUtils.java b/lc123/cloud/app/plugin/utils/FWRestfulUtils.java index a5722cd..a8f552c 100644 --- a/lc123/cloud/app/plugin/utils/FWRestfulUtils.java +++ b/lc123/cloud/app/plugin/utils/FWRestfulUtils.java @@ -194,7 +194,9 @@ public class FWRestfulUtils { //装填参数 List list = new ArrayList<>(); list.add(new BasicNameValuePair("mainData", JSON.toJSONString(mainData))); - list.add(new BasicNameValuePair("detailData", JSON.toJSONString(detailData))); + if (detailData != null && detailData.size() > 0) { + list.add(new BasicNameValuePair("detailData", JSON.toJSONString(detailData))); + } //restful接口url String url = null; From 6afda9b7c994b08737ecf90609d76e4c39103907 Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Fri, 31 Oct 2025 14:42:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=9F=AD=E7=BC=BA=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=8D=95=E6=A0=B9=E6=8D=AE=E7=89=A9=E6=96=99=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=89=B9=E5=8F=B7=E3=80=81=E6=95=88=E6=9C=9F?= =?UTF-8?q?=EF=BC=8C=E7=BB=99=E5=AF=B9=E5=BA=94=E5=AD=97=E6=AE=B5=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/im/ShortageBillPlugin.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 lc123/cloud/app/plugin/form/im/ShortageBillPlugin.java diff --git a/lc123/cloud/app/plugin/form/im/ShortageBillPlugin.java b/lc123/cloud/app/plugin/form/im/ShortageBillPlugin.java new file mode 100644 index 0000000..a23323a --- /dev/null +++ b/lc123/cloud/app/plugin/form/im/ShortageBillPlugin.java @@ -0,0 +1,82 @@ +package tqq9.lc123.cloud.app.plugin.form.im; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.EntityMetadataCache; +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.orm.ORM; +import kd.bos.servicehelper.BusinessDataServiceHelper; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; +import java.util.EventObject; + +/** + * 短缺处理表单插件 + */ +public class ShortageBillPlugin extends AbstractBillPlugIn { + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + DynamicObject dataEntity = this.getModel().getDataEntity(true); + DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry"); + for (int i = 0; i < billentries.size(); i++) { + DynamicObject billentry = billentries.get(i); + DynamicObject material = billentry.getDynamicObject("material"); + if(material != null){ + material = BusinessDataServiceHelper.loadSingle(material.getPkValue(), material.getDynamicObjectType().getName()); + boolean enablelot = material.getBoolean("enablelot");//是否启用批号 + boolean enableshelflifemgr = material.getBoolean("enableshelflifemgr");//是否启用保质期 + if(enablelot){ + this.getModel().setValue("lotnumber", "ZZZ", i); + }else{ + this.getModel().setValue("lotnumber", null, i); + } + if(enableshelflifemgr){ + this.getModel().setValue("producedate", new Date(), i); + LocalDate localDate = LocalDate.of(2999, 12, 31); + Date expirydate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); + this.getModel().setValue("expirydate", expirydate, i); + }else{ + this.getModel().setValue("producedate", null, i); + this.getModel().setValue("expirydate", null, i); + } + } + } + + } + + @Override + public void propertyChanged(PropertyChangedArgs e) { + super.propertyChanged(e); + String name = e.getProperty().getName(); + ChangeData[] changeSet = e.getChangeSet(); + int rowIndex = changeSet[0].getRowIndex(); + if("material".equals(name)){ + DynamicObject material = (DynamicObject) this.getModel().getValue("material", rowIndex);//物料库存信息 + if(material != null){ + material = BusinessDataServiceHelper.loadSingle(material.getPkValue(), material.getDynamicObjectType().getName()); + boolean enablelot = material.getBoolean("enablelot");//是否启用批号 + boolean enableshelflifemgr = material.getBoolean("enableshelflifemgr");//是否启用保质期 + if(enablelot){ + this.getModel().setValue("lotnumber", "ZZZ", rowIndex); + }else{ + this.getModel().setValue("lotnumber", null, rowIndex); + } + if(enableshelflifemgr){ + this.getModel().setValue("producedate", new Date(), rowIndex); + LocalDate localDate = LocalDate.of(2999, 12, 31); + Date expirydate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); + this.getModel().setValue("expirydate", expirydate, rowIndex); + }else{ + this.getModel().setValue("producedate", null, rowIndex); + this.getModel().setValue("expirydate", null, rowIndex); + } + } + } + } +}