Commit c35216343667ffd94cb8ae1860e32a5ac910a8b1

Authored by 廖磊
2 parents 60f88df4 35f5420e

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
Showing 34 changed files with 2674 additions and 463 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -30,7 +30,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, @@ -30,7 +30,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
30 DayOfSchedule dayOfSchedule; 30 DayOfSchedule dayOfSchedule;
31 31
32 @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST) 32 @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
33 - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId,@RequestParam String jGh, String sGh,@RequestParam String nbbm){ 33 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
34 return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm); 34 return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
35 } 35 }
36 36
src/main/java/com/bsth/data/Station2ParkBuffer.java
@@ -50,6 +50,8 @@ public class Station2ParkBuffer implements CommandLineRunner { @@ -50,6 +50,8 @@ public class Station2ParkBuffer implements CommandLineRunner {
50 50
51 public static StationToPark get(String lineCode, String sName, String eName) { 51 public static StationToPark get(String lineCode, String sName, String eName) {
52 List<StationToPark> list = get(lineCode); 52 List<StationToPark> list = get(lineCode);
  53 + if(null == list)
  54 + return null;
53 StationToPark stp = null; 55 StationToPark stp = null;
54 for (StationToPark s : list) { 56 for (StationToPark s : list) {
55 if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { 57 if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) {
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
@@ -74,7 +74,6 @@ public class CarOutInfoHandler { @@ -74,7 +74,6 @@ public class CarOutInfoHandler {
74 save(pstList); 74 save(pstList);
75 pstList.clear(); 75 pstList.clear();
76 xlMaps.clear(); 76 xlMaps.clear();
77 - //logger.info("更新发车信息表!!");  
78 }catch (Exception e){ 77 }catch (Exception e){
79 logger.error("", e); 78 logger.error("", e);
80 } 79 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -158,7 +158,7 @@ public class InStationProcess { @@ -158,7 +158,7 @@ public class InStationProcess {
158 //webSocket 158 //webSocket
159 sendUtils.sendZdsj(sch, lpNext, doneSum); 159 sendUtils.sendZdsj(sch, lpNext, doneSum);
160 160
161 - logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual()); 161 + logger.info("车辆:" + nbbm + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual() + " -stopNo: " + gps.getStopNo());
162 162
163 //清除车辆误点调整监听 163 //清除车辆误点调整监听
164 LateAdjustHandle.remove(sch); 164 LateAdjustHandle.remove(sch);
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -16,6 +16,8 @@ import com.bsth.service.schedule.SchedulePlanInfoService; @@ -16,6 +16,8 @@ import com.bsth.service.schedule.SchedulePlanInfoService;
16 import com.bsth.websocket.handler.SendUtils; 16 import com.bsth.websocket.handler.SendUtils;
17 import com.google.common.collect.ArrayListMultimap; 17 import com.google.common.collect.ArrayListMultimap;
18 import com.google.common.collect.HashMultimap; 18 import com.google.common.collect.HashMultimap;
  19 +import com.google.common.collect.ListMultimap;
  20 +import com.google.common.collect.Multimaps;
19 import org.apache.commons.lang3.StringUtils; 21 import org.apache.commons.lang3.StringUtils;
20 import org.joda.time.format.DateTimeFormat; 22 import org.joda.time.format.DateTimeFormat;
21 import org.joda.time.format.DateTimeFormatter; 23 import org.joda.time.format.DateTimeFormatter;
@@ -55,7 +57,7 @@ public class DayOfSchedule { @@ -55,7 +57,7 @@ public class DayOfSchedule {
55 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; 57 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap;
56 58
57 // 按车辆分组的班次数据 59 // 按车辆分组的班次数据
58 - private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; 60 + private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap;
59 61
60 //按线路分组计划用车 62 //按线路分组计划用车
61 private static HashMultimap<String, String> lineNbbmsMap; 63 private static HashMultimap<String, String> lineNbbmsMap;
@@ -104,6 +106,8 @@ public class DayOfSchedule { @@ -104,6 +106,8 @@ public class DayOfSchedule {
104 106
105 static { 107 static {
106 nbbmScheduleMap = ArrayListMultimap.create(); 108 nbbmScheduleMap = ArrayListMultimap.create();
  109 + nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap);
  110 +
107 lpScheduleMap = ArrayListMultimap.create(); 111 lpScheduleMap = ArrayListMultimap.create();
108 lineNbbmsMap = HashMultimap.create(); 112 lineNbbmsMap = HashMultimap.create();
109 113
src/main/java/com/bsth/data/schedule/e_state_check/ScheduleStationCodeChecker.java
@@ -103,7 +103,7 @@ public class ScheduleStationCodeChecker { @@ -103,7 +103,7 @@ public class ScheduleStationCodeChecker {
103 rs.add(sci); 103 rs.add(sci);
104 continue; 104 continue;
105 } 105 }
106 - else if(null != sci && !sci.getRealStationCode().equals(getCode(sch, qdOrZd))){//名称一致的站点,编码不一致 106 + else if(null != sci && !codeEq(sci, getCode(sch, qdOrZd))){//名称一致的站点,编码不一致
107 sci.setStationCode(getCode(sch, qdOrZd)); 107 sci.setStationCode(getCode(sch, qdOrZd));
108 rs.add(sci); 108 rs.add(sci);
109 continue; 109 continue;
@@ -112,6 +112,10 @@ public class ScheduleStationCodeChecker { @@ -112,6 +112,10 @@ public class ScheduleStationCodeChecker {
112 return rs; 112 return rs;
113 } 113 }
114 114
  115 + private boolean codeEq(SCodeInfo sci, String code){
  116 + return sci.getRealStationCode().equals(code) || sci.getRealStationCode().indexOf(code + "^") != -1;
  117 + }
  118 +
115 private String getName(ScheduleRealInfo sch, String qdOrZd) { 119 private String getName(ScheduleRealInfo sch, String qdOrZd) {
116 return qdOrZd.equals("qd")?sch.getQdzName():sch.getZdzName(); 120 return qdOrZd.equals("qd")?sch.getQdzName():sch.getZdzName();
117 } 121 }
@@ -126,11 +130,22 @@ public class ScheduleStationCodeChecker { @@ -126,11 +130,22 @@ public class ScheduleStationCodeChecker {
126 List<SCodeInfo> realList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SCodeInfo.class)); 130 List<SCodeInfo> realList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SCodeInfo.class));
127 Map<String, SCodeInfo> realMap = new HashMap<>(); 131 Map<String, SCodeInfo> realMap = new HashMap<>();
128 132
  133 + String kName;
  134 + SCodeInfo old;
129 for (SCodeInfo sci : realList) { 135 for (SCodeInfo sci : realList) {
130 - realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationName(), sci); 136 + kName = sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationName();
  137 +
  138 + if(realMap.containsKey(kName)){
  139 + //环线可能存在同名的站点
  140 + old = realMap.get(kName);
  141 + old.setRealStationCode(old.getRealStationCode() + "^" + sci.getRealStationCode() + "^");
  142 + continue;
  143 + }
  144 +
  145 + realMap.put(kName, sci);
131 realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getRealStationCode(), sci); 146 realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getRealStationCode(), sci);
132 } 147 }
133 148
134 return realMap; 149 return realMap;
135 } 150 }
136 -} 151 +}
137 \ No newline at end of file 152 \ No newline at end of file
src/main/java/com/bsth/data/schedule/edit_logs/entity/SchEditInfo.java
@@ -165,7 +165,13 @@ public class SchEditInfo { @@ -165,7 +165,13 @@ public class SchEditInfo {
165 long t = System.currentTimeMillis(); 165 long t = System.currentTimeMillis();
166 sei.setTs(t); 166 sei.setTs(t);
167 sei.setTimeStr(fmtHHmm.print(t)); 167 sei.setTimeStr(fmtHHmm.print(t));
168 - sei.setUser(userId); 168 + if(null != userId)
  169 + sei.setUser(userId);
  170 + else{
  171 + SysUser user = SecurityUtils.getCurrentUser();
  172 + if(user != null)
  173 + sei.setUser(user.getUserName());
  174 + }
169 sei.setRq(sch.getScheduleDateStr()); 175 sei.setRq(sch.getScheduleDateStr());
170 sei.setSchId(sch.getId()); 176 sei.setSchId(sch.getId());
171 sei.setLineCode(sch.getXlBm()); 177 sei.setLineCode(sch.getXlBm());
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -22,12 +22,12 @@ import java.util.List; @@ -22,12 +22,12 @@ import java.util.List;
22 22
23 /** 23 /**
24 * 误点自动调整待发 处理程序 24 * 误点自动调整待发 处理程序
25 - * 25 + * <p>
26 * 注意 :这里的误点是指应发未到 26 * 注意 :这里的误点是指应发未到
27 * Created by panzhao on 2017/4/16. 27 * Created by panzhao on 2017/4/16.
28 */ 28 */
29 @Component 29 @Component
30 -public class LateAdjustHandle implements ApplicationContextAware{ 30 +public class LateAdjustHandle implements ApplicationContextAware {
31 31
32 static LineConfigData lineConfigData; 32 static LineConfigData lineConfigData;
33 static SendUtils sendUtils; 33 static SendUtils sendUtils;
@@ -36,7 +36,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -36,7 +36,7 @@ public class LateAdjustHandle implements ApplicationContextAware{
36 36
37 /** 37 /**
38 * 应发未到车辆 和 班次 38 * 应发未到车辆 和 班次
39 - * 39 + * <p>
40 * 起点相同的,保留最后一个班次 40 * 起点相同的,保留最后一个班次
41 */ 41 */
42 private static ArrayListMultimap lateSchMaps; 42 private static ArrayListMultimap lateSchMaps;
@@ -48,55 +48,57 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -48,55 +48,57 @@ public class LateAdjustHandle implements ApplicationContextAware{
48 48
49 /** 49 /**
50 * 新增一个误点班次 50 * 新增一个误点班次
  51 + *
51 * @param sch 52 * @param sch
52 */ 53 */
53 - public static void putLate(ScheduleRealInfo sch){  
54 - try{ 54 + public static void putLate(ScheduleRealInfo sch) {
  55 + try {
55 //线路配置 56 //线路配置
56 LineConfig config = lineConfigData.get(sch.getXlBm()); 57 LineConfig config = lineConfigData.get(sch.getXlBm());
57 - if(sch.getLateMinute() == 0){  
58 - if(!config.isEnableYjtk()) 58 + if (sch.getLateMinute() == 0) {
  59 + if (!config.isEnableYjtk())
59 return; 60 return;
60 61
61 - sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute()); 62 + sch.setLateMinute(sch.getXlDir().equals("0") ? config.getUpStopMinute() : config.getDownStopMinute());
62 } 63 }
63 64
64 - if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0  
65 - && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ 65 + if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0
  66 + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) {
66 67
67 ScheduleRealInfo old = popLateSch(sch); 68 ScheduleRealInfo old = popLateSch(sch);
68 69
69 //班次被压入 70 //班次被压入
70 - if(lateSchMaps.containsEntry(sch.getClZbh(), sch)){ 71 + if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) {
71 72
72 - logger.info("【应发未到 -多个("+lateSchMaps.get(sch.getClZbh()).size()+")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); 73 + logger.info("【应发未到 -多个(" + lateSchMaps.get(sch.getClZbh()).size() + ")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
73 //通知客户端 74 //通知客户端
74 sch.setLate2(true); 75 sch.setLate2(true);
75 sendUtils.sendAutoWdtz(sch, old); 76 sendUtils.sendAutoWdtz(sch, old);
76 } 77 }
77 } 78 }
78 79
79 - }catch (Exception e){ 80 + } catch (Exception e) {
80 logger.error("", e); 81 logger.error("", e);
81 } 82 }
82 } 83 }
83 84
84 /** 85 /**
85 * 压入新的误点班次 86 * 压入新的误点班次
  87 + *
86 * @param sch 88 * @param sch
87 * @return 返回被移除的误点班次 89 * @return 返回被移除的误点班次
88 */ 90 */
89 private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) { 91 private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) {
90 List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh()); 92 List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh());
91 93
92 - if(null == list || list.size() == 0) 94 + if (null == list || list.size() == 0)
93 lateSchMaps.put(sch.getClZbh(), sch); 95 lateSchMaps.put(sch.getClZbh(), sch);
94 else { 96 else {
95 - ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName()); 97 + ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName(), "");
96 98
97 - if(null == old) 99 + if (null == old)
98 lateSchMaps.put(sch.getClZbh(), sch); 100 lateSchMaps.put(sch.getClZbh(), sch);
99 - else if(old.getDfsjT() < sch.getDfsjT()){ 101 + else if (old.getDfsjT() < sch.getDfsjT()) {
100 //同一个起点,保留时间最大的班次 102 //同一个起点,保留时间最大的班次
101 lateSchMaps.remove(old.getClZbh(), old); 103 lateSchMaps.remove(old.getClZbh(), old);
102 lateSchMaps.put(sch.getClZbh(), sch); 104 lateSchMaps.put(sch.getClZbh(), sch);
@@ -111,13 +113,15 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -111,13 +113,15 @@ public class LateAdjustHandle implements ApplicationContextAware{
111 113
112 /** 114 /**
113 * 搜索同样起点的班次 115 * 搜索同样起点的班次
  116 + *
114 * @param list 117 * @param list
115 * @return 118 * @return
116 */ 119 */
117 - private static ScheduleRealInfo findExistQdz(List<ScheduleRealInfo> list, String qdzCode, String qdzName) {  
118 - for(ScheduleRealInfo item : list){  
119 - if(item.getQdzCode().equals(qdzCode)  
120 - || item.getQdzName().equals(qdzName)) 120 + private static ScheduleRealInfo findExistQdz(List<ScheduleRealInfo> list, String qdzCode, String nam1, String name2) {
  121 + for (ScheduleRealInfo item : list) {
  122 + if (item.getQdzCode().equals(qdzCode)
  123 + || item.getQdzName().equals(nam1)
  124 + || item.getQdzName().equals(name2))
121 return item; 125 return item;
122 } 126 }
123 return null; 127 return null;
@@ -126,15 +130,16 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -126,15 +130,16 @@ public class LateAdjustHandle implements ApplicationContextAware{
126 130
127 /** 131 /**
128 * 获取所有应发未到的班次 132 * 获取所有应发未到的班次
  133 + *
129 * @return 134 * @return
130 */ 135 */
131 - public static Collection<ScheduleRealInfo> allLateSch(){ 136 + public static Collection<ScheduleRealInfo> allLateSch() {
132 return lateSchMaps.values(); 137 return lateSchMaps.values();
133 } 138 }
134 139
135 - public static void remove(ScheduleRealInfo sch){ 140 + public static void remove(ScheduleRealInfo sch) {
136 try { 141 try {
137 - if(lateSchMaps.containsEntry(sch.getClZbh(), sch)){ 142 + if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) {
138 lateSchMaps.remove(sch.getClZbh(), sch); 143 lateSchMaps.remove(sch.getClZbh(), sch);
139 144
140 sch.setLate2(false); 145 sch.setLate2(false);
@@ -143,46 +148,55 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -143,46 +148,55 @@ public class LateAdjustHandle implements ApplicationContextAware{
143 148
144 logger.info("移除误点调整 -" + sch.getClZbh() + " -time: " + sch.getDfsj() + " -id: " + sch.getId()); 149 logger.info("移除误点调整 -" + sch.getClZbh() + " -time: " + sch.getDfsj() + " -id: " + sch.getId());
145 } 150 }
146 - }catch (Exception e){ 151 + } catch (Exception e) {
147 logger.error("", e); 152 logger.error("", e);
148 } 153 }
149 } 154 }
150 155
151 /** 156 /**
152 * 车辆到站 157 * 车辆到站
  158 + *
153 * @param gps 159 * @param gps
154 */ 160 */
155 - public static void carArrive(GpsEntity gps){  
156 - try{ 161 + public static void carArrive(GpsEntity gps) {
  162 + try {
  163 + if (gps.getInstation() <= 0) {
  164 + return;
  165 + }
  166 +
157 List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm()); 167 List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm());
158 168
159 - if(null == list || list.size() == 0) 169 + if (null == list || list.size() == 0)
160 return; 170 return;
161 171
162 - String key = gps.getStopNo();  
163 - if(gps.getInstation()==1){  
164 - if(StringUtils.isNotEmpty(gps.getCarparkNo()))  
165 - key = gps.getCarparkNo();//停车场名称  
166 - else  
167 - key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo();//站点名称 172 +
  173 + String key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()
  174 + , name1 = BasicData.stationCode2NameMap.get(key)//站点名称
  175 + , name2 = null;
  176 + if (StringUtils.isNotEmpty(gps.getCarparkNo())) {
  177 + name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo());
  178 + }
  179 +
  180 + if (gps.getInstation() == 2) {
  181 + name1 = name2;//进场,没有站
168 } 182 }
169 183
170 - gps.setStationName(BasicData.stationCode2NameMap.get(key)); 184 + gps.setStationName(name1);
171 //根据起点站获取误点班次 185 //根据起点站获取误点班次
172 - ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), gps.getStationName()); 186 + ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), name1, name2);
173 187
174 - if(null == sch) 188 + if (null == sch)
175 return; 189 return;
176 190
177 //可能是延迟信号,gps时间没有误点 191 //可能是延迟信号,gps时间没有误点
178 - if(gps.getTimestamp() <= sch.getDfsjT()){ 192 + if (gps.getTimestamp() <= sch.getDfsjT()) {
179 sch.setLate2(false); 193 sch.setLate2(false);
180 lateSchMaps.remove(sch.getClZbh(), sch); 194 lateSchMaps.remove(sch.getClZbh(), sch);
181 return; 195 return;
182 } 196 }
183 197
184 - if(gps.getStationName().equals(sch.getQdzName())  
185 - || gps.getStopNo().equals(sch.getQdzCode())){ 198 + if (gps.getStationName().equals(sch.getQdzName())
  199 + || gps.getStopNo().equals(sch.getQdzCode())) {
186 200
187 //自动调整待发 到达时间 + 停靠时间 201 //自动调整待发 到达时间 + 停靠时间
188 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); 202 long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
@@ -195,7 +209,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -195,7 +209,7 @@ public class LateAdjustHandle implements ApplicationContextAware{
195 lateSchMaps.remove(sch.getClZbh(), sch); 209 lateSchMaps.remove(sch.getClZbh(), sch);
196 logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); 210 logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
197 } 211 }
198 - }catch (Exception e){ 212 + } catch (Exception e) {
199 e.printStackTrace(); 213 e.printStackTrace();
200 logger.error("late2 car arrive", e); 214 logger.error("late2 car arrive", e);
201 } 215 }
src/main/java/com/bsth/data/schedule/taopao/TaoPaoDataBuffer.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.data.schedule.taopao.entity.CLTaoPaoInfo;
  5 +import com.google.common.collect.ArrayListMultimap;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 实际班次套跑信息
  11 + */
  12 +@Component
  13 +public class TaoPaoDataBuffer {
  14 +
  15 + /**
  16 + * 线路编码 ——> 套跑信息
  17 + */
  18 + private static ArrayListMultimap<String, CLTaoPaoInfo> multimap;
  19 +
  20 + static {
  21 + multimap = ArrayListMultimap.create();
  22 + }
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +}
src/main/java/com/bsth/data/schedule/taopao/entity/CLTaoPaoInfo.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao.entity;
  2 +
  3 +/**
  4 + * 车辆套跑 信息
  5 + */
  6 +public class CLTaoPaoInfo {
  7 +
  8 + private String lineCode;
  9 +
  10 + private String nbbm;
  11 +
  12 + /**
  13 + * 班次ID , 号分割多个
  14 + */
  15 + private String schIdx;
  16 +
  17 + public String getLineCode() {
  18 + return lineCode;
  19 + }
  20 +
  21 + public void setLineCode(String lineCode) {
  22 + this.lineCode = lineCode;
  23 + }
  24 +
  25 + public String getNbbm() {
  26 + return nbbm;
  27 + }
  28 +
  29 + public void setNbbm(String nbbm) {
  30 + this.nbbm = nbbm;
  31 + }
  32 +
  33 + public String getSchIdx() {
  34 + return schIdx;
  35 + }
  36 +
  37 + public void setSchIdx(String schIdx) {
  38 + this.schIdx = schIdx;
  39 + }
  40 +}
src/main/java/com/bsth/data/schedule/taopao/entity/TPCutRealSchedule.java 0 → 100644
  1 +package com.bsth.data.schedule.taopao.entity;
  2 +
  3 +import javax.persistence.Transient;
  4 +
  5 +/**
  6 + * 精简的班次信息(展示套跑信息用)
  7 + */
  8 +public class TPCutRealSchedule {
  9 +
  10 + /** 主键Id */
  11 + private Long id;
  12 +
  13 + /** 排班日期字符串 YYYY-MM-DD */
  14 + private String scheduleDateStr;
  15 +
  16 + /** 路牌名称 */
  17 + private String lpName;
  18 +
  19 + /** 车辆自编号 */
  20 + private String clZbh;
  21 +
  22 + /** 驾驶员工号 */
  23 + private String jGh;
  24 + /** 驾驶员名字 */
  25 + private String jName;
  26 + /** 售票员工号 */
  27 + private String sGh;
  28 + /** 售票员名字 */
  29 + private String sName;
  30 +
  31 + /** 线路方向 */
  32 + private String xlDir;
  33 + /** 起点站名字 */
  34 + private String qdzName;
  35 +
  36 + /** 终点站名字 */
  37 + private String zdzName;
  38 +
  39 + /** 计划发车时间(格式 HH:mm) */
  40 + private String fcsj;
  41 + /** 计划发车时间戳*/
  42 + @Transient
  43 + private Long fcsjT;
  44 +
  45 + /** 计划终点时间(格式 HH:mm) */
  46 + private String zdsj;
  47 + /** 计划终点时间戳*/
  48 + @Transient
  49 + private Long zdsjT;
  50 +
  51 + /** 计划里程 */
  52 + private Double jhlc;
  53 +
  54 + /** 班次历时 */
  55 + private Integer bcsj;
  56 +
  57 + /**
  58 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  59 + */
  60 + private String bcType;
  61 +
  62 + //放站班次 站点名称
  63 + private String majorStationName;
  64 +
  65 + /** 实际发车时间*/
  66 + private String fcsjActual;
  67 + /**实际终点时间 */
  68 + private String zdsjActual;
  69 +
  70 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  71 + private int status;
  72 +
  73 + private String adjustExps;
  74 +
  75 + /** 是否是临加班次 */
  76 + private boolean sflj;
  77 +
  78 + /** 备注*/
  79 + private String remarks;
  80 +
  81 + /**待发时间(格式 HH:mm) */
  82 + private String dfsj;
  83 +
  84 + /**待发时间戳 */
  85 + @Transient
  86 + private Long dfsjT;
  87 +
  88 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  89 + private Integer directiveState = -1;
  90 +
  91 + /** 起点站计划到达时间 */
  92 + @Transient
  93 + private String qdzArrDatejh;
  94 +
  95 + /** 起点站实际到达时间 */
  96 + @Transient
  97 + private String qdzArrDatesj;
  98 +
  99 + public Long getId() {
  100 + return id;
  101 + }
  102 +
  103 + public void setId(Long id) {
  104 + this.id = id;
  105 + }
  106 +
  107 + public String getScheduleDateStr() {
  108 + return scheduleDateStr;
  109 + }
  110 +
  111 + public void setScheduleDateStr(String scheduleDateStr) {
  112 + this.scheduleDateStr = scheduleDateStr;
  113 + }
  114 +
  115 + public String getLpName() {
  116 + return lpName;
  117 + }
  118 +
  119 + public void setLpName(String lpName) {
  120 + this.lpName = lpName;
  121 + }
  122 +
  123 + public String getClZbh() {
  124 + return clZbh;
  125 + }
  126 +
  127 + public void setClZbh(String clZbh) {
  128 + this.clZbh = clZbh;
  129 + }
  130 +
  131 + public String getjGh() {
  132 + return jGh;
  133 + }
  134 +
  135 + public void setjGh(String jGh) {
  136 + this.jGh = jGh;
  137 + }
  138 +
  139 + public String getjName() {
  140 + return jName;
  141 + }
  142 +
  143 + public void setjName(String jName) {
  144 + this.jName = jName;
  145 + }
  146 +
  147 + public String getsGh() {
  148 + return sGh;
  149 + }
  150 +
  151 + public void setsGh(String sGh) {
  152 + this.sGh = sGh;
  153 + }
  154 +
  155 + public String getsName() {
  156 + return sName;
  157 + }
  158 +
  159 + public void setsName(String sName) {
  160 + this.sName = sName;
  161 + }
  162 +
  163 + public String getXlDir() {
  164 + return xlDir;
  165 + }
  166 +
  167 + public void setXlDir(String xlDir) {
  168 + this.xlDir = xlDir;
  169 + }
  170 +
  171 + public String getQdzName() {
  172 + return qdzName;
  173 + }
  174 +
  175 + public void setQdzName(String qdzName) {
  176 + this.qdzName = qdzName;
  177 + }
  178 +
  179 + public String getZdzName() {
  180 + return zdzName;
  181 + }
  182 +
  183 + public void setZdzName(String zdzName) {
  184 + this.zdzName = zdzName;
  185 + }
  186 +
  187 + public String getFcsj() {
  188 + return fcsj;
  189 + }
  190 +
  191 + public void setFcsj(String fcsj) {
  192 + this.fcsj = fcsj;
  193 + }
  194 +
  195 + public Long getFcsjT() {
  196 + return fcsjT;
  197 + }
  198 +
  199 + public void setFcsjT(Long fcsjT) {
  200 + this.fcsjT = fcsjT;
  201 + }
  202 +
  203 + public String getZdsj() {
  204 + return zdsj;
  205 + }
  206 +
  207 + public void setZdsj(String zdsj) {
  208 + this.zdsj = zdsj;
  209 + }
  210 +
  211 + public Long getZdsjT() {
  212 + return zdsjT;
  213 + }
  214 +
  215 + public void setZdsjT(Long zdsjT) {
  216 + this.zdsjT = zdsjT;
  217 + }
  218 +
  219 + public Double getJhlc() {
  220 + return jhlc;
  221 + }
  222 +
  223 + public void setJhlc(Double jhlc) {
  224 + this.jhlc = jhlc;
  225 + }
  226 +
  227 + public Integer getBcsj() {
  228 + return bcsj;
  229 + }
  230 +
  231 + public void setBcsj(Integer bcsj) {
  232 + this.bcsj = bcsj;
  233 + }
  234 +
  235 + public String getBcType() {
  236 + return bcType;
  237 + }
  238 +
  239 + public void setBcType(String bcType) {
  240 + this.bcType = bcType;
  241 + }
  242 +
  243 + public String getMajorStationName() {
  244 + return majorStationName;
  245 + }
  246 +
  247 + public void setMajorStationName(String majorStationName) {
  248 + this.majorStationName = majorStationName;
  249 + }
  250 +
  251 + public String getFcsjActual() {
  252 + return fcsjActual;
  253 + }
  254 +
  255 + public void setFcsjActual(String fcsjActual) {
  256 + this.fcsjActual = fcsjActual;
  257 + }
  258 +
  259 + public String getZdsjActual() {
  260 + return zdsjActual;
  261 + }
  262 +
  263 + public void setZdsjActual(String zdsjActual) {
  264 + this.zdsjActual = zdsjActual;
  265 + }
  266 +
  267 + public int getStatus() {
  268 + return status;
  269 + }
  270 +
  271 + public void setStatus(int status) {
  272 + this.status = status;
  273 + }
  274 +
  275 + public String getAdjustExps() {
  276 + return adjustExps;
  277 + }
  278 +
  279 + public void setAdjustExps(String adjustExps) {
  280 + this.adjustExps = adjustExps;
  281 + }
  282 +
  283 + public boolean isSflj() {
  284 + return sflj;
  285 + }
  286 +
  287 + public void setSflj(boolean sflj) {
  288 + this.sflj = sflj;
  289 + }
  290 +
  291 + public String getRemarks() {
  292 + return remarks;
  293 + }
  294 +
  295 + public void setRemarks(String remarks) {
  296 + this.remarks = remarks;
  297 + }
  298 +
  299 + public String getDfsj() {
  300 + return dfsj;
  301 + }
  302 +
  303 + public void setDfsj(String dfsj) {
  304 + this.dfsj = dfsj;
  305 + }
  306 +
  307 + public Long getDfsjT() {
  308 + return dfsjT;
  309 + }
  310 +
  311 + public void setDfsjT(Long dfsjT) {
  312 + this.dfsjT = dfsjT;
  313 + }
  314 +
  315 + public Integer getDirectiveState() {
  316 + return directiveState;
  317 + }
  318 +
  319 + public void setDirectiveState(Integer directiveState) {
  320 + this.directiveState = directiveState;
  321 + }
  322 +
  323 + public String getQdzArrDatejh() {
  324 + return qdzArrDatejh;
  325 + }
  326 +
  327 + public void setQdzArrDatejh(String qdzArrDatejh) {
  328 + this.qdzArrDatejh = qdzArrDatejh;
  329 + }
  330 +
  331 + public String getQdzArrDatesj() {
  332 + return qdzArrDatesj;
  333 + }
  334 +
  335 + public void setQdzArrDatesj(String qdzArrDatesj) {
  336 + this.qdzArrDatesj = qdzArrDatesj;
  337 + }
  338 +}
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -942,32 +942,42 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -942,32 +942,42 @@ public class TrafficManageServiceImpl implements TrafficManageService{
942 public String setSKB(String ids) { 942 public String setSKB(String ids) {
943 String result = "failure"; 943 String result = "failure";
944 StringBuffer sBuffer = new StringBuffer(); 944 StringBuffer sBuffer = new StringBuffer();
  945 + DecimalFormat df = new DecimalFormat("######0.000");
945 try { 946 try {
946 String[] idArray = ids.split(","); 947 String[] idArray = ids.split(",");
947 - StringBuffer sBufferA;  
948 - StringBuffer sBufferB; 948 + StringBuffer sBufferA ,sBufferB = null,sBufferC = null;
  949 + double zlc = 0.0f,yylc = 0.0f,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程
  950 + String bcType,sxx;// 班次类型、上下行
949 // 上传的时刻表集合 951 // 上传的时刻表集合
950 List<TTInfo> ttinfoList = new ArrayList<>(); 952 List<TTInfo> ttinfoList = new ArrayList<>();
951 TTInfo ttInfo; 953 TTInfo ttInfo;
952 TTInfoDetail ttInfoDetail; 954 TTInfoDetail ttInfoDetail;
  955 + LineInformation lineInformation;
953 Iterator<TTInfoDetail> ttInfoDetailIterator; 956 Iterator<TTInfoDetail> ttInfoDetailIterator;
954 - HashMap<String,Object> param = new HashMap<String, Object>(); 957 + HashMap<String,Object> param ;
955 sBuffer.append("<SKBs>"); 958 sBuffer.append("<SKBs>");
956 HashMap<String,String> paramMap; 959 HashMap<String,String> paramMap;
957 - HashMap<String,String> otherMap = new HashMap<String, String>(); 960 + HashMap<String,String> otherMap = new HashMap<>();
958 for (int i = 0; i < idArray.length; i++) { 961 for (int i = 0; i < idArray.length; i++) {
959 ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); 962 ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i]));
960 if(ttInfo == null) 963 if(ttInfo == null)
961 continue; 964 continue;
962 ttinfoList.add(ttInfo); // 保存时刻表 965 ttinfoList.add(ttInfo); // 保存时刻表
  966 + // 获得时刻表
  967 + param = new HashMap();
963 param.put("ttinfo.id_eq", ttInfo.getId()); 968 param.put("ttinfo.id_eq", ttInfo.getId());
964 ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), 969 ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param),
965 new Sort(Direction.ASC, "xlDir")).iterator(); 970 new Sort(Direction.ASC, "xlDir")).iterator();
  971 + // 获得lineInformation
  972 + param = new HashMap();
  973 + param.put("line.id_eq", ttInfo.getXl().getId());
  974 + lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param));
966 if(ttInfoDetailIterator.hasNext()){ 975 if(ttInfoDetailIterator.hasNext()){
967 sBuffer.append("<SKB>"); 976 sBuffer.append("<SKB>");
968 sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) 977 sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))
969 .append("</XLBM>"); 978 .append("</XLBM>");
970 sBufferB = new StringBuffer(); 979 sBufferB = new StringBuffer();
  980 + sBufferC = new StringBuffer();
971 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); 981 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
972 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 982 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表
973 sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); 983 sBufferB.append("<JSRQ>").append("").append("</JSRQ>");
@@ -975,46 +985,58 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -975,46 +985,58 @@ public class TrafficManageServiceImpl implements TrafficManageService{
975 sBufferB.append("<TBYY>").append("").append("</TBYY>"); 985 sBufferB.append("<TBYY>").append("").append("</TBYY>");
976 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); 986 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
977 sBufferB.append("<BCList>"); 987 sBufferB.append("<BCList>");
978 - int num = 1;  
979 while (ttInfoDetailIterator.hasNext()) { 988 while (ttInfoDetailIterator.hasNext()) {
980 ttInfoDetail = ttInfoDetailIterator.next(); 989 ttInfoDetail = ttInfoDetailIterator.next();
981 - if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){ 990 + bcType = ttInfoDetail.getBcType();
  991 + sxx = ttInfoDetail.getXlDir();
  992 + // 进出场班次
  993 + if(bcType.equals("in") || bcType.equals("out")){
  994 + // 进出班次的计划里程,算空驶里程
  995 + emptyLc = ttInfoDetail.getJhlc();
  996 + // 总里程需要加上空驶里程
  997 + zlc += emptyLc;
982 continue; 998 continue;
983 } 999 }
984 - if(num++ == 1){  
985 - sBufferA = new StringBuffer();  
986 - sBufferA.append("<JHZLC>").append(ttInfoDetail.getJhlc()).append("</JHZLC>");  
987 - sBufferA.append("<JHYYLC>").append(ttInfoDetail.getJhlc()).append("</JHYYLC>");  
988 - sBuffer.append(sBufferA).append(sBufferB);  
989 - }  
990 // 如果发车时间格式错误,忽略此条 1000 // 如果发车时间格式错误,忽略此条
991 if(changeTimeFormat(ttInfoDetail) == null){ 1001 if(changeTimeFormat(ttInfoDetail) == null){
992 continue; 1002 continue;
993 } 1003 }
994 - sBuffer.append("<BC>");  
995 - sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");  
996 - sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>");  
997 - sBuffer.append("<FCZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() 1004 + sBufferC.append("<BC>");
  1005 + sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
  1006 + sBufferC.append("<SXX>").append(sxx).append("</SXX>");
  1007 + sBufferC.append("<FCZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
998 +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); 1008 +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>");
999 // 起点站的参数 1009 // 起点站的参数
1000 otherMap.put("stationMark","B"); 1010 otherMap.put("stationMark","B");
1001 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1011 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1002 - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");  
1003 - sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");  
1004 - sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() 1012 + sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");
  1013 + sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
  1014 + sBufferC.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
1005 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); 1015 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");
1006 // 起点站的参数 1016 // 起点站的参数
1007 otherMap.put("stationMark","E"); 1017 otherMap.put("stationMark","E");
1008 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1018 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1009 - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");  
1010 - sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");  
1011 - sBuffer.append("</BC>"); 1019 + sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");
  1020 + sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
  1021 + sBufferC.append("</BC>");
  1022 + // 0:上行;1:下行
  1023 + if("0".equals(sxx)){
  1024 + singleLc = lineInformation.getUpMileage();
  1025 + }else{
  1026 + singleLc = lineInformation.getDownMileage();
  1027 + }
  1028 + zlc += singleLc ;
  1029 + yylc += singleLc;
1012 } 1030 }
1013 - sBuffer.append("</BCList>");  
1014 - sBuffer.append("</SKB>"); 1031 + sBufferC.append("</BCList>");
  1032 + sBufferC.append("</SKB>");
