From 760c9e7af2353a6fccafbdd616ebcfe69fe8e1bc Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Sat, 15 Mar 2025 15:53:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E9=87=87=E8=B4=AD=E9=9C=80?= =?UTF-8?q?=E6=B1=82,=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=90=BA?= =?UTF-8?q?=E5=B8=A6=E9=A1=B9=E7=9B=AE=E9=80=BB=E8=BE=91=202.=E6=96=B0?= =?UTF-8?q?=E5=A2=9E(=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E4=B8=AD=E7=9A=84=E7=94=B3=E8=AF=B7=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E5=90=88=E7=BA=A6=E8=A7=84=E5=88=92=E9=87=91?= =?UTF-8?q?=E9=A2=9D=EF=BC=8C=E4=B8=8D=E5=85=81=E8=AE=B8=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E3=80=82)=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit S --- .../rebm/formplugin/PurDemandFormPlugin.java | 12 ++++++++++-- .../repc/rebm/formplugin/PurPlanFormPlugin.java | 11 ++++++++++- .../rebm/opplugin/PurPlanSubmitOPPlugin.java | 17 +++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/main/java/shkd/repc/rebm/formplugin/PurDemandFormPlugin.java b/main/java/shkd/repc/rebm/formplugin/PurDemandFormPlugin.java index 6318b39..ff3109b 100644 --- a/main/java/shkd/repc/rebm/formplugin/PurDemandFormPlugin.java +++ b/main/java/shkd/repc/rebm/formplugin/PurDemandFormPlugin.java @@ -35,15 +35,23 @@ public class PurDemandFormPlugin extends AbstractFormPlugin { String name = e.getProperty().getName(); //根据组织携带项目 if ("org".equals(name)) { - updateRenovationProject(); + updateRenovationProjects(); } } private void updateRenovationProject() { DynamicObject org = (DynamicObject) this.getModel().getValue("org"); + DynamicObject renovation_proj = (DynamicObject)this.getModel().getValue("qeug_renovation_proj"); + // 只有在需求组织不为空 并且项目不为空的情况下才进行查询 + if (org != null && null == renovation_proj) { + setRenovationProjectByOrg(org); + } + } + private void updateRenovationProjects() { + DynamicObject org = (DynamicObject) this.getModel().getValue("org"); // 只有在需求组织不为空的情况下才进行查询 - if (org != null) { + if (org != null ) { setRenovationProjectByOrg(org); } else { // 组织为空,清空项目 diff --git a/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java b/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java index e39402f..e0777d3 100644 --- a/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java +++ b/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java @@ -69,12 +69,21 @@ public class PurPlanFormPlugin extends AbstractBillPlugIn implements HyperLinkCl String name = e.getProperty().getName(); //根据组织携带项目 if ("org".equals(name)) { - updateRenovationProject(); + updateRenovationProjects(); } } private void updateRenovationProject() { DynamicObject org = (DynamicObject) this.getModel().getValue("org"); + DynamicObject purproject = (DynamicObject)this.getModel().getValue("purproject"); + // 只有在需求组织不为空的情况下才进行查询 + if (org != null && null == purproject) { + setRenovationProjectByOrg(org); + } + } + + private void updateRenovationProjects() { + DynamicObject org = (DynamicObject) this.getModel().getValue("org"); // 只有在需求组织不为空的情况下才进行查询 if (org != null) { diff --git a/main/java/shkd/repc/rebm/opplugin/PurPlanSubmitOPPlugin.java b/main/java/shkd/repc/rebm/opplugin/PurPlanSubmitOPPlugin.java index 860f437..dbbbd47 100644 --- a/main/java/shkd/repc/rebm/opplugin/PurPlanSubmitOPPlugin.java +++ b/main/java/shkd/repc/rebm/opplugin/PurPlanSubmitOPPlugin.java @@ -9,6 +9,8 @@ import kd.bos.entity.validate.AbstractValidator; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; +import java.math.BigDecimal; + public class PurPlanSubmitOPPlugin extends AbstractOperationServicePlugIn { private static final Log logger = LogFactory.getLog(PurPlanSubmitOPPlugin.class); @@ -30,6 +32,21 @@ public class PurPlanSubmitOPPlugin extends AbstractOperationServicePlugIn { if (cgxuentry.isEmpty()) { this.addErrorMessage(extendedDataEntity, "采购需求明细不能为空,不允许提交。"); } + //采购计划明细 + BigDecimal cgxuentry_a = BigDecimal.ZERO; + for (DynamicObject dynamicObject : cgxuentry) { + cgxuentry_a = cgxuentry_a.add(dynamicObject.getBigDecimal("qeug_applyamount")); + } + //合约规划金额 entryentity + DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity"); + BigDecimal cgxuentry_b = BigDecimal.ZERO; + for (DynamicObject dynamicObject : entryentity) { + cgxuentry_b = cgxuentry_b.add(dynamicObject.getBigDecimal("planamount")); + } + if (cgxuentry_a.compareTo(cgxuentry_b) > 0) { // 如果 cgxuentry_a 大于 cgxuentry_b + this.addErrorMessage(extendedDataEntity, "采购计划明细中的申请金额大于合约规划金额,不允许提交。"); + } + } break; default: