Commit 8f6640d44381b1368affb9f088f32fd6d1f29bcd

Authored by 徐烜
1 parent 5b8a3bd4

Update

src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
1 package com.bsth.controller.schedule.core; 1 package com.bsth.controller.schedule.core;
2 2
  3 +import com.bsth.common.Constants;
  4 +import com.bsth.common.ResponseCode;
3 import com.bsth.controller.schedule.BController; 5 import com.bsth.controller.schedule.BController;
4 import com.bsth.entity.schedule.SchedulePlan; 6 import com.bsth.entity.schedule.SchedulePlan;
  7 +import com.bsth.entity.sys.CompanyAuthority;
5 import com.bsth.service.schedule.SchedulePlanService; 8 import com.bsth.service.schedule.SchedulePlanService;
6 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
7 -import org.springframework.web.bind.annotation.RequestMapping;  
8 -import org.springframework.web.bind.annotation.RequestMethod;  
9 -import org.springframework.web.bind.annotation.RestController; 10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +import javax.servlet.http.HttpSession;
  13 +import java.util.Date;
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
10 17
11 /** 18 /**
12 * Created by xu on 16/6/16. 19 * Created by xu on 16/6/16.
@@ -17,6 +24,21 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { @@ -17,6 +24,21 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> {
17 @Autowired 24 @Autowired
18 private SchedulePlanService schedulePlanService; 25 private SchedulePlanService schedulePlanService;
19 26
  27 + @Override
  28 + public Map<String, Object> save(@RequestBody SchedulePlan schedulePlan, HttpSession httpSession) {
  29 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) httpSession.getAttribute(Constants.COMPANY_AUTHORITYS);
  30 + // TODO:如果多个公司,选第一个,以后改成页面控制
  31 + if (cmyAuths == null || cmyAuths.size() == 0)
  32 + schedulePlanService.save(schedulePlan, new CompanyAuthority());
  33 + else
  34 + schedulePlanService.save(schedulePlan, cmyAuths.get(0));
  35 +
  36 + Map<String, Object> rtn = new HashMap<>();
  37 + rtn.put("status", ResponseCode.SUCCESS);
  38 + rtn.put("data", new Object());
  39 + return rtn;
  40 + }
  41 +
20 /** 42 /**
21 * 获取明天的一歌排班计划。 43 * 获取明天的一歌排班计划。
22 * @return 44 * @return
@@ -31,4 +53,25 @@ public class SchedulePlanController extends BController&lt;SchedulePlan, Long&gt; { @@ -31,4 +53,25 @@ public class SchedulePlanController extends BController&lt;SchedulePlan, Long&gt; {
31 } 53 }
32 } 54 }
33 55
  56 + /**
  57 + * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况
  58 + * @param xlid 线路id
  59 + * @param from 开始时间
  60 + * @param to 结束时间
  61 + * @return
  62 + * @throws Exception
  63 + */
  64 + @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET)
  65 + public Map<String, Object> validateTTInfo(
  66 + @PathVariable(value = "xlid") Integer xlid,
  67 + @PathVariable(value = "from") Date from,
  68 + @PathVariable(value = "to") Date to
  69 + ) throws Exception {
  70 + // TODO:测试数据
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + rtn.put("data", schedulePlanService.validateTTInfo(xlid, from, to));
  74 + return rtn;
  75 + }
  76 +
34 } 77 }
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.SchedulePlan; 3 import com.bsth.entity.schedule.SchedulePlan;
  4 +import com.bsth.entity.sys.CompanyAuthority;
  5 +import com.bsth.service.schedule.rules.ttinfo2.Result;
  6 +
  7 +import java.util.Date;
4 8
5 /** 9 /**
6 * Created by xu on 16/6/16. 10 * Created by xu on 16/6/16.
7 */ 11 */
8 public interface SchedulePlanService extends BService<SchedulePlan, Long> { 12 public interface SchedulePlanService extends BService<SchedulePlan, Long> {
  13 +
  14 + SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority);
  15 +
9 /** 16 /**
10 * 获取有明日排班的计划。 17 * 获取有明日排班的计划。
11 * @return 18 * @return
12 */ 19 */
13 SchedulePlan findSchedulePlanTommorw(); 20 SchedulePlan findSchedulePlanTommorw();
14 -} 21 +
  22 + /**
  23 + * 验证使用的时刻表。
  24 + * @param xlid 线路id
  25 + * @param from 开始时间
  26 + * @param to 结束时间
  27 + * @return
  28 + */
  29 + Result validateTTInfo(Integer xlid, Date from, Date to);
  30 +}
15 \ No newline at end of file 31 \ No newline at end of file
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -3,19 +3,26 @@ package com.bsth.service.schedule.impl; @@ -3,19 +3,26 @@ package com.bsth.service.schedule.impl;
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.bsth.entity.schedule.*; 4 import com.bsth.entity.schedule.*;
5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.entity.sys.CompanyAuthority;
6 import com.bsth.repository.schedule.SchedulePlanInfoRepository; 7 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
7 import com.bsth.repository.schedule.SchedulePlanRepository; 8 import com.bsth.repository.schedule.SchedulePlanRepository;
  9 +import com.bsth.service.LineService;
8 import com.bsth.service.schedule.SchedulePlanService; 10 import com.bsth.service.schedule.SchedulePlanService;
  11 +import com.bsth.service.schedule.TTInfoService;
9 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; 12 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
10 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 13 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
11 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; 14 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
12 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; 15 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
13 import com.bsth.service.schedule.rules.strategy.IStrategy; 16 import com.bsth.service.schedule.rules.strategy.IStrategy;
  17 +import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
  18 +import com.bsth.service.schedule.rules.ttinfo2.Result;
14 import com.google.common.collect.Multimap; 19 import com.google.common.collect.Multimap;
15 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
16 import org.joda.time.DateTime; 21 import org.joda.time.DateTime;
17 import org.kie.api.KieBase; 22 import org.kie.api.KieBase;
18 import org.kie.api.runtime.KieSession; 23 import org.kie.api.runtime.KieSession;
  24 +import org.slf4j.Logger;
  25 +import org.slf4j.LoggerFactory;
19 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
21 import org.springframework.transaction.annotation.Isolation; 28 import org.springframework.transaction.annotation.Isolation;
@@ -37,10 +44,16 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -37,10 +44,16 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
37 private SchedulePlanRepository schedulePlanRepository; 44 private SchedulePlanRepository schedulePlanRepository;
38 @Autowired 45 @Autowired
39 private SchedulePlanInfoRepository schedulePlanInfoRepository; 46 private SchedulePlanInfoRepository schedulePlanInfoRepository;
  47 + @Autowired
  48 + private LineService lineService;
  49 + @Autowired
  50 + private TTInfoService ttInfoService;
  51 +
  52 + /** 日志记录器 */
  53 + private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class);
