From 5af47982cdb22275a4dd8e1c2ce905c7b82c7a37 Mon Sep 17 00:00:00 2001 From: xiaoshi <2272816786@qq.com> Date: Tue, 17 Dec 2024 11:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InContractSettlementValidator.java | 35 ++++++++----------- .../OutContractSettlementValidator.java | 11 ++---- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java index 051c05f..3420bdb 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/InContractSettlementValidator.java @@ -19,32 +19,27 @@ public class InContractSettlementValidator extends InContractSettleValidator { ExtendedDataEntity[] var2 = dataEntities; int var3 = dataEntities.length; - for(int var4 = 0; var4 < var3; ++var4) { + for (int var4 = 0; var4 < var3; ++var4) { ExtendedDataEntity dataEntity = var2[var4]; BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount"); DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract"); if (contractTemp == null) { return; } - long id = dataEntity.getDataEntity().getLong("id"); - QFilter f1 = new QFilter("id", "=", id); - DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); - if(incontractsettle!=null){ - DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); - if(itementry == null) { - if(itementry.isEmpty()) { - this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); - } - DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract"); - BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); - BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); - DynamicObject contractType = contract.getDynamicObject("contracttype"); - DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); - boolean validateAmount = true; - if (contractAttr != null) { - contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); - validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); - } + DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); + if (itementry != null) { + if (itementry.size() == 0) { + this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); + } + DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract"); + BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount"); + BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount"); + DynamicObject contractType = contract.getDynamicObject("contracttype"); + DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr"); + boolean validateAmount = true; + if (contractAttr != null) { + contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr"); + validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype")); } } // DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java index cfa3005..b83a873 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettlementValidator.java @@ -17,12 +17,8 @@ public class OutContractSettlementValidator extends OutContractSettleValidator { { BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount"); DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract"); - long id = dataEntity.getDataEntity().getLong("id"); - QFilter f1 = new QFilter("id", "=", id); - DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1}); - if(incontractsettle!=null){ - DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry"); -// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap"); + + DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry"); if(itementry.isEmpty()) { this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0])); } @@ -48,9 +44,6 @@ public class OutContractSettlementValidator extends OutContractSettleValidator { return true; } } - } - } - return true; } }