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 f6b2632..e5c8e30 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 @@ -20,7 +20,8 @@ import java.util.Map; /* * 使用插件注册位置:支出合同结算表单插件 - * 说明:新增合同支付项明细后将对应不同分录拆分至工序分摊中 + * 说明:1:新增合同支付项明细后将对应不同分录拆分至工序分摊中 + * 2:新增的入库单分录如上 */ public class CostAllocatorBillPlugin extends AbstractFormPlugin { @@ -30,6 +31,7 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { this.addItemClickListeners("payitemdetaitoolap");//合同支付项明细工具栏 this.addItemClickListeners("entrytoolbar1");//入库单明细工具栏 } + @Override public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { super.afterDoOperation(afterDoOperationEventArgs); @@ -39,6 +41,7 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { this.getView().invokeOperation("refresh"); } } + @Override public void itemClick(ItemClickEvent evt) { super.itemClick(evt); @@ -88,6 +91,7 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { } } else if (itemKey.equals("removeline1")) { //入库单明细删除按钮 + boolean zcgj_transset = (boolean) this.getModel().getValue("zcgj_transset");//按入库运费结算 DynamicObjectCollection materialInEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("materialinentry");//入库单分录 DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录 if (itemEntryCollection.size() == 0) { @@ -121,6 +125,23 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { processAllocEntityCollection.add(newProcessAllocEntity); } + if (zcgj_transset) { + DynamicObjectCollection expensesummaryCollection = ecma_materialInBill.getDynamicObjectCollection("zcgj_expensesummary");//费用汇总 + for (DynamicObject entryEntity : expensesummaryCollection) { + boolean zcgj_isfreightline = entryEntity.getBoolean("zcgj_isfreightline");//运费行 + if (!zcgj_isfreightline) { + continue; + } + DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); + newProcessAllocEntity.set("zcgj_pa_amount", entryEntity.get("zcgj_pa_amount"));//价税合计-价税合计 + newProcessAllocEntity.set("zcgj_amountnotax", entryEntity.get("zcgj_amountnotax"));//不含税金额-不含税金额 + newProcessAllocEntity.set("zcgj_rateval", entryEntity.get("zcgj_rateval"));//税率(%)-税率(%) + newProcessAllocEntity.set("zcgj_taxamt", entryEntity.get("zcgj_taxamt"));//税额-税额 + newProcessAllocEntity.set("zcgj_expenseitem", entryEntity.get("zcgj_expenseitem"));//费用项目-费用项目 + + processAllocEntityCollection.add(newProcessAllocEntity); + } + } } } @@ -201,6 +222,7 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { } else if ("matinnumber".equals(name)) { //入库单明细-编码 this.getModel().beginInit(); + boolean zcgj_transset = (boolean) this.getModel().getValue("zcgj_transset");//按入库运费结算 DynamicObject contattr = (DynamicObject) this.getModel().getValue("contattr");//合同属性 if (contattr == null) { return; @@ -242,6 +264,23 @@ public class CostAllocatorBillPlugin extends AbstractFormPlugin { processAllocEntityCollection.add(newProcessAllocEntity); } + if (zcgj_transset) { + DynamicObjectCollection expensesummaryCollection = ecma_materialInBill.getDynamicObjectCollection("zcgj_expensesummary");//费用汇总 + for (DynamicObject entryEntity : expensesummaryCollection) { + boolean zcgj_isfreightline = entryEntity.getBoolean("zcgj_isfreightline");//运费行 + if (!zcgj_isfreightline) { + continue; + } + DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType); + newProcessAllocEntity.set("zcgj_pa_amount", entryEntity.get("zcgj_pa_amount"));//价税合计-价税合计 + newProcessAllocEntity.set("zcgj_amountnotax", entryEntity.get("zcgj_amountnotax"));//不含税金额-不含税金额 + newProcessAllocEntity.set("zcgj_rateval", entryEntity.get("zcgj_rateval"));//税率(%)-税率(%) + newProcessAllocEntity.set("zcgj_taxamt", entryEntity.get("zcgj_taxamt"));//税额-税额 + newProcessAllocEntity.set("zcgj_expenseitem", entryEntity.get("zcgj_expenseitem"));//费用项目-费用项目 + + processAllocEntityCollection.add(newProcessAllocEntity); + } + } } }