1015 } 1033 }
1016 } 1034 }
1017 - sBuffer.append("</SKBs>"); 1035 +
  1036 + sBufferA = new StringBuffer();
  1037 + sBufferA.append("<JHZLC>").append(df.format(zlc)).append("</JHZLC>");
  1038 + sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>");
  1039 + sBuffer.append(sBufferA).append(sBufferB).append(sBufferC).append("</SKBs>");
1018 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1040 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1019 result = "success"; 1041 result = "success";
1020 SKBUploadLogger skbUploadLogger ; 1042 SKBUploadLogger skbUploadLogger ;
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -190,66 +190,57 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -190,66 +190,57 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
190 ScheduleRealInfo sch = dayOfSchedule.get(schId); 190 ScheduleRealInfo sch = dayOfSchedule.get(schId);
191 String gsbm = sch.getGsBm(), fgsbm = sch.getFgsBm(); 191 String gsbm = sch.getGsBm(), fgsbm = sch.getFgsBm();
192 192
193 - if(StringUtils.isBlank(jGh) || "/".equals(StringUtils.trim(jGh))){  
194 - rs.put("msg", "无效的参数【驾驶员】");  
195 - rs.put("status", ResponseCode.ERROR);  
196 - return rs;  
197 - }  
198 - //校验运营公司  
199 - Personnel jsy = BasicData.perMap.get(gsbm + "-" + jGh);  
200 - if (null == jsy) {  
201 - msg = "【驾驶员】:" + sch.getGsName() + "暂无工号为" + "【" + jGh + "】的人员";  
202 - rs.put("msg", msg);  
203 - return rs;  
204 - }  
205 -  
206 - if (!carExist(gsbm, nbbm)) { 193 + if (nbbm != null && !carExist(gsbm, nbbm)) {
207 msg = sch.getGsName() + "没有自编号为" + "[" + nbbm + "]的车辆"; 194 msg = sch.getGsName() + "没有自编号为" + "[" + nbbm + "]的车辆";
208 rs.put("msg", msg); 195 rs.put("msg", msg);
209 return rs; 196 return rs;
210 } 197 }
211 198
212 - if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(nbbm))) { 199 + if (nbbm != null && !sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(nbbm))) {
213 rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + nbbm + "】的车辆"); 200 rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + nbbm + "】的车辆");
214 return rs; 201 return rs;
215 } 202 }
216 203
217 - Personnel spy = null;  
218 - if (StringUtils.isNotEmpty(sGh)) {  
219 - spy = BasicData.perMap.get(gsbm + "-" + sGh);  
220 - if (null == spy) {  
221 - msg = "【售票员】: " + sch.getGsName() + "暂无工号为" + "【" + sGh + "】的人员";  
222 - rs.put("msg", msg);  
223 - return rs;  
224 - }  
225 - } 204 + if (nbbm != null && !(fgsbm + "_" + gsbm).equals(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm))) {
226 205
  206 + String clFgsName = BasicData.businessFgsCodeNameMap.get(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm));
