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 | 70 | |
| 71 | 71 | ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo(); |
| 72 | 72 | errorInfo.setRuleId(wrapInput.getRuleId()); |
| 73 | - errorInfo.setClZbh(wrapInput.getClZbh()); | |
| 73 | +// errorInfo.setClZbh(wrapInput.getClZbh()); | |
| 74 | 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 | 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 | 93 | // 2、路牌id,路牌名字,路牌起始索引验证 |
| 86 | 94 | if (StringUtils.isNotEmpty(wrapInput.getLpIds()) && |
| 87 | 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 | 16 | private Integer xlId; |
| 17 | 17 | /** 车辆自编号 */ |
| 18 | 18 | private String clZbh; |
| 19 | + /** 车咯配置Id */ | |
| 20 | + private Long ccId; | |
| 19 | 21 | /** 路牌id列表 */ |
| 20 | 22 | private String lpIds; |
| 21 | 23 | /** 路牌名字列表 */ |
| ... | ... | @@ -33,16 +35,17 @@ public class WrapInput { |
| 33 | 35 | /** 启用日期 */ |
| 34 | 36 | private Date qyrq; |
| 35 | 37 | |
| 36 | - private Map<String, CarConfigInfo> ccInfos = new HashMap<>(); | |
| 38 | + private Map<Long, CarConfigInfo> ccInfos = new HashMap<>(); | |
| 37 | 39 | private Map<Long, GuideboardInfo> lpInfos = new HashMap<>(); |
| 38 | 40 | private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>(); |
| 39 | 41 | |
| 40 | 42 | public WrapInput(ScheduleRule1Flat r, |
| 41 | - Map<String, CarConfigInfo> cc, | |
| 43 | + Map<Long, CarConfigInfo> cc, | |
| 42 | 44 | Map<Long, GuideboardInfo> lp, |
| 43 | 45 | Map<Long, EmployeeConfigInfo> ec) { |
| 44 | 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 | 49 | this.lpIds = r.getLpIds(); |
| 47 | 50 | this.lpNames = r.getLpNames(); |
| 48 | 51 | this.ecIds = r.getRyConfigIds(); |
| ... | ... | @@ -136,6 +139,14 @@ public class WrapInput { |
| 136 | 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 | 150 | public Date getQyrq() { |
| 140 | 151 | return qyrq; |
| 141 | 152 | } |
| ... | ... | @@ -144,11 +155,11 @@ public class WrapInput { |
| 144 | 155 | this.qyrq = qyrq; |
| 145 | 156 | } |
| 146 | 157 | |
| 147 | - public Map<String, CarConfigInfo> getCcInfos() { | |
| 158 | + public Map<Long, CarConfigInfo> getCcInfos() { | |
| 148 | 159 | return ccInfos; |
| 149 | 160 | } |
| 150 | 161 | |
| 151 | - public void setCcInfos(Map<String, CarConfigInfo> ccInfos) { | |
| 162 | + public void setCcInfos(Map<Long, CarConfigInfo> ccInfos) { | |
| 152 | 163 | this.ccInfos = ccInfos; |
| 153 | 164 | } |
| 154 | 165 | ... | ... |
src/main/resources/rules/kBase3_validate_rule.drl
| ... | ... | @@ -38,10 +38,10 @@ global ValidateRuleResult result; |
| 38 | 38 | |
| 39 | 39 | //------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------// |
| 40 | 40 | |
| 41 | -// 1、车辆信息载入 | |
| 41 | +// 1、车辆配置信息载入 | |
| 42 | 42 | declare CarConfig_Wraps |
| 43 | 43 | xlId: Integer // 线路Id |
| 44 | - ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo> | |
| 44 | + ccMap: Map // 车辆配置Map Map<车咯配置Id, CarConfigInfo> | |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | rule "calcu_CarConfig_Wraps" |
| ... | ... | @@ -58,13 +58,13 @@ rule "calcu_CarConfig_Wraps" |
| 58 | 58 | for (int i = 0; i < ccInfos.size(); i++) { |
| 59 | 59 | CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i); |
| 60 | 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 | 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 | 68 | end |
| 69 | 69 | |
| 70 | 70 | // 2、路牌信息载入 | ... | ... |