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 b31aae6..d808cac 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 @@ -51,7 +51,7 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{ DynamicObject contract = (DynamicObject)changeData.getNewValue(); this.clearUnitproject(); this.contractChanged(contract); - this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录 +// this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录 } else if (StringUtils.equals(name, "period")) { this.periodChanged(changeData); } else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) { @@ -171,43 +171,43 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{ } - private void clearOrNewProcessAlloc() { - DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细 - DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录 - if (itemEntryCollection.size() == 0) { - return; - } - if (payItemDetailEntryCollection.size() > 0) { - for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) { - - DynamicObject itemEntry = itemEntryCollection.get(0); - DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊 - DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType(); - - long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id - DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量 - if (EcOutContractMeasure != null) { - DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录 - for (DynamicObject ListModelEntry : ListModelEntryCollection) { - DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录 - for (DynamicObject listEntry : listEntryCollection) { - DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); - newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构 - newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额 - newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额 - newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率(%)-税率(%) - newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额 - newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明 - processAllocEntityCollection.add(newProcessAllocEntity); - } - } - } - } - this.getView().updateView("zcgj_processallocatentity");//工序分摊 - } else { - itemEntryCollection.clear(); - this.getView().updateView("itementry");//支付项分录 - this.getView().updateView("zcgj_processallocatentity");//工序分摊分录 - } - } +// private void clearOrNewProcessAlloc() { +// DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细 +// DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录 +// if (itemEntryCollection.size() == 0) { +// return; +// } +// if (payItemDetailEntryCollection.size() > 0) { +// for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) { +// +// DynamicObject itemEntry = itemEntryCollection.get(0); +// DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊 +// DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType(); +// +// long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id +// DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量 +// if (EcOutContractMeasure != null) { +// DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录 +// for (DynamicObject ListModelEntry : ListModelEntryCollection) { +// DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录 +// for (DynamicObject listEntry : listEntryCollection) { +// DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); +// newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构 +// newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额 +// newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额 +// newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率(%)-税率(%) +// newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额 +// newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明 +// processAllocEntityCollection.add(newProcessAllocEntity); +// } +// } +// } +// } +// this.getView().updateView("zcgj_processallocatentity");//工序分摊 +// } else { +// itemEntryCollection.clear(); +// this.getView().updateView("itementry");//支付项分录 +// this.getView().updateView("zcgj_processallocatentity");//工序分摊分录 +// } +// } } \ No newline at end of file diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/CostAllocatorBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/CostAllocatorBillPlugin.java index 1a19433..697f58f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/CostAllocatorBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/CostAllocatorBillPlugin.java @@ -5,6 +5,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; import kd.bos.entity.datamodel.RowDataEntity; import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; +import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.plugin.AbstractFormPlugin; @@ -83,9 +84,54 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); String name = e.getProperty().getName(); -// if ("totalsettleoftaxamount".equals(name)) { -// //关联单据 -// System.out.println(); -// } + if ("totalsettleoftaxamount".equals(name) || "contract".equals(name)) { + //关联单据 + DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细 + DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录 + if (itemEntryCollection.size() == 0) { + return; + } + DynamicObject itemEntry = itemEntryCollection.get(0); + DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊 + processAllocEntityCollection.clear(); + if ("contract".equals(name)) { + ChangeData changeData = e.getChangeSet()[0]; //修改值所在行 + Object newValue = changeData.getNewValue();//新值 + if (newValue == null){ + this.getView().updateView("zcgj_processallocatentity");//工序分摊 + return; + } + } + Object contract = this.getModel().getValue("contract"); + if (contract == null) { + this.getView().updateView("zcgj_processallocatentity");//工序分摊 + return; + } + DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType(); + if (payItemDetailEntryCollection.size() > 0) { + for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) { + + long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id + DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量 + if (EcOutContractMeasure != null) { + DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录 + for (DynamicObject ListModelEntry : ListModelEntryCollection) { + DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录 + for (DynamicObject listEntry : listEntryCollection) { + DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); + newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构 + newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额 + newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额 + newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率(%)-税率(%) + newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额 + newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明 + processAllocEntityCollection.add(newProcessAllocEntity); + } + } + } + } + } + this.getView().updateView("zcgj_processallocatentity");//工序分摊 + } } }