From 468d17c611581ff6d3dc9e3ac01103923d1d4c43 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 5 Nov 2025 10:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/OutContractSettleEditPluginExt.java | 119 ++++++++++++------ 1 file changed, 82 insertions(+), 37 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java index ddc95aa..f579f49 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/OutContractSettleEditPluginExt.java @@ -336,97 +336,97 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement protected void sumMaterialInAmountToItemEntry() { this.getModel().updateCache(); - DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry"); + DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry");//入库单分录 if (materialInEntry != null && materialInEntry.size() != 0) { - BigDecimal amount = BigDecimal.ZERO; - BigDecimal ofTaxAmount = BigDecimal.ZERO; - boolean isSettleTrans = false; - BigDecimal transAmount = BigDecimal.ZERO; - BigDecimal transOfTaxAmount = BigDecimal.ZERO; + BigDecimal amount = BigDecimal.ZERO;//入库单明细-材料不含税金额汇总 + BigDecimal ofTaxAmount = BigDecimal.ZERO;//入库单明细-材料含税金额汇总 + boolean isSettleTrans = false;//入库单明细-存在运费结算 + BigDecimal transAmount = BigDecimal.ZERO;//入库单明细-运费不含税金额汇总 + BigDecimal transOfTaxAmount = BigDecimal.ZERO;//入库单明细-运费含税金额汇总 Iterator var7 = materialInEntry.iterator(); DynamicObject transSettleItem; while (var7.hasNext()) { - transSettleItem = (DynamicObject) var7.next(); - BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount"); - BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount"); + transSettleItem = (DynamicObject) var7.next();//入库单明细 + BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount");//入库单明细-材料含税金额 + BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount");//入库单明细-材料不含税金额 amount = amount.add(materialNoTaxAmount); ofTaxAmount = ofTaxAmount.add(materialTaxAmount); - boolean settleTrans = transSettleItem.getBoolean("istranssettle"); + boolean settleTrans = transSettleItem.getBoolean("istranssettle");//入库单明细-运费结算 if (settleTrans) { - BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount"); - BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount"); + BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount");//入库单明细-运费含税金额 + BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount");//入库单明细-运费不含税金额 transAmount = transAmount.add(transNoTaxAmount); transOfTaxAmount = transOfTaxAmount.add(transTaxAmount); isSettleTrans = true; } } - this.getModel().setValue("oftaxamount", ofTaxAmount, 0); - this.getModel().setValue("amount", amount, 0); + this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计 + this.getModel().setValue("amount", amount, 0);//合同支付项-金额 if (BigDecimal.ZERO.compareTo(amount) != 0) { this.getPageCache().put("ignoreRateChanged", "1"); - this.getModel().setValue("rate", ofTaxAmount.subtract(amount).divide(amount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 0); + this.getModel().setValue("rate", ofTaxAmount.subtract(amount).divide(amount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 0);//合同支付项-税率(%) } - this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0); - int entryRowCount = this.getModel().getEntryRowCount("itementry"); + this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额 + int entryRowCount = this.getModel().getEntryRowCount("itementry");//合同支付项分录 if (entryRowCount <= 1) { if (isSettleTrans) { this.getModel().insertEntryRow("itementry", 1); - this.getModel().setValue("payitem", "760004250343646208", 1); + this.getModel().setValue("payitem", "760004250343646208", 1);//合同支付项-名称 this.fillItemEntryCbs(1); } } else { transSettleItem = this.getModel().getEntryRowEntity("itementry", 1); - DynamicObject payItem = transSettleItem.getDynamicObject("payitem"); + DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称 boolean hasSettleTrans = "YFJS".equals(payItem.getString("number")); if (isSettleTrans && !hasSettleTrans) { this.getModel().insertEntryRow("itementry", 1); - this.getModel().setValue("payitem", "760004250343646208", 1); + this.getModel().setValue("payitem", "760004250343646208", 1);//合同支付项-名称 this.fillItemEntryCbs(1); } else if (!isSettleTrans && hasSettleTrans) { - this.getModel().setValue("oftaxamount", transOfTaxAmount, 1); - this.getModel().setValue("amount", transAmount, 1); + this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);//合同支付项-价税合计 + this.getModel().setValue("amount", transAmount, 1);//合同支付项-金额 this.getModel().deleteEntryRow("itementry", 1); } } if (isSettleTrans) { - this.getModel().setValue("oftaxamount", transOfTaxAmount, 1); - this.getModel().setValue("amount", transAmount, 1); + this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);//合同支付项-价税合计 + this.getModel().setValue("amount", transAmount, 1);//合同支付项-金额 if (BigDecimal.ZERO.compareTo(transAmount) != 0) { - this.getModel().setValue("rate", transOfTaxAmount.subtract(transAmount).divide(transAmount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 1); + this.getModel().setValue("rate", transOfTaxAmount.subtract(transAmount).divide(transAmount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 1);//合同支付项-税率(%) } - this.getModel().setValue("taxamt", transOfTaxAmount.subtract(transAmount), 1); + this.getModel().setValue("taxamt", transOfTaxAmount.subtract(transAmount), 1);//合同支付项-税额 } } else { - int entryRowCount = this.getModel().getEntryRowCount("itementry"); + int entryRowCount = this.getModel().getEntryRowCount("itementry");//合同支付项分录行数 DynamicObject taxRate; if (entryRowCount > 1) { taxRate = this.getModel().getEntryRowEntity("itementry", 1); - DynamicObject payItem = taxRate.getDynamicObject("payitem"); + DynamicObject payItem = taxRate.getDynamicObject("payitem");//合同支付项-名称 if (payItem != null && "YFJS".equals(payItem.getString("number"))) { this.getModel().deleteEntryRow("itementry", 1); } } - this.getModel().setValue("oftaxamount", 0, 0); - taxRate = this.getModel().getDataEntity().getDynamicObject("taxrate"); + this.getModel().setValue("oftaxamount", 0, 0);//合同支付项-价税合计 + taxRate = this.getModel().getDataEntity().getDynamicObject("taxrate");//税率 if (taxRate != null) { - this.getModel().setValue("rate", taxRate.getBigDecimal("taxrate"), 0); + this.getModel().setValue("rate", taxRate.getBigDecimal("taxrate"), 0);//合同支付项-税率(%) } - this.getModel().setValue("taxamt", 0, 0); + this.getModel().setValue("taxamt", 0, 0);//合同支付项-税额 } } protected void fillItemEntryCbs(int row) { DynamicObject cbs = this.getNeedFillCbs(); - if (cbs != null && !(Boolean) this.getModel().getValue("isonlist")) { - this.getModel().setValue("itemcbs", cbs.getPkValue(), row); + if (cbs != null && !(Boolean) this.getModel().getValue("isonlist")) {//基于清单 + this.getModel().setValue("itemcbs", cbs.getPkValue(), row);//合同支付项-成本分解结构 } } @@ -537,10 +537,55 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement this.periodChanged(changeData); } else if (StringUtils.equals(name, "iseqsettle")) { this.isEqSettleChanged(changeData); - }else if (StringUtils.equals(name, "zcgj_transset")){ - this.getModel().deleteEntryRow("itementry", 0); - } + } else if (StringUtils.equals(name, "zcgj_transset")) { + //按入库运费结算 + Boolean zcgj_transset = (Boolean) changeData.getNewValue();//按入库运费结算新值 + DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry");//入库单分录 + if (materialInEntry != null && materialInEntry.size() != 0) { + BigDecimal amount = BigDecimal.ZERO;//入库单明细-材料不含税金额汇总 + BigDecimal ofTaxAmount = BigDecimal.ZERO;//入库单明细-材料含税金额汇总 +/* boolean isSettleTrans = false;//入库单明细-存在运费结算 + BigDecimal transAmount = BigDecimal.ZERO;//入库单明细-运费不含税金额汇总 + BigDecimal transOfTaxAmount = BigDecimal.ZERO;//入库单明细-运费含税金额汇总*/ + Iterator var7 = materialInEntry.iterator(); + DynamicObject transSettleItem; + while (var7.hasNext()) { + transSettleItem = (DynamicObject) var7.next();//入库单明细 + BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount");//入库单明细-材料含税金额 + BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount");//入库单明细-材料不含税金额 + amount = amount.add(materialNoTaxAmount); + ofTaxAmount = ofTaxAmount.add(materialTaxAmount); +/* boolean settleTrans = transSettleItem.getBoolean("istranssettle");//入库单明细-运费结算 + if (settleTrans) { + BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount");//入库单明细-运费含税金额 + BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount");//入库单明细-运费不含税金额 + transAmount = transAmount.add(transNoTaxAmount); + transOfTaxAmount = transOfTaxAmount.add(transTaxAmount); + isSettleTrans = true; + }*/ + } + transSettleItem = this.getModel().getEntryRowEntity("itementry", 0); + DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称 + boolean hasSettleTrans = "HTJL".equals(payItem.getString("number")); + if (hasSettleTrans && zcgj_transset) { + this.getModel().setValue("oftaxamount", 0, 0);//合同支付项-价税合计 + this.getModel().setValue("amount", 0, 0);//合同支付项-金额 + this.getModel().deleteEntryRow("itementry", 0); + } else { + this.getModel().insertEntryRow("itementry", 0); + this.getModel().setValue("payitem", "506427748873442304", 0);//合同支付项-名称 + this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计 + this.getModel().setValue("amount", amount, 0);//合同支付项-金额 + if (BigDecimal.ZERO.compareTo(amount) != 0) { + this.getPageCache().put("ignoreRateChanged", "1"); + this.getModel().setValue("rate", ofTaxAmount.subtract(amount).divide(amount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 0);//合同支付项-税率(%) + } + + this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额 + } + } + } } protected void periodChanged(ChangeData changeData) {