40 54
41 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) 55 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
42 - @Override  
43 - public SchedulePlan save(SchedulePlan schedulePlan) { 56 + public SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority) {
44 // 1-1、查找线路具体信息 57 // 1-1、查找线路具体信息
45 Line xl = strategy.getLine(schedulePlan.getXl().getId()); 58 Line xl = strategy.getLine(schedulePlan.getXl().getId());
46 // 1-2、查出指定线路的所有规则 59 // 1-2、查出指定线路的所有规则
@@ -116,6 +129,13 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -116,6 +129,13 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
116 configInfo, 129 configInfo,
117 employeeConfigInfoList, 130 employeeConfigInfoList,
118 schedulePlan); 131 schedulePlan);
  132 +
  133 + // 公司,分公司编码
  134 + schedulePlanInfo.setGsBm(companyAuthority.getCompanyCode());
  135 + schedulePlanInfo.setGsName(companyAuthority.getCompanyName());
  136 + schedulePlanInfo.setFgsBm(companyAuthority.getSubCompanyCode());
  137 + schedulePlanInfo.setFgsName(companyAuthority.getSubCompanyName());
  138 +
119 schedulePlanInfos.add(schedulePlanInfo); 139 schedulePlanInfos.add(schedulePlanInfo);
120 ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); 140 ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName());
121 } 141 }
@@ -144,4 +164,32 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -144,4 +164,32 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
144 } 164 }
145 return null; 165 return null;
146 } 166 }
  167 +
  168 + @Override
  169 + public Result validateTTInfo(Integer xlid, Date from, Date to) {
  170 + // 构造drools session->载入数据->启动规则->计算->销毁session
  171 + // 创建session,内部配置的是stateful
  172 + KieSession session = kieBase.newKieSession();
  173 + // TODO:设置gloable对象,在drl中通过别名使用
  174 + session.setGlobal("log", logger);
  175 + session.setGlobal("lineService", lineService);
  176 +
  177 + // 载入数据
  178 + CalcuParam calcuParam = new CalcuParam(
  179 + new DateTime(from), new DateTime(to), xlid);
  180 + session.insert(calcuParam);
  181 + List<TTInfo> ttInfos = ttInfoService.findAll();
  182 + for (TTInfo ttInfo: ttInfos)
  183 + session.insert(ttInfo);
  184 +
  185 +
  186 + // 执行rule
  187 + session.fireAllRules();
  188 +
  189 + // 执行完毕销毁,有日志的也要关闭
  190 + session.dispose();
  191 +
  192 +
  193 + return null;
  194 + }
147 } 195 }
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -61,6 +61,9 @@ public class MyDroolsConfiguration { @@ -61,6 +61,9 @@ public class MyDroolsConfiguration {
61 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() 61 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
62 .newInputStreamResource(this.getClass().getResourceAsStream( 62 .newInputStreamResource(this.getClass().getResourceAsStream(
63 "/rules/ttinfo.drl"), "UTF-8")); 63 "/rules/ttinfo.drl"), "UTF-8"));
  64 + kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources()
  65 + .newInputStreamResource(this.getClass().getResourceAsStream(
  66 + "/rules/ttinfo2.drl"), "UTF-8"));