227 207
228 - //校验分公司  
229 - if (null != jsy && !fgsbm.equals(jsy.getBrancheCompanyCode())) {  
230 - msg = ("【驾驶员】:" + jGh + "/" + jsy.getPersonnelName() + "是" + jsy.getBrancheCompany() + "的人员"); 208 + msg = ("【" + nbbm + "】" + "是" + clFgsName + "的车辆!");
231 rs.put("msg", msg); 209 rs.put("msg", msg);
232 rs.put("checkStatus", -1); 210 rs.put("checkStatus", -1);
233 return rs; 211 return rs;
234 } 212 }
235 213
236 - if (StringUtils.isNotEmpty(sGh)) {  
237 - if (null != spy && !fgsbm.equals(spy.getBrancheCompanyCode())) {  
238 - msg = ("【售票员】: " + jGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); 214 + if(null != jGh && !"/".equals(StringUtils.trim(jGh))){
  215 + Personnel jsy = BasicData.perMap.get(gsbm + "-" + jGh);
  216 +
  217 + if (null == jsy) {
  218 + msg = "【驾驶员】:" + sch.getGsName() + "暂无工号为" + "【" + jGh + "】的人员";
  219 + rs.put("msg", msg);
  220 + return rs;
  221 + }
  222 + else if (!fgsbm.equals(jsy.getBrancheCompanyCode())) {
  223 + //校验分公司
  224 + msg = ("【驾驶员】:" + jGh + "/" + jsy.getPersonnelName() + "是" + jsy.getBrancheCompany() + "的人员");
239 rs.put("msg", msg); 225 rs.put("msg", msg);
240 rs.put("checkStatus", -1); 226 rs.put("checkStatus", -1);
241 return rs; 227 return rs;
242 } 228 }
243 } 229 }
244 230
245 - if (!(fgsbm + "_" + gsbm).equals(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm))) {  
246 -  
247 - String clFgsName = BasicData.businessFgsCodeNameMap.get(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm));  
248 -  
249 - msg = ("【" + nbbm + "】" + "是" + clFgsName + "的车辆!");  
250 - rs.put("msg", msg);  
251 - rs.put("checkStatus", -1);  
252 - return rs; 231 + if (null != sGh && !"/".equals(StringUtils.trim(sGh))) {
  232 + Personnel spy = BasicData.perMap.get(gsbm + "-" + sGh);
  233 + if (null == spy) {
  234 + msg = "【售票员】: " + sch.getGsName() + "暂无工号为" + "【" + sGh + "】的人员";
  235 + rs.put("msg", msg);
  236 + return rs;
  237 + }
  238 + else if (!fgsbm.equals(spy.getBrancheCompanyCode())) {
  239 + msg = ("【售票员】: " + jGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员");
  240 + rs.put("msg", msg);
  241 + rs.put("checkStatus", -1);
  242 + return rs;
  243 + }
253 } 244 }
254 245
255 rs.put("checkStatus", 1); 246 rs.put("checkStatus", 1);
@@ -3461,11 +3452,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3461,11 +3452,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3461 Set<ScheduleRealInfo> set = new HashSet<>(); 3452 Set<ScheduleRealInfo> set = new HashSet<>();
3462 3453
3463 ScheduleRealInfo sch; 3454 ScheduleRealInfo sch;
3464 - //StringBuilder sb = new StringBuilder();  
3465 3455
3466 String jGh = null, jName, sGh, sName; 3456 String jGh = null, jName, sGh, sName;
3467 for (ChangePersonCar cpc : cpcs) { 3457 for (ChangePersonCar cpc : cpcs) {
3468 - //sb = new StringBuilder();  
3469 3458
3470 sch = dayOfSchedule.get(cpc.getSchId()); 3459 sch = dayOfSchedule.get(cpc.getSchId());
3471 if (sch == null) 3460 if (sch == null)
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -152,6 +152,7 @@ @@ -152,6 +152,7 @@
152 <script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script> 152 <script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script>
153 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script> 153 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script>
154 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script> 154 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script>
  155 +<script src="/pages/base/timesmodel/js/v2/AdjustTripStrategy.js"></script>
155 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script> 156 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script>
156 <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script> 157 <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script>
157 <script src="/pages/base/timesmodel/js/errorinfo.js"></script> 158 <script src="/pages/base/timesmodel/js/errorinfo.js"></script>
src/main/resources/static/pages/base/timesmodel/js/v2/AdjustTripStrategy.js 0 → 100644
  1 +//------------------ 策略模块(以下) -----------------//
  2 +
  3 +var AdjustTripS1 = (function() {
  4 +
  5 + function _f1(aBc, schedule, paramObj, fre) {
  6 + if (fre > 0) {
  7 + aBc.sort(function (o1, o2) {
  8 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  9 + return -1;
  10 + } else {
  11 + return 1;
  12 + }
  13 + });
  14 +
  15 + var i;
  16 + var j;
  17 +
  18 + var iBcCountOfGroup = 3; // 3个班次取一次计算
  19 + var aBcOfGroup; // 3个班次列表
  20 + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
  21 + var oBcFcTime; // 班次发车时间
  22 +
  23 + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
  24 + aBcOfGroup = [];
  25 + aBcIntervalOfGroup = [];
  26 + for (j = i; j < i + iBcCountOfGroup; j++) {
  27 + aBcOfGroup.push(aBc[j]);
  28 + }
  29 +
  30 + for (j = 0; j < aBcOfGroup.length; j++) {
  31 + if (j < aBcOfGroup.length - 1) {
  32 + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
  33 + aBcOfGroup[j].getFcTimeObj(), "m"));
  34 + }
  35 + }
  36 +
  37 + // 判定规则
  38 + oBcFcTime = aBcOfGroup[1].getFcTimeObj();
  39 +
  40 + // 第一个班次发车时间不动,根据间隔,调整中间一个班次
  41 + // 如果3个班次2个间隔时间差1分钟,不调整
  42 + // 如果第一个间隔大,调整第二个班次往前1分钟
  43 + // 如果第二个间隔大,调整第二个班次往后1分钟
  44 +
  45 + if (paramObj.isTroughBc(oBcFcTime) &&
  46 + aBcIntervalOfGroup[0] > paramObj.getTroughMaxFcjx()) {
  47 +
  48 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  49 +
  50 + // 判定是否能调整发车时间
  51 + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) {
  52 + aBcOfGroup[1]._$_fcsjObj.add(-1, "m");
  53 + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute(
  54 + aBcOfGroup[1].getFcTimeObj(),
  55 + paramObj.calcuTravelTime(
  56 + aBcOfGroup[1].getFcTimeObj(),
  57 + aBcOfGroup[1].isUp())
  58 + ));
  59 +
  60 + // }
  61 + }
  62 +
  63 + //else if (_paramObj.isMPeakBc(oBcFcTime) &&
  64 + // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) {
  65 + // aBcOfGroup[1].addMinuteToFcsj(1);
  66 + //} else if (_paramObj.isMPeakBc(oBcFcTime) &&
  67 + // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) {
  68 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  69 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  70 + // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) {
  71 + // aBcOfGroup[1].addMinuteToFcsj(1);
  72 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  73 + // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) {
  74 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  75 + //}
  76 +
  77 +
  78 + else {
  79 + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  80 + //continue;
  81 + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  82 +
  83 +
  84 + // 判定是否能调整发车时间
  85 + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) {
  86 + aBcOfGroup[1]._$_fcsjObj.add(-1, "m");
  87 + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute(
  88 + aBcOfGroup[1].getFcTimeObj(),
  89 + paramObj.calcuTravelTime(
  90 + aBcOfGroup[1].getFcTimeObj(),
  91 + aBcOfGroup[1].isUp())
  92 + ));
  93 + // }
  94 +
  95 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  96 + } else {
  97 + // aBcOfGroup[1].addMinuteToFcsj(1);
  98 +
  99 + // 判定是否能调整发车时间
  100 + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], 1, _paramObj)) {
  101 + aBcOfGroup[1]._$_fcsjObj.add(1, "m");
  102 + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute(
  103 + aBcOfGroup[1].getFcTimeObj(),
  104 + paramObj.calcuTravelTime(
  105 + aBcOfGroup[1].getFcTimeObj(),
  106 + aBcOfGroup[1].isUp())
  107 + ));
  108 + // }
  109 + }
  110 + }
  111 +
  112 + //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  113 + // //continue;
  114 + //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  115 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  116 + //} else {
  117 + // aBcOfGroup[1].addMinuteToFcsj(1);
  118 + //}
  119 +
  120 +
  121 + }
  122 +
  123 + _f1(aBc, schedule, paramObj, fre - 1);
  124 +
  125 + }
  126 + }
  127 +
  128 +
  129 + function f1(aUpBc, aDownBc, schedule, paramObj) {
  130 + // TODO:9、调整纵向班次间隔
  131 + _f1(aUpBc, schedule, paramObj, 5);
  132 + _f1(aDownBc, schedule, paramObj, 5);
  133 +
  134 + schedule.fnAdjustLpBcInterval(1);
  135 +
  136 + _f1(aUpBc, schedule, paramObj, 5);
  137 + _f1(aDownBc, schedule, paramObj, 5);
  138 + }
  139 +
  140 + return f1;
  141 +}());
  142 +
  143 +//------------------ 策略模块(以上) -----------------//
  144 +
  145 +
  146 +
  147 +
  148 +
  149 +// 调整班次策略类
  150 +var AdjustTripStrategy = (function() {
  151 +
  152 + /**
  153 + * 内部策略配置封装类。
  154 + * @constructor
  155 + */
  156 + function InternalStrategy() {
  157 + // 策略函数对应,每个函数都由一个标识符号对应,类似配置函数
  158 + this._oSTRATIGIS = {
  159 + "ADJUST_TRIP": AdjustTripS1
  160 + };
  161 + }
  162 +
  163 + /**
  164 + * 返回策略函数
  165 + * @param str 标识
  166 + * @returns {function}
  167 + */
  168 + InternalStrategy.prototype.sFn = function(str) {
  169 + if (!this._oSTRATIGIS[str]) {
  170 + throw "指定标识" + str + "策略函数不存在!";
  171 + }
  172 + return this._oSTRATIGIS[str];
  173 + };
  174 + /**
  175 + * 替换策略配置
  176 + * @param str 策略函数标识
  177 + * @param fn 策略函数
  178 + */
  179 + InternalStrategy.prototype.sConfig = function(str, fn) {
  180 + this._oSTRATIGIS[str] = fn;
  181 + };
  182 +
  183 + return new InternalStrategy();
  184 +}());
0 \ No newline at end of file 185 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2/ParameterObj.js
@@ -730,6 +730,22 @@ var ParameterObj = function() { @@ -730,6 +730,22 @@ var ParameterObj = function() {
730 return _stopTypeObj.isMasterStop && (!_stopTypeObj.isMasterUpStop); 730 return _stopTypeObj.isMasterStop && (!_stopTypeObj.isMasterUpStop);
731 }, 731 },
732 732
  733 + /**
  734 + * 获取副站停站的方向(true,上行,false,下行)。
  735 + */
  736 + getDirAnotherWayStop: function() {
  737 + if (!this.isTwoWayStop()) {
  738 + if (this.isUpOneWayStop()) {
  739 + return true;
  740 + } else {
  741 + return false;
  742 + }
  743 +
  744 + } else {
  745 + return undefined;
  746 + }
  747 + },
  748 +
733 //----------------- 获取高峰配车数、加班路牌数 ----------------// 749 //----------------- 获取高峰配车数、加班路牌数 ----------------//
734 /** 750 /**
735 * 获取高峰建议配车数(TODO:参照一下)。 751 * 获取高峰建议配车数(TODO:参照一下)。
@@ -913,7 +929,7 @@ var ParameterObj = function() { @@ -913,7 +929,7 @@ var ParameterObj = function() {
913 }, 929 },
914 930
915 /** 931 /**
916 - * 获取固定的停站时间(固定停站时间都是选的最大值,非平均停站) 932 + * 获取固定的停站时间(使用平均停站)
917 * @param oTimeObj 时间对象 933 * @param oTimeObj 时间对象
918 * @param bIsUp 是否上行 934 * @param bIsUp 是否上行
919 * @param iXXTime 行驶时间 935 * @param iXXTime 行驶时间
@@ -921,181 +937,185 @@ var ParameterObj = function() { @@ -921,181 +937,185 @@ var ParameterObj = function() {
921 */ 937 */
922 fnCalcuFixedStopNumber: function(oTimeObj, bIsUp, iXXTime) { 938 fnCalcuFixedStopNumber: function(oTimeObj, bIsUp, iXXTime) {
923 _validInternal(); // 验证 939 _validInternal(); // 验证
924 - var oParam = this;  
925 940
926 - var iPeakStopTime; // 高峰停站时间  
927 - var iTroughStopTime; // 低谷停站时间  
928 - var iSecondaryStopTime; // 副站停站时间  
929 -  
930 - var iXXTime_temp;  
931 -  
932 - // 双向停站  
933 - if (oParam.isTwoWayStop()) {  
934 - if (bIsUp) { // 上行  
935 - if (this.isMPeakBc(oTimeObj)) { // 早高峰  
936 - iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime;  
937 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
938 - if (iPeakStopTime < 3) { // 不少于3分钟  
939 - iPeakStopTime = 3;  
940 - }  
941 - return iPeakStopTime;  
942 - } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰  
943 - iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime;  
944 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
945 - if (iPeakStopTime < 3) { // 不少于3分钟  
946 - iPeakStopTime = 3;  
947 - }  
948 - return iPeakStopTime;  
949 - } else { // 低谷  
950 - if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前  
951 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
952 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
953 - if (iTroughStopTime < 10) { // 不少于10分钟  
954 - iTroughStopTime = 10;  
955 - }  
956 - return iTroughStopTime;  
957 - } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后  
958 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
959 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
960 - if (iTroughStopTime < 10) { // 不少于10分钟  
961 - iTroughStopTime = 10;  
962 - }  
963 - return iTroughStopTime;  
964 - } else { // 早高峰,晚高峰之间  
965 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
966 - iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%  
967 - if (iTroughStopTime < 10) { // 不少于10分钟  
968 - iTroughStopTime = 10;  
969 - }  
970 - return iTroughStopTime;  
971 - }  
972 - }  
973 - } else { // 下行  
974 - if (this.isMPeakBc(oTimeObj)) { // 早高峰  
975 - iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime;  
976 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
977 - if (iPeakStopTime < 3) { // 不少于3分钟  
978 - iPeakStopTime = 3;  
979 - }  
980 - return iPeakStopTime;  
981 - } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰  
982 - iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime;  
983 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
984 - if (iPeakStopTime < 3) { // 不少于3分钟  
985 - iPeakStopTime = 3;  
986 - }  
987 - return iPeakStopTime;  
988 - } else { // 低谷  
989 - if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前  
990 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
991 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
992 - if (iTroughStopTime < 10) { // 不少于10分钟  
993 - iTroughStopTime = 10;  
994 - }  
995 - return iTroughStopTime;  
996 - } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后  
997 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
998 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
999 - if (iTroughStopTime < 10) { // 不少于10分钟  
1000 - iTroughStopTime = 10;  
1001 - }  
1002 - return iTroughStopTime;  
1003 - } else { // 早高峰,晚高峰之间  
1004 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
1005 - iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%  
1006 - if (iTroughStopTime < 10) { // 不少于10分钟  
1007 - iTroughStopTime = 10;  
1008 - }  
1009 - return iTroughStopTime;  
1010 - }  
1011 - }  
1012 - }  
1013 - } else { // 主站停站  
1014 - if (bIsUp == oParam.isUpOneWayStop()) {  
1015 - if (bIsUp) { // 上行  
1016 - if (this.isMPeakBc(oTimeObj)) { // 早高峰  
1017 - iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime;  
1018 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
1019 - if (iPeakStopTime < 3) { // 不少于3分钟  
1020 - iPeakStopTime = 3;  
1021 - }  
1022 - return iPeakStopTime;  
1023 - } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰  
1024 - iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime;  
1025 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
1026 - if (iPeakStopTime < 3) { // 不少于3分钟  
1027 - iPeakStopTime = 3;  
1028 - }  
1029 - return iPeakStopTime;  
1030 - } else { // 低谷  
1031 - if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前  
1032 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
1033 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
1034 - if (iTroughStopTime < 10) { // 不少于10分钟  
1035 - iTroughStopTime = 10;  
1036 - }  
1037 - return iTroughStopTime;  
1038 - } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后  
1039 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
1040 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
1041 - if (iTroughStopTime < 10) { // 不少于10分钟  
1042 - iTroughStopTime = 10;  
1043 - }  
1044 - return iTroughStopTime;  
1045 - } else { // 早高峰,晚高峰之间  
1046 - iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;  
1047 - iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%  
1048 - if (iTroughStopTime < 10) { // 不少于10分钟  
1049 - iTroughStopTime = 10;  
1050 - }  
1051 - return iTroughStopTime;  
1052 - }  
1053 - }  
1054 - } else { // 下行  
1055 - if (this.isMPeakBc(oTimeObj)) { // 早高峰  
1056 - iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime;  
1057 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
1058 - if (iPeakStopTime < 3) { // 不少于3分钟  
1059 - iPeakStopTime = 3;  
1060 - }  
1061 - return iPeakStopTime;  
1062 - } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰  
1063 - iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime;  
1064 - iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%  
1065 - if (iPeakStopTime < 3) { // 不少于3分钟  
1066 - iPeakStopTime = 3;  
1067 - }  
1068 - return iPeakStopTime;  
1069 - } else { // 低谷  
1070 - if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前  
1071 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
1072 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
1073 - if (iTroughStopTime < 10) { // 不少于10分钟  
1074 - iTroughStopTime = 10;  
1075 - }  
1076 - return iTroughStopTime;  
1077 - } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后  
1078 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
1079 - iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%  
1080 - if (iTroughStopTime < 10) { // 不少于10分钟  
1081 - iTroughStopTime = 10;  
1082 - }  
1083 - return iTroughStopTime;  
1084 - } else { // 早高峰,晚高峰之间  
1085 - iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;  
1086 - iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%  
1087 - if (iTroughStopTime < 10) { // 不少于10分钟  
1088 - iTroughStopTime = 10;  
1089 - }  
1090 - return iTroughStopTime;  
1091 - }  
1092 - }  
1093 - }  
1094 - } else { // 副站停战,2到3分钟  
1095 - iSecondaryStopTime = 3;  
1096 - return iSecondaryStopTime; // 直接返回3分钟  
1097 - }  
1098 - } 941 + return this.calcuTripAvgLayoverTime(oTimeObj, bIsUp,
  942 + this.calcuTripLayoverTimeRange(oTimeObj, bIsUp, iXXTime));
  943 +
  944 + // var oParam = this;
  945 + //
  946 + // var iPeakStopTime; // 高峰停站时间
  947 + // var iTroughStopTime; // 低谷停站时间
  948 + // var iSecondaryStopTime; // 副站停站时间
  949 + //
  950 + // var iXXTime_temp;
  951 + //
  952 + // // 双向停站
  953 + // if (oParam.isTwoWayStop()) {
  954 + // if (bIsUp) { // 上行
  955 + // if (this.isMPeakBc(oTimeObj)) { // 早高峰
  956 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime;
  957 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  958 + // if (iPeakStopTime < 3) { // 不少于3分钟
  959 + // iPeakStopTime = 3;
  960 + // }
  961 + // return iPeakStopTime;
  962 + // } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  963 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime;
  964 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  965 + // if (iPeakStopTime < 3) { // 不少于3分钟
  966 + // iPeakStopTime = 3;
  967 + // }
  968 + // return iPeakStopTime;
  969 + // } else { // 低谷
  970 + // if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  971 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  972 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  973 + // if (iTroughStopTime < 10) { // 不少于10分钟
  974 + // iTroughStopTime = 10;
  975 + // }
  976 + // return iTroughStopTime;
  977 + // } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  978 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  979 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  980 + // if (iTroughStopTime < 10) { // 不少于10分钟
  981 + // iTroughStopTime = 10;
  982 + // }
  983 + // return iTroughStopTime;
  984 + // } else { // 早高峰,晚高峰之间
  985 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  986 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%
  987 + // if (iTroughStopTime < 10) { // 不少于10分钟
  988 + // iTroughStopTime = 10;
  989 + // }
  990 + // return iTroughStopTime;
  991 + // }
  992 + // }
  993 + // } else { // 下行
  994 + // if (this.isMPeakBc(oTimeObj)) { // 早高峰
  995 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime;
  996 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  997 + // if (iPeakStopTime < 3) { // 不少于3分钟
  998 + // iPeakStopTime = 3;
  999 + // }
  1000 + // return iPeakStopTime;
  1001 + // } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1002 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime;
  1003 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  1004 + // if (iPeakStopTime < 3) { // 不少于3分钟
  1005 + // iPeakStopTime = 3;
  1006 + // }
  1007 + // return iPeakStopTime;
  1008 + // } else { // 低谷
  1009 + // if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1010 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1011 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1012 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1013 + // iTroughStopTime = 10;
  1014 + // }
  1015 + // return iTroughStopTime;
  1016 + // } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1017 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1018 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1019 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1020 + // iTroughStopTime = 10;
  1021 + // }
  1022 + // return iTroughStopTime;
  1023 + // } else { // 早高峰,晚高峰之间
  1024 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1025 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%
  1026 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1027 + // iTroughStopTime = 10;
  1028 + // }
  1029 + // return iTroughStopTime;
  1030 + // }
  1031 + // }
  1032 + // }
  1033 + // } else { // 主站停站
  1034 + // if (bIsUp == oParam.isUpOneWayStop()) {
  1035 + // if (bIsUp) { // 上行
  1036 + // if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1037 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime;
  1038 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  1039 + // if (iPeakStopTime < 3) { // 不少于3分钟
  1040 + // iPeakStopTime = 3;
  1041 + // }
  1042 + // return iPeakStopTime;
  1043 + // } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1044 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime;
  1045 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  1046 + // if (iPeakStopTime < 3) { // 不少于3分钟
  1047 + // iPeakStopTime = 3;
  1048 + // }
  1049 + // return iPeakStopTime;
  1050 + // } else { // 低谷
  1051 + // if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1052 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  1053 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1054 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1055 + // iTroughStopTime = 10;
  1056 + // }
  1057 + // return iTroughStopTime;
  1058 + // } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1059 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  1060 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1061 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1062 + // iTroughStopTime = 10;
  1063 + // }
  1064 + // return iTroughStopTime;
  1065 + // } else { // 早高峰,晚高峰之间
  1066 + // iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime;
  1067 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%
  1068 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1069 + // iTroughStopTime = 10;
  1070 + // }
  1071 + // return iTroughStopTime;
  1072 + // }
  1073 + // }
  1074 + // } else { // 下行
  1075 + // if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1076 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime;
  1077 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  1078 + // if (iPeakStopTime < 3) { // 不少于3分钟
  1079 + // iPeakStopTime = 3;
  1080 + // }
  1081 + // return iPeakStopTime;
  1082 + // } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1083 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime;
  1084 + // iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10%
  1085 + // if (iPeakStopTime < 3) { // 不少于3分钟
  1086 + // iPeakStopTime = 3;
  1087 + // }
  1088 + // return iPeakStopTime;
  1089 + // } else { // 低谷
  1090 + // if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1091 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1092 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1093 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1094 + // iTroughStopTime = 10;
  1095 + // }
  1096 + // return iTroughStopTime;
  1097 + // } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1098 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1099 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20%
  1100 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1101 + // iTroughStopTime = 10;
  1102 + // }
  1103 + // return iTroughStopTime;
  1104 + // } else { // 早高峰,晚高峰之间
  1105 + // iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime;
  1106 + // iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15%
  1107 + // if (iTroughStopTime < 10) { // 不少于10分钟
  1108 + // iTroughStopTime = 10;
  1109 + // }
  1110 + // return iTroughStopTime;
  1111 + // }
  1112 + // }
  1113 + // }
  1114 + // } else { // 副站停战,2到3分钟
  1115 + // iSecondaryStopTime = 3;
  1116 + // return iSecondaryStopTime; // 直接返回3分钟
  1117 + // }
  1118 + // }
