Commit 477fa9149270468e5bc29cd35dc9023b47a9e2ec

Authored by 潘钊
1 parent 2f612948

update...

src/main/java/com/bsth/Application.java
@@ -2,10 +2,6 @@ package com.bsth; @@ -2,10 +2,6 @@ package com.bsth;
2 2
3 import com.fasterxml.jackson.databind.ObjectMapper; 3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.fasterxml.jackson.databind.SerializationFeature; 4 import com.fasterxml.jackson.databind.SerializationFeature;
5 -  
6 -import java.util.concurrent.Executors;  
7 -import java.util.concurrent.ScheduledExecutorService;  
8 -  
9 import org.springframework.boot.SpringApplication; 5 import org.springframework.boot.SpringApplication;
10 import org.springframework.boot.autoconfigure.SpringBootApplication; 6 import org.springframework.boot.autoconfigure.SpringBootApplication;
11 import org.springframework.boot.builder.SpringApplicationBuilder; 7 import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -13,10 +9,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer; @@ -13,10 +9,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
13 import org.springframework.context.annotation.Bean; 9 import org.springframework.context.annotation.Bean;
14 import org.springframework.context.annotation.Primary; 10 import org.springframework.context.annotation.Primary;
15 11
  12 +import java.util.concurrent.Executors;
  13 +import java.util.concurrent.ScheduledExecutorService;
  14 +
16 @SpringBootApplication 15 @SpringBootApplication
17 public class Application extends SpringBootServletInitializer { 16 public class Application extends SpringBootServletInitializer {
18 17
19 - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(12); 18 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(13);
20 19
21 @Override 20 @Override
22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 21 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
@@ -14,39 +14,91 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ @@ -14,39 +14,91 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{
14 14
15 @Autowired 15 @Autowired
16 LineConfigService lineConfigService; 16 LineConfigService lineConfigService;
17 - 17 +
  18 + /**
  19 + * 检查是否有线路配置信息
  20 + * @param codeArray
  21 + * @return
  22 + */
18 @RequestMapping("/check") 23 @RequestMapping("/check")
19 public Map<String, Object> check(@RequestParam String[] codeArray){ 24 public Map<String, Object> check(@RequestParam String[] codeArray){
20 return lineConfigService.check(codeArray); 25 return lineConfigService.check(codeArray);
21 } 26 }
22 - 27 +
  28 + /**
  29 + * 初始化线路配置
  30 + * @param lineCode
  31 + * @return
  32 + * @throws Exception
  33 + */
23 @RequestMapping("/init/{lineCode}") 34 @RequestMapping("/init/{lineCode}")
24 public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{ 35 public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{
25 return lineConfigService.init(lineCode); 36 return lineConfigService.init(lineCode);
26 } 37 }
27 - 38 +
  39 + /**
  40 + * 修改班次刷新时间
  41 + * @param time
  42 + * @param lineCode
  43 + * @return
  44 + */
28 @RequestMapping(value = "/editTime", method = RequestMethod.POST) 45 @RequestMapping(value = "/editTime", method = RequestMethod.POST)
29 public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ 46 public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){
30 return lineConfigService.editStartOptTime(time, lineCode); 47 return lineConfigService.editStartOptTime(time, lineCode);
31 } 48 }
32 - 49 +
  50 + /**
  51 + * 修改出场时间类型
  52 + * @param lineCode
  53 + * @param type
  54 + * @return
  55 + */
33 @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) 56 @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST)
34 public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ 57 public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){
35 return lineConfigService.editOutTimeType(lineCode, type); 58 return lineConfigService.editOutTimeType(lineCode, type);
36 } 59 }
37 60
  61 + /**
  62 + * 启用原线路回场
  63 + * @param lineCode
  64 + * @param enable
  65 + * @return
  66 + */
38 @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST) 67 @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST)
39 public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){ 68 public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){
40 return lineConfigService.enableInParkForSource(lineCode, enable); 69 return lineConfigService.enableInParkForSource(lineCode, enable);
41 } 70 }
42 71
  72 + /**
  73 + * 根据线路编码获取配置信息
  74 + * @param lineCode
  75 + * @return
  76 + */
43 @RequestMapping(value = "/getByLineCode") 77 @RequestMapping(value = "/getByLineCode")
44 public LineConfig getByLineCode(@RequestParam String lineCode){ 78 public LineConfig getByLineCode(@RequestParam String lineCode){
45 return lineConfigService.getByLineCode(lineCode); 79 return lineConfigService.getByLineCode(lineCode);
46 } 80 }
47 81
  82 + /**
  83 + * 到站缓冲区设置
  84 + * @param lineCode
  85 + * @param field
  86 + * @param value
  87 + * @return
  88 + */
48 @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST) 89 @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST)
49 public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){ 90 public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){
50 return lineConfigService.bufferTimeDiff(lineCode, field, value); 91 return lineConfigService.bufferTimeDiff(lineCode, field, value);
51 } 92 }
  93 +
  94 + /**
  95 + * 应急停靠设置
  96 + * @param map
  97 + * @return
  98 + */
  99 + @RequestMapping(value = "/yjtkSet", method = RequestMethod.POST)
  100 + public Map<String, Object> yjtkSet(@RequestParam Map<String, String> map){
  101 + //System.out.println(map);
  102 + return lineConfigService.yjtkSet(map);
  103 + }
52 } 104 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
3 import com.alibaba.fastjson.JSONArray; 3 import com.alibaba.fastjson.JSONArray;
  4 +import com.bsth.common.ResponseCode;
4 import com.bsth.controller.BaseController; 5 import com.bsth.controller.BaseController;
5 import com.bsth.controller.realcontrol.dto.ChangePersonCar; 6 import com.bsth.controller.realcontrol.dto.ChangePersonCar;
6 import com.bsth.controller.realcontrol.dto.DfsjChange; 7 import com.bsth.controller.realcontrol.dto.DfsjChange;
@@ -486,4 +487,33 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -486,4 +487,33 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
486 public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ 487 public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
487 return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); 488 return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
488 } 489 }
  490 +
  491 + /**
  492 + * 删除当日实际排班
  493 + * @return
  494 + */
  495 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  496 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  497 + return dayOfSchedule.deleteRealSchedule(lineCode);
  498 + }
  499 +
  500 + /**
  501 + * 从计划表重新加载当日排班
  502 + * @param lineCode
  503 + * @return
  504 + */
  505 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  506 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  507 + Map<String, Object> rs = new HashMap<>();
  508 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  509 + if(list != null && list.size() > 0){
  510 + rs.put("status", ResponseCode.ERROR);
  511 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  512 + return rs;
  513 + }
  514 +
  515 + int code = dayOfSchedule.reloadSch(lineCode);
  516 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  517 + return rs;
  518 + }