64 // TODO:还有其他drl.... 67 // TODO:还有其他drl....
65 68
66 // 4、创建KieBuilder,使用KieFileSystem构建 69 // 4、创建KieBuilder,使用KieFileSystem构建
src/main/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo2;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 时刻表计算参数。
  7 + */
  8 +public class CalcuParam {
  9 + /** 开始计算时间 */
  10 + private DateTime fromDate;
  11 + /** 结束计算时间 */
  12 + private DateTime toDate;
  13 + /** 线路id */
  14 + private Integer xlId;
  15 +
  16 + public CalcuParam() {}
  17 + public CalcuParam(
  18 + DateTime fromDate,
  19 + DateTime toDate,
  20 + Integer xlId) {
  21 + this.fromDate = fromDate;
  22 + this.toDate = toDate;
  23 + this.xlId = xlId;
  24 + }
  25 +
  26 + public DateTime getFromDate() {
  27 + return fromDate;
  28 + }
  29 +
  30 + public void setFromDate(DateTime fromDate) {
  31 + this.fromDate = fromDate;
  32 + }
  33 +
  34 + public DateTime getToDate() {
  35 + return toDate;
  36 + }
  37 +
  38 + public void setToDate(DateTime toDate) {
  39 + this.toDate = toDate;
  40 + }
  41 +
  42 + public Integer getXlId() {
  43 + return xlId;
  44 + }
  45 +
  46 + public void setXlId(Integer xlId) {
  47 + this.xlId = xlId;
  48 + }
  49 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo2;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * 输出结果值。
  8 + */
  9 +public class Result {
  10 + private List<StatInfo> infos = new ArrayList<>();
  11 +
  12 + public static class StatInfo {
  13 + /** 时刻表id */
  14 + private Long ttid;
  15 + /** 时刻表名字 */
  16 + private String ttname;
  17 +
  18 + /** 所有班次数 */
  19 + private Integer allbc;
  20 + /** 进场班次数 */
  21 + private Integer inbc;
  22 + /** 出场班次数 */
  23 + private Integer outbc;
  24 + /** 营运班次数 */
  25 + private Integer yybc;
  26 +
  27 + /** 错误班次数 */
  28 + private Integer errorbc;
  29 +
  30 + public Long getTtid() {
  31 + return ttid;
  32 + }
  33 +
  34 + public void setTtid(Long ttid) {
  35 + this.ttid = ttid;
  36 + }
  37 +
  38 + public String getTtname() {
  39 + return ttname;
  40 + }
  41 +
  42 + public void setTtname(String ttname) {
  43 + this.ttname = ttname;
  44 + }
  45 +
  46 + public Integer getAllbc() {
  47 + return allbc;
  48 + }
  49 +
  50 + public void setAllbc(Integer allbc) {
  51 + this.allbc = allbc;
  52 + }
  53 +
  54 + public Integer getInbc() {
  55 + return inbc;
  56 + }
  57 +
  58 + public void setInbc(Integer inbc) {
  59 + this.inbc = inbc;
  60 + }
  61 +
  62 + public Integer getOutbc() {
  63 + return outbc;
  64 + }
  65 +
  66 + public void setOutbc(Integer outbc) {
  67 + this.outbc = outbc;
  68 + }
  69 +
  70 + public Integer getYybc() {
  71 + return yybc;
  72 + }
  73 +
  74 + public void setYybc(Integer yybc) {
  75 + this.yybc = yybc;
  76 + }
  77 +
  78 + public Integer getErrorbc() {
  79 + return errorbc;
  80 + }
  81 +
  82 + public void setErrorbc(Integer errorbc) {
  83 + this.errorbc = errorbc;
  84 + }
  85 + }
  86 +}
src/main/resources/rules/ttinfo2.drl 0 → 100644
  1 +package com.bsth.service.schedule.ttinfo2;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +
  7 +import com.bsth.service.schedule.rules.ttinfo2.Result;
  8 +import com.bsth.service.schedule.rules.ttinfo2.Result.StatInfo;
  9 +import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
  10 +
  11 +import com.bsth.entity.schedule.TTInfo;
  12 +import com.bsth.entity.schedule.TTInfoDetail;
  13 +import com.bsth.entity.Line;
  14 +
  15 +import com.bsth.service.LineService;
  16 +
  17 +import org.slf4j.Logger
  18 +import org.joda.time.format.DateTimeFormat;
  19 +
  20 +// 全局日志类(一般使用调用此规则的service类)
  21 +global Logger log;
  22 +global LineService lineService;
  23 +// 输出
  24 +global Result rs;
  25 +
  26 +/*
  27 + 规则说明:
  28 + 1、找出指定线路,指定时间范围的时刻表
  29 + 2、统计这些时刻表班次数据的情况
  30 +*/
  31 +
  32 +//-------------- 第一阶段、计算规则迭代数据(天数) ------------//
  33 +declare Calcu_iter_days_result
  34 + xlId: Integer // 线路Id
  35 + xlName: String // 线路名字
  36 +
  37 + // 迭代数据
  38 + calcu_day: Integer // 准备计算第几天
  39 + calcu_weekday: Integer // 准备计算星期几(1到7)
  40 + calcu_date: DateTime // 准备计算的具体日期
  41 +
  42 + // 范围数据
  43 + calcu_days: Integer // 总共需要计算的天数
  44 + calcu_start_date: DateTime // 开始计算日期
  45 + calcu_end_date: DateTime // 结束计算日期
  46 +
  47 + // 时刻表映射数据
  48 + ttinfomap: Map // 指定时间段内,用的时刻表id映射 Map<Long, Long>
  49 +end
  50 +
  51 +rule "calcu_iter_days"
  52 + salience 1900
  53 + when
  54 + CalcuParam(
  55 + $xlId: xlId,
  56 + $fromDate: fromDate,
  57 + $toDate: toDate,
  58 + $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate)
  59 + )
  60 + then
  61 + // 构造Calcu_iter_days_result对象,进行下一步计算
  62 + Calcu_iter_days_result cidr = new Calcu_iter_days_result();
  63 + Period p = new Period($fromDate, $toDate, PeriodType.days());
  64 +
  65 + Line line = (Line) lineService.findById($xlId);
  66 +
  67 + cidr.setXlId($xlId);
  68 + cidr.setXlName(line.getName());
  69 +
  70 + cidr.setCalcu_day(new Integer(1));
  71 + cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek()));
  72 + cidr.setCalcu_date($fromDate);
  73 +
  74 + cidr.setCalcu_days(Integer.valueOf(p.getDays() + 1));
  75 + cidr.setCalcu_start_date($fromDate);
  76 + cidr.setCalcu_end_date($toDate);
  77 +
  78 + cidr.setTtinfomap(new HashMap());
  79 +
  80 + log.info(
  81 + "线路={}-id={},开始时间={},结束时间={},总共计算的天数={},将从开始时间迭代",
  82 + cidr.getXlName(),
  83 + cidr.getXlId(),
  84 + cidr.getCalcu_start_date(),
  85 + cidr.getCalcu_end_date(),
  86 + cidr.getCalcu_days()
  87 + );
  88 +
  89 + insert(cidr);
  90 +end
  91 +
  92 +//-------------- 第二阶段、包装时刻表实体类到内部对象 ------------//
  93 +
  94 +declare TTInfo_wrap
  95 + id: Long // 时刻表id
  96 + name: String // 时刻表名字
  97 + weekdays: List // 周一到周日是否启用 List<Boolean>
  98 + specialDays: List // 特殊节假日 List<DateTime>
  99 + updateDate: DateTime // 最新修改时间
  100 +end
  101 +
  102 +rule "TTInfo_wrap_result"
  103 + salience 900
  104 + when
  105 + CalcuParam($xlId: xlId)
  106 + $ttinfo: TTInfo(
  107 + xl.id == $xlId,
  108 + isEnableDisTemplate == true,
  109 + isCancel == false
  110 + )
  111 + then
  112 + TTInfo_wrap ttInfo_wrap = new TTInfo_wrap();
  113 + ttInfo_wrap.setId($ttinfo.getId());
  114 + ttInfo_wrap.setName($ttinfo.getName());
  115 + ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate()));
  116 + ttInfo_wrap.setWeekdays(new ArrayList());
  117 + ttInfo_wrap.setSpecialDays(new ArrayList());
  118 +
  119 + String[] days = $ttinfo.getRule_days().split(",");
  120 + for (int i = 0; i < 7; i++) {
  121 + if ("1".equals(days[i])) {
  122 + ttInfo_wrap.getWeekdays().add(true);
  123 + } else {
  124 + ttInfo_wrap.getWeekdays().add(false);
  125 + }
  126 + }
  127 +
  128 + if (StringUtils.isNotEmpty($ttinfo.getSpecial_days())) {
  129 + String[] sdays = $ttinfo.getSpecial_days().split(",");
  130 + for (int i = 0; i < sdays.length; i++) {
  131 + ttInfo_wrap.getSpecialDays().add(
  132 + DateTimeFormat.forPattern(
  133 + "yyyy-MM-dd").parseDateTime(sdays[i]));
  134 + }
  135 + }
  136 +
  137 + log.info("时刻表={},id={},常规日期={},特殊日期={}",
  138 + ttInfo_wrap.getName(),
  139 + ttInfo_wrap.getId(),
  140 + ttInfo_wrap.getWeekdays(),
  141 + ttInfo_wrap.getSpecialDays());
  142 +
  143 + insert(ttInfo_wrap);
  144 +
  145 +end
  146 +
  147 +//-------------- 第三阶段、时刻表的日期匹配 ------------//
  148 +
  149 +rule "Calcu_iter_days_special_day" // 特殊日期匹配
  150 + salience 800
  151 + when
  152 + $cid : Calcu_iter_days_result(
  153 + $calcu_date: calcu_date,
  154 + $calcu_day: calcu_day,
  155 + calcu_day <= calcu_days
  156 + )
  157 + TTInfo_wrap(
  158 + $tid: id,
  159 + $tname: name,
  160 + specialDays contains $calcu_date
  161 + )
  162 + then
  163 + // 更新迭代对象
  164 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  165 + $cid.setCalcu_day(new_calcu_day);
  166 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  167 + $cid.setCalcu_date(new_calcu_date);
  168 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  169 +
  170 + log.info("启用特殊日期时刻表:" +
  171 + "时刻表id={} 特殊日期={}",
  172 + $tid, $calcu_date);
  173 +
  174 + // 判定使用的时刻表
  175 + if (!$cid.getTtinfomap().containsKey($tid)) {
  176 + $cid.getTtinfomap().put($tid, $tid);
  177 + StatInfo statInfo = new StatInfo();
  178 + statInfo.setTtid($tid);
  179 + statInfo.setTtname($tname);
  180 + insert(statInfo);
  181 + }
  182 + update($cid);
  183 +
  184 +end
  185 +
  186 +rule "Calcu_iter_days_normal_day" // 平日匹配
  187 + salience 700
  188 + when
  189 + $cid : Calcu_iter_days_result(
  190 + $calcu_date: calcu_date,
  191 + $calcu_weekday: calcu_weekday,
  192 + $calcu_day: calcu_day,
  193 + calcu_day <= calcu_days
  194 + )
  195 + TTInfo_wrap(
  196 + $tid: id,
  197 + $tname: name,
  198 + specialDays not contains $calcu_date,
  199 + weekdays[$calcu_weekday - 1] == Boolean.TRUE
  200 + )
  201 + then
  202 + // 更新迭代对象
  203 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  204 + $cid.setCalcu_day(new_calcu_day);
  205 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  206 + $cid.setCalcu_date(new_calcu_date);
  207 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  208 +
  209 +
  210 + log.info("启用常规日期时刻表:" +
  211 + "时刻表id={} 常规日期={} 星期几={}",
  212 + $tid, $calcu_date, $calcu_weekday);
  213 +
  214 + // 判定使用的时刻表
  215 + if (!$cid.getTtinfomap().containsKey($tid)) {
  216 + $cid.getTtinfomap().put($tid, $tid);
  217 + StatInfo statInfo = new StatInfo();
  218 + statInfo.setTtid($tid);
  219 + statInfo.setTtname($tname);
  220 + insert(statInfo);
  221 + }
  222 + update($cid);
  223 +
  224 +end
  225 +
  226 +rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配
  227 + salience 500
  228 + when
  229 + $cid : Calcu_iter_days_result(
  230 + $calcu_date: calcu_date,
  231 + $calcu_weekday: calcu_weekday,
  232 + $calcu_day: calcu_day,
  233 + calcu_day <= calcu_days
  234 + )
  235 + TTInfo_wrap(
  236 + $tid: id,
  237 + $tname: name,
  238 + specialDays not contains $calcu_date,
  239 + weekdays[$calcu_weekday - 1] == false
  240 + )
  241 + then
  242 + // 更新迭代对象
  243 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  244 + $cid.setCalcu_day(new_calcu_day);
  245 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  246 + $cid.setCalcu_date(new_calcu_date);
  247 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  248 +
  249 + log.info("启用默认日期时刻表:" +
  250 + "时刻表id={} 常规日期={} 星期几={}",
  251 + $tid, $calcu_date, $calcu_weekday);
  252 +
  253 + // 判定使用的时刻表
  254 + if (!$cid.getTtinfomap().containsKey($tid)) {
  255 + $cid.getTtinfomap().put($tid, $tid);
  256 + StatInfo statInfo = new StatInfo();
  257 + statInfo.setTtid($tid);
  258 + statInfo.setTtname($tname);
  259 + insert(statInfo);
  260 + }
  261 + update($cid);
  262 +
  263 +end
  264 +
  265 +//-------------- 第四阶段、时刻表明细统计值 ------------//
  266 +
  267 +rule "statinfo_result"
  268 + when
  269 + $statInfo: StatInfo()
  270 + then
  271 +
  272 + log.info("TODO:时刻表={},id={}", $statInfo.getTtname(), $statInfo.getTtid());
  273 +
  274 +end
  275 +
  276 +
  277 +
  278 +
  279 +
  280 +
  281 +
  282 +
  283 +
  284 +
  285 +
  286 +
  287 +
  288 +
  289 +
  290 +