1099 1119
1100 }, 1120 },
1101 1121
@@ -1216,7 +1236,7 @@ var ParameterObj = function() { @@ -1216,7 +1236,7 @@ var ParameterObj = function() {
1216 var paramObj = this; 1236 var paramObj = this;
1217 1237
1218 if (isUp) { 1238 if (isUp) {
1219 - if (bcType == "in_") { 1239 + if (bcType == "in_" || bcType == "in") {
1220 return paramObj.getUpInLc(); 1240 return paramObj.getUpInLc();
1221 } else if (bcType == "out") { 1241 } else if (bcType == "out") {
1222 return paramObj.getUpOutLc(); 1242 return paramObj.getUpOutLc();
@@ -1230,7 +1250,7 @@ var ParameterObj = function() { @@ -1230,7 +1250,7 @@ var ParameterObj = function() {
1230 return paramObj.getUpNormalLc(); 1250 return paramObj.getUpNormalLc();
1231 } 1251 }
1232 } else { 1252 } else {
1233 - if (bcType == "in_") { 1253 + if (bcType == "in_" || bcType == "in") {
1234 return paramObj.getDownInLc(); 1254 return paramObj.getDownInLc();
1235 } else if (bcType == "out") { 1255 } else if (bcType == "out") {
1236 return paramObj.getDownOutLc(); 1256 return paramObj.getDownOutLc();
@@ -1247,21 +1267,56 @@ var ParameterObj = function() { @@ -1247,21 +1267,56 @@ var ParameterObj = function() {
1247 }, 1267 },
1248 1268
1249 /** 1269 /**
1250 - * 计算高峰周转时间 1270 + * 计算高峰周转时间(早高峰)
1251 * @returns 周转时间 1271 * @returns 周转时间
1252 */ 1272 */
1253 calcuPeakZzsj: function() { 1273 calcuPeakZzsj: function() {
1254 _validInternal(); // 验证 1274 _validInternal(); // 验证
1255 - var paramObj = this; 1275 + // var paramObj = this;
  1276 + //
  1277 + // // 使用早高峰的周转时间
  1278 + // var _time = paramObj.getMPeakStartTimeObj();
  1279 + // var _zzsj = // 早高峰上行行驶时间+停站时间+早高峰下行行驶时间+停站时间
  1280 + // this.calcuTravelTime(_time, true) +
  1281 + // this.fnCalcuFixedStopNumber(_time, true) +
  1282 + // this.calcuTravelTime(_time, false) +
  1283 + // this.fnCalcuFixedStopNumber(_time, false);
  1284 + // return _zzsj;
  1285 +
  1286 + // 改成使用平均停站时间
  1287 + var _oTime = this.getMPeakStartTimeObj();
  1288 + var _iUpRT = this.calcuTravelTime(_oTime, true);
  1289 + var _aUpLTRange = this.calcuTripLayoverTimeRange(
  1290 + _oTime, true, _iUpRT);
  1291 + var _iUpLT = this.calcuTripAvgLayoverTime(
  1292 + _oTime, true, _aUpLTRange);
  1293 + var _iDownRT = this.calcuTravelTime(_oTime, false);
  1294 + var _aDownLTRange = this.calcuTripLayoverTimeRange(
  1295 + _oTime, false, _iDownRT);
  1296 + var _iDownLT = this.calcuTripAvgLayoverTime(
  1297 + _oTime, true, _aDownLTRange);
  1298 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  1299 + },
1256 1300
1257 - // 使用早高峰的周转时间  
1258 - var _time = paramObj.getMPeakStartTimeObj();  
1259 - var _zzsj = // 早高峰上行行驶时间+停站时间+早高峰下行行驶时间+停站时间  
1260 - this.calcuTravelTime(_time, true) +  
1261 - this.fnCalcuFixedStopNumber(_time, true) +  
1262 - this.calcuTravelTime(_time, false) +  
1263 - this.fnCalcuFixedStopNumber(_time, false);  
1264 - return _zzsj; 1301 + /**
  1302 + * 计算晚高峰周转时间(早高峰)。
  1303 + * @returns 周转时间
  1304 + */
  1305 + calcuEPeakZzsj : function() {
  1306 +
  1307 + // 改成使用平均停站时间
  1308 + var _oTime = this.getEPeakStartTimeObj();
  1309 + var _iUpRT = this.calcuTravelTime(_oTime, true);
  1310 + var _aUpLTRange = this.calcuTripLayoverTimeRange(
  1311 + _oTime, true, _iUpRT);
  1312 + var _iUpLT = this.calcuTripAvgLayoverTime(
  1313 + _oTime, true, _aUpLTRange);
  1314 + var _iDownRT = this.calcuTravelTime(_oTime, false);
  1315 + var _aDownLTRange = this.calcuTripLayoverTimeRange(
  1316 + _oTime, false, _iDownRT);
  1317 + var _iDownLT = this.calcuTripAvgLayoverTime(
  1318 + _oTime, true, _aDownLTRange);
  1319 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1265 }, 1320 },
1266 1321
1267 /** 1322 /**
@@ -1270,31 +1325,121 @@ var ParameterObj = function() { @@ -1270,31 +1325,121 @@ var ParameterObj = function() {
1270 */ 1325 */
1271 calcuTroughZzsj: function() { 1326 calcuTroughZzsj: function() {
1272 _validInternal(); // 验证 1327 _validInternal(); // 验证
1273 - var paramObj = this;  
1274 -  
1275 - // 使用低谷的周转时间  
1276 - var _time = this.addMinute(paramObj.getMPeakStartTimeObj(), -1); // 使用任意一个低谷时间  
1277 - var _zzsj = // 低谷上行行驶时间+停站时间+低谷下行行驶时间+停站时间  
1278 - this.calcuTravelTime(_time, true) +  
1279 - this.fnCalcuFixedStopNumber(_time, true) +  
1280 - this.calcuTravelTime(_time, false) +  
1281 - this.fnCalcuFixedStopNumber(_time, false);  
1282 -  
1283 - return _zzsj; 1328 + // var paramObj = this;
  1329 + //
  1330 + // // 使用低谷的周转时间
  1331 + // var _time = this.addMinute(paramObj.getMPeakStartTimeObj(), -1); // 使用任意一个低谷时间
  1332 + // var _zzsj = // 低谷上行行驶时间+停站时间+低谷下行行驶时间+停站时间
  1333 + // this.calcuTravelTime(_time, true) +
  1334 + // this.fnCalcuFixedStopNumber(_time, true) +
  1335 + // this.calcuTravelTime(_time, false) +
  1336 + // this.fnCalcuFixedStopNumber(_time, false);
  1337 + //
  1338 + // return _zzsj;
  1339 +
  1340 + // 改成使用平均停站时间
  1341 + var _oTime = this.addMinute(this.getMPeakStartTimeObj(), -1);
  1342 + var _iUpRT = this.calcuTravelTime(_oTime, true);
  1343 + var _aUpLTRange = this.calcuTripLayoverTimeRange(
  1344 + _oTime, true, _iUpRT);
  1345 + var _iUpLT = this.calcuTripAvgLayoverTime(
  1346 + _oTime, true, _aUpLTRange);
  1347 + var _iDownRT = this.calcuTravelTime(_oTime, false);
  1348 + var _aDownLTRange = this.calcuTripLayoverTimeRange(
  1349 + _oTime, false, _iDownRT);
  1350 + var _iDownLT = this.calcuTripAvgLayoverTime(
  1351 + _oTime, true, _aDownLTRange);
  1352 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1284 }, 1353 },
1285 1354
1286 /** 1355 /**
1287 * 计算车辆总数。 1356 * 计算车辆总数。
1288 - * @returns 车辆数 1357 + * @returns {int} 车辆数
1289 */ 1358 */
1290 calcuClzx: function() { 1359 calcuClzx: function() {
1291 _validInternal(); // 验证 1360 _validInternal(); // 验证
1292 - var paramObj = this; 1361 + // var paramObj = this;
  1362 + //
  1363 + // // 使用早高峰平均间隔
  1364 + // var _fcjx_avg = Math.floor((paramObj.getMPeakMinFcjx() + paramObj.getMPeakMaxFcjx()) / 2);
  1365 + // return Math.round(this.calcuPeakZzsj() / _fcjx_avg);
  1366 +
  1367 + // 计算早高峰车辆数(使用平均间隔)
  1368 + var _iAMPeakFcjx_avg = (this.getMPeakMinFcjx() + this.getMPeakMaxFcjx()) / 2;
  1369 + var _iAMPeakRCTime = this.calcuPeakZzsj();
  1370 + var _iAMPeakVehicleCount = _iAMPeakRCTime / _iAMPeakFcjx_avg;
  1371 +
  1372 + // 计算晚高峰车辆数 (使用平均间隔)
  1373 + var _iPMPeakFcjx_avg = (this.getEPeakMinFcjx() + this.getEPeakMaxFcjx()) / 2;
  1374 + var _iPMPeakRCTime = this.calcuEPeakZzsj();
  1375 + var _iPMPeakVehicleCount = _iPMPeakRCTime / _iPMPeakFcjx_avg;
  1376 +
  1377 + // 取最大值为最终车辆数
  1378 + // 大于或等于的最小整数,人话就是有小数点就加1
  1379 + if (_iAMPeakVehicleCount > _iPMPeakVehicleCount) {
  1380 + return Math.ceil(_iAMPeakVehicleCount);
  1381 + } else {
  1382 + return Math.ceil(_iPMPeakVehicleCount);
  1383 + }
  1384 + },
  1385 +
  1386 + /**
  1387 + * 计算平均Layover时间。
  1388 + * @param arriveTimeObj {moment} 到达时间对象
  1389 + * @param isUp {boolean} 是否上行
  1390 + * @param aRangeTime {array} Layover时间范围
  1391 + * @returns {int} 平均Layover时间
  1392 + */
  1393 + calcuTripAvgLayoverTime : function (arriveTimeObj, isUp, aRangeTime) {
  1394 + return Math.floor((aRangeTime[0] + aRangeTime[1]) / 2);
  1395 + },
  1396 +
  1397 + /**
  1398 + * 计算班次Layover时间范围。
  1399 + * @param arriveTimeObj {moment} 到达时间对象
  1400 + * @param isUp {boolean} 是否上行
  1401 + * @param runningTime {int} 班次行驶时间
  1402 + * @returns int[] 两个元素,一个最小停站时间-分钟,一个最大停站时间-分钟
  1403 + */
  1404 + calcuTripLayoverTimeRange: function(arriveTimeObj, isUp, runningTime) {
  1405 + var _aLayoverTime = [];
  1406 +
  1407 + var _iMinLayoverTime = 0;
  1408 + var _iMaxlayoverTime = 0;
  1409 +
  1410 + if (this.isTwoWayStop() || (this.getDirAnotherWayStop() != isUp)) {
  1411 + // 主站停站
  1412 + // 早晚高峰,行驶时间的10%-15%,最少3分钟
  1413 + // 低谷,行驶时间的15%-20%,最少10分钟
  1414 +
  1415 + if (this.isMPeakBc(arriveTimeObj) || this.isEPeakBc(arriveTimeObj)) {
  1416 + _iMinLayoverTime = Math.floor(runningTime * 0.10);
  1417 + _iMaxlayoverTime = Math.floor(runningTime * 0.15);
  1418 + if (_iMaxlayoverTime < 3) {
  1419 + _iMinLayoverTime = 3;
  1420 + _iMaxlayoverTime = 3;
  1421 + }
  1422 + } else {
  1423 + _iMinLayoverTime = Math.floor(runningTime * 0.15);
  1424 + _iMaxlayoverTime = Math.floor(runningTime * 0.20);
  1425 + if (_iMaxlayoverTime < 10) {
  1426 + _iMinLayoverTime = 10;
  1427 + _iMaxlayoverTime = 10;
  1428 + }
  1429 + }
  1430 + } else {
  1431 + // 副站停站
  1432 + // 所有时间段,1-3分钟
  1433 + _iMinLayoverTime = 1;
  1434 + _iMaxlayoverTime = 3;
  1435 + }
1293 1436
1294 - // 使用早高峰平均间隔  
1295 - var _fcjx_avg = Math.floor((paramObj.getMPeakMinFcjx() + paramObj.getMPeakMaxFcjx()) / 2);  
1296 - return Math.round(this.calcuPeakZzsj() / _fcjx_avg); 1437 + _aLayoverTime.push(_iMinLayoverTime);
  1438 + _aLayoverTime.push(_iMaxlayoverTime);
  1439 + return _aLayoverTime;
1297 } 1440 }
1298 1441
  1442 +
  1443 +
1299 }; 1444 };
1300 }; 1445 };
1301 \ No newline at end of file 1446 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
@@ -94,6 +94,10 @@ InternalBcObj.prototype.setGroup = function(groupObj) { @@ -94,6 +94,10 @@ InternalBcObj.prototype.setGroup = function(groupObj) {
94 this._$$_internal_group_obj = groupObj; 94 this._$$_internal_group_obj = groupObj;
95 }; 95 };
96 96
  97 +InternalBcObj.prototype.getGroup = function() {
  98 + return this._$$_internal_group_obj
  99 +};
  100 +
97 /** 101 /**
98 * 是否上行。 102 * 是否上行。
99 * @returns boolean 103 * @returns boolean
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupObj.js
@@ -53,6 +53,9 @@ InternalGroupObj.prototype.setLp = function(lpObj) { @@ -53,6 +53,9 @@ InternalGroupObj.prototype.setLp = function(lpObj) {
53 bc2.setLp(lpObj); 53 bc2.setLp(lpObj);
54 } 54 }
55 }; 55 };
  56 +InternalGroupObj.prototype.getLp = function() {
  57 + return this._$$_internal_lp_obj;
  58 +};
56 59
57 60
58 61
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
@@ -486,10 +486,13 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( @@ -486,10 +486,13 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function(
486 486
487 console.log("比较时间=" + fctime.format("HH:mm")); 487 console.log("比较时间=" + fctime.format("HH:mm"));
488 488
  489 + var oBc;
  490 +
489 for (i = 0; i < this._$_qCount; i++) { 491 for (i = 0; i < this._$_qCount; i++) {
490 group = groupArray[i]; 492 group = groupArray[i];
491 if (group) { 493 if (group) {
492 - if (group.getBc1() && hasUp) { 494 + oBc = group.getBc1();
  495 + if (oBc != undefined && (oBc.isUp() == hasUp || oBc.isUp() == hasDown)) {
493 bc1time = group.getBc1().getFcTimeObj(); 496 bc1time = group.getBc1().getFcTimeObj();
494 console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff); 497 console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff);
495 tempdiff = Math.abs(bc1time.diff(fctime)); 498 tempdiff = Math.abs(bc1time.diff(fctime));
@@ -514,7 +517,8 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( @@ -514,7 +517,8 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function(
514 } 517 }
515 } 518 }
516 519
517 - if (group.getBc2() && hasDown) { 520 + oBc = group.getBc2();
  521 + if (oBc != undefined && (oBc.isUp() == hasUp || oBc.isUp() == hasDown)) {
518 bc2time = group.getBc2().getFcTimeObj(); 522 bc2time = group.getBc2().getFcTimeObj();
519 console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff); 523 console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff);
520 tempdiff = Math.abs(bc2time.diff(fctime)); 524 tempdiff = Math.abs(bc2time.diff(fctime));
@@ -850,6 +854,222 @@ InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTrough @@ -850,6 +854,222 @@ InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTrough
850 854
851 }; 855 };
852 856
  857 +/**
  858 + * 调整车次block的班次停站时间,如果不在范围内,调整成平均停站时间。
  859 + * @param oParam {ParameterObj} 参数对象
  860 + */
  861 +InternalLpObj.prototype.fnAdjustBcTime = function(oParam) {
  862 + // 获取车次链个数
  863 + var iBcChainCount = this.fnGetBcChainCount();
  864 +
  865 + var i;
  866 + var j;
  867 + var oBcIndex;
  868 + var iQIndex;
  869 + var iBcIndex;
  870 + var iBcCount;
  871 + var oBc;
  872 + var oNextBc;
  873 +
  874 + var iBcStopTime;
  875 +
  876 + var aRangeStopTime;
  877 +
  878 + for (i = 0; i < iBcChainCount; i++) {
  879 + oBcIndex = this.fnGetBcChainInfo(i);
  880 + iQIndex = oBcIndex["s_q"];
  881 + iBcIndex = oBcIndex["s_b"];
  882 + iBcCount = oBcIndex["bcount"];
  883 +
  884 + for (j = 0; j < iBcCount - 1; j++) {
  885 + oBc = this.getBc(iQIndex, iBcIndex);
  886 + oNextBc = this.getBc(
  887 + iBcIndex == 0 ? iQIndex : iQIndex + 1,
  888 + iBcIndex == 0 ? 1 : 0);
  889 +
  890 + if (oNextBc.fnIsFirstBc()) { // 如果同一路牌连续2个方向首站班次,都不做处理
  891 + // 两个班次都是头班车,则停站时间不考虑范围,直接计算
  892 + iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
  893 + oBc.setStopTime(iBcStopTime);
  894 +
  895 + } else {
  896 + // 获取当前班次的停站时间范围
  897 + aRangeStopTime = oParam.calcuTripLayoverTimeRange(
  898 + oBc.getArrTimeObj(), oBc.isUp(), oBc.getBcTime()
  899 + );
  900 + // 获取当前班次停站时间
  901 + iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
  902 +
  903 + // 不改变当前班次的行驶时间,修正停站时间和下一个班次的发车时间和停站时间
  904 + if (oBc.fnGetEatTime() > 0) {
  905 + // 当前班次后有吃饭时间, 则没有停站时间了
  906 + oBc.setStopTime(0);
  907 + // 修改下一个班次的发车时间,到达时间
  908 + oNextBc.setFcTimeObj(oParam.addMinute(
  909 + oBc.getArrTimeObj(),
  910 + oBc.fnGetEatTime())
  911 + );
  912 + oNextBc.setArrTimeObj(oParam.addMinute(
  913 + oNextBc.getFcTimeObj(),
  914 + oParam.calcuTravelTime(
  915 + oNextBc.getFcTimeObj(),
  916 + oNextBc.isUp())
  917 + ));
  918 + } else {
  919 + if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime<= aRangeStopTime[1]) {
  920 + // 在范围内,重新设置以下停站时间
  921 + oBc.setStopTime(iBcStopTime);
  922 +
  923 + } else if (iBcStopTime < aRangeStopTime[0]) {
  924 + oBc.setStopTime(aRangeStopTime[0]);
  925 + // 修改下一个班次的发车时间,到达时间
  926 + oNextBc.setFcTimeObj(oParam.addMinute(
  927 + oBc.getArrTimeObj(),
  928 + oBc.getStopTime())
  929 + );
  930 + oNextBc.setArrTimeObj(oParam.addMinute(
  931 + oNextBc.getFcTimeObj(),
  932 + oParam.calcuTravelTime(
  933 + oNextBc.getFcTimeObj(),
  934 + oNextBc.isUp())
  935 + ));
  936 + } else {
  937 + oBc.setStopTime(aRangeStopTime[1]);
  938 + // 修改下一个班次的发车时间,到达时间
  939 + oNextBc.setFcTimeObj(oParam.addMinute(
  940 + oBc.getArrTimeObj(),
  941 + oBc.getStopTime())
  942 + );
  943 + oNextBc.setArrTimeObj(oParam.addMinute(
  944 + oNextBc.getFcTimeObj(),
  945 + oParam.calcuTravelTime(
  946 + oNextBc.getFcTimeObj(),
  947 + oNextBc.isUp())
  948 + ));
  949 + }
  950 + }
  951 + }
  952 +
  953 +
  954 + iBcIndex = iBcIndex == 0 ? 1 : 0;
  955 + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex;
  956 +
  957 + }
  958 +
  959 + // 最后一个班次停站时间为0
  960 + this.getBc(iQIndex, iBcIndex).setStopTime(0);
  961 + }
  962 +};
  963 +
  964 +/**
  965 + * 返回指定班次的上一个班次。
  966 + * @param oBc {moment} 指定班次
  967 + * @returns {object} 上一个班次,如果没有,返回false
  968 + */
  969 +InternalLpObj.prototype.getPreBc = function(oBc) {
  970 + // 获取车次链个数
  971 + var iBcChainCount = this.fnGetBcChainCount();
  972 +
  973 + var i;
  974 + var j;
  975 + var oBcIndex;
  976 + var iQIndex;
  977 + var iBcIndex;
  978 + var iBcCount;
  979 + var _oPreBc;
  980 + var _bFindCurrentBc = false;
  981 +
  982 + for (i = 0; i < iBcChainCount; i++) {
  983 + oBcIndex = this.fnGetBcChainInfo(i);
  984 + iQIndex = oBcIndex["s_q"];
  985 + iBcIndex = oBcIndex["s_b"];
  986 + iBcCount = oBcIndex["bcount"];
  987 +
  988 + for (j = 0; j < iBcCount - 1; j++) {
  989 + if (oBc.getFcTimeObj().format("HH:mm") ==
  990 + this.getBc(iQIndex, iBcIndex).getFcTimeObj().format("HH:mm")) {
  991 + _bFindCurrentBc = true;
  992 + break;
  993 + }
  994 +
  995 + // 进入到下一圈
  996 + iBcIndex = iBcIndex == 0 ? 1 : 0;
  997 + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex;
  998 + }
  999 +
  1000 + if (_bFindCurrentBc) {
  1001 + if (iQIndex == oBcIndex["s_q"] && iBcIndex == oBcIndex["s_q"]) { // 第一个班次
  1002 + break;
  1003 + } else {
  1004 + _oPreBc = this.getBc(
  1005 + iBcIndex == 0 ? iQIndex - 1 : iQIndex,
  1006 + iBcIndex == 0 ? 1 : 0);
  1007 + }
  1008 + }
  1009 +
  1010 + }
  1011 +
  1012 + return _oPreBc || false;
  1013 +
  1014 +};
  1015 +
  1016 +/**
  1017 + * 是否能调整班次的发车时间。
  1018 + * @param oBc 指定班次
  1019 + * @param iStep 修正步长
  1020 + * @param oParam 参数对象
  1021 + */
  1022 +InternalLpObj.prototype.isModifyBcFcsj = function(oBc, iStep, oParam) {
  1023 + // 获取车次链个数
  1024 + var iBcChainCount = this.fnGetBcChainCount();
  1025 +
  1026 + var i;
  1027 + var j;
  1028 + var oBcIndex;
  1029 + var iQIndex;
  1030 + var iBcIndex;
  1031 + var iBcCount;
  1032 + var oPreBc;
  1033 +
  1034 + var iBcStopTime;
  1035 +
  1036 + var aRangeStopTime;
  1037 +
  1038 + for (i = 0; i < iBcChainCount; i++) {
  1039 + oBcIndex = this.fnGetBcChainInfo(i);
  1040 + iQIndex = oBcIndex["s_q"];
  1041 + iBcIndex = oBcIndex["s_b"];
  1042 + iBcCount = oBcIndex["bcount"];
  1043 +
  1044 + oPreBc = this.getPreBc(oBc);
  1045 +
  1046 + // 如果是第一个班次
  1047 + if (!oPreBc) {
  1048 + if (oBc.fnIsFirstBc()) { // 如果是方向头班车
  1049 + return false;
  1050 + } else {
  1051 + return true;
  1052 + }
  1053 + }
  1054 +
  1055 + if (oPreBc.fnGetEatTime() > 0) { // 如果是吃饭班次,不能修改发车时间
  1056 + return false;
  1057 + }
  1058 +
  1059 + aRangeStopTime = oParam.calcuTripLayoverTimeRange(
  1060 + oPreBc.getArrTimeObj(), oPreBc.isUp(), oPreBc.getBcTime()
  1061 + );
  1062 + iBcStopTime = oPreBc.getStopTime() + iStep;
  1063 + if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime <= aRangeStopTime[1]) {
  1064 + return true;
  1065 + } else {
  1066 + return false;
  1067 + }
  1068 +
  1069 +
  1070 + }
  1071 +
  1072 +};
853 1073
854 // TODO 1074 // TODO
855 1075
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
@@ -159,12 +159,13 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -159,12 +159,13 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
159 159
160 // 在第一个班次之前再添加一个模拟班次,用于中标线的作用 160 // 在第一个班次之前再添加一个模拟班次,用于中标线的作用
161 // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除 161 // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除
  162 + var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime();
162 var iFirstStopTime = 163 var iFirstStopTime =
163 _paramObj.fnCalcuFixedStopNumber( 164 _paramObj.fnCalcuFixedStopNumber(
164 _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), 165 _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10),
165 - _qIsUp 166 + _qIsUp,
  167 + iXXTime
166 ); 168 );
167 - var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime();  
168 var oFlagBc = _factory.createBcObj( // 标记班次 169 var oFlagBc = _factory.createBcObj( // 标记班次
169 _internalLpArray[0], 170 _internalLpArray[0],
170 "normal", 171 "normal",
@@ -173,6 +174,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -173,6 +174,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
173 _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), 174 _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)),
174 _paramObj 175 _paramObj
175 ); 176 );
  177 + console.log("ddfdfdf=" + (iFirstStopTime));
  178 + console.log("ddfdfdf=" + (iXXTime));
  179 + console.log("ttt ==" + oFlagBc.getFcTimeObj().format("HH:mm"));
