From e4ea1655f8471d7d60ffef6fc6de5f8d1ad1deac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=B4=B5=E5=BC=BA?= Date: Sat, 15 Mar 2025 14:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=A0=87=E7=8E=AF=E8=8A=82=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E5=AE=9A=E6=A0=87=E6=80=BB=E9=87=91=E9=A2=9D=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E=E9=87=87=E8=B4=AD=E6=8E=A7=E5=88=B6=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../validators/DecisionAmountValidator.java | 52 +++++++++++++++++++ .../recon/validator/ConNoTextValidator.java | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 main/java/shkd/repc/rebm/validators/DecisionAmountValidator.java diff --git a/main/java/shkd/repc/rebm/validators/DecisionAmountValidator.java b/main/java/shkd/repc/rebm/validators/DecisionAmountValidator.java new file mode 100644 index 0000000..3adbc31 --- /dev/null +++ b/main/java/shkd/repc/rebm/validators/DecisionAmountValidator.java @@ -0,0 +1,52 @@ +package shkd.repc.rebm.validators; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; + +import java.math.BigDecimal; + +/** + * 动态表单插件 + * 定标环节如果定标总金额大于采购控制金额不允许提交 + */ +public class DecisionAmountValidator extends AbstractValidator { + + @Override + public void validate() { + ExtendedDataEntity[] dataEntities = this.getDataEntities(); + if (dataEntities == null || dataEntities.length == 0) { + return; + } + for (ExtendedDataEntity dataEntity : dataEntities) { + if (dataEntity == null) { + continue; + } + DynamicObject bill = dataEntity.getDataEntity(); + DynamicObject decisionBill = BusinessDataServiceHelper.loadSingle(bill.getLong("id"), "rebm_decision"); + if (decisionBill == null) { + continue; + } + + //采购控制明细 + DynamicObjectCollection bottomEntry = decisionBill.getDynamicObjectCollection("bottomentry"); + if (!bottomEntry.isEmpty()){ + BigDecimal allEntryAmount=BigDecimal.ZERO; + for (DynamicObject dynamicObject : bottomEntry) { + //采购控制金额(含税) + BigDecimal botControlAmount = dynamicObject.getBigDecimal("botcontrolamount"); + allEntryAmount=allEntryAmount.add(botControlAmount); + } + //定标总金额 + BigDecimal amount = decisionBill.getBigDecimal("amount"); + if (amount.compareTo(allEntryAmount)>0){ + this.addErrorMessage(dataEntity, "提交失败!定标总金额不能大于采购控制金额(含税)!"); + } + } + } + } +} \ No newline at end of file diff --git a/main/java/shkd/repc/recon/validator/ConNoTextValidator.java b/main/java/shkd/repc/recon/validator/ConNoTextValidator.java index fc4e425..9bb6862 100644 --- a/main/java/shkd/repc/recon/validator/ConNoTextValidator.java +++ b/main/java/shkd/repc/recon/validator/ConNoTextValidator.java @@ -51,7 +51,7 @@ public class ConNoTextValidator extends AbstractValidator { // 计算占用金额,并收集提示信息 BigDecimal occupationAmount = BigDecimal.ZERO; StringBuilder message = new StringBuilder(); - + message.append("申请超额:\n"); for (DynamicObject otherBill : relatedBills) { if (otherBill.getLong("id") == currentBill.getLong("id")) { continue; // 跳过当前单据