src/main/resources/static/pages/scheduleApp/Gruntfile.js
@@ -85,7 +85,8 @@ module.exports = function (grunt) { @@ -85,7 +85,8 @@ module.exports = function (grunt) {
85 'module/common/dts2/guideboardGroup/saGuideboardgroup.js', // 路牌选择整合指令 85 'module/common/dts2/guideboardGroup/saGuideboardgroup.js', // 路牌选择整合指令
86 'module/common/dts2/employeeGroup/saEmployeegroup.js', // 人员选饿整合指令 86 'module/common/dts2/employeeGroup/saEmployeegroup.js', // 人员选饿整合指令
87 'module/common/dts2/bcGroup/saBcgroup.js', // 班次选择整合指令 87 'module/common/dts2/bcGroup/saBcgroup.js', // 班次选择整合指令
88 - 'module/common/dts2/ttinfotable/saTimeTable.js' // 时刻表显示指令 88 + 'module/common/dts2/ttinfotable/saTimeTable.js', // 时刻表显示指令
  89 + 'module/common/dts2/scheduleplan/saScpdate.js' // saScpdate指令(非通用指令,只在排版计划form中使用)
89 ], 90 ],
90 dest: 'module/common/prj-common-directive.js' 91 dest: 'module/common/prj-common-directive.js'
91 }, 92 },
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdate.js 0 → 100644
  1 +/**
  2 + * saScpdate指令(非通用指令,只在排版计划form中使用)。
  3 + * 属性如下:
  4 + * name(必须):控件的名字
  5 + * xlid(必须):线路id
  6 + * xlname(必须):线路名字
  7 + * from(必须):独立作用域-绑定的开始时间属性名
  8 + * to(必须):独立作用域-绑定的结束时间属性名
  9 + * error(必须):独立作用域-绑定的错误描述属性名
  10 + */
  11 +angular.module('ScheduleApp').directive(
  12 + 'saScpdate',
  13 + [
  14 + 'SchedulePlanManageService_g',
  15 + function(service) {
  16 + return {
  17 + restrict: 'E',
  18 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdateTemplate.html',
  19 + scope: {
  20 + from: '=',
  21 + to: '=',
  22 + xlid: '=',
  23 + xlname: '=',
  24 + error: '='
  25 + },
  26 + controllerAs: '$saScpdateCtrl',
  27 + bindToController: true,
  28 + controller: function() {
  29 + var self = this;
  30 +
  31 + // 内部ng-model值,用于和required配对
  32 + self.$$internalmodel = undefined;
  33 +
  34 + // 内部数据源(时刻表的一些信息)
  35 + self.$$ds = [];
  36 +
  37 + },
  38 + compile: function(tElem, tAttrs) {
  39 + // 获取所有属性,并验证
  40 + var $name_attr = tAttrs['name']; // 控件的名字
  41 + if (!$name_attr) {
  42 + throw "必须有名称属性";
  43 + }
  44 +
  45 + // controlAs名字
  46 + var ctrlAs = '$saScpdateCtrl';
  47 +
  48 + // 线路id
  49 + var xl_id = undefined;
  50 + // 线路名字
  51 + var xl_name = undefined;
  52 + // 开始时间
  53 + var from_date = undefined;
  54 + // 结束时间
  55 + var to_date = undefined;
  56 +
  57 + // 内部添加required验证,将所有的错误应用到required验证上去
  58 + tElem.find("div").attr("required", "");
  59 +
  60 + return {
  61 + pre: function(scope, element, attr) {
  62 +
  63 + },
  64 +
  65 + post: function(scope, element, attr) {
  66 + // 属性值
  67 + if ($name_attr) {
  68 + scope[ctrlAs]["$name_attr"] = $name_attr;
  69 + }
  70 +
  71 + // 开始日期open属性,及方法
  72 + scope[ctrlAs].$$fromDateOpen = false;
  73 + scope[ctrlAs].$$fromDate_open = function() {
  74 + scope[ctrlAs].$$fromDateOpen = true;
  75 + };
  76 +
  77 + // 结束日期open属性,及方法
  78 + scope[ctrlAs].$$toDateOpen = false;
  79 + scope[ctrlAs].$$toDate_open = function() {
  80 + scope[ctrlAs].$$toDateOpen = true;
  81 + };
  82 +
  83 +
  84 + // 内部模型刷新
  85 + scope[ctrlAs].$$internal_model_refresh = function() {
  86 + if (!xl_id) {
  87 + scope[ctrlAs].$$internalmodel = undefined;
  88 + scope[ctrlAs].error = "线路必须选择";
  89 + return;
  90 + }
  91 + if (!xl_name) {
  92 + scope[ctrlAs].$$internalmodel = undefined;
  93 + scope[ctrlAs].error = "线路必须选择";
  94 + return;
  95 + }
  96 +
  97 + if (!from_date) {
  98 + scope[ctrlAs].$$internalmodel = undefined;
  99 + scope[ctrlAs].error = "开始日期必须选择";
  100 + return;
  101 + }
  102 + if (!to_date) {
  103 + scope[ctrlAs].$$internalmodel = undefined;
  104 + scope[ctrlAs].error = "结束日期必须选择";
  105 + return;
  106 + }
  107 + if (from_date > to_date) {
  108 + scope[ctrlAs].$$internalmodel = undefined;
  109 + scope[ctrlAs].error = "开始日期必须在结束日期之前";
  110 + return;
  111 + }
  112 +
  113 + var QClass = service.ttinfo;
  114 + QClass.val({xlid: xl_id, from: from_date, to: to_date},
  115 + function(result) {
  116 + scope[ctrlAs].$$ds = [];
  117 +
  118 + // 模拟数据
  119 + scope[ctrlAs].$$ds.push(
  120 + {
  121 + xlid: 63020,
  122 + ttid: 79,
  123 + xlname: '青浦8路',
  124 + ttname: '测试周末表',
  125 +
  126 + allbc: 18,
  127 + inbc: 4,
  128 + outbc: 4,
  129 + yybc: 14,
  130 +
  131 + errorbc: 0
  132 +
  133 + },
  134 + {
  135 + xlid: 63020,
  136 + ttid: 80,
  137 + xlname: '青浦8路',
  138 + ttname: '周四周五test',
  139 +
  140 + allbc: 18,
  141 + inbc: 4,
  142 + outbc: 4,
  143 + yybc: 14,
  144 +
  145 + errorbc: 10
  146 +
  147 + },
  148 + {
  149 + xlid: 63020,
  150 + ttid: 64,
  151 + xlname: '青浦8路',
  152 + ttname: '青浦8路时刻表1111',
  153 +
  154 + allbc: 18,
  155 + inbc: 4,
  156 + outbc: 4,
  157 + yybc: 14,
  158 +
  159 + errorbc: 10
  160 +
  161 + }
  162 + );
  163 +
  164 +
  165 +
  166 + scope[ctrlAs].$$internalmodel = "ok";
  167 + },
  168 + function() {
  169 + scope[ctrlAs].$$internalmodel = undefined;
  170 + scope[ctrlAs].error = "获取时刻表数据失败!";
  171 + }
  172 + );
  173 +
  174 +
  175 + scope[ctrlAs].$$internalmodel = "ok";
  176 + };
  177 +
  178 + scope[ctrlAs].$$internal_model_refresh(); // 初始执行
  179 +
  180 + //--------------------- 监控属性方法 -------------------//
  181 + // 监控线路id模型值变化
  182 + scope.$watch(
  183 + function() {
  184 + return scope[ctrlAs].xlid;
  185 + },
  186 + function(newValue, oldValue) {
  187 + xl_id = newValue;
  188 + scope[ctrlAs].$$internal_model_refresh();
  189 + }
  190 + );
  191 + // 监控线路name模型值变化
  192 + scope.$watch(
  193 + function() {
  194 + return scope[ctrlAs].xlname;
  195 + },
  196 + function(newValue, oldValue) {
  197 + xl_name = newValue;
  198 + scope[ctrlAs].$$internal_model_refresh();
  199 + }
  200 + );
  201 +
  202 + // 监控开始时间模型值变化
  203 + scope.$watch(
  204 + function() {
  205 + return scope[ctrlAs].from;
  206 + },
  207 + function(newValue, oldValue) {
  208 + from_date = newValue;
  209 + scope[ctrlAs].$$internal_model_refresh();
  210 + }
  211 + );
  212 + // 监控结束时间模型值变化
  213 + scope.$watch(
  214 + function() {
  215 + return scope[ctrlAs].to;
  216 + },
  217 + function(newValue, oldValue) {
  218 + to_date = newValue;
  219 + scope[ctrlAs].$$internal_model_refresh();
  220 + }
  221 + );
  222 +
  223 + }
  224 + };
  225 + }
  226 + };
  227 + }
  228 + ]
  229 +);