176 oFlagBc.fnSetDelFlag(true); // 标记了删除记号 180 oFlagBc.fnSetDelFlag(true); // 标记了删除记号
177 181
178 _internalLpArray[0].setBc(0, 1, oFlagBc); 182 _internalLpArray[0].setBc(0, 1, oFlagBc);
@@ -1377,6 +1381,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1377,6 +1381,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1377 // 晚饭index 1381 // 晚饭index
1378 var aDEIndex; 1382 var aDEIndex;
1379 1383
  1384 + console.log("吃饭");
1380 // 所有吃饭都默认在一个方向,两个方向暂时不考虑 1385 // 所有吃饭都默认在一个方向,两个方向暂时不考虑
1381 if (_paramObj.fnIsUpEat()) { 1386 if (_paramObj.fnIsUpEat()) {
1382 aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false); 1387 aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false);
@@ -1533,12 +1538,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1533,12 +1538,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1533 oLp.fnGetBcChainInfo(0)["s_b"] 1538 oLp.fnGetBcChainInfo(0)["s_b"]
1534 ); 1539 );
1535 aOtherBc.push(_factory.createBcObj( 1540 aOtherBc.push(_factory.createBcObj(
1536 - oLp, "bd", true, 1, 1541 + oLp, "bd", oStartBc.isUp(), 1,
1537 oStartBc.getFcTimeObj(), 1542 oStartBc.getFcTimeObj(),
1538 _paramObj 1543 _paramObj
1539 )); 1544 ));
1540 aOtherBc.push(_factory.createBcObj( 1545 aOtherBc.push(_factory.createBcObj(
1541 - oLp, "out", true, 1, 1546 + oLp, "out", oStartBc.isUp(), 1,
1542 oStartBc.getFcTimeObj(), 1547 oStartBc.getFcTimeObj(),
1543 _paramObj 1548 _paramObj
1544 )); 1549 ));
@@ -1551,12 +1556,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1551,12 +1556,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1551 oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置 1556 oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置
1552 oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置 1557 oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置
1553 aOtherBc.push(_factory.createBcObj( 1558 aOtherBc.push(_factory.createBcObj(
1554 - oLp, "in", true, 1, 1559 + oLp, "in", !oEndBc.isUp(), 1,
1555 oEndBc.getArrTimeObj(), 1560 oEndBc.getArrTimeObj(),
1556 _paramObj 1561 _paramObj
1557 )); 1562 ));
1558 aOtherBc.push(_factory.createBcObj( 1563 aOtherBc.push(_factory.createBcObj(
1559 - oLp, "lc", true, 1, 1564 + oLp, "lc", !oEndBc.isUp(), 1,
1560 oEndBc.getArrTimeObj(), 1565 oEndBc.getArrTimeObj(),
1561 _paramObj 1566 _paramObj
1562 )); 1567 ));
@@ -1567,12 +1572,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1567,12 +1572,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1567 oLp.fnGetBcChainInfo(0)["s_b"] 1572 oLp.fnGetBcChainInfo(0)["s_b"]
1568 ); 1573 );
1569 aOtherBc.push(_factory.createBcObj( 1574 aOtherBc.push(_factory.createBcObj(
1570 - oLp, "bd", true, 1, 1575 + oLp, "bd", oStartBc.isUp(), 1,
1571 oStartBc.getFcTimeObj(), 1576 oStartBc.getFcTimeObj(),
1572 _paramObj 1577 _paramObj
1573 )); 1578 ));
1574 aOtherBc.push(_factory.createBcObj( 1579 aOtherBc.push(_factory.createBcObj(
1575 - oLp, "out", true, 1, 1580 + oLp, "out", oStartBc.isUp(), 1,
1576 oStartBc.getFcTimeObj(), 1581 oStartBc.getFcTimeObj(),
1577 _paramObj 1582 _paramObj
1578 )); 1583 ));
@@ -1582,7 +1587,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1582,7 +1587,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1582 oLp.fnGetBcChainInfo(0)["e_b"] 1587 oLp.fnGetBcChainInfo(0)["e_b"]
1583 ); 1588 );
1584 aOtherBc.push(_factory.createBcObj( 1589 aOtherBc.push(_factory.createBcObj(
1585 - oLp, "in", true, 1, 1590 + oLp, "in", !oEndBc.isUp(), 1,
1586 oEndBc.getArrTimeObj(), 1591 oEndBc.getArrTimeObj(),
1587 _paramObj 1592 _paramObj
1588 )); 1593 ));
@@ -1593,12 +1598,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1593,12 +1598,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1593 oLp.fnGetBcChainInfo(1)["s_b"] 1598 oLp.fnGetBcChainInfo(1)["s_b"]
1594 ); 1599 );
1595 aOtherBc.push(_factory.createBcObj( 1600 aOtherBc.push(_factory.createBcObj(
1596 - oLp, "bd", true, 1, 1601 + oLp, "bd", oStartBc.isUp(), 1,
1597 oStartBc.getFcTimeObj(), 1602 oStartBc.getFcTimeObj(),
1598 _paramObj 1603 _paramObj
1599 )); 1604 ));
1600 aOtherBc.push(_factory.createBcObj( 1605 aOtherBc.push(_factory.createBcObj(
1601 - oLp, "out", true, 1, 1606 + oLp, "out", oStartBc.isUp(), 1,
1602 oStartBc.getFcTimeObj(), 1607 oStartBc.getFcTimeObj(),
1603 _paramObj 1608 _paramObj
1604 )); 1609 ));
@@ -1608,12 +1613,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1608,12 +1613,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1608 oLp.fnGetBcChainInfo(1)["e_b"] 1613 oLp.fnGetBcChainInfo(1)["e_b"]
1609 ); 1614 );
1610 aOtherBc.push(_factory.createBcObj( 1615 aOtherBc.push(_factory.createBcObj(
1611 - oLp, "in", true, 1, 1616 + oLp, "in", !oEndBc.isUp(), 1,
1612 oEndBc.getArrTimeObj(), 1617 oEndBc.getArrTimeObj(),
1613 _paramObj 1618 _paramObj
1614 )); 1619 ));
1615 aOtherBc.push(_factory.createBcObj( 1620 aOtherBc.push(_factory.createBcObj(
1616 - oLp, "lc", true, 1, 1621 + oLp, "lc", !oEndBc.isUp(), 1,
1617 oEndBc.getArrTimeObj(), 1622 oEndBc.getArrTimeObj(),
1618 _paramObj 1623 _paramObj
1619 )); 1624 ));
@@ -1653,15 +1658,19 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1653,15 +1658,19 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1653 * @param iFre int 迭代次数 1658 * @param iFre int 迭代次数
1654 */ 1659 */
1655 fnAdjustLpBcInterval: function(iFre) { 1660 fnAdjustLpBcInterval: function(iFre) {
1656 - if (iFre > 0) {  
1657 - for (var i = 0; i < _internalLpArray.length; i++) {  
1658 - _internalLpArray[i].fnAdjustBcInterval(  
1659 - this.fnCalcuAverPeakStopTime(),  
1660 - this.fnCalcuAverTroughStopTime(),  
1661 - _paramObj);  
1662 - }  
1663 -  
1664 - this.fnAdjustLpBcInterval(iFre - 1); 1661 + // if (iFre > 0) {
  1662 + // for (var i = 0; i < _internalLpArray.length; i++) {
  1663 + // _internalLpArray[i].fnAdjustBcInterval(
  1664 + // this.fnCalcuAverPeakStopTime(),
  1665 + // this.fnCalcuAverTroughStopTime(),
  1666 + // _paramObj);
  1667 + // }
  1668 + //
  1669 + // this.fnAdjustLpBcInterval(iFre - 1);
  1670 + // }
  1671 +
  1672 + for (var i = 0; i < _internalLpArray.length; i++) {
  1673 + _internalLpArray[i].fnAdjustBcTime(_paramObj);
1665 } 1674 }
1666 }, 1675 },
1667 1676
@@ -1723,96 +1732,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1723,96 +1732,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1723 }, 1732 },
1724 1733
1725 /** 1734 /**
1726 - * 调整班次间隔。  
1727 - * @param boolean isUp 是否上行 1735 + * 调整班次间隔(使用策略类)。
1728 * @param oStartTime 开始时间对象 1736 * @param oStartTime 开始时间对象
1729 - * @param fre int 迭代次数  
1730 */ 1737 */
1731 - fnAdjustBcInterval: function(isUp, oStartTime, fre) {  
1732 - if (fre > 0) {  
1733 - var aBc = !oStartTime ? _fnGetBcList(isUp) : _fnGetBcList2(isUp, oStartTime); // 指定方向的班次列表  
1734 -  
1735 - aBc.sort(function(o1, o2) {  
1736 - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {  
1737 - return -1;  
1738 - } else {  
1739 - return 1;  
1740 - }  
1741 - });  
1742 -  
1743 - var i;  
1744 - var j;  
1745 -  
1746 - var iBcCountOfGroup = 3; // 3个班次取一次计算  
1747 - var aBcOfGroup; // 3个班次列表  
1748 - var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔  
1749 - var oBcFcTime; // 班次发车时间  
1750 -  
1751 - for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {  
1752 - aBcOfGroup = [];  
1753 - aBcIntervalOfGroup = [];  
1754 - for (j = i; j < i + iBcCountOfGroup; j++) {  
1755 - aBcOfGroup.push(aBc[j]);  
1756 - }  
1757 -  
1758 - for (j = 0; j < aBcOfGroup.length; j++) {  
1759 - if (j < aBcOfGroup.length - 1) {  
1760 - aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(  
1761 - aBcOfGroup[j].getFcTimeObj(), "m"));  
1762 - }  
1763 - }  
1764 -  
1765 - // 判定规则  
1766 - oBcFcTime = aBcOfGroup[1].getFcTimeObj();  
1767 -  
1768 - // 第一个班次发车时间不动,根据间隔,调整中间一个班次  
1769 - // 如果3个班次2个间隔时间差1分钟,不调整  
1770 - // 如果第一个间隔大,调整第二个班次往前1分钟  
1771 - // 如果第二个间隔大,调整第二个班次往后1分钟  
1772 -  
1773 - if (_paramObj.isTroughBc(oBcFcTime) &&  
1774 - aBcIntervalOfGroup[0] > _paramObj.getTroughMaxFcjx()) {  
1775 - aBcOfGroup[1].addMinuteToFcsj(-1);  
1776 - }  
1777 -  
1778 - //else if (_paramObj.isMPeakBc(oBcFcTime) &&  
1779 - // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) {  
1780 - // aBcOfGroup[1].addMinuteToFcsj(1);  
1781 - //} else if (_paramObj.isMPeakBc(oBcFcTime) &&  
1782 - // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) {  
1783 - // aBcOfGroup[1].addMinuteToFcsj(-1);  
1784 - //} else if (_paramObj.isEPeakBc(oBcFcTime) &&  
1785 - // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) {  
1786 - // aBcOfGroup[1].addMinuteToFcsj(1);  
1787 - //} else if (_paramObj.isEPeakBc(oBcFcTime) &&  
1788 - // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) {  
1789 - // aBcOfGroup[1].addMinuteToFcsj(-1);  
1790 - //}  
1791 -  
1792 -  
1793 - else {  
1794 - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {  
1795 - //continue;  
1796 - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {  
1797 - aBcOfGroup[1].addMinuteToFcsj(-1);  
1798 - } else {  
1799 - aBcOfGroup[1].addMinuteToFcsj(1);  
1800 - }  
1801 - }  
1802 -  
1803 - //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {  
1804 - // //continue;  
1805 - //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {  
1806 - // aBcOfGroup[1].addMinuteToFcsj(-1);  
1807 - //} else {  
1808 - // aBcOfGroup[1].addMinuteToFcsj(1);  
1809 - //}  
1810 -  
1811 -  
1812 - }  
1813 -  
1814 - this.fnAdjustBcInterval(isUp, oStartTime, fre - 1);  
1815 - } 1738 + fnAdjustBcInterval: function(oStartTime) {
  1739 + // 获取上行班次列表
  1740 + var aUpBc = !oStartTime ? _fnGetBcList(true) : _fnGetBcList2(true, oStartTime); // 指定方向的班次列表
  1741 + var aDownBc = !oStartTime ? _fnGetBcList(false) : _fnGetBcList2(false, oStartTime); // 指定方向的班次列表
  1742 + // 使用策略类调用指定策略函数,注意 AdjustTripStrategy.js 导入
  1743 + AdjustTripStrategy.sFn("ADJUST_TRIP")(aUpBc, aDownBc, this, _paramObj);
1816 1744
1817 }, 1745 },
1818 1746
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
@@ -19,7 +19,7 @@ var Main_v2 = function() { @@ -19,7 +19,7 @@ var Main_v2 = function() {
19 var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); 19 var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp);
20 var _arrsj = paramObj.addMinute(_fcsj, _bcsj); 20 var _arrsj = paramObj.addMinute(_fcsj, _bcsj);
21 //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); 21 //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
22 - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, undefined); 22 + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, isUp, paramObj.calcuTravelTime(_fcsj, isUp));
23 var _tccid = paramObj.getTTinfoId(); 23 var _tccid = paramObj.getTTinfoId();
24 var _ttinfoid = paramObj.getTTinfoId(); 24 var _ttinfoid = paramObj.getTTinfoId();
25 var _xl = paramObj.getXlId(); 25 var _xl = paramObj.getXlId();
@@ -187,7 +187,7 @@ var Main_v2 = function() { @@ -187,7 +187,7 @@ var Main_v2 = function() {
187 oInternalLp.fnGetBcChainInfo(0)["s_b"] 187 oInternalLp.fnGetBcChainInfo(0)["s_b"]
188 ); 188 );
189 oTempBc = _factory.createBcObj( 189 oTempBc = _factory.createBcObj(
190 - oLp, "bd", true, 1, 190 + oLp, "bd", oStartBc.isUp(), 1,
191 oStartBc.getFcTimeObj(), 191 oStartBc.getFcTimeObj(),
192 _paramObj 192 _paramObj
193 ); 193 );
@@ -213,7 +213,7 @@ var Main_v2 = function() { @@ -213,7 +213,7 @@ var Main_v2 = function() {
213 }); 213 });
214 214
215 oTempBc = _factory.createBcObj( 215 oTempBc = _factory.createBcObj(
216 - oLp, "out", true, 1, 216 + oLp, "out", oStartBc.isUp(), 1,
217 oStartBc.getFcTimeObj(), 217 oStartBc.getFcTimeObj(),
218 _paramObj 218 _paramObj
219 ); 219 );
@@ -249,7 +249,7 @@ var Main_v2 = function() { @@ -249,7 +249,7 @@ var Main_v2 = function() {
249 ); 249 );
250 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); 250 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
251 oTempBc = _factory.createBcObj( 251 oTempBc = _factory.createBcObj(
252 - oLp, "in", true, 1, 252 + oLp, "in", !oEndBc.isUp(), 1,
253 oEndBc.getArrTimeObj(), 253 oEndBc.getArrTimeObj(),
254 _paramObj 254 _paramObj
255 ); 255 );
@@ -278,7 +278,7 @@ var Main_v2 = function() { @@ -278,7 +278,7 @@ var Main_v2 = function() {
278 }); 278 });
279 279
280 oTempBc = _factory.createBcObj( 280 oTempBc = _factory.createBcObj(
281 - oLp, "lc", true, 1, 281 + oLp, "lc", !oEndBc.isUp(), 1,
282 oEndBc.getArrTimeObj(), 282 oEndBc.getArrTimeObj(),
283 _paramObj 283 _paramObj
284 ); 284 );
@@ -311,7 +311,7 @@ var Main_v2 = function() { @@ -311,7 +311,7 @@ var Main_v2 = function() {
311 oInternalLp.fnGetBcChainInfo(0)["s_b"] 311 oInternalLp.fnGetBcChainInfo(0)["s_b"]
312 ); 312 );
313 oTempBc = _factory.createBcObj( 313 oTempBc = _factory.createBcObj(
314 - oLp, "bd", true, 1, 314 + oLp, "bd", oStartBc.isUp(), 1,
315 oStartBc.getFcTimeObj(), 315 oStartBc.getFcTimeObj(),
316 _paramObj 316 _paramObj
317 ); 317 );
@@ -337,7 +337,7 @@ var Main_v2 = function() { @@ -337,7 +337,7 @@ var Main_v2 = function() {
337 }); 337 });
338 338
339 oTempBc = _factory.createBcObj( 339 oTempBc = _factory.createBcObj(
340 - oLp, "out", true, 1, 340 + oLp, "out", oStartBc.isUp(), 1,
341 oStartBc.getFcTimeObj(), 341 oStartBc.getFcTimeObj(),
342 _paramObj 342 _paramObj
343 ); 343 );
@@ -373,7 +373,7 @@ var Main_v2 = function() { @@ -373,7 +373,7 @@ var Main_v2 = function() {
373 ); 373 );
374 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); 374 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
375 oTempBc = _factory.createBcObj( 375 oTempBc = _factory.createBcObj(
376 - oLp, "in", true, 1, 376 + oLp, "in", !oEndBc.isUp(), 1,
377 oEndBc.getArrTimeObj(), 377 oEndBc.getArrTimeObj(),
378 _paramObj 378 _paramObj
379 ); 379 );
@@ -408,7 +408,7 @@ var Main_v2 = function() { @@ -408,7 +408,7 @@ var Main_v2 = function() {
408 oInternalLp.fnGetBcChainInfo(1)["s_b"] 408 oInternalLp.fnGetBcChainInfo(1)["s_b"]
409 ); 409 );
410 oTempBc = _factory.createBcObj( 410 oTempBc = _factory.createBcObj(
411 - oLp, "bd", true, 1, 411 + oLp, "bd", oStartBc.isUp(), 1,
412 oStartBc.getFcTimeObj(), 412 oStartBc.getFcTimeObj(),
413 _paramObj 413 _paramObj
414 ); 414 );
@@ -434,7 +434,7 @@ var Main_v2 = function() { @@ -434,7 +434,7 @@ var Main_v2 = function() {
434 }); 434 });
435 435
436 oTempBc = _factory.createBcObj( 436 oTempBc = _factory.createBcObj(
437 - oLp, "out", true, 1, 437 + oLp, "out", oStartBc.isUp(), 1,
438 oStartBc.getFcTimeObj(), 438 oStartBc.getFcTimeObj(),
439 _paramObj 439 _paramObj
440 ); 440 );
@@ -471,7 +471,7 @@ var Main_v2 = function() { @@ -471,7 +471,7 @@ var Main_v2 = function() {
471 ); 471 );
472 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); 472 aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
473 oTempBc = _factory.createBcObj( 473 oTempBc = _factory.createBcObj(
474 - oLp, "in", true, 1, 474 + oLp, "in", !oEndBc.isUp(), 1,
475 oEndBc.getArrTimeObj(), 475 oEndBc.getArrTimeObj(),
476 _paramObj 476 _paramObj
477 ); 477 );
@@ -500,7 +500,7 @@ var Main_v2 = function() { @@ -500,7 +500,7 @@ var Main_v2 = function() {
500 }); 500 });
501 501
502 oTempBc = _factory.createBcObj( 502 oTempBc = _factory.createBcObj(
503 - oLp, "lc", true, 1, 503 + oLp, "lc", !oEndBc.isUp(), 1,
504 oEndBc.getArrTimeObj(), 504 oEndBc.getArrTimeObj(),
505 _paramObj 505 _paramObj
506 ); 506 );
@@ -540,6 +540,7 @@ var Main_v2 = function() { @@ -540,6 +540,7 @@ var Main_v2 = function() {
540 z == 1 ? j + 1 : j, 540 z == 1 ? j + 1 : j,
541 z == 1 ? 0 : 1); 541 z == 1 ? 0 : 1);
542 542
  543 + oInternalBc_temp._$_isRealEat = true;
