From a3000e20477ecd4c20e0882c7d2b6f6039ccbbda Mon Sep 17 00:00:00 2001 From: chenshaoxin <1981897232@qq.com> Date: Mon, 18 Nov 2024 17:04:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A=E9=99=88=E7=BB=8D=E9=91=AB?= =?UTF-8?q?=20=E6=97=B6=E9=97=B4=EF=BC=9A2024/11/18=20=2017=EF=BC=9A00=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=9A=E6=88=90=E6=9C=AC=E6=B5=8B=E7=AE=97?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recos/formplugin/MeasureciFormPlugin.java | 77 +++++++++++++++++++ .../formplugin/RecosMeasurecosFormPlugin.java | 22 +++++- .../repmd/formplugin/ProjectBillPlugin.java | 3 +- .../repmd/formplugin/WorkQuantityPlugin.java | 33 +++++--- 4 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 main/java/shkd/repc/recos/formplugin/MeasureciFormPlugin.java diff --git a/main/java/shkd/repc/recos/formplugin/MeasureciFormPlugin.java b/main/java/shkd/repc/recos/formplugin/MeasureciFormPlugin.java new file mode 100644 index 0000000..08574a8 --- /dev/null +++ b/main/java/shkd/repc/recos/formplugin/MeasureciFormPlugin.java @@ -0,0 +1,77 @@ +package shkd.repc.recos.formplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.form.control.EntryGrid; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.operate.FormOperate; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.QueryServiceHelper; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MeasureciFormPlugin extends AbstractFormPlugin { + @Override + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + super.beforeDoOperation(args); + FormOperate source = (FormOperate) args.getSource(); + String operateKey = source.getOperateKey(); + if ("qeug_tbgcl".equals(operateKey)){ + Object producttypeid = this.getModel().getValue("producttypeid");//产品类型ID + Object measurecostid = this.getModel().getValue("measurecostid");//成本测算ID + DynamicObject measurecost = BusinessDataServiceHelper.loadSingle(measurecostid,"recos_measurecost"); + DynamicObject project = measurecost.getDynamicObject("project"); + String number = project.getString("number");//项目编码 + QFilter filter = new QFilter("qeug_cpmc.id", QCP.equals, producttypeid). + and(new QFilter("qeug_xmnumber", QCP.equals, number)); + DynamicObject queryone = QueryServiceHelper.queryOne("qeug_gcl", "id", filter.toArray()); + if (queryone==null){ + this.getView().showSuccessNotification("请维护项目面积数据"); + return; + } + Map result = new HashMap<>(); + DynamicObject gcl = BusinessDataServiceHelper.loadSingle(queryone.get("id"),"qeug_gcl"); + DynamicObjectCollection qeug_entryentity = gcl.getDynamicObjectCollection("qeug_entryentity");//面积 + for (int i = 0; i myList = new ArrayList<>(); + for (int i = 0; i < selectRows.length; i++) { + DynamicObject cientrydata = this.getModel().getEntryRowEntity("cientry", selectRows[i]); + myList.add(cientrydata); + } + result.forEach((key, value) -> { + for (DynamicObject dynamicObject : myList) { + if (dynamicObject.getString("entry_accountname").equals(key)){ + this.getModel().setValue("entry_workload",value,(int)dynamicObject.get("seq")-1);//工程量 + } + } + }); + this.getView().showSuccessNotification("功能失败:"); + } + } +} diff --git a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java index 757ad49..c86f7a4 100644 --- a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java +++ b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java @@ -80,7 +80,12 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl for (DynamicObject queryOne : query) { List list=new ArrayList(); List listcaption=new ArrayList(); - listcaption.add("科目长名称"); +// listcaption.add("科目长名称"); + listcaption.add("一级分类"); + listcaption.add("二级分类"); + listcaption.add("三级分类"); + listcaption.add("四级分类"); + listcaption.add("五级分类"); listcaption.add("科目编码"); listcaption.add("科目名称"); listcaption.add("工程量单位"); @@ -97,7 +102,20 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl DynamicObject entry_costaccount = dynamicObject.getDynamicObject("entry_costaccount");//科目 if (entry_costaccount.getBoolean("isleaf")){ List listvalue=new ArrayList(); - listvalue.add(entry_costaccount.getString("fullname"));//科目长名称 +// listvalue.add(entry_costaccount.getString("fullname"));//科目长名称 + String fullname = entry_costaccount.getString("fullname"); + String[] parts = fullname.split("_"); + String[] partsWithoutLast = Arrays.copyOf(parts, parts.length - 1); + + for (int i = 0; i < 5; i++) { + try { + String s = partsWithoutLast[i]; + listvalue.add(s); + } catch (Exception e) { + listvalue.add(""); + } + } + listvalue.add(dynamicObject.getString("entry_longnumber"));//科目编码 listvalue.add(dynamicObject.getString("entry_accountname"));//科目名称 DynamicObject entry_workloadunit = dynamicObject.getDynamicObject("entry_workloadunit"); diff --git a/main/java/shkd/repc/repmd/formplugin/ProjectBillPlugin.java b/main/java/shkd/repc/repmd/formplugin/ProjectBillPlugin.java index 2535840..8595dc9 100644 --- a/main/java/shkd/repc/repmd/formplugin/ProjectBillPlugin.java +++ b/main/java/shkd/repc/repmd/formplugin/ProjectBillPlugin.java @@ -51,7 +51,8 @@ public class ProjectBillPlugin extends AbstractFormPlugin implements BeforeQuick showParameter.setCustomParam("billno",billno); showParameter.setCustomParam("billname",zh_cn); showParameter.setCustomParam("productentry_producttype",productentry_producttype.getPkValue().toString()); - showParameter.setCustomParam("versionnum",this.getModel().getValue("versionnum")); + showParameter.setCustomParam("operateKey",operateKey); + } } diff --git a/main/java/shkd/repc/repmd/formplugin/WorkQuantityPlugin.java b/main/java/shkd/repc/repmd/formplugin/WorkQuantityPlugin.java index 31a3678..7be67b8 100644 --- a/main/java/shkd/repc/repmd/formplugin/WorkQuantityPlugin.java +++ b/main/java/shkd/repc/repmd/formplugin/WorkQuantityPlugin.java @@ -2,6 +2,7 @@ package shkd.repc.repmd.formplugin; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.datamodel.events.BizDataEventArgs; import kd.bos.entity.operate.Save; import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; @@ -14,28 +15,38 @@ import kd.bos.servicehelper.QueryServiceHelper; import java.util.EventObject; public class WorkQuantityPlugin extends AbstractFormPlugin { + + @Override + public void createNewData(BizDataEventArgs e) { + super.createNewData(e); + + } + @Override public void afterBindData(EventObject e) { super.afterBindData(e); - String billno = this.getView().getFormShowParameter().getCustomParam("billno"); - String billname = this.getView().getFormShowParameter().getCustomParam("billname"); - String versionnum = this.getView().getFormShowParameter().getCustomParam("versionnum"); - String productentry_producttype = this.getView().getFormShowParameter().getCustomParam("productentry_producttype"); - this.getModel().setValue("qeug_xmnumber",billno); - this.getModel().setValue("name",billname); - this.getModel().setValue("qeug_cpmc",productentry_producttype); - this.getModel().setValue("qeug_bbh",versionnum); + String operateKey = this.getView().getFormShowParameter().getCustomParam("operateKey"); + if ("工程量".equals(operateKey)){ + String billno = this.getView().getFormShowParameter().getCustomParam("billno"); + String billname = this.getView().getFormShowParameter().getCustomParam("billname"); + String productentry_producttype = this.getView().getFormShowParameter().getCustomParam("productentry_producttype"); + this.getModel().setValue("qeug_xmnumber",billno); + this.getModel().setValue("name",billname); + this.getModel().setValue("qeug_cpmc",productentry_producttype); + } } @Override public void beforeDoOperation(BeforeDoOperationEventArgs args) { if (args.getSource() instanceof Save){ String qeug_xmnumber = (String) this.getModel().getValue("qeug_xmnumber"); - String qeug_bbh = (String) this.getModel().getValue("qeug_bbh"); - QFilter filter = new QFilter("qeug_xmnumber", QCP.equals, qeug_xmnumber).and(new QFilter("qeug_bbh", QCP.equals, qeug_bbh)); + DynamicObject qeug_cpmc = (DynamicObject) this.getModel().getValue("qeug_cpmc"); + Object pkValue = qeug_cpmc.getPkValue(); + QFilter filter = new QFilter("qeug_xmnumber", QCP.equals, qeug_xmnumber) + .and(new QFilter("qeug_cpmc.id", QCP.equals, pkValue)); DynamicObjectCollection query = QueryServiceHelper.query("qeug_gcl", "id", filter.toArray()); if (query.size()!=0){ - this.getView().showSuccessNotification("已存在当前版本号的项目数据,不允许保存"); + this.getView().showSuccessNotification("已存在此项目,不允许保存"); args.setCancel(true); } }