0 \ No newline at end of file 230 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdateTemplate.html 0 → 100644
  1 +<div name="{{$saScpdateCtrl.$name_attr}}" ng-model="$saScpdateCtrl.$$internalmodel">
  2 +
  3 + <style>
  4 + .scp-date-select {
  5 + min-height: 180px;
  6 + border: 1px solid #ddd;
  7 + }
  8 + .scp-date-select .scp-date-input {
  9 + margin: 0px 5px 5px 5px;
  10 + padding-top: 7px;
  11 + padding-left: 0;
  12 + }
  13 + .scp-date-select .scp-date-select-cont {
  14 + text-align: left;
  15 + min-height: 100px;
  16 + padding-right: 0px;
  17 + }
  18 + .scp-date-select .scp-date-select-body {
  19 + margin-top: 10px;
  20 + overflow: auto;
  21 + width: auto;
  22 + min-height: 100px;
  23 + }
  24 +
  25 + .scp-date-select .scp-date-select-body h3 {
  26 + margin: 7px 0 5px;
  27 + text-indent: 5px;
  28 + margin: 0;
  29 + height: 31px;
  30 + line-height: 31px;
  31 + color: #2765A7;
  32 +
  33 + text-overflow: ellipsis;
  34 + overflow: hidden;
  35 + white-space: nowrap;
  36 + }
  37 +
  38 + .scp-date-select .scp-date-select-body .increase-popover-width {
  39 + max-width: 450px;
  40 + }
  41 +
  42 +
  43 +
  44 + </style>
  45 +
  46 + <div class="col-md-12 scp-date-select">
  47 + <div class="col-md-12 scp-date-input">
  48 + <div class="col-md-12">
  49 + 使用的时刻表,共{{$saScpdateCtrl.$$ds.length}}个
  50 + </div>
  51 + </div>
  52 + <div class="col-md-12 scp-date-select-cont">
  53 + <div class="scp-date-select-body">
  54 +
  55 + <script type="text/ng-template" id="$saScpdateCtrl_popover.html">
  56 + <div><span ng-bind="info.ttname"></span></div>
  57 + <div><span>统计班次:{{info.allbc}}个,出场:{{info.outbc}}个,进场:{{info.inbc}}个,营运:{{info.yybc}}个</span></div>
  58 + <div><span>异常班次:{{info.errorbc}}个</span></div>
  59 + </script>
  60 +
  61 + <div ng-repeat="info in $saScpdateCtrl.$$ds track by $index">
  62 +
  63 + <div class="col-md-12" uib-popover-template="'$saScpdateCtrl_popover.html'"
  64 + popover-class="increase-popover-width"
  65 + popover-trigger="mouseenter">
  66 + <h3 class="col-md-8">
  67 + <a ui-sref="ttInfoDetailManage_edit3({xlid: info.xlid, ttid : info.ttid, xlname: info.xlname, ttname : info.ttname, rflag : true})">
  68 + {{info.ttname}}
  69 + </a>
  70 + </h3>
  71 + <span class="glyphicon glyphicon-ok" aria-hidden="true" ng-if="info.errorbc == 0"></span>
  72 + <span class="glyphicon glyphicon-remove" aria-hidden="true" ng-if="info.errorbc > 0"></span>
  73 + </div>
  74 + </div>
  75 + </div>
  76 + </div>
  77 + </div>
  78 +
  79 +
  80 +
  81 +</div>
