From ab5206bcfd7836d8f8043b4f986140baf5670234 Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Fri, 18 Jul 2025 10:47:39 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=94=9F=E4=BA=A7=E5=95=86=E3=80=91?= =?UTF-8?q?=E5=8D=AB=E7=94=9F=E8=AE=B8=E5=8F=AF=E8=AF=81=E5=8F=B7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/sys/ProxyAndFactoryBillPlugin.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lc123/cloud/app/plugin/form/sys/ProxyAndFactoryBillPlugin.java diff --git a/lc123/cloud/app/plugin/form/sys/ProxyAndFactoryBillPlugin.java b/lc123/cloud/app/plugin/form/sys/ProxyAndFactoryBillPlugin.java new file mode 100644 index 0000000..4c5a3bc --- /dev/null +++ b/lc123/cloud/app/plugin/form/sys/ProxyAndFactoryBillPlugin.java @@ -0,0 +1,62 @@ +package tqq9.lc123.cloud.app.plugin.form.sys; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.form.control.events.ItemClickEvent; +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; +import java.util.EventObject; +import java.util.HashSet; +import java.util.Set; + +/** + * 生产商界面插件 + * 卫生许可证明细上的添加按钮 + */ +public class ProxyAndFactoryBillPlugin extends AbstractBillPlugIn { + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + this.addItemClickListeners("tqq9_advcontoolbarap"); + } + + @Override + public void itemClick(ItemClickEvent evt) { + super.itemClick(evt); + String itemKey = evt.getItemKey(); + if("tqq9_additem".equals(itemKey)){ + String tqq9_cleanno = (String) this.getModel().getValue("tqq9_cleanno");//卫消字证号 + Date tqq9_cleanstartdate = (Date) this.getModel().getValue("tqq9_cleanstartdate");//开始时间 + Date tqq9_cleanenddate = (Date) this.getModel().getValue("tqq9_cleanenddate");//结束时间 + if(StringUtils.isNotBlank(tqq9_cleanno) && tqq9_cleanstartdate != null && tqq9_cleanenddate != null){ + DynamicObjectCollection tqq9_clnentries = this.getModel().getDataEntity(true).getDynamicObjectCollection("tqq9_clnentry"); + Set set = new HashSet<>(); + if(tqq9_clnentries != null && tqq9_clnentries.size() > 0){ + for (DynamicObject tqq9_clnentry : tqq9_clnentries) { + String tqq9_clnno = tqq9_clnentry.getString("tqq9_clnno");//明细-卫消字证号 + set.add(tqq9_clnno); + } + } + if(set.contains(tqq9_cleanno)){ + this.getView().showTipNotification("卫消字证号["+tqq9_cleanno+"]已经添加过,不需要重复添加!"); + }else{ + DynamicObject entry = tqq9_clnentries.addNew(); + entry.set("tqq9_clnno", tqq9_cleanno); + entry.set("tqq9_clnstartdate", tqq9_cleanstartdate); + entry.set("tqq9_clnenddate", tqq9_cleanenddate); + + this.getModel().setValue("tqq9_cleanno", null); + this.getModel().setValue("tqq9_cleanstartdate", null); + this.getModel().setValue("tqq9_cleanenddate", null); + this.getView().updateView("tqq9_entry"); + this.getView().updateView(); + } + }else{ + this.getView().showTipNotification("请填写卫消字证号和开始/截止时间!"); + } + } + } +}