543 oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")"; 544 oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")";
544 } 545 }
545 546
@@ -555,7 +556,9 @@ var Main_v2 = function() { @@ -555,7 +556,9 @@ var Main_v2 = function() {
555 "isUp": oInternalBc._$_isUp, // 是否上行 556 "isUp": oInternalBc._$_isUp, // 是否上行
556 557
557 "bcType": oInternalBc._$_bcType, // 班次类型 558 "bcType": oInternalBc._$_bcType, // 班次类型
558 - "fcsj": oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 559 + "fcsj": oInternalBc._$_isRealEat ?
  560 + ("*" + oInternalBc._$_fcsjObj.format("HH:mm")) :
  561 + oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
559 "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"), 562 "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"),
560 563
561 "groupNo": j, // 第几圈 564 "groupNo": j, // 第几圈
@@ -788,12 +791,11 @@ var Main_v2 = function() { @@ -788,12 +791,11 @@ var Main_v2 = function() {
788 // 7、祛除上标线开头有删除标记的班次 791 // 7、祛除上标线开头有删除标记的班次
789 schedule.fnRemoveDelFirstFlagBc(); 792 schedule.fnRemoveDelFirstFlagBc();
790 793
791 - // TODO:8、调整路牌班次间隔 794 + // 8、调整路牌班次间隔(使用平均停站时间)
792 schedule.fnAdjustLpBcInterval(1); 795 schedule.fnAdjustLpBcInterval(1);
793 796
794 - // TODO:9、调整纵向班次间隔  
795 - schedule.fnAdjustBcInterval(true, false, 10);  
796 - schedule.fnAdjustBcInterval(false, false, 10); 797 + // 9、调整纵向班次间隔
  798 + schedule.fnAdjustBcInterval(false);
797 799
798 // 10、确定末班车 800 // 10、确定末班车
799 schedule.fnCalcuLastBc(); 801 schedule.fnCalcuLastBc();
@@ -802,8 +804,8 @@ var Main_v2 = function() { @@ -802,8 +804,8 @@ var Main_v2 = function() {
802 schedule.fnRemoveDelLastFlagBc(); 804 schedule.fnRemoveDelLastFlagBc();
803 805
804 // TODO:12、平均化指定时间后的班次列表间隔 806 // TODO:12、平均化指定时间后的班次列表间隔
805 - schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50"));  
806 - schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50")); 807 + // schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50"));
  808 + // schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50"));
807 809
808 // 10、补进出场例保班次 810 // 10、补进出场例保班次
809 schedule.fnCalcuOtherBc(); 811 schedule.fnCalcuOtherBc();
src/main/resources/static/pages/base/timesmodel/js/v2_1/Block.js 0 → 100644
  1 +/**
  2 + * Block类,由多个trip串连在一起,
  3 + * 可包含进场,出场,报到,离场,正常,吃饭类型班次。
  4 + */
  5 +var Block = (function() {
  6 +
  7 + /**
  8 + * 内部Block类。
  9 + * @param stra {Strategy} 策略类
  10 + * @constructor
  11 + */
  12 + function InternalBlock(stra) {
  13 + // 内部的trip数组
  14 + this._aTrips = [];
  15 + // 策略类
  16 + this._oStrategy = stra;
  17 +
  18 +
  19 + // TODO
  20 + }
  21 +
  22 + return InternalBlock;
  23 +
  24 +}());
0 \ No newline at end of file 25 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2_1/ParamContext.js 0 → 100644
  1 +/**
  2 + * 参数上下文。内部ParamContext类
  3 + * 构造函数两个参数,formMap,dataMap
  4 + */
  5 +var ParamContext = (function() {
  6 +
  7 + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀
  8 + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式
  9 + /**
  10 + * 将时间包装成日期,方便计算。
  11 + * @param timeStr 时间格式,如 06:30
  12 + * @returns {moment}
  13 + */
  14 + var _fnWrapToTimeObj = function(timeStr) {
  15 + return moment(
  16 + date_wrap_prefix + timeStr,
  17 + date_wrap_format
  18 + );
  19 + };
  20 +
  21 + /**
  22 + * 添加分钟到时间对象。
  23 + * @param timeObj {moment} 时间对象
  24 + * @param m {int} 分钟
  25 + * @returns {moment}
  26 + */
  27 + var _fnAddMinuteToTimeObj = function(timeObj, m) {
  28 + var _oTime = moment(timeObj);
  29 + _oTime.add(m, "m");
  30 + return _oTime
  31 + };
  32 +
  33 + /**
  34 + * 内部对应的参数上下文对象。
  35 + * @param formMap
  36 + * @param dataMap
  37 + * @constructor
  38 + */
  39 + function InternalParamContext(formMap, dataMap) {
  40 + this._formMap = formMap;
  41 + this._dataMap = dataMap;
  42 +
  43 + if (!this._formMap) {
  44 + alert("formMap为空!");
  45 + throw "formMap为空!";
  46 + }
  47 + if (!this._dataMap) {
  48 + alert("dataMap为空!");
  49 + throw "dataMap为空!";
  50 + }
  51 +
  52 + // 计算首班车,末班车行驶时间对象
  53 + this._firstLastTripBeginTimeObj = {
  54 + up: { // 上行
  55 + firstTripBeginTimeObj: _fnWrapToTimeObj(this._formMap.startStationFirstTime),
  56 + lastTripBeginTimeObj: _fnWrapToTimeObj(this._formMap.startStationEndTime)
  57 + },
  58 + down: { // 下行
  59 + firstTripBeginTimeObj: _fnWrapToTimeObj(this._formMap.endStationFirstTime),
  60 + lastTripBeginTimeObj: _fnWrapToTimeObj(this._formMap.endStationEndTime)
  61 + }
  62 + };
  63 + // 计算吃饭时间
  64 + this._oEatTime = {
  65 + l: isNaN(this._formMap.workeLunch) || parseInt(this._formMap.workeLunch) == 0 ?
  66 + 20 : parseInt(this._formMap.workeLunch),
  67 + d: isNaN(this._formMap.workeDinner) || parseInt(this._formMap.workeDinner) == 0 ?
  68 + 20 : parseInt(this._formMap.workeDinner)
  69 + };
  70 + // 计算吃饭地点(方向)
  71 + this._oEatDir = {
  72 + up: false,
  73 + down: false
  74 + };
  75 + if (this._formMap.cfdd != undefined && String(this._formMap.cfdd) == "") {
  76 + // 没有选择吃饭地点,不吃饭
  77 + } else if (parseInt(this._formMap.cfdd) == 0) {
  78 + this._oEatDir["up"] = true;
  79 + } else if (parseInt(this._formMap.cfdd) == 1) {
  80 + this._oEatDir["down"] = true;
  81 + } else if (String(this._formMap.cfdd) == "allYes") {
  82 + this._oEatDir["up"] = true;
  83 + this._oEatDir["down"] = true;
  84 + }
  85 + // 计算行驶时间对象
  86 + this._oTripRunningTime = {
  87 + "up" : {
  88 + "AMPeak" : (isNaN(this._formMap.earlyUpTime) || parseInt(this._formMap.earlyUpTime) == 0) ?
  89 + parseInt(this._formMap.upTravelTime) :
  90 + parseInt(this._formMap.earlyUpTime),
  91 + "PMPeak" : (isNaN(this._formMap.lateUpTime) || parseInt(this._formMap.lateUpTime) == 0) ?
  92 + parseInt(this._formMap.upTravelTime) :
  93 + parseInt(this._formMap.lateUpTime),
  94 + "trough" : (isNaN(this._formMap.troughUpTime) || parseInt(this._formMap.troughUpTime) == 0) ?
  95 + parseInt(this._formMap.upTravelTime) :
  96 + parseInt(this._formMap.troughUpTime)
  97 + },
  98 + "down" : {
  99 + "AMPeak" : (isNaN(this._formMap.earlyDownTime) || parseInt(this._formMap.earlyDownTime) == 0) ?
  100 + parseInt(this._formMap.downTravelTime) :
  101 + parseInt(this._formMap.earlyDownTime),
  102 + "PMPeak" : (isNaN(this._formMap.lateDownTime) || parseInt(this._formMap.lateDownTime) == 0) ?
  103 + parseInt(this._formMap.downTravelTime) :
  104 + parseInt(this._formMap.lateDownTime),
  105 + "trough" : (isNaN(this._formMap.troughDownTime) || parseInt(this._formMap.troughDownTime) == 0) ?
  106 + parseInt(this._formMap.downTravelTime) :
  107 + parseInt(this._formMap.troughDownTime)
  108 + }
  109 + };
  110 + // 计算上下行进出场时间
  111 + this._oPullInOutTime = {
  112 + "up" : {
  113 + "pullIn" : (isNaN(this._formMap.upInTimer) || parseInt(this._formMap.upInTimer) == 0) ?
  114 + 20 : parseInt(this._formMap.upInTimer),
  115 + "pullOut" : (isNaN(this._formMap.upOutTimer) || parseInt(this._formMap.upOutTimer) == 0) ?
  116 + 20 : parseInt(this._formMap.upOutTimer)
  117 + },
  118 + "down" : {
  119 + "pullIn" : (isNaN(this._formMap.downInTimer) || parseInt(this._formMap.downInTimer) == 0) ?
  120 + 20 : parseInt(this._formMap.downInTimer),
  121 + "pullOut" : (isNaN(this._formMap.downOutTimer) || parseInt(this._formMap.downOutTimer) == 0) ?
  122 + 20 : parseInt(this._formMap.downOutTimer)
  123 + }
  124 + };
  125 + // 计算行驶里程对象
  126 + this._oMileage = {
  127 + "up" : {
  128 + "trip" : isNaN(this._formMap.upMileage) ? 0 : parseFloat(this._formMap.upMileage),
  129 + "pullIn" : isNaN(this._formMap.upInMileage) ? 0 : parseFloat(this._formMap.upInMileage),
  130 + "pullOut" : isNaN(this._formMap.upOutMileage) ? 0 : parseFloat(this._formMap.upOutMileage)
  131 + },
  132 + "down" : {
  133 + "trip" : isNaN(this._formMap.downMileage) ? 0 : parseFloat(this._formMap.downMileage),
  134 + "pullIn" : isNaN(this._formMap.downInMileage) ? 0 : parseFloat(this._formMap.downInMileage),
  135 + "pullOut" : isNaN(this._formMap.downOutMileage) ? 0 : parseFloat(this._formMap.downOutMileage)
  136 + }
  137 + };
  138 + // 计算时间段划分对象
  139 + this._oPeriod = {
  140 + "AMPeak" : {
  141 + "from" : _fnWrapToTimeObj(this._formMap.earlyStartTime),
  142 + "to" : _fnWrapToTimeObj(this._formMap.earlyEndTime)
  143 + },
  144 + "PMPeak" : {
  145 + "from" : _fnWrapToTimeObj(this._formMap.lateStartTime),
  146 + "to" : _fnWrapToTimeObj(this._formMap.lateEndTime)
  147 + }
  148 + };
  149 + // 计算各个时段的发车间隙
  150 + this._oHeadway = {
  151 + "AMPeak" : {
  152 + "min" : parseInt(this._formMap.zgffcjxmin),
  153 + "max" : parseInt(this._formMap.zgffcjxmax)
  154 + },
  155 + "PMPeak" : {
  156 + "min" : parseInt(this._formMap.wffcjxmin),
  157 + "max" : parseInt(this._formMap.wffcjxmax)
  158 + },
  159 + "trough" : {
  160 + "min" : parseInt(this._formMap.dgfcjxmin),
  161 + "max" : parseInt(this._formMap.dgfcjxmax)
  162 + }
  163 + };
  164 + // 做一些逻辑检查
  165 + if (this._oHeadway.AMPeak.min > this._oHeadway.AMPeak.max) {
  166 + alert("早高峰最小间隔大于最大间隔");
  167 + throw "早高峰最小间隔大于最大间隔";
  168 + }
  169 + if (this._oHeadway.PMPeak.min > this._oHeadway.PMPeak.max) {
  170 + alert("晚高峰最小间隔大于最大间隔");
  171 + throw "晚高峰最小间隔大于最大间隔";
  172 + }
  173 + if (this._oHeadway.trough.min > this._oHeadway.trough.max) {
  174 + alert("低谷最小间隔大于最大间隔");
  175 + throw "低谷最小间隔大于最大间隔";
  176 + }
  177 + // 获取停站类型
  178 + this._oStopType = {
  179 + upMaster : false,
  180 + downMaster : false
  181 + };
  182 + if (!this._formMap.stt) {
  183 + throw "停站类型没有选择!";
  184 + } else {
  185 + if (this._formMap.stt.split("/").length == 1) {
  186 + this._oStopType.upMaster = false;
  187 + this._oStopType.downMaster = false;
  188 + } else {
  189 + if (this._formMap.stt.split("/")[1] == "0") {
  190 + this._oStopType.upMaster = true;
  191 + } else {
  192 + this._oStopType.downMaster = true;
  193 + }
  194 + }
  195 + }
  196 +
  197 + }
  198 +
  199 + //------------ 获取首班末班时间 ------------//
  200 + /**
  201 + * 获取上行首班时间对象。
  202 + * @returns {moment}
  203 + */
  204 + InternalParamContext.prototype.fnGetUpFirstTripBeginTimeObj = function() {
  205 + return this._firstLastTripBeginTimeObj["up"]["firstTripBeginTimeObj"];
  206 + };
  207 + /**
  208 + * 获取上行末班时间对象。
  209 + * @returns moment
  210 + */
  211 + InternalParamContext.prototype.fnGetUpLastTripBeginTimeObj = function() {
  212 + var oStartTime = this._firstLastTripBeginTimeObj["up"]["firstTripBeginTimeObj"];
  213 + var oEndTime = this._firstLastTripBeginTimeObj["up"]["lastTripBeginTimeObj"];
  214 + if (oEndTime.isBefore(oStartTime)) {
  215 + // 因为是相同日期前缀,具体见_fnWrapToTimeObj函数
  216 + // 如果末班车时间早于首班车时间,则末班车时间跨天,需要加1天
  217 + oEndTime.add(1, "day");
  218 +
  219 + }
  220 + return oEndTime;
  221 + };
  222 + /**
  223 + * 获取下行首班时间对象。
  224 + * @returns moment
  225 + */
  226 + InternalParamContext.prototype.fnGetDownFirstTripBeginTimeObj = function() {
  227 + return this._firstLastTripBeginTimeObj["down"]["firstTripBeginTimeObj"];
  228 + };
  229 + /**
  230 + * 获取下行末班车时间对象。
  231 + * @returns moment
  232 + */
  233 + InternalParamContext.prototype.fnGetDownLastTripBeginTimeObj = function() {
  234 + var oStartTime = this._firstLastTripBeginTimeObj["down"]["firstTripBeginTimeObj"];
  235 + var oEndTime = this._firstLastTripBeginTimeObj["down"]["lastTripBeginTimeObj"];
  236 + if (oEndTime.isBefore(oStartTime)) {
  237 + // 因为是相同日期前缀,具体见_fnWrapToTimeObj函数
  238 + // 如果末班车时间早于首班车时间,则末班车时间跨天,需要加1天
  239 + oEndTime.add(1, "day");
  240 +
  241 + }
  242 + return oEndTime;
  243 + };
  244 +
  245 + //-------------- 获取吃饭时间 ----------------//
  246 + /**
  247 + * 获取午饭时间。
  248 + * @returns int
  249 + */
  250 + InternalParamContext.prototype.fnGetLunchTime = function() {
  251 + return this._oEatTime["l"];
  252 + };
  253 + /**
  254 + * 获取晚饭时间。
  255 + * @returns int
  256 + */
  257 + InternalParamContext.prototype.fnGetDinnerTime = function() {
  258 + return this._oEatTime["d"];
  259 + };
  260 +
  261 + //-------------- 获取吃饭地点(方向) ----------------//
  262 + /**
  263 + * 是否吃饭。
  264 + * @returns boolean
  265 + */
  266 + InternalParamContext.prototype.fnIsEat = function() {
  267 + return this._oEatDir["up"] || this._oEatDir["down"];
  268 + };
  269 + /**
  270 + * 是否上行吃饭。
  271 + * @returns boolean
  272 + */
  273 + InternalParamContext.prototype.fnIsUpEat = function() {
  274 + return this._oEatDir["up"];
  275 + };
  276 + /**
  277 + * 是否下行吃饭。
  278 + * @returns boolean
  279 + */
  280 + InternalParamContext.prototype.fnIsDownEat = function() {
  281 + return this._oEatDir["down"];
  282 + };
  283 + /**
  284 + * 是否上下行吃饭。
  285 + * @returns boolean
  286 + */
  287 + InternalParamContext.prototype.fnIsBothEat = function() {
  288 + return this._oEatDir["up"] && this._oEatDir["down"];
  289 + };
  290 +
  291 + //-------------- 获取行驶时间 ----------------//
  292 + /**
  293 + * 获取上行早高峰班次行驶时间。
  294 + * @returns int
  295 + */
  296 + InternalParamContext.prototype.fnGetUpAMPeakRunningTime = function() {
  297 + return this._oTripRunningTime["up"]["AMPeak"];
  298 + };
  299 + /**
  300 + * 获取上行晚高峰班次行驶时间。
  301 + * @returns int
  302 + */
  303 + InternalParamContext.prototype.fnGetUpPMPeakRunningTime = function() {
  304 + return this._oTripRunningTime["up"]["PMPeak"];
  305 + };
  306 + /**
  307 + * 获取上行低谷班次行驶时间。
  308 + * @returns int
  309 + */
  310 + InternalParamContext.prototype.fnGetUpTRunningTime = function() {
  311 + return this._oTripRunningTime["up"]["trough"];
  312 + };
  313 + /**
  314 + * 获取下行早高峰班次行驶时间。
  315 + * @returns int
  316 + */
  317 + InternalParamContext.prototype.fnGetDownAMPeakRunningTime = function() {
  318 + return this._oTripRunningTime["down"]["AMPeak"];
  319 + };
  320 + /**
  321 + * 获取下行晚高峰班次行驶时间。
  322 + * @returns int
  323 + */
  324 + InternalParamContext.prototype.fnGetDownPMPeakRunningTime = function() {
  325 + return this._oTripRunningTime["down"]["PMPeak"];
  326 + };
  327 + /**
  328 + * 获取下行低谷班次行驶时间。
  329 + * @returns int
  330 + */
  331 + InternalParamContext.prototype.fnGetDownTRunningTime = function() {
  332 + return this._oTripRunningTime["down"]["trough"];
  333 + };
  334 + /**
  335 + * 获取上行进场时间。
  336 + * @returns int
  337 + */
  338 + InternalParamContext.prototype.fnGetUpPullInTime = function() {
  339 + return this._oPullInOutTime["up"]["pullIn"];
  340 + };
  341 + /**
  342 + * 获取上行出场时间。
  343 + * @returns int
  344 + */
  345 + InternalParamContext.prototype.fnGetUpPullOutTime = function() {
  346 + return this._oPullInOutTime["up"]["pullOut"];
  347 + };
  348 + /**
  349 + * 获取下行进场时间。
  350 + * @returns int
  351 + */
  352 + InternalParamContext.prototype.fnGetDownPullInTime = function() {
  353 + return this._oPullInOutTime["down"]["pullIn"];
  354 + };
  355 + /**
  356 + * 获取下行出场时间。
  357 + * @returns int
  358 + */
  359 + InternalParamContext.prototype.fnGetDownPullOutTime = function() {
  360 + return this._oPullInOutTime["down"]["pullOut"];
  361 + };
  362 +
  363 + //---------------- 获取行驶里程 -----------------//
  364 + /**
  365 + * 获取上行班次里程
  366 + * @returns float
  367 + */
  368 + InternalParamContext.prototype.fnGetUpTripMileage = function() {
  369 + return this._oMileage["up"]["trip"];
  370 + };
  371 + /**
  372 + * 获取上行进场里程
  373 + * @returns float
  374 + */
  375 + InternalParamContext.prototype.fnGetUpPullInMileage = function() {
  376 + return this._oMileage["up"]["pullIn"];
  377 + };
  378 + /**
  379 + * 获取上行出场里程。
  380 + * @returns float
  381 + */
  382 + InternalParamContext.prototype.fnGetUpPullOutMileage = function() {
  383 + return this._oMileage["up"]["pullOut"];
  384 + };
  385 + /**
  386 + * 获取下行班次里程。
  387 + * @returns float
  388 + */
  389 + InternalParamContext.prototype.fnGetDownTripMileage = function() {
  390 + return this._oMileage["down"]["trip"];
  391 + };
  392 + /**
  393 + * 获取下行进场里程。
  394 + * @returns float
  395 + */
  396 + InternalParamContext.prototype.fnGetDownPullInMileage = function() {
  397 + return this._oMileage["down"]["pullIn"];
  398 + };
  399 + /**
  400 + * 获取下行出场里程。
  401 + * @returns float
  402 + */
  403 + InternalParamContext.prototype.fnGetDownPullOutMileage = function() {
  404 + return this._oMileage["down"]["pullOut"];
  405 + };
  406 +
  407 + //---------------- 获取时间段信息,时间段判定 --------------//
  408 + /**
  409 + * 获取早高峰开始时间对象。
  410 + * @returns moment
  411 + */
  412 + InternalParamContext.prototype.fnGetAMPeakFromTimeObj = function() {
  413 + return this._oPeriod["AMPeak"]["from"];
  414 + };
  415 + /**
  416 + * 获取早高峰结束时间对象。
  417 + * @returns moment
  418 + */
  419 + InternalParamContext.prototype.fnGetAMPeakToTimeObj = function() {
  420 + return this._oPeriod["AMPeak"]["to"];
  421 + };
  422 + /**
  423 + * 获取晚高峰开始时间对象。
  424 + * @returns moment
  425 + */
  426 + InternalParamContext.prototype.fnGetPMPeakFromTimeObj = function() {
  427 + return this._oPeriod["PMPeak"]["from"];
  428 + };
  429 + /**
  430 + * 获取晚高峰结束时间对象。
  431 + * @returns moment
  432 + */
  433 + InternalParamContext.prototype.fnGetPMPeakToTimeObj = function() {
  434 + return this._oPeriod["PMPeak"]["to"];
  435 + };
  436 +
  437 + /**
  438 + * 判定时间是否在早高峰。
  439 + * @param leaveTimeObj {moment} 发车时间对象
  440 + * @returns {boolean}
  441 + */
  442 + InternalParamContext.prototype.fnIsAMPeak = function(timeObj) {
  443 + var _oST = this.fnGetAMPeakFromTimeObj();
  444 + var _oET = this.fnGetAMPeakToTimeObj();
  445 + return timeObj.isBetween(_oST, _oET, null, "[]");
  446 + };
  447 + /**
  448 + * 判定时间是否在晚高峰。
  449 + * @param leaveTimeObj {moment} 发车时间对象
  450 + * @returns {boolean}
  451 + */
  452 + InternalParamContext.prototype.fnIsPMPeak = function(timeObj) {
  453 + var _oST = this.fnGetPMPeakFromTimeObj();
  454 + var _oET = this.fnGetPMPeakToTimeObj();
  455 + return timeObj.isBetween(_oST, _oET, null, "[]");
  456 + };
  457 + /**
  458 + * 判定时间是否在低谷。
  459 + * @param leaveTimeObj {moment} 发车时间对象
  460 + * @returns {boolean}
  461 + */
  462 + InternalParamContext.prototype.fnIsTrough = function(timeObj) {
  463 + return !(this.fnIsAMPeak(timeObj) ||
  464 + this.fnIsPMPeak(timeObj));
  465 + };
  466 + /**
  467 + * 判定时间是否在早高峰开始之前。
  468 + * @param leaveTimeObj {moment} 发车时间对象
  469 + * @returns {boolean}
  470 + */
  471 + InternalParamContext.prototype.fnIsTroughBeforeAMPeak = function(timeObj) {
  472 + var _oST = this.fnGetAMPeakFromTimeObj();
  473 + return timeObj.isBefore(_oST);
  474 + };
  475 + /**
  476 + * 判定时间是否在晚高峰结束之后。
  477 + * @param leaveTimeObj {moment} 发车时间对象
  478 + * @returns {boolean}
  479 + */
  480 + InternalParamContext.prototype.fnIsTroughAfterPMPeak = function(timeObj) {
  481 + var _oET = this.fnGetPMPeakToTimeObj();
  482 + return timeObj.isAfter(_oET);
  483 + };
  484 +
  485 + //----------------- 获取发车间隙(TODO:以后通过客流估算)-----------------//
  486 + /**
  487 + * 获取早高峰最小发车间隔。
  488 + * @returns int
  489 + */
  490 + InternalParamContext.prototype.fnGetAMPeakMinHeadway = function() {
  491 + return this._oHeadway["AMPeak"]["min"];
  492 + };
  493 + /**
  494 + * 获取早高峰最大发车间隔。
  495 + * @returns int
  496 + */
  497 + InternalParamContext.prototype.fnGetAMPeakMaxHeadway = function() {
  498 + return this._oHeadway["AMPeak"]["max"];
  499 + };
  500 + /**
  501 + * 获取晚高峰最小发车间隔。
  502 + * @returns int
  503 + */
  504 + InternalParamContext.prototype.fnGetPMPeakMinHeadway = function() {
  505 + return this._oHeadway["PMPeak"]["min"];
  506 + };
  507 + /**
  508 + * 获取晚高峰最大发车间隔。
  509 + * @returns int
  510 + */
  511 + InternalParamContext.prototype.fnGetPMPeakMaxHeadway = function() {
  512 + return this._oHeadway["PMPeak"]["max"];
  513 + };
  514 + /**
  515 + * 获取低谷最小发车间隔。
  516 + * @returns int
  517 + */
  518 + InternalParamContext.prototype.fnGetTroughMinHeadway = function() {
  519 + return this._oHeadway["trough"]["min"];
  520 + };
  521 + /**
  522 + * 获取低谷最大发车间隔。
  523 + * @returns {int}
  524 + */
  525 + InternalParamContext.prototype.fnGetTroughMaxHeadway = function() {
  526 + return this._oHeadway["trough"]["max"];
  527 + };
  528 +
  529 + //----------------- 获取停站方式 -------------------//
  530 + /**
  531 + * 是否双向停站.
  532 + * @returns {boolean}
  533 + */
  534 + InternalParamContext.prototype.fnIsTwoDirStop = function() {
  535 + return !(this._oStopType.upMaster || this._oStopType.downMaster);
  536 + };
  537 + /**
  538 + * 是否上行停站。
  539 + * @returns {boolean}
  540 + */
  541 + InternalParamContext.prototype.fnIsUpDirStop = function() {
  542 + return this._oStopType.upMaster;
  543 + };
  544 + /**
  545 + * 是否下行停站。
  546 + * @returns {boolean}
  547 + */
  548 + InternalParamContext.prototype.fnIsDownDirStop = function() {
  549 + return this._oStopType.downMaster;
  550 + };
  551 +
  552 + //----------------- 获取高峰建议配车数、加班路牌数 ----------------//
  553 + /**
  554 + * 获取高峰建议配车数。
  555 + * @returns {int}
  556 + */
  557 + InternalParamContext.prototype.fnGetAdvicePeakVehicleCount = function() {
  558 + return parseInt(this._formMap.gfjypcs);
  559 + };
  560 + /**
  561 + * 获取5休2路牌数。
  562 + * @returns {int}
  563 + */
  564 + InternalParamContext.prototype.fnGet5_2lpCount = function() {
  565 + return parseInt(this._formMap.jbclcount);
  566 + };
  567 +
  568 + //----------------- 获取保养信息 ------------------//
  569 + /**
  570 + * 获取保养信息。
  571 + * @returns {int}
  572 + */
  573 + InternalParamContext.prototype.fnGetMaintenanceTime = function() {
  574 + return (isNaN(this._formMap.lb) || parseInt(this._formMap.lb) == 0) ?
  575 + 10 : parseInt(this._formMap.lb);
  576 + };
  577 +
  578 + //----------------- 获取其他关联数据信息 -----------------//
  579 + /**
  580 + * 获取线路id。
  581 + * @returns {int}
  582 + */
  583 + InternalParamContext.prototype.fnGetXlId = function() {
  584 + return parseInt(this._formMap.lineName.split('_')[0]);
  585 + };
  586 + /**
  587 + * 获取停车场id。
  588 + * @returns {int}
  589 + */
  590 + InternalParamContext.prototype.fnGetTccId = function() {
  591 + return parseInt(this._formMap.tcc_id);
  592 + };
  593 + /**
  594 + * 获取时刻表id。
  595 + * @returns {int}
  596 + */
  597 + InternalParamContext.prototype.fnGetTTInfoId = function() {
  598 + return parseInt(this._formMap.skbName);
  599 + };
  600 + /**
  601 + * 获取上行起点站路由id。
  602 + * @returns {int}
  603 + */
  604 + InternalParamContext.prototype.fnGetUpQdzRouteId = function() {
  605 + return parseInt(this._dataMap.qdzArr[0]);
  606 + };
  607 + /**
  608 + * 获取上行终点站路由id。
  609 + * @returns {int}
  610 + */
  611 + InternalParamContext.prototype.fnGetUpZdzRouteId = function() {
  612 + return parseInt(this._dataMap.zdzArr[0]);
  613 + };
  614 + /**
  615 + * 获取下行起点站路由id。
  616 + * @returns {int}
  617 + */
  618 + InternalParamContext.prototype.fnGetDownQdzRouteId = function() {
  619 + return parseInt(this._dataMap.qdzArr[1]);
  620 + };
  621 + /**
  622 + * 获取下行终点站路由id。
  623 + * @returns {int}
  624 + */
  625 + InternalParamContext.prototype.fnGetDownZdzRouteId = function() {
  626 + return parseInt(this._dataMap.zdzArr[1]);
  627 + };
  628 +
  629 +
  630 +
  631 +
  632 + // TODO
  633 +
  634 + //---------------------- 静态工具方法 ---------------------//
  635 + InternalParamContext.ADDMINUTE = _fnAddMinuteToTimeObj;
  636 + InternalParamContext.TOTIMEOBJ = _fnWrapToTimeObj;
  637 +
  638 + return InternalParamContext;
  639 +}());
  640 +
  641 +// new ParamContext({}, {});
0 \ No newline at end of file 642 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2_1/SchedulePlan.js 0 → 100644
  1 +/**
  2 + * 排班计划对象。
  3 + */
  4 +var SchedulePlan = (function() {
  5 +
  6 + // 1、初始化行车计划
  7 + // 2、将连班路牌的班次补足
  8 + // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除
  9 + // 4、补吃饭班次
  10 + // 5、按照车辆投入运营要求补充班次
  11 + // 6、根据班型补充所有的不足班次
  12 + // 7、祛除上标线开头有删除标记的班次
  13 + // TODO:8、调整路牌班次间隔
  14 + // TODO:9、调整纵向班次间隔
  15 + // 10、确定末班车
  16 + // 11、祛除上标线结尾有删除标记的班次
  17 + // TODO:12、平均化指定时间后的班次列表间隔
  18 + // 13、补进出场例保班次
  19 +
  20 +
  21 + // TODO
  22 +
  23 + function InternalSchedulePlan() {
  24 +
  25 + }
  26 +
  27 + return InternalSchedulePlan;
  28 +}());
0 \ No newline at end of file 29 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2_1/Strategy.js 0 → 100644
  1 +// 策略类
  2 +var Strategy = (function() {
  3 +
  4 + //------------------ 策略函数(以下) -----------------//
  5 +
  6 + /**
  7 + * 计算班次的行驶时间。
  8 + * @param tripType {TripType} 班次类型
  9 + * @param isUp {boolean} 是否上行
  10 + * @param leaveTimeObj {moment} 发车时间
  11 + * @param pc {ParamContext} 参数上下文
  12 + * @returns {int}
  13 + */
  14 + function calcuTripRunningTime(tripType, isUp, leaveTimeObj, pc) {
  15 + if (isUp) {
  16 + if (Trip.Type.IN.fnIsEqual(tripType)) {
  17 + return pc.fnGetUpPullInTime();
  18 + } else if (Trip.Type.OUT.fnIsEqual(tripType)) {
  19 + return pc.fnGetUpPullOutTime();
  20 + } else if (Trip.Type.NORMAL.fnIsEqual(tripType)) {
  21 + if (pc.fnIsAMPeak(leaveTimeObj)) {
  22 + return pc.fnGetUpAMPeakRunningTime();
  23 + } else if (pc.fnIsPMPeak(leaveTimeObj)) {
  24 + return pc.fnGetUpPMPeakRunningTime();
  25 + } else {
  26 + return pc.fnGetUpTRunningTime();
  27 + }
  28 + } else if (Trip.Type.BD.fnIsEqual(tripType)) {
  29 + return pc.fnGetMaintenanceTime();
  30 + } else if (Trip.Type.LC.fnIsEqual(tripType)) {
  31 + return pc.fnGetMaintenanceTime();
  32 + }
  33 + } else {
  34 + if (Trip.Type.IN.fnIsEqual(tripType)) {
  35 + return pc.fnGetDownPullInTime();
  36 + } else if (Trip.Type.OUT.fnIsEqual(tripType)) {
  37 + return pc.fnGetDownPullOutTime();
  38 + } else if (Trip.Type.NORMAL.fnIsEqual(tripType)) {
  39 + if (pc.fnIsAMPeak(leaveTimeObj)) {
  40 + return pc.fnGetDownAMPeakRunningTime();
  41 + } else if (pc.fnIsPMPeak(leaveTimeObj)) {
  42 + return pc.fnGetDownPMPeakRunningTime();
  43 + } else {
  44 + return pc.fnGetDownTRunningTime();
  45 + }
  46 + } else if (Trip.Type.BD.fnIsEqual(tripType)) {
  47 + return pc.fnGetMaintenanceTime();
  48 + } else if (Trip.Type.LC.fnIsEqual(tripType)) {
  49 + return pc.fnGetMaintenanceTime();
  50 + }
  51 + }
  52 +
  53 + }
  54 +
  55 + /**
  56 + * 计算班次的行驶里程。
  57 + * @param tripType {TripType} 班次类型
  58 + * @param isUp {boolean} 是否上行
  59 + * @param leaveTimeObj {moment} 发车时间
  60 + * @param pc {ParamContext} 参数上下文
  61 + * @returns {float}
  62 + */
  63 + function calcuTripMileage(tripType, isUp, leaveTimeObj, pc) {
  64 + if (isUp) {
  65 + if (Trip.Type.IN.fnIsEqual(tripType)) {
  66 + return pc.fnGetUpPullInMileage();
  67 + } else if (Trip.Type.OUT.fnIsEqual(tripType)) {
  68 + return pc.fnGetUpPullOutMileage();
  69 + } else if (Trip.Type.NORMAL.fnIsEqual(tripType)) {
  70 + return pc.fnGetUpTripMileage();
  71 + }
  72 + } else {
  73 + if (Trip.Type.IN.fnIsEqual(tripType)) {
  74 + return pc.fnGetDownPullInMileage();
  75 + } else if (Trip.Type.OUT.fnIsEqual(tripType)) {
  76 + return pc.fnGetDownPullOutMileage();
  77 + } else if (Trip.Type.NORMAL.fnIsEqual(tripType)) {
  78 + return pc.fnGetDownTripMileage();
  79 + }
  80 + }
  81 +
  82 + // TODO:其他班次类型再议
  83 + }
  84 +
  85 + /**
  86 + * 计算班次Layover时间范围。
  87 + * @param arriveTimeObj {moment} 到达时间对象
  88 + * @param isUp {boolean} 是否上行
  89 + * @param runningTime {int} 班次行驶时间
  90 + * @param pc {ParamContext} 参数上下文
  91 + * @returns int[] 两个元素,一个最小停站时间-分钟,一个最大停站时间-分钟
  92 + */
  93 + function calcuTripLayoverTimeRange(arriveTimeObj, isUp, runningTime, pc) {
  94 + var _aLayoverTime = [];
  95 +
  96 + var _iMinLayoverTime = 0;
  97 + var _iMaxlayoverTime = 0;
  98 +
  99 + if (pc.fnIsTwoDirStop() || isUp != pc.fnIsUpDirStop()) {
  100 + // 主站停站
  101 + // 早晚高峰,行驶时间的10%-15%,最少3分钟
  102 + // 低谷,行驶时间的15%-20%,最少10分钟
  103 + if (pc.fnIsAMPeak(arriveTimeObj) || pc.fnIsPMPeak(arriveTimeObj)) {
  104 + _iMinLayoverTime = Math.floor(runningTime * 0.1);
  105 + _iMaxlayoverTime = Math.floor(runningTime * 0.15);
  106 + if (_iMaxlayoverTime < 3) {
  107 + _iMinLayoverTime = 3;
  108 + _iMaxlayoverTime = 3;
  109 + }
  110 + } else {
  111 + _iMinLayoverTime = Math.floor(runningTime * 0.15);
  112 + _iMaxlayoverTime = Math.floor(runningTime * 0.20);
  113 + if (_iMaxlayoverTime < 10) {
  114 + _iMinLayoverTime = 10;
  115 + _iMaxlayoverTime = 10;
  116 + }
  117 + }
  118 + } else {
  119 + // 副站停站
  120 + // 所有时间段,1-3分钟
  121 + _iMinLayoverTime = 1;
  122 + _iMaxlayoverTime = 3;
  123 + }
  124 +
  125 + _aLayoverTime.push(_iMinLayoverTime);
  126 + _aLayoverTime.push(_iMaxlayoverTime);
  127 + return _aLayoverTime;
  128 + }
  129 +
  130 + /**
  131 + * 计算Layover时间。
  132 + * @param arriveTimeObj {moment} 班次到达时间
  133 + * @param isUp {boolean} 是否上行
  134 + * @param aRangeTime {array} Layover时间范围
  135 + * @param pc {ParamContext} 参数上下文
  136 + * @returns {int}
  137 + */
  138 + function calcuTripLayoverTime(arriveTimeObj, isUp, aRangeTime, pc) {
  139 + // 使用平均时间计算Layover时间
  140 + return Math.floor((aRangeTime[0] + aRangeTime[1]) / 2);
  141 + }
  142 +
  143 + /**
  144 + * 计算早高峰周转时间(需要关联其他策略)。
  145 + * @param sConfig {InternalStrategyConfig} 行驶时间策略函数
  146 + * @param pc {ParamContext} 参数上行文
  147 + * @returns {int}
  148 + */
  149 + function calcuAMPeakRoundTripsCycleTime(sConfig, pc) {
  150 + var _oTime = pc.fnGetAMPeakFromTimeObj();
  151 + var _iUpRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  152 + Trip.Type.NORMAL, true, _oTime, pc);
  153 + var _aUpLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  154 + _oTime, true, _iUpRT, pc);
  155 + var _iUpLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  156 + _oTime, true, _aUpLTRange, pc
  157 + );
  158 + var _iDownRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  159 + Trip.Type.NORMAL, true, _oTime, pc);
  160 + var _aDownLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  161 + _oTime, false, _iDownRT, pc);
  162 + var _iDownLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  163 + _oTime, false, _aDownLTRange, pc
  164 + );
  165 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  166 + }
  167 +
  168 + /**
  169 + * 计算晚高峰周转时间(需要关联其他策略)。
  170 + * @param sConfig {InternalStrategyConfig} 行驶时间策略函数
  171 + * @param pc {ParamContext} 参数上行文
  172 + * @returns {int}
  173 + */
  174 + function calcuPMPeakRoundTripsCycleTime(sConfig, pc) {
  175 + var _oTime = pc.fnGetPMPeakFromTimeObj();
  176 + var _iUpRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  177 + Trip.Type.NORMAL, true, _oTime, pc);
  178 + var _aUpLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  179 + _oTime, true, _iUpRT, pc);
  180 + var _iUpLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  181 + _oTime, true, _aUpLTRange, pc
  182 + );
  183 + var _iDownRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  184 + Trip.Type.NORMAL, true, _oTime, pc);
  185 + var _aDownLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  186 + _oTime, false, _iDownRT, pc);
  187 + var _iDownLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  188 + _oTime, false, _aDownLTRange, pc
  189 + );
  190 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  191 + }
  192 +
  193 + /**
  194 + * 计算晚低谷周转时间(需要关联其他策略)。
  195 + * @param sConfig {InternalStrategyConfig} 策略对象
  196 + * @param pc {ParamContext} 参数上行文
  197 + * @returns {int}
  198 + */
  199 + function calcuTroughRoundTripsCycleTime(sConfig, pc) {
  200 + var _oTime = ParamContext.ADDMINUTE(pc.fnGetAMPeakFromTimeObj(), -1);
  201 + var _iUpRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  202 + Trip.Type.NORMAL, true, _oTime, pc);
  203 + var _aUpLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  204 + _oTime, true, _iUpRT, pc);
  205 + var _iUpLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  206 + _oTime, true, _aUpLTRange, pc
  207 + );
  208 + var _iDownRT = sConfig.sFn("CALCU_TRIP_R_TIME")(
  209 + Trip.Type.NORMAL, true, _oTime, pc);
  210 + var _aDownLTRange = sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  211 + _oTime, false, _iDownRT, pc);
  212 + var _iDownLT = sConfig.sFn("CALCU_TRIP_L_TIME")(
  213 + _oTime, false, _aDownLTRange, pc
  214 + );
  215 + return _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  216 + }
  217 +
  218 + /**
  219 + * 计算所需的车辆数。
  220 + * @param sConfig {InternalStrategyConfig} 策略对象
  221 + * @param pc {ParamContext} 参数上行文
  222 + * @returns {int}
  223 + */
  224 + function calcuVehicleCount : function(sConfig, pc) {
  225 + // 计算早高峰车辆数(使用平均间隔)
  226 + var _iAMPeakFcjx_avg = (pc.fnGetAMPeakMinHeadway() + pc.fnGetAMPeakMaxHeadway()) / 2;
  227 + var _iAMPeakRCTime = sConfig.sFn("CALCU_AM_P_ROUND_TRIPS_C_TIME")(sConfig, pc);
  228 + var _iAMPeakVehicleCount = _iAMPeakRCTime / _iAMPeakFcjx_avg;
  229 +
  230 + // 计算晚高峰车辆数 (使用平均间隔)
  231 + var _iPMPeakFcjx_avg = (pc.fnGetPMPeakMinHeadway() + pc.fnGetPMPeakMaxHeadway()) / 2;
  232 + var _iPMPeakRCTime = sConfig.sFn("CALCU_AM_P_ROUND_TRIPS_C_TIME")(sConfig, pc);
  233 + var _iPMPeakVehicleCount = _iPMPeakRCTime / _iPMPeakFcjx_avg;
  234 +
  235 + // 取最大值为最终车辆数
  236 + // 大于或等于的最小整数,人话就是有小数点就加1
  237 + if (_iAMPeakVehicleCount > _iPMPeakVehicleCount) {
  238 + return Math.ceil(_iAMPeakVehicleCount);
  239 + } else {
  240 + return Math.ceil(_iPMPeakVehicleCount);
  241 + }
  242 +
  243 + }
  244 +
  245 + /**
  246 + * 创建班次策略。
  247 + * @param tripType {TripType} 班次类型
  248 + * @param isUp {boolean} 是否上行
  249 + * @param leaveTimeObj {moment} 发车时间对象
  250 + * @param sConfig {InternalStrategyConfig} 策略对象
  251 + * @param pc {ParamContext} 参数上下文
  252 + * @returns {Trip}
  253 + */
  254 + function createTrip(tripType, isUp, leaveTimeObj, sConfig, pc) {
  255 + var _oTripType = tripType;
  256 + var _bIsUpDir = isUp;
  257 + var _oLeaveTime = leaveTimeObj;
  258 + var _iRunningTime = sConfig.sFn("CALCU_TRIP_R_TIME")(
  259 + _oTripType, _bIsUpDir, _oLeaveTime, pc
  260 + );
  261 + var _oArriveTime = ParamContext.ADDMINUTE(_oLeaveTime, _iRunningTime);
  262 + var _iLayoverTime = sConfig.sFn("CALCU_TRIP_L_TIME")(
  263 + _oArriveTime, _oTripType,
  264 + sConfig.sFn("CALCU_TRIP_L_TIME_RANGE")(
  265 + _oArriveTime, _bIsUpDir, _iRunningTime, pc
  266 + ),
  267 + pc
  268 + );
  269 + var _iRecoveryTime = 0;
  270 + var _iEatTime = 0;
  271 + var _fTripMileage = sConfig.sFn("CALCU_TRIP_MILE")(
  272 + _oTripType, _bIsUpDir, _oLeaveTime, pc
  273 + );
  274 +
  275 + if (Trip.Type.BD.fnIsEqual(tripType)) { // 早例保,传过来的发车时间是第一个班次的发车时间
  276 + if (_bIsUpDir) { // 上行
  277 + _oLeaveTime = ParamContext.ADDMINUTE(
  278 + _oLeaveTime,
  279 + -(pc.fnGetUpPullOutTime() + pc.fnGetMaintenanceTime())
  280 + );
  281 + _iLayoverTime = 0;
  282 + } else { // 下行
  283 + _oLeaveTime = ParamContext.ADDMINUTE(
  284 + _oLeaveTime,
  285 + -(pc.fnGetDownPullOutTime() + pc.fnGetMaintenanceTime())
  286 + );
  287 + _iLayoverTime = 0;
  288 + }
  289 + } else if (Trip.Type.LC.fnIsEqual(tripType)) { // 晚例保,传过来的发车时间是最后一个班次的到达时间
  290 + if (_bIsUpDir) { // 上行
  291 + _oLeaveTime = ParamContext.ADDMINUTE(
  292 + _oLeaveTime,
  293 + pc.fnGetUpPullInTime()
  294 + );
  295 + _iLayoverTime = 0;
  296 + } else { // 下行
  297 + _oLeaveTime = ParamContext.ADDMINUTE(
  298 + _oLeaveTime,
  299 + pc.fnGetDownPullInTime()
  300 + );
  301 + _iLayoverTime = 0;
  302 + }
  303 + } else if (Trip.Type.OUT.fnIsEqual(tripType)) { // 出场,传过来的发车时间是第一个班次的发车时间
  304 + if (_bIsUpDir) { // 上行
  305 + _oLeaveTime = ParamContext.ADDMINUTE(
  306 + _oLeaveTime,
  307 + -pc.fnGetUpPullOutTime()
  308 + );
  309 + _iLayoverTime = 0;
  310 + } else { // 下行
  311 + _oLeaveTime = ParamContext.ADDMINUTE(
  312 + _oLeaveTime,
  313 + -pc.fnGetDownPullOutTime()
  314 + );
  315 + _iLayoverTime = 0;
  316 + }
  317 + } else if (Trip.Type.IN.fnIsEqual(tripType)) { // 进场,传过来的发车时间是最后一个班次的到达时间
  318 + if (_bIsUpDir) { // 上行
  319 + _iLayoverTime = 0;
  320 + } else { // 下行
  321 + _iLayoverTime = 0;
  322 + }
  323 + }
  324 +
  325 + return new Trip(
  326 + _oTripType,
  327 + _bIsUpDir,
  328 + _oLeaveTime, _oArriveTime, _iRunningTime,
  329 + _iLayoverTime, _iRecoveryTime, _iEatTime,
  330 + _fTripMileage,
  331 + pc
  332 + );
  333 +
  334 + }
  335 +
  336 + // TODO
  337 +
  338 + //------------------ 策略函数(以上) -----------------//
  339 +
  340 + /**
  341 + * 内部策略配置封装类。
  342 + * @constructor
  343 + */
  344 + function InternalStrategyConfig() {
  345 + // 策略函数对应,每个函数都由一个标识符号对应,类似配置函数
  346 + this._oSTRATIGIS = {
  347 + "CALCU_TRIP_R_TIME" : calcuTripRunningTime,
  348 + "CALCU_TRIP_MILE" : calcuTripMileage,
  349 + "CALCU_TRIP_L_TIME_RANGE" : calcuTripLayoverTimeRange,
  350 + "CALCU_TRIP_L_TIME" : calcuTripLayoverTime,
  351 + "CALCU_AM_P_ROUND_TRIPS_C_TIME" : calcuAMPeakRoundTripsCycleTime,
  352 + "CALCU_PM_P_ROUND_TRIPS_C_TIME" : calcuPMPeakRoundTripsCycleTime,
  353 + "CALCU_T_ROUND_TRIPS_C_TIME" : calcuTroughRoundTripsCycleTime,
  354 + "CALCU_V_COUNT" : calcuVehicleCount,
  355 + "CREATE_TRIP" : createTrip
  356 +
  357 +
  358 + // TODO
  359 + };
  360 +
  361 + }
  362 +
  363 + /**
  364 + * 返回策略函数
  365 + * @param str 标识
  366 + * @returns {function}
  367 + */
  368 + InternalStrategyConfig.prototype.sFn = function(str) {
  369 + if (!this._oSTRATIGIS[str]) {
  370 + throw "指定标识" + str + "策略函数不存在!";
  371 + }
  372 + return this._oSTRATIGIS[str];
  373 + };
  374 + /**
  375 + * 替换策略配置
  376 + * @param str 策略函数标识
  377 + * @param fn 策略函数
  378 + */
  379 + InternalStrategyConfig.prototype.sConfig = function(str, fn) {
  380 + this._oSTRATIGIS[str] = fn;
  381 + };
  382 +
  383 +
  384 + return InternalStrategyConfig;
  385 +
  386 +}());