0 \ No newline at end of file 82 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
@@ -3817,3 +3817,233 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saTimetable&#39;, [&#39;$compile&#39;, &#39;$window&#39;, @@ -3817,3 +3817,233 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saTimetable&#39;, [&#39;$compile&#39;, &#39;$window&#39;,
3817 }; 3817 };
3818 } 3818 }
3819 ]); 3819 ]);
  3820 +
  3821 +/**
  3822 + * saScpdate指令(非通用指令,只在排版计划form中使用)。
  3823 + * 属性如下:
  3824 + * name(必须):控件的名字
  3825 + * xlid(必须):线路id
  3826 + * xlname(必须):线路名字
  3827 + * from(必须):独立作用域-绑定的开始时间属性名
  3828 + * to(必须):独立作用域-绑定的结束时间属性名
  3829 + * error(必须):独立作用域-绑定的错误描述属性名
  3830 + */
  3831 +angular.module('ScheduleApp').directive(
  3832 + 'saScpdate',
  3833 + [
  3834 + 'SchedulePlanManageService_g',
  3835 + function(service) {
  3836 + return {
  3837 + restrict: 'E',
  3838 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdateTemplate.html',
  3839 + scope: {
  3840 + from: '=',
  3841 + to: '=',
  3842 + xlid: '=',
  3843 + xlname: '=',
  3844 + error: '='
  3845 + },
  3846 + controllerAs: '$saScpdateCtrl',
  3847 + bindToController: true,
  3848 + controller: function() {
  3849 + var self = this;
  3850 +
  3851 + // 内部ng-model值,用于和required配对
  3852 + self.$$internalmodel = undefined;
  3853 +
  3854 + // 内部数据源(时刻表的一些信息)
  3855 + self.$$ds = [];
  3856 +
  3857 + },
  3858 + compile: function(tElem, tAttrs) {
  3859 + // 获取所有属性,并验证
  3860 + var $name_attr = tAttrs['name']; // 控件的名字
  3861 + if (!$name_attr) {
  3862 + throw "必须有名称属性";
  3863 + }
  3864 +
  3865 + // controlAs名字
  3866 + var ctrlAs = '$saScpdateCtrl';
  3867 +
  3868 + // 线路id
  3869 + var xl_id = undefined;
  3870 + // 线路名字
  3871 + var xl_name = undefined;
  3872 + // 开始时间
  3873 + var from_date = undefined;
  3874 + // 结束时间
  3875 + var to_date = undefined;
  3876 +
  3877 + // 内部添加required验证,将所有的错误应用到required验证上去
  3878 + tElem.find("div").attr("required", "");
  3879 +
  3880 + return {
  3881 + pre: function(scope, element, attr) {
  3882 +
  3883 + },
  3884 +
  3885 + post: function(scope, element, attr) {
  3886 + // 属性值
  3887 + if ($name_attr) {
  3888 + scope[ctrlAs]["$name_attr"] = $name_attr;
  3889 + }
  3890 +
  3891 + // 开始日期open属性,及方法
  3892 + scope[ctrlAs].$$fromDateOpen = false;
  3893 + scope[ctrlAs].$$fromDate_open = function() {
  3894 + scope[ctrlAs].$$fromDateOpen = true;
  3895 + };
  3896 +
  3897 + // 结束日期open属性,及方法
  3898 + scope[ctrlAs].$$toDateOpen = false;
  3899 + scope[ctrlAs].$$toDate_open = function() {
  3900 + scope[ctrlAs].$$toDateOpen = true;
  3901 + };
  3902 +
  3903 +
  3904 + // 内部模型刷新
  3905 + scope[ctrlAs].$$internal_model_refresh = function() {
  3906 + if (!xl_id) {
  3907 + scope[ctrlAs].$$internalmodel = undefined;
  3908 + scope[ctrlAs].error = "线路必须选择";
  3909 + return;
  3910 + }
  3911 + if (!xl_name) {
  3912 + scope[ctrlAs].$$internalmodel = undefined;
  3913 + scope[ctrlAs].error = "线路必须选择";
  3914 + return;
  3915 + }
  3916 +
  3917 + if (!from_date) {
  3918 + scope[ctrlAs].$$internalmodel = undefined;
  3919 + scope[ctrlAs].error = "开始日期必须选择";
  3920 + return;
  3921 + }
  3922 + if (!to_date) {
  3923 + scope[ctrlAs].$$internalmodel = undefined;
  3924 + scope[ctrlAs].error = "结束日期必须选择";
  3925 + return;
  3926 + }
  3927 + if (from_date > to_date) {
  3928 + scope[ctrlAs].$$internalmodel = undefined;
  3929 + scope[ctrlAs].error = "开始日期必须在结束日期之前";
  3930 + return;
  3931 + }
  3932 +
  3933 + var QClass = service.ttinfo;
  3934 + QClass.val({xlid: xl_id, from: from_date, to: to_date},
  3935 + function(result) {
  3936 + scope[ctrlAs].$$ds = [];
  3937 +
  3938 + // 模拟数据
  3939 + scope[ctrlAs].$$ds.push(
  3940 + {
  3941 + xlid: 63020,
  3942 + ttid: 79,
  3943 + xlname: '青浦8路',
  3944 + ttname: '测试周末表',
  3945 +
  3946 + allbc: 18,
  3947 + inbc: 4,
  3948 + outbc: 4,
  3949 + yybc: 14,
  3950 +
  3951 + errorbc: 0
  3952 +
  3953 + },
  3954 + {
  3955 + xlid: 63020,
  3956 + ttid: 80,
  3957 + xlname: '青浦8路',
  3958 + ttname: '周四周五test',
  3959 +
  3960 + allbc: 18,
  3961 + inbc: 4,
  3962 + outbc: 4,
  3963 + yybc: 14,
  3964 +
  3965 + errorbc: 10
  3966 +
  3967 + },
  3968 + {
  3969 + xlid: 63020,
  3970 + ttid: 64,
  3971 + xlname: '青浦8路',
  3972 + ttname: '青浦8路时刻表1111',
  3973 +
  3974 + allbc: 18,
  3975 + inbc: 4,
  3976 + outbc: 4,
  3977 + yybc: 14,
  3978 +
  3979 + errorbc: 10
  3980 +
  3981 + }
  3982 + );
  3983 +
  3984 +
  3985 +
  3986 + scope[ctrlAs].$$internalmodel = "ok";
  3987 + },
  3988 + function() {
  3989 + scope[ctrlAs].$$internalmodel = undefined;
  3990 + scope[ctrlAs].error = "获取时刻表数据失败!";
  3991 + }
  3992 + );
  3993 +
  3994 +
  3995 + scope[ctrlAs].$$internalmodel = "ok";
  3996 + };
  3997 +
  3998 + scope[ctrlAs].$$internal_model_refresh(); // 初始执行
  3999 +
  4000 + //--------------------- 监控属性方法 -------------------//
  4001 + // 监控线路id模型值变化
  4002 + scope.$watch(
  4003 + function() {
  4004 + return scope[ctrlAs].xlid;
  4005 + },
  4006 + function(newValue, oldValue) {
  4007 + xl_id = newValue;
  4008 + scope[ctrlAs].$$internal_model_refresh();
  4009 + }
  4010 + );
  4011 + // 监控线路name模型值变化
  4012 + scope.$watch(
  4013 + function() {
  4014 + return scope[ctrlAs].xlname;
  4015 + },
  4016 + function(newValue, oldValue) {
  4017 + xl_name = newValue;
  4018 + scope[ctrlAs].$$internal_model_refresh();
  4019 + }
  4020 + );
  4021 +
  4022 + // 监控开始时间模型值变化
  4023 + scope.$watch(
  4024 + function() {
  4025 + return scope[ctrlAs].from;
  4026 + },
  4027 + function(newValue, oldValue) {
  4028 + from_date = newValue;
  4029 + scope[ctrlAs].$$internal_model_refresh();
  4030 + }
  4031 + );
  4032 + // 监控结束时间模型值变化
  4033 + scope.$watch(
  4034 + function() {
  4035 + return scope[ctrlAs].to;
  4036 + },
  4037 + function(newValue, oldValue) {
  4038 + to_date = newValue;
  4039 + scope[ctrlAs].$$internal_model_refresh();
  4040 + }
  4041 + );
  4042 +
  4043 + }
  4044 + };
  4045 + }
  4046 + };
  4047 + }
  4048 + ]
  4049 +);
