Commit c1567544b0c3ebcb5c1ae4434b5b0b64f276f4be
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into
minhang
Showing
29 changed files
with
1249 additions
and
99 deletions
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
0 → 100644
| 1 | +//package com.bsth.controller.realcontrol; | |
| 2 | +// | |
| 3 | +//import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +//import org.springframework.web.bind.annotation.RestController; | |
| 5 | +// | |
| 6 | +///** | |
| 7 | +// * 对外的营运数据接口,主要输出当日的数据 | |
| 8 | +// * Created by panzhao on 2017/3/15. | |
| 9 | +// */ | |
| 10 | +//@RestController | |
| 11 | +//@RequestMapping("/companyService") | |
| 12 | +//public class ServiceDataInterface { | |
| 13 | +//} | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -494,6 +494,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 494 | 494 | if (config != null) |
| 495 | 495 | outConfig = config.getOutConfig(); |
| 496 | 496 | |
| 497 | + //限定出站既出场的停车场 | |
| 498 | + String park = config.getTwinsPark(); | |
| 499 | + boolean limitPark = StringUtils.isNotEmpty(park); | |
| 497 | 500 | boolean flag = false; |
| 498 | 501 | ScheduleRealInfo next = null; |
| 499 | 502 | for (ScheduleRealInfo temp : list) { |
| ... | ... | @@ -506,7 +509,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 506 | 509 | continue; |
| 507 | 510 | |
| 508 | 511 | //出站既出场,忽略出场班次 |
| 509 | - if (outConfig == 2 && temp.getBcType().equals("out")) | |
| 512 | + if (outConfig == 2 && temp.getBcType().equals("out") | |
| 513 | + && (!limitPark || park.equals(temp.getQdzCode()))) | |
| 510 | 514 | continue; |
| 511 | 515 | |
| 512 | 516 | if (flag) { |
| ... | ... | @@ -529,6 +533,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 529 | 533 | if (config != null) |
| 530 | 534 | outConfig = config.getOutConfig(); |
| 531 | 535 | |
| 536 | + //限定出站既出场的停车场 | |
| 537 | + String park = config.getTwinsPark(); | |
| 538 | + boolean limitPark = StringUtils.isNotEmpty(park); | |
| 532 | 539 | boolean flag = false; |
| 533 | 540 | ScheduleRealInfo next = null; |
| 534 | 541 | for (ScheduleRealInfo temp : list) { |
| ... | ... | @@ -541,7 +548,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 541 | 548 | continue; |
| 542 | 549 | |
| 543 | 550 | //出站既出场,忽略出场班次 |
| 544 | - if (outConfig == 2 && temp.getBcType().equals("out")) | |
| 551 | + if (outConfig == 2 && temp.getBcType().equals("out") | |
| 552 | + && (!limitPark || park.equals(temp.getQdzCode()))) | |
| 545 | 553 | continue; |
| 546 | 554 | |
| 547 | 555 | if (flag && temp.getXlDir().equals(sch.getXlDir())) { | ... | ... |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| ... | ... | @@ -47,6 +47,9 @@ public class LineConfig { |
| 47 | 47 | /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */ |
| 48 | 48 | private int outConfig; |
| 49 | 49 | |
| 50 | + /** 出站既出场 对应的停车场 */ | |
| 51 | + private String twinsPark; | |
| 52 | + | |
| 50 | 53 | /** 短语模板 , 号分隔多个 */ |
| 51 | 54 | private String phraseTemps; |
| 52 | 55 | |
| ... | ... | @@ -208,4 +211,12 @@ public class LineConfig { |
| 208 | 211 | public void setDownOutDiff(int downOutDiff) { |
| 209 | 212 | this.downOutDiff = downOutDiff; |
| 210 | 213 | } |
| 214 | + | |
| 215 | + public String getTwinsPark() { | |
| 216 | + return twinsPark; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public void setTwinsPark(String twinsPark) { | |
| 220 | + this.twinsPark = twinsPark; | |
| 221 | + } | |
| 211 | 222 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
| 1 | 1 | package com.bsth.entity.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.CarPark; | |
| 3 | 4 | import com.bsth.entity.Cars; |
| 4 | 5 | import com.bsth.entity.Line; |
| 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| ... | ... | @@ -47,9 +48,16 @@ public class CarConfigInfo extends BEntity implements Serializable { |
| 47 | 48 | private Date qyrq; |
| 48 | 49 | /** 终止日期 */ |
| 49 | 50 | private Date zzrq; |
| 51 | + | |
| 52 | + | |
| 50 | 53 | @Column(nullable = false) |
| 51 | 54 | /** 停车点(TODO:这个不知道是否要关联)*/ |
| 52 | 55 | private String tcd; |
| 56 | + | |
| 57 | + /** 停车场关联(出场,进场班次会关联停车场) */ | |
| 58 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 59 | + private CarPark tcc; | |
| 60 | + | |
| 53 | 61 | /** 受否切换 0或者1(TODO:不懂,貌似喝历史配车有关) */ |
| 54 | 62 | @Column(nullable = false) |
| 55 | 63 | private int isSwitch; |
| ... | ... | @@ -248,4 +256,12 @@ public class CarConfigInfo extends BEntity implements Serializable { |
| 248 | 256 | public void setDownInSj(Double downInSj) { |
| 249 | 257 | this.downInSj = downInSj; |
| 250 | 258 | } |
| 259 | + | |
| 260 | + public CarPark getTcc() { | |
| 261 | + return tcc; | |
| 262 | + } | |
| 263 | + | |
| 264 | + public void setTcc(CarPark tcc) { | |
| 265 | + this.tcc = tcc; | |
| 266 | + } | |
| 251 | 267 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -160,7 +160,10 @@ public class SchedulePlanInfo { |
| 160 | 160 | Boolean isFb, |
| 161 | 161 | CarConfigInfo carConfigInfo, |
| 162 | 162 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 163 | - SchedulePlan schedulePlan) { | |
| 163 | + SchedulePlan schedulePlan, | |
| 164 | + boolean isFirstBc, // 是否第一个班次 | |
| 165 | + boolean isLastBc // 是否最后一个班次 | |
| 166 | + ) { | |
| 164 | 167 | |
| 165 | 168 | // TODO:关联的公司名称 |
| 166 | 169 | // TODO:关联的公司编码 |
| ... | ... | @@ -266,6 +269,47 @@ public class SchedulePlanInfo { |
| 266 | 269 | // 使用的时刻表名字 |
| 267 | 270 | this.ttInfoName = ttInfoDetail.getTtinfo().getName(); |
| 268 | 271 | |
| 272 | + // 使用车辆配置的停车场信息 | |
| 273 | + String pzType = carConfigInfo.getPzType(); // 配置类型 | |
| 274 | + if (pzType != null && !pzType.equals("BSY")) { | |
| 275 | + if ("ZW".equals(pzType)) { // 只看早晚进出场 | |
| 276 | + if (isFirstBc) { // 第一个班次是出场 | |
| 277 | + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 278 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | |
| 279 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | |
| 280 | + | |
| 281 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | |
| 282 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | |
| 283 | + | |
| 284 | + } else if (isLastBc) { // 最后一个班次是进场 | |
| 285 | + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 286 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | |
| 287 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | |
| 288 | + | |
| 289 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | |
| 290 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | |
| 291 | + } | |
| 292 | + | |
| 293 | + } else if ("FS".equals(pzType)) { // 所有进出场 | |
| 294 | + if ("out".equals(this.bcType)) { // 出场班次 | |
| 295 | + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 296 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | |
| 297 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | |
| 298 | + | |
| 299 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | |
| 300 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | |
| 301 | + | |
| 302 | + } else if ("in".equals(this.bcType)) { | |
| 303 | + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 304 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | |
| 305 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | |
| 306 | + | |
| 307 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | |
| 308 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | |
| 309 | + } | |
| 310 | + } | |
| 311 | + } | |
| 312 | + | |
| 269 | 313 | } |
| 270 | 314 | |
| 271 | 315 | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -853,6 +853,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 853 | 853 | rs.put("msg", "未烂班,无法撤销!"); |
| 854 | 854 | } else { |
| 855 | 855 | sch.setStatus(0); |
| 856 | + sch.setRemarks("");//清空备注 | |
| 856 | 857 | rs.put("status", ResponseCode.SUCCESS); |
| 857 | 858 | rs.put("t", sch); |
| 858 | 859 | |
| ... | ... | @@ -1058,7 +1059,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1058 | 1059 | //修改班次里程 |
| 1059 | 1060 | String jhlc = map.get("jhlc"); |
| 1060 | 1061 | if (StringUtils.isNotEmpty(jhlc) |
| 1061 | - && Double.parseDouble(jhlc) != sch.getJhlc()) { | |
| 1062 | + /*&& Double.parseDouble(jhlc) != sch.getJhlc()*/) { | |
| 1062 | 1063 | sch.setJhlc(Double.parseDouble(jhlc)); |
| 1063 | 1064 | } |
| 1064 | 1065 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -8,14 +8,17 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 8 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 9 | 9 | import com.bsth.service.BusinessService; |
| 10 | 10 | import com.bsth.service.LineService; |
| 11 | -import com.bsth.service.schedule.SchedulePlanService; | |
| 12 | -import com.bsth.service.schedule.TTInfoDetailService; | |
| 13 | -import com.bsth.service.schedule.TTInfoService; | |
| 11 | +import com.bsth.service.schedule.*; | |
| 12 | +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | |
| 13 | +import com.bsth.service.schedule.rules.plan.PlanResult; | |
| 14 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 15 | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 16 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 17 | 17 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 18 | 18 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 19 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | |
| 20 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 21 | +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | |
| 19 | 22 | import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; |
| 20 | 23 | import com.bsth.service.schedule.rules.ttinfo2.Result; |
| 21 | 24 | import com.google.common.collect.Multimap; |
| ... | ... | @@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; |
| 30 | 33 | import org.springframework.transaction.annotation.Isolation; |
| 31 | 34 | import org.springframework.transaction.annotation.Propagation; |
| 32 | 35 | import org.springframework.transaction.annotation.Transactional; |
| 36 | +import org.springframework.util.CollectionUtils; | |
| 33 | 37 | |
| 34 | 38 | import java.util.*; |
| 35 | 39 | |
| ... | ... | @@ -54,12 +58,191 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 54 | 58 | private TTInfoDetailService ttInfoDetailService; |
| 55 | 59 | @Autowired |
| 56 | 60 | private BusinessService businessService; |
| 61 | + @Autowired | |
| 62 | + private CarConfigInfoService carConfigInfoService; | |
| 63 | + @Autowired | |
| 64 | + private EmployeeConfigInfoService employeeConfigInfoService; | |
| 57 | 65 | |
| 58 | 66 | /** 日志记录器 */ |
| 59 | 67 | private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); |
| 60 | 68 | |
| 69 | + // 查找线路(未撤销),TODO:到时候放入drl中 | |
| 70 | + private Line getLine(Integer xlId) { | |
| 71 | + Map<String, Object> param = new HashMap<>(); | |
| 72 | + param.put("id_eq", xlId); | |
| 73 | + param.put("destroy_eq", 0); // 未撤销 | |
| 74 | + List<Line> lines = (List<Line>) lineService.list(param); | |
| 75 | + if (CollectionUtils.isEmpty(lines)) { | |
| 76 | + throw new RuntimeException("线路找不到,可能已经撤销!"); | |
| 77 | + } | |
| 78 | + return lines.get(0); | |
| 79 | + } | |
| 80 | + // 查找时刻表(未作废),TODO:到时候放入drl中 | |
| 81 | + private List<TTInfo> getTTInfos(Integer xlId) { | |
| 82 | + // 查询参数 | |
| 83 | + Map<String, Object> param = new HashMap<>(); | |
| 84 | + param.put("xl.id_eq", xlId); // 线路Id | |
| 85 | + param.put("isCancel_eq", false); // 作废的过滤掉 | |
| 86 | + Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator(); | |
| 87 | + if (!ttInfoIterator.hasNext()) { | |
| 88 | + throw new RuntimeException("线路id=" + xlId + " 没有时刻表!"); | |
| 89 | + } | |
| 90 | + List<TTInfo> ttInfos = new ArrayList<>(); | |
| 91 | + while (ttInfoIterator.hasNext()) { | |
| 92 | + TTInfo ttInfo = ttInfoIterator.next(); | |
| 93 | + ttInfos.add(ttInfo); | |
| 94 | + } | |
| 95 | + return ttInfos; | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 循环规则输出。 | |
| 100 | + * @param schedulePlan | |
| 101 | + */ | |
| 102 | + private ScheduleResults_output loopRuleOutput(SchedulePlan schedulePlan) { | |
| 103 | + // 获取主线路 | |
| 104 | + Line xl = strategy.getLine(schedulePlan.getXl().getId()); | |
| 105 | + | |
| 106 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 107 | + // 全局计算参数 | |
| 108 | + ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); | |
| 109 | + // 每个规则对应的输入参数 | |
| 110 | + List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>(); | |
| 111 | + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator(); | |
| 112 | + while (scheduleRule1FlatIterator.hasNext()) { | |
| 113 | + ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next(); | |
| 114 | + ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp); | |
| 115 | + scheduleRule_inputs.add(scheduleRule_input); | |
| 116 | + } | |
| 117 | + // 规则输出数据 | |
| 118 | + ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); | |
| 119 | + | |
| 120 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 121 | + // 创建session,内部配置的是stateful | |
| 122 | + KieSession session = kieBase.newKieSession(); | |
| 123 | + // 设置gloable对象,在drl中通过别名使用 | |
| 124 | + session.setGlobal("scheduleResult", scheduleResults_output); | |
| 125 | + session.setGlobal("log", logger); // 设置日志 | |
| 126 | + | |
| 127 | + // 载入数据 | |
| 128 | + session.insert(scheduleCalcuParam_input); | |
| 129 | + for (ScheduleRule_input scheduleRule_input : scheduleRule_inputs) { | |
| 130 | + session.insert(scheduleRule_input); | |
| 131 | + } | |
| 132 | + // 执行rule | |
| 133 | + session.fireAllRules(); | |
| 134 | + | |
| 135 | + // 执行完毕销毁,有日志的也要关闭 | |
| 136 | + session.dispose(); | |
| 137 | + | |
| 138 | + logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1()); | |
| 139 | + | |
| 140 | + return scheduleResults_output; | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * 时刻表选择(判定每天使用的时刻表)。 | |
| 145 | + * @param schedulePlan | |
| 146 | + * @return | |
| 147 | + */ | |
| 148 | + private TTInfoResults_output ttInfoOutput(SchedulePlan schedulePlan) { | |
| 149 | + // 获取线路的所有未作废的时刻表 | |
| 150 | + List<TTInfo> ttInfos = getTTInfos(schedulePlan.getXl().getId()); | |
| 151 | + | |
| 152 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 153 | + // 全局计算参数 | |
| 154 | + TTInfoCalcuParam_input ttInfoCalcuParam_input = | |
| 155 | + new TTInfoCalcuParam_input( | |
| 156 | + new DateTime(schedulePlan.getScheduleFromTime()), | |
| 157 | + new DateTime(schedulePlan.getScheduleToTime()), | |
| 158 | + String.valueOf(schedulePlan.getXl().getId()) | |
| 159 | + ); | |
| 160 | + // 规则输出数据 | |
| 161 | + TTInfoResults_output ttInfoResults_output = new TTInfoResults_output(); | |
| 162 | + | |
| 163 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 164 | + // 创建session,内部配置的是stateful | |
| 165 | + KieSession session = kieBase.newKieSession(); | |
| 166 | + | |
| 167 | + // 设置gloable对象,在drl中通过别名使用 | |
| 168 | + session.setGlobal("results", ttInfoResults_output); | |
| 169 | + session.setGlobal("log", logger); // 设置日志 | |
| 170 | + | |
| 171 | + // 载入数据 | |
| 172 | + session.insert(ttInfoCalcuParam_input); | |
| 173 | + for (TTInfo ttInfo : ttInfos) { | |
| 174 | + TTInfo_input ttInfo_input = new TTInfo_input(ttInfo); | |
| 175 | + session.insert(ttInfo_input); | |
| 176 | + } | |
| 177 | + | |
| 178 | + // 执行rule | |
| 179 | + session.fireAllRules(); | |
| 180 | + | |
| 181 | + // 执行完毕销毁,有日志的也要关闭 | |
| 182 | + session.dispose(); | |
| 183 | + | |
| 184 | + return ttInfoResults_output; | |
| 185 | + | |
| 186 | + } | |
| 187 | + | |
| 188 | + private PlanResult planResultOutput( | |
| 189 | + SchedulePlan schedulePlan, | |
| 190 | + ScheduleResults_output scheduleResults_output, | |
| 191 | + TTInfoResults_output ttInfoResults_output) { | |
| 192 | + | |
| 193 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 194 | + PlanCalcuParam_input planCalcuParam_input = new PlanCalcuParam_input( | |
| 195 | + schedulePlan, | |
| 196 | + scheduleResults_output, | |
| 197 | + ttInfoResults_output | |
| 198 | + ); | |
| 199 | + // 规则输出数据 | |
| 200 | + PlanResult planResult = new PlanResult(); | |
| 201 | + | |
| 202 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 203 | + // 创建session,内部配置的是stateful | |
| 204 | + KieSession session = kieBase.newKieSession(); | |
| 205 | + | |
| 206 | + // 设置gloable对象,在drl中通过别名使用 | |
| 207 | + session.setGlobal("planResult", planResult); | |
| 208 | + session.setGlobal("tTInfoService", ttInfoService); | |
| 209 | + session.setGlobal("tTInfoDetailService", ttInfoDetailService); | |
| 210 | + session.setGlobal("carConfigInfoService", carConfigInfoService); | |
| 211 | + session.setGlobal("employeeConfigInfoService", employeeConfigInfoService); | |
| 212 | + session.setGlobal("log", logger); // 设置日志 | |
| 213 | + | |
| 214 | + // 载入数据 | |
| 215 | + session.insert(planCalcuParam_input); | |
| 216 | + | |
| 217 | + // 执行rule | |
| 218 | + session.fireAllRules(); | |
| 219 | + | |
| 220 | + // 执行完毕销毁,有日志的也要关闭 | |
| 221 | + session.dispose(); | |
| 222 | + | |
| 223 | + return planResult; | |
| 224 | + | |
| 225 | + } | |
| 226 | + | |
| 227 | + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | |
| 228 | + public SchedulePlan save2(SchedulePlan schedulePlan) { | |
| 229 | + // 1、循环规则计算输出 | |
| 230 | + ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan); | |
| 231 | + // 2、时刻表选择 | |
| 232 | + TTInfoResults_output ttInfoResults_output = ttInfoOutput(schedulePlan); | |
| 233 | + // 3、计划输出 | |
| 234 | + PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); | |
| 235 | + | |
| 236 | + // TODO: | |
| 237 | + | |
| 238 | + return new SchedulePlan(); | |
| 239 | + } | |
| 240 | + | |
| 61 | 241 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 62 | 242 | public SchedulePlan save(SchedulePlan schedulePlan) { |
| 243 | + // 测试 | |
| 244 | +// return save2(schedulePlan); | |
| 245 | + | |
| 63 | 246 | // 1-1、查找线路具体信息 |
| 64 | 247 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); |
| 65 | 248 | // 1-2、查出指定线路的所有规则 |
| ... | ... | @@ -139,7 +322,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 139 | 322 | }); |
| 140 | 323 | |
| 141 | 324 | Boolean isFb = false; // 是否分班 |
| 142 | - for (TTInfoDetail ttInfoDetail : ttInfoDetails) { | |
| 325 | + for (int i = 0; i < ttInfoDetails.size(); i++) { | |
| 326 | + TTInfoDetail ttInfoDetail = ttInfoDetails.get(i); | |
| 327 | + | |
| 143 | 328 | if (ttInfoDetail.getIsFB()) |
| 144 | 329 | isFb = ttInfoDetail.getIsFB(); |
| 145 | 330 | |
| ... | ... | @@ -150,7 +335,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 150 | 335 | isFb, |
| 151 | 336 | configInfo, |
| 152 | 337 | employeeConfigInfoList, |
| 153 | - schedulePlan); | |
| 338 | + schedulePlan, | |
| 339 | + i == 0, | |
| 340 | + i == ttInfoDetails.size() - 1); | |
| 154 | 341 | |
| 155 | 342 | // 获取公司,分公司信息 |
| 156 | 343 | String gsbm = xl.getCompany(); |
| ... | ... | @@ -197,6 +384,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 197 | 384 | ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); |
| 198 | 385 | |
| 199 | 386 | } |
| 387 | + | |
| 200 | 388 | } |
| 201 | 389 | |
| 202 | 390 | schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ",")); | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -406,6 +406,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 406 | 406 | p1.put("line.id_eq", lineid); |
| 407 | 407 | p1.put("stationName_eq", cell_con.trim()); |
| 408 | 408 | p1.put("stationMark_eq", "B"); |
| 409 | + p1.put("destroy_eq", 0); // 未撤销 | |
| 409 | 410 | |
| 410 | 411 | |
| 411 | 412 | // TODO:这里要修改(起点站有启用撤销的标志的) | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -58,15 +58,18 @@ public class MyDroolsConfiguration { |
| 58 | 58 | kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() |
| 59 | 59 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 60 | 60 | "/rules/HelloWorld.drl"), "UTF-8")); |
| 61 | - kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources() | |
| 61 | + kfs.write("src/main/resources/shiftloop_fb.drl", kieServices.getResources() | |
| 62 | 62 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 63 | - "/rules/shiftloop.drl"), "UTF-8")); | |
| 63 | + "/rules/shiftloop_fb.drl"), "UTF-8")); | |
| 64 | 64 | kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() |
| 65 | 65 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 66 | 66 | "/rules/ttinfo.drl"), "UTF-8")); |
| 67 | 67 | kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() |
| 68 | 68 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 69 | 69 | "/rules/ttinfo2.drl"), "UTF-8")); |
| 70 | + kfs.write("src/main/resources/plan.drl", kieServices.getResources() | |
| 71 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 72 | + "/rules/plan.drl"), "UTF-8")); | |
| 70 | 73 | // TODO:还有其他drl.... |
| 71 | 74 | |
| 72 | 75 | // 4、创建KieBuilder,使用KieFileSystem构建 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.plan; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlan; | |
| 4 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 5 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 排班规则-规则输入参数。 | |
| 9 | + */ | |
| 10 | +public class PlanCalcuParam_input { | |
| 11 | + /** 线路id */ | |
| 12 | + private Integer xlId; | |
| 13 | + /** 循环规则输出 */ | |
| 14 | + private ScheduleResults_output scheduleResults_output; | |
| 15 | + /** 时刻表选择规则输出 */ | |
| 16 | + private TTInfoResults_output ttInfoResults_output; | |
| 17 | + | |
| 18 | + public PlanCalcuParam_input() { | |
| 19 | + } | |
| 20 | + public PlanCalcuParam_input( | |
| 21 | + SchedulePlan schedulePlan, | |
| 22 | + ScheduleResults_output scheduleResults_output, | |
| 23 | + TTInfoResults_output ttInfoResults_output) { | |
| 24 | + this.xlId = schedulePlan.getXl().getId(); | |
| 25 | + this.scheduleResults_output = scheduleResults_output; | |
| 26 | + this.ttInfoResults_output = ttInfoResults_output; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public Integer getXlId() { | |
| 30 | + return xlId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setXlId(Integer xlId) { | |
| 34 | + this.xlId = xlId; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public ScheduleResults_output getScheduleResults_output() { | |
| 38 | + return scheduleResults_output; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setScheduleResults_output(ScheduleResults_output scheduleResults_output) { | |
| 42 | + this.scheduleResults_output = scheduleResults_output; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public TTInfoResults_output getTtInfoResults_output() { | |
| 46 | + return ttInfoResults_output; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setTtInfoResults_output(TTInfoResults_output ttInfoResults_output) { | |
| 50 | + this.ttInfoResults_output = ttInfoResults_output; | |
| 51 | + } | |
| 52 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.plan; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | + | |
| 5 | +import java.util.ArrayList; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 计划输出。 | |
| 10 | + */ | |
| 11 | +public class PlanResult { | |
| 12 | + private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); | |
| 13 | + | |
| 14 | + public PlanResult() { | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void add(SchedulePlanInfo schedulePlanInfo) { | |
| 18 | + schedulePlanInfos.add(schedulePlanInfo); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public List<SchedulePlanInfo> getSchedulePlanInfos() { | |
| 22 | + return schedulePlanInfos; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) { | |
| 26 | + this.schedulePlanInfos = schedulePlanInfos; | |
| 27 | + } | |
| 28 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt
0 → 100644
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.shiftloop; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 4 | 4 | import com.google.common.base.Splitter; |
| 5 | +import org.apache.commons.lang3.StringUtils; | |
| 5 | 6 | import org.joda.time.DateTime; |
| 6 | 7 | |
| 7 | 8 | import java.util.ArrayList; |
| ... | ... | @@ -29,7 +30,8 @@ public class ScheduleRule_input { |
| 29 | 30 | /** 车辆配置id */ |
| 30 | 31 | private String carConfigId; |
| 31 | 32 | |
| 32 | - // TODO:车辆翻班暂时不考虑进去 | |
| 33 | + /** 车辆翻版(周一到周日是否启用) */ | |
| 34 | + private List<Boolean> weekdays = new ArrayList<>(); | |
| 33 | 35 | |
| 34 | 36 | public ScheduleRule_input() {} |
| 35 | 37 | |
| ... | ... | @@ -51,6 +53,23 @@ public class ScheduleRule_input { |
| 51 | 53 | // 人员初始索引减1 |
| 52 | 54 | this.startEIndex = scheduleRule1Flat.getRyStart() - 1; |
| 53 | 55 | this.carConfigId = String.valueOf(scheduleRule1Flat.getCarConfigInfo().getId()); |
| 56 | + | |
| 57 | + /** 车辆翻版(周一到周日是否启用)*/ | |
| 58 | + String fbgs_temp = null; | |
| 59 | + if (StringUtils.isEmpty(scheduleRule1Flat.getFbgs()) || "1".equals(scheduleRule1Flat.getFbgs())) { | |
| 60 | + fbgs_temp = "1,1,1,1,1,1,1"; | |
| 61 | + } else { | |
| 62 | + fbgs_temp = "1,1,1,1,1,0,0"; | |
| 63 | +// fbgs_temp = scheduleRule1Flat.getFbgs(); | |
| 64 | + } | |
| 65 | + String[] days = fbgs_temp.split(","); | |
| 66 | + for (int i = 0; i < 7; i++) { | |
| 67 | + if ("1".equals(days[i])) { | |
| 68 | + weekdays.add(true); | |
| 69 | + } else { | |
| 70 | + weekdays.add(false); | |
| 71 | + } | |
| 72 | + } | |
| 54 | 73 | } |
| 55 | 74 | |
| 56 | 75 | public String getRuleId() { |
| ... | ... | @@ -108,4 +127,12 @@ public class ScheduleRule_input { |
| 108 | 127 | public void setCarConfigId(String carConfigId) { |
| 109 | 128 | this.carConfigId = carConfigId; |
| 110 | 129 | } |
| 130 | + | |
| 131 | + public List<Boolean> getWeekdays() { | |
| 132 | + return weekdays; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public void setWeekdays(List<Boolean> weekdays) { | |
| 136 | + this.weekdays = weekdays; | |
| 137 | + } | |
| 111 | 138 | } | ... | ... |
src/main/resources/rules/plan.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.plan; | |
| 2 | + | |
| 3 | +import org.joda.time.*; | |
| 4 | +import java.util.*; | |
| 5 | + | |
| 6 | +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | |
| 7 | +import com.bsth.service.schedule.rules.plan.PlanResult; | |
| 8 | + | |
| 9 | +import com.bsth.service.schedule.TTInfoService; | |
| 10 | +import com.bsth.service.schedule.TTInfoDetailService; | |
| 11 | +import com.bsth.service.schedule.CarConfigInfoService; | |
| 12 | +import com.bsth.service.schedule.EmployeeConfigInfoService; | |
| 13 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 14 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 15 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; | |
| 16 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 17 | + | |
| 18 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 19 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 20 | +import com.bsth.entity.schedule.TTInfo; | |
| 21 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 22 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 23 | + | |
| 24 | +import org.slf4j.Logger; | |
| 25 | + | |
| 26 | + | |
| 27 | +// 全局日志类(一般使用调用此规则的service类) | |
| 28 | +global Logger log; | |
| 29 | +global TTInfoDetailService tTInfoDetailService; | |
| 30 | +global TTInfoService tTInfoService; | |
| 31 | +global CarConfigInfoService carConfigInfoService; | |
| 32 | +global EmployeeConfigInfoService employeeConfigInfoService; | |
| 33 | + | |
| 34 | +// 输出 | |
| 35 | +global PlanResult planResult; | |
| 36 | + | |
| 37 | +function Map ttidParams(String ttid) { | |
| 38 | + Map param = new HashMap(); | |
| 39 | + param.put("ttinfo.id_eq", Long.parseLong(ttid)); | |
| 40 | + return param; | |
| 41 | +} | |
| 42 | + | |
| 43 | +function Map xlidParams(Integer xlid) { | |
| 44 | + Map param = new HashMap(); | |
| 45 | + param.put("xl.id_eq", xlid); | |
| 46 | + return param; | |
| 47 | +} | |
| 48 | + | |
| 49 | +/* | |
| 50 | + 规则说明: | |
| 51 | + 1、根据循环规则输出,时刻表选择规则输出,计算排班明细 | |
| 52 | +*/ | |
| 53 | + | |
| 54 | +//-------------------- 第一阶段、计算迭代数据 -----------------// | |
| 55 | +declare Loop_result | |
| 56 | + xlId: Integer // 线路id | |
| 57 | + ruleLoop: List // 每天分配的规则 List<ScheduleResult_output> | |
| 58 | + ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>> | |
| 59 | + ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output> | |
| 60 | + | |
| 61 | + ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output> | |
| 62 | +end | |
| 63 | + | |
| 64 | +rule "calcu_step1_Loop_result" | |
| 65 | + salience 1000 | |
| 66 | + when | |
| 67 | + $param: PlanCalcuParam_input($xlId: xlId) | |
| 68 | + then | |
| 69 | + Loop_result loop_result = new Loop_result(); | |
| 70 | + loop_result.setXlId($xlId); | |
| 71 | + loop_result.setRuleLoop($param.getScheduleResults_output().getResults()); | |
| 72 | + | |
| 73 | + loop_result.setTtInfoMapLoop(new HashMap()); | |
| 74 | + loop_result.setTtInfoMap(new HashMap()); | |
| 75 | + | |
| 76 | + com.google.common.collect.Multimap ttInfoMap_temp = | |
| 77 | + (com.google.common.collect.Multimap) | |
| 78 | + $param.getTtInfoResults_output().getResults().get( | |
| 79 | + String.valueOf($xlId)); | |
| 80 | + | |
| 81 | + loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap()); | |
| 82 | + | |
| 83 | + insert(loop_result); | |
| 84 | + | |
| 85 | + log.info("calcu_step1_Loop_result"); | |
| 86 | +end | |
| 87 | + | |
| 88 | +rule "calcu_step2_loop_result" | |
| 89 | + salience 1000 | |
| 90 | + no-loop | |
| 91 | + when | |
| 92 | + $param: PlanCalcuParam_input($xlId: xlId) | |
| 93 | + $lr: Loop_result(xlId == $xlId) | |
| 94 | + $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet() | |
| 95 | + then | |
| 96 | + // 当天时刻表只取第一张 TODO: | |
| 97 | + Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd); | |
| 98 | + Iterator iter = col.iterator(); | |
| 99 | + TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next(); | |
| 100 | + $lr.getTtInfoMapLoop().put($sd, ttInfo_result); | |
| 101 | + | |
| 102 | + // 总共使用的时刻表 | |
| 103 | + $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result); | |
| 104 | + | |
| 105 | + update($lr); | |
| 106 | +end | |
| 107 | + | |
| 108 | +//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------// | |
| 109 | + | |
| 110 | +declare TTInfoDetail_Wrap | |
| 111 | + ttInfoId: String // 时刻表id(cast字符串-方便比较) | |
| 112 | + gid: String // 路牌id(cast字符串-方便比较) | |
| 113 | + | |
| 114 | + self: TTInfoDetail // 原始数据 | |
| 115 | +end | |
| 116 | + | |
| 117 | +rule "calcu_TTInfoDetail_Wrap" | |
| 118 | + salience 800 | |
| 119 | + when | |
| 120 | + $lr: Loop_result($xlId: xlId) | |
| 121 | + $ttInfoId: String() from $lr.getTtInfoMap().keySet() | |
| 122 | + $ttInfoDetail: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttInfoId)) | |
| 123 | + then | |
| 124 | + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap(); | |
| 125 | + ttInfoDetail_wrap.setTtInfoId($ttInfoId); | |
| 126 | + ttInfoDetail_wrap.setGid(String.valueOf($ttInfoDetail.getLp().getId())); | |
| 127 | + ttInfoDetail_wrap.setSelf($ttInfoDetail); | |
| 128 | + | |
| 129 | +// log.info("时刻表id={}", $ttInfoId); | |
| 130 | +// log.info("时刻表明细id={}", $ttInfoDetail.getId()); | |
| 131 | + | |
| 132 | + insert(ttInfoDetail_wrap); | |
| 133 | +end | |
| 134 | + | |
| 135 | +declare CarConfig_Wrap | |
| 136 | + id: String // 车辆配置id(cast字符串-方便比较) | |
| 137 | + | |
| 138 | + self: CarConfigInfo // 原始数据 | |
| 139 | +end | |
| 140 | + | |
| 141 | +rule "calcu_CarConfig_Wrap" | |
| 142 | + salience 800 | |
| 143 | + when | |
| 144 | + $lr: Loop_result($xlId: xlId) | |
| 145 | + $ccf: CarConfigInfo() from carConfigInfoService.list(xlidParams($xlId)) | |
| 146 | + then | |
| 147 | + CarConfig_Wrap carConfig_wrap = new CarConfig_Wrap(); | |
| 148 | + carConfig_wrap.setId(String.valueOf($ccf.getId())); | |
| 149 | + carConfig_wrap.setSelf($ccf); | |
| 150 | + | |
| 151 | + insert(carConfig_wrap); | |
| 152 | +end | |
| 153 | + | |
| 154 | +declare EmployeeConfig_Wrap | |
| 155 | + id: String // 人员配置id(cast字符串-方便比较) | |
| 156 | + | |
| 157 | + self: EmployeeConfigInfo // 原始数据 | |
| 158 | +end | |
| 159 | + | |
| 160 | +rule "calcu_EmployeeConfig_Wrap" | |
| 161 | + salience 800 | |
| 162 | + when | |
| 163 | + $lr: Loop_result($xlId: xlId) | |
| 164 | + $eci: EmployeeConfigInfo() from employeeConfigInfoService.list(xlidParams($xlId)) | |
| 165 | + then | |
| 166 | + EmployeeConfig_Wrap employeeConfig_wrap = new EmployeeConfig_Wrap(); | |
| 167 | + employeeConfig_wrap.setId(String.valueOf($eci.getId())); | |
| 168 | + employeeConfig_wrap.setSelf($eci); | |
| 169 | + | |
| 170 | + insert(employeeConfig_wrap); | |
| 171 | +end | |
| 172 | + | |
| 173 | +declare ScheduleResult_output_Wrap | |
| 174 | + xlId: Integer // 线路id | |
| 175 | + sd: DateTime // 日期 | |
| 176 | + ruleId: String // 规则Id | |
| 177 | + eciIds: List // 人员配置ids | |
| 178 | + | |
| 179 | + self: ScheduleResult_output // 原始数据 | |
| 180 | +end | |
| 181 | + | |
| 182 | +rule "calcu_ScheduleResult_output_Wrap" | |
| 183 | + salience 800 | |
| 184 | + when | |
| 185 | + $lr: Loop_result($xlId: xlId) | |
| 186 | + $sro: ScheduleResult_output() from $lr.getRuleLoop() | |
| 187 | + then | |
| 188 | + ScheduleResult_output_Wrap scheduleResult_output_wrap = new ScheduleResult_output_Wrap(); | |
| 189 | + scheduleResult_output_wrap.setXlId($xlId); | |
| 190 | + scheduleResult_output_wrap.setSd($sro.getSd()); | |
| 191 | + scheduleResult_output_wrap.setRuleId($sro.getRuleId()); | |
| 192 | + scheduleResult_output_wrap.setEciIds(Arrays.asList( | |
| 193 | + $sro.getEmployeeConfigId().split("-"))); | |
| 194 | + scheduleResult_output_wrap.setSelf($sro); | |
| 195 | + | |
| 196 | + insert(scheduleResult_output_wrap); | |
| 197 | +end | |
| 198 | + | |
| 199 | +//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------// | |
| 200 | + | |
| 201 | +// TODO:暂时不考虑分班 | |
| 202 | + | |
| 203 | +//rule "Calcu_SchedulePlanInfo" | |
| 204 | +// salience 600 | |
| 205 | +// when | |
| 206 | +// $lr: Loop_result($xlId: xlId) | |
| 207 | +// $sro: ScheduleResult_output($sd: sd) from $lr.getRuleLoop() | |
| 208 | +// ScheduleResult_output_Wrap( | |
| 209 | +// xlId == $xlId, sd == $sro.sd, ruleId == $sro.ruleId, | |
| 210 | +// $eciIds: eciIds, $sr: self) | |
| 211 | +// $ecId: String() from $eciIds | |
| 212 | +// CarConfig_Wrap(id == $sro.carConfigId, $cc: self) | |
| 213 | +// EmployeeConfig_Wrap(id == $ecId, $ec: self) | |
| 214 | +// TTInfoDetail_Wrap( | |
| 215 | +// ttInfoId == ((TTInfoResult_output) $lr.getTtInfoMapLoop($sd))., | |
| 216 | +// gid == $sr.guideboardId, | |
| 217 | +// $ttInfoDetail: self | |
| 218 | +// ) | |
| 219 | +// then | |
| 220 | +// log.info("Calcu_SchedulePlanInfo"); | |
| 221 | +// | |
| 222 | +//end | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | ... | ... |
src/main/resources/rules/shiftloop.drl
| ... | ... | @@ -145,6 +145,7 @@ rule "calcu_guideboard_index_1" |
| 145 | 145 | insert(cgir); |
| 146 | 146 | end |
| 147 | 147 | |
| 148 | +// 启用日期大于开始日期 | |
| 148 | 149 | rule "calcu_guideboard_index_2" |
| 149 | 150 | when |
| 150 | 151 | $calcu_days_result : Calcu_days_result($ruleId: ruleId, $qyrq_days: qyrq_days , qyrq_days > 0) |
| ... | ... | @@ -515,49 +516,70 @@ rule "calcu_loop_guideboard" |
| 515 | 516 | when |
| 516 | 517 | $loopData : Calcu_guideboard_range_loop_result($ruleId : ruleId, rangeSize >= 0) |
| 517 | 518 | $indexData : Calcu_guideboard_index_result(ruleId == $ruleId) |
| 518 | - $ruleData : ScheduleRule_input(ruleId == $ruleId) | |
| 519 | - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) | |
| 519 | + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays) | |
| 520 | + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date) | |
| 520 | 521 | then |
| 521 | 522 | // 循环计算路牌 |
| 522 | - DateTime initDate = $startDate; | |
| 523 | + DateTime initDate = $startDate; // 开始时间 | |
| 524 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 523 | 525 | List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); |
| 524 | 526 | |
| 525 | 527 | // 1、初始组循环 |
| 526 | - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) { | |
| 527 | - ScheduleResult_output ro = new ScheduleResult_output(); | |
| 528 | - ro.setRuleId($ruleId); | |
| 529 | - ro.setSd(initDate); | |
| 530 | - ro.setGuideboardId($ruleData.getGuideboardIds().get(i)); | |
| 531 | - ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 532 | - scheduleResult_outputs.add(ro); | |
| 533 | - | |
| 534 | - initDate = initDate.plusDays(1); | |
| 528 | + int i = $indexData.getCalcu_index(); | |
| 529 | + while (!initDate.isAfter(endDate) && i <= $loopData.getFirstLoopSize()) { | |
| 530 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 531 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 532 | + ro.setRuleId($ruleId); | |
| 533 | + ro.setSd(initDate); | |
| 534 | + ro.setGuideboardId($ruleData.getGuideboardIds().get(i)); | |
| 535 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 536 | + scheduleResult_outputs.add(ro); | |
| 537 | + | |
| 538 | + initDate = initDate.plusDays(1); | |
| 539 | + i++; | |
| 540 | + } else { | |
| 541 | + initDate = initDate.plusDays(1); | |
| 542 | + } | |
| 535 | 543 | } |
| 536 | 544 | |
| 537 | 545 | // 2、组循环 |
| 538 | - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) { | |
| 539 | - for (int k = 0; k < $loopData.getRangeSize(); k++) { | |
| 540 | - ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 541 | - ro2.setRuleId($ruleId); | |
| 542 | - ro2.setSd(initDate); | |
| 543 | - ro2.setGuideboardId($ruleData.getGuideboardIds().get(k)); | |
| 544 | - ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 545 | - scheduleResult_outputs.add(ro2); | |
| 546 | - | |
| 547 | - initDate = initDate.plusDays(1); | |
| 546 | + int j = 0; | |
| 547 | + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) { | |
| 548 | + int k = 0; | |
| 549 | + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) { | |
| 550 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 551 | + ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 552 | + ro2.setRuleId($ruleId); | |
| 553 | + ro2.setSd(initDate); | |
| 554 | + ro2.setGuideboardId($ruleData.getGuideboardIds().get(k)); | |
| 555 | + ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 556 | + scheduleResult_outputs.add(ro2); | |
| 557 | + | |
| 558 | + initDate = initDate.plusDays(1); | |
| 559 | + k++; | |
| 560 | + } else { | |
| 561 | + initDate = initDate.plusDays(1); | |
| 562 | + } | |
| 548 | 563 | } |
| 564 | + j++; | |
| 549 | 565 | } |
| 550 | 566 | |
| 551 | 567 | // 3、余下组循环 |
| 552 | - for (int l = 0; l < $loopData.getLastLoopSize(); l++) { | |
| 553 | - ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 554 | - ro3.setRuleId($ruleId); | |
| 555 | - ro3.setSd(initDate); | |
| 556 | - ro3.setGuideboardId($ruleData.getGuideboardIds().get(l)); | |
| 557 | - ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 558 | - scheduleResult_outputs.add(ro3); | |
| 559 | - | |
| 560 | - initDate = initDate.plusDays(1); | |
| 568 | + int l = 0; | |
| 569 | + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) { | |
| 570 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 571 | + ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 572 | + ro3.setRuleId($ruleId); | |
| 573 | + ro3.setSd(initDate); | |
| 574 | + ro3.setGuideboardId($ruleData.getGuideboardIds().get(l)); | |
| 575 | + ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 576 | + scheduleResult_outputs.add(ro3); | |
| 577 | + | |
| 578 | + initDate = initDate.plusDays(1); | |
| 579 | + l++; | |
| 580 | + } else { | |
| 581 | + initDate = initDate.plusDays(1); | |
| 582 | + } | |
| 561 | 583 | } |
| 562 | 584 | |
| 563 | 585 | Calcu_loop_guideboard_result clgr = new Calcu_loop_guideboard_result(); |
| ... | ... | @@ -579,49 +601,70 @@ rule "calcu_loop_employee" |
| 579 | 601 | when |
| 580 | 602 | $loopData : Calcu_employee_range_loop_result($ruleId : ruleId, rangeSize >= 0) |
| 581 | 603 | $indexData : Calcu_employee_index_result(ruleId == $ruleId) |
| 582 | - $ruleData : ScheduleRule_input(ruleId == $ruleId) | |
| 583 | - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) | |
| 604 | + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays) | |
| 605 | + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date) | |
| 584 | 606 | then |
| 585 | 607 | // 循环计算路牌 |
| 586 | - DateTime initDate = $startDate; | |
| 608 | + DateTime initDate = $startDate; // 开始时间 | |
| 609 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 587 | 610 | List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); |
| 588 | 611 | |
| 589 | 612 | // 1、初始组循环 |
| 590 | - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) { | |
| 591 | - ScheduleResult_output ro = new ScheduleResult_output(); | |
| 592 | - ro.setRuleId($ruleId); | |
| 593 | - ro.setSd(initDate); | |
| 594 | - ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i)); | |
| 595 | - ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 596 | - scheduleResult_outputs.add(ro); | |
| 597 | - | |
| 598 | - initDate = initDate.plusDays(1); | |
| 613 | + int i = $indexData.getCalcu_index(); | |
| 614 | + while (!initDate.isAfter(endDate) && i<= $loopData.getFirstLoopSize()) { | |
| 615 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 616 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 617 | + ro.setRuleId($ruleId); | |
| 618 | + ro.setSd(initDate); | |
| 619 | + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i)); | |
| 620 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 621 | + scheduleResult_outputs.add(ro); | |
| 622 | + | |
| 623 | + initDate = initDate.plusDays(1); | |
| 624 | + i++; | |
| 625 | + } else { | |
| 626 | + initDate = initDate.plusDays(1); | |
| 627 | + } | |
| 599 | 628 | } |
| 600 | 629 | |
| 601 | 630 | // 2、组循环 |
| 602 | - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) { | |
| 603 | - for (int k = 0; k < $loopData.getRangeSize(); k++) { | |
| 604 | - ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 605 | - ro2.setRuleId($ruleId); | |
| 606 | - ro2.setSd(initDate); | |
| 607 | - ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k)); | |
| 608 | - ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 609 | - scheduleResult_outputs.add(ro2); | |
| 610 | - | |
| 611 | - initDate = initDate.plusDays(1); | |
| 631 | + int j = 0; | |
| 632 | + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) { | |
| 633 | + int k = 0; | |
| 634 | + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) { | |
| 635 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 636 | + ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 637 | + ro2.setRuleId($ruleId); | |
| 638 | + ro2.setSd(initDate); | |
| 639 | + ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k)); | |
| 640 | + ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 641 | + scheduleResult_outputs.add(ro2); | |
| 642 | + | |
| 643 | + initDate = initDate.plusDays(1); | |
| 644 | + k++; | |
| 645 | + } else { | |
| 646 | + initDate = initDate.plusDays(1); | |
| 647 | + } | |
| 612 | 648 | } |
| 649 | + j++; | |
| 613 | 650 | } |
| 614 | 651 | |
| 615 | 652 | // 3、余下组循环 |
| 616 | - for (int l = 0; l < $loopData.getLastLoopSize(); l++) { | |
| 617 | - ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 618 | - ro3.setRuleId($ruleId); | |
| 619 | - ro3.setSd(initDate); | |
| 620 | - ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l)); | |
| 621 | - ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 622 | - scheduleResult_outputs.add(ro3); | |
| 623 | - | |
| 624 | - initDate = initDate.plusDays(1); | |
| 653 | + int l = 0; | |
| 654 | + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) { | |
| 655 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 656 | + ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 657 | + ro3.setRuleId($ruleId); | |
| 658 | + ro3.setSd(initDate); | |
| 659 | + ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l)); | |
| 660 | + ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 661 | + scheduleResult_outputs.add(ro3); | |
| 662 | + | |
| 663 | + initDate = initDate.plusDays(1); | |
| 664 | + l++; | |
| 665 | + } else { | |
| 666 | + initDate = initDate.plusDays(1); | |
| 667 | + } | |
| 625 | 668 | } |
| 626 | 669 | |
| 627 | 670 | Calcu_loop_employee_result clgr = new Calcu_loop_employee_result(); | ... | ... |
src/main/resources/rules/shiftloop_fb.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.shiftloop; | |
| 2 | + | |
| 3 | +import org.joda.time.*; | |
| 4 | +import java.util.*; | |
| 5 | + | |
| 6 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | |
| 7 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | |
| 8 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 9 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 10 | + | |
| 11 | +import org.slf4j.Logger; | |
| 12 | + | |
| 13 | +global Logger log; | |
| 14 | + | |
| 15 | +/* | |
| 16 | + 存在(翻班格式) | |
| 17 | +*/ | |
| 18 | + | |
| 19 | +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------// | |
| 20 | + | |
| 21 | +declare Calcu_days_result | |
| 22 | + ruleId : String // 规则Id | |
| 23 | + qyrq_days : Integer // 开始日期离启用日期的天数 | |
| 24 | + sdays : Integer // 总共需要排班的天数 | |
| 25 | + calcu_start_date : DateTime // 开始计算日期 | |
| 26 | + calcu_end_date : DateTime // 结束计算日期 | |
| 27 | +end | |
| 28 | + | |
| 29 | +/* | |
| 30 | + 计算启用日期,开始计算日期,结束计算日期,相差天数 | |
| 31 | + 1、规则启用日期小于开始计算日期 | |
| 32 | + 2、规则启用日期大于等于开始日期,小于等于结束日期 | |
| 33 | +*/ | |
| 34 | +rule "calcu_days_1" | |
| 35 | + salience 100 | |
| 36 | + when | |
| 37 | + ScheduleCalcuParam_input( | |
| 38 | + fromDate.isBefore(toDate) || fromDate.isEqual(toDate), | |
| 39 | + $fromDate : fromDate, | |
| 40 | + $toDate : toDate | |
| 41 | + ) | |
| 42 | + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq) | |
| 43 | + eval($qyrq.isBefore($fromDate)) | |
| 44 | + then | |
| 45 | + // 构造Calcu_days_result对象,进行下一阶段计算 | |
| 46 | + Calcu_days_result cdr = new Calcu_days_result(); | |
| 47 | + cdr.setRuleId($ruleId); | |
| 48 | + Period p1 = new Period($qyrq, $fromDate, PeriodType.days()); | |
| 49 | + cdr.setQyrq_days(p1.getDays()); | |
| 50 | + Period p2 = new Period($fromDate, $toDate, PeriodType.days()); | |
| 51 | + cdr.setSdays(p2.getDays() + 1); | |
| 52 | + cdr.setCalcu_start_date($fromDate); | |
| 53 | + cdr.setCalcu_end_date($toDate); | |
| 54 | + | |
| 55 | + log.info("开始日期离启用日期的天数 qyrq_days={}", p1.getDays()); | |
| 56 | + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1)); | |
| 57 | + | |
| 58 | + insert(cdr); // 插入fact数据,进入下一个阶段 | |
| 59 | +end | |
| 60 | + | |
| 61 | +rule "calcu_days_2" | |
| 62 | + salience 100 | |
| 63 | + when | |
| 64 | + ScheduleCalcuParam_input( | |
| 65 | + fromDate.isBefore(toDate) || fromDate.isEqual(toDate), | |
| 66 | + $fromDate : fromDate, | |
| 67 | + $toDate : toDate | |
| 68 | + ) | |
| 69 | + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq) | |
| 70 | + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate))) | |
| 71 | + then | |
| 72 | + // 构造Calcu_days_result对象,进行下一阶段计算 | |
| 73 | + Calcu_days_result cdr = new Calcu_days_result(); | |
| 74 | + cdr.setRuleId($ruleId); | |
| 75 | + cdr.setQyrq_days(0); | |
| 76 | + Period p2 = new Period($qyrq, $toDate, PeriodType.days()); | |
| 77 | + cdr.setSdays(Integer.valueOf(p2.getDays() + 1)); | |
| 78 | + cdr.setCalcu_start_date($qyrq); | |
| 79 | + cdr.setCalcu_end_date($toDate); | |
| 80 | + | |
| 81 | + log.info("开始日期离启用日期的天数 qyrq_days=0"); | |
| 82 | + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1)); | |
| 83 | + | |
| 84 | + insert(cdr); // 插入fact数据,进入下一个阶段 | |
| 85 | +end | |
| 86 | + | |
| 87 | +//------------------------- 第二阶段、计算规则准备数据2(起始索引) ----------------------------// | |
| 88 | + | |
| 89 | +//----------------------- 路牌范围循环计算 ------------------------// | |
| 90 | + | |
| 91 | +declare Calcu_guideboard_index_result | |
| 92 | + ruleId : String // 规则Id | |
| 93 | + calcu_index : Integer // 计算之后的起始索引 | |
| 94 | +end | |
| 95 | + | |
| 96 | +// 启用日期等于开始日期 | |
| 97 | +rule "calcu_guideboard_index_qyrq_eq_startrq" | |
| 98 | + when | |
| 99 | + $calcu_days_result : Calcu_days_result( | |
| 100 | + qyrq_days == 0, | |
| 101 | + $ruleId: ruleId | |
| 102 | + ) | |
| 103 | + $scheduleRule_input : ScheduleRule_input( | |
| 104 | + ruleId == $ruleId, | |
| 105 | + $oindex : startGbdIndex | |
| 106 | + ) | |
| 107 | + then | |
| 108 | + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result(); | |
| 109 | + cgir.setRuleId($ruleId); | |
| 110 | + cgir.setCalcu_index($oindex); | |
| 111 | + | |
| 112 | + log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index()); | |
| 113 | + | |
| 114 | + insert(cgir); | |
| 115 | +end | |
| 116 | + | |
| 117 | +// 开始日期大于启用日期 | |
| 118 | +rule "calcu_guideboard_index_startrq_gt_qyrq" | |
| 119 | + when | |
| 120 | + $calcu_days_result : Calcu_days_result( | |
| 121 | + qyrq_days > 0, | |
| 122 | + $ruleId: ruleId, $qyrq_days: qyrq_days, | |
| 123 | + $calcu_start_date: calcu_start_date | |
| 124 | + ) | |
| 125 | + $scheduleRule_input : ScheduleRule_input( | |
| 126 | + ruleId == $ruleId, | |
| 127 | + $qyrq: qyrq, | |
| 128 | + $rangesize : guideboardIds.size(), | |
| 129 | + $oindex : startGbdIndex, | |
| 130 | + $weekdays: weekdays | |
| 131 | + ) | |
| 132 | + then | |
| 133 | + // 开始时间 | |
| 134 | + DateTime initDate = $qyrq; | |
| 135 | + int index = $oindex; | |
| 136 | + int resultIndex = index; | |
| 137 | + | |
| 138 | + while (!initDate.isAfter($calcu_start_date)) { | |
| 139 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 140 | + resultIndex = index; | |
| 141 | + index = (index + 1) % $rangesize; | |
| 142 | + } | |
| 143 | + initDate = initDate.plusDays(1); | |
| 144 | + } | |
| 145 | + | |
| 146 | + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result(); | |
| 147 | + cgir.setRuleId($ruleId); | |
| 148 | + cgir.setCalcu_index(resultIndex); | |
| 149 | + | |
| 150 | + log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index()); | |
| 151 | + | |
| 152 | + insert(cgir); | |
| 153 | +end | |
| 154 | + | |
| 155 | +//----------------------- 人员范围循环计算 ------------------------// | |
| 156 | + | |
| 157 | +declare Calcu_employee_index_result | |
| 158 | + ruleId : String // 规则Id | |
| 159 | + calcu_index : Integer // 计算之后的起始索引 | |
| 160 | +end | |
| 161 | + | |
| 162 | +// 启用日期等于开始日期 | |
| 163 | +rule "calcu_employee_index_qyrq_eq_startrq" | |
| 164 | + when | |
| 165 | + $calcu_days_result : Calcu_days_result( | |
| 166 | + qyrq_days == 0, | |
| 167 | + $ruleId: ruleId) | |
| 168 | + $scheduleRule_input : ScheduleRule_input( | |
| 169 | + ruleId == $ruleId, | |
| 170 | + $oindex : startEIndex) | |
| 171 | + then | |
| 172 | + Calcu_employee_index_result cgir = new Calcu_employee_index_result(); | |
| 173 | + cgir.setRuleId($ruleId); | |
| 174 | + cgir.setCalcu_index($oindex); | |
| 175 | + | |
| 176 | + log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index()); | |
| 177 | + | |
| 178 | + insert(cgir); | |
| 179 | +end | |
| 180 | + | |
| 181 | +// 开始日期大于启用日期 | |
| 182 | +rule "calcu_employee_index_startrq_gt_qyrq" | |
| 183 | + when | |
| 184 | + $calcu_days_result : Calcu_days_result( | |
| 185 | + qyrq_days > 0, | |
| 186 | + $ruleId: ruleId, $qyrq_days: qyrq_days, | |
| 187 | + $calcu_start_date: calcu_start_date | |
| 188 | + ) | |
| 189 | + $scheduleRule_input : ScheduleRule_input( | |
| 190 | + ruleId == $ruleId, | |
| 191 | + $qyrq: qyrq, | |
| 192 | + $rangesize : employeeConfigIds.size(), | |
| 193 | + $oindex : startEIndex, | |
| 194 | + $weekdays: weekdays | |
| 195 | + ) | |
| 196 | + then | |
| 197 | + // 开始时间 | |
| 198 | + DateTime initDate = $qyrq; | |
| 199 | + int index = $oindex; | |
| 200 | + int resultIndex = index; | |
| 201 | + | |
| 202 | + while (!initDate.isAfter($calcu_start_date)) { | |
| 203 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 204 | + resultIndex = index; | |
| 205 | + index = (index + 1) % $rangesize; | |
| 206 | + } | |
| 207 | + initDate = initDate.plusDays(1); | |
| 208 | + } | |
| 209 | + | |
| 210 | + Calcu_employee_index_result cgir = new Calcu_employee_index_result(); | |
| 211 | + cgir.setRuleId($ruleId); | |
| 212 | + cgir.setCalcu_index(resultIndex); | |
| 213 | + | |
| 214 | + log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index()); | |
| 215 | + | |
| 216 | + insert(cgir); | |
| 217 | + | |
| 218 | +end | |
| 219 | + | |
| 220 | +//------------------------- 第三阶段、循环计算 ------------------------// | |
| 221 | + | |
| 222 | +//----------------------- 路牌范围循环计算 ------------------------// | |
| 223 | +declare loop_guideboard_result | |
| 224 | + ruleId : String // 规则id | |
| 225 | + go_list : List // 路牌循环的列表 | |
| 226 | +end | |
| 227 | + | |
| 228 | +// 循环路牌计算 | |
| 229 | +rule "Calcu_loop_guideboard_result" | |
| 230 | + when | |
| 231 | + Calcu_days_result( | |
| 232 | + $ruleId: ruleId, | |
| 233 | + $startDate : calcu_start_date, | |
| 234 | + $calcu_end_date: calcu_end_date | |
| 235 | + ) | |
| 236 | + $ruleData : ScheduleRule_input( | |
| 237 | + ruleId == $ruleId, | |
| 238 | + $rangesize : guideboardIds.size(), | |
| 239 | + $weekdays: weekdays | |
| 240 | + ) | |
| 241 | + $indexData : Calcu_guideboard_index_result( | |
| 242 | + ruleId == $ruleId | |
| 243 | + ) | |
| 244 | + then | |
| 245 | + DateTime initDate = $startDate; // 开始时间 | |
| 246 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 247 | + List<ScheduleResult_output> scheduleResult_outputs = | |
| 248 | + new ArrayList<ScheduleResult_output>(); | |
| 249 | + | |
| 250 | + int i = $indexData.getCalcu_index(); | |
| 251 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) { | |
| 252 | + i = (i + 1) % $rangesize; | |
| 253 | + } | |
| 254 | + | |
| 255 | + while (!initDate.isAfter(endDate)) { | |
| 256 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 257 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 258 | + ro.setRuleId($ruleId); | |
| 259 | + ro.setSd(initDate); | |
| 260 | + ro.setGuideboardId($ruleData.getGuideboardIds().get(i)); | |
| 261 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 262 | + scheduleResult_outputs.add(ro); | |
| 263 | + | |
| 264 | + i = (i + 1) % $rangesize; | |
| 265 | + } | |
| 266 | + | |
| 267 | + initDate = initDate.plusDays(1); | |
| 268 | + } | |
| 269 | + | |
| 270 | + loop_guideboard_result clgr = new loop_guideboard_result(); | |
| 271 | + clgr.setRuleId($ruleId); | |
| 272 | + clgr.setGo_list(scheduleResult_outputs); | |
| 273 | + | |
| 274 | + log.info(String.valueOf(scheduleResult_outputs.size())); | |
| 275 | + | |
| 276 | + insert(clgr); | |
| 277 | + | |
| 278 | +end | |
| 279 | + | |
| 280 | +//----------------------- 人员范围循环计算 ------------------------// | |
| 281 | +declare loop_employee_result | |
| 282 | + ruleId : String // 规则id | |
| 283 | + eo_list : List // 人员循环的列表 | |
| 284 | +end | |
| 285 | + | |
| 286 | +// 循环人员计算 | |
| 287 | +rule "Calcu_loop_employee_result" | |
| 288 | + when | |
| 289 | + Calcu_days_result( | |
| 290 | + $ruleId: ruleId, | |
| 291 | + $startDate : calcu_start_date, | |
| 292 | + $calcu_end_date: calcu_end_date | |
| 293 | + ) | |
| 294 | + $ruleData : ScheduleRule_input( | |
| 295 | + ruleId == $ruleId, | |
| 296 | + $rangesize : employeeConfigIds.size(), | |
| 297 | + $weekdays: weekdays | |
| 298 | + ) | |
| 299 | + $indexData : Calcu_employee_index_result( | |
| 300 | + ruleId == $ruleId | |
| 301 | + ) | |
| 302 | + then | |
| 303 | + DateTime initDate = $startDate; // 开始时间 | |
| 304 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 305 | + List<ScheduleResult_output> scheduleResult_outputs = | |
| 306 | + new ArrayList<ScheduleResult_output>(); | |
| 307 | + | |
| 308 | + int i = $indexData.getCalcu_index(); | |
| 309 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) { | |
| 310 | + i = (i + 1) % $rangesize; | |
| 311 | + } | |
| 312 | + | |
| 313 | + while (!initDate.isAfter(endDate)) { | |
| 314 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 315 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 316 | + ro.setRuleId($ruleId); | |
| 317 | + ro.setSd(initDate); | |
| 318 | + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i)); | |
| 319 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 320 | + scheduleResult_outputs.add(ro); | |
| 321 | + | |
| 322 | + i = (i + 1) % $rangesize; | |
| 323 | + } | |
| 324 | + | |
| 325 | + initDate = initDate.plusDays(1); | |
| 326 | + } | |
| 327 | + | |
| 328 | + loop_employee_result clgr = new loop_employee_result(); | |
| 329 | + clgr.setRuleId($ruleId); | |
| 330 | + clgr.setEo_list(scheduleResult_outputs); | |
| 331 | + | |
| 332 | + log.info(String.valueOf(scheduleResult_outputs.size())); | |
| 333 | + | |
| 334 | + insert(clgr); | |
| 335 | +end | |
| 336 | + | |
| 337 | +//------------------------- 第四阶段、范围组循环计算 ----------------------------// | |
| 338 | + | |
| 339 | +global ScheduleResults_output scheduleResult; | |
| 340 | + | |
| 341 | +rule "output" | |
| 342 | + when | |
| 343 | + loop_guideboard_result( | |
| 344 | + go_list.size() > 0, | |
| 345 | + $ruleId : ruleId, $go_list : go_list | |
| 346 | + ) | |
| 347 | + loop_employee_result( | |
| 348 | + ruleId == $ruleId, | |
| 349 | + eo_list.size() == $go_list.size(), | |
| 350 | + $eo_list : eo_list | |
| 351 | + ) | |
| 352 | + then | |
| 353 | + for (int i = 0; i < $go_list.size(); i++) { | |
| 354 | + ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i); | |
| 355 | + ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i); | |
| 356 | + go.setEmployeeConfigId(eo.getEmployeeConfigId()); | |
| 357 | + scheduleResult.getResults().add(go); | |
| 358 | + } | |
| 359 | + | |
| 360 | +end | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
| ... | ... | @@ -135,11 +135,11 @@ |
| 135 | 135 | <div class="form-group has-success has-feedback"> |
| 136 | 136 | <label class="col-md-2 control-label">停车场*:</label> |
| 137 | 137 | <div class="col-md-3"> |
| 138 | - <sa-Select5 name="tcd" | |
| 138 | + <sa-Select5 name="tcc" | |
| 139 | 139 | model="ctrl.busConfigForSave" |
| 140 | - cmaps="{'tcd': 'parkName'}" | |
| 141 | - dcname="tcd" | |
| 142 | - icname="parkName" | |
| 140 | + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}" | |
| 141 | + dcname="tcc.id" | |
| 142 | + icname="id" | |
| 143 | 143 | dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" |
| 144 | 144 | iterobjname="item" |
| 145 | 145 | iterobjexp="item.parkName" |
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | </sa-Select5> |
| 150 | 150 | </div> |
| 151 | 151 | <!-- 隐藏块,显示验证信息 --> |
| 152 | - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> | |
| 152 | + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required"> | |
| 153 | 153 | 停车场必须填写 |
| 154 | 154 | </div> |
| 155 | 155 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
| ... | ... | @@ -135,11 +135,11 @@ |
| 135 | 135 | <div class="form-group has-success has-feedback"> |
| 136 | 136 | <label class="col-md-2 control-label">停车场*:</label> |
| 137 | 137 | <div class="col-md-3"> |
| 138 | - <sa-Select5 name="tcd" | |
| 138 | + <sa-Select5 name="tcc" | |
| 139 | 139 | model="ctrl.busConfigForSave" |
| 140 | - cmaps="{'tcd': 'parkName'}" | |
| 141 | - dcname="tcd" | |
| 142 | - icname="parkName" | |
| 140 | + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}" | |
| 141 | + dcname="tcc.id" | |
| 142 | + icname="id" | |
| 143 | 143 | dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" |
| 144 | 144 | iterobjname="item" |
| 145 | 145 | iterobjexp="item.parkName" |
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | </sa-Select5> |
| 150 | 150 | </div> |
| 151 | 151 | <!-- 隐藏块,显示验证信息 --> |
| 152 | - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> | |
| 152 | + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required"> | |
| 153 | 153 | 停车场必须填写 |
| 154 | 154 | </div> |
| 155 | 155 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
| ... | ... | @@ -237,12 +237,17 @@ angular.module('ScheduleApp').controller( |
| 237 | 237 | self.busConfigForSave = new BusConfig; |
| 238 | 238 | self.busConfigForSave.xl = {}; |
| 239 | 239 | self.busConfigForSave.cl = {}; |
| 240 | + self.busConfigForSave.tcc = {}; | |
| 240 | 241 | |
| 241 | 242 | // 获取传过来的id,有的话就是修改,获取一遍数据 |
| 242 | 243 | var id = $stateParams.id; |
| 243 | 244 | if (id) { |
| 244 | 245 | BusConfig.get({id: id}, function(value) { |
| 245 | 246 | self.busConfigForSave = value; |
| 247 | + | |
| 248 | + if (!self.busConfigForSave.tcc) { | |
| 249 | + self.busConfigForSave.tcc = {}; | |
| 250 | + } | |
| 246 | 251 | }); |
| 247 | 252 | } else { |
| 248 | 253 | // 初始表单,从查询条件中获取线路id | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/list_info.html
| ... | ... | @@ -8,12 +8,14 @@ |
| 8 | 8 | <th style="width: 80px;">线路</th> |
| 9 | 9 | <th style="width: 150px;">日期</th> |
| 10 | 10 | <th style="width: 50px;">路牌</th> |
| 11 | - <th style="width: 120px;">车辆</th> | |
| 11 | + <th style="width: 100px;">车辆</th> | |
| 12 | 12 | <th style="width: 120px;">驾驶员(工号)</th> |
| 13 | - <th style="width: 120px;">售票员(工号)</th> | |
| 13 | + <!--<th style="width: 120px;">售票员(工号)</th>--> | |
| 14 | 14 | <th style="width: 80px;">班次类型</th> |
| 15 | 15 | <th style="width: 80px;">上下行</th> |
| 16 | 16 | <th style="width: 80px;">发车时间</th> |
| 17 | + <th style="width: 100px;">起点站</th> | |
| 18 | + <th style="width: 100px;">终点站</th> | |
| 17 | 19 | <th style="width: 100%">时刻表</th> |
| 18 | 20 | <th style="width: 90px;">修改人</th> |
| 19 | 21 | <th style="width: 90px;">修改时间</th> |
| ... | ... | @@ -48,6 +50,7 @@ |
| 48 | 50 | <td></td> |
| 49 | 51 | <td></td> |
| 50 | 52 | <td></td> |
| 53 | + <td></td> | |
| 51 | 54 | |
| 52 | 55 | </tr> |
| 53 | 56 | </thead> |
| ... | ... | @@ -73,9 +76,9 @@ |
| 73 | 76 | <span>{{info.jName ? info.jName + '(' + info.jGh + ')' : ''}}</span> |
| 74 | 77 | |
| 75 | 78 | </td> |
| 76 | - <td> | |
| 77 | - <span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span> | |
| 78 | - </td> | |
| 79 | + <!--<td>--> | |
| 80 | + <!--<span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span>--> | |
| 81 | + <!--</td>--> | |
| 79 | 82 | <td> |
| 80 | 83 | <span ng-bind="info.bcType | dict:'ScheduleType':'未知' "></span> |
| 81 | 84 | </td> |
| ... | ... | @@ -86,7 +89,31 @@ |
| 86 | 89 | <span ng-bind="info.fcsj"></span> |
| 87 | 90 | </td> |
| 88 | 91 | <td> |
| 89 | - <span ng-bind="info.ttInfoName"></span> | |
| 92 | + <a href="#" | |
| 93 | + tooltip-animation="false" | |
| 94 | + tooltip-placement="top" | |
| 95 | + uib-tooltip="{{info.qdzName}}" | |
| 96 | + tooltip-class="headClass"> | |
| 97 | + {{info.qdzName}} | |
| 98 | + </a> | |
| 99 | + </td> | |
| 100 | + <td> | |
| 101 | + <a href="#" | |
| 102 | + tooltip-animation="false" | |
| 103 | + tooltip-placement="top" | |
| 104 | + uib-tooltip="{{info.zdzName}}" | |
| 105 | + tooltip-class="headClass"> | |
| 106 | + {{info.zdzName}} | |
| 107 | + </a> | |
| 108 | + </td> | |
| 109 | + <td> | |
| 110 | + <a href="#" | |
| 111 | + tooltip-animation="false" | |
| 112 | + tooltip-placement="top" | |
| 113 | + uib-tooltip="{{info.ttInfoName}}" | |
| 114 | + tooltip-class="headClass"> | |
| 115 | + {{info.ttInfoName}} | |
| 116 | + </a> | |
| 90 | 117 | </td> |
| 91 | 118 | <td> |
| 92 | 119 | <span ng-bind="info.updateBy.userName"></span> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/edit.html
| ... | ... | @@ -148,6 +148,21 @@ |
| 148 | 148 | </div> |
| 149 | 149 | </div> |
| 150 | 150 | |
| 151 | + <div class="form-group has-success has-feedback"> | |
| 152 | + <label class="col-md-2 control-label">翻班格式*:</label> | |
| 153 | + <div class="col-md-6"> | |
| 154 | + <sa-Checkboxgroup model="ctrl.scheduleRuleManageForSave" | |
| 155 | + name="fbgs" | |
| 156 | + dcvalue="{{ctrl.scheduleRuleManageForSave.fbgs}}" | |
| 157 | + dcname="fbgs" | |
| 158 | + required > | |
| 159 | + </sa-Checkboxgroup> | |
| 160 | + </div> | |
| 161 | + <div class="alert alert-danger well-sm" ng-show="myForm.fbgs.$error.required"> | |
| 162 | + 请操作一下1 | |
| 163 | + </div> | |
| 164 | + </div> | |
| 165 | + | |
| 151 | 166 | <!--<div class="form-group">--> |
| 152 | 167 | <!--<label class="col-md-2 control-label">翻班格式:</label>--> |
| 153 | 168 | <!--<div class="col-md-4">--> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <th>路牌范围</th> |
| 13 | 13 | <th>起始人员</th> |
| 14 | 14 | <th>人员范围</th> |
| 15 | + <th>翻版格式</th> | |
| 15 | 16 | <th style="width: 21%">操作</th> |
| 16 | 17 | </tr> |
| 17 | 18 | <tr role="row" class="filter"> |
| ... | ... | @@ -37,6 +38,7 @@ |
| 37 | 38 | <td></td> |
| 38 | 39 | <td></td> |
| 39 | 40 | <td></td> |
| 41 | + <td></td> | |
| 40 | 42 | <td> |
| 41 | 43 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 42 | 44 | ng-click="ctrl.doPage()"> |
| ... | ... | @@ -72,13 +74,34 @@ |
| 72 | 74 | <span ng-bind="info.lpStart"></span> |
| 73 | 75 | </td> |
| 74 | 76 | <td> |
| 75 | - <span ng-bind="info.lpNames"></span> | |
| 77 | + <a href="#" | |
| 78 | + tooltip-animation="false" | |
| 79 | + tooltip-placement="left-top" | |
| 80 | + uib-tooltip="{{info.lpNames}}" | |
| 81 | + tooltip-class="headClass"> | |
| 82 | + {{info.lpNames}} | |
| 83 | + </a> | |
| 76 | 84 | </td> |
| 77 | 85 | <td> |
| 78 | 86 | <span ng-bind="info.ryStart"></span> |
| 79 | 87 | </td> |
| 80 | 88 | <td> |
| 81 | - <span ng-bind="info.ryDbbms"></span> | |
| 89 | + <a href="#" | |
| 90 | + tooltip-animation="false" | |
| 91 | + tooltip-placement="top" | |
| 92 | + uib-tooltip="{{info.ryDbbms}}" | |
| 93 | + tooltip-class="headClass"> | |
| 94 | + {{info.ryDbbms}} | |
| 95 | + </a> | |
| 96 | + </td> | |
| 97 | + <td> | |
| 98 | + <a href="#" | |
| 99 | + tooltip-animation="false" | |
| 100 | + tooltip-placement="top" | |
| 101 | + uib-tooltip="{{info.fbgs}}" | |
| 102 | + tooltip-class="headClass"> | |
| 103 | + {{info.fbgs}} | |
| 104 | + </a> | |
| 82 | 105 | </td> |
| 83 | 106 | <td> |
| 84 | 107 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | ... | ... |
src/main/resources/static/real_control_v2/css/ct_table.css
src/main/resources/static/real_control_v2/css/line_schedule.css
| ... | ... | @@ -96,7 +96,7 @@ |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | .line-schedule-table dl dt:nth-of-type(3), .line-schedule-table dl dd:nth-of-type(3) { |
| 99 | - width: calc(2% + 86px); | |
| 99 | + width: calc(2% + 66px); | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | .line-schedule-table dl dt:nth-of-type(4), .line-schedule-table dl dd:nth-of-type(4) { |
| ... | ... | @@ -122,7 +122,7 @@ |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) { |
| 125 | - width: 50px; | |
| 125 | + width: 70px; | |
| 126 | 126 | border-right: 0; |
| 127 | 127 | } |
| 128 | 128 | |
| ... | ... | @@ -238,6 +238,10 @@ |
| 238 | 238 | height: 36px; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | +.schedule-body .ct_table dl:nth-child(even){ | |
| 242 | + background: rgba(249, 249, 249, 0.31); | |
| 243 | +} | |
| 244 | + | |
| 241 | 245 | span.fcsj-diff { |
| 242 | 246 | color: gray; |
| 243 | 247 | margin-left: 3px; |
| ... | ... | @@ -528,8 +532,7 @@ div.drop-rail[data-type="car"]:before { |
| 528 | 532 | } |
| 529 | 533 | |
| 530 | 534 | dl.relevance-active dd:nth-child(n+2) { |
| 531 | - background: #f1efef !important; | |
| 532 | - color: #333; | |
| 535 | + background: #c1e2f9 !important; | |
| 533 | 536 | } |
| 534 | 537 | |
| 535 | 538 | dl.relevance-active.intimity dd:nth-child(n+2) { | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
| ... | ... | @@ -141,7 +141,7 @@ |
| 141 | 141 | <div class="uk-form-row"> |
| 142 | 142 | <label class="uk-form-label" >里程</label> |
| 143 | 143 | <div class="uk-form-controls"> |
| 144 | - <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" > | |
| 144 | + <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" required> | |
| 145 | 145 | </div> |
| 146 | 146 | </div> |
| 147 | 147 | </div> | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
| ... | ... | @@ -132,7 +132,7 @@ var gb_schedule_context_menu = (function () { |
| 132 | 132 | }, modal_opts); |
| 133 | 133 | }, |
| 134 | 134 | cxzx: function (sch) { |
| 135 | - if (!sch.zdsjActual) | |
| 135 | + if (!sch.zdsjActual && !sch.fcsjActual) | |
| 136 | 136 | return notify_err('车辆未执行,无法撤销执行!'); |
| 137 | 137 | |
| 138 | 138 | var content = '<h3>确定要撤销<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>的实达时间?</h3>' | ... | ... |
src/test/java/com/bsth/service/schedule/rules/DroolsRulesTest2.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules; | |
| 2 | + | |
| 3 | +import com.bsth.Application; | |
| 4 | +import org.junit.runner.RunWith; | |
| 5 | +import org.kie.api.KieBase; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.boot.test.SpringApplicationConfiguration; | |
| 8 | +import org.springframework.context.annotation.ComponentScan; | |
| 9 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 测试类。 | |
| 13 | + */ | |
| 14 | +@RunWith(SpringJUnit4ClassRunner.class) | |
| 15 | +@SpringApplicationConfiguration(classes = {Application.class}) | |
| 16 | +@ComponentScan(basePackages = {"com.bsth.entity"}) | |
| 17 | +public class DroolsRulesTest2 { | |
| 18 | + @Autowired | |
| 19 | + private KieBase kieBase; | |
| 20 | + | |
| 21 | + @org.junit.Test | |
| 22 | + public void test1() throws Exception { | |
| 23 | + System.out.println("dfdfdfdfd"); | |
| 24 | + } | |
| 25 | + | |
| 26 | +} | ... | ... |
src/test/resources/test.properties
0 → 100644