Commit 39729142c261f852e4202947b1c1263c4921345d

Authored by 王通
1 parent 2df18a06

1.应急停靠处置,可以按班次类型排除

src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -53,8 +53,7 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -53,8 +53,7 @@ public class LateAdjustHandle implements ApplicationContextAware {
53 sch.setLateMinute(sch.getXlDir().equals("0") ? config.getUpStopMinute() : config.getDownStopMinute()); 53 sch.setLateMinute(sch.getXlDir().equals("0") ? config.getUpStopMinute() : config.getDownStopMinute());
54 } 54 }
55 55
56 - if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0  
57 - && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) { 56 + if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0 && !config.getExcludeTrip().contains(sch.getBcType())) {
58 57
59 //班次压入 58 //班次压入
60 if (!lateSchMap.containsKey(sch.getId())) { 59 if (!lateSchMap.containsKey(sch.getId())) {
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
@@ -79,6 +79,12 @@ public class LineConfig { @@ -79,6 +79,12 @@ public class LineConfig {
79 * 应急停靠 79 * 应急停靠
80 */ 80 */
81 private boolean enableYjtk; 81 private boolean enableYjtk;
  82 +
  83 + /**
  84 + * 排除班次类型
  85 + */
  86 + private String excludeTrip;
  87 +
82 /** HH:mm */ 88 /** HH:mm */
83 private String yjtkStart; 89 private String yjtkStart;
84 /** HH:mm */ 90 /** HH:mm */
@@ -220,6 +226,13 @@ public class LineConfig { @@ -220,6 +226,13 @@ public class LineConfig {
220 this.enableYjtk = enableYjtk; 226 this.enableYjtk = enableYjtk;
221 } 227 }
222 228
  229 + public String getExcludeTrip() {
  230 + return excludeTrip;
  231 + }
  232 +
  233 + public void setExcludeTrip(String excludeTrip) {
  234 + this.excludeTrip = excludeTrip;
  235 + }
223 236
224 public boolean isLockFirstOutTime() { 237 public boolean isLockFirstOutTime() {
225 return lockFirstOutTime; 238 return lockFirstOutTime;
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
1 -package com.bsth.service.realcontrol.impl;  
2 -  
3 -import com.bsth.common.ResponseCode;  
4 -import com.bsth.data.LineConfigData;  
5 -import com.bsth.entity.realcontrol.LineConfig;  
6 -import com.bsth.repository.realcontrol.LineConfigRepository;  
7 -import com.bsth.service.impl.BaseServiceImpl;  
8 -import com.bsth.service.realcontrol.LineConfigService;  
9 -import com.google.common.base.Splitter;  
10 -import org.slf4j.Logger;  
11 -import org.slf4j.LoggerFactory;  
12 -import org.springframework.beans.factory.annotation.Autowired;  
13 -import org.springframework.stereotype.Service;  
14 -  
15 -import java.lang.reflect.Field;  
16 -import java.util.ArrayList;  
17 -import java.util.HashMap;  
18 -import java.util.List;  
19 -import java.util.Map;  
20 -  
21 -@Service  
22 -public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService {  
23 -  
24 - @Autowired  
25 - LineConfigRepository lineConfigRepository;  
26 -  
27 - @Autowired  
28 - LineConfigData lineConfigData;  
29 -  
30 - Logger logger = LoggerFactory.getLogger(this.getClass());  
31 -  
32 - @Override  
33 - public Map<String, Object> check(String[] codeArray) {  
34 - Map<String, Object> rs = new HashMap<>();  
35 - List<String> notArr = new ArrayList<>();  
36 -  
37 - for (String lineCode : codeArray) {  
38 - if (null == lineConfigData.get(lineCode + ""))  
39 - notArr.add(lineCode);  
40 - }  
41 -  
42 - if (notArr.size() > 0) {  
43 - rs.put("status", 1);  
44 - rs.put("not", notArr);  
45 - } else  
46 - rs.put("status", 0);  
47 - return rs;  
48 - }  
49 -  
50 - @Override  
51 - public Integer init(String lineCode) throws Exception {  
52 - LineConfig conf = lineConfigData.get(lineCode);  
53 -  
54 - if (conf == null)  
55 - lineConfigData.init(lineCode);  
56 -  
57 - return 1;  
58 - }  
59 -  
60 - @Override  
61 - public Map<String, Object> editStartOptTime(String time, String lineCode) {  
62 - Map<String, Object> rs = new HashMap<>();  
63 - try {  
64 - LineConfig conf = lineConfigData.get(lineCode);  
65 - conf.setStartOpt(time);  
66 - lineConfigData.set(conf);  
67 -  
68 - rs.put("status", ResponseCode.SUCCESS);  
69 - rs.put("time", time);  
70 - } catch (Exception e) {  
71 - rs.put("status", ResponseCode.ERROR);  
72 - rs.put("msg", e.getMessage());  
73 - logger.error("", e);  
74 - }  
75 - return rs;  
76 - }  
77 -  
78 - @Override  
79 - public Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode) {  
80 - Map<String, Object> rs = new HashMap<>();  
81 - try {  
82 - LineConfig conf = lineConfigData.get(lineCode);  
83 -  
84 - conf.setOutConfig(type);  
85 - if(type == 2){  
86 - conf.setTwinsParks(parkCode);  
87 - conf.setTwinsStations(stationCode);  
88 - }  
89 - lineConfigData.set(conf);  
90 -  
91 - rs.put("status", ResponseCode.SUCCESS);  
92 - rs.put("conf", conf);  
93 - } catch (Exception e) {  
94 - rs.put("status", ResponseCode.ERROR);  
95 - rs.put("msg", e.getMessage());  
96 - logger.error("", e);  
97 - }  
98 - return rs;  
99 - }  
100 -  
101 - @Override  
102 - public LineConfig getByLineCode(String lineCode) {  
103 - return lineConfigData.get(lineCode);  
104 - }  
105 -  
106 - @Override  
107 - public Map<String, Object> enableInParkForSource(String lineCode, int enable) {  
108 - Map<String, Object> rs = new HashMap<>();  
109 - try {  
110 - LineConfig conf = lineConfigData.get(lineCode);  
111 -  
112 - conf.setInParkForSource(enable == 1);  
113 - lineConfigData.set(conf);  
114 -  
115 - rs.put("status", ResponseCode.SUCCESS);  
116 - rs.put("enable", enable);  
117 - } catch (Exception e) {  
118 - rs.put("status", ResponseCode.ERROR);  
119 - rs.put("msg", e.getMessage());  
120 - logger.error("", e);  
121 - }  
122 - return rs;  
123 - }  
124 -  
125 - @Override  
126 - public Map<String, Object> bufferTimeDiff(String lineCode, String field, String value) {  
127 -  
128 - Map<String, Object> rs = new HashMap<>();  
129 - try {  
130 - LineConfig conf = lineConfigData.get(lineCode);  
131 - Field f = conf.getClass().getDeclaredField(field);  
132 - f.setAccessible(true);  
133 - f.setInt(conf, Integer.parseInt(value));  
134 -  
135 - lineConfigData.set(conf);  
136 -  
137 - rs.put("status", ResponseCode.SUCCESS);  
138 - rs.put("field", field);  
139 - rs.put("value", value);  
140 - } catch (Exception e) {  
141 - rs.put("status", ResponseCode.ERROR);  
142 - rs.put("msg", e.getMessage());  
143 - logger.error("", e);  
144 - }  
145 - return rs;  
146 - }  
147 -  
148 - @Override  
149 - public Map<String, Object> yjtkSet(Map<String, String> map) {  
150 - String lineCode = map.get("lineCode").toString();  
151 - int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString());  
152 -  
153 - Map<String, Object> rs = new HashMap<>();  
154 - try {  
155 - LineConfig conf = lineConfigData.get(lineCode);  
156 -  
157 - if(enableYjtk == 1){  
158 - String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00";  
159 - String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59";  
160 - int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString());  
161 - int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString());  
162 -  
163 - conf.setEnableYjtk(true);  
164 - conf.setYjtkStart(yjtkStart);  
165 - conf.setYjtkEnd(yjtkEnd);  
166 - conf.setUpStopMinute(upStopMinute);  
167 - conf.setDownStopMinute(downStopMinute);  
168 - }  
169 - else  
170 - conf.setEnableYjtk(false);  
171 -  
172 - lineConfigData.set(conf);  
173 -  
174 - rs.put("status", ResponseCode.SUCCESS);  
175 - rs.put("conf", conf);  
176 - } catch (Exception e) {  
177 - rs.put("status", ResponseCode.ERROR);  
178 - rs.put("msg", e.getMessage());  
179 - logger.error("", e);  
180 - }  
181 - return rs;  
182 - }  
183 -  
184 - @Override  
185 - public Map<String, Object> parkAndStationSet(Map<String, String> map) {  
186 - String lineCode = map.get("lineCode").toString();  
187 - String twinsPark = map.get("twinsPark").toString();  
188 - String twinsStation = map.get("twinsStation").toString();  
189 -  
190 - Map<String, Object> rs = new HashMap<>();  
191 - try {  
192 - LineConfig conf = lineConfigData.get(lineCode);  
193 - conf.setTwinsParks(twinsPark);  
194 - conf.setTwinsStations(twinsStation);  
195 -  
196 - lineConfigData.set(conf);  
197 -  
198 - rs.put("status", ResponseCode.SUCCESS);  
199 - rs.put("conf", conf);  
200 - } catch (Exception e) {  
201 - rs.put("status", ResponseCode.ERROR);  
202 - rs.put("msg", e.getMessage());  
203 - logger.error("", e);  
204 - }  
205 - return rs;  
206 - }  
207 -  
208 - @Override  
209 - public Map<String, Object> findByIdx(String idx) {  
210 - Map<String, Object> rs = new HashMap();  
211 - try{  
212 - List<LineConfig> list = new ArrayList<>();  
213 - List<String> ids = Splitter.on(",").splitToList(idx);  
214 -  
215 - for(String id : ids){  
216 - list.add(lineConfigData.get(id));  
217 - }  
218 -  
219 - rs.put("status", ResponseCode.SUCCESS);  
220 - rs.put("list", list);  
221 - }catch (Exception e){  
222 - rs.put("status", ResponseCode.ERROR);  
223 - logger.error("", e);  
224 - }  
225 - return rs;  
226 - }  
227 -  
228 - @Override  
229 - public Map<String, Object> setAutoExec(Map<String, String> map) {  
230 - String lineCode = map.get("lineCode").toString();  
231 - boolean autoExec = Boolean.parseBoolean(map.get("autoExec").toString());  
232 -  
233 - Map<String, Object> rs = new HashMap<>();  
234 - try {  
235 - LineConfig conf = lineConfigData.get(lineCode);  
236 - conf.setAutoExec(autoExec);  
237 -  
238 - lineConfigData.set(conf);  
239 - rs.put("status", ResponseCode.SUCCESS);  
240 - rs.put("conf", conf);  
241 - } catch (Exception e) {  
242 - rs.put("status", ResponseCode.ERROR);  
243 - rs.put("msg", e.getMessage());  
244 - logger.error("", e);  
245 - }  
246 - return rs;  
247 - }  
248 -  
249 - @Override  
250 - public Map<String, Object> setReadReverse(int status, String lineCode) {  
251 - Map<String, Object> rs = new HashMap<>();  
252 - try {  
253 - LineConfig conf = lineConfigData.get(lineCode);  
254 - conf.setReadReverse(status==1?true:false);  
255 -  
256 - lineConfigData.set(conf);  
257 - rs.put("status", ResponseCode.SUCCESS);  
258 - rs.put("conf", conf);  
259 - } catch (Exception e) {  
260 - rs.put("status", ResponseCode.ERROR);  
261 - rs.put("msg", e.getMessage());  
262 - logger.error("", e);  
263 - }  
264 - return rs;  
265 - }  
266 -} 1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.data.LineConfigData;
  5 +import com.bsth.entity.realcontrol.LineConfig;
  6 +import com.bsth.repository.realcontrol.LineConfigRepository;
  7 +import com.bsth.service.impl.BaseServiceImpl;
  8 +import com.bsth.service.realcontrol.LineConfigService;
  9 +import com.google.common.base.Splitter;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.lang.reflect.Field;
  16 +import java.util.ArrayList;
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +@Service
  22 +public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService {
  23 +
  24 + @Autowired
  25 + LineConfigRepository lineConfigRepository;
  26 +
  27 + @Autowired
  28 + LineConfigData lineConfigData;
  29 +
  30 + Logger logger = LoggerFactory.getLogger(this.getClass());
  31 +
  32 + @Override
  33 + public Map<String, Object> check(String[] codeArray) {
  34 + Map<String, Object> rs = new HashMap<>();
  35 + List<String> notArr = new ArrayList<>();
  36 +
  37 + for (String lineCode : codeArray) {
  38 + if (null == lineConfigData.get(lineCode + ""))
  39 + notArr.add(lineCode);
  40 + }
  41 +
  42 + if (notArr.size() > 0) {
  43 + rs.put("status", 1);
  44 + rs.put("not", notArr);
  45 + } else
  46 + rs.put("status", 0);
  47 + return rs;
  48 + }
  49 +
  50 + @Override
  51 + public Integer init(String lineCode) throws Exception {
  52 + LineConfig conf = lineConfigData.get(lineCode);
  53 +
  54 + if (conf == null)
  55 + lineConfigData.init(lineCode);
  56 +
  57 + return 1;
  58 + }
  59 +
  60 + @Override
  61 + public Map<String, Object> editStartOptTime(String time, String lineCode) {
  62 + Map<String, Object> rs = new HashMap<>();
  63 + try {
  64 + LineConfig conf = lineConfigData.get(lineCode);
  65 + conf.setStartOpt(time);
  66 + lineConfigData.set(conf);
  67 +
  68 + rs.put("status", ResponseCode.SUCCESS);
  69 + rs.put("time", time);
  70 + } catch (Exception e) {
  71 + rs.put("status", ResponseCode.ERROR);
  72 + rs.put("msg", e.getMessage());
  73 + logger.error("", e);
  74 + }
  75 + return rs;
  76 + }
  77 +
  78 + @Override
  79 + public Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode) {
  80 + Map<String, Object> rs = new HashMap<>();
  81 + try {
  82 + LineConfig conf = lineConfigData.get(lineCode);
  83 +
  84 + conf.setOutConfig(type);
  85 + if(type == 2){
  86 + conf.setTwinsParks(parkCode);
  87 + conf.setTwinsStations(stationCode);
  88 + }
  89 + lineConfigData.set(conf);
  90 +
  91 + rs.put("status", ResponseCode.SUCCESS);
  92 + rs.put("conf", conf);
  93 + } catch (Exception e) {
  94 + rs.put("status", ResponseCode.ERROR);
  95 + rs.put("msg", e.getMessage());
  96 + logger.error("", e);
  97 + }
  98 + return rs;
  99 + }
  100 +
  101 + @Override
  102 + public LineConfig getByLineCode(String lineCode) {
  103 + return lineConfigData.get(lineCode);
  104 + }
  105 +
  106 + @Override
  107 + public Map<String, Object> enableInParkForSource(String lineCode, int enable) {
  108 + Map<String, Object> rs = new HashMap<>();
  109 + try {
  110 + LineConfig conf = lineConfigData.get(lineCode);
  111 +
  112 + conf.setInParkForSource(enable == 1);
  113 + lineConfigData.set(conf);
  114 +
  115 + rs.put("status", ResponseCode.SUCCESS);
  116 + rs.put("enable", enable);
  117 + } catch (Exception e) {
  118 + rs.put("status", ResponseCode.ERROR);
  119 + rs.put("msg", e.getMessage());
  120 + logger.error("", e);
  121 + }
  122 + return rs;
  123 + }
  124 +
  125 + @Override
  126 + public Map<String, Object> bufferTimeDiff(String lineCode, String field, String value) {
  127 +
  128 + Map<String, Object> rs = new HashMap<>();
  129 + try {
  130 + LineConfig conf = lineConfigData.get(lineCode);
  131 + Field f = conf.getClass().getDeclaredField(field);
  132 + f.setAccessible(true);
  133 + f.setInt(conf, Integer.parseInt(value));
  134 +
  135 + lineConfigData.set(conf);
  136 +
  137 + rs.put("status", ResponseCode.SUCCESS);
  138 + rs.put("field", field);
  139 + rs.put("value", value);
  140 + } catch (Exception e) {
  141 + rs.put("status", ResponseCode.ERROR);
  142 + rs.put("msg", e.getMessage());
  143 + logger.error("", e);
  144 + }
  145 + return rs;
  146 + }
  147 +
  148 + @Override
  149 + public Map<String, Object> yjtkSet(Map<String, String> map) {
  150 + String lineCode = map.get("lineCode").toString();
  151 + int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString());
  152 +
  153 + Map<String, Object> rs = new HashMap<>();
  154 + try {
  155 + LineConfig conf = lineConfigData.get(lineCode);
  156 +
  157 + if(enableYjtk == 1){
  158 + String excludeTrip = map.get("excludeTrip") == null ? "" : map.get("excludeTrip").toString();
  159 + String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00";
  160 + String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59";
  161 + int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString());
  162 + int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString());
  163 +
  164 + conf.setEnableYjtk(true);
  165 + conf.setExcludeTrip(excludeTrip);
  166 + conf.setYjtkStart(yjtkStart);
  167 + conf.setYjtkEnd(yjtkEnd);
  168 + conf.setUpStopMinute(upStopMinute);
  169 + conf.setDownStopMinute(downStopMinute);
  170 + }
  171 + else
  172 + conf.setEnableYjtk(false);
  173 +
  174 + lineConfigData.set(conf);
  175 +
  176 + rs.put("status", ResponseCode.SUCCESS);
  177 + rs.put("conf", conf);
  178 + } catch (Exception e) {
  179 + rs.put("status", ResponseCode.ERROR);
  180 + rs.put("msg", e.getMessage());
  181 + logger.error("", e);
  182 + }
  183 + return rs;
  184 + }
  185 +
  186 + @Override
  187 + public Map<String, Object> parkAndStationSet(Map<String, String> map) {
  188 + String lineCode = map.get("lineCode").toString();
  189 + String twinsPark = map.get("twinsPark").toString();
  190 + String twinsStation = map.get("twinsStation").toString();
  191 +
  192 + Map<String, Object> rs = new HashMap<>();
  193 + try {
  194 + LineConfig conf = lineConfigData.get(lineCode);
  195 + conf.setTwinsParks(twinsPark);
  196 + conf.setTwinsStations(twinsStation);
  197 +
  198 + lineConfigData.set(conf);
  199 +
  200 + rs.put("status", ResponseCode.SUCCESS);
  201 + rs.put("conf", conf);
  202 + } catch (Exception e) {
  203 + rs.put("status", ResponseCode.ERROR);
  204 + rs.put("msg", e.getMessage());
  205 + logger.error("", e);
  206 + }
  207 + return rs;
  208 + }
  209 +
  210 + @Override
  211 + public Map<String, Object> findByIdx(String idx) {
  212 + Map<String, Object> rs = new HashMap();
  213 + try{
  214 + List<LineConfig> list = new ArrayList<>();
  215 + List<String> ids = Splitter.on(",").splitToList(idx);
  216 +
  217 + for(String id : ids){
  218 + list.add(lineConfigData.get(id));
  219 + }
  220 +
  221 + rs.put("status", ResponseCode.SUCCESS);
  222 + rs.put("list", list);
  223 + }catch (Exception e){
  224 + rs.put("status", ResponseCode.ERROR);
  225 + logger.error("", e);
  226 + }
  227 + return rs;
  228 + }
  229 +
  230 + @Override
  231 + public Map<String, Object> setAutoExec(Map<String, String> map) {
  232 + String lineCode = map.get("lineCode").toString();
  233 + boolean autoExec = Boolean.parseBoolean(map.get("autoExec").toString());
  234 +
  235 + Map<String, Object> rs = new HashMap<>();
  236 + try {
  237 + LineConfig conf = lineConfigData.get(lineCode);
  238 + conf.setAutoExec(autoExec);
  239 +
  240 + lineConfigData.set(conf);
  241 + rs.put("status", ResponseCode.SUCCESS);
  242 + rs.put("conf", conf);
  243 + } catch (Exception e) {
  244 + rs.put("status", ResponseCode.ERROR);
  245 + rs.put("msg", e.getMessage());
  246 + logger.error("", e);
  247 + }
  248 + return rs;
  249 + }
  250 +
  251 + @Override
  252 + public Map<String, Object> setReadReverse(int status, String lineCode) {
  253 + Map<String, Object> rs = new HashMap<>();
  254 + try {
  255 + LineConfig conf = lineConfigData.get(lineCode);
  256 + conf.setReadReverse(status==1?true:false);
  257 +
  258 + lineConfigData.set(conf);
  259 + rs.put("status", ResponseCode.SUCCESS);
  260 + rs.put("conf", conf);
  261 + } catch (Exception e) {
  262 + rs.put("status", ResponseCode.ERROR);
  263 + rs.put("msg", e.getMessage());
  264 + logger.error("", e);
  265 + }
  266 + return rs;
  267 + }
  268 +}
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/buffer_config.html
1 -<!-- 缓冲区设置 和 应急停靠 -->  
2 -<div id="buffer_config_wrap">  
3 -  
4 - <script id="buffer_config_form-temp" type="text/html">  
5 -  
6 - <div id="buffer_inOut_diff_panel">  
7 - <h2 class="btn_title_line">  
8 - <a class="uk-link-reset">到站缓冲区设置</a>  
9 - </h2>  
10 - <div>  
11 - <form class="uk-form">  
12 - <div class="uk-form-row">  
13 - 到达上行加  
14 - <input name="upInDiff" type="number" class="z-depth-input" value="{{upInDiff}}">  
15 - 秒  
16 - <i class="uk-icon-pencil edit-icon"></i>  
17 - </div>  
18 - <div class="uk-form-row">  
19 - 上行发出减  
20 - <input name="upOutDiff" type="number" class="z-depth-input" value="{{upOutDiff}}">  
21 - 秒  
22 - <i class="uk-icon-pencil edit-icon"></i>  
23 - </div>  
24 - <div class="uk-form-row">  
25 - 到达下行加  
26 - <input name="downInDiff" type="number" class="z-depth-input" value="{{downInDiff}}">  
27 - 秒  
28 - <i class="uk-icon-pencil edit-icon"></i>  
29 - </div>  
30 - <div class="uk-form-row">  
31 - 下行发出减  
32 - <input name="downOutDiff" type="number" class="z-depth-input" value="{{downOutDiff}}">  
33 - 秒  
34 - <i class="uk-icon-pencil edit-icon"></i>  
35 - </div>  
36 - </form>  
37 - <!--<a style="font-size: 80%;">编辑电子围栏</a>-->  
38 - </div>  
39 - </div>  
40 -  
41 - <div id="emergency_stop_panel">  
42 - <h2 class="btn_title_line">  
43 - <a class="uk-link-reset">应急停靠</a>  
44 - </h2>  
45 - <div>  
46 - <form class="uk-form" name="yjtkForm">  
47 - <table>  
48 - <tr>  
49 - <td colspan="2" style="padding-left: 30px;">  
50 - 是否启用  
51 - <select class="z-depth-input" name="enableYjtk">  
52 - <option value="0" >禁用</option>  
53 - <option value="1" {{if enableYjtk}}selected{{/if}}>启用</option>  
54 - </select>  
55 - </td>  
56 - </tr>  
57 - <tr>  
58 - <td colspan="2" style="padding-left: 58px;">  
59 - 时间  
60 - <input type="time" value="{{yjtkStart}}" name="yjtkStart" {{if !enableYjtk}}disabled{{/if}}>至  
61 - <input type="time" value="{{yjtkEnd}}" name="yjtkEnd" {{if !enableYjtk}}disabled{{/if}}>  
62 - </td>  
63 - </tr>  
64 - <tr>  
65 - <td>  
66 - 上行停靠时间  
67 - <input type="number" value="{{upStopMinute}}" name="upStopMinute" {{if !enableYjtk}}disabled{{/if}}>分钟  
68 - </td>  
69 - </tr>  
70 - <tr>  
71 - <td>  
72 - 下行停靠时间  
73 - <input type="number" value="{{downStopMinute}}" name="downStopMinute" {{if !enableYjtk}}disabled{{/if}}>分钟  
74 - </td>  
75 - </tr>  
76 - </table>  
77 - </form>  
78 - </div>  
79 - </div>  
80 - </script>  
81 -  
82 - <script>  
83 - (function () {  
84 - var wrap = '#buffer_config_wrap',  
85 - conf;  
86 -  
87 - var textMap = {upInDiff: '到达上行加', upOutDiff: '上行发出减', downInDiff: '到达下行加', downOutDiff: '下行发出减'};  
88 - $(wrap).on('init', function (e, data) {  
89 - e.stopPropagation();  
90 - conf = data.lineConfig;  
91 -  
92 - var htmlStr = template('buffer_config_form-temp', conf);  
93 - $(wrap).html(htmlStr);  
94 -  
95 - //到站缓冲区设置  
96 - $('#buffer_inOut_diff_panel input', wrap).on('focus', function () {  
97 - $(this).next('.edit-icon').show();  
98 - });  
99 - $('#buffer_inOut_diff_panel input', wrap).on('blur', function () {  
100 - $(this).next('.edit-icon').hide();  
101 -  
102 - var field = $(this).attr('name');  
103 - var val = $(this).val();  
104 - if (conf[field] != val) {  
105 - gb_common.$post('/lineConfig/bufferTimeDiff', {  
106 - lineCode: conf.line.lineCode,  
107 - field: field,  
108 - value: val  
109 - }, function (rs) {  
110 - conf[rs.field] = rs.value;  
111 - notify_succ(textMap[field] + val + '秒');  
112 - });  
113 - }  
114 - });  
115 -  
116 - //启禁用应急停靠  
117 - $('[name=enableYjtk]', wrap).on('change', function () {  
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 - // 0禁用 1启用 2修改参数  
132 - data.operCode = 2;  
133 - gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {  
134 - conf = rs.conf;  
135 - notify_succ('调整应急停靠参数');  
136 - });  
137 - }  
138 - });  
139 - });  
140 -  
141 - function enableYjtkForm() {  
142 - var f = $('form[name=yjtkForm]', wrap);  
143 - $('input', f).removeAttr('disabled');  
144 - //开始时间  
145 - if($('[name=yjtkStart]',f).val() == '')  
146 - $('[name=yjtkStart]',f).val('00:00');  
147 - if($('[name=yjtkEnd]',f).val() == '')  
148 - $('[name=yjtkEnd]',f).val('23:59');  
149 -  
150 - var data = f.serializeJSON();  
151 - data.lineCode = conf.line.lineCode;  
152 - data.operCode = 1;  
153 - gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {  
154 - conf = rs.conf;  
155 - notify_succ('启用应急停靠');  
156 - });  
157 - }  
158 -  
159 - function disabledYjtkForm() {  
160 - var f = $('form[name=yjtkForm]', wrap);  
161 - $('input', f).attr('disabled', 'disabled');  
162 - //恢复val  
163 - $('[name=yjtkStart]',f).val(conf.yjtkStart);  
164 - $('[name=yjtkEnd]',f).val(conf.yjtkEnd);  
165 - $('[name=upStopMinute]',f).val(conf.upStopMinute);  
166 - $('[name=downStopMinute]',f).val(conf.downStopMinute);  
167 -  
168 - var data = {enableYjtk: 0, lineCode: conf.line.lineCode, operCode: 0};  
169 - gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {  
170 - conf = rs.conf;  
171 - notify_succ('禁用应急停靠');  
172 - });  
173 - }  
174 - })();  
175 - </script> 1 +<!-- 缓冲区设置 和 应急停靠 -->
  2 +<div id="buffer_config_wrap">
  3 +
  4 + <script id="buffer_config_form-temp" type="text/html">
  5 +
  6 + <div id="buffer_inOut_diff_panel">
  7 + <h2 class="btn_title_line">
  8 + <a class="uk-link-reset">到站缓冲区设置</a>
  9 + </h2>
  10 + <div>
  11 + <form class="uk-form">
  12 + <div class="uk-form-row">
  13 + 到达上行加
  14 + <input name="upInDiff" type="number" class="z-depth-input" value="{{upInDiff}}">
  15 + 秒
  16 + <i class="uk-icon-pencil edit-icon"></i>
  17 + </div>
  18 + <div class="uk-form-row">
  19 + 上行发出减
  20 + <input name="upOutDiff" type="number" class="z-depth-input" value="{{upOutDiff}}">
  21 + 秒
  22 + <i class="uk-icon-pencil edit-icon"></i>
  23 + </div>
  24 + <div class="uk-form-row">
  25 + 到达下行加
  26 + <input name="downInDiff" type="number" class="z-depth-input" value="{{downInDiff}}">
  27 + 秒
  28 + <i class="uk-icon-pencil edit-icon"></i>
  29 + </div>
  30 + <div class="uk-form-row">
  31 + 下行发出减
  32 + <input name="downOutDiff" type="number" class="z-depth-input" value="{{downOutDiff}}">
  33 + 秒
  34 + <i class="uk-icon-pencil edit-icon"></i>
  35 + </div>
  36 + </form>
  37 + <!--<a style="font-size: 80%;">编辑电子围栏</a>-->
  38 + </div>
  39 + </div>
  40 +
  41 + <div id="emergency_stop_panel">
  42 + <h2 class="btn_title_line">
  43 + <a class="uk-link-reset">应急停靠</a>
  44 + </h2>
  45 + <div>
  46 + <form class="uk-form" name="yjtkForm">
  47 + <table>
  48 + <tr>
  49 + <td colspan="2" style="padding-left: 30px;">
  50 + 是否启用
  51 + <select class="z-depth-input" name="enableYjtk">
  52 + <option value="0" >禁用</option>
  53 + <option value="1" {{if enableYjtk}}selected{{/if}}>启用</option>
  54 + </select>
  55 + </td>
  56 + </tr>
  57 + <tr>
  58 + <td colspan="2" style="padding-left: 30px;">
  59 + 排除班次
  60 + <div style="display: inline-block;vertical-align: center;">
  61 + <label style="margin-right: 15px;">
  62 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="normal" {{if excludeTrip && excludeTrip.indexOf('normal') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  63 + 正常班次
  64 + </label>
  65 + <label style="margin-right: 15px;">
  66 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="out" {{if excludeTrip && excludeTrip.indexOf('out') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  67 + 出场
  68 + </label>
  69 + <label style="margin-right: 15px;">
  70 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="in" {{if excludeTrip && excludeTrip.indexOf('in') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  71 + 进场
  72 + </label>
  73 + <label style="margin-right: 15px;">
  74 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="region" {{if excludeTrip && excludeTrip.indexOf('region') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  75 + 区间
  76 + </label>
  77 + <label style="margin-right: 15px;">
  78 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="venting" {{if excludeTrip && excludeTrip.indexOf('venting') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  79 + 直放
  80 + </label>
  81 + <label style="margin-right: 15px;">
  82 + <input type="checkbox" style="width: 14px;" name="excludeTrip" value="major" {{if excludeTrip && excludeTrip.indexOf('major') > -1}}checked{{/if}} {{if !enableYjtk}}disabled{{/if}}>
  83 + 放站
  84 + </label>
  85 + </div>
  86 + </td>
  87 + </tr>
  88 + <tr>
  89 + <td colspan="2" style="padding-left: 58px;">
  90 + 时间
  91 + <input type="time" value="{{yjtkStart}}" name="yjtkStart" {{if !enableYjtk}}disabled{{/if}}>至
  92 + <input type="time" value="{{yjtkEnd}}" name="yjtkEnd" {{if !enableYjtk}}disabled{{/if}}>
  93 + </td>
  94 + </tr>
  95 + <tr>
  96 + <td>
  97 + 上行停靠时间
  98 + <input type="number" value="{{upStopMinute}}" name="upStopMinute" {{if !enableYjtk}}disabled{{/if}}>分钟
  99 + </td>
  100 + </tr>
  101 + <tr>
  102 + <td>
  103 + 下行停靠时间
  104 + <input type="number" value="{{downStopMinute}}" name="downStopMinute" {{if !enableYjtk}}disabled{{/if}}>分钟
  105 + </td>
  106 + </tr>
  107 + </table>
  108 + </form>
  109 + </div>
  110 + </div>
  111 + </script>
  112 +
  113 + <script>
  114 + (function () {
  115 + var wrap = '#buffer_config_wrap',
  116 + conf;
  117 +
  118 + var textMap = {upInDiff: '到达上行加', upOutDiff: '上行发出减', downInDiff: '到达下行加', downOutDiff: '下行发出减'};
  119 + $(wrap).on('init', function (e, data) {
  120 + e.stopPropagation();
  121 + conf = data.lineConfig;
  122 +
  123 + var htmlStr = template('buffer_config_form-temp', conf);
  124 + $(wrap).html(htmlStr);
  125 +
  126 + //到站缓冲区设置
  127 + $('#buffer_inOut_diff_panel input', wrap).on('focus', function () {
  128 + $(this).next('.edit-icon').show();
  129 + });
  130 + $('#buffer_inOut_diff_panel input', wrap).on('blur', function () {
  131 + $(this).next('.edit-icon').hide();
  132 +
  133 + var field = $(this).attr('name');
  134 + var val = $(this).val();
  135 + if (conf[field] != val) {
  136 + gb_common.$post('/lineConfig/bufferTimeDiff', {
  137 + lineCode: conf.line.lineCode,
  138 + field: field,
  139 + value: val
  140 + }, function (rs) {
  141 + conf[rs.field] = rs.value;
  142 + notify_succ(textMap[field] + val + '秒');
  143 + });
  144 + }
  145 + });
  146 +
  147 + //启禁用应急停靠
  148 + $('[name=enableYjtk]', wrap).on('change', function () {
  149 + if($(this).val() == '1'){
  150 + enableYjtkForm();
  151 + }
  152 + else
  153 + disabledYjtkForm();
  154 + });
  155 + //参数改变
  156 + $('form[name=yjtkForm] input', wrap).on('blur', function () {
  157 + var field = $(this).attr('name');
  158 + var val = $(this).val();
  159 + if (conf[field] != val) {
  160 + var data = $('form[name=yjtkForm]', wrap).serializeJSON();
  161 + data.lineCode = conf.line.lineCode;
  162 + // 0禁用 1启用 2修改参数
  163 + data.operCode = 2;
  164 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  165 + conf = rs.conf;
  166 + notify_succ('调整应急停靠参数');
  167 + });
  168 + }
  169 + });
  170 +
  171 + //处理排除班次复选框组的变化
  172 + $('form[name=yjtkForm] input[name=excludeTrip]', wrap).on('change', function () {
  173 + var selectedValues = $('form[name=yjtkForm] input[name=excludeTrip]:checked', wrap).map(function() {
  174 + return this.value;
  175 + }).get();
  176 + if (JSON.stringify(conf.excludeTrip) !== JSON.stringify(selectedValues)) {
  177 + var data = $('form[name=yjtkForm]', wrap).serializeJSON();
  178 + // 手动设置excludeTrip的值
  179 + data.excludeTrip = selectedValues.join(',');
  180 + data.lineCode = conf.line.lineCode;
  181 + // 0禁用 1启用 2修改参数
  182 + data.operCode = 2;
  183 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  184 + conf = rs.conf;
  185 + notify_succ('调整应急停靠参数');
  186 + });
  187 + }
  188 + });
  189 + });
  190 +
  191 + function enableYjtkForm() {
  192 + var f = $('form[name=yjtkForm]', wrap);
  193 + $('input', f).removeAttr('disabled');
  194 + //开始时间
  195 + if($('[name=yjtkStart]',f).val() == '')
  196 + $('[name=yjtkStart]',f).val('00:00');
  197 + if($('[name=yjtkEnd]',f).val() == '')
  198 + $('[name=yjtkEnd]',f).val('23:59');
  199 +
  200 + var data = f.serializeJSON();
  201 + data.lineCode = conf.line.lineCode;
  202 + data.operCode = 1;
  203 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  204 + conf = rs.conf;
  205 + notify_succ('启用应急停靠');
  206 + });
  207 + }
  208 +
  209 + function disabledYjtkForm() {
  210 + var f = $('form[name=yjtkForm]', wrap);
  211 + $('input', f).attr('disabled', 'disabled');
  212 + //恢复val
  213 + $('[name=yjtkStart]',f).val(conf.yjtkStart);
  214 + $('[name=yjtkEnd]',f).val(conf.yjtkEnd);
  215 + $('[name=upStopMinute]',f).val(conf.upStopMinute);
  216 + $('[name=downStopMinute]',f).val(conf.downStopMinute);
  217 + // 恢复excludeTrip复选框组的值
  218 + if (conf.excludeTrip) {
  219 + $('form[name=yjtkForm] input[name=excludeTrip]', f).each(function() {
  220 + $(this).prop('checked', conf.excludeTrip.indexOf(this.value) > -1);
  221 + });
  222 + } else {
  223 + $('form[name=yjtkForm] input[name=excludeTrip]', f).prop('checked', false);
  224 + }
  225 +
  226 + var data = {enableYjtk: 0, lineCode: conf.line.lineCode, operCode: 0};
  227 + gb_common.$post('/lineConfig/yjtkSet', data, function (rs) {
  228 + conf = rs.conf;
  229 + notify_succ('禁用应急停靠');
  230 + });
  231 + }
  232 + })();
  233 + </script>
176 </div> 234 </div>
177 \ No newline at end of file 235 \ No newline at end of file