Commit ace076a949ed5d101903ba58e8b6973cc7913562

Authored by 徐烜
1 parent c6cdf717

Update

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
... ... @@ -71,7 +71,7 @@ public class ScheduleRule1Flat extends BEntity {
71 71 @NotNull
72 72 private Integer ryStart;
73 73  
74   - /** 翻班格式(TODO:这个用在车子上的,暂时不管)*/
  74 + /** 翻班格式(类似格式:1110011)*/
75 75 private String fbgs;
76 76  
77 77 public Long getId() {
... ...
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&lt;SchedulePlan, Long&gt; 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&lt;SchedulePlan, Long&gt; 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&lt;SchedulePlan, Long&gt; 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&lt;SchedulePlan, Long&gt; 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&lt;TTInfoDetail, Long&gt; 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
... ... @@ -67,6 +67,9 @@ public class MyDroolsConfiguration {
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
  1 +排班计划规则,构造计划明细输出
  2 +1、使用shiftloop.drl和ttinfo.drl的输出作为输入,进行规则计算
  3 +2、计算后输出排班明细列表
0 4 \ No newline at end of file
... ...
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,22 @@ 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 = scheduleRule1Flat.getFbgs();
  63 + }
  64 + String[] days = fbgs_temp.split(",");
  65 + for (int i = 0; i < 7; i++) {
  66 + if ("1".equals(days[i])) {
  67 + weekdays.add(true);
  68 + } else {
  69 + weekdays.add(false);
  70 + }
  71 + }
54 72 }
55 73  
56 74 public String getRuleId() {
... ... @@ -108,4 +126,12 @@ public class ScheduleRule_input {
108 126 public void setCarConfigId(String carConfigId) {
109 127 this.carConfigId = carConfigId;
110 128 }
  129 +
  130 + public List<Boolean> getWeekdays() {
  131 + return weekdays;
  132 + }
  133 +
  134 + public void setWeekdays(List<Boolean> weekdays) {
  135 + this.weekdays = weekdays;
  136 + }
111 137 }
... ...
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
... ... @@ -515,49 +515,70 @@ rule &quot;calcu_loop_guideboard&quot;
515 515 when
516 516 $loopData : Calcu_guideboard_range_loop_result($ruleId : ruleId, rangeSize >= 0)
517 517 $indexData : Calcu_guideboard_index_result(ruleId == $ruleId)
518   - $ruleData : ScheduleRule_input(ruleId == $ruleId)
519   - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date)
  518 + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays)
  519 + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date)
520 520 then
521 521 // 循环计算路牌
522   - DateTime initDate = $startDate;
  522 + DateTime initDate = $startDate; // 开始时间
  523 + DateTime endDate = $calcu_end_date; // 结束实际
523 524 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>();
524 525  
525 526 // 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);
  527 + int i = $indexData.getCalcu_index();
  528 + while (!initDate.isAfter(endDate) && i <= $loopData.getFirstLoopSize()) {
  529 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  530 + ScheduleResult_output ro = new ScheduleResult_output();
  531 + ro.setRuleId($ruleId);
  532 + ro.setSd(initDate);
  533 + ro.setGuideboardId($ruleData.getGuideboardIds().get(i));
  534 + ro.setCarConfigId($ruleData.getCarConfigId());
  535 + scheduleResult_outputs.add(ro);
  536 +
  537 + initDate = initDate.plusDays(1);
  538 + i++;
  539 + } else {
  540 + initDate = initDate.plusDays(1);
  541 + }
535 542 }
536 543  
537 544 // 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);
  545 + int j = 0;
  546 + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) {
  547 + int k = 0;
  548 + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) {
  549 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  550 + ScheduleResult_output ro2 = new ScheduleResult_output();
  551 + ro2.setRuleId($ruleId);
  552 + ro2.setSd(initDate);
  553 + ro2.setGuideboardId($ruleData.getGuideboardIds().get(k));
  554 + ro2.setCarConfigId($ruleData.getCarConfigId());
  555 + scheduleResult_outputs.add(ro2);
  556 +
  557 + initDate = initDate.plusDays(1);
  558 + k++;
  559 + } else {
  560 + initDate = initDate.plusDays(1);
  561 + }