489 } 519 }
src/main/java/com/bsth/data/LineConfigData.java
1 package com.bsth.data; 1 package com.bsth.data;
2 2
  3 +import com.bsth.Application;
3 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
4 import com.bsth.entity.realcontrol.D80ReplyTemp; 5 import com.bsth.entity.realcontrol.D80ReplyTemp;
5 import com.bsth.entity.realcontrol.LineConfig; 6 import com.bsth.entity.realcontrol.LineConfig;
6 -import com.bsth.oplog.normal.OpLogger; 7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 import com.bsth.service.LineService; 8 import com.bsth.service.LineService;
8 import com.bsth.service.realcontrol.LineConfigService; 9 import com.bsth.service.realcontrol.LineConfigService;
9 import org.slf4j.Logger; 10 import org.slf4j.Logger;
@@ -14,101 +15,151 @@ import org.springframework.core.annotation.Order; @@ -14,101 +15,151 @@ import org.springframework.core.annotation.Order;
14 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
15 16
16 import java.util.*; 17 import java.util.*;
  18 +import java.util.concurrent.TimeUnit;
17 19
18 /** 20 /**
19 - * 21 + * @author PanZhao
20 * @ClassName: LineConfigData 22 * @ClassName: LineConfigData
21 * @Description: TODO(线路配置数据管理) 23 * @Description: TODO(线路配置数据管理)
22 - * @author PanZhao  
23 * @date 2016年8月15日 下午2:50:19 24 * @date 2016年8月15日 下午2:50:19
24 - *  
25 */ 25 */
26 @Component 26 @Component
27 @Order(value = 2) 27 @Order(value = 2)
28 public class LineConfigData implements CommandLineRunner { 28 public class LineConfigData implements CommandLineRunner {
29 -  
30 - Logger logger = LoggerFactory.getLogger(this.getClass());  
31 -  
32 - // 线路编码和配置  
33 - private Map<String, LineConfig> lineConfMap;  
34 -  
35 - @Autowired  
36 - LineConfigService lineConfigService;  
37 -  
38 - @Autowired  
39 - LineService lineService;  
40 -  
41 - @Autowired  
42 - OpLogger opLog;  
43 -  
44 - @Override  
45 - public void run(String... arg0) throws Exception {  
46 - lineConfMap = new HashMap<>();  
47 -  
48 - Iterator<LineConfig> itr = lineConfigService.findAll().iterator();  
49 - while (itr.hasNext())  
50 - setBuffer(itr.next());  
51 -  
52 - opLog.info("Line_config_data");  
53 - }  
54 -  
55 - public LineConfig get(String lineCode){  
56 - return lineConfMap.get(lineCode);  
57 - }  
58 -  
59 - public Collection<LineConfig> getAll(){  
60 - return lineConfMap.values();  
61 - }  
62 -  
63 - public void set(LineConfig conf){  
64 - lineConfigService.save(conf);  
65 - setBuffer(conf);  
66 - }  
67 -  
68 - public void setBuffer(LineConfig conf){  
69 - lineConfMap.put(conf.getLine().getLineCode(), conf);  
70 - }  
71 -  
72 - /**  
73 - *  
74 - * @Title: init  
75 - * @Description: TODO(初始化配置信息)  
76 - */  
77 - public void init(String lineCode) throws Exception{  
78 - LineConfig conf = new LineConfig();  
79 - //线路  
80 - Line line = lineService.findByLineCode(lineCode);  
81 - if(null == line)  
82 - throw new NullPointerException("异常的lineCode");  
83 -  
84 - conf.setLine(line);  
85 - //开始运营时间  
86 - conf.setStartOpt("02:00");  
87 - //托管状态  
88 - conf.setTrust(true);  
89 - //出场时间类型  
90 - conf.setOutConfig(0);  
91 - //进场时间类型  
92 - //conf.setInConfig(1);  
93 - //短语模板  
94 - conf.setPhraseTemps("");  
95 - //调度指令模板  
96 - conf.setSchDirectiveTemp("");  
97 -  
98 - //80指令回复  
99 - D80ReplyTemp t50 = new D80ReplyTemp(conf, (short)0x50, "同意,回电详谈", "不同意,请回电")  
100 - ,t60 = new D80ReplyTemp(conf, (short)0x60, "同意,回电详谈", "不同意,请回电")  
101 - ,tA2 = new D80ReplyTemp(conf, (short)0xA2, "同意,回电详谈", "不同意,请回电")  
102 - ,t70 = new D80ReplyTemp(conf, (short)0x70, "同意,回电详谈", "不同意,请回电")  
103 - ,t11 = new D80ReplyTemp(conf, (short)0x11, "同意,回电详谈", "不同意,请回电");  
104 -  
105 - Set<D80ReplyTemp> temps = conf.getD80Temps();  
106 - temps.add(t50);  
107 - temps.add(t60);  
108 - temps.add(tA2);  
109 - temps.add(t70);  
110 - temps.add(t11);  
111 -  
112 - set(conf);  
113 - } 29 +
  30 + static Logger logger = LoggerFactory.getLogger(LineConfigData.class);
  31 +
  32 + // 线路编码和配置
  33 + private Map<String, LineConfig> lineConfMap;
  34 +
  35 + @Autowired
  36 + LineConfigService lineConfigService;
  37 +
  38 + @Autowired
  39 + LineService lineService;
  40 +
  41 + //入库缓冲
  42 + static LinkedList<LineConfig> saveBuffers = new LinkedList<>();
  43 +
  44 + @Autowired
  45 + LineConfigPersistThread configPersistThread;
  46 +
  47 + @Override
  48 + public void run(String... arg0) throws Exception {
  49 + lineConfMap = new HashMap<>();
  50 +
  51 + Iterator<LineConfig> itr = lineConfigService.findAll().iterator();
  52 + while (itr.hasNext())
  53 + setBuffer(itr.next());
  54 +
  55 + //异步入库
  56 + Application.mainServices.scheduleWithFixedDelay(configPersistThread, 60, 60, TimeUnit.SECONDS);
  57 + }
  58 +
  59 + /**
  60 + * 起点发出,应用缓冲区设置参数
  61 + * @param sch
  62 + * @param timestamp
  63 + * @return
  64 + */
  65 + public long applyOut(ScheduleRealInfo sch, Long timestamp) {
  66 + LineConfig config = lineConfMap.get(sch.getXlBm());
  67 + int diff = sch.getXlDir()=="0"?config.getUpOutDiff():config.getDownOutDiff();
  68 + return timestamp - (diff * 60 * 1000);
  69 + }
  70 +
  71 + /**
  72 + * 终点到达,应用缓冲区设置参数
  73 + * @param sch
  74 + * @param timestamp
  75 + * @return
  76 + */
  77 + public long applyIn(ScheduleRealInfo sch, Long timestamp){
  78 + LineConfig config = lineConfMap.get(sch.getXlBm());
  79 + int diff = sch.getXlDir()=="0"?config.getUpInDiff():config.getDownInDiff();
  80 + return timestamp - (diff * 60 * 1000);
  81 + }
  82 +
  83 + @Component
  84 + private static class LineConfigPersistThread extends Thread {
  85 +
  86 + @Autowired
  87 + LineConfigService lineConfigService;
  88 +
  89 + @Override
  90 + public void run() {
  91 + LineConfig config;
  92 + for (int i = 0; i < 800; i++) {
  93 + config = saveBuffers.poll();
  94 + if (config == null)
  95 + break;
  96 +
  97 + try {
  98 + lineConfigService.save(config);
  99 + }catch (Exception e){
  100 + logger.error("", e);
  101 + }
  102 + }
  103 + }
  104 + }
  105 +
  106 + public LineConfig get(String lineCode) {
  107 + return lineConfMap.get(lineCode);
  108 + }
  109 +
  110 + public Collection<LineConfig> getAll() {
  111 + return lineConfMap.values();
  112 + }
  113 +
  114 + public void set(LineConfig conf) {
  115 + //lineConfigService.save(conf);
  116 + saveBuffers.add(conf);
  117 + setBuffer(conf);
  118 + }
  119 +
  120 + public void setBuffer(LineConfig conf) {
  121 + lineConfMap.put(conf.getLine().getLineCode(), conf);
  122 + }
  123 +
  124 + /**
  125 + * @Title: init
  126 + * @Description: TODO(初始化配置信息)
  127 + */
  128 + public void init(String lineCode) throws Exception {
  129 + LineConfig conf = new LineConfig();
  130 + //线路
  131 + Line line = lineService.findByLineCode(lineCode);
  132 + if (null == line)
  133 + throw new NullPointerException("异常的lineCode");
  134 +
  135 + conf.setLine(line);
  136 + //开始运营时间
  137 + conf.setStartOpt("02:00");
  138 + //托管状态
  139 + conf.setTrust(true);
  140 + //出场时间类型
  141 + conf.setOutConfig(0);
  142 + //进场时间类型
  143 + //conf.setInConfig(1);
  144 + //短语模板
  145 + conf.setPhraseTemps("");
  146 + //调度指令模板
  147 + conf.setSchDirectiveTemp("");
  148 +
  149 + //80指令回复 闵行用
  150 + D80ReplyTemp t50 = new D80ReplyTemp(conf, (short) 0x50, "同意,回电详谈", "不同意,请回电"), t60 = new D80ReplyTemp(conf, (short) 0x60, "同意,回电详谈", "不同意,请回电"), tA2 = new D80ReplyTemp(conf, (short) 0xA2, "同意,回电详谈", "不同意,请回电"), t70 = new D80ReplyTemp(conf, (short) 0x70, "同意,回电详谈", "不同意,请回电"), t11 = new D80ReplyTemp(conf, (short) 0x11, "同意,回电详谈", "不同意,请回电");
  151 +
  152 + //应急停靠默认值
  153 + conf.setYjtkStart("00:00");
  154 + conf.setYjtkEnd("23:59");
  155 +
  156 + Set<D80ReplyTemp> temps = conf.getD80Temps();
  157 + temps.add(t50);
  158 + temps.add(t60);
  159 + temps.add(tA2);
  160 + temps.add(t70);
  161 + temps.add(t11);
  162 +
  163 + set(conf);
  164 + }
114 } 165 }
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -135,8 +135,11 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -135,8 +135,11 @@ public class InOutStationSignalHandle extends SignalHandle{
135 if(StringUtils.isNotEmpty(sch.getFcsjActual())) 135 if(StringUtils.isNotEmpty(sch.getFcsjActual()))
136 return; 136 return;
137 137
  138 + //应用到离站缓冲区设置参数
  139 + long rsT = lineConfigData.applyOut(sch, gps.getTimestamp());
  140 +
138 //实发时间 141 //实发时间
139 - sch.setFcsjActualAll(gps.getTimestamp()); 142 + sch.setFcsjActualAll(rsT);
140 //通知客户端 143 //通知客户端
141 sendUtils.sendFcsj(sch); 144 sendUtils.sendFcsj(sch);
142 //持久化 145 //持久化
@@ -215,7 +218,10 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -215,7 +218,10 @@ public class InOutStationSignalHandle extends SignalHandle{
215 if(StringUtils.isNotEmpty(sch.getZdsjActual())) 218 if(StringUtils.isNotEmpty(sch.getZdsjActual()))
216 return; 219 return;
217 220
218 - sch.setZdsjActualAll(gps.getTimestamp()); 221 + //应用到离站缓冲区设置参数
  222 + long rsT = lineConfigData.applyIn(sch, gps.getTimestamp());
  223 +
  224 + sch.setZdsjActualAll(rsT);
219 //已完成班次数 225 //已完成班次数
220 int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); 226 int doneSum = dayOfSchedule.doneSum(sch.getClZbh());
221 ScheduleRealInfo next = dayOfSchedule.next(sch); 227 ScheduleRealInfo next = dayOfSchedule.next(sch);
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -3,6 +3,7 @@ package com.bsth.data.schedule; @@ -3,6 +3,7 @@ package com.bsth.data.schedule;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
5 import com.bsth.Application; 5 import com.bsth.Application;
  6 +import com.bsth.common.ResponseCode;
6 import com.bsth.data.BasicData; 7 import com.bsth.data.BasicData;
7 import com.bsth.data.LineConfigData; 8 import com.bsth.data.LineConfigData;
8 import com.bsth.data.directive.DirectivesPstThread; 9 import com.bsth.data.directive.DirectivesPstThread;
@@ -18,7 +19,6 @@ import com.bsth.util.BatchSaveUtils; @@ -18,7 +19,6 @@ import com.bsth.util.BatchSaveUtils;
18 import com.bsth.util.DateUtils; 19 import com.bsth.util.DateUtils;
19 import com.bsth.websocket.handler.SendUtils; 20 import com.bsth.websocket.handler.SendUtils;
20 import com.google.common.collect.ArrayListMultimap; 21 import com.google.common.collect.ArrayListMultimap;
21 -import com.google.common.collect.TreeMultimap;  
22 import org.apache.commons.lang3.StringUtils; 22 import org.apache.commons.lang3.StringUtils;
23 import org.joda.time.format.DateTimeFormat; 23 import org.joda.time.format.DateTimeFormat;
24 import org.joda.time.format.DateTimeFormatter; 24 import org.joda.time.format.DateTimeFormatter;
@@ -56,7 +56,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -56,7 +56,7 @@ public class DayOfSchedule implements CommandLineRunner {
56 private static Map<Long, ScheduleRealInfo> id2SchedulMap; 56 private static Map<Long, ScheduleRealInfo> id2SchedulMap;
57 57
58 // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) 58 // 车辆和排班起终点站对照(包括进出的停车场,区间起终点)
59 - private static TreeMultimap<String, String> nbbm2SEStationMap; 59 + //private static TreeMultimap<String, String> nbbm2SEStationMap;
60 60
61 //车辆 ——> 当前执行班次 61 //车辆 ——> 当前执行班次
62 private static Map<String, ScheduleRealInfo> carExecutePlanMap; 62 private static Map<String, ScheduleRealInfo> carExecutePlanMap;
@@ -99,7 +99,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -99,7 +99,7 @@ public class DayOfSchedule implements CommandLineRunner {
99 pstBuffer = new LinkedList<>(); 99 pstBuffer = new LinkedList<>();
100 schFCSJComparator = new ScheduleComparator.FCSJ(); 100 schFCSJComparator = new ScheduleComparator.FCSJ();
101 currSchDateMap = new HashMap<>(); 101 currSchDateMap = new HashMap<>();
102 - nbbm2SEStationMap = TreeMultimap.create(); 102 + //nbbm2SEStationMap = TreeMultimap.create();
103 carExecutePlanMap = new HashMap<>(); 103 carExecutePlanMap = new HashMap<>();
104 104
105 schedulePlanMap = new HashMap<>(); 105 schedulePlanMap = new HashMap<>();
@@ -244,6 +244,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -244,6 +244,10 @@ public class DayOfSchedule implements CommandLineRunner {
244 return 0; 244 return 0;
245 } 245 }
246 246
  247 + public int reloadSch(String lineCode){
  248 + return reloadSch(lineCode, calcSchDate(lineCode), true);
  249 + }
  250 +
247 /** 251 /**
248 * @Title: searchAllCars 252 * @Title: searchAllCars
249 * @Description: TODO(搜索班次集合中的车辆) 253 * @Description: TODO(搜索班次集合中的车辆)
@@ -480,9 +484,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -480,9 +484,9 @@ public class DayOfSchedule implements CommandLineRunner {
480 return id2SchedulMap.get(id); 484 return id2SchedulMap.get(id);
481 } 485 }
482 486
483 - public Set<String> getSEStationList(String nbbm) { 487 + /* public Set<String> getSEStationList(String nbbm) {
484 return nbbm2SEStationMap.get(nbbm); 488 return nbbm2SEStationMap.get(nbbm);
485 - } 489 + }*/
486 490
487 /** 491 /**
488 * @Title: next 492 * @Title: next
@@ -610,8 +614,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -610,8 +614,8 @@ public class DayOfSchedule implements CommandLineRunner {
610 614
611 String nbbm = sch.getClZbh(); 615 String nbbm = sch.getClZbh();
612 nbbmScheduleMap.put(nbbm, sch); 616 nbbmScheduleMap.put(nbbm, sch);
613 - nbbm2SEStationMap.put(nbbm, sch.getQdzCode());  
614 - nbbm2SEStationMap.put(nbbm, sch.getZdzCode()); 617 + //nbbm2SEStationMap.put(nbbm, sch.getQdzCode());
  618 + //nbbm2SEStationMap.put(nbbm, sch.getZdzCode());
615 619
616 //主键索引 620 //主键索引
617 id2SchedulMap.put(sch.getId(), sch); 621 id2SchedulMap.put(sch.getId(), sch);
@@ -630,9 +634,6 @@ public class DayOfSchedule implements CommandLineRunner { @@ -630,9 +634,6 @@ public class DayOfSchedule implements CommandLineRunner {
630 //return sch; 634 //return sch;
631 } 635 }
632 636
633 -// public void calcQdzTimePlan(String nbbm){  
634 -// schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));  
635 -// }  
636 637
637 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { 638 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) {
638 Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator); 639 Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator);
@@ -640,27 +641,6 @@ public class DayOfSchedule implements CommandLineRunner { @@ -640,27 +641,6 @@ public class DayOfSchedule implements CommandLineRunner {
640 } 641 }
641 642
642 /** 643 /**
643 - *  
644 - * @Title: nextAll  
645 - * @Description: TODO(之后的所有班次)  
646 - */  
647 -/* public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) {  
648 - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());  
649 - // 排序  
650 - Collections.sort(list, schFCSJComparator);  
651 -  
652 - List<ScheduleRealInfo> rs = new ArrayList<>();  
653 - ScheduleRealInfo temp;  
654 - for (int i = 0; i < list.size() - 1; i++) {  
655 - temp = list.get(i);  
656 - if(temp.getFcsjT() > sch.getFcsjT())  
657 - rs.add(temp);  
658 -  
659 - }  
660 - return rs;  
661 - }*/  
662 -  
663 - /**  
664 * @Title: doneSum 644 * @Title: doneSum
665 * @Description: TODO(已完成班次总数) 645 * @Description: TODO(已完成班次总数)
666 */ 646 */
@@ -828,8 +808,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -828,8 +808,8 @@ public class DayOfSchedule implements CommandLineRunner {
828 808
829 sch.setClZbh(newClZbh); 809 sch.setClZbh(newClZbh);
830 nbbmScheduleMap.put(newClZbh, sch); 810 nbbmScheduleMap.put(newClZbh, sch);
831 - nbbm2SEStationMap.put(newClZbh, sch.getQdzCode());  
832 - nbbm2SEStationMap.put(newClZbh, sch.getZdzCode()); 811 + //nbbm2SEStationMap.put(newClZbh, sch.getQdzCode());
  812 + //nbbm2SEStationMap.put(newClZbh, sch.getZdzCode());
833 813
834 //重新计算班次应到时间 814 //重新计算班次应到时间
835 ups.addAll(updateQdzTimePlan(oldClzbh)); 815 ups.addAll(updateQdzTimePlan(oldClzbh));
@@ -876,43 +856,50 @@ public class DayOfSchedule implements CommandLineRunner { @@ -876,43 +856,50 @@ public class DayOfSchedule implements CommandLineRunner {
876 } 856 }
877 857
878 /** 858 /**
879 - * 获取班次的计划停站时间  
880 - * @param sch 859 + * 删除实际排班
  860 + * @param lineCode
881 * @return 861 * @return
  862 + */
  863 + public Map<String, Object> deleteRealSchedule(String lineCode) {
  864 + Map<String, Object> rs = new HashMap<>();
882 865
883 - public int stopTimePlan(Object task) { 866 + try {
  867 + String rq = currSchDateMap.get(lineCode);
  868 + if(StringUtils.isNotEmpty(rq)){
  869 + //解除gps 和班次之间的关联
  870 + List<ScheduleRealInfo> unions = calcUnion(findByLineCode(lineCode), carExecutePlanMap.values());
  871 + for(ScheduleRealInfo sch : unions){
  872 + removeExecPlan(sch.getClZbh());
  873 + }
884 874
885 - ScheduleRealInfo sch = prev((ScheduleRealInfo) task); 875 + //删除班次数据
  876 + removeRealSch(lineCode, rq);
  877 + //删除相关班次修正记录
  878 + }
  879 + rs.put("status", ResponseCode.SUCCESS);
  880 + }catch (Exception e){
  881 + logger.error("", e);
  882 + rs.put("status", ResponseCode.ERROR);
  883 + }
886 884
887 - sch.getzdsj  
888 - return -1;  
889 - }*/ 885 + return rs;
  886 + }
890 887
891 /** 888 /**
  889 + * 计算并集
892 * 890 *
893 - * @Title: linkToSchPlan  
894 - * @Description: TODO(车辆关联到班次) 891 + * @param all
  892 + * @param sub
  893 + * @return
895 */ 894 */
896 -/* public void linkToSchPlan(String nbbm) {  
897 - //当前GPS状态  
898 - GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm));  
899 - if(null == gps)  
900 - return;  
901 -  
902 - //班次集合  
903 - List<ScheduleRealInfo> schArr = nbbmScheduleMap.get(nbbm);  
904 -  
905 - for(ScheduleRealInfo sch : schArr){  
906 - if(sch.getStatus() == 2)  
907 - continue;  
908 - if(sch.isDestroy())  
909 - continue;  
910 - if(!sch.getXlBm().equals(gps.getLineId())  
911 - || Integer.parseInt(sch.getXlDir()) != gps.getUpDown().intValue())  
912 - continue;  
913 -  
914 - addExecPlan(sch);  
915 - break;  
916 - }  
917 - }*/ 895 + public List<ScheduleRealInfo> calcUnion(Collection<ScheduleRealInfo> c1, Collection<ScheduleRealInfo> c2) {
  896 + List<ScheduleRealInfo> rs = new ArrayList<>();
  897 +
  898 + for (ScheduleRealInfo sch : c1) {
  899 + if(c2.contains(sch)){
  900 + rs.add(sch);
  901 + }
  902 + }
  903 + return rs;
  904 + }
918 } 905 }
919 \ No newline at end of file 906 \ No newline at end of file
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
@@ -2,7 +2,6 @@ package com.bsth.data.schedule.thread; @@ -2,7 +2,6 @@ package com.bsth.data.schedule.thread;
2 2
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
4 import com.bsth.data.LineConfigData; 4 import com.bsth.data.LineConfigData;
5 -import com.bsth.data.arrival.ArrivalData_GPS;  
6 import com.bsth.data.directive.DayOfDirectives; 5 import com.bsth.data.directive.DayOfDirectives;
7 import com.bsth.data.pilot80.PilotReport; 6 import com.bsth.data.pilot80.PilotReport;
8 import com.bsth.data.schedule.DayOfSchedule; 7 import com.bsth.data.schedule.DayOfSchedule;
@@ -29,8 +28,8 @@ public class ScheduleRefreshThread extends Thread{ @@ -29,8 +28,8 @@ public class ScheduleRefreshThread extends Thread{
29 @Autowired 28 @Autowired
30 DayOfSchedule dayOfSchedule; 29 DayOfSchedule dayOfSchedule;
31 30
32 - @Autowired  
33 - ArrivalData_GPS arrivalData; 31 + /*@Autowired
  32 + ArrivalData_GPS arrivalData;*/
34 33
35 @Autowired 34 @Autowired
36 LineConfigData lineConfs; 35 LineConfigData lineConfs;
@@ -59,7 +58,7 @@ public class ScheduleRefreshThread extends Thread{ @@ -59,7 +58,7 @@ public class ScheduleRefreshThread extends Thread{
59 58
60 logger.info(lineCode + "开始翻班, " + currSchDate); 59 logger.info(lineCode + "开始翻班, " + currSchDate);
61 //清除进出站数据 60 //清除进出站数据
62 - arrivalData.clearRAMData(lineCode); 61 + //arrivalData.clearRAMData(lineCode);
63 //清除指令数据 62 //清除指令数据
64 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); 63 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
65 for(String car : cars) 64 for(String car : cars)
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
@@ -20,4 +20,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{ @@ -20,4 +20,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
20 Map<String,Object> enableInParkForSource(String lineCode, int enable); 20 Map<String,Object> enableInParkForSource(String lineCode, int enable);
21 21
22 Map<String,Object> bufferTimeDiff(String lineCode, String field, String value); 22 Map<String,Object> bufferTimeDiff(String lineCode, String field, String value);
  23 +
  24 + Map<String,Object> yjtkSet(Map<String, String> map);
23 } 25 }
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
@@ -140,4 +140,40 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt; @@ -140,4 +140,40 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
140 } 140 }
141 return rs; 141 return rs;
142 } 142 }
  143 +
  144 + @Override
  145 + public Map<String, Object> yjtkSet(Map<String, String> map) {
  146 + String lineCode = map.get("lineCode").toString();
  147 + int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString());
  148 +
  149 + Map<String, Object> rs = new HashMap<>();
  150 + try {
  151 + LineConfig conf = lineConfigData.get(lineCode);
  152 +
  153 + if(enableYjtk == 1){
  154 + String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00";
  155 + String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59";
  156 + int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString());
  157 + int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString());
  158 +
  159 + conf.setEnableYjtk(true);
  160 + conf.setYjtkStart(yjtkStart);
  161 + conf.setYjtkEnd(yjtkEnd);
  162 + conf.setUpStopMinute(upStopMinute);
  163 + conf.setDownStopMinute(downStopMinute);
  164 + }
  165 + else
  166 + conf.setEnableYjtk(false);
  167 +
  168 + lineConfigData.set(conf);
  169 +
  170 + rs.put("status", ResponseCode.SUCCESS);
  171 + rs.put("conf", conf);
  172 + } catch (Exception e) {
  173 + rs.put("status", ResponseCode.ERROR);
  174 + rs.put("msg", e.getMessage());
  175 + logger.error("", e);
  176 + }
  177 + return rs;
  178 + }