0 \ No newline at end of file 387 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2_1/Trip.js 0 → 100644
  1 +/**
  2 + * 班次对象。
  3 + */
  4 +var Trip = (function() {
  5 +
  6 + var _oTripType = {
  7 + "normal" : "normal", // 正常班次
  8 + "bd" : "bd", // 早例保班次
  9 + "lc" : "lc", // 晚例保班次
  10 + "out" : "out", // 出场班次
  11 + "in" : "in_", // 进场班次
  12 + "cf" : "cf" // 吃饭班次
  13 + };
  14 +
  15 + /**
  16 + * 班次类型对象
  17 + * @param sType
  18 + * @constructor
  19 + */
  20 + function TripType(sType) {
  21 + if (!_oTripType[sType]) {
  22 + throw "未知的班次类型=" + sType;
  23 + }
  24 + this._sTripType = _oTripType[sType];
  25 + }
  26 +
  27 + /**
  28 + * 返回班次类型内部描述string。
  29 + * @returns {string}
  30 + */
  31 + TripType.prototype.fnGetType = function() {
  32 + return this._sTripType;
  33 + };
  34 + /**
  35 + * 判定类型是否相等。
  36 + * @param tripType {TripType}
  37 + * @returns {boolean}
  38 + */
  39 + TripType.prototype.fnIsEqual = function(tripType) {
  40 + if (this === tripType) {
  41 + return true;
  42 + } else {
  43 + return this.fnGetType() == tripType.fnGetType();
  44 + }
  45 + };
  46 + TripType.BD = new TripType("bd");
  47 + TripType.NORMAL = new TripType("normal");
  48 + TripType.LC = new TripType("lc");
  49 + TripType.IN = new TripType("in");
  50 + TripType.OUT = new TripType("out");
  51 + TripType.CF = new TripType("cf");
  52 +
  53 + /**
  54 + * 班次对象。
  55 + * @param tripType {TripType} 班次类型
  56 + * @param isUpDir {boolean} 是否上行
  57 + * @param leaveTimeObj {moment} 发车时间
  58 + * @param arriveTimeObj {moment} 到达时间
  59 + * @param runningTime {int} 行驶时间
  60 + * @param layoverTime {int} 到达后的停站时间
  61 + * @param recoveryTime {int} 发车前的停站时间
  62 + * @param eatTime {int} 吃饭时间
  63 + * @param tripMileage {float} 行驶里程
  64 + * @param pc {ParamContext} 参数上下文
  65 + * @constructor
  66 + */
  67 + function Trip(
  68 + tripType,
  69 + isUpDir,
  70 + leaveTimeObj, arriveTimeObj, runningTime,
  71 + layoverTime, recoveryTime, eatTime,
  72 + tripMileage,
  73 + pc
  74 + ) {
  75 + this._oTripType = tripType;
  76 + this._bIsUpDir = isUpDir;
  77 + this._oLeaveTime = leaveTimeObj;
  78 + this._oArriveTime = arriveTimeObj;
  79 + this._iRunningTime = runningTime;
  80 + this._iLayoverTime = layoverTime;
  81 + this._iRecoveryTime = recoveryTime;
  82 + this._iEatTime = eatTime;
  83 + this._fTripMileage = tripMileage;
  84 + this._oPc = pc;
  85 +
  86 +
  87 +
  88 + // TODO:
  89 +
  90 +
  91 + }
  92 +
  93 + /**
  94 + * 转换生成gantt显示的班次对象。
  95 + * @param lpNo {string} 路牌编号
  96 + * @param lpName {string} 路牌名字
  97 + * @param fcno {int} 发车顺序号
  98 + * @param isfb {boolean} 是否分班
  99 + */
  100 + Trip.prototype.fnToGanttBcObj = function(lpNo, lpName, fcno, isfb) {
  101 + var _bcObj = {
  102 + parent: lpNo,
  103 + lpNo: lpNo,
  104 + lp: null,
  105 + lpName: lpName,
  106 + lpType: '普通路牌',
  107 + bcType: this._oTripType.fnGetType(),
  108 + fcno: fcno,
  109 + isfb: isfb ? 1 : 0,
  110 + isSwitchXl: null,
  111 + bz: null
  112 + };
  113 +
  114 + // 线路上下行
  115 + _bcObj.xlDir = this._bIsUpDir ? "relationshipGraph-up" : "relationshipGraph-down";
  116 +
  117 + // 里程
  118 + _bcObj.jhlc = this._fTripMileage;
  119 +
  120 + // 停车场
  121 + _bcObj.tcc = this._oPc.fnGetTccId();
  122 +
  123 + // 时刻表
  124 + _bcObj.ttinfo = this._oPc.fnGetTTInfoId();
  125 +
  126 + // 线路
  127 + _bcObj.xl = this._oPc.fnGetXlId();
  128 +
  129 + // 起点站、终点站
  130 + _bcObj.qdz = this._bIsUpDir ? this._oPc.fnGetUpQdzRouteId() : this._oPc.fnGetDownQdzRouteId();
  131 + _bcObj.zdz = this._bIsUpDir ? this._oPc.fnGetUpZdzRouteId() : this._oPc.fnGetDownZdzRouteId();
  132 +
  133 + // 发车时间,行驶时间,到达时间,停站时间
  134 + _bcObj.fcsj = this._oLeaveTime.format("HH:mm");
  135 + _bcObj.bcsj = this._iRunningTime;
  136 + _bcObj.ARRIVALTIME = this._oArriveTime.format("HH:mm");
  137 + _bcObj.STOPTIME = this._iLayoverTime;
  138 +
  139 + return _bcObj;
  140 + };
  141 +
  142 + // 班次类型
  143 + Trip.Type = TripType;
  144 +
  145 +
  146 + return Trip;
  147 +}());