3820 \ No newline at end of file 4050 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
@@ -468,6 +468,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource @@ -468,6 +468,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
468 method: 'GET' 468 method: 'GET'
469 } 469 }
470 } 470 }
  471 + ),
  472 + ttinfo: $resource(
  473 + '/spc/valttinfo/:xlid/:from/:to',
  474 + {xlid: '@xlid', from: '@from', to: '@to'},
  475 + {
  476 + val: {
  477 + method: 'GET'
  478 + }
  479 + }
471 ) 480 )
472 }; 481 };
473 }]); 482 }]);
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/form.html
@@ -43,24 +43,26 @@ @@ -43,24 +43,26 @@
43 <div class="form-group has-success has-feedback"> 43 <div class="form-group has-success has-feedback">
44 <label class="col-md-2 control-label">线路*:</label> 44 <label class="col-md-2 control-label">线路*:</label>
45 <div class="col-md-3"> 45 <div class="col-md-3">
46 - <sa-Select3 model="ctrl.schedulePlanManageForSave"  
47 - name="xl"  
48 - placeholder="请输拼音..."  
49 - dcvalue="{{ctrl.schedulePlanManageForSave.xl.id}}" 46 + <sa-Select5 name="xl"
  47 + model="ctrl.schedulePlanManageForSave"
  48 + cmaps="{'xl.id' : 'id', 'xl.name': 'name'}"
