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: