Compare commits

...

2 Commits

2 changed files with 90 additions and 44 deletions

View File

@ -51,7 +51,7 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{
DynamicObject contract = (DynamicObject)changeData.getNewValue(); DynamicObject contract = (DynamicObject)changeData.getNewValue();
this.clearUnitproject(); this.clearUnitproject();
this.contractChanged(contract); this.contractChanged(contract);
this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录 // this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录
} else if (StringUtils.equals(name, "period")) { } else if (StringUtils.equals(name, "period")) {
this.periodChanged(changeData); this.periodChanged(changeData);
} else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) { } else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) {
@ -171,43 +171,43 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{
} }
private void clearOrNewProcessAlloc() { // private void clearOrNewProcessAlloc() {
DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细 // DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细
DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录 // DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录
if (itemEntryCollection.size() == 0) { // if (itemEntryCollection.size() == 0) {
return; // return;
} // }
if (payItemDetailEntryCollection.size() > 0) { // if (payItemDetailEntryCollection.size() > 0) {
for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) { // for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) {
//
DynamicObject itemEntry = itemEntryCollection.get(0); // DynamicObject itemEntry = itemEntryCollection.get(0);
DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊 // DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊
DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType(); // DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType();
//
long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id // long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id
DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量 // DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量
if (EcOutContractMeasure != null) { // if (EcOutContractMeasure != null) {
DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录 // DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录
for (DynamicObject ListModelEntry : ListModelEntryCollection) { // for (DynamicObject ListModelEntry : ListModelEntryCollection) {
DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录 // DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录
for (DynamicObject listEntry : listEntryCollection) { // for (DynamicObject listEntry : listEntryCollection) {
DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); // DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType);
newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构 // newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构
newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额 // newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额
newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额 // newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额
newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率%-税率% // newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率%-税率%
newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额 // newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额
newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明 // newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明
processAllocEntityCollection.add(newProcessAllocEntity); // processAllocEntityCollection.add(newProcessAllocEntity);
} // }
} // }
} // }
} // }
this.getView().updateView("zcgj_processallocatentity");//工序分摊 // this.getView().updateView("zcgj_processallocatentity");//工序分摊
} else { // } else {
itemEntryCollection.clear(); // itemEntryCollection.clear();
this.getView().updateView("itementry");//支付项分录 // this.getView().updateView("itementry");//支付项分录
this.getView().updateView("zcgj_processallocatentity");//工序分摊分录 // this.getView().updateView("zcgj_processallocatentity");//工序分摊分录
} // }
} // }
} }

View File

@ -5,6 +5,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
import kd.bos.entity.datamodel.RowDataEntity; import kd.bos.entity.datamodel.RowDataEntity;
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.form.plugin.AbstractFormPlugin;
@ -83,9 +84,54 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin {
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
String name = e.getProperty().getName(); String name = e.getProperty().getName();
// if ("totalsettleoftaxamount".equals(name)) { if ("totalsettleoftaxamount".equals(name) || "contract".equals(name)) {
// //关联单据 //关联单据
// System.out.println(); 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");//工序分摊
}
} }
} }