合同提交校验合同清单金额与合同金额的差

This commit is contained in:
ptt 2025-04-25 15:31:39 +08:00
parent 8b2d6bbc4c
commit 4e78f4c85b
1 changed files with 16 additions and 7 deletions

View File

@ -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");