From e8108297cfb7219f26968d96e8ef2e7c8acdbe9f Mon Sep 17 00:00:00 2001 From: zhangzhiguo <zhangzhiguo@123> Date: Wed, 16 Apr 2025 20:06:10 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7=E5=8D=95?= =?UTF-8?q?=E5=AE=9E=E4=BB=98=E9=87=91=E9=A2=9D=E6=A0=B9=E6=8D=AE=E4=BB=98?= =?UTF-8?q?=E6=AC=BE=E7=94=B3=E8=AF=B7=E5=8D=95=E8=A1=8C=E5=8F=B7=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=8F=8D=E5=86=99=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutContractSettleProcessCheckOp.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettleProcessCheckOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettleProcessCheckOp.java index bb73c0d..f83949d 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettleProcessCheckOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/OutContractSettleProcessCheckOp.java @@ -7,6 +7,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.validate.AbstractValidator; +import kd.bos.servicehelper.BusinessDataServiceHelper; import java.math.BigDecimal; @@ -19,7 +20,10 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl public void onPreparePropertys(PreparePropertysEventArgs e) { super.onPreparePropertys(e); e.getFieldKeys().add("itementry"); + e.getFieldKeys().add("itementry.oftaxamount"); e.getFieldKeys().add("zcgj_processallocatentity"); + e.getFieldKeys().add("contract"); + //e.getFieldKeys().add("contract.zcgj_pricetype"); } @Override @@ -35,19 +39,27 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { DynamicObject dataEntity = extendedDataEntity.getDataEntity(); - DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry"); - int i=1; - for (DynamicObject itementry : itementryCollection) { - BigDecimal oftaxamount = itementry.getBigDecimal("oftaxamount"); - DynamicObjectCollection processallocatentityCollection = itementry.getDynamicObjectCollection("zcgj_processallocatentity"); - BigDecimal totalPaAmount = BigDecimal.ZERO; - for (DynamicObject dynamicObject : processallocatentityCollection) { - totalPaAmount = totalPaAmount.add(dynamicObject.getBigDecimal("zcgj_pa_amount")); + DynamicObject contract = dataEntity.getDynamicObject("contract"); + if (contract != null) { + DynamicObject contractObj = BusinessDataServiceHelper.loadSingle(contract.getLong("id"), "ec_out_contract", "zcgj_pricetype"); + //不定量不定价合同和总价包干合同,zjbg,bdlbdj + if (contractObj.getString("zcgj_pricetype").equals("zjbg") + || contractObj.getString("zcgj_pricetype").equals("bdlbdj")) { + DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry"); + int i=1; + for (DynamicObject itementry : itementryCollection) { + BigDecimal oftaxamount = itementry.getBigDecimal("oftaxamount"); + DynamicObjectCollection processallocatentityCollection = itementry.getDynamicObjectCollection("zcgj_processallocatentity"); + BigDecimal totalPaAmount = BigDecimal.ZERO; + for (DynamicObject dynamicObject : processallocatentityCollection) { + totalPaAmount = totalPaAmount.add(dynamicObject.getBigDecimal("zcgj_pa_amount")); + } + if(totalPaAmount.compareTo(oftaxamount)!=0){ + this.addFatalErrorMessage(extendedDataEntity, "合同支付项第"+i+"条,价税合计金额与工序分摊金额不一致,请重新核对并调整分摊金额,以确保两者相等。"); + } + i++; + } } - if(totalPaAmount.compareTo(oftaxamount)!=0){ - this.addFatalErrorMessage(extendedDataEntity, "合同支付项第"+i+"条,价税合计金额与工序分摊金额不一致,请重新核对并调整分摊金额,以确保两者相等。"); - } - i++; } } }