From e19f96774d5d63a3845c567e8ed5697b06dbc1b0 Mon Sep 17 00:00:00 2001 From: xiaoshi <2272816786@qq.com> Date: Fri, 13 Dec 2024 15:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=90=88=E5=90=8C=E8=AE=A1=E9=87=8F=E8=A1=8C?= =?UTF-8?q?=E5=B8=A6=E5=87=BA=E6=9C=89=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/ContractSettleBillPlugin.java | 11 +++-- .../plugin/form/ResourceFilterExtPlugin.java | 49 ++++++++++++------- .../pr/plugin/operate/ContractSettleOp.java | 46 +++++++++++++++++ .../InContractSettlementValidator.java | 30 ++++++------ 4 files changed, 102 insertions(+), 34 deletions(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractSettleOp.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java index ca12c3c..80ba2a2 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractSettleBillPlugin.java @@ -6,6 +6,7 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.operate.result.OperationResult; +import kd.bos.form.control.Button; import kd.bos.form.control.Control; import kd.bos.form.control.events.BeforeClickEvent; import kd.bos.form.control.events.BeforeItemClickEvent; @@ -41,8 +42,10 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug public void registerListener(EventObject e) { super.registerListener(e); // 注册按钮点击事件 - this.addClickListeners("bar_audit"); - this.addItemClickListeners("bar_audit"); +// this.addClickListeners("bar_audit"); +// this.addItemClickListeners("bar_audit"); +// Button button = this.getView().getControl("bar_audit"); +// button.addClickListener(this); } @Override @@ -54,13 +57,15 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug @Override public void click(EventObject evt) { super.click(evt); + System.out.println(); } @Override public void beforeItemClick(BeforeItemClickEvent evt) { super.beforeItemClick(evt); Control source = (Control) evt.getSource(); - if (StringUtils.equals("bar_audit", source.getKey())) { + String key = source.getKey(); + if (StringUtils.equals("bar_audit", key)) { // 在此添加业务逻辑 Object changetype = this.getModel().getValue("changetype"); if (changetype != null) { diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java index a124e5e..25b21e0 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ResourceFilterExtPlugin.java @@ -1,20 +1,45 @@ package zcgj.zcdev.zcdev.pr.plugin.form; -import kd.bos.entity.tree.TreeNode; import kd.bos.form.FormShowParameter; -import kd.bos.form.IPageCache; -import kd.bos.form.control.TreeView; -import kd.ec.basedata.common.enums.ResourceTypeEnum; -import kd.ec.basedata.formplugin.ResourceFilterPlugin; import kd.ec.basedata.formplugin.ResourceItemListPlugin; import java.util.EventObject; import java.util.Map; public class ResourceFilterExtPlugin extends ResourceItemListPlugin { + @Override + public void beforeBindData(EventObject e) { +// super.afterBindData(e); + FormShowParameter formShowParameter = this.getView().getFormShowParameter(); + Map customParams = formShowParameter.getCustomParams(); + Object contractType = customParams.get("contractType"); + String firstOpen = this.getPageCache().get("firstOpen"); + if (firstOpen != null) { +// this.getPageCache().put("firstOpen", "false"); + this.getPageCache().remove("firstOpen"); + + if (contractType != null) { + if (contractType.toString().equals("wzcg")) {//物资采购 + this.setResourceTypeStyle("material"); + this.afterSelectedTag("material"); + } else if (contractType.toString().equals("sbcg")) {//设备采购 + this.setResourceTypeStyle("equipment"); + this.afterSelectedTag("equipment"); + }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物 + this.setResourceTypeStyle("turnover"); + this.afterSelectedTag("turnover"); + } + } + }else{ + this.getPageCache().put("firstOpen","false"); + } + + System.out.println(); + + } + @Override public void afterBindData(EventObject e) { - super.afterBindData(e); FormShowParameter formShowParameter = this.getView().getFormShowParameter(); Map customParams = formShowParameter.getCustomParams(); Object contractType = customParams.get("contractType"); @@ -25,24 +50,14 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin { if (contractType.toString().equals("wzcg")) {//物资采购 this.getView().setVisible(true, new String[]{"flexpanelmaterial"}); this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"}); - this.setResourceTypeStyle("material"); - this.afterSelectedTag("material"); - } else if (contractType.toString().equals("cs2")) {//设备采购 + } else if (contractType.toString().equals("sbcg")) {//设备采购 this.getView().setVisible(true, new String[]{"flexpanelequipment"}); this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"}); - this.setResourceTypeStyle("equipment"); - this.afterSelectedTag("equipment"); }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物 this.getView().setVisible(true, new String[]{"flexpanelturnover"}); this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"}); - this.setResourceTypeStyle("turnover"); - this.afterSelectedTag("turnover"); } } } - - System.out.println(); - } - } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractSettleOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractSettleOp.java new file mode 100644 index 0000000..1d1830f --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractSettleOp.java @@ -0,0 +1,46 @@ +package zcgj.zcdev.zcdev.pr.plugin.operate; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.operate.result.OperationResult; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; + +public class ContractSettleOp extends AbstractOperationServicePlugIn { + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + DynamicObject[] dataEntities1 = e.getDataEntities(); + DynamicObject object = dataEntities1[0]; + Object changetype = object.getString("changetype"); + if (changetype != null) { + if (changetype.toString().equals("03")) { + DynamicObject contract = object.getDynamicObject("contract"); + String billName = contract.getDataEntityType().getName(); + DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb"); + DynamicObjectCollection zcgjOtherpart = object.getDynamicObjectCollection("zcgj_otherpart"); + if (billName.equals("ec_out_contract_f7")) { + QFilter f1 = new QFilter("number", "=", contract.getString("number")); + DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1}); + outContractF7.set("partb", zcgjpartb); + OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体 + + QFilter f2 = new QFilter("billno", "=", contract.getString("number")); + DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2}); + outContract.set("partb", zcgjpartb); + if (zcgjOtherpart != null) { +// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart"); + outContract.set("otherpart", zcgjOtherpart); + outContract.set("ismulticontract", true); + } + OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体 + System.out.println(saveOperationResult1); + } + } + } + } +} \ No newline at end of file diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java index 0f3f08f..051c05f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java @@ -29,20 +29,22 @@ public class InContractSettlementValidator extends InContractSettleValidator { long id = dataEntity.getDataEntity().getLong("id"); QFilter f1 = new QFilter("id", "=", id); DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); - DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); - if(itementry == null) { - if(itementry.isEmpty()) { - this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); - } - DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract"); - BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); - BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); - DynamicObject contractType = contract.getDynamicObject("contracttype"); - DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); - boolean validateAmount = true; - if (contractAttr != null) { - contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); - validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); + if(incontractsettle!=null){ + DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); + if(itementry == null) { + if(itementry.isEmpty()) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + } + DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract"); + BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); + BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); + DynamicObject contractType = contract.getDynamicObject("contracttype"); + DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); + boolean validateAmount = true; + if (contractAttr != null) { + contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); + validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); + } } } // DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");