From c48838e47b67878391990f73b8e90177bd9849bc Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Tue, 11 Feb 2025 17:44:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=90=88=E5=90=8C=E6=B8=85=E5=8D=95(?= =?UTF-8?q?=E5=AE=9A=E9=A2=9D)=E7=9A=84=E9=87=91=E9=A2=9D=E4=B9=8B?= =?UTF-8?q?=E5=92=8C=E4=B8=8D=E8=83=BD=E5=A4=A7=E4=BA=8E=E5=90=88=E5=90=8C?= =?UTF-8?q?=E9=87=91=E9=A2=9D=5F=E5=90=88=E5=90=8C=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit S --- .../repc/recon/opplugin/ContractOPPlugin.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java index a97b72c..0cbbf9f 100644 --- a/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java +++ b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java @@ -8,6 +8,7 @@ import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.validate.AbstractValidator; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; +import kd.bos.servicehelper.BusinessDataServiceHelper; import java.math.BigDecimal; @@ -27,7 +28,13 @@ public class ContractOPPlugin extends AbstractOperationServicePlugIn { for (ExtendedDataEntity extendedDataEntity : dataEntities1) { //保证金明细 DynamicObject dataEntity = extendedDataEntity.getDataEntity(); - DynamicObjectCollection qeugBondentrys = dataEntity.getDynamicObjectCollection("qeug_bondentry"); + DynamicObjectCollection qeugBondentrys; + try { + qeugBondentrys = dataEntity.getDynamicObjectCollection("qeug_bondentry"); + }catch (Exception e){ + dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_contractbill"); + qeugBondentrys = dataEntity.getDynamicObjectCollection("qeug_bondentry"); + } BigDecimal qeugMarginlevel = BigDecimal.ZERO; if (!qeugBondentrys.isEmpty()) { for (DynamicObject qeugBondentry : qeugBondentrys) { @@ -37,6 +44,26 @@ public class ContractOPPlugin extends AbstractOperationServicePlugIn { if (qeugMarginlevel.compareTo(BigDecimal.valueOf(100)) > 0) { this.addErrorMessage(extendedDataEntity, "保证金明细:保证金比例(%)之和不能大于100"); } + //合同清单(定额) + DynamicObjectCollection invoiceentryinfos; + try { + //合同监控列表点击提交会提示找不到:qeug_invoiceentryinfo属性 + invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo"); + }catch (Exception e){ + dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_contractbill"); + invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo"); + } + BigDecimal qeug_amounts = BigDecimal.ZERO;//金额(元)_合计 + if (!invoiceentryinfos.isEmpty()) { + for (DynamicObject invoiceentryinfo : invoiceentryinfos) { + qeug_amounts = qeug_amounts.add(invoiceentryinfo.getBigDecimal("qeug_amount")); + } + } + BigDecimal amount = dataEntity.getBigDecimal("amount");//合同金额 + // 检查 qeug_amounts 是否大于 amount + if (qeug_amounts.compareTo(amount) > 0) { + this.addErrorMessage(extendedDataEntity, "合同清单(定额)的金额之和不能大于合同金额"); + } } break; case "qeug_attatchment":