143 } 179 }
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/buffer_config.html
@@ -43,14 +43,14 @@ @@ -43,14 +43,14 @@
43 <a class="uk-link-reset">应急停靠</a> 43 <a class="uk-link-reset">应急停靠</a>
44 </h2> 44 </h2>
45 <div> 45 <div>
46 - <form class="uk-form"> 46 + <form class="uk-form" name="yjtkForm">
47 <table> 47 <table>
48 <tr> 48 <tr>
49 <td colspan="2" style="padding-left: 30px;"> 49 <td colspan="2" style="padding-left: 30px;">
50 是否启用 50 是否启用
51 <select class="z-depth-input" name="enableYjtk"> 51 <select class="z-depth-input" name="enableYjtk">
52 - <option>禁用</option>  
53 - <option>启用</option> 52 + <option value="0" >禁用</option>
  53 + <option value="1" {{if enableYjtk}}selected{{/if}}>启用</option>
54 </select> 54 </select>
55 </td> 55 </td>
56 </tr> 56 </tr>
@@ -113,12 +113,56 @@ @@ -113,12 +113,56 @@
113 } 113 }
114 }); 114 });
115 115
116 - //应急停靠 116 + //启禁用应急停靠
117 $('[name=enableYjtk]', wrap).on('change', function () { 117 $('[name=enableYjtk]', wrap).on('change', function () {
118 - 118 + if($(this).val() == '1'){
  119 + enableYjtkForm();
  120 + }
  121 + else
  122 + disabledYjtkForm();
  123 + });
  124 + //参数改变
  125 + $('form[name=yjtkForm] input', wrap).on('blur', function () {
  126 + var field = $(this).attr('name');
  127 + var val = $(this).val();
  128 + if (conf[field] != val) {
  129 + var data = $('form[name=yjtkForm]', wrap).serializeJSON();
  130 + data.lineCode = conf.line.lineCode;
  131 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  132 + conf = rs.conf;
  133 + notify_succ('调整应急停靠参数');
  134 + });
  135 + }
119 }); 136 });
120 }); 137 });
121 138
  139 + function enableYjtkForm() {
  140 + var f = $('form[name=yjtkForm]', wrap);
  141 + $('input', f).removeAttr('disabled');
  142 +
  143 + var data = f.serializeJSON();
  144 + data.lineCode = conf.line.lineCode;
  145 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  146 + conf = rs.conf;
  147 + notify_succ('启用应急停靠');
  148 + });
  149 + }
  150 +
  151 + function disabledYjtkForm() {
  152 + var f = $('form[name=yjtkForm]', wrap);
  153 + $('input', f).attr('disabled', 'disabled');
  154 + //恢复val
  155 + $('[name=yjtkStart]',f).val(conf.yjtkStart);
  156 + $('[name=yjtkEnd]',f).val(conf.yjtkEnd);
  157 + $('[name=upStopMinute]',f).val(conf.upStopMinute);
  158 + $('[name=downStopMinute]',f).val(conf.downStopMinute);
  159 +
  160 + var data = {enableYjtk: 0, lineCode: conf.line.lineCode};
  161 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  162 + conf = rs.conf;
  163 + notify_succ('禁用应急停靠');
  164 + });
  165 + }