548 562 }
  563 + j++;
549 564 }
550 565  
551 566 // 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);
  567 + int l = 0;
  568 + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) {
  569 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  570 + ScheduleResult_output ro3 = new ScheduleResult_output();
  571 + ro3.setRuleId($ruleId);
  572 + ro3.setSd(initDate);
  573 + ro3.setGuideboardId($ruleData.getGuideboardIds().get(l));
  574 + ro3.setCarConfigId($ruleData.getCarConfigId());
  575 + scheduleResult_outputs.add(ro3);
  576 +
  577 + initDate = initDate.plusDays(1);
  578 + l++;
  579 + } else {
  580 + initDate = initDate.plusDays(1);
  581 + }
561 582 }
562 583  
563 584 Calcu_loop_guideboard_result clgr = new Calcu_loop_guideboard_result();
... ... @@ -579,49 +600,70 @@ rule &quot;calcu_loop_employee&quot;
579 600 when
580 601 $loopData : Calcu_employee_range_loop_result($ruleId : ruleId, rangeSize >= 0)
581 602 $indexData : Calcu_employee_index_result(ruleId == $ruleId)
582   - $ruleData : ScheduleRule_input(ruleId == $ruleId)
583   - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date)
  603 + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays)
  604 + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date)
584 605 then
585 606 // 循环计算路牌
586   - DateTime initDate = $startDate;
  607 + DateTime initDate = $startDate; // 开始时间
  608 + DateTime endDate = $calcu_end_date; // 结束实际
587 609 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>();
588 610  
589 611 // 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);
  612 + int i = $indexData.getCalcu_index();
  613 + while (!initDate.isAfter(endDate) && i<= $loopData.getFirstLoopSize()) {
  614 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  615 + ScheduleResult_output ro = new ScheduleResult_output();
  616 + ro.setRuleId($ruleId);
  617 + ro.setSd(initDate);
  618 + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));
  619 + ro.setCarConfigId($ruleData.getCarConfigId());
  620 + scheduleResult_outputs.add(ro);
  621 +
  622 + initDate = initDate.plusDays(1);
  623 + i++;
  624 + } else {
  625 + initDate = initDate.plusDays(1);
  626 + }
599 627 }
600 628  
601 629 // 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);
  630 + int j = 0;
  631 + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) {
  632 + int k = 0;
  633 + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) {
  634 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  635 + ScheduleResult_output ro2 = new ScheduleResult_output();
  636 + ro2.setRuleId($ruleId);
  637 + ro2.setSd(initDate);
  638 + ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k));
  639 + ro2.setCarConfigId($ruleData.getCarConfigId());
  640 + scheduleResult_outputs.add(ro2);
  641 +
  642 + initDate = initDate.plusDays(1);
  643 + k++;
  644 + } else {
  645 + initDate = initDate.plusDays(1);
  646 + }
612 647 }
  648 + j++;
613 649 }
614 650  
615 651 // 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);
  652 + int l = 0;
  653 + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) {
  654 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  655 + ScheduleResult_output ro3 = new ScheduleResult_output();
  656 + ro3.setRuleId($ruleId);
  657 + ro3.setSd(initDate);
  658 + ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l));
  659 + ro3.setCarConfigId($ruleData.getCarConfigId());
  660 + scheduleResult_outputs.add(ro3);
  661 +
  662 + initDate = initDate.plusDays(1);
  663 + l++;
  664 + } else {
  665 + initDate = initDate.plusDays(1);
  666 + }
625 667 }
626 668  
627 669 Calcu_loop_employee_result clgr = new Calcu_loop_employee_result();
... ...
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(&#39;ScheduleApp&#39;).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/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