0 \ No newline at end of file 148 \ No newline at end of file
src/main/resources/static/pages/permission/authorize_all/user_auth.html
@@ -131,7 +131,8 @@ @@ -131,7 +131,8 @@
131 <script id="authorize-user-auth-title-temp" type="text/html"> 131 <script id="authorize-user-auth-title-temp" type="text/html">
132 <div style="font-weight: 600;">{{name}}({{userName}}) 132 <div style="font-weight: 600;">{{name}}({{userName}})
133 </div> 133 </div>
134 - <div class="desc">最近登录 {{lastLoginDateStr}}</div> 134 + <!--<div class="desc">最近登录 {{lastLoginDateStr}}</div>-->
  135 + <div class="desc">...</div>
135 </script> 136 </script>
136 137
137 <script id="authorize-modal-lines-temp" type="text/html"> 138 <script id="authorize-modal-lines-temp" type="text/html">
src/main/resources/static/real_control_v2/css/main.css
@@ -2076,4 +2076,9 @@ dl.active &gt; dd.disabled { @@ -2076,4 +2076,9 @@ dl.active &gt; dd.disabled {
2076 2076
2077 .warn_multi_station:hover{ 2077 .warn_multi_station:hover{
2078 background: #f8f81e; 2078 background: #f8f81e;
  2079 +}
  2080 +
  2081 +.tp_info_icon{
  2082 + font-size: 14px;
  2083 + cursor: pointer;
2079 } 2084 }
2080 \ No newline at end of file 2085 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/tzrc.html
@@ -285,11 +285,11 @@ @@ -285,11 +285,11 @@
285 }); 285 });
286 286
287 function check_fgs_ascription(data, cb) { 287 function check_fgs_ascription(data, cb) {
288 - var jGh = data.jsy.split('/')[0]  
289 - ,sGh  
290 - ,nbbm = data.clZbh; 288 + var jGh,sGh,nbbm = data.clZbh;
291 if(data.spy) 289 if(data.spy)
292 sGh = data.spy.split('/')[0]; 290 sGh = data.spy.split('/')[0];
  291 + if(data.jsy)
  292 + jGh = data.jsy.split('/')[0];
293 293
294 gb_common.$post('/realSchedule/check_fgs_ascription',{ 294 gb_common.$post('/realSchedule/check_fgs_ascription',{
295 schId: data.schId, 295 schId: data.schId,
@@ -298,7 +298,7 @@ @@ -298,7 +298,7 @@
298 nbbm: nbbm 298 nbbm: nbbm
299 } 299 }
300 , function (rs) { 300 , function (rs) {
301 - $('form.tzrc_form [type=submit]', modal).removeAttr('disabled'); 301 + //$('form.tzrc_form [type=submit]', modal).removeAttr('disabled');
302 if(rs['checkStatus']==1) 302 if(rs['checkStatus']==1)
303 cb && cb(); 303 cb && cb();
304 else if (rs['checkStatus']==-2){ 304 else if (rs['checkStatus']==-2){
src/main/resources/static/real_control_v2/fragments/line_schedule/layout.html
@@ -48,11 +48,12 @@ @@ -48,11 +48,12 @@
48 <ul class="uk-list uk-list-line" style="margin-bottom: 0;"> 48 <ul class="uk-list uk-list-line" style="margin-bottom: 0;">
49 {{each list as obj i}} 49 {{each list as obj i}}
50 {{if obj.realStationCode!=null}} 50 {{if obj.realStationCode!=null}}
51 - <li>【{{obj.stationName}}】班次编码 <span style="color: red;">{{obj.stationCode}}</span> -实际:{{obj.realStationCode}}</li> 51 + <li>【{{obj.stationName}}】班次用的站点 <span style="color: red;">{{obj.stationCode}}</span> -实际:{{obj.realStationCode}}</li>
52 {{else}} 52 {{else}}
53 - <li>【{{obj.stationName}}】班次编码 <span style="color: red;">{{obj.stationCode}}</span> -在当前线路站点中不存在</li> 53 + <li>【{{obj.stationName}}】班次用的站点 <span style="color: red;">{{obj.stationCode}}</span> -在站点路由中不存在的</li>
54 {{/if}} 54 {{/if}}
55 {{/each}} 55 {{/each}}
  56 +
56 </ul> 57 </ul>
57 </div> 58 </div>
58 </script> 59 </script>
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
@@ -24,6 +24,8 @@ @@ -24,6 +24,8 @@
24 </div> 24 </div>
25 </div> 25 </div>
26 <i class="uk-icon-eye uk-icon-hover ct_eye_icon"></i> 26 <i class="uk-icon-eye uk-icon-hover ct_eye_icon"></i>
  27 + <!--<i class="uk-icon-share-alt uk-icon-hover tp_info_icon" ></i>-->
  28 +
27 <span class="warn_multi_station" data-updown="{{dir}}" data-code="{{line.lineCode}}"></span> 29 <span class="warn_multi_station" data-updown="{{dir}}" data-code="{{line.lineCode}}"></span>
28 <div class="search_sch_panel"> 30 <div class="search_sch_panel">
29 <form class="uk-form" onsubmit="javascript:return false;"> 31 <form class="uk-form" onsubmit="javascript:return false;">
src/main/resources/static/real_control_v2/js/line_schedule/layout.js
@@ -64,8 +64,6 @@ var gb_line_layout = (function() { @@ -64,8 +64,6 @@ var gb_line_layout = (function() {
64 var lineCode = $(this).data('code') 64 var lineCode = $(this).data('code')
65 ,updown = $(this).data('updown') 65 ,updown = $(this).data('updown')
66 ,list = gb_schedule_table.findSCodeErrorInfo(lineCode, updown); 66 ,list = gb_schedule_table.findSCodeErrorInfo(lineCode, updown);
67 - //console.log('this', this);  
68 - //var data = gb_schedule_table.findSCodeErrorInfo();  
69 return temps['sch-table-m_station_error-temp']({list: list}); 67 return temps['sch-table-m_station_error-temp']({list: list});
70 } 68 }
71 }, 69 },
@@ -90,6 +88,38 @@ var gb_line_layout = (function() { @@ -90,6 +88,38 @@ var gb_line_layout = (function() {
90 }); 88 });
91 }); 89 });
92 90
  91 +
  92 + $(document).on('mouseenter', '.schedule-wrap .header-title i.tp_info_icon', function() {
  93 + $(this).qtip({
  94 + show: {
  95 + ready: true,
  96 + delay: 200
  97 + },
  98 + content: {
  99 + text: '点击展开车辆套跑信息'
  100 + },
  101 + position: {
  102 + viewport: $(window),
  103 + my: 'bottom center',
  104 + at: 'top center'
  105 + },
  106 + style: {
  107 + classes: 'qtip-rounded qtip-shadow '
  108 + },
  109 + hide: {
  110 + fixed: true,
  111 + delay: 300
  112 + },
  113 + events: {
  114 + hidden: function(event, api) {
  115 + //destroy dom
  116 + $(this).qtip('destroy', true);
  117 + }
  118 + }
  119 + });
  120 + });
  121 +
  122 +
93 return { 123 return {
94 layout: layout 124 layout: layout
95 }; 125 };
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -825,6 +825,10 @@ var gb_schedule_table = (function () { @@ -825,6 +825,10 @@ var gb_schedule_table = (function () {
825 var k; 825 var k;
826 for(var i=0,obj;obj=list[i++];){ 826 for(var i=0,obj;obj=list[i++];){
827 k = obj.lineCode+'_'+obj.upDown; 827 k = obj.lineCode+'_'+obj.upDown;
  828 +
  829 + if(obj.realStationCode && obj.realStationCode.indexOf('^') != -1)
  830 + obj.realStationCode = obj.realStationCode.split('^')[0];
  831 +
828 if(!data[k]) 832 if(!data[k])
829 data[k] = []; 833 data[k] = [];
830 data[k].push(obj); 834 data[k].push(obj);
@@ -837,7 +841,7 @@ var gb_schedule_table = (function () { @@ -837,7 +841,7 @@ var gb_schedule_table = (function () {
837 continue; 841 continue;
838 842
839 $(".schedule-wrap span.warn_multi_station[data-updown="+(k.split('_')[1])+"]", wrap) 843 $(".schedule-wrap span.warn_multi_station[data-updown="+(k.split('_')[1])+"]", wrap)
840 - .html('班次站点编码与实际不符!!!').show(); 844 + .html('o(* ̄▽ ̄*)o 班次和站点关联有点问题!!').show();
841 } 845 }
842 846
843 errorCodeData = data; 847 errorCodeData = data;
src/main/resources/static/real_control_v2/js/main.js
@@ -47,7 +47,7 @@ var gb_main_ep = new EventProxy(), @@ -47,7 +47,7 @@ var gb_main_ep = new EventProxy(),
47 $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); 47 $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html');
48 }, 1000); 48 }, 1000);
49 //弹出更新说明 49 //弹出更新说明
50 - //showUpdateDescription(); 50 + showUpdateDescription();
51 }); 51 });
52 52
53 function g_emit(id) { 53 function g_emit(id) {
@@ -168,8 +168,8 @@ var disabled_submit_btn = function (form) { @@ -168,8 +168,8 @@ var disabled_submit_btn = function (form) {
168 function showUpdateDescription() { 168 function showUpdateDescription() {
169 //更新说明 169 //更新说明
170 var updateDescription = { 170 var updateDescription = {
171 - date: '2017-11-25_中午',  
172 - text: '<h5>1、修复这个版本的一个问题,这个问题导致首站和第二站重叠的时候无法发车。</h5><h5>2、修复455路因 昌邑路民生路 和 昌邑路苗圃路 站点顺序颠倒引发的上下行跳动问题。</h5><h5>3、放宽对中途站的检测机制,如果仍然有线路出现上下行乱跳的问题,及时上报管理员。</h5>' 171 + date: '...',
  172 + text: '<h5 style="line-height: 25px;letter-spacing: 1px;font-family: 微软雅黑;"> <span style="font-weight: 600;color: #ff0505;">修复了一个bug。</span><br><hr>该bug导致“调整人车”时,提交按钮可快速的重复点击(<small style="color: #6a6a6a;">提交按钮被误解锁</small>)。<br>有一定几率引起查询故障,导致线调页面看不到班次信息。</h5>'
173 }; 173 };
174 174
175 var storage = window.localStorage 175 var storage = window.localStorage
@@ -177,10 +177,10 @@ function showUpdateDescription() { @@ -177,10 +177,10 @@ function showUpdateDescription() {
177 var text = storage.getItem(key); 177 var text = storage.getItem(key);
178 if (!text) { 178 if (!text) {
179 var modal = '<div class="uk-modal" id="update-description-modal">' + 179 var modal = '<div class="uk-modal" id="update-description-modal">' +
180 - ' <div class="uk-modal-dialog">' + 180 + ' <div class="uk-modal-dialog" >' +
181 ' <a class="uk-modal-close uk-close"></a>' + 181 ' <a class="uk-modal-close uk-close"></a>' +
182 ' <div class="uk-modal-header">' + 182 ' <div class="uk-modal-header">' +
183 - ' <h2>' + updateDescription.date + ' 更新说明</h2></div>' + updateDescription.text + 183 + ' <h2>' + updateDescription.date + '</h2></div>' + updateDescription.text +
184 ' </div>'; 184 ' </div>';
185 185
186 show_modal('#update-description-modal', modal); 186 show_modal('#update-description-modal', modal);