122 })(); 166 })();
123 </script> 167 </script>
124 </div> 168 </div>
125 \ No newline at end of file 169 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config.html
@@ -11,10 +11,6 @@ @@ -11,10 +11,6 @@
11 <div id="buffer_config_panel"></div> 11 <div id="buffer_config_panel"></div>
12 </div> 12 </div>
13 </div> 13 </div>
14 -  
15 - <div style="position: absolute;top: 10px;left: 40%;padding: 10px;color: #fe4242;background: #f2f2f2;box-shadow: 3px 1px 4px 0 rgba(0, 0, 0, 0.2), 1px 0px 5px 0 rgba(0, 0, 0, 0.19);font-size: 16px;">  
16 - 功能调试中,当前页面暂不可用!!!  
17 - </div>  
18 </div> 14 </div>
19 15
20 16
@@ -42,27 +38,6 @@ @@ -42,27 +38,6 @@
42 var modal = '#nav-line_config-modal', 38 var modal = '#nav-line_config-modal',
43 lineConfig, activeCode; 39 lineConfig, activeCode;
44 40
45 - $(modal).on('init', function (e, data) {  
46 - e.stopPropagation();  
47 - var htmlStr = template('nav-line_config-modal-tree-temp', {array: gb_data_basic.activeLines});  
48 - $('.line-config-tree .uk-accordion', modal).html(htmlStr);  
49 -  
50 - if(data.activeCode){  
51 -  
52 - }  
53 - else{  
54 - //没有指定线路,默认展开第一条  
55 - var $first = $('.uk-accordion-title:eq(0)', modal);  
56 - activeCode = $first.data('id');  
57 - load();  
58 -  
59 - setTimeout(function () {  
60 - //选中第一条线路  
61 - $first.trigger('click');  
62 - }, 400);  
63 - }  
64 - });  
65 -  
66 /** 41 /**
67 * 手风琴拨动 42 * 手风琴拨动
68 */ 43 */
@@ -73,6 +48,31 @@ @@ -73,6 +48,31 @@
73 } 48 }
74 }); 49 });
75 50
  51 + $(modal).on('init', function (e, data) {
  52 + e.stopPropagation();
  53 + var htmlStr = template('nav-line_config-modal-tree-temp', {array: gb_data_basic.activeLines});
  54 + $('.line-config-tree .uk-accordion', modal).html(htmlStr);
  55 +
  56 + if(data.activeCode)
  57 + activeCode = data.activeCode;
  58 + else{
  59 + //展开tab激活的线路
  60 + var $activeTab = $('#main-tab-content>li.line_schedule.uk-active');
  61 + if($activeTab.length > 0)
  62 + activeCode = $activeTab.data('id');
  63 + else{
  64 + //展开第一个
  65 + var $first = $('.uk-accordion-title:eq(0)', modal);
  66 + activeCode = $first.data('id');
  67 + }
  68 + }
  69 +
  70 + setTimeout(function () {
  71 + $('.uk-accordion-title[data-id='+activeCode+']', modal).trigger('click');
  72 + }, 500);
  73 + });
  74 +
  75 +