50 dcname="xl.id" 49 dcname="xl.id"
51 icname="id" 50 icname="id"
52 - icnames="name"  
53 - datatype="xl"  
54 - mlp="true" 51 + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
  52 + iterobjname="item"
  53 + iterobjexp="item.name"
  54 + searchph="请输拼音..."
  55 + searchexp="this.name"
55 required > 56 required >
56 - </sa-Select3> 57 + </sa-Select5>
57 </div> 58 </div>
58 <!-- 隐藏块,显示验证信息 --> 59 <!-- 隐藏块,显示验证信息 -->
59 <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required"> 60 <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
60 线路必须选择 61 线路必须选择
61 </div> 62 </div>
62 </div> 63 </div>
63 - <div class="form-group"> 64 +
  65 + <div class="form-group has-success has-feedback">
64 <label class="col-md-2 control-label">开始日期*:</label> 66 <label class="col-md-2 control-label">开始日期*:</label>
65 <div class="col-md-3"> 67 <div class="col-md-3">
66 <div class="input-group"> 68 <div class="input-group">
@@ -82,7 +84,7 @@ @@ -82,7 +84,7 @@
82 </div> 84 </div>
83 </div> 85 </div>
84 86
85 - <div class="form-group"> 87 + <div class="form-group has-success has-feedback">
86 <label class="col-md-2 control-label">结束日期*:</label> 88 <label class="col-md-2 control-label">结束日期*:</label>
87 <div class="col-md-3"> 89 <div class="col-md-3">
88 <div class="input-group"> 90 <div class="input-group">
@@ -104,6 +106,24 @@ @@ -104,6 +106,24 @@
104 </div> 106 </div>
105 </div> 107 </div>
106 108
  109 + <!--<div class="form-group has-success has-feedback">-->
  110 + <!--<label class="col-md-2 control-label">时刻表信息*:</label>-->
  111 + <!--<div class="col-md-6">-->
  112 + <!--<sa-Scpdate name="scp_s_t_date"-->
  113 + <!--xlid="ctrl.schedulePlanManageForSave.xl.id"-->
  114 + <!--xlname="ctrl.schedulePlanManageForSave.xl.name"-->
  115 + <!--from="ctrl.schedulePlanManageForSave.scheduleFromTime"-->
  116 + <!--to="ctrl.schedulePlanManageForSave.scheduleToTime"-->
  117 + <!--error="ctrl.scperror"-->
  118 + <!--required-->
  119 + <!-->-->
  120 + <!--</sa-Scpdate>-->
  121 + <!--</div>-->
  122 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.scp_s_t_date.$error.required">-->
  123 + <!--{{ctrl.scperror}}-->
  124 + <!--</div>-->
  125 + <!--</div>-->
  126 +
107 <!-- 其他form-group --> 127 <!-- 其他form-group -->
108 128
109 </div> 129 </div>
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
@@ -15,15 +15,18 @@ @@ -15,15 +15,18 @@
15 <tr role="row" class="filter"> 15 <tr role="row" class="filter">
16 <td></td> 16 <td></td>
17 <td> 17 <td>
18 - <sa-Select3 model="ctrl.searchCondition()"  
19 - name="xl"  
20 - placeholder="请输拼音..."  
21 - dcvalue="{{ctrl.searchCondition()['xl.id_eq']}}" 18 + <sa-Select5 name="xl"
  19 + model="ctrl.searchCondition()"
  20 + cmaps="{'xl.id_eq': 'id', 'xl.name_eq': 'name'}"
22 dcname="xl.id_eq" 21 dcname="xl.id_eq"
23 icname="id" 22 icname="id"
24 - icnames="name"  
25 - datatype="xl">  
26 - </sa-Select3> 23 + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
  24 + iterobjname="item"
  25 + iterobjexp="item.name"
  26 + searchph="请输拼音..."
  27 + searchexp="this.name"
  28 + required >
  29 + </sa-Select5>
27 </td> 30 </td>
28 <td> 31 <td>
29 <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().name_like" placeholder="输入时刻表名称..."/> 32 <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().name_like" placeholder="输入时刻表名称..."/>
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/module.js
@@ -146,6 +146,10 @@ angular.module(&#39;ScheduleApp&#39;).controller( @@ -146,6 +146,10 @@ angular.module(&#39;ScheduleApp&#39;).controller(
146 self.schedulePlanManageForSave = new SPlan; 146 self.schedulePlanManageForSave = new SPlan;
147 self.schedulePlanManageForSave.xl = {}; 147 self.schedulePlanManageForSave.xl = {};
148 148
  149 + // 初始表单,从查询条件中获取线路id
  150 + self.schedulePlanManageForSave.xl.id = service.getSearchCondition()['xl.id_eq'];
  151 + self.schedulePlanManageForSave.xl.name = service.getSearchCondition()['xl.name_eq'];
  152 +
149 // 提交方法 153 // 提交方法
150 self.submit = function() { 154 self.submit = function() {
151 console.log(self.schedulePlanManageForSave); 155 console.log(self.schedulePlanManageForSave);
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
@@ -46,6 +46,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource @@ -46,6 +46,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
46 method: 'GET' 46 method: 'GET'
47 } 47 }
48 } 48 }
  49 + ),
  50 + ttinfo: $resource(
  51 + '/spc/valttinfo/:xlid/:from/:to',
  52 + {xlid: '@xlid', from: '@from', to: '@to'},
  53 + {
  54 + val: {
  55 + method: 'GET'
  56 + }
  57 + }
49 ) 58 )
50 }; 59 };
51 }]); 60 }]);