diff --git a/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java index 32fc9b9..afa1961 100644 --- a/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java +++ b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java @@ -49,27 +49,36 @@ public class ContractOPPlugin extends AbstractOperationServicePlugIn { } //合同清单(定额) DynamicObjectCollection invoiceentryinfos; + BigDecimal qeug_amounts = BigDecimal.ZERO;//金额(元)_合计 + //合同清单(定额) + DynamicObjectCollection orderformentry; + BigDecimal qeug_taxtotalprices = BigDecimal.ZERO;//金额(元)_合计 + boolean isEntry = false; try { //合同监控列表点击提交会提示找不到:qeug_invoiceentryinfo属性 invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo"); - if (!invoiceentryinfos.isEmpty()) { - for (DynamicObject invoiceentryinfo : invoiceentryinfos) { - BigDecimal qeug_amount = invoiceentryinfo.getBigDecimal("qeug_amount"); - } - } + //合同监控列表点击提交会提示找不到:qeug_orderformentry属性 + orderformentry = dataEntity.getDynamicObjectCollection("qeug_orderformentry"); }catch (Exception e){ dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_contractbill"); invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo"); + orderformentry = dataEntity.getDynamicObjectCollection("qeug_orderformentry"); } - BigDecimal qeug_amounts = BigDecimal.ZERO;//金额(元)_合计 if (!invoiceentryinfos.isEmpty()) { + isEntry = true; for (DynamicObject invoiceentryinfo : invoiceentryinfos) { qeug_amounts = qeug_amounts.add(invoiceentryinfo.getBigDecimal("qeug_amount")); } } + if (!orderformentry.isEmpty()) { + isEntry = true; + for (DynamicObject orderform : orderformentry) { + qeug_taxtotalprices = qeug_taxtotalprices.add(orderform.getBigDecimal("qeug_taxtotalprice")); + } + } BigDecimal amount = dataEntity.getBigDecimal("amount");//合同金额 // 检查 qeug_amounts 是否大于 amount - if (qeug_amounts.setScale(2, RoundingMode.HALF_UP).compareTo(amount) > 0) { + if (isEntry&&qeug_amounts.add(qeug_taxtotalprices).setScale(2, RoundingMode.HALF_UP).compareTo(amount) < 0) { this.addErrorMessage(extendedDataEntity, "合同清单(定额)的金额之和不能大于合同金额"); } // DynamicObjectCollection qeug_orderformentry1 = dataEntity.getDynamicObjectCollection("qeug_orderformentry");