76 var load = function () { 76 var load = function () {
77 //获取线路配置信息 77 //获取线路配置信息
78 $.get('/lineConfig/getByLineCode', {lineCode: activeCode}, function (conf) { 78 $.get('/lineConfig/getByLineCode', {lineCode: activeCode}, function (conf) {
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config_entity.html
@@ -23,9 +23,9 @@ @@ -23,9 +23,9 @@
23 <small><i class="uk-icon-question-circle"></i> 所有发车时间小于该时间的班次都默认跨过24点,手动调整的实发实达均应用此规则。</small> 23 <small><i class="uk-icon-question-circle"></i> 所有发车时间小于该时间的班次都默认跨过24点,手动调整的实发实达均应用此规则。</small>
24 </li> 24 </li>
25 </ul> 25 </ul>
26 - <a class="uk-button uk-button-mini">删除实际排班</a>  
27 - <a class="uk-button uk-button-mini">重新加载实际排班</a>  
28 - <a class="uk-button uk-button-mini">加载历史GPS恢复到离站</a> 26 + <button class="uk-button uk-button-mini" id="clearRealScheduleBtn">删除实际排班</button>
  27 + <button class="uk-button uk-button-mini" id="reLoadRealScheduleBtn">重新加载实际排班</button>
  28 + <button class="uk-button uk-button-mini" disabled>加载历史GPS恢复到离站</button>
29 </div> 29 </div>
30 </div> 30 </div>
31 <div id="out_time_type_panel"> 31 <div id="out_time_type_panel">
@@ -81,9 +81,42 @@ @@ -81,9 +81,42 @@
81 81
82 var wrap = '#line_config_entity_wrap', conf; 82 var wrap = '#line_config_entity_wrap', conf;
83 83
  84 + /**
  85 + * 删除实际排班
  86 + */
  87 + var clearRealSchedule = function (e) {
  88 + e.stopPropagation();
  89 + var lineCode = conf.line.lineCode;
  90 + var htmlStr = '<h4 style="color: red;">你确定要删除【' + conf.line.name + '】今日的实际排班?</h4><h5>人车、路牌、待发等相关班次调整信息会被删除。</h5><h5>调度指令和期间与设备的通讯记录被保留</h5><h5>后台日志中的人工操作痕迹被保留</h5>';
  91 + alt_confirm(htmlStr, function () {
  92 + gb_common.$post('/realSchedule/deleteRealSchedule', {lineCode: lineCode}, function () {
  93 + //刷新班次表格
  94 + gb_schedule_table.reLoadAndRefresh(lineCode);
  95 + notify_succ('删除班次成功!!!');
  96 + });
  97 + }, '确认删除' + conf.line.name + '的实际排班');
  98 +
  99 + return false;
  100 + };
  101 +
  102 + /**
  103 + * 重新载入实际排班
  104 + */
  105 + var reLoadRealSchedule = function (e) {
  106 + e.stopPropagation();
  107 + var lineCode = conf.line.lineCode;
  108 + gb_common.$post('/realSchedule/reLoadRealSchedule', {lineCode: lineCode}, function () {
  109 + //刷新班次表格
  110 + gb_schedule_table.reLoadAndRefresh(lineCode);
  111 + notify_succ('重新载入班次成功');
  112 + });
  113 + return false;
  114 + };
  115 +
84 $(wrap).on('init', function (e, data) { 116 $(wrap).on('init', function (e, data) {
85 e.stopPropagation(); 117 e.stopPropagation();
86 conf = data.lineConfig; 118 conf = data.lineConfig;
  119 +
87 var htmlStr = template('line_config_entity_form-temp', conf); 120 var htmlStr = template('line_config_entity_form-temp', conf);
88 $('form', wrap).html(htmlStr); 121 $('form', wrap).html(htmlStr);
89 122
@@ -93,7 +126,11 @@ @@ -93,7 +126,11 @@
93 //出场时间类型 126 //出场时间类型
94 $('select[name=outParkTypeSelect]', wrap).on('change', updateOutParkType); 127 $('select[name=outParkTypeSelect]', wrap).on('change', updateOutParkType);
95 //原线路回场 128 //原线路回场
96 - $('select[name=inParkForSourceSelect]', wrap).on('change', enableInParkForSource) 129 + $('select[name=inParkForSourceSelect]', wrap).on('change', enableInParkForSource);
  130 + //删除班次
  131 + $('#clearRealScheduleBtn', wrap).on('click', clearRealSchedule);
  132 + //重新载入实际排班
  133 + $('#reLoadRealScheduleBtn', wrap).on('click', reLoadRealSchedule);
97 }); 134 });
98 135
99 //更新排班时间 136 //更新排班时间
@@ -110,39 +147,23 @@ @@ -110,39 +147,23 @@
110 conf.startOpt = rs.time; 147 conf.startOpt = rs.time;
111 }); 148 });
112 startOptFlag = false; 149 startOptFlag = false;
113 - }, 500); 150 + }, 300);
114 } 151 }
115 152
116 - var outParkFlag;  
117 function updateOutParkType() { 153 function updateOutParkType() {
118 - if (outParkFlag)  
119 - return;  
120 - outParkFlag = true;  
121 - var that = this;  
122 - setTimeout(function () {  
123 - var type = $(that).val();  
124 - gb_common.$post('/lineConfig/editOutTimeType', {lineCode: conf.line.lineCode, type: type}, function () {  
125 - notify_succ('调整出场时间类型成功!');  
126 - conf.outConfig = type;  
127 - });  
128 - outParkFlag = false;  
129 - }, 500); 154 + var type = $(this).val();
  155 + gb_common.$post('/lineConfig/editOutTimeType', {lineCode: conf.line.lineCode, type: type}, function () {
  156 + notify_succ('调整出场时间类型成功!');
  157 + conf.outConfig = type;
  158 + });
130 } 159 }
131 160
132 - var inParkSourceFlag;  
133 function enableInParkForSource() { 161 function enableInParkForSource() {
134 - if(inParkSourceFlag)  
135 - return;  
136 - inParkSourceFlag = true;  
137 - var that = this;  
138 - setTimeout(function () {  
139 - var enable = $(that).val();  
140 - gb_common.$post('/lineConfig/enableInParkForSource', {lineCode: conf.line.lineCode, enable: enable}, function () {  
141 - notify_succ((enable==1?'启用':'禁用') + '原线路回场');  
142 - conf.inParkForSource = enable;  
143 - });  
144 - inParkSourceFlag = false;  
145 - }, 500); 162 + var enable = $(this).val();
  163 + gb_common.$post('/lineConfig/enableInParkForSource', {lineCode: conf.line.lineCode, enable: enable}, function () {
  164 + notify_succ((enable==1?'启用':'禁用') + '原线路回场');
  165 + conf.inParkForSource = enable;
  166 + });
146 } 167 }
147 })(); 168 })();
148 </script> 169 </script>
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -152,6 +152,8 @@ var gb_schedule_table = (function () { @@ -152,6 +152,8 @@ var gb_schedule_table = (function () {
152 } 152 }
153 153
154 //重新渲染表格 154 //重新渲染表格
  155 + reRenderTable(sch.xlBm);
  156 + /*//重新渲染表格
155 var data = gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort), 157 var data = gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort),
156 dirData = gb_common.groupBy(data, 'xlDir'), 158 dirData = gb_common.groupBy(data, 'xlDir'),
157 tabCont = $('li.line_schedule[data-id=' + sch.xlBm + ']'); 159 tabCont = $('li.line_schedule[data-id=' + sch.xlBm + ']');
@@ -171,11 +173,72 @@ var gb_schedule_table = (function () { @@ -171,11 +173,72 @@ var gb_schedule_table = (function () {
171 //计算应发未发 173 //计算应发未发
172 calc_yfwf_num(sch.xlBm); 174 calc_yfwf_num(sch.xlBm);
173 //重新固定表头 175 //重新固定表头
174 - gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap')); 176 + gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap'));*/
175 //定位到新添加的班次 177 //定位到新添加的班次
176 scroToDl(sch); 178 scroToDl(sch);
177 }; 179 };
178 180
  181 + /**
  182 + * 重新渲染表格
  183 + */
  184 + var reRenderTable = function (lineCode) {
  185 + var data = gb_common.get_vals(line2Schedule[lineCode]).sort(schedule_sort),
  186 + dirData = gb_common.groupBy(data, 'xlDir'),
  187 + tabCont = $('li.line_schedule[data-id=' + lineCode + ']'),
  188 + htmlStr;
  189 +
  190 + if($.isEmptyObject(dirData)){
  191 + $('.schedule-wrap .card-panel', tabCont).html('');
  192 + }
  193 + else {
  194 + for (var upDown in dirData) {
  195 + htmlStr = temps['line-schedule-table-temp']({
  196 + dir: upDown,
  197 + line: gb_data_basic.codeToLine[lineCode],
  198 + list: dirData[upDown]
  199 + });
  200 + $('.schedule-wrap .card-panel:eq(' + upDown + ')', tabCont).html(htmlStr);
  201 + }
  202 + //图例相关
  203 + gb_sch_legend.init(tabCont);
  204 + //标记末班
  205 + markerLastByLine(lineCode);
  206 + //计算应发未发
  207 + calc_yfwf_num(lineCode);
  208 + //重新固定表头
  209 + gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap'));
  210 + }
  211 + };
  212 +
  213 +
  214 + /**
  215 + * 重新从服务器加载数据,并刷新表格
  216 + * @param lineCode
  217 + */
  218 + var reLoadAndRefresh = function (lineCode) {
  219 + $.get('/realSchedule/lines', {
  220 + lines: lineCode + ','
  221 + }, function (rs) {
  222 + if(!rs || $.isEmptyObject(rs)){
  223 + line2Schedule[lineCode] = {};
  224 + }
  225 + else{
  226 + //排序
  227 + rs[lineCode].sort(schedule_sort);
  228 + line2Schedule[lineCode] = {};
  229 + //calc shift
  230 + $.each(rs[lineCode], function () {
  231 + calc_sch_real_shift(this);
  232 + line2Schedule[lineCode][this.id] = this;
  233 + });
  234 + }
  235 + //计算应发未发
  236 + calc_yfwf_num(lineCode);
  237 + //重新渲染
  238 + reRenderTable(lineCode);
  239 + });
  240 + };
  241 +
179 //删除一个班次 242 //删除一个班次
180 var deheteSchedule = function (sch) { 243 var deheteSchedule = function (sch) {
181 sch = line2Schedule[sch.xlBm][sch.id]; 244 sch = line2Schedule[sch.xlBm][sch.id];
@@ -494,6 +557,7 @@ var gb_schedule_table = (function () { @@ -494,6 +557,7 @@ var gb_schedule_table = (function () {
494 reset_drag_active_all: reset_drag_active_all, 557 reset_drag_active_all: reset_drag_active_all,
495 getDl: getDl, 558 getDl: getDl,
496 getNextSch: getNextSch, 559 getNextSch: getNextSch,
497 - addRemarks: addRemarks 560 + addRemarks: addRemarks,
  561 + reLoadAndRefresh: reLoadAndRefresh
498 }; 562 };
499 })(); 563 })();