Commit 061f1a92a4202f687f2ec7289ee6fb6bb4ecf849
1 parent
f06e1baf
1、修改排班计划规则验证逻辑,之前是验证自编号是否为空,现在改成规则中的车辆配置Id是否在该线路未作废的车辆配置中,具体查看相关drl
Showing
3 changed files
with
35 additions
and
16 deletions
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ErrorInfoFunction.java
| @@ -70,18 +70,26 @@ public class ErrorInfoFunction implements AccumulateFunction { | @@ -70,18 +70,26 @@ public class ErrorInfoFunction implements AccumulateFunction { | ||
| 70 | 70 | ||
| 71 | ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo(); | 71 | ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo(); |
| 72 | errorInfo.setRuleId(wrapInput.getRuleId()); | 72 | errorInfo.setRuleId(wrapInput.getRuleId()); |
| 73 | - errorInfo.setClZbh(wrapInput.getClZbh()); | 73 | +// errorInfo.setClZbh(wrapInput.getClZbh()); |
| 74 | errorInfo.setQyrq(wrapInput.getQyrq()); | 74 | errorInfo.setQyrq(wrapInput.getQyrq()); |
| 75 | 75 | ||
| 76 | - // 1、车辆配置验证 | ||
| 77 | - if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空 | ||
| 78 | - if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上 | ||
| 79 | - errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!"); | ||
| 80 | - } | 76 | + // 1、车咯配置验证 |
| 77 | + if (wrapInput.getCcInfos().get(wrapInput.getCcId()) == null) { | ||
| 78 | + errorInfo.setClZbh("未知的车咯配置 rule[id=" + wrapInput.getRuleId() + "]"); | ||
| 79 | + errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!"); | ||
| 81 | } else { | 80 | } else { |
| 82 | - errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!"); | 81 | + errorInfo.setClZbh(wrapInput.getCcInfos().get(wrapInput.getCcId()).getCl().getInsideCode()); |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 84 | +// // 1、车辆配置验证 | ||
| 85 | +// if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空 | ||
| 86 | +// if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上 | ||
| 87 | +// errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!"); | ||
| 88 | +// } | ||
| 89 | +// } else { | ||
| 90 | +// errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!"); | ||
| 91 | +// } | ||
| 92 | + | ||
| 85 | // 2、路牌id,路牌名字,路牌起始索引验证 | 93 | // 2、路牌id,路牌名字,路牌起始索引验证 |
| 86 | if (StringUtils.isNotEmpty(wrapInput.getLpIds()) && | 94 | if (StringUtils.isNotEmpty(wrapInput.getLpIds()) && |
| 87 | StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空 | 95 | StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空 |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/WrapInput.java
| @@ -16,6 +16,8 @@ public class WrapInput { | @@ -16,6 +16,8 @@ public class WrapInput { | ||
| 16 | private Integer xlId; | 16 | private Integer xlId; |
| 17 | /** 车辆自编号 */ | 17 | /** 车辆自编号 */ |
| 18 | private String clZbh; | 18 | private String clZbh; |
| 19 | + /** 车咯配置Id */ | ||
| 20 | + private Long ccId; | ||
| 19 | /** 路牌id列表 */ | 21 | /** 路牌id列表 */ |
| 20 | private String lpIds; | 22 | private String lpIds; |
| 21 | /** 路牌名字列表 */ | 23 | /** 路牌名字列表 */ |
| @@ -33,16 +35,17 @@ public class WrapInput { | @@ -33,16 +35,17 @@ public class WrapInput { | ||
| 33 | /** 启用日期 */ | 35 | /** 启用日期 */ |
| 34 | private Date qyrq; | 36 | private Date qyrq; |
| 35 | 37 | ||
| 36 | - private Map<String, CarConfigInfo> ccInfos = new HashMap<>(); | 38 | + private Map<Long, CarConfigInfo> ccInfos = new HashMap<>(); |
| 37 | private Map<Long, GuideboardInfo> lpInfos = new HashMap<>(); | 39 | private Map<Long, GuideboardInfo> lpInfos = new HashMap<>(); |
| 38 | private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>(); | 40 | private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>(); |
| 39 | 41 | ||
| 40 | public WrapInput(ScheduleRule1Flat r, | 42 | public WrapInput(ScheduleRule1Flat r, |
| 41 | - Map<String, CarConfigInfo> cc, | 43 | + Map<Long, CarConfigInfo> cc, |
| 42 | Map<Long, GuideboardInfo> lp, | 44 | Map<Long, GuideboardInfo> lp, |
| 43 | Map<Long, EmployeeConfigInfo> ec) { | 45 | Map<Long, EmployeeConfigInfo> ec) { |
| 44 | this.xlId = r.getXl().getId(); | 46 | this.xlId = r.getXl().getId(); |
| 45 | - this.clZbh = r.getCarConfigInfo().getCl().getInsideCode(); | 47 | +// this.clZbh = r.getCarConfigInfo().getCl().getInsideCode(); |
| 48 | + this.ccId = r.getCarConfigInfo().getId(); | ||
| 46 | this.lpIds = r.getLpIds(); | 49 | this.lpIds = r.getLpIds(); |
| 47 | this.lpNames = r.getLpNames(); | 50 | this.lpNames = r.getLpNames(); |
| 48 | this.ecIds = r.getRyConfigIds(); | 51 | this.ecIds = r.getRyConfigIds(); |
| @@ -136,6 +139,14 @@ public class WrapInput { | @@ -136,6 +139,14 @@ public class WrapInput { | ||
| 136 | this.ruleId = ruleId; | 139 | this.ruleId = ruleId; |
| 137 | } | 140 | } |
| 138 | 141 | ||
| 142 | + public Long getCcId() { | ||
| 143 | + return ccId; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public void setCcId(Long ccId) { | ||
| 147 | + this.ccId = ccId; | ||
| 148 | + } | ||
| 149 | + | ||
| 139 | public Date getQyrq() { | 150 | public Date getQyrq() { |
| 140 | return qyrq; | 151 | return qyrq; |
| 141 | } | 152 | } |
| @@ -144,11 +155,11 @@ public class WrapInput { | @@ -144,11 +155,11 @@ public class WrapInput { | ||
| 144 | this.qyrq = qyrq; | 155 | this.qyrq = qyrq; |
| 145 | } | 156 | } |
| 146 | 157 | ||
| 147 | - public Map<String, CarConfigInfo> getCcInfos() { | 158 | + public Map<Long, CarConfigInfo> getCcInfos() { |
| 148 | return ccInfos; | 159 | return ccInfos; |
| 149 | } | 160 | } |
| 150 | 161 | ||
| 151 | - public void setCcInfos(Map<String, CarConfigInfo> ccInfos) { | 162 | + public void setCcInfos(Map<Long, CarConfigInfo> ccInfos) { |
| 152 | this.ccInfos = ccInfos; | 163 | this.ccInfos = ccInfos; |
| 153 | } | 164 | } |
| 154 | 165 |
src/main/resources/rules/kBase3_validate_rule.drl
| @@ -38,10 +38,10 @@ global ValidateRuleResult result; | @@ -38,10 +38,10 @@ global ValidateRuleResult result; | ||
| 38 | 38 | ||
| 39 | //------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------// | 39 | //------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------// |
| 40 | 40 | ||
| 41 | -// 1、车辆信息载入 | 41 | +// 1、车辆配置信息载入 |
| 42 | declare CarConfig_Wraps | 42 | declare CarConfig_Wraps |
| 43 | xlId: Integer // 线路Id | 43 | xlId: Integer // 线路Id |
| 44 | - ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo> | 44 | + ccMap: Map // 车辆配置Map Map<车咯配置Id, CarConfigInfo> |
| 45 | end | 45 | end |
| 46 | 46 | ||
| 47 | rule "calcu_CarConfig_Wraps" | 47 | rule "calcu_CarConfig_Wraps" |
| @@ -58,13 +58,13 @@ rule "calcu_CarConfig_Wraps" | @@ -58,13 +58,13 @@ rule "calcu_CarConfig_Wraps" | ||
| 58 | for (int i = 0; i < ccInfos.size(); i++) { | 58 | for (int i = 0; i < ccInfos.size(); i++) { |
| 59 | CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i); | 59 | CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i); |
| 60 | if (!ccInfo.getIsCancel()) { | 60 | if (!ccInfo.getIsCancel()) { |
| 61 | - carConfig_wraps.getCcMap().put(ccInfo.getCl().getInsideCode(), ccInfo); | 61 | + carConfig_wraps.getCcMap().put(ccInfo.getId(), ccInfo); |
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | insert(carConfig_wraps); | 65 | insert(carConfig_wraps); |
| 66 | 66 | ||
| 67 | - LOG.info("第一阶段 --> 1、车辆信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size()); | 67 | + LOG.info("第一阶段 --> 1、车辆配置信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size()); |
| 68 | end | 68 | end |
| 69 | 69 | ||
| 70 | // 2、路牌信息载入 | 70 | // 2、路牌信息载入 |