From d1477ffbb70813306dfe4e212a79610485c7a505 Mon Sep 17 00:00:00 2001 From: xiaoshi <2272816786@qq.com> Date: Wed, 25 Dec 2024 17:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20=20?= =?UTF-8?q?=E5=90=88=E5=90=8C=E8=AE=A1=E9=87=8F=E6=97=B6=E9=97=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=8F=96=E6=B6=88=20=20=20=E5=90=88=E5=90=8C=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E9=94=81=E5=AE=9A=E5=8F=96=E6=B6=88=20=20=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0=E4=B8=9A=E4=B8=BB=E5=85=A8=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ContractEeasurementBillPlugin.java | 27 ++++++ .../plugin/form/ContractSettleBillPlugin.java | 97 +------------------ .../form/ContractTreeListExtPlugin.java | 9 +- .../InContractMeasurementBillEditPlugin.java | 27 ++++++ .../pr/plugin/form/ProjectEditExtUI.java | 55 +++++++++++ .../operate/ContractMeasurementValidator.java | 2 +- 6 files changed, 121 insertions(+), 96 deletions(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProjectEditExtUI.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java index 95a0397..6b5e29e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractEeasurementBillPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; @@ -14,6 +15,7 @@ import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -78,6 +80,31 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin } } + @Override + protected void onDateChanged(ChangeData changeData, String propName) { + if (this.getPageCache().get("isperiodchanged") != null) { + this.getPageCache().remove("isperiodchanged"); + } else { + Date beginDate = (Date)this.getModel().getValue("begindate"); + Date endDate = (Date)this.getModel().getValue("enddate"); + DynamicObject period = (DynamicObject)this.getModel().getValue("period"); + if (period != null) { + Date periodBeginDate = period.getDate("begindate"); + Date periodEndDate = period.getDate("enddate"); + if (null != endDate && null != beginDate && beginDate.compareTo(endDate) > 0) { + this.getModel().setValue(propName, changeData.getOldValue()); + this.getView().showMessage(ResManager.loadKDString("结束日期应大于等于开始日期。", "ContractMeasureBillEditPlugin_1", "ec-contract-formplugin", new Object[0])); + } else if (null != endDate && endDate.compareTo(periodEndDate) > 0) { +// this.getModel().setValue("enddate", changeData.getOldValue()); +// this.getView().showMessage(ResManager.loadKDString("结束日期应小于等于期间结束日期。", "ContractMeasureBillEditPlugin_2", "ec-contract-formplugin", new Object[0])); + } else if (null != beginDate && beginDate.compareTo(periodBeginDate) < 0) { +// this.getModel().setValue("begindate", changeData.getOldValue()); +// this.getView().showMessage(ResManager.loadKDString("开始日期应大于等于期间开始日期。", "ContractMeasureBillEditPlugin_3", "ec-contract-formplugin", new Object[0])); + } + } + } + } + @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); 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 1c5c903..43054ef 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 @@ -13,6 +13,7 @@ import kd.bos.form.control.events.BeforeItemClickEvent; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.ec.contract.formplugin.settle.ContractSettleCommonEditPlugin; import kd.sdk.plugin.Plugin; import java.util.EventObject; @@ -21,100 +22,10 @@ import java.util.EventObject; * 单据界面插件 * 支出合同结算供应商变更插件 */ -public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plugin { +public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{ @Override - public void afterCreateNewData(EventObject e) { - super.afterCreateNewData(e); -// Object changetype = this.getModel().getValue("changetype"); -// if(changetype!=null){ -// if(changetype.toString().equals("03")){ -// this.getView().setVisible(true,"zcgj_partb"); -// this.getView().setVisible(true,"zcgj_otherpart"); -// }else { -// this.getView().setVisible(false,"zcgj_partb"); -// this.getView().setVisible(false,"zcgj_otherpart"); -// } -// } - } - - @Override - public void registerListener(EventObject e) { - super.registerListener(e); - // 注册按钮点击事件 -// this.addClickListeners("bar_audit"); -// this.addItemClickListeners("bar_audit"); -// Button button = this.getView().getControl("bar_save"); -// button.addClickListener(this); - } - - @Override - public void beforeClick(BeforeClickEvent evt) { - super.beforeClick(evt); - - } - - @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(); - String key = source.getKey(); - if (StringUtils.equals("bar_audit", key)) { - // 在此添加业务逻辑 -// Object changetype = this.getModel().getValue("changetype"); -// if (changetype != null) { -// if (changetype.toString().equals("03")) { -// Object contract = this.getModel().getValue("contract"); -// DynamicObject contractInfo = (DynamicObject) contract; -// String billName = contractInfo.getDataEntityType().getName(); -// DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb"); -// Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart"); -// if (billName.equals("ec_out_contract_f7")) { -// QFilter f1 = new QFilter("number", "=", contractInfo.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", "=", contractInfo.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",otherpart); -// outContract.set("ismulticontract",true); -// } -// OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体 -// System.out.println(saveOperationResult1); -// }else{ -// -// } -// } -// } - evt.setCancel(true); // 取消后续处理,将不会再触发click事件 - } - } - - @Override - public void propertyChanged(PropertyChangedArgs e) { - super.propertyChanged(e); - String name = e.getProperty().getName(); -// if(name.equals("changetype")){ -// Object changetype = this.getModel().getValue("changetype"); -// if(changetype!=null){ -// if(changetype.toString().equals("03")){ -// this.getView().setVisible(true,"zcgj_partb"); -// this.getView().setVisible(true,"zcgj_otherpart"); -// }else { -// this.getView().setVisible(false,"zcgj_partb"); -// this.getView().setVisible(false,"zcgj_otherpart"); -// } -// } -// } + protected void setDateEditMinAndMaxDate() { +// super.setDateEditMinAndMaxDate(); } } \ No newline at end of file diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractTreeListExtPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractTreeListExtPlugin.java index b8553a1..4fd5e84 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractTreeListExtPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ContractTreeListExtPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.form.field.BasedataEdit; import kd.ec.contract.formplugin.ContractTreeListingPlugin; public class ContractTreeListExtPlugin extends ContractTreeListingPlugin { @@ -11,12 +12,16 @@ public class ContractTreeListExtPlugin extends ContractTreeListingPlugin { if(contractType != null) { DynamicObject dynamicObject = (DynamicObject) contractType; String number = dynamicObject.getString("number"); - if(number .equals("wzcg01")||number.equals("sbcg")||number.equals("jjfb")) { + if(number.equals("wzcg01")||number.equals("sbcg")) { this.getView().setVisible(false, new String[]{"treecbsnumber", "treecbsname","cbs"}); this.getView().setEnable(false,"isincost"); this.getModel().setValue("isincost",false); + }else if(number.equals("jjfb")){ + this.getView().setEnable(false,"isincost"); + this.getModel().setValue("isincost",true); + BasedataEdit basedataEdit = (BasedataEdit)this.getControl("cbs"); + basedataEdit.setMustInput(false); } } - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java index 8ee6245..7d61215 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; @@ -14,6 +15,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -119,6 +121,31 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd return result; } + @Override + protected void onDateChanged(ChangeData changeData, String propName) { + if (this.getPageCache().get("isperiodchanged") != null) { + this.getPageCache().remove("isperiodchanged"); + } else { + Date beginDate = (Date)this.getModel().getValue("begindate"); + Date endDate = (Date)this.getModel().getValue("enddate"); + DynamicObject period = (DynamicObject)this.getModel().getValue("period"); + if (period != null) { + Date periodBeginDate = period.getDate("begindate"); + Date periodEndDate = period.getDate("enddate"); + if (null != endDate && null != beginDate && beginDate.compareTo(endDate) > 0) { + this.getModel().setValue(propName, changeData.getOldValue()); + this.getView().showMessage(ResManager.loadKDString("结束日期应大于等于开始日期。", "ContractMeasureBillEditPlugin_1", "ec-contract-formplugin", new Object[0])); + } else if (null != endDate && endDate.compareTo(periodEndDate) > 0) { +// this.getModel().setValue("enddate", changeData.getOldValue()); +// this.getView().showMessage(ResManager.loadKDString("结束日期应小于等于期间结束日期。", "ContractMeasureBillEditPlugin_2", "ec-contract-formplugin", new Object[0])); + } else if (null != beginDate && beginDate.compareTo(periodBeginDate) < 0) { +// this.getModel().setValue("begindate", changeData.getOldValue()); +// this.getView().showMessage(ResManager.loadKDString("开始日期应大于等于期间开始日期。", "ContractMeasureBillEditPlugin_3", "ec-contract-formplugin", new Object[0])); + } + } + } + } + @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProjectEditExtUI.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProjectEditExtUI.java new file mode 100644 index 0000000..a7846eb --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProjectEditExtUI.java @@ -0,0 +1,55 @@ +package zcgj.zcdev.zcdev.pr.plugin.form; + +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.form.field.FieldEdit; +import kd.ec.contract.formplugin.ProjectEditUI; + +import java.util.EventObject; + +/** + * 项目编辑界面插件 + */ +public class ProjectEditExtUI extends ProjectEditUI { + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + String value = this.getModel().getDataEntity().getString("boqmode"); + setUnitProMustInput(value); + } + + @Override + public void propertyChanged(PropertyChangedArgs args) { + super.propertyChanged(args); + String propertyName = args.getProperty().getName(); + ChangeData data; + if ("boqmode".equals(propertyName)) { + data = args.getChangeSet()[0]; + String unitProjectName = (String) data.getNewValue(); + setUnitProMustInput(unitProjectName); + } + } + + + private void setUnitProMustInput(String value) { + FieldEdit pronumber = (FieldEdit)this.getControl("unitprojectnumber"); + FieldEdit proname = (FieldEdit)this.getControl("unitprojectname"); + FieldEdit proorg = (FieldEdit)this.getControl("responsibleorg"); + if ("unitproject".equals(value)) { + pronumber.setMustInput(true); + proname.setMustInput(true); +// proorg.setMustInput(true); + this.getView().setEnable(true, new String[]{"unitproject", "addunitproject", "deleteunitproject"}); + this.getModel().setValue("editonunit", true); + } else { + pronumber.setMustInput(false); + proname.setMustInput(false); + proorg.setMustInput(false); + this.getModel().deleteEntryData("unitproject"); + this.getView().setEnable(false, new String[]{"unitproject", "addunitproject", "deleteunitproject"}); + this.getModel().setValue("editonunit", false); + } + + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java index 5c70383..6a5107e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/ContractMeasurementValidator.java @@ -124,7 +124,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator { DynamicObject listing = listingEntry.getDynamicObject("listing"); if (listing != null) { if (repeatListingIds.contains(listing.getLong("id"))) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("本次操作的单据中清单【%s】存在重复,请检查。", "ContractMeasureValidator_2", "ec-contract-opplugin", new Object[0]), listing.getString("name"))); +// this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("本次操作的单据中清单【%s】存在重复,请检查。", "ContractMeasureValidator_2", "ec-contract-opplugin", new Object[0]), listing.getString("name"))); } else if (changedListingIds.contains(listing.getLong("id"))) { this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("清单【%s】正在变更中,请检查。", "ContractMeasureValidator_3", "ec-contract-opplugin", new Object[0]), listing.getString("name"))); } else {