Commit 3ced2fc6fb8d0ffc16e3f7d9fd156ab94b269535
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong
Showing
37 changed files
with
6861 additions
and
7071 deletions
src/main/java/com/bsth/XDApplication.java
| @@ -160,7 +160,7 @@ public class XDApplication implements CommandLineRunner { | @@ -160,7 +160,7 @@ public class XDApplication implements CommandLineRunner { | ||
| 160 | 160 | ||
| 161 | /** 线调业务 */ | 161 | /** 线调业务 */ |
| 162 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | 162 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| 163 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点 | 163 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 |
| 164 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 | 164 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 |
| 165 | sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | 165 | sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 |
| 166 | 166 |
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
| @@ -89,6 +89,8 @@ public class ServiceDataInterface { | @@ -89,6 +89,8 @@ public class ServiceDataInterface { | ||
| 89 | map.put("remarks", sch.getRemark()); | 89 | map.put("remarks", sch.getRemark()); |
| 90 | map.put("status", sch.getStatus()); | 90 | map.put("status", sch.getStatus()); |
| 91 | 91 | ||
| 92 | + //放站班次,放到的站点 | ||
| 93 | + map.put("majorStationName", sch.getMajorStationName()); | ||
| 92 | rs.add(map); | 94 | rs.add(map); |
| 93 | } | 95 | } |
| 94 | return rs; | 96 | return rs; |
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| @@ -146,8 +146,8 @@ public class InStationProcess { | @@ -146,8 +146,8 @@ public class InStationProcess { | ||
| 146 | dayOfSchedule.removeExecPlan(nbbm); | 146 | dayOfSchedule.removeExecPlan(nbbm); |
| 147 | 147 | ||
| 148 | //通知误点停靠程序,有车辆到站 | 148 | //通知误点停靠程序,有车辆到站 |
| 149 | - //LateAdjustHandle.carArrive(gps, next); | ||
| 150 | - LateAdjustHandle.carArrive(gps); | 149 | + LateAdjustHandle.carArrive(gps, next); |
| 150 | + //LateAdjustHandle.carArrive(gps); | ||
| 151 | 151 | ||
| 152 | //路牌的下一个班次,页面显示起点实际到达时间 | 152 | //路牌的下一个班次,页面显示起点实际到达时间 |
| 153 | ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); | 153 | ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| 1 | 1 | ||
| 2 | package com.bsth.data.schedule.late_adjust; | 2 | package com.bsth.data.schedule.late_adjust; |
| 3 | 3 | ||
| 4 | -import com.bsth.data.BasicData; | ||
| 5 | import com.bsth.data.LineConfigData; | 4 | import com.bsth.data.LineConfigData; |
| 6 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 5 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 7 | import com.bsth.entity.realcontrol.LineConfig; | 6 | import com.bsth.entity.realcontrol.LineConfig; |
| 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 7 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | import com.bsth.util.Arith; | 8 | import com.bsth.util.Arith; |
| 10 | import com.bsth.websocket.handler.SendUtils; | 9 | import com.bsth.websocket.handler.SendUtils; |
| 11 | -import com.google.common.collect.ArrayListMultimap; | ||
| 12 | -import org.apache.commons.lang3.StringUtils; | ||
| 13 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 11 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.BeansException; | 12 | import org.springframework.beans.BeansException; |
| @@ -18,7 +15,8 @@ import org.springframework.context.ApplicationContextAware; | @@ -18,7 +15,8 @@ import org.springframework.context.ApplicationContextAware; | ||
| 18 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 19 | 16 | ||
| 20 | import java.util.Collection; | 17 | import java.util.Collection; |
| 21 | -import java.util.List; | 18 | +import java.util.concurrent.ConcurrentHashMap; |
| 19 | +import java.util.concurrent.ConcurrentMap; | ||
| 22 | 20 | ||
| 23 | /** | 21 | /** |
| 24 | * 误点自动调整待发 处理程序 | 22 | * 误点自动调整待发 处理程序 |
| @@ -35,17 +33,11 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -35,17 +33,11 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 35 | static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class); | 33 | static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class); |
| 36 | 34 | ||
| 37 | /** | 35 | /** |
| 38 | - * 应发未到车辆 和 班次 | ||
| 39 | - * <p> | ||
| 40 | - * 起点相同的,保留最后一个班次 | 36 | + * 应发未到的班次 key : id |
| 41 | */ | 37 | */ |
| 42 | - private static ArrayListMultimap lateSchMaps; | 38 | + private static ConcurrentMap<Long, ScheduleRealInfo> lateSchMap = new ConcurrentHashMap<>(); |
| 43 | 39 | ||
| 44 | 40 | ||
| 45 | - static { | ||
| 46 | - lateSchMaps = ArrayListMultimap.create(); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | /** | 41 | /** |
| 50 | * 新增一个误点班次 | 42 | * 新增一个误点班次 |
| 51 | * | 43 | * |
| @@ -65,15 +57,14 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -65,15 +57,14 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 65 | if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0 | 57 | if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0 |
| 66 | && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) { | 58 | && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) { |
| 67 | 59 | ||
| 68 | - ScheduleRealInfo old = popLateSch(sch); | ||
| 69 | - | ||
| 70 | - //班次被压入 | ||
| 71 | - if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) { | 60 | + //班次压入 |
| 61 | + if (!lateSchMap.containsKey(sch.getId())) { | ||
| 62 | + logger.info("29【应发未到 班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 72 | 63 | ||
| 73 | - logger.info("21【应发未到 -多个(" + lateSchMaps.get(sch.getClZbh()).size() + ")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 74 | - //通知客户端 | ||
| 75 | sch.setLate2(true); | 64 | sch.setLate2(true); |
| 76 | - sendUtils.sendAutoWdtz(sch, old); | 65 | + lateSchMap.put(sch.getId(), sch); |
| 66 | + //通知客户端 | ||
| 67 | + sendUtils.sendAutoWdtz(sch, null); | ||
| 77 | } | 68 | } |
| 78 | } | 69 | } |
| 79 | 70 | ||
| @@ -82,51 +73,6 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -82,51 +73,6 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 82 | } | 73 | } |
| 83 | } | 74 | } |
| 84 | 75 | ||
| 85 | - /** | ||
| 86 | - * 压入新的误点班次 | ||
| 87 | - * | ||
| 88 | - * @param sch | ||
| 89 | - * @return 返回被移除的误点班次 | ||
| 90 | - */ | ||
| 91 | - private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) { | ||
| 92 | - List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh()); | ||
| 93 | - | ||
| 94 | - if (null == list || list.size() == 0) | ||
| 95 | - lateSchMaps.put(sch.getClZbh(), sch); | ||
| 96 | - else { | ||
| 97 | - ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName(), ""); | ||
| 98 | - | ||
| 99 | - if (null == old) | ||
| 100 | - lateSchMaps.put(sch.getClZbh(), sch); | ||
| 101 | - else if (old.getDfsjT() < sch.getDfsjT()) { | ||
| 102 | - //同一个起点,保留时间最大的班次 | ||
| 103 | - lateSchMaps.remove(old.getClZbh(), old); | ||
| 104 | - lateSchMaps.put(sch.getClZbh(), sch); | ||
| 105 | - | ||
| 106 | - logger.info(sch.getClZbh() + "【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | ||
| 107 | - return old; | ||
| 108 | - } | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - return null; | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - /** | ||
| 115 | - * 搜索同样起点的班次 | ||
| 116 | - * | ||
| 117 | - * @param list | ||
| 118 | - * @return | ||
| 119 | - */ | ||
| 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)) | ||
| 125 | - return item; | ||
| 126 | - } | ||
| 127 | - return null; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | 76 | ||
| 131 | /** | 77 | /** |
| 132 | * 获取所有应发未到的班次 | 78 | * 获取所有应发未到的班次 |
| @@ -134,13 +80,13 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -134,13 +80,13 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 134 | * @return | 80 | * @return |
| 135 | */ | 81 | */ |
| 136 | public static Collection<ScheduleRealInfo> allLateSch() { | 82 | public static Collection<ScheduleRealInfo> allLateSch() { |
| 137 | - return lateSchMaps.values(); | 83 | + return lateSchMap.values(); |
| 138 | } | 84 | } |
| 139 | 85 | ||
| 140 | public static void remove(ScheduleRealInfo sch) { | 86 | public static void remove(ScheduleRealInfo sch) { |
| 141 | try { | 87 | try { |
| 142 | - if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) { | ||
| 143 | - lateSchMaps.remove(sch.getClZbh(), sch); | 88 | + if (lateSchMap.containsKey(sch.getId())) { |
| 89 | + lateSchMap.remove(sch.getId()); | ||
| 144 | 90 | ||
| 145 | sch.setLate2(false); | 91 | sch.setLate2(false); |
| 146 | sch.setLateMinute(0); | 92 | sch.setLateMinute(0); |
| @@ -154,61 +100,47 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -154,61 +100,47 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 154 | } | 100 | } |
| 155 | 101 | ||
| 156 | /** | 102 | /** |
| 157 | - * 车辆到站 | 103 | + * 车辆到站 进站 进 的哪个班次,就调该车辆的下一个班次 |
| 158 | * | 104 | * |
| 159 | * @param gps | 105 | * @param gps |
| 160 | */ | 106 | */ |
| 161 | - public static void carArrive(GpsEntity gps) { | 107 | + public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) { |
| 162 | try { | 108 | try { |
| 163 | - if (gps.getInstation() <= 0) { | ||
| 164 | - return; | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm()); | ||
| 168 | - | ||
| 169 | - if (null == list || list.size() == 0) | 109 | + if (gps.getInstation() <= 0 || null == sch) |
| 170 | return; | 110 | return; |
| 171 | 111 | ||
| 112 | + if (!lateSchMap.containsKey(sch.getId())) { | ||
| 113 | + //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次) | ||
| 114 | + if (sch.getDfsjT() <= gps.getTimestamp()) { | ||
| 115 | + putLate(sch); | ||
| 172 | 116 | ||
| 173 | - String key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo(), name1 = BasicData.stationCode2NameMap.get(key)//站点名称 | ||
| 174 | - , name2 = null; | ||
| 175 | - if (StringUtils.isNotEmpty(gps.getCarparkNo())) { | ||
| 176 | - name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo()); | ||
| 177 | - } | 117 | + if (!lateSchMap.containsKey(sch.getId())) |
| 118 | + return; | ||
| 178 | 119 | ||
| 179 | - if (gps.getInstation() == 2) { | ||
| 180 | - name1 = name2;//进场,没有站 | 120 | + logger.info("线程空隙漏掉的误点,id: " + sch.getId()); |
| 121 | + } else | ||
| 122 | + return; | ||
| 181 | } | 123 | } |
| 182 | 124 | ||
| 183 | - gps.setStationName(name1); | ||
| 184 | - //根据起点站获取误点班次 | ||
| 185 | - ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), name1, name2); | ||
| 186 | - | ||
| 187 | - if (null == sch) | ||
| 188 | - return; | ||
| 189 | 125 | ||
| 190 | //可能是延迟信号,gps时间没有误点 | 126 | //可能是延迟信号,gps时间没有误点 |
| 191 | if (gps.getTimestamp() <= sch.getDfsjT()) { | 127 | if (gps.getTimestamp() <= sch.getDfsjT()) { |
| 192 | sch.setLate2(false); | 128 | sch.setLate2(false); |
| 193 | - lateSchMaps.remove(sch.getClZbh(), sch); | 129 | + lateSchMap.remove(sch.getId()); |
| 194 | return; | 130 | return; |
| 195 | } | 131 | } |
| 196 | 132 | ||
| 197 | - if (gps.getStationName().equals(sch.getQdzName()) | ||
| 198 | - || gps.getStopNo().equals(sch.getQdzCode()) | ||
| 199 | - || sch.getQdzName().equals(name2)) { | ||
| 200 | 133 | ||
| 201 | - //自动调整待发 到达时间 + 停靠时间 | ||
| 202 | - long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); | 134 | + //自动调整待发 到达时间 + 停靠时间 |
| 135 | + long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); | ||
| 203 | 136 | ||
| 204 | - sch.setDfsjAll(dt); | ||
| 205 | - sch.setDfAuto(true); | ||
| 206 | - //取消应发未到标记 | ||
| 207 | - sch.setLate2(false); | 137 | + sch.setDfsjAll(dt); |
| 138 | + sch.setDfAuto(true); | ||
| 139 | + //取消应发未到标记 | ||
| 140 | + sch.setLate2(false); | ||
| 208 | 141 | ||
| 209 | - lateSchMaps.remove(sch.getClZbh(), sch); | ||
| 210 | - logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); | ||
| 211 | - } | 142 | + lateSchMap.remove(sch.getId()); |
| 143 | + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt + " -id:" + sch.getId()); | ||
| 212 | } catch (Exception e) { | 144 | } catch (Exception e) { |
| 213 | e.printStackTrace(); | 145 | e.printStackTrace(); |
| 214 | logger.error("late2 car arrive", e); | 146 | logger.error("late2 car arrive", e); |
| @@ -216,47 +148,6 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -216,47 +148,6 @@ public class LateAdjustHandle implements ApplicationContextAware { | ||
| 216 | } | 148 | } |
| 217 | 149 | ||
| 218 | 150 | ||
| 219 | - /** | ||
| 220 | - * 车辆到站, 进站 进 的哪个班次,就调该车辆的下一个班次 | ||
| 221 | - * | ||
| 222 | - * @param gps | ||
| 223 | - * @param sch public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) { | ||
| 224 | - * try { | ||
| 225 | - * if (gps.getInstation() <= 0 || null == sch) { | ||
| 226 | - * return; | ||
| 227 | - * } | ||
| 228 | - * <p> | ||
| 229 | - * List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm()); | ||
| 230 | - * <p> | ||
| 231 | - * if (null == list || list.size() == 0 || !list.contains(sch)) { | ||
| 232 | - * return; | ||
| 233 | - * } | ||
| 234 | - * <p> | ||
| 235 | - * //可能是延迟信号,gps时间没有误点 | ||
| 236 | - * if (gps.getTimestamp() <= sch.getDfsjT()) { | ||
| 237 | - * sch.setLate2(false); | ||
| 238 | - * lateSchMaps.remove(sch.getClZbh(), sch); | ||
| 239 | - * return; | ||
| 240 | - * } | ||
| 241 | - * <p> | ||
| 242 | - * <p> | ||
| 243 | - * //自动调整待发 到达时间 + 停靠时间 | ||
| 244 | - * long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); | ||
| 245 | - * <p> | ||
| 246 | - * sch.setDfsjAll(dt); | ||
| 247 | - * sch.setDfAuto(true); | ||
| 248 | - * //取消应发未到标记 | ||
| 249 | - * sch.setLate2(false); | ||
| 250 | - * <p> | ||
| 251 | - * lateSchMaps.remove(sch.getClZbh(), sch); | ||
| 252 | - * logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); | ||
| 253 | - * } catch (Exception e) { | ||
| 254 | - * e.printStackTrace(); | ||
| 255 | - * logger.error("late2 car arrive", e); | ||
| 256 | - * } | ||
| 257 | - * } | ||
| 258 | - */ | ||
| 259 | - | ||
| 260 | @Override | 151 | @Override |
| 261 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | 152 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| 262 | lineConfigData = applicationContext.getBean(LineConfigData.class); | 153 | lineConfigData = applicationContext.getBean(LineConfigData.class); |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -105,7 +105,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -105,7 +105,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 105 | // List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); | 105 | // List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); |
| 106 | 106 | ||
| 107 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 107 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 108 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj") | 108 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.realExecDate,s.fcsj") |
| 109 | List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date); | 109 | List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date); |
| 110 | 110 | ||
| 111 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 111 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| @@ -170,7 +170,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -170,7 +170,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 170 | List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); | 170 | List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); |
| 171 | 171 | ||
| 172 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 172 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 173 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj") | 173 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.realExecDate,s.fcsj") |
| 174 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); | 174 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); |
| 175 | 175 | ||
| 176 | //按月统计 | 176 | //按月统计 |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -150,9 +150,9 @@ public class GpsServiceImpl implements GpsService { | @@ -150,9 +150,9 @@ public class GpsServiceImpl implements GpsService { | ||
| 150 | * @return -1无效 0上行 1下行 | 150 | * @return -1无效 0上行 1下行 |
| 151 | */ | 151 | */ |
| 152 | public static byte getUpOrDown(long serviceState) { | 152 | public static byte getUpOrDown(long serviceState) { |
| 153 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | 153 | + /*if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 |
| 154 | || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000) | 154 | || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000) |
| 155 | - return -1; | 155 | + return -1;*/ |
| 156 | return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); | 156 | return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| @@ -162,8 +162,8 @@ public class GpsServiceImpl implements GpsService { | @@ -162,8 +162,8 @@ public class GpsServiceImpl implements GpsService { | ||
| 162 | * @return -1无效 0运营 1未运营 | 162 | * @return -1无效 0运营 1未运营 |
| 163 | */ | 163 | */ |
| 164 | public static byte getService(long serviceState) { | 164 | public static byte getService(long serviceState) { |
| 165 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | ||
| 166 | - return -1; | 165 | + /*if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) |
| 166 | + return -1;*/ | ||
| 167 | return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | 167 | return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| @@ -743,11 +743,12 @@ public class GpsServiceImpl implements GpsService { | @@ -743,11 +743,12 @@ public class GpsServiceImpl implements GpsService { | ||
| 743 | row.setHeight((short) (1.5 * 256)); | 743 | row.setHeight((short) (1.5 * 256)); |
| 744 | row.createCell(0).setCellValue("序号"); | 744 | row.createCell(0).setCellValue("序号"); |
| 745 | row.createCell(1).setCellValue("车辆"); | 745 | row.createCell(1).setCellValue("车辆"); |
| 746 | - row.createCell(2).setCellValue("所在道路"); | ||
| 747 | - row.createCell(3).setCellValue("经度"); | ||
| 748 | - row.createCell(4).setCellValue("纬度"); | ||
| 749 | - row.createCell(5).setCellValue("时间"); | ||
| 750 | - row.createCell(6).setCellValue("速度"); | 746 | + row.createCell(2).setCellValue("牌照号"); |
| 747 | + row.createCell(3).setCellValue("所在道路"); | ||
| 748 | + row.createCell(4).setCellValue("经度"); | ||
| 749 | + row.createCell(5).setCellValue("纬度"); | ||
| 750 | + row.createCell(6).setCellValue("时间"); | ||
| 751 | + row.createCell(7).setCellValue("速度"); | ||
| 751 | //数据 | 752 | //数据 |
| 752 | DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"), | 753 | DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"), |
| 753 | fmt = DateTimeFormat.forPattern("yyyyMMddHHmm"); | 754 | fmt = DateTimeFormat.forPattern("yyyyMMddHHmm"); |
| @@ -756,12 +757,13 @@ public class GpsServiceImpl implements GpsService { | @@ -756,12 +757,13 @@ public class GpsServiceImpl implements GpsService { | ||
| 756 | gps = list.get(i); | 757 | gps = list.get(i); |
| 757 | row = sheet.createRow(i + 1); | 758 | row = sheet.createRow(i + 1); |
| 758 | row.createCell(0).setCellValue(i + 1); | 759 | row.createCell(0).setCellValue(i + 1); |
| 759 | - row.createCell(1).setCellValue(gps.getNbbm()); | ||
| 760 | - row.createCell(2).setCellValue(gps.getSection_name()); | ||
| 761 | - row.createCell(3).setCellValue(gps.getLon()); | ||
| 762 | - row.createCell(4).setCellValue(gps.getLat()); | ||
| 763 | - row.createCell(5).setCellValue(fmtHHmmss.print(gps.getTimestamp())); | ||
| 764 | - row.createCell(6).setCellValue(gps.getSpeed()); | 760 | + row.createCell(1).setCellValue(nbbm); |
| 761 | + row.createCell(2).setCellValue(BasicData.nbbmCompanyPlateMap.get(nbbm)); | ||
| 762 | + row.createCell(3).setCellValue(gps.getSection_name()); | ||
| 763 | + row.createCell(4).setCellValue(gps.getLon()); | ||
| 764 | + row.createCell(5).setCellValue(gps.getLat()); | ||
| 765 | + row.createCell(6).setCellValue(fmtHHmmss.print(gps.getTimestamp())); | ||
| 766 | + row.createCell(7).setCellValue(gps.getSpeed()); | ||
| 765 | } | 767 | } |
| 766 | 768 | ||
| 767 | st = st * 1000; | 769 | st = st * 1000; |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -2604,7 +2604,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2604,7 +2604,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2604 | Map.put("xlName", s.getXlName()); | 2604 | Map.put("xlName", s.getXlName()); |
| 2605 | Map.put("clZbh", s.getClZbh()); | 2605 | Map.put("clZbh", s.getClZbh()); |
| 2606 | Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | 2606 | Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); |
| 2607 | - Map.put("fcsjActual", s.getFcsjActual()); | 2607 | + Map.put("fcsjActual", s.getFcsjActual()==null?"":s.getFcsjActual()); |
| 2608 | Map.put("zdzName", s.getZdzName()); | 2608 | Map.put("zdzName", s.getZdzName()); |
| 2609 | Map.put("scheduleDate", s.getScheduleDateStr()); | 2609 | Map.put("scheduleDate", s.getScheduleDateStr()); |
| 2610 | Map.put("lpName", s.getLpName()); | 2610 | Map.put("lpName", s.getLpName()); |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 743 | try { | 743 | try { |
| 744 | // 获取线路ID | 744 | // 获取线路ID |
| 745 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | 745 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 746 | + Integer fileVersions = map.get("fileVersions").equals("") ? 2 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认2 | ||
| 746 | /** 查询线路信息 @param:<lineId:线路ID> */ | 747 | /** 查询线路信息 @param:<lineId:线路ID> */ |
| 747 | Line line = lineRepository.findOne(lineId); | 748 | Line line = lineRepository.findOne(lineId); |
| 748 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | 749 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ |
| @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 778 | textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | 779 | textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ |
| 779 | else | 780 | else |
| 780 | resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 | 781 | resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 |
| 781 | - textStr = line.getName() + " " + "2" + "\r" + textStr; | 782 | + textStr = line.getName() + " " + fileVersions + "\r" + textStr; |
| 782 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | 783 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 783 | /** 生成txt文件,上传ftp */ | 784 | /** 生成txt文件,上传ftp */ |
| 784 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | 785 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); |
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
| 1 | -package com.bsth.service.schedule.datatools; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | -import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 5 | -import com.bsth.service.schedule.utils.DataToolsFileType; | ||
| 6 | -import com.fasterxml.jackson.annotation.JsonCreator; | ||
| 7 | -import com.fasterxml.jackson.annotation.JsonValue; | ||
| 8 | - | ||
| 9 | -import java.util.List; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 动态时刻表数据。 | ||
| 13 | - */ | ||
| 14 | -public interface TTinfoDetailDynamicData { | ||
| 15 | - | ||
| 16 | - //---------------------- 生成时刻表用对象(以下) ---------------------// | ||
| 17 | - enum BcType { // 班次类型枚举 | ||
| 18 | - IN("in"), // 进场 | ||
| 19 | - OUT("out"), // 出场 | ||
| 20 | - BD("bd"), // 早例保 | ||
| 21 | - LC("lc"), // 晚例保 | ||
| 22 | - NORMAL("normal"); // 正常 | ||
| 23 | - private String flag; | ||
| 24 | - | ||
| 25 | - @JsonCreator | ||
| 26 | - private BcType(String flag) { | ||
| 27 | - this.flag = flag; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - @JsonValue | ||
| 31 | - public String getFlag() { | ||
| 32 | - return flag; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - public void setFlag(String flag) { | ||
| 36 | - this.flag = flag; | ||
| 37 | - } | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - class BcObj { // 班次对象 | ||
| 41 | - /** 班次时间 */ | ||
| 42 | - private Integer bcsj; | ||
| 43 | - /** 停站时间 */ | ||
| 44 | - private Integer ssj; | ||
| 45 | - /** 吃饭时间 */ | ||
| 46 | - private Integer eatsj; | ||
| 47 | - | ||
| 48 | - /** 停车场id */ | ||
| 49 | - private Integer tccid; | ||
| 50 | - /** 起点站id */ | ||
| 51 | - private Integer qdzid; | ||
| 52 | - /** 终点站id */ | ||
| 53 | - private Integer zdzid; | ||
| 54 | - | ||
| 55 | - /** 是否上行 */ | ||
| 56 | - private Boolean isUp; | ||
| 57 | - | ||
| 58 | - /** 是否分班 */ | ||
| 59 | - private Boolean isFb; | ||
| 60 | - | ||
| 61 | - /** 班次类型 */ | ||
| 62 | - private BcType bcType; | ||
| 63 | - /** 发车时刻 */ | ||
| 64 | - private String fcsj; | ||
| 65 | - /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */ | ||
| 66 | - private String fcsjDesc; | ||
| 67 | - | ||
| 68 | - /** 第几圈(从1开始) */ | ||
| 69 | - private Integer groupNo; | ||
| 70 | - /** 圈里第几个班次(1或者2) */ | ||
| 71 | - private Integer groupBcNo; | ||
| 72 | - | ||
| 73 | - public Integer getBcsj() { | ||
| 74 | - return bcsj; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public void setBcsj(Integer bcsj) { | ||
| 78 | - this.bcsj = bcsj; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public Integer getSsj() { | ||
| 82 | - return ssj; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - public void setSsj(Integer ssj) { | ||
| 86 | - this.ssj = ssj; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - public Integer getEatsj() { | ||
| 90 | - return eatsj; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - public void setEatsj(Integer eatsj) { | ||
| 94 | - this.eatsj = eatsj; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - public Integer getTccid() { | ||
| 98 | - return tccid; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public void setTccid(Integer tccid) { | ||
| 102 | - this.tccid = tccid; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public Integer getQdzid() { | ||
| 106 | - return qdzid; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - public void setQdzid(Integer qdzid) { | ||
| 110 | - this.qdzid = qdzid; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - public Integer getZdzid() { | ||
| 114 | - return zdzid; | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - public void setZdzid(Integer zdzid) { | ||
| 118 | - this.zdzid = zdzid; | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - public BcType getBcType() { | ||
| 122 | - return bcType; | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - public void setBcType(BcType bcType) { | ||
| 126 | - this.bcType = bcType; | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - public String getFcsj() { | ||
| 130 | - return fcsj; | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - public void setFcsj(String fcsj) { | ||
| 134 | - this.fcsj = fcsj; | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - public Boolean getIsUp() { | ||
| 138 | - return isUp; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - public void setIsUp(Boolean isUp) { | ||
| 142 | - this.isUp = isUp; | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - public Integer getGroupNo() { | ||
| 146 | - return groupNo; | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - public void setGroupNo(Integer groupNo) { | ||
| 150 | - this.groupNo = groupNo; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - public Integer getGroupBcNo() { | ||
| 154 | - return groupBcNo; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - public void setGroupBcNo(Integer groupBcNo) { | ||
| 158 | - this.groupBcNo = groupBcNo; | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - public String getFcsjDesc() { | ||
| 162 | - return fcsjDesc; | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - public void setFcsjDesc(String fcsjDesc) { | ||
| 166 | - this.fcsjDesc = fcsjDesc; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - public Boolean getIsFb() { | ||
| 170 | - return isFb; | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - public void setIsFb(Boolean fb) { | ||
| 174 | - isFb = fb; | ||
| 175 | - } | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - class LpObj { // 路牌对象 | ||
| 179 | - /** 路牌名字 */ | ||
| 180 | - private String lpname; | ||
| 181 | - /** 每圈的第一个班次是否上行 */ | ||
| 182 | - private Boolean isUp; | ||
| 183 | - | ||
| 184 | - /** 第一个班次起点站路由id */ | ||
| 185 | - private Integer stationRouteId1; | ||
| 186 | - /** 第二个班次起点站路由id */ | ||
| 187 | - private Integer stationRouteId2; | ||
| 188 | - | ||
| 189 | - /** 班次列表 */ | ||
| 190 | - private List<BcObj> bcObjList; | ||
| 191 | - /** 总圈数 */ | ||
| 192 | - private Integer groupCount; | ||
| 193 | - | ||
| 194 | - //---------------- 路牌统计 ---------------// | ||
| 195 | - /** 总里程 */ | ||
| 196 | - private Double zlc; | ||
| 197 | - /** 营运里程 */ | ||
| 198 | - private Double yylc; | ||
| 199 | - /** 空驶里程 */ | ||
| 200 | - private Double kslc; | ||
| 201 | - /** 总工时 */ | ||
| 202 | - private Double zgs; | ||
| 203 | - /** 总班次 */ | ||
| 204 | - private Integer zbc; | ||
| 205 | - /** 营运工时 */ | ||
| 206 | - private Double yygs; | ||
| 207 | - /** 营运班次 */ | ||
| 208 | - private Integer yybc; | ||
| 209 | - | ||
| 210 | - public String getLpname() { | ||
| 211 | - return lpname; | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - public void setLpname(String lpname) { | ||
| 215 | - this.lpname = lpname; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - public Boolean getIsUp() { | ||
| 219 | - return isUp; | ||
| 220 | - } | ||
| 221 | - | ||
| 222 | - public void setIsUp(Boolean isUp) { | ||
| 223 | - this.isUp = isUp; | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - public List<BcObj> getBcObjList() { | ||
| 227 | - return bcObjList; | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - public void setBcObjList(List<BcObj> bcObjList) { | ||
| 231 | - this.bcObjList = bcObjList; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - public Integer getGroupCount() { | ||
| 235 | - return groupCount; | ||
| 236 | - } | ||
| 237 | - | ||
| 238 | - public void setGroupCount(Integer groupCount) { | ||
| 239 | - this.groupCount = groupCount; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - public Integer getStationRouteId1() { | ||
| 243 | - return stationRouteId1; | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - public void setStationRouteId1(Integer stationRouteId1) { | ||
| 247 | - this.stationRouteId1 = stationRouteId1; | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | - public Integer getStationRouteId2() { | ||
| 251 | - return stationRouteId2; | ||
| 252 | - } | ||
| 253 | - | ||
| 254 | - public void setStationRouteId2(Integer stationRouteId2) { | ||
| 255 | - this.stationRouteId2 = stationRouteId2; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - public Boolean getUp() { | ||
| 259 | - return isUp; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - public void setUp(Boolean up) { | ||
| 263 | - isUp = up; | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - public Double getZlc() { | ||
| 267 | - return zlc; | ||
| 268 | - } | ||
| 269 | - | ||
| 270 | - public void setZlc(Double zlc) { | ||
| 271 | - this.zlc = zlc; | ||
| 272 | - } | ||
| 273 | - | ||
| 274 | - public Double getYylc() { | ||
| 275 | - return yylc; | ||
| 276 | - } | ||
| 277 | - | ||
| 278 | - public void setYylc(Double yylc) { | ||
| 279 | - this.yylc = yylc; | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | - public Double getKslc() { | ||
| 283 | - return kslc; | ||
| 284 | - } | ||
| 285 | - | ||
| 286 | - public void setKslc(Double kslc) { | ||
| 287 | - this.kslc = kslc; | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - public Double getZgs() { | ||
| 291 | - return zgs; | ||
| 292 | - } | ||
| 293 | - | ||
| 294 | - public void setZgs(Double zgs) { | ||
| 295 | - this.zgs = zgs; | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - public Integer getZbc() { | ||
| 299 | - return zbc; | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - public void setZbc(Integer zbc) { | ||
| 303 | - this.zbc = zbc; | ||
| 304 | - } | ||
| 305 | - | ||
| 306 | - public Double getYygs() { | ||
| 307 | - return yygs; | ||
| 308 | - } | ||
| 309 | - | ||
| 310 | - public void setYygs(Double yygs) { | ||
| 311 | - this.yygs = yygs; | ||
| 312 | - } | ||
| 313 | - | ||
| 314 | - public Integer getYybc() { | ||
| 315 | - return yybc; | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | - public void setYybc(Integer yybc) { | ||
| 319 | - this.yybc = yybc; | ||
| 320 | - } | ||
| 321 | - | ||
| 322 | - } | ||
| 323 | - | ||
| 324 | - class StatInfo { // 统计数据对象 | ||
| 325 | - /** 统计项目 */ | ||
| 326 | - private String statItem; | ||
| 327 | - /** 统计值 */ | ||
| 328 | - private Double statValue; | ||
| 329 | - | ||
| 330 | - public String getStatItem() { | ||
| 331 | - return statItem; | ||
| 332 | - } | ||
| 333 | - | ||
| 334 | - public void setStatItem(String statItem) { | ||
| 335 | - this.statItem = statItem; | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | - public Double getStatValue() { | ||
| 339 | - return statValue; | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - public void setStatValue(Double statValue) { | ||
| 343 | - this.statValue = statValue; | ||
| 344 | - } | ||
| 345 | - } | ||
| 346 | - | ||
| 347 | - class ParameterInfo { // 生成参数对象 | ||
| 348 | - /** 参数项目名称 */ | ||
| 349 | - private String paramItem; | ||
| 350 | - /** 参数项目值 */ | ||
| 351 | - private String paramValue; | ||
| 352 | - | ||
| 353 | - public String getParamItem() { | ||
| 354 | - return paramItem; | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - public void setParamItem(String paramItem) { | ||
| 358 | - this.paramItem = paramItem; | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - public String getParamValue() { | ||
| 362 | - return paramValue; | ||
| 363 | - } | ||
| 364 | - | ||
| 365 | - public void setParamValue(String paramValue) { | ||
| 366 | - this.paramValue = paramValue; | ||
| 367 | - } | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | - class DTInfos { // 所有数据信息 | ||
| 371 | - /** 路牌班次数据列表 */ | ||
| 372 | - private List<LpObj> lpObjList; | ||
| 373 | - /** 统计数据列表 */ | ||
| 374 | - private List<StatInfo> statInfoList; | ||
| 375 | - /** 参数对象信息 */ | ||
| 376 | - private List<ParameterInfo> parameterInfoList; | ||
| 377 | - | ||
| 378 | - public List<LpObj> getLpObjList() { | ||
| 379 | - return lpObjList; | ||
| 380 | - } | ||
| 381 | - | ||
| 382 | - public void setLpObjList(List<LpObj> lpObjList) { | ||
| 383 | - this.lpObjList = lpObjList; | ||
| 384 | - } | ||
| 385 | - | ||
| 386 | - public List<StatInfo> getStatInfoList() { | ||
| 387 | - return statInfoList; | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | - public void setStatInfoList(List<StatInfo> statInfoList) { | ||
| 391 | - this.statInfoList = statInfoList; | ||
| 392 | - } | ||
| 393 | - | ||
| 394 | - public List<ParameterInfo> getParameterInfoList() { | ||
| 395 | - return parameterInfoList; | ||
| 396 | - } | ||
| 397 | - | ||
| 398 | - public void setParameterInfoList(List<ParameterInfo> parameterInfoList) { | ||
| 399 | - this.parameterInfoList = parameterInfoList; | ||
| 400 | - } | ||
| 401 | - } | ||
| 402 | - | ||
| 403 | - //---------------------- 生成时刻表用对象(以上) ---------------------// | ||
| 404 | - | ||
| 405 | - /** | ||
| 406 | - * 导出动态时刻表数据。 | ||
| 407 | - * @param dtInfos | ||
| 408 | - * @return | ||
| 409 | - * @throws ScheduleException | ||
| 410 | - */ | ||
| 411 | - DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException; | ||
| 412 | -} | 1 | +package com.bsth.service.schedule.datatools; |
| 2 | + | ||
| 3 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | +import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 5 | +import com.bsth.service.schedule.utils.DataToolsFileType; | ||
| 6 | +import com.fasterxml.jackson.annotation.JsonCreator; | ||
| 7 | +import com.fasterxml.jackson.annotation.JsonValue; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 动态时刻表数据。 | ||
| 13 | + */ | ||
| 14 | +public interface TTinfoDetailDynamicData { | ||
| 15 | + | ||
| 16 | + //---------------------- 生成时刻表用对象(以下) ---------------------// | ||
| 17 | + enum BcType { // 班次类型枚举 | ||
| 18 | + IN("in"), // 进场 | ||
| 19 | + OUT("out"), // 出场 | ||
| 20 | + BD("bd"), // 早例保 | ||
| 21 | + LC("lc"), // 晚例保 | ||
| 22 | + NORMAL("normal"); // 正常 | ||
| 23 | + private String flag; | ||
| 24 | + | ||
| 25 | + @JsonCreator | ||
| 26 | + private BcType(String flag) { | ||
| 27 | + this.flag = flag; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @JsonValue | ||
| 31 | + public String getFlag() { | ||
| 32 | + return flag; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setFlag(String flag) { | ||
| 36 | + this.flag = flag; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + class BcObj { // 班次对象 | ||
| 41 | + /** 班次时间 */ | ||
| 42 | + private Integer bcsj; | ||
| 43 | + /** 停站时间 */ | ||
| 44 | + private Integer ssj; | ||
| 45 | + /** 吃饭时间 */ | ||
| 46 | + private Integer eatsj; | ||
| 47 | + | ||
| 48 | + /** 停车场id */ | ||
| 49 | + private Integer tccid; | ||
| 50 | + /** 起点站id */ | ||
| 51 | + private Integer qdzid; | ||
| 52 | + /** 终点站id */ | ||
| 53 | + private Integer zdzid; | ||
| 54 | + | ||
| 55 | + /** 是否上行 */ | ||
| 56 | + private Boolean isUp; | ||
| 57 | + | ||
| 58 | + /** 是否分班 */ | ||
| 59 | + private Boolean isFb; | ||
| 60 | + | ||
| 61 | + /** 班次类型 */ | ||
| 62 | + private BcType bcType; | ||
| 63 | + /** 发车时刻 */ | ||
| 64 | + private String fcsj; | ||
| 65 | + /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */ | ||
| 66 | + private String fcsjDesc; | ||
| 67 | + | ||
| 68 | + /** 第几圈(从1开始) */ | ||
| 69 | + private Integer groupNo; | ||
| 70 | + /** 圈里第几个班次(1或者2) */ | ||
| 71 | + private Integer groupBcNo; | ||
| 72 | + | ||
| 73 | + public Integer getBcsj() { | ||
| 74 | + return bcsj; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setBcsj(Integer bcsj) { | ||
| 78 | + this.bcsj = bcsj; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public Integer getSsj() { | ||
| 82 | + return ssj; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setSsj(Integer ssj) { | ||
| 86 | + this.ssj = ssj; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public Integer getEatsj() { | ||
| 90 | + return eatsj; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setEatsj(Integer eatsj) { | ||
| 94 | + this.eatsj = eatsj; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public Integer getTccid() { | ||
| 98 | + return tccid; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setTccid(Integer tccid) { | ||
| 102 | + this.tccid = tccid; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public Integer getQdzid() { | ||
| 106 | + return qdzid; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setQdzid(Integer qdzid) { | ||
| 110 | + this.qdzid = qdzid; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public Integer getZdzid() { | ||
| 114 | + return zdzid; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setZdzid(Integer zdzid) { | ||
| 118 | + this.zdzid = zdzid; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public BcType getBcType() { | ||
| 122 | + return bcType; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setBcType(BcType bcType) { | ||
| 126 | + this.bcType = bcType; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public String getFcsj() { | ||
| 130 | + return fcsj; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setFcsj(String fcsj) { | ||
| 134 | + this.fcsj = fcsj; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public Boolean getIsUp() { | ||
| 138 | + return isUp; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setIsUp(Boolean isUp) { | ||
| 142 | + this.isUp = isUp; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public Integer getGroupNo() { | ||
| 146 | + return groupNo; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setGroupNo(Integer groupNo) { | ||
| 150 | + this.groupNo = groupNo; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public Integer getGroupBcNo() { | ||
| 154 | + return groupBcNo; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setGroupBcNo(Integer groupBcNo) { | ||
| 158 | + this.groupBcNo = groupBcNo; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public String getFcsjDesc() { | ||
| 162 | + return fcsjDesc; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public void setFcsjDesc(String fcsjDesc) { | ||
| 166 | + this.fcsjDesc = fcsjDesc; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public Boolean getIsFb() { | ||
| 170 | + return isFb; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public void setIsFb(Boolean fb) { | ||
| 174 | + isFb = fb; | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + class LpObj { // 路牌对象 | ||
| 179 | + /** 路牌名字 */ | ||
| 180 | + private String lpname; | ||
| 181 | + /** 每圈的第一个班次是否上行 */ | ||
| 182 | + private Boolean isUp; | ||
| 183 | + | ||
| 184 | + /** 第一个班次起点站路由id */ | ||
| 185 | + private Integer stationRouteId1; | ||
| 186 | + /** 第二个班次起点站路由id */ | ||
| 187 | + private Integer stationRouteId2; | ||
| 188 | + | ||
| 189 | + /** 班次列表 */ | ||
| 190 | + private List<BcObj> bcObjList; | ||
| 191 | + /** 总圈数 */ | ||
| 192 | + private Integer groupCount; | ||
| 193 | + | ||
| 194 | + //---------------- 路牌统计 ---------------// | ||
| 195 | + /** 总里程 */ | ||
| 196 | + private Double zlc; | ||
| 197 | + /** 营运里程 */ | ||
| 198 | + private Double yylc; | ||
| 199 | + /** 空驶里程 */ | ||
| 200 | + private Double kslc; | ||
| 201 | + /** 总工时 */ | ||
| 202 | + private Double zgs; | ||
| 203 | + /** 总班次 */ | ||
| 204 | + private Integer zbc; | ||
| 205 | + /** 营运工时 */ | ||
| 206 | + private Double yygs; | ||
| 207 | + /** 营运班次 */ | ||
| 208 | + private Integer yybc; | ||
| 209 | + | ||
| 210 | + public String getLpname() { | ||
| 211 | + return lpname; | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + public void setLpname(String lpname) { | ||
| 215 | + this.lpname = lpname; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + public Boolean getIsUp() { | ||
| 219 | + return isUp; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + public void setIsUp(Boolean isUp) { | ||
| 223 | + this.isUp = isUp; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public List<BcObj> getBcObjList() { | ||
| 227 | + return bcObjList; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + public void setBcObjList(List<BcObj> bcObjList) { | ||
| 231 | + this.bcObjList = bcObjList; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + public Integer getGroupCount() { | ||
| 235 | + return groupCount; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + public void setGroupCount(Integer groupCount) { | ||
| 239 | + this.groupCount = groupCount; | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + public Integer getStationRouteId1() { | ||
| 243 | + return stationRouteId1; | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + public void setStationRouteId1(Integer stationRouteId1) { | ||
| 247 | + this.stationRouteId1 = stationRouteId1; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + public Integer getStationRouteId2() { | ||
| 251 | + return stationRouteId2; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + public void setStationRouteId2(Integer stationRouteId2) { | ||
| 255 | + this.stationRouteId2 = stationRouteId2; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + public Boolean getUp() { | ||
| 259 | + return isUp; | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + public void setUp(Boolean up) { | ||
| 263 | + isUp = up; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + public Double getZlc() { | ||
| 267 | + return zlc; | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + public void setZlc(Double zlc) { | ||
| 271 | + this.zlc = zlc; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + public Double getYylc() { | ||
| 275 | + return yylc; | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + public void setYylc(Double yylc) { | ||
| 279 | + this.yylc = yylc; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + public Double getKslc() { | ||
| 283 | + return kslc; | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + public void setKslc(Double kslc) { | ||
| 287 | + this.kslc = kslc; | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + public Double getZgs() { | ||
| 291 | + return zgs; | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + public void setZgs(Double zgs) { | ||
| 295 | + this.zgs = zgs; | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + public Integer getZbc() { | ||
| 299 | + return zbc; | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + public void setZbc(Integer zbc) { | ||
| 303 | + this.zbc = zbc; | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + public Double getYygs() { | ||
| 307 | + return yygs; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + public void setYygs(Double yygs) { | ||
| 311 | + this.yygs = yygs; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + public Integer getYybc() { | ||
| 315 | + return yybc; | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + public void setYybc(Integer yybc) { | ||
| 319 | + this.yybc = yybc; | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + class StatInfo { // 统计数据对象 | ||
| 325 | + /** 统计项目 */ | ||
| 326 | + private String statItem; | ||
| 327 | + /** 统计值 */ | ||
| 328 | + private Double statValue; | ||
| 329 | + | ||
| 330 | + public String getStatItem() { | ||
| 331 | + return statItem; | ||
| 332 | + } | ||
| 333 | + | ||
| 334 | + public void setStatItem(String statItem) { | ||
| 335 | + this.statItem = statItem; | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + public Double getStatValue() { | ||
| 339 | + return statValue; | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + public void setStatValue(Double statValue) { | ||
| 343 | + this.statValue = statValue; | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + class ParameterInfo { // 生成参数对象 | ||
| 348 | + /** 参数项目名称 */ | ||
| 349 | + private String paramItem; | ||
| 350 | + /** 参数项目值 */ | ||
| 351 | + private String paramValue; | ||
| 352 | + | ||
| 353 | + public String getParamItem() { | ||
| 354 | + return paramItem; | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + public void setParamItem(String paramItem) { | ||
| 358 | + this.paramItem = paramItem; | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + public String getParamValue() { | ||
| 362 | + return paramValue; | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + public void setParamValue(String paramValue) { | ||
| 366 | + this.paramValue = paramValue; | ||
| 367 | + } | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + class DTInfos { // 所有数据信息 | ||
| 371 | + /** 路牌班次数据列表 */ | ||
| 372 | + private List<LpObj> lpObjList; | ||
| 373 | + /** 统计数据列表 */ | ||
| 374 | + private List<StatInfo> statInfoList; | ||
| 375 | + /** 参数对象信息 */ | ||
| 376 | + private List<ParameterInfo> parameterInfoList; | ||
| 377 | + | ||
| 378 | + public List<LpObj> getLpObjList() { | ||
| 379 | + return lpObjList; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + public void setLpObjList(List<LpObj> lpObjList) { | ||
| 383 | + this.lpObjList = lpObjList; | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + public List<StatInfo> getStatInfoList() { | ||
| 387 | + return statInfoList; | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + public void setStatInfoList(List<StatInfo> statInfoList) { | ||
| 391 | + this.statInfoList = statInfoList; | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + public List<ParameterInfo> getParameterInfoList() { | ||
| 395 | + return parameterInfoList; | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + public void setParameterInfoList(List<ParameterInfo> parameterInfoList) { | ||
| 399 | + this.parameterInfoList = parameterInfoList; | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + //---------------------- 生成时刻表用对象(以上) ---------------------// | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * 导出动态时刻表数据。 | ||
| 407 | + * @param dtInfos | ||
| 408 | + * @return | ||
| 409 | + * @throws ScheduleException | ||
| 410 | + */ | ||
| 411 | + DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException; | ||
| 412 | +} |
src/main/resources/fatso/start.js
| 1 | /** | 1 | /** |
| 2 | - * @author PanZhao | ||
| 3 | - * @date 2016年3月17日 下午12:44:06 | 2 | + * @author PanZhao |
| 3 | + * @date 2016年3月17日 下午12:44:06 | ||
| 4 | */ | 4 | */ |
| 5 | var fs = require('fs') | 5 | var fs = require('fs') |
| 6 | - ,colors = require('colors') | ||
| 7 | - ,child_process = require('child_process') | ||
| 8 | - ,EventProxy = require('eventproxy') | ||
| 9 | - ,parse = require('./parse') | ||
| 10 | - ,minifier = require('./minifier') | ||
| 11 | - ,crypto = require("crypto") | ||
| 12 | - ,handle_real_ctl = require('./handle_real_ctl'); | 6 | + , colors = require('colors') |
| 7 | + , child_process = require('child_process') | ||
| 8 | + , EventProxy = require('eventproxy') | ||
| 9 | + , parse = require('./parse') | ||
| 10 | + , minifier = require('./minifier') | ||
| 11 | + , crypto = require("crypto") | ||
| 12 | + , handle_real_ctl = require('./handle_real_ctl'); | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | var platform = process.platform; | 15 | var platform = process.platform; |
| 16 | -var iswin = platform=='win32'; | ||
| 17 | -var sp = platform=='win32'?'\\':'/'; | 16 | +var iswin = platform == 'win32'; |
| 17 | +var sp = platform == 'win32' ? '\\' : '/'; | ||
| 18 | //不参与的目录 | 18 | //不参与的目录 |
| 19 | -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil','base'+sp+'geo_data_edit','base'+sp+'carpark','forms','mforms', 'report', 'punctual'] | ||
| 20 | - ,ep = new EventProxy() | ||
| 21 | - ,pName = 'bsth_control' | ||
| 22 | - ,path = process.cwd() | ||
| 23 | - //根目录 | ||
| 24 | - ,root = path.substr(0, path.indexOf(sp + 'src'+sp+'main')) | ||
| 25 | - ,workspace = root.substr(0, root.lastIndexOf(sp + pName)) | ||
| 26 | - //临时目录 | ||
| 27 | - ,dest = (workspace + sp + pName+'@fatso_copy') | ||
| 28 | - ,_static = sp + 'src'+sp+'main'+sp+'resources'+sp+'static' | ||
| 29 | - ,_pages = dest + _static + sp + 'pages'; | 19 | +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission' + sp + 'authorize_all', 'summary', 'history_sch', 'report' + sp + 'oil', 'base' + sp + 'geo_data_edit', 'base' + sp + 'carpark', 'forms', 'mforms', 'report', 'punctual', 'base' + sp + 'timesmodel'] |
| 20 | + , ep = new EventProxy() | ||
| 21 | + , pName = 'bsth_control' | ||
| 22 | + , path = process.cwd() | ||
| 23 | + //根目录 | ||
| 24 | + , root = path.substr(0, path.indexOf(sp + 'src' + sp + 'main')) | ||
| 25 | + , workspace = root.substr(0, root.lastIndexOf(sp + pName)) | ||
| 26 | + //临时目录 | ||
| 27 | + , dest = (workspace + sp + pName + '@fatso_copy') | ||
| 28 | + , _static = sp + 'src' + sp + 'main' + sp + 'resources' + sp + 'static' | ||
| 29 | + , _pages = dest + _static + sp + 'pages'; | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | //创建临时目录 | 32 | //创建临时目录 |
| 33 | -fs.mkdir(dest, function(e){ | ||
| 34 | - if(e) | ||
| 35 | - logError('创建临时目录出错,请检查目录 ' + dest + '是否存在'); | ||
| 36 | - | ||
| 37 | - setTimeout(function(){ | ||
| 38 | - ep.emit('mvn-clean'); | ||
| 39 | - }, 500); | 33 | +fs.mkdir(dest, function (e) { |
| 34 | + if (e) | ||
| 35 | + logError('创建临时目录出错,请检查目录 ' + dest + '是否存在'); | ||
| 36 | + | ||
| 37 | + setTimeout(function () { | ||
| 38 | + ep.emit('mvn-clean'); | ||
| 39 | + }, 500); | ||
| 40 | }); | 40 | }); |
| 41 | //子进程 | 41 | //子进程 |
| 42 | var cProcess; | 42 | var cProcess; |
| 43 | 43 | ||
| 44 | -ep.tail('mvn-clean',function(){ | ||
| 45 | - //ep.emit('copy-project'); | ||
| 46 | - //清理target | ||
| 47 | - logInfo('mvn clean...'); | ||
| 48 | - cProcess = child_process.exec("mvn clean",{cwd: workspace + sp + pName},function(error){ | ||
| 49 | - if(error) | ||
| 50 | - logError(error); | ||
| 51 | - | ||
| 52 | - logSuccess('mvn clean success'); | ||
| 53 | - | ||
| 54 | - ep.emit('copy-project'); | ||
| 55 | - }); | ||
| 56 | - output(cProcess); | 44 | +ep.tail('mvn-clean', function () { |
| 45 | + //ep.emit('copy-project'); | ||
| 46 | + //清理target | ||
| 47 | + logInfo('mvn clean...'); | ||
| 48 | + cProcess = child_process.exec("mvn clean", {cwd: workspace + sp + pName}, function (error) { | ||
| 49 | + if (error) | ||
| 50 | + logError(error); | ||
| 51 | + | ||
| 52 | + logSuccess('mvn clean success'); | ||
| 53 | + | ||
| 54 | + ep.emit('copy-project'); | ||
| 55 | + }); | ||
| 56 | + output(cProcess); | ||
| 57 | }); | 57 | }); |
| 58 | 58 | ||
| 59 | //复制项目副本 | 59 | //复制项目副本 |
| 60 | -ep.tail('copy-project',function(){ | ||
| 61 | - logInfo('copy project...'); | ||
| 62 | - var xcopyCom; | ||
| 63 | - if(iswin) | ||
| 64 | - xcopyCom = 'XCOPY '+ root.replace(/\//g,'\\') + ' ' + dest +' /e /exclude:'+path+'\\exclude.txt'; | ||
| 65 | - else | ||
| 66 | - xcopyCom = 'cp -a ' + root + '/. ' + dest; | ||
| 67 | - | ||
| 68 | - cProcess = child_process.exec(xcopyCom,{cwd: workspace, maxBuffer: 5000*1024},function(error){ | ||
| 69 | - if(error) | ||
| 70 | - logError(error); | ||
| 71 | - | ||
| 72 | - logSuccess('copy project success'); | ||
| 73 | - | ||
| 74 | - ep.emit('check-js'); | ||
| 75 | - }); | ||
| 76 | - //output(cProcess); | 60 | +ep.tail('copy-project', function () { |
| 61 | + logInfo('copy project...'); | ||
| 62 | + var xcopyCom; | ||
| 63 | + if (iswin) | ||
| 64 | + xcopyCom = 'XCOPY ' + root.replace(/\//g, '\\') + ' ' + dest + ' /e /exclude:' + path + '\\exclude.txt'; | ||
| 65 | + else | ||
| 66 | + xcopyCom = 'cp -a ' + root + '/. ' + dest; | ||
| 67 | + | ||
| 68 | + cProcess = child_process.exec(xcopyCom, {cwd: workspace, maxBuffer: 5000 * 1024}, function (error) { | ||
| 69 | + if (error) | ||
| 70 | + logError(error); | ||
| 71 | + | ||
| 72 | + logSuccess('copy project success'); | ||
| 73 | + | ||
| 74 | + ep.emit('check-js'); | ||
| 75 | + }); | ||
| 76 | + //output(cProcess); | ||
| 77 | }); | 77 | }); |
| 78 | 78 | ||
| 79 | //检查JS | 79 | //检查JS |
| 80 | -ep.tail('check-js', function(){ | ||
| 81 | - ep.emit('minifier-js'); | 80 | +ep.tail('check-js', function () { |
| 81 | + ep.emit('minifier-js'); | ||
| 82 | }); | 82 | }); |
| 83 | 83 | ||
| 84 | //合并压缩JS | 84 | //合并压缩JS |
| 85 | -ep.tail('minifier-js', function(){ | ||
| 86 | - logInfo('handle index.html...'); | ||
| 87 | - | ||
| 88 | - //再处理首页 | ||
| 89 | - ep.emit('handle-index', function(){ | ||
| 90 | - //递归处理片段 | ||
| 91 | - walk(dest + _static + sp + 'pages', function(item){ | ||
| 92 | - ep.emit('handle-fragment', item); | ||
| 93 | - }, | ||
| 94 | - function(){ | ||
| 95 | - //处理线调首页 | ||
| 96 | - handle_real_ctl.handleMain(function () { | ||
| 97 | - //处理线调地图 | ||
| 98 | - handle_real_ctl.handleMap(function () { | ||
| 99 | - //处理单屏地图页面 | ||
| 100 | - handle_real_ctl.handleAlonePage(function () { | ||
| 101 | - //处理单屏主页 | ||
| 102 | - handle_real_ctl.handleAloneHomePage(function () { | ||
| 103 | - ep.emit('package-jar'); | ||
| 104 | - }); | ||
| 105 | - }); | ||
| 106 | - }); | ||
| 107 | - }); | ||
| 108 | - }); | ||
| 109 | - }); | 85 | +ep.tail('minifier-js', function () { |
| 86 | + logInfo('handle index.html...'); | ||
| 87 | + | ||
| 88 | + //再处理首页 | ||
| 89 | + ep.emit('handle-index', function () { | ||
| 90 | + //递归处理片段 | ||
| 91 | + walk(dest + _static + sp + 'pages', function (item) { | ||
| 92 | + ep.emit('handle-fragment', item); | ||
| 93 | + }, | ||
| 94 | + function () { | ||
| 95 | + //处理线调首页 | ||
| 96 | + handle_real_ctl.handleMain(function () { | ||
| 97 | + //处理线调地图 | ||
| 98 | + handle_real_ctl.handleMap(function () { | ||
| 99 | + //处理单屏地图页面 | ||
| 100 | + handle_real_ctl.handleAlonePage(function () { | ||
| 101 | + //处理单屏主页 | ||
| 102 | + handle_real_ctl.handleAloneHomePage(function () { | ||
| 103 | + ep.emit('package-jar'); | ||
| 104 | + }); | ||
| 105 | + }); | ||
| 106 | + }); | ||
| 107 | + }); | ||
| 108 | + }); | ||
| 109 | + }); | ||
| 110 | }); | 110 | }); |
| 111 | 111 | ||
| 112 | //打包 | 112 | //打包 |
| 113 | -ep.tail('package-jar', function(file){ | ||
| 114 | - var packageCom = 'mvn clean package -DskipTests'; | ||
| 115 | - cProcess = child_process.exec(packageCom,{maxBuffer: 5000*1024, cwd: dest},function(error){ | ||
| 116 | - if(error) | ||
| 117 | - logError(error); | ||
| 118 | - | ||
| 119 | - logSuccess('mvn package success'); | ||
| 120 | - | ||
| 121 | - console.log(('成功打包在 ' + dest + sp + 'target 目录下').cyan); | ||
| 122 | - }); | ||
| 123 | - | ||
| 124 | - output(cProcess); | 113 | +ep.tail('package-jar', function (file) { |
| 114 | + var packageCom = 'mvn clean package -DskipTests'; | ||
| 115 | + cProcess = child_process.exec(packageCom, {maxBuffer: 5000 * 1024, cwd: dest}, function (error) { | ||
| 116 | + if (error) | ||
| 117 | + logError(error); | ||
| 118 | + | ||
| 119 | + logSuccess('mvn package success'); | ||
| 120 | + | ||
| 121 | + console.log(('成功打包在 ' + dest + sp + 'target 目录下').cyan); | ||
| 122 | + }); | ||
| 123 | + | ||
| 124 | + output(cProcess); | ||
| 125 | }); | 125 | }); |
| 126 | 126 | ||
| 127 | //处理片段 | 127 | //处理片段 |
| 128 | -ep.tail('handle-fragment', function(file){ | ||
| 129 | - //要排除的文件 | ||
| 130 | - for(var i = 0, ex; ex = excludes[i++];){ | ||
| 131 | - if(file.indexOf(_pages + sp + ex) != -1) | ||
| 132 | - return false; | ||
| 133 | - } | ||
| 134 | - handleJavascript(file, function(mini, $){ | ||
| 135 | - var jsMini; | ||
| 136 | - if(mini.inside) | ||
| 137 | - jsMini = '(function(){' + mini.inside + '\n' + mini.outside + '})();'; | ||
| 138 | - else | ||
| 139 | - jsMini = '(function(){' + mini.outside + '})();'; | ||
| 140 | - | ||
| 141 | - write(file, $.html() + '<script>' + jsMini + '</script>'); | ||
| 142 | - }); | ||
| 143 | - | 128 | +ep.tail('handle-fragment', function (file) { |
| 129 | + //要排除的文件 | ||
| 130 | + for (var i = 0, ex; ex = excludes[i++];) { | ||
| 131 | + if (file.indexOf(_pages + sp + ex) != -1) | ||
| 132 | + return false; | ||
| 133 | + } | ||
| 134 | + handleJavascript(file, function (mini, $) { | ||
| 135 | + var jsMini; | ||
| 136 | + if (mini.inside) | ||
| 137 | + jsMini = '(function(){' + mini.inside + '\n' + mini.outside + '})();'; | ||
| 138 | + else | ||
| 139 | + jsMini = '(function(){' + mini.outside + '})();'; | ||
| 140 | + | ||
| 141 | + write(file, $.html() + '<script>' + jsMini + '</script>'); | ||
| 142 | + }); | ||
| 143 | + | ||
| 144 | }); | 144 | }); |
| 145 | 145 | ||
| 146 | //处理首页 | 146 | //处理首页 |
| 147 | -ep.tail('handle-index', function(cb){ | ||
| 148 | - var index = dest + _static + sp + 'index.html'; | ||
| 149 | - handleJavascript(index, function(mini, $){ | ||
| 150 | - var jsMiniText = mini.inside + mini.outside; | ||
| 151 | - | ||
| 152 | - var code = md5(jsMiniText); | ||
| 153 | - fs.open( dest + _static + sp + 'assets'+sp+'js' + sp + code + '.js', 'a', function(err, fd){ | ||
| 154 | - if(err) | ||
| 155 | - logError(err); | ||
| 156 | - | ||
| 157 | - fs.write(fd,jsMiniText, function(){ | ||
| 158 | - var ss = $('script'); | ||
| 159 | - | ||
| 160 | - $(ss[ss.length - 1]).before('<script src="/assets/js/'+code+'.js"></script>\n'); | ||
| 161 | - for(var i = 0, s; s = ss[i++];){ | ||
| 162 | - $(s).removeAttr('data-exclude') | ||
| 163 | - .removeAttr('flag') | ||
| 164 | - .removeAttr('data-autocephaly'); | ||
| 165 | - } | ||
| 166 | - write(index, $.html()); | ||
| 167 | - | ||
| 168 | - cb && cb(); | ||
| 169 | - }); | ||
| 170 | - }); | ||
| 171 | - }); | 147 | +ep.tail('handle-index', function (cb) { |
| 148 | + var index = dest + _static + sp + 'index.html'; | ||
| 149 | + handleJavascript(index, function (mini, $) { | ||
| 150 | + var jsMiniText = mini.inside + mini.outside; | ||
| 151 | + | ||
| 152 | + var code = md5(jsMiniText); | ||
| 153 | + fs.open(dest + _static + sp + 'assets' + sp + 'js' + sp + code + '.js', 'a', function (err, fd) { | ||
| 154 | + if (err) | ||
| 155 | + logError(err); | ||
| 156 | + | ||
| 157 | + fs.write(fd, jsMiniText, function () { | ||
| 158 | + var ss = $('script'); | ||
| 159 | + | ||
| 160 | + $(ss[ss.length - 1]).before('<script src="/assets/js/' + code + '.js"></script>\n'); | ||
| 161 | + for (var i = 0, s; s = ss[i++];) { | ||
| 162 | + $(s).removeAttr('data-exclude') | ||
| 163 | + .removeAttr('flag') | ||
| 164 | + .removeAttr('data-autocephaly'); | ||
| 165 | + } | ||
| 166 | + write(index, $.html()); | ||
| 167 | + | ||
| 168 | + cb && cb(); | ||
| 169 | + }); | ||
| 170 | + }); | ||
| 171 | + }); | ||
| 172 | }); | 172 | }); |
| 173 | 173 | ||
| 174 | 174 | ||
| 175 | -function handleJavascript(item, cb){ | ||
| 176 | - //解析页面 | ||
| 177 | - var htmlResult = parse.html(item, dest + _static) | ||
| 178 | - ,jsArray = htmlResult.jsArray | ||
| 179 | - ,$ = htmlResult.$ | ||
| 180 | - ,scrStr = htmlResult.scriptString; | ||
| 181 | - | ||
| 182 | - //合并压缩 | ||
| 183 | - var mini = minifier.mergeAndMini(jsArray, scrStr, dest + _static, item); | ||
| 184 | - | ||
| 185 | - cb && cb(mini, $); | 175 | +function handleJavascript(item, cb) { |
| 176 | + //解析页面 | ||
| 177 | + var htmlResult = parse.html(item, dest + _static) | ||
| 178 | + , jsArray = htmlResult.jsArray | ||
| 179 | + , $ = htmlResult.$ | ||
| 180 | + , scrStr = htmlResult.scriptString; | ||
| 181 | + | ||
| 182 | + //合并压缩 | ||
| 183 | + var mini = minifier.mergeAndMini(jsArray, scrStr, dest + _static, item); | ||
| 184 | + | ||
| 185 | + cb && cb(mini, $); | ||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | -function removeJsLink(s, e){ | ||
| 189 | - var newArray = [], flag; | ||
| 190 | - | ||
| 191 | - for(var i = 0, si; si = s[i++];){ | ||
| 192 | - flag = 0; | ||
| 193 | - for(var j = 0,ei; ei = e[j++];){ | ||
| 194 | - if(si.indexOf(ei) != -1){ | ||
| 195 | - flag = -1; | ||
| 196 | - break; | ||
| 197 | - } | ||
| 198 | - } | ||
| 199 | - | ||
| 200 | - if(flag == 0){ | ||
| 201 | - newArray.push(si); | ||
| 202 | - } | ||
| 203 | - } | ||
| 204 | - return newArray; | 188 | +function removeJsLink(s, e) { |
| 189 | + var newArray = [], flag; | ||
| 190 | + | ||
| 191 | + for (var i = 0, si; si = s[i++];) { | ||
| 192 | + flag = 0; | ||
| 193 | + for (var j = 0, ei; ei = e[j++];) { | ||
| 194 | + if (si.indexOf(ei) != -1) { | ||
| 195 | + flag = -1; | ||
| 196 | + break; | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + if (flag == 0) { | ||
| 201 | + newArray.push(si); | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + return newArray; | ||
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | -function write(file, text){ | ||
| 208 | - fs.writeFile(file, text, function (err) { | ||
| 209 | - if (err){ | ||
| 210 | - console.log(err.toString().red); | ||
| 211 | - process.exit(); | ||
| 212 | - } | ||
| 213 | - //console.log(file.green); | ||
| 214 | - }); | 207 | +function write(file, text) { |
| 208 | + fs.writeFile(file, text, function (err) { | ||
| 209 | + if (err) { | ||
| 210 | + console.log(err.toString().red); | ||
| 211 | + process.exit(); | ||
| 212 | + } | ||
| 213 | + //console.log(file.green); | ||
| 214 | + }); | ||
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | -function md5(text){ | ||
| 218 | - return crypto.createHash("md5").update(text).digest("hex"); | 217 | +function md5(text) { |
| 218 | + return crypto.createHash("md5").update(text).digest("hex"); | ||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | 221 | ||
| 222 | -function walk(path ,handleFile, over) { | ||
| 223 | - fs.readdir(path, function(err, files) { | ||
| 224 | - if (err) { | ||
| 225 | - console.log('read dir error'.red); | ||
| 226 | - } else { | ||
| 227 | - files.forEach(function(item) { | 222 | +function walk(path, handleFile, over) { |
| 223 | + fs.readdir(path, function (err, files) { | ||
| 224 | + if (err) { | ||
| 225 | + console.log('read dir error'.red); | ||
| 226 | + } else { | ||
| 227 | + files.forEach(function (item) { | ||
| 228 | var tmpPath = path + sp + item; | 228 | var tmpPath = path + sp + item; |
| 229 | - fs.stat(tmpPath, function(err1, stats) { | ||
| 230 | - if (err1) { | ||
| 231 | - console.log('stat error'); | ||
| 232 | - } else { | ||
| 233 | - if (stats.isDirectory()) { | ||
| 234 | - walk(tmpPath, handleFile); | ||
| 235 | - } else if(item.indexOf('.html') != -1){ | ||
| 236 | - handleFile(tmpPath); | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | - }) | 229 | + fs.stat(tmpPath, function (err1, stats) { |
| 230 | + if (err1) { | ||
| 231 | + console.log('stat error'); | ||
| 232 | + } else { | ||
| 233 | + if (stats.isDirectory()) { | ||
| 234 | + walk(tmpPath, handleFile); | ||
| 235 | + } else if (item.indexOf('.html') != -1) { | ||
| 236 | + handleFile(tmpPath); | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + }) | ||
| 240 | }); | 240 | }); |
| 241 | - | 241 | + |
| 242 | over && over(); | 242 | over && over(); |
| 243 | - } | ||
| 244 | - }); | ||
| 245 | -} | 243 | + } |
| 244 | + }); | ||
| 245 | +} | ||
| 246 | 246 | ||
| 247 | -function logInfo(t){ | ||
| 248 | - console.log(t); | 247 | +function logInfo(t) { |
| 248 | + console.log(t); | ||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | -function logSuccess(t){ | ||
| 252 | - console.log(t.green); | 251 | +function logSuccess(t) { |
| 252 | + console.log(t.green); | ||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | -function logError(e){ | ||
| 256 | - console.log(e.toString().red); | ||
| 257 | - process.exit(); | 255 | +function logError(e) { |
| 256 | + console.log(e.toString().red); | ||
| 257 | + process.exit(); | ||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | -function output(cProcess){ | ||
| 261 | - //标准输出 | ||
| 262 | - cProcess.stdout.on('data', function (s) { | ||
| 263 | - console.log(s); | ||
| 264 | - }); | 260 | +function output(cProcess) { |
| 261 | + //标准输出 | ||
| 262 | + cProcess.stdout.on('data', function (s) { | ||
| 263 | + console.log(s); | ||
| 264 | + }); | ||
| 265 | } | 265 | } |
| 266 | \ No newline at end of file | 266 | \ No newline at end of file |
src/main/resources/static/index.html
| @@ -630,7 +630,8 @@ | @@ -630,7 +630,8 @@ | ||
| 630 | <script | 630 | <script |
| 631 | src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | 631 | src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" |
| 632 | data-exclude=1></script> | 632 | data-exclude=1></script> |
| 633 | - | 633 | +<!-- echarts --> |
| 634 | +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | ||
| 634 | <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | 635 | <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> |
| 635 | 636 | ||
| 636 | </body> | 637 | </body> |
src/main/resources/static/pages/base/geo_data_edit/js/search.js
| @@ -27,8 +27,8 @@ var gb_ct_search = function () { | @@ -27,8 +27,8 @@ var gb_ct_search = function () { | ||
| 27 | }); | 27 | }); |
| 28 | 28 | ||
| 29 | var searchComplete = function (e) { | 29 | var searchComplete = function (e) { |
| 30 | - //console.log('e.wr', e); | ||
| 31 | - var htmlStr = template('geo_d_e_search_result-temp', {list: e.yr}); | 30 | + console.log('e.wr', e); |
| 31 | + var htmlStr = template('geo_d_e_search_result-temp', {list: e.Br}); | ||
| 32 | $('.ct_search_result').html(htmlStr); | 32 | $('.ct_search_result').html(htmlStr); |
| 33 | 33 | ||
| 34 | }; | 34 | }; |
src/main/resources/static/pages/base/line/edit.html
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | </label> | 59 | </label> |
| 60 | <div class="col-md-4"> | 60 | <div class="col-md-4"> |
| 61 | <input type="text" class="form-control" name="lineCode" id="lineCodeInput" | 61 | <input type="text" class="form-control" name="lineCode" id="lineCodeInput" |
| 62 | - placeholder="线路编码"> | 62 | + placeholder="线路编码" readonly="readonly"> |
| 63 | </div> | 63 | </div> |
| 64 | </div> | 64 | </div> |
| 65 | <!-- 线路编码 (* 必填项) END --> | 65 | <!-- 线路编码 (* 必填项) END --> |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| @@ -236,7 +236,7 @@ | @@ -236,7 +236,7 @@ | ||
| 236 | // 表单序列化 | 236 | // 表单序列化 |
| 237 | var params = form.serializeJSON(); | 237 | var params = form.serializeJSON(); |
| 238 | // 查询线路编码的顺延号 | 238 | // 查询线路编码的顺延号 |
| 239 | - $get('/line/all', {lineCode_prefixLike: params.lineCode},function(lineCode){ | 239 | + $get('/line/all', {lineCode_eq: params.lineCode},function(lineCode){ |
| 240 | // 定义返回值的长度 | 240 | // 定义返回值的长度 |
| 241 | var len = lineCode.length; | 241 | var len = lineCode.length; |
| 242 | // 如果大于零,则已存在录入的线路编码;否则不存在 | 242 | // 如果大于零,则已存在录入的线路编码;否则不存在 |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -338,30 +338,54 @@ | @@ -338,30 +338,54 @@ | ||
| 338 | layer.msg('请选中一条线路!'); | 338 | layer.msg('请选中一条线路!'); |
| 339 | return ; | 339 | return ; |
| 340 | }else { | 340 | }else { |
| 341 | - id = arrChk.data('id'); | ||
| 342 | - lineName = arrChk.val(); | ||
| 343 | - // 请求参数 | ||
| 344 | - var params = {lineId:id}; | ||
| 345 | - // 弹出正在加载层 | ||
| 346 | - var index = layer.load(0); | ||
| 347 | - /** 生成线路行单 @pararm:<params:请求参数> */ | ||
| 348 | - $post('/stationroute/usingSingle',params,function(data) { | ||
| 349 | - // 关闭弹出框 | ||
| 350 | - layer.close(index); | ||
| 351 | - if(data.status=='SUCCESS') { | ||
| 352 | - // 弹出添加成功提示消息 | ||
| 353 | - layer.msg('生成线路【'+ lineName +'】路单文件成功!'); | ||
| 354 | - }else if(data.status=='ERROR'){ | ||
| 355 | - // 弹出添加成功提示消息 | ||
| 356 | - layer.msg('生成线路【'+ lineName +'】路单文件失败!'); | ||
| 357 | - }else if(data.status=='NOTDATA') { | ||
| 358 | - // 弹出添加成功提示消息 | ||
| 359 | - layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!'); | ||
| 360 | - }else if(data.status=='NOLinePlayType') { | ||
| 361 | - // 弹出添加成功提示消息 | ||
| 362 | - layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!'); | ||
| 363 | - } | ||
| 364 | - }); | 341 | + layer.open({ |
| 342 | + id:1, | ||
| 343 | + type: 1, | ||
| 344 | + title: "线路文件版本号", | ||
| 345 | + // skin:'layui-layer-rim', | ||
| 346 | + area:['450px', 'auto'], | ||
| 347 | + | ||
| 348 | + content: '<div class="col-sm-12">' | ||
| 349 | + +'<div class="input-group">' | ||
| 350 | + +'<span class="input-group-addon"> 线路文件版本号 :</span>' | ||
| 351 | + +'<input id="fileVersionsInput" type="text" class="form-control" placeholder="没有填写默认为2">' | ||
| 352 | + +'</div>' | ||
| 353 | + +'</div>', | ||
| 354 | + btn:['确定','取消'], | ||
| 355 | + btn1: function (index,layero) { | ||
| 356 | + var fileVersions = $('#fileVersionsInput').val(); | ||
| 357 | + id = arrChk.data('id'); | ||
| 358 | + lineName = arrChk.val(); | ||
| 359 | + // 请求参数 | ||
| 360 | + var params = {lineId:id, fileVersions:fileVersions}; | ||
| 361 | + // 弹出正在加载层 | ||
| 362 | + var index = layer.load(0); | ||
| 363 | + /** 生成线路行单 @pararm:<params:请求参数> */ | ||
| 364 | + $post('/stationroute/usingSingle',params,function(data) { | ||
| 365 | + // 关闭弹出框 | ||
| 366 | + layer.close(index); | ||
| 367 | + if(data.status=='SUCCESS') { | ||
| 368 | + // 弹出添加成功提示消息 | ||
| 369 | + layer.msg('生成线路【'+ lineName +'】路单文件成功!'); | ||
| 370 | + }else if(data.status=='ERROR'){ | ||
| 371 | + // 弹出添加成功提示消息 | ||
| 372 | + layer.msg('生成线路【'+ lineName +'】路单文件失败!'); | ||
| 373 | + }else if(data.status=='NOTDATA') { | ||
| 374 | + // 弹出添加成功提示消息 | ||
| 375 | + layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!'); | ||
| 376 | + }else if(data.status=='NOLinePlayType') { | ||
| 377 | + // 弹出添加成功提示消息 | ||
| 378 | + layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!'); | ||
| 379 | + } | ||
| 380 | + }); | ||
| 381 | + }, | ||
| 382 | + btn2:function (index,layero) { | ||
| 383 | + layer.close(index); | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + }); | ||
| 387 | + | ||
| 388 | + | ||
| 365 | } | 389 | } |
| 366 | }); | 390 | }); |
| 367 | /** 生成路线(路段和站点) */ | 391 | /** 生成路线(路段和站点) */ |
src/main/resources/static/pages/base/stationroute/edit.html
| @@ -190,7 +190,11 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | @@ -190,7 +190,11 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | ||
| 190 | fun.linePanlThree(addLine.id,data,add_direction_v); | 190 | fun.linePanlThree(addLine.id,data,add_direction_v); |
| 191 | }); | 191 | }); |
| 192 | fun.editMapStatusRemove(); | 192 | fun.editMapStatusRemove(); |
| 193 | - } | 193 | + setTimeout(function () { |
| 194 | + var stationArray = map_.getStationArray(); | ||
| 195 | + map_.openStationInfoWin(stationArray[editStationParmasObj.stationRouteId]); | ||
| 196 | + },1000); | ||
| 197 | + } | ||
| 194 | // 编辑表单元素 | 198 | // 编辑表单元素 |
| 195 | var form = $('#edit_station_form'); | 199 | var form = $('#edit_station_form'); |
| 196 | // 获取错误提示元素 | 200 | // 获取错误提示元素 |
| @@ -206,9 +210,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | @@ -206,9 +210,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | ||
| 206 | errorClass : 'help-block help-block-error', | 210 | errorClass : 'help-block help-block-error', |
| 207 | focusInvalid : false, | 211 | focusInvalid : false, |
| 208 | rules : { | 212 | rules : { |
| 209 | - 'zdmc' : { required : true,maxlength : 50,},// 站点名称 必填项 | ||
| 210 | - 'stationName' : { required : true,maxlength : 50,},// 站点名称 必填项 | ||
| 211 | - 'stationCod': {required : true,},// 站点编码 必填项 | 213 | + 'zdmc' : { required : true,maxlength : 50},// 站点名称 必填项 |
| 214 | + 'stationName' : { required : true,maxlength : 50},// 站点名称 必填项 | ||
| 215 | + 'stationCod': {required : true},// 站点编码 必填项 | ||
| 212 | 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 | 216 | 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 |
| 213 | 'stationRouteCode' : {isStart : true},// 站点序号 | 217 | 'stationRouteCode' : {isStart : true},// 站点序号 |
| 214 | 'stationMark' : {required : true},// 站点类型 必填项 | 218 | 'stationMark' : {required : true},// 站点类型 必填项 |
src/main/resources/static/pages/base/stationroute/edit_select.html
| @@ -14,10 +14,6 @@ | @@ -14,10 +14,6 @@ | ||
| 14 | <button class="close" data-close="alert"></button> | 14 | <button class="close" data-close="alert"></button> |
| 15 | 站点名称为必填项 | 15 | 站点名称为必填项 |
| 16 | </div> | 16 | </div> |
| 17 | - <div class="alert alert-danger display-hide" id="serchrname"> | ||
| 18 | - <button class="close" data-close="alert"></button> | ||
| 19 | - 系统无法生成,请选择其他方式新增 | ||
| 20 | - </div> | ||
| 21 | <div class="form-group" id="formRequ"> | 17 | <div class="form-group" id="formRequ"> |
| 22 | <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> | 18 | <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> |
| 23 | <div class="col-md-9" id="errorInfo"> | 19 | <div class="col-md-9" id="errorInfo"> |
| @@ -29,10 +25,13 @@ | @@ -29,10 +25,13 @@ | ||
| 29 | <div class="col-md-9"> | 25 | <div class="col-md-9"> |
| 30 | <div class="icheck-list"> | 26 | <div class="icheck-list"> |
| 31 | <label> | 27 | <label> |
| 32 | - <input type="radio" class="icheck" name="editselect" value=0> 重新绘制位置 | 28 | + <input type="radio" class="icheck" name="editselect" value=0> 重新绘制为多边形 |
| 33 | </label> | 29 | </label> |
| 34 | <label> | 30 | <label> |
| 35 | - <input type="radio" class="icheck" name="editselect" value=1 checked> 编辑原始位置 | 31 | + <input type="radio" class="icheck" name="editselect" value=1> 重新绘制为圆形 |
| 32 | + </label> | ||
| 33 | + <label> | ||
| 34 | + <input type="radio" class="icheck" name="editselect" value=2 checked> 编辑原始位置 | ||
| 36 | </label> | 35 | </label> |
| 37 | </div> | 36 | </div> |
| 38 | </div> | 37 | </div> |
| @@ -124,6 +123,19 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | @@ -124,6 +123,19 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | ||
| 124 | map_.localtionPoint(editStationName+"公交站点"); | 123 | map_.localtionPoint(editStationName+"公交站点"); |
| 125 | fun.editMapStatus(); | 124 | fun.editMapStatus(); |
| 126 | }else if(params.editselect==1){ | 125 | }else if(params.editselect==1){ |
| 126 | + WorldsBMap.localSearchFromAdreesToPoint(editStationName+"公交站点", function (Points) { | ||
| 127 | + if (Points) { | ||
| 128 | + Station.stationJwpoints = Points; | ||
| 129 | + } | ||
| 130 | + Station.stationShapesType = 'r'; | ||
| 131 | + Station.stationGPloyonGrid = null; | ||
| 132 | + Station.stationRadius = 100; | ||
| 133 | + editStationObj.setEitdStation(Station); | ||
| 134 | + editStationObj.setEitdStationName(editStationName); | ||
| 135 | + map_.editShapes(editStationObj); | ||
| 136 | + }); | ||
| 137 | + fun.editMapStatus(); | ||
| 138 | + }else if(params.editselect==2){ | ||
| 127 | editStationObj.setEitdStation(Station); | 139 | editStationObj.setEitdStation(Station); |
| 128 | editStationObj.setEitdStationName(editStationName); | 140 | editStationObj.setEitdStationName(editStationName); |
| 129 | map_.clearMark(); | 141 | map_.clearMark(); |
src/main/resources/static/pages/base/stationroute/editsection.html
| @@ -110,6 +110,9 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu | @@ -110,6 +110,9 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu | ||
| 110 | ajaxd.getSectionRouteInfo(lineId,dir,function(data) { | 110 | ajaxd.getSectionRouteInfo(lineId,dir,function(data) { |
| 111 | fun.linePanlThree(lineId,data,dir); | 111 | fun.linePanlThree(lineId,data,dir); |
| 112 | }); | 112 | }); |
| 113 | + setTimeout(function () { | ||
| 114 | + map_.openSectionInfoWin(p); | ||
| 115 | + },1000); | ||
| 113 | } | 116 | } |
| 114 | // 编辑表单元素 | 117 | // 编辑表单元素 |
| 115 | var form = $('#edit_section__form'); | 118 | var form = $('#edit_section__form'); |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| @@ -24,9 +24,19 @@ | @@ -24,9 +24,19 @@ | ||
| 24 | 24 | ||
| 25 | window.WorldsBMap = function () { | 25 | window.WorldsBMap = function () { |
| 26 | 26 | ||
| 27 | - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆; road_win_show_p:信息窗口打开状态的路段,map_status:地图编辑状态,drawingManager:绘画工具*/ | ||
| 28 | - var mapBValue = '',polygon = '', polyUpline = '', circle = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', sectionArray = [], stationArray = new Map(),map_status = 0, | ||
| 29 | - drawingManager; | 27 | + /** WorldsBMap 全局变量定义 mapBValue:地图对象; road_win_show_p:信息窗口打开状态的路段, |
| 28 | + * sectionArray: 路段集合,stationArray: 站点集合 | ||
| 29 | + * map_status:地图编辑状态,drawingManager:绘画工具, topOverlay:置顶视图*/ | ||
| 30 | + var mapBValue = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', | ||
| 31 | + sectionArray = [], stationArray = new Map(), | ||
| 32 | + map_status = 0,drawingManager,topOverlay; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 编辑缓冲区 | ||
| 36 | + * stationMarkers: 站点图标集合 | ||
| 37 | + */ | ||
| 38 | + var editCircle, editPolygon, dragMarker, stationMarkers = new Map(),centerPoint; | ||
| 39 | + | ||
| 30 | var styleOptions = { | 40 | var styleOptions = { |
| 31 | strokeColor:"blue", //边线颜色。 | 41 | strokeColor:"blue", //边线颜色。 |
| 32 | fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。 | 42 | fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。 |
| @@ -34,7 +44,39 @@ window.WorldsBMap = function () { | @@ -34,7 +44,39 @@ window.WorldsBMap = function () { | ||
| 34 | strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。 | 44 | strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。 |
| 35 | fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 | 45 | fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 |
| 36 | strokeStyle: 'solid' //边线的样式,solid或dashed。 | 46 | strokeStyle: 'solid' //边线的样式,solid或dashed。 |
| 37 | - } | 47 | + }; |
| 48 | + | ||
| 49 | + // 覆盖物置顶 | ||
| 50 | + var setTop = function(overlay) { | ||
| 51 | + if (topOverlay) | ||
| 52 | + topOverlay.setTop(false); | ||
| 53 | + overlay.setTop(true); | ||
| 54 | + topOverlay = overlay; | ||
| 55 | + }; | ||
| 56 | + | ||
| 57 | + var setDragMarker = function (marker) { | ||
| 58 | + marker.enableDragging(); | ||
| 59 | + dragMarker = marker; | ||
| 60 | + dragMarker._old_point = dragMarker._position; | ||
| 61 | + //监听拖拽事件 dragging | ||
| 62 | + dragMarker.addEventListener('dragging', dragMarkerDragEvent); | ||
| 63 | + }; | ||
| 64 | + | ||
| 65 | + var dragMarkerDragEvent = function (e) { | ||
| 66 | + if (editPolygon) { | ||
| 67 | + if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) | ||
| 68 | + dragMarker.setPosition(dragMarker._old_point);//还原位置 | ||
| 69 | + | ||
| 70 | + centerPoint = e.target._position; | ||
| 71 | + } | ||
| 72 | + else if (editCircle) { | ||
| 73 | + editCircle.disableEditing(); | ||
| 74 | + //缓冲区跟随点位运动 | ||
| 75 | + editCircle.setCenter(e.target._position); | ||
| 76 | + editCircle.enableEditing(); | ||
| 77 | + centerPoint = e.target._position; | ||
| 78 | + } | ||
| 79 | + }; | ||
| 38 | 80 | ||
| 39 | var Bmap = { | 81 | var Bmap = { |
| 40 | 82 | ||
| @@ -44,7 +86,7 @@ window.WorldsBMap = function () { | @@ -44,7 +86,7 @@ window.WorldsBMap = function () { | ||
| 44 | // 百度API Key | 86 | // 百度API Key |
| 45 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | 87 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 46 | // 初始化百度地图 | 88 | // 初始化百度地图 |
| 47 | - mapBValue = new BMap.Map("bmap_basic"); | 89 | + mapBValue = new BMap.Map("bmap_basic" , {enableMapClick: false}); |
| 48 | //中心点和缩放级别 | 90 | //中心点和缩放级别 |
| 49 | mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); | 91 | mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); |
| 50 | //启用地图拖拽事件,默认启用(可不写) | 92 | //启用地图拖拽事件,默认启用(可不写) |
| @@ -62,24 +104,21 @@ window.WorldsBMap = function () { | @@ -62,24 +104,21 @@ window.WorldsBMap = function () { | ||
| 62 | getmapBValue: function () { | 104 | getmapBValue: function () { |
| 63 | return mapBValue; | 105 | return mapBValue; |
| 64 | }, | 106 | }, |
| 65 | - getPolygon: function () { | ||
| 66 | - return polygon; | ||
| 67 | - }, | ||
| 68 | - getPolyUpline: function () { | ||
| 69 | - return polyUpline; | ||
| 70 | - }, | ||
| 71 | - getCircle: function () { | ||
| 72 | - return circle; | 107 | + setMap_status : function (i) { |
| 108 | + map_status = i; | ||
| 73 | }, | 109 | }, |
| 74 | getIsEditStatus: function () { | 110 | getIsEditStatus: function () { |
| 75 | return iseditStatus; | 111 | return iseditStatus; |
| 76 | }, | 112 | }, |
| 77 | - setMap_status : function (i) { | ||
| 78 | - map_status = i; | ||
| 79 | - }, | ||
| 80 | setIsEditStatus: function (v) { | 113 | setIsEditStatus: function (v) { |
| 81 | iseditStatus = v; | 114 | iseditStatus = v; |
| 82 | }, | 115 | }, |
| 116 | + getStationArray: function () { | ||
| 117 | + return stationArray; | ||
| 118 | + }, | ||
| 119 | + setStationArray : function (s) { | ||
| 120 | + stationArray = s; | ||
| 121 | + }, | ||
| 83 | /*initDrawingManager: function (map, styleOptions) { | 122 | /*initDrawingManager: function (map, styleOptions) { |
| 84 | },*/ | 123 | },*/ |
| 85 | getDrawingManagerObj: function () { | 124 | getDrawingManagerObj: function () { |
| @@ -100,59 +139,35 @@ window.WorldsBMap = function () { | @@ -100,59 +139,35 @@ window.WorldsBMap = function () { | ||
| 100 | 139 | ||
| 101 | /** 获取距离与时间 @param <points:坐标点集合> */ | 140 | /** 获取距离与时间 @param <points:坐标点集合> */ |
| 102 | getDistanceAndDuration: function (points, callback) { | 141 | getDistanceAndDuration: function (points, callback) { |
| 103 | - | ||
| 104 | // 获取长度 | 142 | // 获取长度 |
| 105 | var len = points.length; | 143 | var len = points.length; |
| 106 | - | ||
| 107 | (function () { | 144 | (function () { |
| 108 | - | ||
| 109 | if (!arguments.callee.count) { | 145 | if (!arguments.callee.count) { |
| 110 | - | ||
| 111 | arguments.callee.count = 0; | 146 | arguments.callee.count = 0; |
| 112 | - | ||
| 113 | } | 147 | } |
| 114 | - | ||
| 115 | arguments.callee.count++; | 148 | arguments.callee.count++; |
| 116 | - | ||
| 117 | var index = parseInt(arguments.callee.count) - 1; | 149 | var index = parseInt(arguments.callee.count) - 1; |
| 118 | - | ||
| 119 | if (index >= len - 1) { | 150 | if (index >= len - 1) { |
| 120 | - | ||
| 121 | callback && callback(points); | 151 | callback && callback(points); |
| 122 | - | ||
| 123 | return; | 152 | return; |
| 124 | } | 153 | } |
| 125 | - | ||
| 126 | // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | 154 | // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) |
| 127 | var f = arguments.callee; | 155 | var f = arguments.callee; |
| 128 | - | ||
| 129 | // 起点坐标 <坐标格式:40.056878,116.30815> | 156 | // 起点坐标 <坐标格式:40.056878,116.30815> |
| 130 | var origin = points[index].potion.lat + ',' + points[index].potion.lng; | 157 | var origin = points[index].potion.lat + ',' + points[index].potion.lng; |
| 131 | - | ||
| 132 | // 终点坐标 <坐标格式:40.056878,116.30815> | 158 | // 终点坐标 <坐标格式:40.056878,116.30815> |
| 133 | var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng; | 159 | var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng; |
| 134 | - | ||
| 135 | var region = '上海'; | 160 | var region = '上海'; |
| 136 | - | ||
| 137 | var origin_region = '上海'; | 161 | var origin_region = '上海'; |
| 138 | - | ||
| 139 | var destination_region = '上海'; | 162 | var destination_region = '上海'; |
| 140 | - | ||
| 141 | var output = 'json'; | 163 | var output = 'json'; |
| 142 | - | ||
| 143 | var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | 164 | var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; |
| 144 | - | ||
| 145 | /** | 165 | /** |
| 146 | * origin:起点名称或经纬度; | 166 | * origin:起点名称或经纬度; |
| 147 | - * | ||
| 148 | * destination:终点名称或经纬度; | 167 | * destination:终点名称或经纬度; |
| 149 | - * | ||
| 150 | * origin_region:起始点所在城市,驾车导航时必填。 | 168 | * origin_region:起始点所在城市,驾车导航时必填。 |
| 151 | - * | ||
| 152 | * destination_region:终点所在城市,驾车导航时必填。 | 169 | * destination_region:终点所在城市,驾车导航时必填。 |
| 153 | - * | ||
| 154 | * output :表示输出类型,可设置为xml或json,默认为xml。 | 170 | * output :表示输出类型,可设置为xml或json,默认为xml。 |
| 155 | - * | ||
| 156 | **/ | 171 | **/ |
| 157 | var paramsB = { | 172 | var paramsB = { |
| 158 | origin: origin, | 173 | origin: origin, |
| @@ -166,60 +181,40 @@ window.WorldsBMap = function () { | @@ -166,60 +181,40 @@ window.WorldsBMap = function () { | ||
| 166 | 181 | ||
| 167 | /** @description :未认证开发者默认配额为:2000次/天。 */ | 182 | /** @description :未认证开发者默认配额为:2000次/天。 */ |
| 168 | $.ajax({ | 183 | $.ajax({ |
| 169 | - | ||
| 170 | // 百度地图根据坐标获取两点之间的时间与距离 | 184 | // 百度地图根据坐标获取两点之间的时间与距离 |
| 171 | url: 'http://api.map.baidu.com/direction/v1?mode=transit', | 185 | url: 'http://api.map.baidu.com/direction/v1?mode=transit', |
| 172 | - | ||
| 173 | data: paramsB, | 186 | data: paramsB, |
| 174 | - | ||
| 175 | dataType: 'jsonp', | 187 | dataType: 'jsonp', |
| 176 | - | ||
| 177 | success: function (r) { | 188 | success: function (r) { |
| 178 | - | ||
| 179 | if (r) { | 189 | if (r) { |
| 180 | - | ||
| 181 | if (r.message == 'ok') { | 190 | if (r.message == 'ok') { |
| 182 | - | ||
| 183 | if (r.result.taxi == null) { | 191 | if (r.result.taxi == null) { |
| 184 | - | ||
| 185 | // 获取距离(单位:米) | 192 | // 获取距离(单位:米) |
| 186 | points[index + 1].distance = 0; | 193 | points[index + 1].distance = 0; |
| 187 | - | ||
| 188 | // 获取时间(单位:秒) | 194 | // 获取时间(单位:秒) |
| 189 | points[index + 1].duration = 0; | 195 | points[index + 1].duration = 0; |
| 190 | - | ||
| 191 | } else { | 196 | } else { |
| 192 | - | ||
| 193 | // 获取距离(单位:米) | 197 | // 获取距离(单位:米) |
| 194 | points[index + 1].distance = r.result.taxi.distance; | 198 | points[index + 1].distance = r.result.taxi.distance; |
| 195 | - | ||
| 196 | // 获取时间(单位:秒) | 199 | // 获取时间(单位:秒) |
| 197 | points[index + 1].duration = r.result.taxi.duration; | 200 | points[index + 1].duration = r.result.taxi.duration; |
| 198 | - | ||
| 199 | } | 201 | } |
| 200 | - | ||
| 201 | - | ||
| 202 | } | 202 | } |
| 203 | - | ||
| 204 | } | 203 | } |
| 205 | - | ||
| 206 | f(); | 204 | f(); |
| 207 | } | 205 | } |
| 208 | }); | 206 | }); |
| 209 | - | ||
| 210 | })(); | 207 | })(); |
| 211 | - | ||
| 212 | }, | 208 | }, |
| 209 | + | ||
| 213 | // 打开站点信息窗口 | 210 | // 打开站点信息窗口 |
| 214 | openStationInfoWin : function (objStation) { | 211 | openStationInfoWin : function (objStation) { |
| 215 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | 212 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) |
| 216 | - mapBValue.setZoom(25); | ||
| 217 | if (objStation) { | 213 | if (objStation) { |
| 218 | // 站点形状 | 214 | // 站点形状 |
| 219 | var shapes = objStation.stationShapesType; | 215 | var shapes = objStation.stationShapesType; |
| 220 | // 获取中心坐标点字符串分割 | 216 | // 获取中心坐标点字符串分割 |
| 221 | var BJwpoints = objStation.stationJwpoints.split(' '); | 217 | var BJwpoints = objStation.stationJwpoints.split(' '); |
| 222 | - | ||
| 223 | // 中心坐标点 | 218 | // 中心坐标点 |
| 224 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | 219 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 225 | var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11; | 220 | var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11; |
| @@ -270,102 +265,59 @@ window.WorldsBMap = function () { | @@ -270,102 +265,59 @@ window.WorldsBMap = function () { | ||
| 270 | //开启信息窗口 | 265 | //开启信息窗口 |
| 271 | mapBValue.openInfoWindow(infoWindow_target, point); | 266 | mapBValue.openInfoWindow(infoWindow_target, point); |
| 272 | }, 100); | 267 | }, 100); |
| 273 | - // 是否在平移过程中禁止动画。(自1.2新增) | ||
| 274 | - var PanOptions_ = {noAnimation: true}; | ||
| 275 | // 将地图的中心点更改为给定的点。 | 268 | // 将地图的中心点更改为给定的点。 |
| 276 | - mapBValue.panTo(point, PanOptions_); | ||
| 277 | - // mapBValue.panBy(10, -150, PanOptions_); | 269 | + mapBValue.panTo(point); |
| 278 | } | 270 | } |
| 279 | }, | 271 | }, |
| 280 | 272 | ||
| 281 | - editPolyUpline: function () { | ||
| 282 | - // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | ||
| 283 | - polyUpline.disableMassClear(); | ||
| 284 | - WorldsBMap.clearMarkAndOverlays(); | ||
| 285 | - // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | ||
| 286 | - polyUpline.enableMassClear(); | ||
| 287 | - // 开启线路编辑 | ||
| 288 | - polyUpline.enableEditing(); | ||
| 289 | - // 添加双击折线保存事件 | ||
| 290 | - polyUpline.addEventListener('dblclick', function (e) { | ||
| 291 | - // 关闭 | ||
| 292 | - layer.closeAll(); | ||
| 293 | - polyUpline.disableEditing(); | ||
| 294 | - // 获取折线坐标集合 | ||
| 295 | - var editPloyLineArray = polyUpline.getPath(); | ||
| 296 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 297 | - polyUpline = ''; | ||
| 298 | - // 加载修改路段弹出层mobal页面 | ||
| 299 | - $.get('editsection.html', function (m) { | ||
| 300 | - $(pjaxContainer).append(m); | ||
| 301 | - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap, GetAjaxData, EditSectionObj, PublicFunctions]); | ||
| 302 | - }); | ||
| 303 | - }); | ||
| 304 | - }, | ||
| 305 | - | ||
| 306 | // 根据地理名称获取百度经纬度坐标 | 273 | // 根据地理名称获取百度经纬度坐标 |
| 307 | localSearchFromAdreesToPoint: function (Address, callback) { | 274 | localSearchFromAdreesToPoint: function (Address, callback) { |
| 308 | - | ||
| 309 | // 创建一个搜索类实例 | 275 | // 创建一个搜索类实例 |
| 310 | var localSearch = new BMap.LocalSearch(mapBValue); | 276 | var localSearch = new BMap.LocalSearch(mapBValue); |
| 311 | - | ||
| 312 | // 检索完成后的回调函数。 | 277 | // 检索完成后的回调函数。 |
| 313 | localSearch.setSearchCompleteCallback(function (searchResult) { | 278 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| 314 | - | ||
| 315 | var resultPoints = ''; | 279 | var resultPoints = ''; |
| 316 | - | ||
| 317 | if (searchResult) { | 280 | if (searchResult) { |
| 318 | - | ||
| 319 | // 返回索引指定的结果。索引0表示第1条结果 | 281 | // 返回索引指定的结果。索引0表示第1条结果 |
| 320 | var poi = searchResult.getPoi(0); | 282 | var poi = searchResult.getPoi(0); |
| 321 | - | ||
| 322 | if (poi) { | 283 | if (poi) { |
| 323 | - | ||
| 324 | //获取经度和纬度 | 284 | //获取经度和纬度 |
| 325 | resultPoints = poi.point.lng + ' ' + poi.point.lat; | 285 | resultPoints = poi.point.lng + ' ' + poi.point.lat; |
| 326 | - | ||
| 327 | callback && callback(resultPoints); | 286 | callback && callback(resultPoints); |
| 328 | - | ||
| 329 | } else { | 287 | } else { |
| 330 | - | ||
| 331 | callback && callback(false); | 288 | callback && callback(false); |
| 332 | - | ||
| 333 | } | 289 | } |
| 334 | - | ||
| 335 | } else { | 290 | } else { |
| 336 | - | ||
| 337 | callback && callback(false); | 291 | callback && callback(false); |
| 338 | } | 292 | } |
| 339 | - | ||
| 340 | }); | 293 | }); |
| 341 | - | ||
| 342 | // 根据检索词发起检索。 | 294 | // 根据检索词发起检索。 |
| 343 | localSearch.search(Address); | 295 | localSearch.search(Address); |
| 344 | - | ||
| 345 | }, | 296 | }, |
| 346 | 297 | ||
| 347 | - // 编辑图形 | 298 | + // 编辑站点 |
| 348 | editShapes: function (obj) { | 299 | editShapes: function (obj) { |
| 349 | // 关闭信息窗口 | 300 | // 关闭信息窗口 |
| 350 | mapBValue.closeInfoWindow(); | 301 | mapBValue.closeInfoWindow(); |
| 351 | - | ||
| 352 | // 清除marker | 302 | // 清除marker |
| 353 | // mapBValue.removeOverlay(marker); | 303 | // mapBValue.removeOverlay(marker); |
| 354 | var station = obj.getEitdStation(); | 304 | var station = obj.getEitdStation(); |
| 355 | var stationShapesTypeV = station.stationShapesType; | 305 | var stationShapesTypeV = station.stationShapesType; |
| 306 | + setDragMarker(stationMarkers[station.stationRouteId]); | ||
| 356 | // 编辑圆 | 307 | // 编辑圆 |
| 357 | if (stationShapesTypeV == 'r') { | 308 | if (stationShapesTypeV == 'r') { |
| 358 | - | ||
| 359 | // 获取中心坐标点字符串分割 | 309 | // 获取中心坐标点字符串分割 |
| 360 | var BJwpoints = station.stationJwpoints.split(' '); | 310 | var BJwpoints = station.stationJwpoints.split(' '); |
| 361 | // 中心坐标点 | 311 | // 中心坐标点 |
| 362 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | 312 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 363 | //创建圆 | 313 | //创建圆 |
| 364 | - circle = new BMap.Circle(point, station.stationRadius, { | 314 | + var circle = new BMap.Circle(point, station.stationRadius, { |
| 365 | strokeColor: "blue", | 315 | strokeColor: "blue", |
| 366 | strokeWeight: 2, | 316 | strokeWeight: 2, |
| 367 | strokeOpacity: 0.7 | 317 | strokeOpacity: 0.7 |
| 368 | }); | 318 | }); |
| 319 | + mapBValue.centerAndZoom(point, 18); | ||
| 320 | + editCircle = circle; | ||
| 369 | // 允许覆盖物在map.clearOverlays方法中被清除 | 321 | // 允许覆盖物在map.clearOverlays方法中被清除 |
| 370 | circle.enableMassClear(); | 322 | circle.enableMassClear(); |
| 371 | // 百度地图添加覆盖物圆 | 323 | // 百度地图添加覆盖物圆 |
| @@ -378,7 +330,7 @@ window.WorldsBMap = function () { | @@ -378,7 +330,7 @@ window.WorldsBMap = function () { | ||
| 378 | var newRadius = circle.getRadius(); | 330 | var newRadius = circle.getRadius(); |
| 379 | // 返回圆形的中心点坐标。 | 331 | // 返回圆形的中心点坐标。 |
| 380 | var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | 332 | var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; |
| 381 | - var centre_New = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}]; | 333 | + // var centre_points = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}]; |
| 382 | /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | 334 | /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ |
| 383 | EditStationObj.setEitdStationJwpoints(newCenter); | 335 | EditStationObj.setEitdStationJwpoints(newCenter); |
| 384 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | 336 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| @@ -387,13 +339,14 @@ window.WorldsBMap = function () { | @@ -387,13 +339,14 @@ window.WorldsBMap = function () { | ||
| 387 | EditStationObj.setEitdStationRadius(Math.round(newRadius)); | 339 | EditStationObj.setEitdStationRadius(Math.round(newRadius)); |
| 388 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | 340 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 389 | EditStationObj.setEitdBPolygonGrid(''); | 341 | EditStationObj.setEitdBPolygonGrid(''); |
| 342 | + // 清除正在编辑的站点 | ||
| 343 | + editCircle = null; | ||
| 390 | // 加载编辑页面 | 344 | // 加载编辑页面 |
| 391 | $.get('edit.html', function (m) { | 345 | $.get('edit.html', function (m) { |
| 392 | $(pjaxContainer).append(m); | 346 | $(pjaxContainer).append(m); |
| 393 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); | 347 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); |
| 394 | }); | 348 | }); |
| 395 | }); | 349 | }); |
| 396 | - | ||
| 397 | // 编辑多变行 | 350 | // 编辑多变行 |
| 398 | } else if (stationShapesTypeV == 'd') { | 351 | } else if (stationShapesTypeV == 'd') { |
| 399 | // 获取中心点坐标字符串 | 352 | // 获取中心点坐标字符串 |
| @@ -413,9 +366,8 @@ window.WorldsBMap = function () { | @@ -413,9 +366,8 @@ window.WorldsBMap = function () { | ||
| 413 | for (var v = 0; v < pointPolygonArray.length; v++) { | 366 | for (var v = 0; v < pointPolygonArray.length; v++) { |
| 414 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0], pointPolygonArray[v].split(" ")[1])); | 367 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0], pointPolygonArray[v].split(" ")[1])); |
| 415 | } | 368 | } |
| 416 | - | ||
| 417 | // 画多边形 | 369 | // 画多边形 |
| 418 | - polygon = new BMap.Polygon(polygonP, { | 370 | + var polygon = new BMap.Polygon(polygonP, { |
| 419 | // 线条显色 | 371 | // 线条显色 |
| 420 | strokeColor: "blue", | 372 | strokeColor: "blue", |
| 421 | // 边线的宽度,以像素为单位。 | 373 | // 边线的宽度,以像素为单位。 |
| @@ -423,92 +375,46 @@ window.WorldsBMap = function () { | @@ -423,92 +375,46 @@ window.WorldsBMap = function () { | ||
| 423 | // 边线透明度,取值范围0 - 1。 | 375 | // 边线透明度,取值范围0 - 1。 |
| 424 | strokeOpacity: 0.7 | 376 | strokeOpacity: 0.7 |
| 425 | }); | 377 | }); |
| 426 | - | 378 | + mapBValue.centerAndZoom(pointPolygon, 18); |
| 379 | + editPolygon = polygon; | ||
| 427 | // 增加地图覆盖物多边形 | 380 | // 增加地图覆盖物多边形 |
| 428 | mapBValue.addOverlay(polygon); | 381 | mapBValue.addOverlay(polygon); |
| 429 | - | ||
| 430 | // 开启编辑功能(自 1.1 新增) | 382 | // 开启编辑功能(自 1.1 新增) |
| 431 | polygon.enableEditing(); | 383 | polygon.enableEditing(); |
| 432 | - | ||
| 433 | // 添加多变行编辑事件 | 384 | // 添加多变行编辑事件 |
| 434 | polygon.addEventListener('dblclick', function (e) { | 385 | polygon.addEventListener('dblclick', function (e) { |
| 435 | - | ||
| 436 | // 获取编辑的多边形对象 | 386 | // 获取编辑的多边形对象 |
| 437 | var edit_pointE = polygon; | 387 | var edit_pointE = polygon; |
| 438 | - | ||
| 439 | var edit_bPloygonGrid = ""; | 388 | var edit_bPloygonGrid = ""; |
| 440 | - | ||
| 441 | var editPolyGonLen_ = edit_pointE.getPath().length; | 389 | var editPolyGonLen_ = edit_pointE.getPath().length; |
| 442 | - | ||
| 443 | for (var k = 0; k < editPolyGonLen_; k++) { | 390 | for (var k = 0; k < editPolyGonLen_; k++) { |
| 444 | - | ||
| 445 | if (k == 0) { | 391 | if (k == 0) { |
| 446 | - | ||
| 447 | edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | 392 | edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 448 | - | ||
| 449 | } else { | 393 | } else { |
| 450 | - | ||
| 451 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | 394 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 452 | - | ||
| 453 | } | 395 | } |
| 454 | - | ||
| 455 | } | 396 | } |
| 456 | - | ||
| 457 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | 397 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; |
| 458 | - | ||
| 459 | // 多边形中心点 | 398 | // 多边形中心点 |
| 460 | - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | ||
| 461 | - | ||
| 462 | - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | ||
| 463 | - EditStationObj.setEitdStationJwpoints(centre_points); | ||
| 464 | - | 399 | + // var centre = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; |
| 400 | + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) centerPoint可拖动点 */ | ||
| 401 | + EditStationObj.setEitdStationJwpoints(centerPoint.lng+' '+centerPoint.lat); | ||
| 465 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | 402 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| 466 | EditStationObj.setEitdStationShapesType('d'); | 403 | EditStationObj.setEitdStationShapesType('d'); |
| 467 | - | ||
| 468 | /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | 404 | /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ |
| 469 | EditStationObj.setEitdStationRadius(''); | 405 | EditStationObj.setEitdStationRadius(''); |
| 470 | - | ||
| 471 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | 406 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 472 | EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); | 407 | EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); |
| 473 | - | 408 | + // 清除正在编辑的站点 |
| 409 | + editPolygon = null; | ||
| 474 | $.get('edit.html', function (m) { | 410 | $.get('edit.html', function (m) { |
| 475 | - | ||
| 476 | $(pjaxContainer).append(m); | 411 | $(pjaxContainer).append(m); |
| 477 | - | ||
| 478 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); | 412 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); |
| 479 | - | ||
| 480 | }); | 413 | }); |
| 481 | - | ||
| 482 | }); | 414 | }); |
| 483 | - | ||
| 484 | } | 415 | } |
| 485 | - | ||
| 486 | }, | 416 | }, |
| 487 | 417 | ||
| 488 | - // 在地图上画出上行线路走向 | ||
| 489 | - /*drawingUpline: function (polylineArray, polyline_center, data) { | ||
| 490 | - /!*WorldsBMap.clearMarkAndOverlays();*!/ | ||
| 491 | - polyUpline = ''; | ||
| 492 | - // 创建线路走向 | ||
| 493 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor: "red", strokeWeight: 6, strokeOpacity: 0.7}); | ||
| 494 | - // polyUpline.data = data; | ||
| 495 | - // 把折线添加到地图上 | ||
| 496 | - mapBValue.addOverlay(polyUpline); | ||
| 497 | - /!*var ceter_index = Math.round(resultdata.length / 2); | ||
| 498 | - | ||
| 499 | - var ceterPointsStr = resultdata[ceter_index].bJwpoints; | ||
| 500 | - | ||
| 501 | - var ceterPointsArray = ceterPointsStr.split(' '); | ||
| 502 | - | ||
| 503 | - var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*!/ | ||
| 504 | - var PanOptions_ = {noAnimation: true}; | ||
| 505 | - mapBValue.reset(); | ||
| 506 | - mapBValue.panTo(polyline_center, PanOptions_); | ||
| 507 | - mapBValue.panBy(500, -510, PanOptions_); | ||
| 508 | - mapBValue.setZoom(14); | ||
| 509 | - },*/ | ||
| 510 | - | ||
| 511 | - | ||
| 512 | // 画路段走向 | 418 | // 画路段走向 |
| 513 | drawingUpline01: function (polyline_center, datas) { | 419 | drawingUpline01: function (polyline_center, datas) { |
| 514 | if (polyline_center && datas) { | 420 | if (polyline_center && datas) { |
| @@ -558,8 +464,9 @@ window.WorldsBMap = function () { | @@ -558,8 +464,9 @@ window.WorldsBMap = function () { | ||
| 558 | }); | 464 | }); |
| 559 | sectionArray.push(polyUpline01); | 465 | sectionArray.push(polyUpline01); |
| 560 | } | 466 | } |
| 561 | - mapBValue.setCenter(polyline_center); | ||
| 562 | - mapBValue.setZoom(15); | 467 | + // mapBValue.setCenter(polyline_center); |
| 468 | + mapBValue.panTo(polyline_center); | ||
| 469 | + // mapBValue.setZoom(15); | ||
| 563 | // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | 470 | // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) |
| 564 | // polyUpline01.disableMassClear(); | 471 | // polyUpline01.disableMassClear(); |
| 565 | } | 472 | } |
| @@ -595,6 +502,7 @@ window.WorldsBMap = function () { | @@ -595,6 +502,7 @@ window.WorldsBMap = function () { | ||
| 595 | WorldsBMap.openStationInfoWin(station); | 502 | WorldsBMap.openStationInfoWin(station); |
| 596 | }); | 503 | }); |
| 597 | stationArray[station.stationRouteId] = station; | 504 | stationArray[station.stationRouteId] = station; |
| 505 | + stationMarkers[station.stationRouteId] = myRichMarker1; | ||
| 598 | }, | 506 | }, |
| 599 | 507 | ||
| 600 | // 站点名称获取百度坐标(手动规划) | 508 | // 站点名称获取百度坐标(手动规划) |
| @@ -725,99 +633,44 @@ window.WorldsBMap = function () { | @@ -725,99 +633,44 @@ window.WorldsBMap = function () { | ||
| 725 | localtionPoint: function (stationNameV) { | 633 | localtionPoint: function (stationNameV) { |
| 726 | // 关闭信息窗口 | 634 | // 关闭信息窗口 |
| 727 | mapBValue.closeInfoWindow(); | 635 | mapBValue.closeInfoWindow(); |
| 728 | - | ||
| 729 | WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) { | 636 | WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) { |
| 730 | - | ||
| 731 | if (Points) { | 637 | if (Points) { |
| 732 | - | ||
| 733 | var BJwpointsArray = Points.split(' '); | 638 | var BJwpointsArray = Points.split(' '); |
| 734 | - | ||
| 735 | var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | 639 | var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); |
| 736 | - | ||
| 737 | var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | 640 | var marker_stargt2 = new BMap.Marker(stationNameChangePoint); |
| 738 | - | ||
| 739 | - var PanOptions = {noAnimation: true}; | ||
| 740 | - | ||
| 741 | - mapBValue.panTo(stationNameChangePoint, PanOptions); | ||
| 742 | - | ||
| 743 | - mapBValue.panBy(0, -100); | ||
| 744 | - | 641 | + mapBValue.panTo(stationNameChangePoint); |
| 745 | // 将标注添加到地图中 | 642 | // 将标注添加到地图中 |
| 746 | mapBValue.addOverlay(marker_stargt2); | 643 | mapBValue.addOverlay(marker_stargt2); |
| 747 | - | ||
| 748 | //跳动的动画 | 644 | //跳动的动画 |
| 749 | marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | 645 | marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); |
| 750 | - | ||
| 751 | } | 646 | } |
| 752 | - | ||
| 753 | }); | 647 | }); |
| 754 | - | ||
| 755 | }, | 648 | }, |
| 756 | 649 | ||
| 757 | /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ | 650 | /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ |
| 758 | getBmapStationNames: function (lineNameValue, i, callback) { | 651 | getBmapStationNames: function (lineNameValue, i, callback) { |
| 759 | - | ||
| 760 | var busline = new BMap.BusLineSearch(mapBValue, { | 652 | var busline = new BMap.BusLineSearch(mapBValue, { |
| 761 | - | ||
| 762 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | 653 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 |
| 763 | onGetBusListComplete: function (BusListResult) { | 654 | onGetBusListComplete: function (BusListResult) { |
| 764 | - | ||
| 765 | // 如果不为空 | 655 | // 如果不为空 |
| 766 | if (BusListResult) { | 656 | if (BusListResult) { |
| 767 | - | ||
| 768 | //获取第一个公交列表显示到map上 | 657 | //获取第一个公交列表显示到map上 |
| 769 | var fstLine = BusListResult.getBusListItem(i); | 658 | var fstLine = BusListResult.getBusListItem(i); |
| 770 | - | ||
| 771 | - /*if(fstLine==undefined){ | ||
| 772 | - | ||
| 773 | - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | ||
| 774 | - | ||
| 775 | - layer.closeAll(); | ||
| 776 | - | ||
| 777 | - if(i==0){ | ||
| 778 | - | ||
| 779 | - $('#upToolsMobal').show(); | ||
| 780 | - | ||
| 781 | - }else if(i==1){ | ||
| 782 | - | ||
| 783 | - $('#downToolsMobal').show(); | ||
| 784 | - | ||
| 785 | - } | ||
| 786 | - | ||
| 787 | - return; | ||
| 788 | - }); | ||
| 789 | - | ||
| 790 | - }*/ | ||
| 791 | - | ||
| 792 | if (fstLine == undefined) { | 659 | if (fstLine == undefined) { |
| 793 | - | ||
| 794 | - | ||
| 795 | callback && callback(null); | 660 | callback && callback(null); |
| 796 | - | ||
| 797 | } | 661 | } |
| 798 | - | ||
| 799 | busline.getBusLine(fstLine); | 662 | busline.getBusLine(fstLine); |
| 800 | - | ||
| 801 | } | 663 | } |
| 802 | - | ||
| 803 | }, | 664 | }, |
| 804 | - | ||
| 805 | //设置公交线路查询后的回调函数.参数:rs: BusLine类型 | 665 | //设置公交线路查询后的回调函数.参数:rs: BusLine类型 |
| 806 | onGetBusLineComplete: function (BusLine) { | 666 | onGetBusLineComplete: function (BusLine) { |
| 807 | - | ||
| 808 | // 如果不为空 | 667 | // 如果不为空 |
| 809 | if (BusLine) { | 668 | if (BusLine) { |
| 810 | - | ||
| 811 | callback && callback(BusLine); | 669 | callback && callback(BusLine); |
| 812 | - | ||
| 813 | } | 670 | } |
| 814 | - | ||
| 815 | } | 671 | } |
| 816 | - | ||
| 817 | }); | 672 | }); |
| 818 | - | ||
| 819 | busline.getBusList(lineNameValue); | 673 | busline.getBusList(lineNameValue); |
| 820 | - | ||
| 821 | }, | 674 | }, |
| 822 | // 修改站点 | 675 | // 修改站点 |
| 823 | editStation: function (stationRouteId) { | 676 | editStation: function (stationRouteId) { |
| @@ -952,6 +805,9 @@ window.WorldsBMap = function () { | @@ -952,6 +805,9 @@ window.WorldsBMap = function () { | ||
| 952 | break; | 805 | break; |
| 953 | } | 806 | } |
| 954 | } | 807 | } |
| 808 | + // 路段中间点为中心 | ||
| 809 | + var c = p.ia[Math.floor(p.ia.length/2)]; | ||
| 810 | + mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18); | ||
| 955 | p.addEventListener('dblclick', function () { | 811 | p.addEventListener('dblclick', function () { |
| 956 | /** 设置修改路段集合对象为空 */ | 812 | /** 设置修改路段集合对象为空 */ |
| 957 | editPolyline = ''; | 813 | editPolyline = ''; |
| @@ -1230,8 +1086,7 @@ window.WorldsBMap = function () { | @@ -1230,8 +1086,7 @@ window.WorldsBMap = function () { | ||
| 1230 | }); | 1086 | }); |
| 1231 | //开启信息窗口 | 1087 | //开启信息窗口 |
| 1232 | mapBValue.openInfoWindow(infoWindow_target, centerPoint); | 1088 | mapBValue.openInfoWindow(infoWindow_target, centerPoint); |
| 1233 | - mapBValue.setZoom(18); | ||
| 1234 | - mapBValue.setCenter(centerPoint); | 1089 | + mapBValue.panTo(centerPoint); |
| 1235 | }, | 1090 | }, |
| 1236 | /** | 1091 | /** |
| 1237 | * 绘制新增路段 | 1092 | * 绘制新增路段 |
| @@ -1310,7 +1165,7 @@ window.WorldsBMap = function () { | @@ -1310,7 +1165,7 @@ window.WorldsBMap = function () { | ||
| 1310 | strGetLength: function (str) { | 1165 | strGetLength: function (str) { |
| 1311 | return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度 | 1166 | return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度 |
| 1312 | } | 1167 | } |
| 1313 | - } | 1168 | + }; |
| 1314 | 1169 | ||
| 1315 | return Bmap; | 1170 | return Bmap; |
| 1316 | 1171 |
src/main/resources/static/pages/base/stationroute/list.html
| @@ -255,6 +255,7 @@ | @@ -255,6 +255,7 @@ | ||
| 255 | </div> | 255 | </div> |
| 256 | </div> | 256 | </div> |
| 257 | </div> | 257 | </div> |
| 258 | +<script src="/assets/js/baidu/bd_GeoUtils_min.js" ></script> | ||
| 258 | <!-- 线路类 --> | 259 | <!-- 线路类 --> |
| 259 | <script src="/pages/base/stationroute/js/line.js"></script> | 260 | <script src="/pages/base/stationroute/js/line.js"></script> |
| 260 | <!-- 新增站点对象类 --> | 261 | <!-- 新增站点对象类 --> |
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/core/InternalLpObj.js
| 1 | -/** | ||
| 2 | - * 内部路牌对象。 | ||
| 3 | - * @constructor | ||
| 4 | - */ | ||
| 5 | -var InternalLpObj = function( | ||
| 6 | - orilpObj, // 原始路牌对象 | ||
| 7 | - qCount, // 总共多少圈 | ||
| 8 | - isUp // 圈是以上行开始还是下行开始 | ||
| 9 | -) { | ||
| 10 | - // TODO:原始路牌对象(这个路牌是对接外部gantt图像,以后有机会改了) | ||
| 11 | - this._$$_orign_lp_obj = orilpObj; | ||
| 12 | - | ||
| 13 | - this._$_isUp = isUp; | ||
| 14 | - | ||
| 15 | - // 路牌的圈数,注意每个路牌的圈数都是一致的, | ||
| 16 | - // 但并不是每一圈都有值 | ||
| 17 | - // 第1圈从上标线开始 | ||
| 18 | - // 第0圈表示中标线的第一个班次组成的半圈 | ||
| 19 | - // 有多少圈根据最终迭代的结果来看 | ||
| 20 | - this._$_qCount = qCount; | ||
| 21 | - // 保存的是 InternalGroupBcObj 对象 | ||
| 22 | - this._$_groupBcArray = new Array(qCount); | ||
| 23 | - | ||
| 24 | - var i; | ||
| 25 | - for (i = 0; i < this._$_qCount; i++) { | ||
| 26 | - this._$_groupBcArray[i] = new InternalGroupObj( | ||
| 27 | - this, this._$_isUp, undefined, undefined); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - // 距离上一个路牌的最小发车间隔时间 | ||
| 31 | - // 用于纵向添加班次的时候使用 | ||
| 32 | - // 默认第一个路牌为0 | ||
| 33 | - this._$_minVerticalIntervalTime = 0; | ||
| 34 | - | ||
| 35 | - // 详细记录每圈每个方向上的发车间隔时间 | ||
| 36 | - // 第一维度表示圈数,第二维度表示第一个方向,第二个方向 | ||
| 37 | - // 第一个方向是否上行由 _$_isUp 决定 | ||
| 38 | - // 这里的间隔表示下一个路牌上的班次距离本路牌的班次发车时间间隔 | ||
| 39 | - // 如果当前是最后一个路牌,表示第一个路牌的下一圈同方向班次距离本班次的间隔 | ||
| 40 | - this._$_aVerticalIntervalTime = new Array(this._$_qCount); | ||
| 41 | - for (i = 0; i < this._$_aVerticalIntervalTime.length; i++) { | ||
| 42 | - this._$_aVerticalIntervalTime[i] = new Array(2); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - // 班型的相关变量 | ||
| 46 | - this._$_bx_isLb = false; // 是否连班 | ||
| 47 | - this._$_bx_isfb = false; // 是否分班 | ||
| 48 | - this._$_bx_isfb_5_2 = false; // 是否5休2分班 | ||
| 49 | - this._$_bx_desc; // 班型描述(默认为路牌编号) | ||
| 50 | - | ||
| 51 | - // 其他班次(进出场,例包,吃饭等),TODO:以后再拆 | ||
| 52 | - this._$_other_bc_array = []; | ||
| 53 | - | ||
| 54 | - // TODO: | ||
| 55 | - | ||
| 56 | -}; | ||
| 57 | - | ||
| 58 | -//------------------- get/set 方法 -------------------// | ||
| 59 | - | ||
| 60 | -InternalLpObj.prototype.getOtherBcArray = function() { | ||
| 61 | - return this._$_other_bc_array; | ||
| 62 | -}; | ||
| 63 | -InternalLpObj.prototype.addOtherBcArray = function(ba) { | ||
| 64 | - this._$_other_bc_array = this._$_other_bc_array.concat(ba); | ||
| 65 | -}; | ||
| 66 | - | ||
| 67 | -/** | ||
| 68 | - * 获取圈 | ||
| 69 | - * @param qIndex 圈index | ||
| 70 | - */ | ||
| 71 | -InternalLpObj.prototype.getGroup = function(qIndex) { | ||
| 72 | - return this._$_groupBcArray[qIndex]; | ||
| 73 | -}; | ||
| 74 | - | ||
| 75 | -/** | ||
| 76 | - * 获取路牌圈数。 | ||
| 77 | - * @returns {*} | ||
| 78 | - */ | ||
| 79 | -InternalLpObj.prototype.fnGetGroupCount = function() { | ||
| 80 | - return this._$_qCount; | ||
| 81 | -}; | ||
| 82 | - | ||
| 83 | -/** | ||
| 84 | - * 是否上行。 | ||
| 85 | - * @returns boolean | ||
| 86 | - */ | ||
| 87 | -InternalLpObj.prototype.isUp = function() { | ||
| 88 | - return this._$_isUp; | ||
| 89 | -}; | ||
| 90 | - | ||
| 91 | -/** | ||
| 92 | - * 获取班次。 | ||
| 93 | - * @param qIndex 第几圈 | ||
| 94 | - * @param bcIndex 第几个班次 | ||
| 95 | - */ | ||
| 96 | -InternalLpObj.prototype.getBc = function(qIndex, bcIndex) { | ||
| 97 | - var group = this._$_groupBcArray[qIndex]; | ||
| 98 | - var bc; | ||
| 99 | - if (bcIndex == 0) { | ||
| 100 | - bc = group.getBc1(); | ||
| 101 | - } else if (bcIndex == 1) { | ||
| 102 | - bc = group.getBc2(); | ||
| 103 | - } | ||
| 104 | - return bc; | ||
| 105 | -}; | ||
| 106 | - | ||
| 107 | -/** | ||
| 108 | - * 在具体位置设置班次。 | ||
| 109 | - * @param qIndex 第几圈 | ||
| 110 | - * @param bcIndex 第几个班次 | ||
| 111 | - * @param bc 班次对象 | ||
| 112 | - */ | ||
| 113 | -InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) { | ||
| 114 | - var group = this._$_groupBcArray[qIndex]; | ||
| 115 | - if (bcIndex == 0) { | ||
| 116 | - group.setBc1(bc); | ||
| 117 | - bc.setGroup(group); | ||
| 118 | - } else if (bcIndex == 1) { | ||
| 119 | - group.setBc2(bc); | ||
| 120 | - bc.setGroup(group); | ||
| 121 | - } | ||
| 122 | -}; | ||
| 123 | - | ||
| 124 | -/** | ||
| 125 | - * 设置原始路牌对象。 | ||
| 126 | - * @param lpObj 原始路牌对象 | ||
| 127 | - */ | ||
| 128 | -InternalLpObj.prototype.setLp = function(lpObj) { | ||
| 129 | - this._$$_orign_lp_obj = lpObj; | ||
| 130 | - var i; | ||
| 131 | - var group; | ||
| 132 | - for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 133 | - group = this._$_groupBcArray[i]; | ||
| 134 | - if (group) { | ||
| 135 | - group.setLp(this); // 圈和班次保存都是 InternalLpObj 对象 | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | -}; | ||
| 139 | - | ||
| 140 | -InternalLpObj.prototype.getLpNo = function() { | ||
| 141 | - return this._$$_orign_lp_obj.lpNo; | ||
| 142 | -}; | ||
| 143 | -InternalLpObj.prototype.getLpName = function() { | ||
| 144 | - return this._$$_orign_lp_obj.lpName; | ||
| 145 | -}; | ||
| 146 | -InternalLpObj.prototype.setBxFb5_2 = function(fb) { | ||
| 147 | - this._$_bx_isfb_5_2 = fb; | ||
| 148 | -}; | ||
| 149 | -InternalLpObj.prototype.isBxFb5_2 = function() { | ||
| 150 | - return this._$_bx_isfb_5_2; | ||
| 151 | -}; | ||
| 152 | -InternalLpObj.prototype.setBxLb = function(lb) { | ||
| 153 | - this._$_bx_isLb = lb; | ||
| 154 | -}; | ||
| 155 | -InternalLpObj.prototype.isBxLb = function() { | ||
| 156 | - return this._$_bx_isLb; | ||
| 157 | -}; | ||
| 158 | - | ||
| 159 | -InternalLpObj.prototype.setBxFb = function(fb) { | ||
| 160 | - this._$_bx_isfb = fb; | ||
| 161 | -}; | ||
| 162 | -InternalLpObj.prototype.isBxFb = function() { | ||
| 163 | - return this._$_bx_isfb; | ||
| 164 | -}; | ||
| 165 | - | ||
| 166 | -/** | ||
| 167 | - * 设置路牌的班型描述(最终是设置班次的路牌名字)。 | ||
| 168 | - * @param desc 描述 | ||
| 169 | - */ | ||
| 170 | -InternalLpObj.prototype.setBxDesc = function(desc) { | ||
| 171 | - // 最终原始路牌的名字 | ||
| 172 | - this._$$_orign_lp_obj.lpName = desc + "_" + this._$$_orign_lp_obj.lpNo; | ||
| 173 | - // 内部对象的班型描述 | ||
| 174 | - this._$_bx_desc = desc; | ||
| 175 | -}; | ||
| 176 | -/** | ||
| 177 | - * 获取版型描述 | ||
| 178 | - * @returns string | ||
| 179 | - */ | ||
| 180 | -InternalLpObj.prototype.getBxDesc = function() { | ||
| 181 | - return this._$_bx_desc; | ||
| 182 | -}; | ||
| 183 | - | ||
| 184 | -/** | ||
| 185 | - * 设置纵向最小发车间隔时间。 | ||
| 186 | - * @param v | ||
| 187 | - */ | ||
| 188 | -InternalLpObj.prototype.setVerticalMinIntervalTime = function(v) { | ||
| 189 | - // 第一个路牌,都为0 | ||
| 190 | - this._$_minVerticalIntervalTime = v; | ||
| 191 | -}; | ||
| 192 | -/** | ||
| 193 | - * 获取纵向最小发车间隔时间。 | ||
| 194 | - * @returns {number|*} | ||
| 195 | - */ | ||
| 196 | -InternalLpObj.prototype.getVerticalMinIntervalTime = function() { | ||
| 197 | - return this._$_minVerticalIntervalTime; | ||
| 198 | -}; | ||
| 199 | - | ||
| 200 | -/** | ||
| 201 | - * 设置纵向发车间隔。 | ||
| 202 | - * @param iQindex 圈index | ||
| 203 | - * @param iBindex 班次index | ||
| 204 | - * @param iTime 间隔时间 | ||
| 205 | - */ | ||
| 206 | -InternalLpObj.prototype.fnSetVerticalIntervalTime = function(iQindex, iBindex, iTime) { | ||
| 207 | - this._$_aVerticalIntervalTime[iQindex][iBindex] = iTime; | ||
| 208 | -}; | ||
| 209 | - | ||
| 210 | -/** | ||
| 211 | - * 返回纵向发车间隔。 | ||
| 212 | - * @param iQindex 圈index | ||
| 213 | - * @param iBindex 班次index | ||
| 214 | - */ | ||
| 215 | -InternalLpObj.prototype.fnGetVerticalIntervalTime = function(iQindex, iBindex) { | ||
| 216 | - return this._$_aVerticalIntervalTime[iQindex][iBindex]; | ||
| 217 | -}; | ||
| 218 | - | ||
| 219 | -//-------------------- 班次操作方法(查询,统计,删除) -----------------------// | ||
| 220 | - | ||
| 221 | -/** | ||
| 222 | - * 返回总共班次数。 | ||
| 223 | - */ | ||
| 224 | -InternalLpObj.prototype.getBcCount = function() { | ||
| 225 | - var i; | ||
| 226 | - var group; | ||
| 227 | - var bccount = 0; | ||
| 228 | - for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 229 | - group = this._$_groupBcArray[i]; | ||
| 230 | - if (group) { | ||
| 231 | - if (group.getBc1()) { | ||
| 232 | - bccount += 1; | ||
| 233 | - } | ||
| 234 | - if (group.getBc2()) { | ||
| 235 | - bccount += 1; | ||
| 236 | - } | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | - | ||
| 240 | - return bccount; | ||
| 241 | -}; | ||
| 242 | - | ||
| 243 | -/** | ||
| 244 | - * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。 | ||
| 245 | - * @returns arrays (InternalBcObj) | ||
| 246 | - */ | ||
| 247 | -InternalLpObj.prototype.getBcArray = function() { | ||
| 248 | - var bcArray = []; | ||
| 249 | - var i; | ||
| 250 | - var group; | ||
| 251 | - for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 252 | - group = this._$_groupBcArray[i]; | ||
| 253 | - if (group) { | ||
| 254 | - group.getBc1() ? bcArray.push(group.getBc1()) : ""; | ||
| 255 | - group.getBc2() ? bcArray.push(group.getBc2()) : ""; | ||
| 256 | - } | ||
| 257 | - } | ||
| 258 | - | ||
| 259 | - return bcArray; | ||
| 260 | -}; | ||
| 261 | - | ||
| 262 | -/** | ||
| 263 | - * 获取最小(最早)班次对象。 | ||
| 264 | - * @returns [{圈index},{班次index}] | ||
| 265 | - */ | ||
| 266 | -InternalLpObj.prototype.getMinBcObjPosition = function() { | ||
| 267 | - var i; | ||
| 268 | - var bIndex = []; | ||
| 269 | - for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 270 | - if (this._$_groupBcArray[i].getBc1()) { | ||
| 271 | - bIndex.push(i); | ||
| 272 | - bIndex.push(0); | ||
| 273 | - break; | ||
| 274 | - } | ||
| 275 | - if (this._$_groupBcArray[i].getBc2()) { | ||
| 276 | - bIndex.push(i); | ||
| 277 | - bIndex.push(1); | ||
| 278 | - break; | ||
| 279 | - } | ||
| 280 | - } | ||
| 281 | - return bIndex; | ||
| 282 | -}; | ||
| 283 | - | ||
| 284 | -/** | ||
| 285 | - * 获取最大(最晚)班次对象。 | ||
| 286 | - * @returns [{圈index},{班次index}] | ||
| 287 | - */ | ||
| 288 | -InternalLpObj.prototype.getMaxBcObjPosition = function() { | ||
| 289 | - var i; | ||
| 290 | - var bIndex = []; | ||
| 291 | - for (i = this._$_groupBcArray.length - 1; i >= 0; i--) { | ||
| 292 | - if (this._$_groupBcArray[i].getBc2()) { | ||
| 293 | - bIndex.push(i); | ||
| 294 | - bIndex.push(1); | ||
| 295 | - break; | ||
| 296 | - } | ||
| 297 | - if (this._$_groupBcArray[i].getBc1()) { | ||
| 298 | - bIndex.push(i); | ||
| 299 | - bIndex.push(0); | ||
| 300 | - break; | ||
| 301 | - } | ||
| 302 | - } | ||
| 303 | - return bIndex; | ||
| 304 | -}; | ||
| 305 | - | ||
| 306 | -InternalLpObj.prototype.getMinBcObj = function() { | ||
| 307 | - var i; | ||
| 308 | - var bcObj; | ||
| 309 | - for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 310 | - bcObj = this._$_groupBcArray[i].getBc1(); | ||
| 311 | - if (bcObj) { | ||
| 312 | - break; | ||
| 313 | - } | ||
| 314 | - bcObj = this._$_groupBcArray[i].getBc2(); | ||
| 315 | - if (bcObj) { | ||
| 316 | - break; | ||
| 317 | - } | ||
| 318 | - } | ||
| 319 | - return bcObj; | ||
| 320 | -}; | ||
| 321 | -InternalLpObj.prototype.getMaxBcObj = function() { | ||
| 322 | - var i; | ||
| 323 | - var bcObj; | ||
| 324 | - for (i = this._$_groupBcArray.length - 1; i >= 0; i--) { | ||
| 325 | - bcObj = this._$_groupBcArray[i].getBc2(); | ||
| 326 | - if (bcObj) { | ||
| 327 | - break; | ||
| 328 | - } | ||
| 329 | - bcObj = this._$_groupBcArray[i].getBc1(); | ||
| 330 | - if (bcObj) { | ||
| 331 | - break; | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | - return bcObj; | ||
| 335 | -}; | ||
| 336 | - | ||
| 337 | -/** | ||
| 338 | - * 获取车次链信息。 | ||
| 339 | - * @param num 第几个车次链 | ||
| 340 | - * @returns object {s_q: {开始圈索引},s_b : {开始班次索引},e_q : {结束圈索引},e_b : {结束班次索引}, bcount : {班次数}} | ||
| 341 | - */ | ||
| 342 | -InternalLpObj.prototype.fnGetBcChainInfo = function(num) { | ||
| 343 | - // 计算总的车次链信息 | ||
| 344 | - var aChainInfo = []; | ||
| 345 | - var oChainInfo; | ||
| 346 | - var aBcIndex = this.getMinBcObjPosition(); | ||
| 347 | - var oBc; | ||
| 348 | - var iQIndex; | ||
| 349 | - var iBcIndex; | ||
| 350 | - var i; | ||
| 351 | - var bFlag; | ||
| 352 | - | ||
| 353 | - var iBcount = 0; | ||
| 354 | - | ||
| 355 | - if (aBcIndex.length == 2) { | ||
| 356 | - iBcount = 1; | ||
| 357 | - oChainInfo = {s_q : aBcIndex[0], s_b : aBcIndex[1], e_q : aBcIndex[0], e_b : aBcIndex[1], bcount: 1}; | ||
| 358 | - aChainInfo.push(oChainInfo); | ||
| 359 | - bFlag = true; | ||
| 360 | - | ||
| 361 | - // 下一个班次的索引 | ||
| 362 | - iQIndex = aBcIndex[1] == 0 ? aBcIndex[0] : aBcIndex[0] + 1; | ||
| 363 | - iBcIndex = aBcIndex[1] == 0 ? 1 : 0; | ||
| 364 | - | ||
| 365 | - for (i = iQIndex; i < this._$_qCount; i++) { | ||
| 366 | - while (iBcIndex <= 1) { | ||
| 367 | - oBc = this.getBc(i, iBcIndex); | ||
| 368 | - if (!oBc) { | ||
| 369 | - if (bFlag) { | ||
| 370 | - // 车次链结尾是这个班次的前一个班次 | ||
| 371 | - oChainInfo.e_q = iBcIndex == 0 ? i - 1 : i; | ||
| 372 | - oChainInfo.e_b = iBcIndex == 0 ? 1 : 0; | ||
| 373 | - oChainInfo.bcount = iBcount; | ||
| 374 | - } | ||
| 375 | - | ||
| 376 | - bFlag = false; | ||
| 377 | - } else { | ||
| 378 | - if (bFlag) { | ||
| 379 | - iBcount ++; | ||
| 380 | - oChainInfo.bcount = iBcount; | ||
| 381 | - } else { | ||
| 382 | - // 下一个车次链开始 | ||
| 383 | - iBcount = 1; | ||
| 384 | - oChainInfo = {s_q : i, s_b : iBcIndex, e_q : i, e_b : iBcIndex, bcount: 1}; | ||
| 385 | - aChainInfo.push(oChainInfo); | ||
| 386 | - bFlag = true; | ||
| 387 | - } | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | - | ||
| 391 | - iBcIndex ++; | ||
| 392 | - } | ||
| 393 | - iBcIndex = 0; | ||
| 394 | - } | ||
| 395 | - | ||
| 396 | - } | ||
| 397 | - | ||
| 398 | - return aChainInfo[num]; | ||
| 399 | -}; | ||
| 400 | - | ||
| 401 | -/** | ||
| 402 | - * 获取车次链的个数。 | ||
| 403 | - * @returns int | ||
| 404 | - */ | ||
| 405 | -InternalLpObj.prototype.fnGetBcChainCount = function() { | ||
| 406 | - var iChainCount = 0; | ||
| 407 | - var aBcIndex = this.getMinBcObjPosition(); | ||
| 408 | - | ||
| 409 | - var oBc; | ||
| 410 | - var iQIndex; | ||
| 411 | - var iBcIndex; | ||
| 412 | - var i; | ||
| 413 | - var bFlag; | ||
| 414 | - | ||
| 415 | - if (aBcIndex.length == 2) { | ||
| 416 | - iChainCount = 1; | ||
| 417 | - bFlag = true; | ||
| 418 | - | ||
| 419 | - // 下一个班次的索引 | ||
| 420 | - iQIndex = aBcIndex[1] == 0 ? aBcIndex[0] : aBcIndex[0] + 1; | ||
| 421 | - iBcIndex = aBcIndex[1] == 0 ? 1 : 0; | ||
| 422 | - | ||
| 423 | - for (i = iQIndex; i < this._$_qCount; i++) { | ||
| 424 | - while (iBcIndex <= 1) { | ||
| 425 | - oBc = this.getBc(i, iBcIndex); | ||
| 426 | - if (!oBc) { | ||
| 427 | - bFlag = false; | ||
| 428 | - } else { | ||
| 429 | - if (bFlag) { | ||
| 430 | - | ||
| 431 | - } else { | ||
| 432 | - iChainCount ++; | ||
| 433 | - bFlag = true; | ||
| 434 | - } | ||
| 435 | - } | ||
| 436 | - | ||
| 437 | - | ||
| 438 | - iBcIndex ++; | ||
| 439 | - } | ||
| 440 | - iBcIndex = 0; | ||
| 441 | - } | ||
| 442 | - | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - | ||
| 446 | - return iChainCount; | ||
| 447 | -}; | ||
| 448 | - | ||
| 449 | -/** | ||
| 450 | - * 在具体位置移除班次。 | ||
| 451 | - * @param qIndex 第几圈 | ||
| 452 | - * @param bcIndex 第几个班次 | ||
| 453 | - */ | ||
| 454 | -InternalLpObj.prototype.removeBc = function(qIndex, bcIndex) { | ||
| 455 | - var group = this._$_groupBcArray[qIndex]; | ||
| 456 | - if (bcIndex == 0) { | ||
| 457 | - group.removeBc1(); | ||
| 458 | - } else if (bcIndex == 1) { | ||
| 459 | - group.removeBc2(); | ||
| 460 | - } | ||
| 461 | -}; | ||
| 462 | - | ||
| 463 | -/** | ||
| 464 | - * 使用指定时间匹配返回离之最近的第几圈第几个班次, | ||
| 465 | - * 使用时间差的绝度值,比较,取最小的 | ||
| 466 | - * 如果有两个一样的时间差,取比fctime大的时间 | ||
| 467 | - * @param fctime moment 比较用时间 | ||
| 468 | - * @param groupArray 圈数组 | ||
| 469 | - * @param hasUp boolean 计算上行班次 | ||
| 470 | - * @param hasDown boolean 计算下行班次 | ||
| 471 | - * @returns [{第几圈},{第几个班次}] | ||
| 472 | - */ | ||
| 473 | -InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | ||
| 474 | - fctime, groupArray, hasUp, hasDown | ||
| 475 | -) { | ||
| 476 | - var i; | ||
| 477 | - var timediff; // 时间差取绝对值 | ||
| 478 | - var qIndex; | ||
| 479 | - var bcIndex; | ||
| 480 | - | ||
| 481 | - var group; | ||
| 482 | - var bc1time; | ||
| 483 | - var bc2time; | ||
| 484 | - | ||
| 485 | - var tempdiff; | ||
| 486 | - | ||
| 487 | - console.log("比较时间=" + fctime.format("HH:mm")); | ||
| 488 | - | ||
| 489 | - var oBc; | ||
| 490 | - | ||
| 491 | - for (i = 0; i < this._$_qCount; i++) { | ||
| 492 | - group = groupArray[i]; | ||
| 493 | - if (group) { | ||
| 494 | - oBc = group.getBc1(); | ||
| 495 | - | ||
| 496 | - if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { | ||
| 497 | - bc1time = group.getBc1().getFcTimeObj(); | ||
| 498 | - console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff); | ||
| 499 | - tempdiff = Math.abs(bc1time.diff(fctime)); | ||
| 500 | - | ||
| 501 | - if (!timediff) { | ||
| 502 | - timediff = Math.abs(tempdiff); | ||
| 503 | - qIndex = i; | ||
| 504 | - bcIndex = 0; | ||
| 505 | - } else { | ||
| 506 | - if (tempdiff < timediff) { | ||
| 507 | - timediff = tempdiff; | ||
| 508 | - qIndex = i; | ||
| 509 | - bcIndex = 0; | ||
| 510 | - } if (Math.abs(tempdiff) == timediff) { | ||
| 511 | - if (bc1time.isAfter(fctime)) { | ||
| 512 | - timediff = tempdiff; | ||
| 513 | - qIndex = i; | ||
| 514 | - bcIndex = 0; | ||
| 515 | - } | ||
| 516 | - | ||
| 517 | - } | ||
| 518 | - } | ||
| 519 | - } | ||
| 520 | - | ||
| 521 | - oBc = group.getBc2(); | ||
| 522 | - if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { | ||
| 523 | - bc2time = group.getBc2().getFcTimeObj(); | ||
| 524 | - console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff); | ||
| 525 | - tempdiff = Math.abs(bc2time.diff(fctime)); | ||
| 526 | - | ||
| 527 | - if (!timediff) { | ||
| 528 | - timediff = Math.abs(tempdiff); | ||
| 529 | - qIndex = i; | ||
| 530 | - bcIndex = 1; | ||
| 531 | - } else { | ||
| 532 | - if (tempdiff < timediff) { | ||
| 533 | - timediff = tempdiff; | ||
| 534 | - qIndex = i; | ||
| 535 | - bcIndex = 1; | ||
| 536 | - } if (Math.abs(tempdiff) == timediff) { | ||
| 537 | - if (bc2time.isBefore(fctime)) { | ||
| 538 | - timediff = tempdiff; | ||
| 539 | - qIndex = i; | ||
| 540 | - bcIndex = 1; | ||
| 541 | - } | ||
| 542 | - | ||
| 543 | - } | ||
| 544 | - } | ||
| 545 | - } | ||
| 546 | - } | ||
| 547 | - } | ||
| 548 | - | ||
| 549 | - console.log("中标线对应数组索引=" + qIndex); | ||
| 550 | - | ||
| 551 | - var rst = []; | ||
| 552 | - rst.push(qIndex); | ||
| 553 | - rst.push(bcIndex); | ||
| 554 | - | ||
| 555 | - return rst; | ||
| 556 | -}; | ||
| 557 | - | ||
| 558 | -/** | ||
| 559 | - * 使用指定时间匹配返回离之最近的第几圈第几个班次, | ||
| 560 | - * 使用时间差的绝度值,比较,取最小的 | ||
| 561 | - * 如果有两个一样的时间差,取比fctime大的时间 | ||
| 562 | - * @param fctime moment 比较用时间 | ||
| 563 | - * @param hasUp boolean 计算上行班次 | ||
| 564 | - * @param hasDown boolean 计算下行班次 | ||
| 565 | - * @returns [{第几圈},{第几个班次}] | ||
| 566 | - */ | ||
| 567 | -InternalLpObj.prototype.getQBcIndexWithFcTime = function( | ||
| 568 | - fctime, hasUp, hasDown | ||
| 569 | -) { | ||
| 570 | - return this.fnGetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray, hasUp, hasDown); | ||
| 571 | -}; | ||
| 572 | - | ||
| 573 | -//---------------------- 内部数据初始化方法(不同于构造函数)---------------------// | ||
| 574 | - | ||
| 575 | -/** | ||
| 576 | - * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌 | ||
| 577 | - * 注意,之前有班次会删除后再创建。 | ||
| 578 | - * @param startTime 开始时间 | ||
| 579 | - * @param endTime 结束时间 | ||
| 580 | - * @param isUp 第一个班次是上行还是下行 | ||
| 581 | - * @param fromQ 从第几圈开始加入 | ||
| 582 | - * @param paramObj 参数对象 | ||
| 583 | - * @param factory 工厂对象 | ||
| 584 | - */ | ||
| 585 | -InternalLpObj.prototype.initDataFromTimeToTime = function( | ||
| 586 | - startTime, | ||
| 587 | - endTime, | ||
| 588 | - isUp, | ||
| 589 | - fromQ, | ||
| 590 | - paramObj, | ||
| 591 | - factory) { | ||
| 592 | - | ||
| 593 | - var bcData = []; // 班次数组 | ||
| 594 | - var bcObj; | ||
| 595 | - var kssj = startTime; | ||
| 596 | - var fcno = 1; // 发车顺序号 | ||
| 597 | - var bcCount = 1; // 班次数 | ||
| 598 | - do { | ||
| 599 | - bcObj = factory.createBcObj( | ||
| 600 | - this, "normal", isUp, fcno, kssj, paramObj); // this就是所属路牌对象 | ||
| 601 | - bcData.push(bcObj); | ||
| 602 | - | ||
| 603 | - kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime()); | ||
| 604 | - fcno ++; | ||
| 605 | - bcCount ++; | ||
| 606 | - isUp = !isUp; | ||
| 607 | - } while(kssj.isBefore(endTime)); | ||
| 608 | - bcCount--; | ||
| 609 | - | ||
| 610 | - //console.log("last -1;" + bcData[bcCount -2].getFcTimeObj().format("HH:mm")); | ||
| 611 | - //console.log("last;" + bcData[bcCount -1].getFcTimeObj().format("HH:mm")); | ||
| 612 | - //console.log("endtime: " + endTime.format("HH:mm")); | ||
| 613 | - | ||
| 614 | - //if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) { | ||
| 615 | - // // 如果最后一个班次的到达时间超过结束时间,也要去除 | ||
| 616 | - // bcData.splice(bcCount - 1, 1); | ||
| 617 | - //} | ||
| 618 | - | ||
| 619 | - this._initDataFromLbBcArray(bcData, fromQ); | ||
| 620 | - | ||
| 621 | -}; | ||
| 622 | - | ||
| 623 | -/** | ||
| 624 | - * 使用连班的班次数组初始化路牌(相应的圈会被覆盖)。 | ||
| 625 | - * @param bcArray 连班班次数组 | ||
| 626 | - * @param fromQ 从第几圈开始加入 | ||
| 627 | - */ | ||
| 628 | -InternalLpObj.prototype._initDataFromLbBcArray = function( | ||
| 629 | - bcArray, | ||
| 630 | - fromQ | ||
| 631 | -) { | ||
| 632 | - var _bc1Obj; | ||
| 633 | - var _bc2Obj; | ||
| 634 | - var _qObj; | ||
| 635 | - | ||
| 636 | - // 第一班次是上行还是下行 | ||
| 637 | - var isUp = bcArray[0].isUp(); | ||
| 638 | - | ||
| 639 | - if (bcArray.length > 0 && fromQ < this._$_qCount) { | ||
| 640 | - // 构造圈数 | ||
| 641 | - if (isUp != this._$_isUp) { | ||
| 642 | - // 如果方向不一致,意味着第一个班次是半圈 | ||
| 643 | - // 加半圈,并加在bc2上 | ||
| 644 | - _bc2Obj = bcArray.slice(0, 1)[0]; | ||
| 645 | - _qObj = new InternalGroupObj( | ||
| 646 | - this, | ||
| 647 | - this._$_isUp, | ||
| 648 | - undefined, | ||
| 649 | - _bc2Obj | ||
| 650 | - ); | ||
| 651 | - _bc2Obj.setGroup(_qObj); | ||
| 652 | - this._$_groupBcArray[fromQ] = _qObj; | ||
| 653 | - | ||
| 654 | - bcArray.splice(0, 1); | ||
| 655 | - fromQ ++; | ||
| 656 | - } | ||
| 657 | - | ||
| 658 | - var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈 | ||
| 659 | - var qCount2 = bcArray.length % 2; // 最后是否有半圈 | ||
| 660 | - | ||
| 661 | - while (fromQ < this._$_qCount) { | ||
| 662 | - if (qCount1 > 0) { | ||
| 663 | - _bc1Obj = bcArray.slice(0, 1)[0]; | ||
| 664 | - _bc2Obj = bcArray.slice(1, 2)[0]; | ||
| 665 | - _qObj = new InternalGroupObj( | ||
| 666 | - this, | ||
| 667 | - this._$_isUp, | ||
| 668 | - _bc1Obj, | ||
| 669 | - _bc2Obj | ||
| 670 | - ); | ||
| 671 | - _bc1Obj.setGroup(_qObj); | ||
| 672 | - _bc2Obj.setGroup(_qObj); | ||
| 673 | - this._$_groupBcArray[fromQ] = _qObj; | ||
| 674 | - | ||
| 675 | - bcArray.splice(0, 2); | ||
| 676 | - qCount1 --; | ||
| 677 | - } else if (qCount2 > 0) { | ||
| 678 | - // 加半圈,并加在bc1上 | ||
| 679 | - _bc1Obj = bcArray.slice(0, 1)[0]; | ||
| 680 | - _qObj = new InternalGroupObj( | ||
| 681 | - this, | ||
| 682 | - this._$_isUp, | ||
| 683 | - _bc1Obj, | ||
| 684 | - undefined | ||
| 685 | - ); | ||
| 686 | - _bc1Obj.setGroup(_qObj); | ||
| 687 | - this._$_groupBcArray[fromQ] = _qObj; | ||
| 688 | - | ||
| 689 | - bcArray.splice(0, 1); | ||
| 690 | - qCount2 --; | ||
| 691 | - } else { | ||
| 692 | - break; | ||
| 693 | - } | ||
| 694 | - | ||
| 695 | - fromQ ++; | ||
| 696 | - } | ||
| 697 | - } | ||
| 698 | -}; | ||
| 699 | - | ||
| 700 | -//-------------------------- 其他方法 ----------------------------// | ||
| 701 | - | ||
| 702 | -/** | ||
| 703 | - * 从指定位置的班次开始,往后所有的班次修正发车时间 | ||
| 704 | - * @param groupIndex | ||
| 705 | - * @param bcIndex | ||
| 706 | - * @param time | ||
| 707 | - */ | ||
| 708 | -InternalLpObj.prototype.fnAddMinuteToBcFcsj = function(groupIndex, bcIndex, time) { | ||
| 709 | - var i; | ||
| 710 | - var oCurBc; | ||
| 711 | - | ||
| 712 | - // 修正之前班次的停站时间 | ||
| 713 | - //oCurBc = this.getBc( | ||
| 714 | - // bcIndex == 0 ? groupIndex - 1 : groupIndex, | ||
| 715 | - // bcIndex == 1 ? 0 : 1 | ||
| 716 | - //); | ||
| 717 | - //if (oCurBc) { | ||
| 718 | - // oCurBc.setStopTime(oCurBc.getStopTime() + time); | ||
| 719 | - //} | ||
| 720 | - | ||
| 721 | - | ||
| 722 | - for (i = groupIndex; i < this._$_qCount; i++) { | ||
| 723 | - if (bcIndex == 0) { | ||
| 724 | - oCurBc = this.getBc(i, 0); | ||
| 725 | - if (oCurBc) { | ||
| 726 | - oCurBc.addMinuteToFcsj(time); | ||
| 727 | - } | ||
| 728 | - oCurBc = this.getBc(i, 1); | ||
| 729 | - if (oCurBc) { | ||
| 730 | - oCurBc.addMinuteToFcsj(time); | ||
| 731 | - } | ||
| 732 | - | ||
| 733 | - } else { | ||
| 734 | - oCurBc = this.getBc(i, 1); | ||
| 735 | - if (oCurBc) { | ||
| 736 | - oCurBc.addMinuteToFcsj(time); | ||
| 737 | - } | ||
| 738 | - | ||
| 739 | - } | ||
| 740 | - | ||
| 741 | - bcIndex = 0; | ||
| 742 | - } | ||
| 743 | -}; | ||
| 744 | - | ||
| 745 | -/** | ||
| 746 | - * 在指定位置添加一个吃饭班次。 | ||
| 747 | - * 注1:吃饭班次不是普通班次,不记录进圈,记录进_$_other_bc_array | ||
| 748 | - * 注2:添加吃饭班次时,会修改之前班次的停战时间,所以导致之后的班次的停战都会发生变化 | ||
| 749 | - * @param groupIndex | ||
| 750 | - * @param bcIndex | ||
| 751 | - * @param factory | ||
| 752 | - * @param paramObj | ||
| 753 | - * @returns int 相差时间(吃饭时间距离和停站时间相差值) | ||
| 754 | - */ | ||
| 755 | -InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, paramObj) { | ||
| 756 | - var oPreBc; | ||
| 757 | - var oEatBc; | ||
| 758 | - var iBcModifyTime; | ||
| 759 | - | ||
| 760 | - if (!this.getBc(groupIndex, bcIndex)) { // | ||
| 761 | - return 0; | ||
| 762 | - } | ||
| 763 | - | ||
| 764 | - oPreBc = this.getBc( // 前一个邻接班次 | ||
| 765 | - bcIndex == 0 ? groupIndex - 1 : groupIndex, | ||
| 766 | - bcIndex == 1 ? 0 : 1); | ||
| 767 | - if (oPreBc) { // 存在前一个班次 | ||
| 768 | - oEatBc = factory.createBcObj( | ||
| 769 | - this, | ||
| 770 | - "cf", | ||
| 771 | - !oPreBc.isUp(), // 和上一个班次方向相反 | ||
| 772 | - 1, | ||
| 773 | - paramObj.addMinute(oPreBc.getArrTimeObj(), oPreBc.getStopTime()), // 使用上一个班次的到达时间作为开始时间 | ||
| 774 | - paramObj | ||
| 775 | - ); | ||
| 776 | - | ||
| 777 | - //iBcModifyTime = oEatBc.getBcTime() - oPreBc.getStopTime(); // 后续班次要调整的时间 | ||
| 778 | - | ||
| 779 | - // 修正之后的班次发车时间 | ||
| 780 | - // 注意:之后那个班次发车时间就是吃饭班次的到达时间 | ||
| 781 | - iBcModifyTime = oEatBc.getArrTimeObj().diff(this.getBc(groupIndex, bcIndex).getFcTimeObj(), "m"); | ||
| 782 | - this.fnAddMinuteToBcFcsj(groupIndex, bcIndex, iBcModifyTime); | ||
| 783 | - | ||
| 784 | - oPreBc.setStopTime(0); // 不重置停站时间 | ||
| 785 | - oPreBc.fnSetEatTime(oEatBc.getBcTime()); | ||
| 786 | - | ||
| 787 | - //this._$_other_bc_array.push(oEatBc); | ||
| 788 | - | ||
| 789 | - return iBcModifyTime; | ||
| 790 | - } else { | ||
| 791 | - return false; | ||
| 792 | - } | ||
| 793 | - | ||
| 794 | -}; | ||
| 795 | - | ||
| 796 | -/** | ||
| 797 | - * 调整路牌的班次,通过调整停站时间,或者班次发车时间,不能让班次的到达时间和下一个班次的发车时间重叠。 | ||
| 798 | - * @param iPeakAverStopTime 高峰平均停站时间 | ||
| 799 | - * @param iTroughAverStopTime 低谷平均停站时间 | ||
| 800 | - * @param oParam 参数对象 | ||
| 801 | - */ | ||
| 802 | -InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTroughAverStopTime, oParam) { | ||
| 803 | - // 获取车次链个数 | ||
| 804 | - var iBcChainCount = this.fnGetBcChainCount(); | ||
| 805 | - | ||
| 806 | - var i; | ||
| 807 | - var j; | ||
| 808 | - var oBcIndex; | ||
| 809 | - var iQIndex; | ||
| 810 | - var iBcIndex; | ||
| 811 | - var iBcCount; | ||
| 812 | - var oBc; | ||
| 813 | - var oNextBc; | ||
| 814 | - | ||
| 815 | - var iBcStopTime; | ||
| 816 | - | ||
| 817 | - for (i = 0; i < iBcChainCount; i++) { | ||
| 818 | - oBcIndex = this.fnGetBcChainInfo(i); | ||
| 819 | - iQIndex = oBcIndex["s_q"]; | ||
| 820 | - iBcIndex = oBcIndex["s_b"]; | ||
| 821 | - iBcCount = oBcIndex["bcount"]; | ||
| 822 | - | ||
| 823 | - for (j = 0; j < iBcCount - 1; j++) { | ||
| 824 | - oBc = this.getBc(iQIndex, iBcIndex); | ||
| 825 | - oNextBc = this.getBc( | ||
| 826 | - iBcIndex == 0 ? iQIndex : iQIndex + 1, | ||
| 827 | - iBcIndex == 0 ? 1 : 0); | ||
| 828 | - | ||
| 829 | - if (oNextBc.fnIsFirstBc()) { // 如果同一路牌连续2个方向首站班次,都不做处理 | ||
| 830 | - continue; | ||
| 831 | - } | ||
| 832 | - | ||
| 833 | - // 不改变当前班次的行驶时间,修正停站时间和下一个班次的发车时间 | ||
| 834 | - iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m"); | ||
| 835 | - if (iBcStopTime < 0) { | ||
| 836 | - // 当前班次使用最小停站时间 | ||
| 837 | - oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp())); | ||
| 838 | - oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime); | ||
| 839 | - | ||
| 840 | - } else { | ||
| 841 | - if (iBcStopTime == oBc.getStopTime() + oBc.fnGetEatTime()) { | ||
| 842 | - // 停站时间一致,没有问题 | ||
| 843 | - | ||
| 844 | - | ||
| 845 | - } else { | ||
| 846 | - // TODO:当前班次使用最小停站时间 | ||
| 847 | - oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp())); | ||
| 848 | - oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime); | ||
| 849 | - | ||
| 850 | - } | ||
| 851 | - } | ||
| 852 | - | ||
| 853 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 854 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 855 | - } | ||
| 856 | - | ||
| 857 | - this.getBc(iQIndex, iBcIndex).setStopTime(0); | ||
| 858 | - } | ||
| 859 | - | ||
| 860 | - | ||
| 861 | -}; | ||
| 862 | - | ||
| 863 | -/** | ||
| 864 | - * 返回指定班次的上一个班次。 | ||
| 865 | - * @param oBc {moment} 指定班次 | ||
| 866 | - * @returns {object} 上一个班次,如果没有,返回false | ||
| 867 | - */ | ||
| 868 | -InternalLpObj.prototype.getPreBc = function(oBc) { | ||
| 869 | - // 获取车次链个数 | ||
| 870 | - var iBcChainCount = this.fnGetBcChainCount(); | ||
| 871 | - | ||
| 872 | - var i; | ||
| 873 | - var j; | ||
| 874 | - var oBcIndex; | ||
| 875 | - var iQIndex; | ||
| 876 | - var iBcIndex; | ||
| 877 | - var iBcCount; | ||
| 878 | - var _oPreBc; | ||
| 879 | - var _bFindCurrentBc = false; | ||
| 880 | - | ||
| 881 | - for (i = 0; i < iBcChainCount; i++) { | ||
| 882 | - oBcIndex = this.fnGetBcChainInfo(i); | ||
| 883 | - iQIndex = oBcIndex["s_q"]; | ||
| 884 | - iBcIndex = oBcIndex["s_b"]; | ||
| 885 | - iBcCount = oBcIndex["bcount"]; | ||
| 886 | - | ||
| 887 | - for (j = 0; j < iBcCount - 1; j++) { | ||
| 888 | - if (oBc.getFcTimeObj().format("HH:mm") == | ||
| 889 | - this.getBc(iQIndex, iBcIndex).getFcTimeObj().format("HH:mm")) { | ||
| 890 | - _bFindCurrentBc = true; | ||
| 891 | - break; | ||
| 892 | - } | ||
| 893 | - | ||
| 894 | - // 进入到下一圈 | ||
| 895 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 896 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 897 | - } | ||
| 898 | - | ||
| 899 | - if (_bFindCurrentBc) { | ||
| 900 | - if (iQIndex == oBcIndex["s_q"] && iBcIndex == oBcIndex["s_q"]) { // 第一个班次 | ||
| 901 | - break; | ||
| 902 | - } else { | ||
| 903 | - _oPreBc = this.getBc( | ||
| 904 | - iBcIndex == 0 ? iQIndex - 1 : iQIndex, | ||
| 905 | - iBcIndex == 0 ? 1 : 0); | ||
| 906 | - } | ||
| 907 | - } | ||
| 908 | - | ||
| 909 | - } | ||
| 910 | - | ||
| 911 | - return _oPreBc || false; | ||
| 912 | - | ||
| 913 | -}; | ||
| 914 | - | ||
| 915 | -/** | ||
| 916 | - * 通过修改layover时间,修正班次的发车,到达时间。 | ||
| 917 | - * 如果layover时间不符合范围要求,修改成平均时间。 | ||
| 918 | - * @param oParam {ParameterObj} 参数对象 | ||
| 919 | - */ | ||
| 920 | -InternalLpObj.prototype.fnAdjustBcTime_layover = function(oParam) { | ||
| 921 | - // 获取车次链个数(连班路牌1个,分班路牌2个) | ||
| 922 | - var iBlockCount = this.fnGetBcChainCount(); | ||
| 923 | - | ||
| 924 | - var i; | ||
| 925 | - var j; | ||
| 926 | - var aTrip; // 每个block关联的trip列表 | ||
| 927 | - var trip; // 当前班次 | ||
| 928 | - var nextTrip; // 下一个班次 | ||
| 929 | - var layOverTime; | ||
| 930 | - var aLayOverTimeRange; | ||
| 931 | - | ||
| 932 | - var oBcIndex; | ||
| 933 | - var iQIndex; // block开始第几圈缩影 | ||
| 934 | - var iBcIndex; // block开始第几个班次 | ||
| 935 | - var iBcCount; // block的trip数目 | ||
| 936 | - | ||
| 937 | - | ||
| 938 | - for (i = 0; i < iBlockCount; i++) { | ||
| 939 | - // 获取block关联的trip列表 | ||
| 940 | - oBcIndex = this.fnGetBcChainInfo(i); | ||
| 941 | - iQIndex = oBcIndex["s_q"]; | ||
| 942 | - iBcIndex = oBcIndex["s_b"]; | ||
| 943 | - iBcCount = oBcIndex["bcount"]; | ||
| 944 | - | ||
| 945 | - aTrip = []; | ||
| 946 | - for (j = 0; j < iBcCount; j++) { | ||
| 947 | - aTrip.push(this.getBc(iQIndex, iBcIndex)); | ||
| 948 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 949 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 950 | - } | ||
| 951 | - | ||
| 952 | - if (aTrip.length < 2) { | ||
| 953 | - // 两个trip一起处理,只有1个trip的block不处理 | ||
| 954 | - continue; | ||
| 955 | - } | ||
| 956 | - // 迭代block,处理trip的发车,到达,停站时间 | ||
| 957 | - for (j = 0; j < aTrip.length - 1; j++) { | ||
| 958 | - trip = aTrip[j]; | ||
| 959 | - nextTrip = aTrip[j + 1]; | ||
| 960 | - | ||
| 961 | - if (trip.fnIsFirstBc() && nextTrip.fnIsFirstBc()) { | ||
| 962 | - // 如果两个方向的首班车都在一个block上 | ||
| 963 | - // 则停站时间不考虑范围,直接发车时间-到达时间 | ||
| 964 | - layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 965 | - trip.setStopTime(layOverTime); | ||
| 966 | - continue; | ||
| 967 | - } | ||
| 968 | - | ||
| 969 | - //------------- 吃饭班次处理 -----------// | ||
| 970 | - // 获取当前trip的layover的范围 | ||
| 971 | - aLayOverTimeRange = oParam.calcuTripLayoverTimeRange( | ||
| 972 | - trip.getArrTimeObj(), trip.isUp(), trip.getBcTime() | ||
| 973 | - ); | ||
| 974 | - // 重新计算当前班次layover时间 | ||
| 975 | - layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 976 | - if (trip.fnGetEatTime() > 0) { | ||
| 977 | - // 如果当前班次layover是要吃饭的 | ||
| 978 | - // 则停站时间没有,变成吃饭时间 | ||
| 979 | - trip.setStopTime(0); | ||
| 980 | - // 修改下一个班次的发车时间,到达时间 | ||
| 981 | - nextTrip.setFcTimeObj(oParam.addMinute( | ||
| 982 | - trip.getArrTimeObj(), | ||
| 983 | - trip.fnGetEatTime()) | ||
| 984 | - ); | ||
| 985 | - nextTrip.setBcTime(oParam.calcuTravelTime(nextTrip.getFcTimeObj(), nextTrip.isUp())); | ||
| 986 | - nextTrip.setArrTimeObj(oParam.addMinute(nextTrip.getFcTimeObj(), nextTrip.getBcTime())); | ||
| 987 | - continue; | ||
| 988 | - } | ||
| 989 | - | ||
| 990 | - //------------- 正常班次处理 -----------// | ||
| 991 | - if (layOverTime < aLayOverTimeRange[0] || layOverTime > aLayOverTimeRange[1]) { | ||
| 992 | - // 如果layover时间在范围之外,使用平均值 | ||
| 993 | - layOverTime = oParam.fnCalcuFixedStopNumber( | ||
| 994 | - trip.getArrTimeObj(), | ||
| 995 | - trip.isUp(), | ||
| 996 | - oParam.calcuTravelTime( | ||
| 997 | - trip.getFcTimeObj(), | ||
| 998 | - trip.isUp()) | ||
| 999 | - ); | ||
| 1000 | - | ||
| 1001 | - trip.setStopTime(layOverTime); | ||
| 1002 | - nextTrip.setFcTimeObj(oParam.addMinute( | ||
| 1003 | - trip.getArrTimeObj(), | ||
| 1004 | - trip.getStopTime()) | ||
| 1005 | - ); | ||
| 1006 | - nextTrip.setBcTime(oParam.calcuTravelTime(nextTrip.getFcTimeObj(), nextTrip.isUp())); | ||
| 1007 | - nextTrip.setArrTimeObj(oParam.addMinute(nextTrip.getFcTimeObj(), nextTrip.getBcTime())); | ||
| 1008 | - } | ||
| 1009 | - } | ||
| 1010 | - // 最后一个trip的layover时间为0 | ||
| 1011 | - aTrip[j].setStopTime(0); | ||
| 1012 | - | ||
| 1013 | - } | ||
| 1014 | -}; | ||
| 1015 | - | ||
| 1016 | -// TODO | ||
| 1017 | - | ||
| 1018 | -/** | ||
| 1019 | - * | ||
| 1020 | - * | ||
| 1021 | - */ | ||
| 1022 | -InternalLpObj.prototype.calcuLpBx = function() { | ||
| 1023 | - | ||
| 1024 | -}; | ||
| 1025 | - | ||
| 1026 | - | 1 | +/** |
| 2 | + * 内部路牌对象。 | ||
| 3 | + * @constructor | ||
| 4 | + */ | ||
| 5 | +var InternalLpObj = function( | ||
| 6 | + orilpObj, // 原始路牌对象 | ||
| 7 | + qCount, // 总共多少圈 | ||
| 8 | + isUp // 圈是以上行开始还是下行开始 | ||
| 9 | +) { | ||
| 10 | + // TODO:原始路牌对象(这个路牌是对接外部gantt图像,以后有机会改了) | ||
| 11 | + this._$$_orign_lp_obj = orilpObj; | ||
| 12 | + | ||
| 13 | + this._$_isUp = isUp; | ||
| 14 | + | ||
| 15 | + // 路牌的圈数,注意每个路牌的圈数都是一致的, | ||
| 16 | + // 但并不是每一圈都有值 | ||
| 17 | + // 第1圈从上标线开始 | ||
| 18 | + // 第0圈表示中标线的第一个班次组成的半圈 | ||
| 19 | + // 有多少圈根据最终迭代的结果来看 | ||
| 20 | + this._$_qCount = qCount; | ||
| 21 | + // 保存的是 InternalGroupBcObj 对象 | ||
| 22 | + this._$_groupBcArray = new Array(qCount); | ||
| 23 | + | ||
| 24 | + var i; | ||
| 25 | + for (i = 0; i < this._$_qCount; i++) { | ||
| 26 | + this._$_groupBcArray[i] = new InternalGroupObj( | ||
| 27 | + this, this._$_isUp, undefined, undefined); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + // 距离上一个路牌的最小发车间隔时间 | ||
| 31 | + // 用于纵向添加班次的时候使用 | ||
| 32 | + // 默认第一个路牌为0 | ||
| 33 | + this._$_minVerticalIntervalTime = 0; | ||
| 34 | + | ||
| 35 | + // 详细记录每圈每个方向上的发车间隔时间 | ||
| 36 | + // 第一维度表示圈数,第二维度表示第一个方向,第二个方向 | ||
| 37 | + // 第一个方向是否上行由 _$_isUp 决定 | ||
| 38 | + // 这里的间隔表示下一个路牌上的班次距离本路牌的班次发车时间间隔 | ||
| 39 | + // 如果当前是最后一个路牌,表示第一个路牌的下一圈同方向班次距离本班次的间隔 | ||
| 40 | + this._$_aVerticalIntervalTime = new Array(this._$_qCount); | ||
| 41 | + for (i = 0; i < this._$_aVerticalIntervalTime.length; i++) { | ||
| 42 | + this._$_aVerticalIntervalTime[i] = new Array(2); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + // 班型的相关变量 | ||
| 46 | + this._$_bx_isLb = false; // 是否连班 | ||
| 47 | + this._$_bx_isfb = false; // 是否分班 | ||
| 48 | + this._$_bx_isfb_5_2 = false; // 是否5休2分班 | ||
| 49 | + this._$_bx_desc; // 班型描述(默认为路牌编号) | ||
| 50 | + | ||
| 51 | + // 其他班次(进出场,例包,吃饭等),TODO:以后再拆 | ||
| 52 | + this._$_other_bc_array = []; | ||
| 53 | + | ||
| 54 | + // TODO: | ||
| 55 | + | ||
| 56 | +}; | ||
| 57 | + | ||
| 58 | +//------------------- get/set 方法 -------------------// | ||
| 59 | + | ||
| 60 | +InternalLpObj.prototype.getOtherBcArray = function() { | ||
| 61 | + return this._$_other_bc_array; | ||
| 62 | +}; | ||
| 63 | +InternalLpObj.prototype.addOtherBcArray = function(ba) { | ||
| 64 | + this._$_other_bc_array = this._$_other_bc_array.concat(ba); | ||
| 65 | +}; | ||
| 66 | + | ||
| 67 | +/** | ||
| 68 | + * 获取圈 | ||
| 69 | + * @param qIndex 圈index | ||
| 70 | + */ | ||
| 71 | +InternalLpObj.prototype.getGroup = function(qIndex) { | ||
| 72 | + return this._$_groupBcArray[qIndex]; | ||
| 73 | +}; | ||
| 74 | + | ||
| 75 | +/** | ||
| 76 | + * 获取路牌圈数。 | ||
| 77 | + * @returns {*} | ||
| 78 | + */ | ||
| 79 | +InternalLpObj.prototype.fnGetGroupCount = function() { | ||
| 80 | + return this._$_qCount; | ||
| 81 | +}; | ||
| 82 | + | ||
| 83 | +/** | ||
| 84 | + * 是否上行。 | ||
| 85 | + * @returns boolean | ||
| 86 | + */ | ||
| 87 | +InternalLpObj.prototype.isUp = function() { | ||
| 88 | + return this._$_isUp; | ||
| 89 | +}; | ||
| 90 | + | ||
| 91 | +/** | ||
| 92 | + * 获取班次。 | ||
| 93 | + * @param qIndex 第几圈 | ||
| 94 | + * @param bcIndex 第几个班次 | ||
| 95 | + */ | ||
| 96 | +InternalLpObj.prototype.getBc = function(qIndex, bcIndex) { | ||
| 97 | + var group = this._$_groupBcArray[qIndex]; | ||
| 98 | + var bc; | ||
| 99 | + if (bcIndex == 0) { | ||
| 100 | + bc = group.getBc1(); | ||
| 101 | + } else if (bcIndex == 1) { | ||
| 102 | + bc = group.getBc2(); | ||
| 103 | + } | ||
| 104 | + return bc; | ||
| 105 | +}; | ||
| 106 | + | ||
| 107 | +/** | ||
| 108 | + * 在具体位置设置班次。 | ||
| 109 | + * @param qIndex 第几圈 | ||
| 110 | + * @param bcIndex 第几个班次 | ||
| 111 | + * @param bc 班次对象 | ||
| 112 | + */ | ||
| 113 | +InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) { | ||
| 114 | + var group = this._$_groupBcArray[qIndex]; | ||
| 115 | + if (bcIndex == 0) { | ||
| 116 | + group.setBc1(bc); | ||
| 117 | + bc.setGroup(group); | ||
| 118 | + } else if (bcIndex == 1) { | ||
| 119 | + group.setBc2(bc); | ||
| 120 | + bc.setGroup(group); | ||
| 121 | + } | ||
| 122 | +}; | ||
| 123 | + | ||
| 124 | +/** | ||
| 125 | + * 设置原始路牌对象。 | ||
| 126 | + * @param lpObj 原始路牌对象 | ||
| 127 | + */ | ||
| 128 | +InternalLpObj.prototype.setLp = function(lpObj) { | ||
| 129 | + this._$$_orign_lp_obj = lpObj; | ||
| 130 | + var i; | ||
| 131 | + var group; | ||
| 132 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 133 | + group = this._$_groupBcArray[i]; | ||
| 134 | + if (group) { | ||
| 135 | + group.setLp(this); // 圈和班次保存都是 InternalLpObj 对象 | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | +}; | ||
| 139 | + | ||
| 140 | +InternalLpObj.prototype.getLpNo = function() { | ||
| 141 | + return this._$$_orign_lp_obj.lpNo; | ||
| 142 | +}; | ||
| 143 | +InternalLpObj.prototype.getLpName = function() { | ||
| 144 | + return this._$$_orign_lp_obj.lpName; | ||
| 145 | +}; | ||
| 146 | +InternalLpObj.prototype.setBxFb5_2 = function(fb) { | ||
| 147 | + this._$_bx_isfb_5_2 = fb; | ||
| 148 | +}; | ||
| 149 | +InternalLpObj.prototype.isBxFb5_2 = function() { | ||
| 150 | + return this._$_bx_isfb_5_2; | ||
| 151 | +}; | ||
| 152 | +InternalLpObj.prototype.setBxLb = function(lb) { | ||
| 153 | + this._$_bx_isLb = lb; | ||
| 154 | +}; | ||
| 155 | +InternalLpObj.prototype.isBxLb = function() { | ||
| 156 | + return this._$_bx_isLb; | ||
| 157 | +}; | ||
| 158 | + | ||
| 159 | +InternalLpObj.prototype.setBxFb = function(fb) { | ||
| 160 | + this._$_bx_isfb = fb; | ||
| 161 | +}; | ||
| 162 | +InternalLpObj.prototype.isBxFb = function() { | ||
| 163 | + return this._$_bx_isfb; | ||
| 164 | +}; | ||
| 165 | + | ||
| 166 | +/** | ||
| 167 | + * 设置路牌的班型描述(最终是设置班次的路牌名字)。 | ||
| 168 | + * @param desc 描述 | ||
| 169 | + */ | ||
| 170 | +InternalLpObj.prototype.setBxDesc = function(desc) { | ||
| 171 | + // 最终原始路牌的名字 | ||
| 172 | + this._$$_orign_lp_obj.lpName = desc + "_" + this._$$_orign_lp_obj.lpNo; | ||
| 173 | + // 内部对象的班型描述 | ||
| 174 | + this._$_bx_desc = desc; | ||
| 175 | +}; | ||
| 176 | +/** | ||
| 177 | + * 获取版型描述 | ||
| 178 | + * @returns string | ||
| 179 | + */ | ||
| 180 | +InternalLpObj.prototype.getBxDesc = function() { | ||
| 181 | + return this._$_bx_desc; | ||
| 182 | +}; | ||
| 183 | + | ||
| 184 | +/** | ||
| 185 | + * 设置纵向最小发车间隔时间。 | ||
| 186 | + * @param v | ||
| 187 | + */ | ||
| 188 | +InternalLpObj.prototype.setVerticalMinIntervalTime = function(v) { | ||
| 189 | + // 第一个路牌,都为0 | ||
| 190 | + this._$_minVerticalIntervalTime = v; | ||
| 191 | +}; | ||
| 192 | +/** | ||
| 193 | + * 获取纵向最小发车间隔时间。 | ||
| 194 | + * @returns {number|*} | ||
| 195 | + */ | ||
| 196 | +InternalLpObj.prototype.getVerticalMinIntervalTime = function() { | ||
| 197 | + return this._$_minVerticalIntervalTime; | ||
| 198 | +}; | ||
| 199 | + | ||
| 200 | +/** | ||
| 201 | + * 设置纵向发车间隔。 | ||
| 202 | + * @param iQindex 圈index | ||
| 203 | + * @param iBindex 班次index | ||
| 204 | + * @param iTime 间隔时间 | ||
| 205 | + */ | ||
| 206 | +InternalLpObj.prototype.fnSetVerticalIntervalTime = function(iQindex, iBindex, iTime) { | ||
| 207 | + this._$_aVerticalIntervalTime[iQindex][iBindex] = iTime; | ||
| 208 | +}; | ||
| 209 | + | ||
| 210 | +/** | ||
| 211 | + * 返回纵向发车间隔。 | ||
| 212 | + * @param iQindex 圈index | ||
| 213 | + * @param iBindex 班次index | ||
| 214 | + */ | ||
| 215 | +InternalLpObj.prototype.fnGetVerticalIntervalTime = function(iQindex, iBindex) { | ||
| 216 | + return this._$_aVerticalIntervalTime[iQindex][iBindex]; | ||
| 217 | +}; | ||
| 218 | + | ||
| 219 | +//-------------------- 班次操作方法(查询,统计,删除) -----------------------// | ||
| 220 | + | ||
| 221 | +/** | ||
| 222 | + * 返回总共班次数。 | ||
| 223 | + */ | ||
| 224 | +InternalLpObj.prototype.getBcCount = function() { | ||
| 225 | + var i; | ||
| 226 | + var group; | ||
| 227 | + var bccount = 0; | ||
| 228 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 229 | + group = this._$_groupBcArray[i]; | ||
| 230 | + if (group) { | ||
| 231 | + if (group.getBc1()) { | ||
| 232 | + bccount += 1; | ||
| 233 | + } | ||
| 234 | + if (group.getBc2()) { | ||
| 235 | + bccount += 1; | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + return bccount; | ||
| 241 | +}; | ||
| 242 | + | ||
| 243 | +/** | ||
| 244 | + * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。 | ||
| 245 | + * @returns arrays (InternalBcObj) | ||
| 246 | + */ | ||
| 247 | +InternalLpObj.prototype.getBcArray = function() { | ||
| 248 | + var bcArray = []; | ||
| 249 | + var i; | ||
| 250 | + var group; | ||
| 251 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 252 | + group = this._$_groupBcArray[i]; | ||
| 253 | + if (group) { | ||
| 254 | + group.getBc1() ? bcArray.push(group.getBc1()) : ""; | ||
| 255 | + group.getBc2() ? bcArray.push(group.getBc2()) : ""; | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + return bcArray; | ||
| 260 | +}; | ||
| 261 | + | ||
| 262 | +/** | ||
| 263 | + * 获取最小(最早)班次对象。 | ||
| 264 | + * @returns [{圈index},{班次index}] | ||
| 265 | + */ | ||
| 266 | +InternalLpObj.prototype.getMinBcObjPosition = function() { | ||
| 267 | + var i; | ||
| 268 | + var bIndex = []; | ||
| 269 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 270 | + if (this._$_groupBcArray[i].getBc1()) { | ||
| 271 | + bIndex.push(i); | ||
| 272 | + bIndex.push(0); | ||
| 273 | + break; | ||
| 274 | + } | ||
| 275 | + if (this._$_groupBcArray[i].getBc2()) { | ||
| 276 | + bIndex.push(i); | ||
| 277 | + bIndex.push(1); | ||
| 278 | + break; | ||
| 279 | + } | ||
| 280 | + } | ||
| 281 | + return bIndex; | ||
| 282 | +}; | ||
| 283 | + | ||
| 284 | +/** | ||
| 285 | + * 获取最大(最晚)班次对象。 | ||
| 286 | + * @returns [{圈index},{班次index}] | ||
| 287 | + */ | ||
| 288 | +InternalLpObj.prototype.getMaxBcObjPosition = function() { | ||
| 289 | + var i; | ||
| 290 | + var bIndex = []; | ||
| 291 | + for (i = this._$_groupBcArray.length - 1; i >= 0; i--) { | ||
| 292 | + if (this._$_groupBcArray[i].getBc2()) { | ||
| 293 | + bIndex.push(i); | ||
| 294 | + bIndex.push(1); | ||
| 295 | + break; | ||
| 296 | + } | ||
| 297 | + if (this._$_groupBcArray[i].getBc1()) { | ||
| 298 | + bIndex.push(i); | ||
| 299 | + bIndex.push(0); | ||
| 300 | + break; | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + return bIndex; | ||
| 304 | +}; | ||
| 305 | + | ||
| 306 | +InternalLpObj.prototype.getMinBcObj = function() { | ||
| 307 | + var i; | ||
| 308 | + var bcObj; | ||
| 309 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 310 | + bcObj = this._$_groupBcArray[i].getBc1(); | ||
| 311 | + if (bcObj) { | ||
| 312 | + break; | ||
| 313 | + } | ||
| 314 | + bcObj = this._$_groupBcArray[i].getBc2(); | ||
| 315 | + if (bcObj) { | ||
| 316 | + break; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + return bcObj; | ||
| 320 | +}; | ||
| 321 | +InternalLpObj.prototype.getMaxBcObj = function() { | ||
| 322 | + var i; | ||
| 323 | + var bcObj; | ||
| 324 | + for (i = this._$_groupBcArray.length - 1; i >= 0; i--) { | ||
| 325 | + bcObj = this._$_groupBcArray[i].getBc2(); | ||
| 326 | + if (bcObj) { | ||
| 327 | + break; | ||
| 328 | + } | ||
| 329 | + bcObj = this._$_groupBcArray[i].getBc1(); | ||
| 330 | + if (bcObj) { | ||
| 331 | + break; | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + return bcObj; | ||
| 335 | +}; | ||
| 336 | + | ||
| 337 | +/** | ||
| 338 | + * 获取车次链信息。 | ||
| 339 | + * @param num 第几个车次链 | ||
| 340 | + * @returns object {s_q: {开始圈索引},s_b : {开始班次索引},e_q : {结束圈索引},e_b : {结束班次索引}, bcount : {班次数}} | ||
| 341 | + */ | ||
| 342 | +InternalLpObj.prototype.fnGetBcChainInfo = function(num) { | ||
| 343 | + // 计算总的车次链信息 | ||
| 344 | + var aChainInfo = []; | ||
| 345 | + var oChainInfo; | ||
| 346 | + var aBcIndex = this.getMinBcObjPosition(); | ||
| 347 | + var oBc; | ||
| 348 | + var iQIndex; | ||
| 349 | + var iBcIndex; | ||
| 350 | + var i; | ||
| 351 | + var bFlag; | ||
| 352 | + | ||
| 353 | + var iBcount = 0; | ||
| 354 | + | ||
| 355 | + if (aBcIndex.length == 2) { | ||
| 356 | + iBcount = 1; | ||
| 357 | + oChainInfo = {s_q : aBcIndex[0], s_b : aBcIndex[1], e_q : aBcIndex[0], e_b : aBcIndex[1], bcount: 1}; | ||
| 358 | + aChainInfo.push(oChainInfo); | ||
| 359 | + bFlag = true; | ||
| 360 | + | ||
| 361 | + // 下一个班次的索引 | ||
| 362 | + iQIndex = aBcIndex[1] == 0 ? aBcIndex[0] : aBcIndex[0] + 1; | ||
| 363 | + iBcIndex = aBcIndex[1] == 0 ? 1 : 0; | ||
| 364 | + | ||
| 365 | + for (i = iQIndex; i < this._$_qCount; i++) { | ||
| 366 | + while (iBcIndex <= 1) { | ||
| 367 | + oBc = this.getBc(i, iBcIndex); | ||
| 368 | + if (!oBc) { | ||
| 369 | + if (bFlag) { | ||
| 370 | + // 车次链结尾是这个班次的前一个班次 | ||
| 371 | + oChainInfo.e_q = iBcIndex == 0 ? i - 1 : i; | ||
| 372 | + oChainInfo.e_b = iBcIndex == 0 ? 1 : 0; | ||
| 373 | + oChainInfo.bcount = iBcount; | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + bFlag = false; | ||
| 377 | + } else { | ||
| 378 | + if (bFlag) { | ||
| 379 | + iBcount ++; | ||
| 380 | + oChainInfo.bcount = iBcount; | ||
| 381 | + } else { | ||
| 382 | + // 下一个车次链开始 | ||
| 383 | + iBcount = 1; | ||
| 384 | + oChainInfo = {s_q : i, s_b : iBcIndex, e_q : i, e_b : iBcIndex, bcount: 1}; | ||
| 385 | + aChainInfo.push(oChainInfo); | ||
| 386 | + bFlag = true; | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + | ||
| 391 | + iBcIndex ++; | ||
| 392 | + } | ||
| 393 | + iBcIndex = 0; | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + return aChainInfo[num]; | ||
| 399 | +}; | ||
| 400 | + | ||
| 401 | +/** | ||
| 402 | + * 获取车次链的个数。 | ||
| 403 | + * @returns int | ||
| 404 | + */ | ||
| 405 | +InternalLpObj.prototype.fnGetBcChainCount = function() { | ||
| 406 | + var iChainCount = 0; | ||
| 407 | + var aBcIndex = this.getMinBcObjPosition(); | ||
| 408 | + | ||
| 409 | + var oBc; | ||
| 410 | + var iQIndex; | ||
| 411 | + var iBcIndex; | ||
| 412 | + var i; | ||
| 413 | + var bFlag; | ||
| 414 | + | ||
| 415 | + if (aBcIndex.length == 2) { | ||
| 416 | + iChainCount = 1; | ||
| 417 | + bFlag = true; | ||
| 418 | + | ||
| 419 | + // 下一个班次的索引 | ||
| 420 | + iQIndex = aBcIndex[1] == 0 ? aBcIndex[0] : aBcIndex[0] + 1; | ||
| 421 | + iBcIndex = aBcIndex[1] == 0 ? 1 : 0; | ||
| 422 | + | ||
| 423 | + for (i = iQIndex; i < this._$_qCount; i++) { | ||
| 424 | + while (iBcIndex <= 1) { | ||
| 425 | + oBc = this.getBc(i, iBcIndex); | ||
| 426 | + if (!oBc) { | ||
| 427 | + bFlag = false; | ||
| 428 | + } else { | ||
| 429 | + if (bFlag) { | ||
| 430 | + | ||
| 431 | + } else { | ||
| 432 | + iChainCount ++; | ||
| 433 | + bFlag = true; | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + | ||
| 438 | + iBcIndex ++; | ||
| 439 | + } | ||
| 440 | + iBcIndex = 0; | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + } | ||
| 444 | + | ||
| 445 | + | ||
| 446 | + return iChainCount; | ||
| 447 | +}; | ||
| 448 | + | ||
| 449 | +/** | ||
| 450 | + * 在具体位置移除班次。 | ||
| 451 | + * @param qIndex 第几圈 | ||
| 452 | + * @param bcIndex 第几个班次 | ||
| 453 | + */ | ||
| 454 | +InternalLpObj.prototype.removeBc = function(qIndex, bcIndex) { | ||
| 455 | + var group = this._$_groupBcArray[qIndex]; | ||
| 456 | + if (bcIndex == 0) { | ||
| 457 | + group.removeBc1(); | ||
| 458 | + } else if (bcIndex == 1) { | ||
| 459 | + group.removeBc2(); | ||
| 460 | + } | ||
| 461 | +}; | ||
| 462 | + | ||
| 463 | +/** | ||
| 464 | + * 使用指定时间匹配返回离之最近的第几圈第几个班次, | ||
| 465 | + * 使用时间差的绝度值,比较,取最小的 | ||
| 466 | + * 如果有两个一样的时间差,取比fctime大的时间 | ||
| 467 | + * @param fctime moment 比较用时间 | ||
| 468 | + * @param groupArray 圈数组 | ||
| 469 | + * @param hasUp boolean 计算上行班次 | ||
| 470 | + * @param hasDown boolean 计算下行班次 | ||
| 471 | + * @returns [{第几圈},{第几个班次}] | ||
| 472 | + */ | ||
| 473 | +InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | ||
| 474 | + fctime, groupArray, hasUp, hasDown | ||
| 475 | +) { | ||
| 476 | + var i; | ||
| 477 | + var timediff; // 时间差取绝对值 | ||
| 478 | + var qIndex; | ||
| 479 | + var bcIndex; | ||
| 480 | + | ||
| 481 | + var group; | ||
| 482 | + var bc1time; | ||
| 483 | + var bc2time; | ||
| 484 | + | ||
| 485 | + var tempdiff; | ||
| 486 | + | ||
| 487 | + console.log("比较时间=" + fctime.format("HH:mm")); | ||
| 488 | + | ||
| 489 | + var oBc; | ||
| 490 | + | ||
| 491 | + for (i = 0; i < this._$_qCount; i++) { | ||
| 492 | + group = groupArray[i]; | ||
| 493 | + if (group) { | ||
| 494 | + oBc = group.getBc1(); | ||
| 495 | + | ||
| 496 | + if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { | ||
| 497 | + bc1time = group.getBc1().getFcTimeObj(); | ||
| 498 | + console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff); | ||
| 499 | + tempdiff = Math.abs(bc1time.diff(fctime)); | ||
| 500 | + | ||
| 501 | + if (!timediff) { | ||
| 502 | + timediff = Math.abs(tempdiff); | ||
| 503 | + qIndex = i; | ||
| 504 | + bcIndex = 0; | ||
| 505 | + } else { | ||
| 506 | + if (tempdiff < timediff) { | ||
| 507 | + timediff = tempdiff; | ||
| 508 | + qIndex = i; | ||
| 509 | + bcIndex = 0; | ||
| 510 | + } if (Math.abs(tempdiff) == timediff) { | ||
| 511 | + if (bc1time.isAfter(fctime)) { | ||
| 512 | + timediff = tempdiff; | ||
| 513 | + qIndex = i; | ||
| 514 | + bcIndex = 0; | ||
| 515 | + } | ||
| 516 | + | ||
| 517 | + } | ||
| 518 | + } | ||
| 519 | + } | ||
| 520 | + | ||
| 521 | + oBc = group.getBc2(); | ||
| 522 | + if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { | ||
| 523 | + bc2time = group.getBc2().getFcTimeObj(); | ||
| 524 | + console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff); | ||
| 525 | + tempdiff = Math.abs(bc2time.diff(fctime)); | ||
| 526 | + | ||
| 527 | + if (!timediff) { | ||
| 528 | + timediff = Math.abs(tempdiff); | ||
| 529 | + qIndex = i; | ||
| 530 | + bcIndex = 1; | ||
| 531 | + } else { | ||
| 532 | + if (tempdiff < timediff) { | ||
| 533 | + timediff = tempdiff; | ||
| 534 | + qIndex = i; | ||
| 535 | + bcIndex = 1; | ||
| 536 | + } if (Math.abs(tempdiff) == timediff) { | ||
| 537 | + if (bc2time.isBefore(fctime)) { | ||
| 538 | + timediff = tempdiff; | ||
| 539 | + qIndex = i; | ||
| 540 | + bcIndex = 1; | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + } | ||
| 544 | + } | ||
| 545 | + } | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + console.log("中标线对应数组索引=" + qIndex); | ||
| 550 | + | ||
| 551 | + var rst = []; | ||
| 552 | + rst.push(qIndex); | ||
| 553 | + rst.push(bcIndex); | ||
| 554 | + | ||
| 555 | + return rst; | ||
| 556 | +}; | ||
| 557 | + | ||
| 558 | +/** | ||
| 559 | + * 使用指定时间匹配返回离之最近的第几圈第几个班次, | ||
| 560 | + * 使用时间差的绝度值,比较,取最小的 | ||
| 561 | + * 如果有两个一样的时间差,取比fctime大的时间 | ||
| 562 | + * @param fctime moment 比较用时间 | ||
| 563 | + * @param hasUp boolean 计算上行班次 | ||
| 564 | + * @param hasDown boolean 计算下行班次 | ||
| 565 | + * @returns [{第几圈},{第几个班次}] | ||
| 566 | + */ | ||
| 567 | +InternalLpObj.prototype.getQBcIndexWithFcTime = function( | ||
| 568 | + fctime, hasUp, hasDown | ||
| 569 | +) { | ||
| 570 | + return this.fnGetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray, hasUp, hasDown); | ||
| 571 | +}; | ||
| 572 | + | ||
| 573 | +//---------------------- 内部数据初始化方法(不同于构造函数)---------------------// | ||
| 574 | + | ||
| 575 | +/** | ||
| 576 | + * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌 | ||
| 577 | + * 注意,之前有班次会删除后再创建。 | ||
| 578 | + * @param startTime 开始时间 | ||
| 579 | + * @param endTime 结束时间 | ||
| 580 | + * @param isUp 第一个班次是上行还是下行 | ||
| 581 | + * @param fromQ 从第几圈开始加入 | ||
| 582 | + * @param paramObj 参数对象 | ||
| 583 | + * @param factory 工厂对象 | ||
| 584 | + */ | ||
| 585 | +InternalLpObj.prototype.initDataFromTimeToTime = function( | ||
| 586 | + startTime, | ||
| 587 | + endTime, | ||
| 588 | + isUp, | ||
| 589 | + fromQ, | ||
| 590 | + paramObj, | ||
| 591 | + factory) { | ||
| 592 | + | ||
| 593 | + var bcData = []; // 班次数组 | ||
| 594 | + var bcObj; | ||
| 595 | + var kssj = startTime; | ||
| 596 | + var fcno = 1; // 发车顺序号 | ||
| 597 | + var bcCount = 1; // 班次数 | ||
| 598 | + do { | ||
| 599 | + bcObj = factory.createBcObj( | ||
| 600 | + this, "normal", isUp, fcno, kssj, paramObj); // this就是所属路牌对象 | ||
| 601 | + bcData.push(bcObj); | ||
| 602 | + | ||
| 603 | + kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime()); | ||
| 604 | + fcno ++; | ||
| 605 | + bcCount ++; | ||
| 606 | + isUp = !isUp; | ||
| 607 | + } while(kssj.isBefore(endTime)); | ||
| 608 | + bcCount--; | ||
| 609 | + | ||
| 610 | + //console.log("last -1;" + bcData[bcCount -2].getFcTimeObj().format("HH:mm")); | ||
| 611 | + //console.log("last;" + bcData[bcCount -1].getFcTimeObj().format("HH:mm")); | ||
| 612 | + //console.log("endtime: " + endTime.format("HH:mm")); | ||
| 613 | + | ||
| 614 | + //if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) { | ||
| 615 | + // // 如果最后一个班次的到达时间超过结束时间,也要去除 | ||
| 616 | + // bcData.splice(bcCount - 1, 1); | ||
| 617 | + //} | ||
| 618 | + | ||
| 619 | + this._initDataFromLbBcArray(bcData, fromQ); | ||
| 620 | + | ||
| 621 | +}; | ||
| 622 | + | ||
| 623 | +/** | ||
| 624 | + * 使用连班的班次数组初始化路牌(相应的圈会被覆盖)。 | ||
| 625 | + * @param bcArray 连班班次数组 | ||
| 626 | + * @param fromQ 从第几圈开始加入 | ||
| 627 | + */ | ||
| 628 | +InternalLpObj.prototype._initDataFromLbBcArray = function( | ||
| 629 | + bcArray, | ||
| 630 | + fromQ | ||
| 631 | +) { | ||
| 632 | + var _bc1Obj; | ||
| 633 | + var _bc2Obj; | ||
| 634 | + var _qObj; | ||
| 635 | + | ||
| 636 | + // 第一班次是上行还是下行 | ||
| 637 | + var isUp = bcArray[0].isUp(); | ||
| 638 | + | ||
| 639 | + if (bcArray.length > 0 && fromQ < this._$_qCount) { | ||
| 640 | + // 构造圈数 | ||
| 641 | + if (isUp != this._$_isUp) { | ||
| 642 | + // 如果方向不一致,意味着第一个班次是半圈 | ||
| 643 | + // 加半圈,并加在bc2上 | ||
| 644 | + _bc2Obj = bcArray.slice(0, 1)[0]; | ||
| 645 | + _qObj = new InternalGroupObj( | ||
| 646 | + this, | ||
| 647 | + this._$_isUp, | ||
| 648 | + undefined, | ||
| 649 | + _bc2Obj | ||
| 650 | + ); | ||
| 651 | + _bc2Obj.setGroup(_qObj); | ||
| 652 | + this._$_groupBcArray[fromQ] = _qObj; | ||
| 653 | + | ||
| 654 | + bcArray.splice(0, 1); | ||
| 655 | + fromQ ++; | ||
| 656 | + } | ||
| 657 | + | ||
| 658 | + var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈 | ||
| 659 | + var qCount2 = bcArray.length % 2; // 最后是否有半圈 | ||
| 660 | + | ||
| 661 | + while (fromQ < this._$_qCount) { | ||
| 662 | + if (qCount1 > 0) { | ||
| 663 | + _bc1Obj = bcArray.slice(0, 1)[0]; | ||
| 664 | + _bc2Obj = bcArray.slice(1, 2)[0]; | ||
| 665 | + _qObj = new InternalGroupObj( | ||
| 666 | + this, | ||
| 667 | + this._$_isUp, | ||
| 668 | + _bc1Obj, | ||
| 669 | + _bc2Obj | ||
| 670 | + ); | ||
| 671 | + _bc1Obj.setGroup(_qObj); | ||
| 672 | + _bc2Obj.setGroup(_qObj); | ||
| 673 | + this._$_groupBcArray[fromQ] = _qObj; | ||
| 674 | + | ||
| 675 | + bcArray.splice(0, 2); | ||
| 676 | + qCount1 --; | ||
| 677 | + } else if (qCount2 > 0) { | ||
| 678 | + // 加半圈,并加在bc1上 | ||
| 679 | + _bc1Obj = bcArray.slice(0, 1)[0]; | ||
| 680 | + _qObj = new InternalGroupObj( | ||
| 681 | + this, | ||
| 682 | + this._$_isUp, | ||
| 683 | + _bc1Obj, | ||
| 684 | + undefined | ||
| 685 | + ); | ||
| 686 | + _bc1Obj.setGroup(_qObj); | ||
| 687 | + this._$_groupBcArray[fromQ] = _qObj; | ||
| 688 | + | ||
| 689 | + bcArray.splice(0, 1); | ||
| 690 | + qCount2 --; | ||
| 691 | + } else { | ||
| 692 | + break; | ||
| 693 | + } | ||
| 694 | + | ||
| 695 | + fromQ ++; | ||
| 696 | + } | ||
| 697 | + } | ||
| 698 | +}; | ||
| 699 | + | ||
| 700 | +//-------------------------- 其他方法 ----------------------------// | ||
| 701 | + | ||
| 702 | +/** | ||
| 703 | + * 从指定位置的班次开始,往后所有的班次修正发车时间 | ||
| 704 | + * @param groupIndex | ||
| 705 | + * @param bcIndex | ||
| 706 | + * @param time | ||
| 707 | + */ | ||
| 708 | +InternalLpObj.prototype.fnAddMinuteToBcFcsj = function(groupIndex, bcIndex, time) { | ||
| 709 | + var i; | ||
| 710 | + var oCurBc; | ||
| 711 | + | ||
| 712 | + // 修正之前班次的停站时间 | ||
| 713 | + //oCurBc = this.getBc( | ||
| 714 | + // bcIndex == 0 ? groupIndex - 1 : groupIndex, | ||
| 715 | + // bcIndex == 1 ? 0 : 1 | ||
| 716 | + //); | ||
| 717 | + //if (oCurBc) { | ||
| 718 | + // oCurBc.setStopTime(oCurBc.getStopTime() + time); | ||
| 719 | + //} | ||
| 720 | + | ||
| 721 | + | ||
| 722 | + for (i = groupIndex; i < this._$_qCount; i++) { | ||
| 723 | + if (bcIndex == 0) { | ||
| 724 | + oCurBc = this.getBc(i, 0); | ||
| 725 | + if (oCurBc) { | ||
| 726 | + oCurBc.addMinuteToFcsj(time); | ||
| 727 | + } | ||
| 728 | + oCurBc = this.getBc(i, 1); | ||
| 729 | + if (oCurBc) { | ||
| 730 | + oCurBc.addMinuteToFcsj(time); | ||
| 731 | + } | ||
| 732 | + | ||
| 733 | + } else { | ||
| 734 | + oCurBc = this.getBc(i, 1); | ||
| 735 | + if (oCurBc) { | ||
| 736 | + oCurBc.addMinuteToFcsj(time); | ||
| 737 | + } | ||
| 738 | + | ||
| 739 | + } | ||
| 740 | + | ||
| 741 | + bcIndex = 0; | ||
| 742 | + } | ||
| 743 | +}; | ||
| 744 | + | ||
| 745 | +/** | ||
| 746 | + * 在指定位置添加一个吃饭班次。 | ||
| 747 | + * 注1:吃饭班次不是普通班次,不记录进圈,记录进_$_other_bc_array | ||
| 748 | + * 注2:添加吃饭班次时,会修改之前班次的停战时间,所以导致之后的班次的停战都会发生变化 | ||
| 749 | + * @param groupIndex | ||
| 750 | + * @param bcIndex | ||
| 751 | + * @param factory | ||
| 752 | + * @param paramObj | ||
| 753 | + * @returns int 相差时间(吃饭时间距离和停站时间相差值) | ||
| 754 | + */ | ||
| 755 | +InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, paramObj) { | ||
| 756 | + var oPreBc; | ||
| 757 | + var oEatBc; | ||
| 758 | + var iBcModifyTime; | ||
| 759 | + | ||
| 760 | + if (!this.getBc(groupIndex, bcIndex)) { // | ||
| 761 | + return 0; | ||
| 762 | + } | ||
| 763 | + | ||
| 764 | + oPreBc = this.getBc( // 前一个邻接班次 | ||
| 765 | + bcIndex == 0 ? groupIndex - 1 : groupIndex, | ||
| 766 | + bcIndex == 1 ? 0 : 1); | ||
| 767 | + if (oPreBc) { // 存在前一个班次 | ||
| 768 | + oEatBc = factory.createBcObj( | ||
| 769 | + this, | ||
| 770 | + "cf", | ||
| 771 | + !oPreBc.isUp(), // 和上一个班次方向相反 | ||
| 772 | + 1, | ||
| 773 | + paramObj.addMinute(oPreBc.getArrTimeObj(), oPreBc.getStopTime()), // 使用上一个班次的到达时间作为开始时间 | ||
| 774 | + paramObj | ||
| 775 | + ); | ||
| 776 | + | ||
| 777 | + //iBcModifyTime = oEatBc.getBcTime() - oPreBc.getStopTime(); // 后续班次要调整的时间 | ||
| 778 | + | ||
| 779 | + // 修正之后的班次发车时间 | ||
| 780 | + // 注意:之后那个班次发车时间就是吃饭班次的到达时间 | ||
| 781 | + iBcModifyTime = oEatBc.getArrTimeObj().diff(this.getBc(groupIndex, bcIndex).getFcTimeObj(), "m"); | ||
| 782 | + this.fnAddMinuteToBcFcsj(groupIndex, bcIndex, iBcModifyTime); | ||
| 783 | + | ||
| 784 | + oPreBc.setStopTime(0); // 不重置停站时间 | ||
| 785 | + oPreBc.fnSetEatTime(oEatBc.getBcTime()); | ||
| 786 | + | ||
| 787 | + //this._$_other_bc_array.push(oEatBc); | ||
| 788 | + | ||
| 789 | + return iBcModifyTime; | ||
| 790 | + } else { | ||
| 791 | + return false; | ||
| 792 | + } | ||
| 793 | + | ||
| 794 | +}; | ||
| 795 | + | ||
| 796 | +/** | ||
| 797 | + * 调整路牌的班次,通过调整停站时间,或者班次发车时间,不能让班次的到达时间和下一个班次的发车时间重叠。 | ||
| 798 | + * @param iPeakAverStopTime 高峰平均停站时间 | ||
| 799 | + * @param iTroughAverStopTime 低谷平均停站时间 | ||
| 800 | + * @param oParam 参数对象 | ||
| 801 | + */ | ||
| 802 | +InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTroughAverStopTime, oParam) { | ||
| 803 | + // 获取车次链个数 | ||
| 804 | + var iBcChainCount = this.fnGetBcChainCount(); | ||
| 805 | + | ||
| 806 | + var i; | ||
| 807 | + var j; | ||
| 808 | + var oBcIndex; | ||
| 809 | + var iQIndex; | ||
| 810 | + var iBcIndex; | ||
| 811 | + var iBcCount; | ||
| 812 | + var oBc; | ||
| 813 | + var oNextBc; | ||
| 814 | + | ||
| 815 | + var iBcStopTime; | ||
| 816 | + | ||
| 817 | + for (i = 0; i < iBcChainCount; i++) { | ||
| 818 | + oBcIndex = this.fnGetBcChainInfo(i); | ||
| 819 | + iQIndex = oBcIndex["s_q"]; | ||
| 820 | + iBcIndex = oBcIndex["s_b"]; | ||
| 821 | + iBcCount = oBcIndex["bcount"]; | ||
| 822 | + | ||
| 823 | + for (j = 0; j < iBcCount - 1; j++) { | ||
| 824 | + oBc = this.getBc(iQIndex, iBcIndex); | ||
| 825 | + oNextBc = this.getBc( | ||
| 826 | + iBcIndex == 0 ? iQIndex : iQIndex + 1, | ||
| 827 | + iBcIndex == 0 ? 1 : 0); | ||
| 828 | + | ||
| 829 | + if (oNextBc.fnIsFirstBc()) { // 如果同一路牌连续2个方向首站班次,都不做处理 | ||
| 830 | + continue; | ||
| 831 | + } | ||
| 832 | + | ||
| 833 | + // 不改变当前班次的行驶时间,修正停站时间和下一个班次的发车时间 | ||
| 834 | + iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m"); | ||
| 835 | + if (iBcStopTime < 0) { | ||
| 836 | + // 当前班次使用最小停站时间 | ||
| 837 | + oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp())); | ||
| 838 | + oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime); | ||
| 839 | + | ||
| 840 | + } else { | ||
| 841 | + if (iBcStopTime == oBc.getStopTime() + oBc.fnGetEatTime()) { | ||
| 842 | + // 停站时间一致,没有问题 | ||
| 843 | + | ||
| 844 | + | ||
| 845 | + } else { | ||
| 846 | + // TODO:当前班次使用最小停站时间 | ||
| 847 | + oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp())); | ||
| 848 | + oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime); | ||
| 849 | + | ||
| 850 | + } | ||
| 851 | + } | ||
| 852 | + | ||
| 853 | + iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 854 | + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 855 | + } | ||
| 856 | + | ||
| 857 | + this.getBc(iQIndex, iBcIndex).setStopTime(0); | ||
| 858 | + } | ||
| 859 | + | ||
| 860 | + | ||
| 861 | +}; | ||
| 862 | + | ||
| 863 | +/** | ||
| 864 | + * 返回指定班次的上一个班次。 | ||
| 865 | + * @param oBc {moment} 指定班次 | ||
| 866 | + * @returns {object} 上一个班次,如果没有,返回false | ||
| 867 | + */ | ||
| 868 | +InternalLpObj.prototype.getPreBc = function(oBc) { | ||
| 869 | + // 获取车次链个数 | ||
| 870 | + var iBcChainCount = this.fnGetBcChainCount(); | ||
| 871 | + | ||
| 872 | + var i; | ||
| 873 | + var j; | ||
| 874 | + var oBcIndex; | ||
| 875 | + var iQIndex; | ||
| 876 | + var iBcIndex; | ||
| 877 | + var iBcCount; | ||
| 878 | + var _oPreBc; | ||
| 879 | + var _bFindCurrentBc = false; | ||
| 880 | + | ||
| 881 | + for (i = 0; i < iBcChainCount; i++) { | ||
| 882 | + oBcIndex = this.fnGetBcChainInfo(i); | ||
| 883 | + iQIndex = oBcIndex["s_q"]; | ||
| 884 | + iBcIndex = oBcIndex["s_b"]; | ||
| 885 | + iBcCount = oBcIndex["bcount"]; | ||
| 886 | + | ||
| 887 | + for (j = 0; j < iBcCount - 1; j++) { | ||
| 888 | + if (oBc.getFcTimeObj().format("HH:mm") == | ||
| 889 | + this.getBc(iQIndex, iBcIndex).getFcTimeObj().format("HH:mm")) { | ||
| 890 | + _bFindCurrentBc = true; | ||
| 891 | + break; | ||
| 892 | + } | ||
| 893 | + | ||
| 894 | + // 进入到下一圈 | ||
| 895 | + iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 896 | + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 897 | + } | ||
| 898 | + | ||
| 899 | + if (_bFindCurrentBc) { | ||
| 900 | + if (iQIndex == oBcIndex["s_q"] && iBcIndex == oBcIndex["s_q"]) { // 第一个班次 | ||
| 901 | + break; | ||
| 902 | + } else { | ||
| 903 | + _oPreBc = this.getBc( | ||
| 904 | + iBcIndex == 0 ? iQIndex - 1 : iQIndex, | ||
| 905 | + iBcIndex == 0 ? 1 : 0); | ||
| 906 | + } | ||
| 907 | + } | ||
| 908 | + | ||
| 909 | + } | ||
| 910 | + | ||
| 911 | + return _oPreBc || false; | ||
| 912 | + | ||
| 913 | +}; | ||
| 914 | + | ||
| 915 | +/** | ||
| 916 | + * 通过修改layover时间,修正班次的发车,到达时间。 | ||
| 917 | + * 如果layover时间不符合范围要求,修改成平均时间。 | ||
| 918 | + * @param oParam {ParameterObj} 参数对象 | ||
| 919 | + */ | ||
| 920 | +InternalLpObj.prototype.fnAdjustBcTime_layover = function(oParam) { | ||
| 921 | + // 获取车次链个数(连班路牌1个,分班路牌2个) | ||
| 922 | + var iBlockCount = this.fnGetBcChainCount(); | ||
| 923 | + | ||
| 924 | + var i; | ||
| 925 | + var j; | ||
| 926 | + var aTrip; // 每个block关联的trip列表 | ||
| 927 | + var trip; // 当前班次 | ||
| 928 | + var nextTrip; // 下一个班次 | ||
| 929 | + var layOverTime; | ||
| 930 | + var aLayOverTimeRange; | ||
| 931 | + | ||
| 932 | + var oBcIndex; | ||
| 933 | + var iQIndex; // block开始第几圈缩影 | ||
| 934 | + var iBcIndex; // block开始第几个班次 | ||
| 935 | + var iBcCount; // block的trip数目 | ||
| 936 | + | ||
| 937 | + | ||
| 938 | + for (i = 0; i < iBlockCount; i++) { | ||
| 939 | + // 获取block关联的trip列表 | ||
| 940 | + oBcIndex = this.fnGetBcChainInfo(i); | ||
| 941 | + iQIndex = oBcIndex["s_q"]; | ||
| 942 | + iBcIndex = oBcIndex["s_b"]; | ||
| 943 | + iBcCount = oBcIndex["bcount"]; | ||
| 944 | + | ||
| 945 | + aTrip = []; | ||
| 946 | + for (j = 0; j < iBcCount; j++) { | ||
| 947 | + aTrip.push(this.getBc(iQIndex, iBcIndex)); | ||
| 948 | + iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 949 | + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 950 | + } | ||
| 951 | + | ||
| 952 | + if (aTrip.length < 2) { | ||
| 953 | + // 两个trip一起处理,只有1个trip的block不处理 | ||
| 954 | + continue; | ||
| 955 | + } | ||
| 956 | + // 迭代block,处理trip的发车,到达,停站时间 | ||
| 957 | + for (j = 0; j < aTrip.length - 1; j++) { | ||
| 958 | + trip = aTrip[j]; | ||
| 959 | + nextTrip = aTrip[j + 1]; | ||
| 960 | + | ||
| 961 | + if (trip.fnIsFirstBc() && nextTrip.fnIsFirstBc()) { | ||
| 962 | + // 如果两个方向的首班车都在一个block上 | ||
| 963 | + // 则停站时间不考虑范围,直接发车时间-到达时间 | ||
| 964 | + layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 965 | + trip.setStopTime(layOverTime); | ||
| 966 | + continue; | ||
| 967 | + } | ||
| 968 | + | ||
| 969 | + //------------- 吃饭班次处理 -----------// | ||
| 970 | + // 获取当前trip的layover的范围 | ||
| 971 | + aLayOverTimeRange = oParam.calcuTripLayoverTimeRange( | ||
| 972 | + trip.getArrTimeObj(), trip.isUp(), trip.getBcTime() | ||
| 973 | + ); | ||
| 974 | + // 重新计算当前班次layover时间 | ||
| 975 | + layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 976 | + if (trip.fnGetEatTime() > 0) { | ||
| 977 | + // 如果当前班次layover是要吃饭的 | ||
| 978 | + // 则停站时间没有,变成吃饭时间 | ||
| 979 | + trip.setStopTime(0); | ||
| 980 | + // 修改下一个班次的发车时间,到达时间 | ||
| 981 | + nextTrip.setFcTimeObj(oParam.addMinute( | ||
| 982 | + trip.getArrTimeObj(), | ||
| 983 | + trip.fnGetEatTime()) | ||
| 984 | + ); | ||
| 985 | + nextTrip.setBcTime(oParam.calcuTravelTime(nextTrip.getFcTimeObj(), nextTrip.isUp())); | ||
| 986 | + nextTrip.setArrTimeObj(oParam.addMinute(nextTrip.getFcTimeObj(), nextTrip.getBcTime())); | ||
| 987 | + continue; | ||
| 988 | + } | ||
| 989 | + | ||
| 990 | + //------------- 正常班次处理 -----------// | ||
| 991 | + if (layOverTime < aLayOverTimeRange[0] || layOverTime > aLayOverTimeRange[1]) { | ||
| 992 | + // 如果layover时间在范围之外,使用平均值 | ||
| 993 | + layOverTime = oParam.fnCalcuFixedStopNumber( | ||
| 994 | + trip.getArrTimeObj(), | ||
| 995 | + trip.isUp(), | ||
| 996 | + oParam.calcuTravelTime( | ||
| 997 | + trip.getFcTimeObj(), | ||
| 998 | + trip.isUp()) | ||
| 999 | + ); | ||
| 1000 | + | ||
| 1001 | + trip.setStopTime(layOverTime); | ||
| 1002 | + nextTrip.setFcTimeObj(oParam.addMinute( | ||
| 1003 | + trip.getArrTimeObj(), | ||
| 1004 | + trip.getStopTime()) | ||
| 1005 | + ); | ||
| 1006 | + nextTrip.setBcTime(oParam.calcuTravelTime(nextTrip.getFcTimeObj(), nextTrip.isUp())); | ||
| 1007 | + nextTrip.setArrTimeObj(oParam.addMinute(nextTrip.getFcTimeObj(), nextTrip.getBcTime())); | ||
| 1008 | + } | ||
| 1009 | + } | ||
| 1010 | + // 最后一个trip的layover时间为0 | ||
| 1011 | + aTrip[j].setStopTime(0); | ||
| 1012 | + | ||
| 1013 | + } | ||
| 1014 | +}; | ||
| 1015 | + | ||
| 1016 | +// TODO | ||
| 1017 | + | ||
| 1018 | +/** | ||
| 1019 | + * | ||
| 1020 | + * | ||
| 1021 | + */ | ||
| 1022 | +InternalLpObj.prototype.calcuLpBx = function() { | ||
| 1023 | + | ||
| 1024 | +}; | ||
| 1025 | + | ||
| 1026 | + |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| 1 | -/** | ||
| 2 | - * 内部行车计划对象。 | ||
| 3 | - * @constructor | ||
| 4 | - */ | ||
| 5 | -var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 6 | - // 参数对象 | ||
| 7 | - var _paramObj = paramObj; | ||
| 8 | - // 外部的路牌数组 | ||
| 9 | - var _lpArray = lpArray; | ||
| 10 | - // 工厂对象 | ||
| 11 | - var _factory = factory; | ||
| 12 | - | ||
| 13 | - //------------------ 初始化方法1,以及计算关联的内部变量 -----------------// | ||
| 14 | - var _qIsUp; // 每一圈是上行开始还是下行开始 | ||
| 15 | - var _qCount = 0; // 总的圈数 | ||
| 16 | - var _internalLpArray = []; // 内部对象数组 | ||
| 17 | - var _aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时) | ||
| 18 | - {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 19 | - {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 20 | - {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 21 | - {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 22 | - {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 23 | - {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 24 | - {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 25 | - {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0} | ||
| 26 | - ]; | ||
| 27 | - | ||
| 28 | - var _fnInitFun1 = function() { // 初始化方法1 | ||
| 29 | - console.log("//---------------- 行车计划,初始化方法1 start ----------------//"); | ||
| 30 | - | ||
| 31 | - //----------------------- 1、确定上标线的方向,圈的方向 -------------------// | ||
| 32 | - | ||
| 33 | - // 确定_qIsUp,哪个方向的首班车晚就用哪个 | ||
| 34 | - _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore( | ||
| 35 | - _paramObj.getDownFirstDTimeObj()) ? false : true; | ||
| 36 | - // 上标线开始时间,就是方向的首班车时间 | ||
| 37 | - var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 38 | - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | ||
| 39 | - var et; | ||
| 40 | - var et_IsUp; | ||
| 41 | - if (_paramObj.getUpLastDtimeObj().isBefore( | ||
| 42 | - _paramObj.getDownLastDTimeObj())) { | ||
| 43 | - et = _paramObj.getDownLastDTimeObj(); | ||
| 44 | - et_IsUp = false; | ||
| 45 | - } else { | ||
| 46 | - et = _paramObj.getUpLastDtimeObj(); | ||
| 47 | - et_IsUp = true; | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - //------------------------ 2、计算总共有多少圈 ------------------------// | ||
| 51 | - | ||
| 52 | - // 以开始时间,结束时间,构造上标线用连班班次发车时间 | ||
| 53 | - var bcFcsjArrays = []; // 班次发车时间对象数组 | ||
| 54 | - var bcArsjArrays = []; // 班次到达时间对象数组 | ||
| 55 | - var isUp = _qIsUp; // 方向 | ||
| 56 | - var bcCount = 1; // 班次数 | ||
| 57 | - | ||
| 58 | - var _kssj = st; // 开始时间 | ||
| 59 | - var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时 | ||
| 60 | - var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间 | ||
| 61 | - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); // 停站时间 | ||
| 62 | - | ||
| 63 | - do { | ||
| 64 | - bcFcsjArrays.push(_kssj); | ||
| 65 | - bcArsjArrays.push(_arrsj); | ||
| 66 | - | ||
| 67 | - _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime); | ||
| 68 | - _bcsj = paramObj.calcuTravelTime(_kssj, isUp); | ||
| 69 | - _arrsj = paramObj.addMinute(_kssj, _bcsj); | ||
| 70 | - _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); | ||
| 71 | - | ||
| 72 | - bcCount ++; | ||
| 73 | - isUp = !isUp; | ||
| 74 | - } while(_kssj.isBefore(et)); | ||
| 75 | - bcCount--; // 因为先做do,所以总的班次要减1 | ||
| 76 | - //if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) { | ||
| 77 | - // // 如果最后一个班次的到达时间超过结束时间,也要去除 | ||
| 78 | - // bcFcsjArrays.splice(bcCount - 1, 1); | ||
| 79 | - // bcArsjArrays.splice(bcCount - 1, 1); | ||
| 80 | - // bcCount--; | ||
| 81 | - //} | ||
| 82 | - var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈 | ||
| 83 | - var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈 | ||
| 84 | - | ||
| 85 | - // 利用连班数组计算圈数 | ||
| 86 | - _qCount = 1; // 前面加1圈,补中标线的班次 | ||
| 87 | - _qCount += _qCount_p1; | ||
| 88 | - _qCount += _qCount_p2; | ||
| 89 | - | ||
| 90 | - // 计算最后是不是还要补一圈 | ||
| 91 | - if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题) | ||
| 92 | - if (_qCount_p2 == 0) { // 没有余下班次,整数圈数 | ||
| 93 | - // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行 | ||
| 94 | - // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致 | ||
| 95 | - if (!_qIsUp == et_IsUp) { | ||
| 96 | - // 一致不用加圈数 | ||
| 97 | - } else { | ||
| 98 | - // 不一致需要加圈补最后一个结束时间班次 | ||
| 99 | - _qCount ++; | ||
| 100 | - } | ||
| 101 | - } else { | ||
| 102 | - // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里 | ||
| 103 | - // 不需要在补圈数了 | ||
| 104 | - } | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------// | ||
| 108 | - | ||
| 109 | - // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中 | ||
| 110 | - var i; | ||
| 111 | - for (i = 0; i < _lpArray.length; i++) { | ||
| 112 | - _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp)); | ||
| 113 | - } | ||
| 114 | - // 初始化上标线,从第1圈开始 | ||
| 115 | - _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory); | ||
| 116 | - | ||
| 117 | - // 以上标线为基础,计算各种班型工时对应的圈数、班次数 | ||
| 118 | - var aBcArray = _internalLpArray[0].getBcArray(); | ||
| 119 | - aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识 | ||
| 120 | - | ||
| 121 | - if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算 | ||
| 122 | - aBcArray.splice(aBcArray.length - 1, 1); | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - // 午饭吃饭时间 | ||
| 126 | - var iLTime = _paramObj.fnGetLunchTime(); | ||
| 127 | - // 晚饭吃饭时间 | ||
| 128 | - var iDTime = _paramObj.fnGetDinnerTime(); | ||
| 129 | - // 出场时间 | ||
| 130 | - var iOutTime = _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime(); | ||
| 131 | - // 进场时间 | ||
| 132 | - var iInTime = _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime(); | ||
| 133 | - // 例保时间 | ||
| 134 | - var iBTime = _paramObj.getLbTime(); | ||
| 135 | - | ||
| 136 | - var sum = 0; // 总班次时间 | ||
| 137 | - for (i = 0; i < aBcArray.length; i++) { | ||
| 138 | - sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime(); | ||
| 139 | - } | ||
| 140 | - sum += iLTime; // 加午饭时间 | ||
| 141 | - sum += iDTime; // 加晚饭时间 | ||
| 142 | - for (i = 0; i < _aBxDesc.length; i++) { | ||
| 143 | - _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间 | ||
| 144 | - | ||
| 145 | - // 计算5休2的班次数(双进出场,4个例保) | ||
| 146 | - if (i == 6) { | ||
| 147 | - _aBxDesc[i].fQCount = | ||
| 148 | - (_aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) / | ||
| 149 | - _aBxDesc[i].fAverTime; | ||
| 150 | - _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2; | ||
| 151 | - } else { // 进出场,2个例保 | ||
| 152 | - _aBxDesc[i].fQCount = | ||
| 153 | - (_aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) / | ||
| 154 | - _aBxDesc[i].fAverTime; | ||
| 155 | - _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2; | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - // 在第一个班次之前再添加一个模拟班次,用于中标线的作用 | ||
| 161 | - // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除 | ||
| 162 | - var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime(); | ||
| 163 | - var iFirstStopTime = | ||
| 164 | - _paramObj.fnCalcuFixedStopNumber( | ||
| 165 | - _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), | ||
| 166 | - !_qIsUp, | ||
| 167 | - iXXTime | ||
| 168 | - ); | ||
| 169 | - var oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 170 | - _internalLpArray[0], | ||
| 171 | - "normal", | ||
| 172 | - !_qIsUp, | ||
| 173 | - 1, | ||
| 174 | - _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), | ||
| 175 | - _paramObj | ||
| 176 | - ); | ||
| 177 | - oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 178 | - | ||
| 179 | - _internalLpArray[0].setBc(0, 1, oFlagBc); | ||
| 180 | - | ||
| 181 | - // 在最后一圈也补上一个或者2个模拟班次,暂时标记,最后需要删除 | ||
| 182 | - var aMaxBcIndex = _internalLpArray[0].getMaxBcObjPosition(); | ||
| 183 | - if (aMaxBcIndex[0] == _qCount - 1) { // 可能加半圈 | ||
| 184 | - oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 185 | - _internalLpArray[0], | ||
| 186 | - "normal", | ||
| 187 | - !_qIsUp, | ||
| 188 | - 1, | ||
| 189 | - _paramObj.addMinute( | ||
| 190 | - _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 191 | - _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 192 | - _paramObj | ||
| 193 | - ); | ||
| 194 | - oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 195 | - _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 196 | - | ||
| 197 | - } else { // 加完整的一圈 | ||
| 198 | - oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 199 | - _internalLpArray[0], | ||
| 200 | - "normal", | ||
| 201 | - _qIsUp, | ||
| 202 | - 1, | ||
| 203 | - _paramObj.addMinute( | ||
| 204 | - _internalLpArray[0].getBc(_qCount - 2, 1).getArrTimeObj(), | ||
| 205 | - _internalLpArray[0].getBc(_qCount - 2, 1).getStopTime()), | ||
| 206 | - _paramObj | ||
| 207 | - ); | ||
| 208 | - oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 209 | - _internalLpArray[0].setBc(_qCount - 1, 0, oFlagBc); | ||
| 210 | - | ||
| 211 | - oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 212 | - _internalLpArray[0], | ||
| 213 | - "normal", | ||
| 214 | - !_qIsUp, | ||
| 215 | - 1, | ||
| 216 | - _paramObj.addMinute( | ||
| 217 | - _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 218 | - _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 219 | - _paramObj | ||
| 220 | - ); | ||
| 221 | - oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 222 | - _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 223 | - | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") + | ||
| 227 | - "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm")); | ||
| 228 | - console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") + | ||
| 229 | - "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm")); | ||
| 230 | - console.log("总共计算的圈数:" + _qCount); | ||
| 231 | - console.log("圈的方向isUP:" + _qIsUp); | ||
| 232 | - console.log("班型描述(以下):"); | ||
| 233 | - console.log(_aBxDesc); | ||
| 234 | - console.log("所有路牌间隔描述(以下):"); | ||
| 235 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 236 | - console.log(_internalLpArray[i]._$_aVerticalIntervalTime); | ||
| 237 | - } | ||
| 238 | - console.log("//---------------- 行车计划,初始化方法1 end ----------------//"); | ||
| 239 | - | ||
| 240 | - }; | ||
| 241 | - | ||
| 242 | - //------------------ 初始化方法2,以及计算关联的内部变量 ----------------// | ||
| 243 | - var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出 | ||
| 244 | - var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行) | ||
| 245 | - var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出 | ||
| 246 | - var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行) | ||
| 247 | - | ||
| 248 | - var _fnInitFun2 = function() { // 初始化方法2 | ||
| 249 | - console.log("//---------------- 行车计划,初始化方法2 start ----------------//"); | ||
| 250 | - | ||
| 251 | - //------------------------ 1、计算车辆总数 ------------------------// | ||
| 252 | - // 是用高峰上行周转时间除以高峰平均间隔得到的 | ||
| 253 | - // 这样算还算合理,车辆不多不少,待以后有新的算法再修正 | ||
| 254 | - var iClCount = _paramObj.calcuClzx(); | ||
| 255 | - | ||
| 256 | - //------------------------ 2、计算所有路牌的发车在各个圈中的间隔 --------------------// | ||
| 257 | - var i; | ||
| 258 | - var j; | ||
| 259 | - var iBindex = 1; | ||
| 260 | - var iZzsj; | ||
| 261 | - var oLp; | ||
| 262 | - var iC1; | ||
| 263 | - var iC2; | ||
| 264 | - | ||
| 265 | - for (i = 0; i < _qCount - 1; i++) { | ||
| 266 | - while (iBindex <= 1) { | ||
| 267 | - // 每圈每个方向的周转时间不一致,以上标线为主 | ||
| 268 | - oLp = _internalLpArray[0]; | ||
| 269 | - iZzsj = oLp.getBc(i + 1, iBindex).getFcTimeObj().diff( | ||
| 270 | - oLp.getBc(i, iBindex).getFcTimeObj(), "m" | ||
| 271 | - ); | ||
| 272 | - | ||
| 273 | - iC1 = Math.floor(iZzsj / iClCount); | ||
| 274 | - iC2 = iZzsj % iClCount; | ||
| 275 | - | ||
| 276 | - for (j = 0; j < iClCount - iC2; j++) { | ||
| 277 | - oLp = _internalLpArray[j]; | ||
| 278 | - oLp.fnSetVerticalIntervalTime(i, iBindex, iC1); | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - for (j = 0; j < iC2; j++) { | ||
| 282 | - oLp = _internalLpArray[iClCount - iC2 + j]; | ||
| 283 | - oLp.fnSetVerticalIntervalTime(i, iBindex, iC1 + 1); | ||
| 284 | - } | ||
| 285 | - | ||
| 286 | - iBindex ++; | ||
| 287 | - | ||
| 288 | - } | ||
| 289 | - iBindex = 0; | ||
| 290 | - } | ||
| 291 | - // 最后一圈没有下一圈的参照,周转时间没发获取,由于都是低谷,所以使用倒数第二圈的间隔最为最后一圈的间隔 | ||
| 292 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 293 | - oLp = _internalLpArray[i]; | ||
| 294 | - oLp.fnSetVerticalIntervalTime(_qCount - 1, 0, oLp.fnGetVerticalIntervalTime(_qCount - 2, 0)); | ||
| 295 | - oLp.fnSetVerticalIntervalTime(_qCount - 1, 1, oLp.fnGetVerticalIntervalTime(_qCount - 2, 1)); | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - //------------------------ 3、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | ||
| 299 | - | ||
| 300 | - // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次 | ||
| 301 | - // 以这个班次为早高峰起点,全部出车策略 | ||
| 302 | - var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime( | ||
| 303 | - _paramObj.getMPeakStartTimeObj(), true, true); | ||
| 304 | - var qIndex = qbcIndexArray[0]; // 第几圈 | ||
| 305 | - var bIndex = qbcIndexArray[1]; // 第几个班次 | ||
| 306 | - | ||
| 307 | - for (i = 1; i < _internalLpArray.length; i++) { | ||
| 308 | - _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 309 | - } | ||
| 310 | - | ||
| 311 | - _approximate_zgfQIndex = qIndex; | ||
| 312 | - _approximate_zgfBIndex = bIndex; | ||
| 313 | - | ||
| 314 | - //------------------------ 4、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | ||
| 315 | - | ||
| 316 | - // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次 | ||
| 317 | - // 以这个班次为早高峰起点,全部出车策略 | ||
| 318 | - qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime( | ||
| 319 | - _paramObj.getEPeakStartTimeObj(), true, true); | ||
| 320 | - qIndex = qbcIndexArray[0]; // 第几圈 | ||
| 321 | - bIndex = qbcIndexArray[1]; // 第几个班次 | ||
| 322 | - | ||
| 323 | - for (i = 1; i < _internalLpArray.length; i++) { | ||
| 324 | - _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 325 | - } | ||
| 326 | - | ||
| 327 | - _approximate_wgfQIndex = qIndex; | ||
| 328 | - _approximate_wgfBIndex = bIndex; | ||
| 329 | - | ||
| 330 | - console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟"); | ||
| 331 | - console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟"); | ||
| 332 | - console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出"); | ||
| 333 | - console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出"); | ||
| 334 | - console.log("//---------------- 行车计划,初始化方法2 end ----------------//"); | ||
| 335 | - }; | ||
| 336 | - | ||
| 337 | - //----------------------- 初始化方法3,计算连班分班的路牌分布 ----------------// | ||
| 338 | - var _iBx_lb_lpcount; // 连班路牌数 | ||
| 339 | - var _iBx_5_2_fb_lpcount; // 5休2分班路牌数 | ||
| 340 | - var _iBx_other_fb_lpcount; // 其他分班路牌数 | ||
| 341 | - | ||
| 342 | - var _fnInitFun3 = function() { // 初始化方法3 | ||
| 343 | - console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | ||
| 344 | - | ||
| 345 | - //--------------------- 1、计算分班连班班型车辆分布数 --------------------// | ||
| 346 | - // 总共车辆数(高峰最大车辆数) | ||
| 347 | - var iCls = _paramObj.calcuClzx(); | ||
| 348 | - // 低谷最少配车(连班车数量) | ||
| 349 | - var iDgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx()); | ||
| 350 | - // 加班车路牌数(做5休2的路牌数) | ||
| 351 | - var i_5_2_lpes = _paramObj.getJBLpes(); | ||
| 352 | - | ||
| 353 | - // 做些简单的验证 | ||
| 354 | - if (iCls < iDgminpc) { | ||
| 355 | - alert("总配车数小于低谷最小配车"); | ||
| 356 | - throw "总配车数小于低谷最小配车"; | ||
| 357 | - } | ||
| 358 | - | ||
| 359 | - if (iDgminpc < 2) { | ||
| 360 | - // alert("连班路牌小于2,办不到啊"); | ||
| 361 | - // throw "连班路牌小于2,办不到啊"; | ||
| 362 | - console.log("连班路牌小于2,则5休2之外的车辆数则为连班车辆数"); | ||
| 363 | - iDgminpc = iCls - i_5_2_lpes; | ||
| 364 | - } | ||
| 365 | - if (iCls - iDgminpc < i_5_2_lpes) { | ||
| 366 | - // alert("总分班路牌数小于加班路牌数"); | ||
| 367 | - // throw "总分班路牌数小于加班路牌数"; | ||
| 368 | - console.log("总分班路牌数小于加班路牌数,则忽略其他分班路牌数"); | ||
| 369 | - iDgminpc = iCls - i_5_2_lpes; | ||
| 370 | - } | ||
| 371 | - | ||
| 372 | - //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20 | ||
| 373 | - //while(_paramObj.calcuPeakZzsj() / iDgminpc > 20) { | ||
| 374 | - // iDgminpc ++; | ||
| 375 | - //} | ||
| 376 | - _iBx_lb_lpcount = iDgminpc; | ||
| 377 | - | ||
| 378 | - _iBx_5_2_fb_lpcount = i_5_2_lpes; | ||
| 379 | - _iBx_other_fb_lpcount = iCls - _iBx_lb_lpcount - i_5_2_lpes; | ||
| 380 | - | ||
| 381 | - //------------------------ 2、利用间隔法计算连班路牌分布 --------------------// | ||
| 382 | - var i; | ||
| 383 | - var j; | ||
| 384 | - var iC1 = Math.floor(_internalLpArray.length / _iBx_lb_lpcount); | ||
| 385 | - var iC2 = _internalLpArray.length % _iBx_lb_lpcount; | ||
| 386 | - var iLpIndex; | ||
| 387 | - | ||
| 388 | - for (i = 0; i < _iBx_lb_lpcount - iC2; i++) { | ||
| 389 | - iLpIndex = i * iC1; | ||
| 390 | - _internalLpArray[iLpIndex].setBxLb(true); | ||
| 391 | - _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 392 | - } | ||
| 393 | - for (j = 0; j < iC2; j++) { | ||
| 394 | - iLpIndex = i * iC1 + j * (iC1 + 1); | ||
| 395 | - _internalLpArray[iLpIndex].setBxLb(true); | ||
| 396 | - _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 397 | - } | ||
| 398 | - | ||
| 399 | - //------------------------ 3、利用间隔法计算分班班型路牌分布 --------------------// | ||
| 400 | - // 获取分班路牌索引 | ||
| 401 | - var aNotLbIndexes = []; | ||
| 402 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 403 | - if (!_internalLpArray[i].isBxLb()) { | ||
| 404 | - aNotLbIndexes.push(i); | ||
| 405 | - } | ||
| 406 | - } | ||
| 407 | - // 先5休2分班 | ||
| 408 | - iC1 = Math.floor(aNotLbIndexes.length / _iBx_5_2_fb_lpcount); | ||
| 409 | - iC2 = aNotLbIndexes.length % _iBx_5_2_fb_lpcount; | ||
| 410 | - | ||
| 411 | - for (i = 0; i < _iBx_5_2_fb_lpcount - iC2; i++) { | ||
| 412 | - iLpIndex = aNotLbIndexes[i * iC1]; | ||
| 413 | - _internalLpArray[iLpIndex].setBxLb(false); | ||
| 414 | - _internalLpArray[iLpIndex].setBxFb(true); | ||
| 415 | - _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 416 | - _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 417 | - } | ||
| 418 | - for (i = 0; i < iC2; i++) { | ||
| 419 | - iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)]; | ||
| 420 | - _internalLpArray[iLpIndex].setBxLb(false); | ||
| 421 | - _internalLpArray[iLpIndex].setBxFb(true); | ||
| 422 | - _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 423 | - _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 424 | - } | ||
| 425 | - // 其他分班 | ||
| 426 | - for (i = 0; i < aNotLbIndexes.length; i++) { | ||
| 427 | - iLpIndex = aNotLbIndexes[i]; | ||
| 428 | - if (!_internalLpArray[iLpIndex].isBxFb5_2()) { | ||
| 429 | - _internalLpArray[iLpIndex].setBxLb(false); | ||
| 430 | - _internalLpArray[iLpIndex].setBxFb(true); | ||
| 431 | - _internalLpArray[iLpIndex].setBxFb5_2(false); | ||
| 432 | - _internalLpArray[iLpIndex].setBxDesc("其他分班"); | ||
| 433 | - } | ||
| 434 | - } | ||
| 435 | - | ||
| 436 | - console.log("高峰周转时间:" + _paramObj.calcuPeakZzsj()); | ||
| 437 | - console.log("连班路牌数:" + _iBx_lb_lpcount); | ||
| 438 | - console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount); | ||
| 439 | - console.log("其他分班路牌数:" + _iBx_other_fb_lpcount); | ||
| 440 | - var aLbIndexes = []; | ||
| 441 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 442 | - if (_internalLpArray[i].isBxLb()) { | ||
| 443 | - aLbIndexes.push(i); | ||
| 444 | - } | ||
| 445 | - } | ||
| 446 | - console.log("连班路牌indexes=" + aLbIndexes); | ||
| 447 | - var a_5_2_fbIndexes = []; | ||
| 448 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 449 | - if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) { | ||
| 450 | - a_5_2_fbIndexes.push(i); | ||
| 451 | - } | ||
| 452 | - } | ||
| 453 | - console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes); | ||
| 454 | - var a_other_fbIndexes = []; | ||
| 455 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 456 | - if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) { | ||
| 457 | - a_other_fbIndexes.push(i); | ||
| 458 | - } | ||
| 459 | - } | ||
| 460 | - console.log("其他分班路牌indexes=" + a_other_fbIndexes); | ||
| 461 | - | ||
| 462 | - console.log("//---------------- 行车计划,初始化方法3 end ----------------//"); | ||
| 463 | - }; | ||
| 464 | - | ||
| 465 | - //----------------------- 初始化方法4,计算中标线位置 -------------------------// | ||
| 466 | - var _iZbx_lpIndex; // 中标线对应第几个路牌 | ||
| 467 | - var _fnInitFun4 = function() { // 初始化方法4 | ||
| 468 | - console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); | ||
| 469 | - | ||
| 470 | - // 中标线开始时间,早的首班车时间,和上标线的开始时间方向相反 | ||
| 471 | - var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 472 | - | ||
| 473 | - // 1、使用上标线的开始时间的之前的虚拟班次,往下拉,模拟构造每个路牌的开头的虚拟班次 | ||
| 474 | - var i; | ||
| 475 | - var _aFBc = []; | ||
| 476 | - _aFBc.push(_internalLpArray[0].getBc(0, 1)); // 第一个班次是上标线的开头虚拟班次 | ||
| 477 | - for (i = 1; i < _internalLpArray.length; i++) { | ||
| 478 | - _aFBc.push(_fnGenerateBc(i, 0, 1)); | ||
| 479 | - } | ||
| 480 | - | ||
| 481 | - // 2、使用中标线开始时间,比对虚拟班次,找出最接近的(但是要大于等于时间) | ||
| 482 | - var _iLpIndex = -1; // 中标线的路牌索引 | ||
| 483 | - for (i = 0; i < _aFBc.length; i++) { | ||
| 484 | - console.log("比较班次的发车时间=" + _aFBc[i].getFcTimeObj().format("HH:mm")); | ||
| 485 | - | ||
| 486 | - if (!_internalLpArray[i].isBxLb()) { | ||
| 487 | - // 如果不是连班,不计算 | ||
| 488 | - continue; | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - if (_aFBc[i].getFcTimeObj().diff(oSt) >= 0) { | ||
| 492 | - _iLpIndex = i; | ||
| 493 | - break; | ||
| 494 | - } | ||
| 495 | - } | ||
| 496 | - | ||
| 497 | - _iZbx_lpIndex = _iLpIndex; // 中标线放在第几个路牌 | ||
| 498 | - | ||
| 499 | - // 3、设定中标线班次 | ||
| 500 | - _aFBc[_iZbx_lpIndex].fnSetIsFirstBc(true); // 设置首班班次标识 | ||
| 501 | - _aFBc[_iZbx_lpIndex].setLp(_internalLpArray[_iZbx_lpIndex]); // 设置关联的路牌 | ||
| 502 | - _aFBc[_iZbx_lpIndex].fnSetDelFlag(false); // 不是标识班次 | ||
| 503 | - _internalLpArray[_iZbx_lpIndex].setBc(0, 1, _aFBc[_iZbx_lpIndex]); // 将班次加入路牌 | ||
| 504 | - | ||
| 505 | - // 4、修改班次时间为中标时间 | ||
| 506 | - var _iDiffTime = _aFBc[_iZbx_lpIndex].getFcTimeObj().diff(oSt, "m"); | ||
| 507 | - _aFBc[_iZbx_lpIndex].getFcTimeObj().add(-_iDiffTime, "m"); | ||
| 508 | - _aFBc[_iZbx_lpIndex].getArrTimeObj().add(-_iDiffTime, "m"); | ||
| 509 | - _aFBc[_iZbx_lpIndex].setStopTime(_aFBc[_iZbx_lpIndex].getStopTime() + _iDiffTime); | ||
| 510 | - | ||
| 511 | - | ||
| 512 | - // 5、如果中标线的开始时间比较早,则中标线下一个班次可能空,补,一直到前面添加的高峰班次为止 | ||
| 513 | - for (i = 1; i < _qCount; i++) { // 从第二圈开始,因为第一圈第二个班次就是中标线的开始时间 | ||
| 514 | - if (_internalLpArray[_iZbx_lpIndex].getBc(i, 0)) { | ||
| 515 | - break; | ||
| 516 | - } else { | ||
| 517 | - _fnGenerateBcAndSetBc(_iZbx_lpIndex, i, 0); | ||
| 518 | - } | ||
| 519 | - | ||
| 520 | - if (_internalLpArray[_iZbx_lpIndex].getBc(i, 1)) { | ||
| 521 | - break; | ||
| 522 | - } else { | ||
| 523 | - _fnGenerateBcAndSetBc(_iZbx_lpIndex, i, 1); | ||
| 524 | - } | ||
| 525 | - } | ||
| 526 | - | ||
| 527 | - console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌"); | ||
| 528 | - | ||
| 529 | - console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); | ||
| 530 | - | ||
| 531 | - | ||
| 532 | - }; | ||
| 533 | - | ||
| 534 | - //-------------------- 重要的内部方法 -----------------------// | ||
| 535 | - /** | ||
| 536 | - * 核心方法,利用路牌间隔纵向生成班次。 | ||
| 537 | - * @param iLpindex 路牌索引 | ||
| 538 | - * @param iQindex 圈索引 | ||
| 539 | - * @param iBcindex 班次索引 | ||
| 540 | - * @returns object InternalBcObj,失败 false | ||
| 541 | - */ | ||
| 542 | - var _fnGenerateBc = function(iLpindex, iQindex, iBcindex) { | ||
| 543 | - // 以上标线为起始点,使用路牌在不同圈,班次索引的发车间隔,计算班次 | ||
| 544 | - // 注意,发车间隔是指下一个班次应该距离当前班次间隔,是从下往上的 | ||
| 545 | - | ||
| 546 | - // 1、参数验证 | ||
| 547 | - if (iLpindex == 0) { // 上标线的班次不需要生成 | ||
| 548 | - return false; | ||
| 549 | - } | ||
| 550 | - | ||
| 551 | - // 2、计算间隔 | ||
| 552 | - var i; | ||
| 553 | - var oLp; | ||
| 554 | - var iTime = 0; | ||
| 555 | - for (i = 0; i < iLpindex; i++) { | ||
| 556 | - oLp = _internalLpArray[i]; | ||
| 557 | - iTime += oLp.fnGetVerticalIntervalTime(iQindex, iBcindex); | ||
| 558 | - } | ||
| 559 | - | ||
| 560 | - // 3、生成班次 | ||
| 561 | - var _oKsbc = _internalLpArray[0].getBc(iQindex, iBcindex); | ||
| 562 | - if (!_oKsbc) { | ||
| 563 | - return false; | ||
| 564 | - } | ||
| 565 | - var _oKssj = _paramObj.addMinute(_oKsbc.getFcTimeObj(), iTime); | ||
| 566 | - var _oBc = _factory.createBcObj( | ||
| 567 | - _internalLpArray[iLpindex], | ||
| 568 | - "normal", _oKsbc.isUp(), | ||
| 569 | - 1, _oKssj, _paramObj); | ||
| 570 | - | ||
| 571 | - return _oBc; | ||
| 572 | - | ||
| 573 | - }; | ||
| 574 | - | ||
| 575 | - /** | ||
| 576 | - * 核心方法,在指定位置生成班次并添加到路牌指定位置中。 | ||
| 577 | - * @param lpIndex 第几个路牌 | ||
| 578 | - * @param qIndex 第几圈 | ||
| 579 | - * @param bcIndex 第几个班次 | ||
| 580 | - */ | ||
| 581 | - var _fnGenerateBcAndSetBc = function(lpIndex, qIndex, bcIndex) { | ||
| 582 | - var _bcObj = _fnGenerateBc(lpIndex, qIndex, bcIndex); | ||
| 583 | - if (_bcObj) { | ||
| 584 | - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj); | ||
| 585 | - } | ||
| 586 | - }; | ||
| 587 | - | ||
| 588 | - /** | ||
| 589 | - * 获取班次列表。 | ||
| 590 | - * @param oIsUp 是否上行 | ||
| 591 | - * @param oStartTime 开始时间对象 | ||
| 592 | - * @returns [(InternalBcObj)] | ||
| 593 | - */ | ||
| 594 | - var _fnGetBcList2 = function(oIsUp, oStartTime) { | ||
| 595 | - var i; | ||
| 596 | - var j; | ||
| 597 | - var oLp; | ||
| 598 | - var oBc; | ||
| 599 | - var aBc = []; | ||
| 600 | - | ||
| 601 | - for (j = 0; j < _qCount; j++) { | ||
| 602 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 603 | - oLp = _internalLpArray[i]; | ||
| 604 | - oBc = oLp.getBc( | ||
| 605 | - j, | ||
| 606 | - _qIsUp == oIsUp ? 0 : 1 | ||
| 607 | - ); | ||
| 608 | - if (oBc && oBc.getFcTimeObj().isAfter(oStartTime)) { | ||
| 609 | - aBc.push(oBc); | ||
| 610 | - } | ||
| 611 | - } | ||
| 612 | - } | ||
| 613 | - | ||
| 614 | - var aBcFcTime = []; | ||
| 615 | - for (i = 0; i < aBc.length; i++) { | ||
| 616 | - oBc = aBc[i]; | ||
| 617 | - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm")); | ||
| 618 | - } | ||
| 619 | - console.log((oIsUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(",")); | ||
| 620 | - | ||
| 621 | - return aBc; | ||
| 622 | - }; | ||
| 623 | - | ||
| 624 | - /** | ||
| 625 | - * 获取班次列表。 | ||
| 626 | - * @param isUp boolean 是否上行 | ||
| 627 | - * @returns [(InternalBcObj)] | ||
| 628 | - */ | ||
| 629 | - var _fnGetBcList = function(isUp) { | ||
| 630 | - var i; | ||
| 631 | - var j; | ||
| 632 | - var oLp; | ||
| 633 | - var oBc; | ||
| 634 | - var aBc = []; | ||
| 635 | - | ||
| 636 | - for (j = 0; j < _qCount; j++) { | ||
| 637 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 638 | - oLp = _internalLpArray[i]; | ||
| 639 | - oBc = oLp.getBc( | ||
| 640 | - j, | ||
| 641 | - _qIsUp == isUp ? 0 : 1 | ||
| 642 | - ); | ||
| 643 | - if (oBc) { | ||
| 644 | - aBc.push(oBc); | ||
| 645 | - } | ||
| 646 | - } | ||
| 647 | - } | ||
| 648 | - | ||
| 649 | - var aBcFcTime = []; | ||
| 650 | - for (i = 0; i < aBc.length; i++) { | ||
| 651 | - oBc = aBc[i]; | ||
| 652 | - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm")); | ||
| 653 | - } | ||
| 654 | - console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(",")); | ||
| 655 | - | ||
| 656 | - return aBc; | ||
| 657 | - }; | ||
| 658 | - | ||
| 659 | - /** | ||
| 660 | - * 查找离指定时间最近的前面的班次索引信息 | ||
| 661 | - * @param timeObj 查找时间 | ||
| 662 | - * @param isUp 是否上行 | ||
| 663 | - * @returns [{路牌index},{圈index},{班次index}] | ||
| 664 | - */ | ||
| 665 | - var _fnFindUpClosedBcIndexWithTime = function(timeObj, isUp) { | ||
| 666 | - | ||
| 667 | - var _lpObj; | ||
| 668 | - var _groupObj; | ||
| 669 | - var _bcObj; | ||
| 670 | - var _i; | ||
| 671 | - var _j; | ||
| 672 | - var timediff; // 时间差取绝对值 | ||
| 673 | - | ||
| 674 | - var _lpIndex; | ||
| 675 | - var _up_qIndex; | ||
| 676 | - var _up_bIndex; | ||
| 677 | - | ||
| 678 | - for (_i = 0; _i < _qCount; _i++) { | ||
| 679 | - for (_j = 0; _j < _internalLpArray.length; _j++) { | ||
| 680 | - _lpObj = _internalLpArray[_j]; | ||
| 681 | - _groupObj = _lpObj.getGroup(_i); | ||
| 682 | - _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2(); | ||
| 683 | - if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的 | ||
| 684 | - _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1); | ||
| 685 | - } | ||
| 686 | - if (_bcObj) { | ||
| 687 | - if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) { | ||
| 688 | - if (!timediff) { | ||
| 689 | - timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 690 | - _lpIndex = _j; | ||
| 691 | - _up_qIndex = _i; | ||
| 692 | - _up_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 693 | - } else { | ||
| 694 | - if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) { | ||
| 695 | - timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 696 | - _lpIndex = _j; | ||
| 697 | - _up_qIndex = _i; | ||
| 698 | - _up_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 699 | - } | ||
| 700 | - } | ||
| 701 | - } | ||
| 702 | - } | ||
| 703 | - } | ||
| 704 | - } | ||
| 705 | - | ||
| 706 | - if (_lpIndex == undefined) { | ||
| 707 | - return false; | ||
| 708 | - } | ||
| 709 | - | ||
| 710 | - var bcindex = []; | ||
| 711 | - bcindex.push(_lpIndex); | ||
| 712 | - bcindex.push(_up_qIndex); | ||
| 713 | - bcindex.push(_up_bIndex); | ||
| 714 | - | ||
| 715 | - return bcindex; | ||
| 716 | - }; | ||
| 717 | - | ||
| 718 | - /** | ||
| 719 | - * 查找离指定时间最近的后面的班次索引信息 | ||
| 720 | - * @param timeObj 查找时间 | ||
| 721 | - * @param isUp 是否上行 | ||
| 722 | - * @returns [{路牌index},{圈index},{班次index}] | ||
| 723 | - */ | ||
| 724 | - var _fnFindDownClosedBcIndexWithTime = function(timeObj, isUp) { | ||
| 725 | - var _lpObj; | ||
| 726 | - var _groupObj; | ||
| 727 | - var _bcObj; | ||
| 728 | - var _i; | ||
| 729 | - var _j; | ||
| 730 | - var timediff; // 时间差取绝对值 | ||
| 731 | - | ||
| 732 | - var _lpIndex; | ||
| 733 | - var _down_qIndex; | ||
| 734 | - var _down_bIndex; | ||
| 735 | - | ||
| 736 | - var flag; | ||
| 737 | - | ||
| 738 | - for (_i = 0; _i < _qCount; _i++) { | ||
| 739 | - for (_j = 0; _j < _internalLpArray.length; _j++) { | ||
| 740 | - _lpObj = _internalLpArray[_j]; | ||
| 741 | - _groupObj = _lpObj.getGroup(_i); | ||
| 742 | - // TODO:bug | ||
| 743 | - _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2(); | ||
| 744 | - if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的 | ||
| 745 | - _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1); | ||
| 746 | - } | ||
| 747 | - if (_bcObj) { | ||
| 748 | - //console.log("timeobj -> bcobj diff flag " + | ||
| 749 | - // timeObj.format("HH:mm") + "->" + | ||
| 750 | - // _bcObj.getFcTimeObj().format("HH:mm") + | ||
| 751 | - // timeObj.diff(_bcObj.getFcTimeObj()) + | ||
| 752 | - // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0) | ||
| 753 | - //); | ||
| 754 | - | ||
| 755 | - flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0; | ||
| 756 | - | ||
| 757 | - if (flag) { | ||
| 758 | - if (!timediff) { | ||
| 759 | - timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 760 | - _lpIndex = _j; | ||
| 761 | - _down_qIndex = _i; | ||
| 762 | - _down_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 763 | - } else { | ||
| 764 | - if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) { | ||
| 765 | - timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 766 | - _lpIndex = _j; | ||
| 767 | - _down_qIndex = _i; | ||
| 768 | - _down_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 769 | - } | ||
| 770 | - } | ||
| 771 | - } | ||
| 772 | - } | ||
| 773 | - } | ||
| 774 | - } | ||
| 775 | - | ||
| 776 | - if (_lpIndex == undefined) { | ||
| 777 | - return false; | ||
| 778 | - } | ||
| 779 | - | ||
| 780 | - var bcindex = []; | ||
| 781 | - bcindex.push(_lpIndex); | ||
| 782 | - bcindex.push(_down_qIndex); | ||
| 783 | - bcindex.push(_down_bIndex); | ||
| 784 | - | ||
| 785 | - return bcindex; | ||
| 786 | - }; | ||
| 787 | - | ||
| 788 | - /** | ||
| 789 | - * 获取班次索引。 | ||
| 790 | - * @param oBc 班次对象 | ||
| 791 | - * @returns [{路牌索引},{圈索引},{班次索引}] | ||
| 792 | - */ | ||
| 793 | - var _fnGetBcIndex = function(oBc) { | ||
| 794 | - // 路牌索引 | ||
| 795 | - var i; | ||
| 796 | - var iLpIndex; | ||
| 797 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 798 | - if (_internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) { | ||
| 799 | - iLpIndex = i; | ||
| 800 | - break; | ||
| 801 | - } | ||
| 802 | - } | ||
| 803 | - // 圈索引 | ||
| 804 | - var j; | ||
| 805 | - var iGroupIndex; | ||
| 806 | - var bFlag = false; | ||
| 807 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 808 | - if (bFlag) { | ||
| 809 | - break; | ||
| 810 | - } | ||
| 811 | - for (j = 0; j < _qCount; j++) { | ||
| 812 | - if (_internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) { | ||
| 813 | - iGroupIndex = j; | ||
| 814 | - bFlag = true; | ||
| 815 | - break; | ||
| 816 | - } | ||
| 817 | - } | ||
| 818 | - } | ||
| 819 | - // 班次索引 | ||
| 820 | - var iBcIndex = _qIsUp == oBc.isUp() ? 0 : 1; | ||
| 821 | - | ||
| 822 | - if (iLpIndex == undefined) { | ||
| 823 | - return null; | ||
| 824 | - } else { | ||
| 825 | - return [].concat(iLpIndex, iGroupIndex, iBcIndex); | ||
| 826 | - } | ||
| 827 | - | ||
| 828 | - }; | ||
| 829 | - | ||
| 830 | - return { | ||
| 831 | - //------------- 布局初始化方法 ------------// | ||
| 832 | - /** | ||
| 833 | - * 初始化数据,使用标线初始化 | ||
| 834 | - */ | ||
| 835 | - fnInitDataWithBxLayout: function() { | ||
| 836 | - // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中 | ||
| 837 | - _fnInitFun1(); | ||
| 838 | - // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次,计算路牌在各个圈中的间隔 | ||
| 839 | - _fnInitFun2(); | ||
| 840 | - // 初始化布局3,计算连班分班路牌分布 | ||
| 841 | - _fnInitFun3(); | ||
| 842 | - // 初始化布局4,计算中标线位置 | ||
| 843 | - _fnInitFun4(); | ||
| 844 | - | ||
| 845 | - }, | ||
| 846 | - | ||
| 847 | - /** | ||
| 848 | - * 调整高峰班次, | ||
| 849 | - * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间 | ||
| 850 | - * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后 | ||
| 851 | - * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的) | ||
| 852 | - * @param isZgf 是否早高峰 | ||
| 853 | - * @param isUp 是否上行 | ||
| 854 | - */ | ||
| 855 | - fnAdjustGfbc : function(isZgf, isUp) { | ||
| 856 | - var oStartTime; // 开始时间 | ||
| 857 | - var oEndTime; // 结束时间 | ||
| 858 | - var aStartBcIndex; // 开始班次索引 | ||
| 859 | - var aEndBcIndex; // 结束班次索引 | ||
| 860 | - | ||
| 861 | - oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj(); | ||
| 862 | - oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj(); | ||
| 863 | - | ||
| 864 | - aStartBcIndex = _fnFindUpClosedBcIndexWithTime(oStartTime, isUp); | ||
| 865 | - aEndBcIndex = _fnFindDownClosedBcIndexWithTime(oEndTime, isUp); | ||
| 866 | - | ||
| 867 | - var iLpIndex; | ||
| 868 | - var iQIndex; | ||
| 869 | - var iBcIndex; | ||
| 870 | - var iQInternelCount; // 高峰时间段中间包含的圈数 | ||
| 871 | - var i; | ||
| 872 | - var j; | ||
| 873 | - | ||
| 874 | - var oLp; | ||
| 875 | - | ||
| 876 | - if (aStartBcIndex && aEndBcIndex) { | ||
| 877 | - iLpIndex = aStartBcIndex[0]; | ||
| 878 | - iQIndex = aStartBcIndex[1]; | ||
| 879 | - iBcIndex = aStartBcIndex[2]; | ||
| 880 | - | ||
| 881 | - // 处理头 | ||
| 882 | - // 删除头部多余班次 | ||
| 883 | - for (j = 0; j < iLpIndex; j++) { | ||
| 884 | - oLp = _internalLpArray[j]; | ||
| 885 | - if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 886 | - oLp.removeBc(iQIndex, iBcIndex); | ||
| 887 | - } | ||
| 888 | - } | ||
| 889 | - | ||
| 890 | - for (j = iLpIndex; j < _internalLpArray.length; j++) { | ||
| 891 | - oLp = _internalLpArray[j]; | ||
| 892 | - if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 893 | - _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 894 | - } | ||
| 895 | - } | ||
| 896 | - | ||
| 897 | - // 处理中间 | ||
| 898 | - iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1; | ||
| 899 | - for (i = 1; i <= iQInternelCount; i++) { | ||
| 900 | - | ||
| 901 | - for (j = 0; j < _internalLpArray.length; j++) { | ||
| 902 | - oLp = _internalLpArray[j]; | ||
| 903 | - if (!oLp.getBc(iQIndex + i, iBcIndex)) { | ||
| 904 | - _fnGenerateBcAndSetBc(j, iQIndex + i, iBcIndex); | ||
| 905 | - } | ||
| 906 | - } | ||
| 907 | - | ||
| 908 | - } | ||
| 909 | - | ||
| 910 | - // 处理尾部 | ||
| 911 | - iLpIndex = aEndBcIndex[0]; | ||
| 912 | - iQIndex = aEndBcIndex[1]; | ||
| 913 | - iBcIndex = aEndBcIndex[2]; | ||
| 914 | - | ||
| 915 | - // 删除尾部多余的班次 | ||
| 916 | - for (j = iLpIndex; j < _internalLpArray.length; j++) { | ||
| 917 | - oLp = _internalLpArray[j]; | ||
| 918 | - if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 919 | - oLp.removeBc(iQIndex, iBcIndex); | ||
| 920 | - } | ||
| 921 | - } | ||
| 922 | - | ||
| 923 | - if (aStartBcIndex[1] != aEndBcIndex[1]) { // 指定时间范围跨圈 | ||
| 924 | - for (j = 0; j < iLpIndex; j++) { | ||
| 925 | - oLp = _internalLpArray[j]; | ||
| 926 | - if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 927 | - _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 928 | - } | ||
| 929 | - } | ||
| 930 | - } else { | ||
| 931 | - // 不跨圈,不用处理,处理头的时候已经加了 | ||
| 932 | - } | ||
| 933 | - | ||
| 934 | - } | ||
| 935 | - | ||
| 936 | - }, | ||
| 937 | - | ||
| 938 | - /** | ||
| 939 | - * 按照营运时间要求补充班次, | ||
| 940 | - * 早高峰7:45分以前出场运营, | ||
| 941 | - * 晚高峰16:10分以前出场运营 | ||
| 942 | - */ | ||
| 943 | - fnCalcuLpBc_yy: function() { | ||
| 944 | - // 补班次的时候,针对的是分班班型 | ||
| 945 | - var i; | ||
| 946 | - var _oLp; | ||
| 947 | - var _oBc; | ||
| 948 | - var _aMinBcIndex; | ||
| 949 | - var _aMaxBcIndex; | ||
| 950 | - | ||
| 951 | - var _qIndex; | ||
| 952 | - var _bIndex; | ||
| 953 | - | ||
| 954 | - var _zgfCDate = _paramObj.toTimeObj("7:45"); | ||
| 955 | - var _wgfCDate = _paramObj.toTimeObj("16:10"); | ||
| 956 | - var _ccsj; | ||
| 957 | - | ||
| 958 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 959 | - _oLp = _internalLpArray[i]; | ||
| 960 | - if (_oLp.isBxFb()) { // 分班路牌 | ||
| 961 | - // 早高峰部分 | ||
| 962 | - _aMinBcIndex = _oLp.getMinBcObjPosition(); | ||
| 963 | - _qIndex = _aMinBcIndex[0]; | ||
| 964 | - _bIndex = _aMinBcIndex[1]; | ||
| 965 | - _oBc = _oLp.getBc(_qIndex, _bIndex); | ||
| 966 | - if (_qIsUp) { | ||
| 967 | - _ccsj = _bIndex == 0 ? | ||
| 968 | - _paramObj.getUpOutTime() : | ||
| 969 | - _paramObj.getDownOutTime(); | ||
| 970 | - } else { | ||
| 971 | - _ccsj = _bIndex == 0 ? | ||
| 972 | - _paramObj.getDownOutTime() : | ||
| 973 | - _paramObj.getUpOutTime(); | ||
| 974 | - } | ||
| 975 | - if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | ||
| 976 | - _fnGenerateBcAndSetBc( | ||
| 977 | - i, | ||
| 978 | - _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 979 | - _bIndex == 0 ? 1 : 0 | ||
| 980 | - ) | ||
| 981 | - } | ||
| 982 | - | ||
| 983 | - // 晚高峰部分 | ||
| 984 | - _aMaxBcIndex = _oLp.getMaxBcObjPosition(); | ||
| 985 | - _qIndex = _aMaxBcIndex[0]; | ||
| 986 | - _bIndex = _aMaxBcIndex[1]; | ||
| 987 | - _oBc = _oLp.getBc( | ||
| 988 | - _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 989 | - _bIndex == 0 ? 1 : 0 | ||
| 990 | - ); | ||
| 991 | - if (!_oBc) { // 前一个班次不存在,再判定加不加 | ||
| 992 | - _oBc = _oLp.getBc(_qIndex, _bIndex); | ||
| 993 | - if (_qIsUp) { | ||
| 994 | - _ccsj = _bIndex == 0 ? | ||
| 995 | - _paramObj.getUpOutTime() : | ||
| 996 | - _paramObj.getDownOutTime(); | ||
| 997 | - } else { | ||
| 998 | - _ccsj = _bIndex == 0 ? | ||
| 999 | - _paramObj.getDownOutTime() : | ||
| 1000 | - _paramObj.getUpOutTime(); | ||
| 1001 | - } | ||
| 1002 | - if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | ||
| 1003 | - _fnGenerateBcAndSetBc( | ||
| 1004 | - i, | ||
| 1005 | - _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 1006 | - _bIndex == 0 ? 1 : 0 | ||
| 1007 | - ) | ||
| 1008 | - } | ||
| 1009 | - } | ||
| 1010 | - } | ||
| 1011 | - } | ||
| 1012 | - }, | ||
| 1013 | - | ||
| 1014 | - /** | ||
| 1015 | - * 补充做5休2的班型班次。 | ||
| 1016 | - * 1、确认5_2班型大致多少圈(小数点过.7进位) | ||
| 1017 | - * 2、获取当前5_2两端车次链的信息,每段的班次数目,还差几个班次没加 | ||
| 1018 | - * 3、如果前面的车次链班次少,则从前面的车次链开始加 | ||
| 1019 | - * 4、如果车次链班次数一样,从从后面的车次链开始加 | ||
| 1020 | - * 5、加班次时都是往车次链前方加 | ||
| 1021 | - * 6、如果前面车次链不能再加班次了,从后面车次链加 | ||
| 1022 | - */ | ||
| 1023 | - fnCalcuLpBx_5_2: function() { | ||
| 1024 | - // 计算做5休2班型所需的班次数 | ||
| 1025 | - var iBxBcount = _aBxDesc[6].fBcCount; | ||
| 1026 | - if (iBxBcount - Math.floor(iBxBcount) > 0.7) { | ||
| 1027 | - iBxBcount = Math.floor(iBxBcount) + 1; | ||
| 1028 | - } else { | ||
| 1029 | - iBxBcount = Math.floor(iBxBcount); | ||
| 1030 | - } | ||
| 1031 | - | ||
| 1032 | - var i; | ||
| 1033 | - var j; | ||
| 1034 | - var oLp; | ||
| 1035 | - var iAddBcCount; | ||
| 1036 | - var oBcChain1; | ||
| 1037 | - var oBcChain2; | ||
| 1038 | - var iQindex; | ||
| 1039 | - var iBindex; | ||
| 1040 | - | ||
| 1041 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1042 | - oLp = _internalLpArray[i]; | ||
| 1043 | - if (oLp.isBxFb5_2()) { | ||
| 1044 | - iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数 | ||
| 1045 | - for (j = 1; j <= iAddBcCount; j++) { | ||
| 1046 | - oBcChain1 = oLp.fnGetBcChainInfo(0); | ||
| 1047 | - oBcChain2 = oLp.fnGetBcChainInfo(1); | ||
| 1048 | - | ||
| 1049 | - if (oBcChain1.bcount < oBcChain2.bcount) { | ||
| 1050 | - iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q; | ||
| 1051 | - iBindex = oBcChain1.s_b == 0 ? 1 : 0; | ||
| 1052 | - // 往车次链往前不能加,就往后加 | ||
| 1053 | - if (_fnGenerateBc(i, iQindex, iBindex)) { | ||
| 1054 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1055 | - } else { | ||
| 1056 | - iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | ||
| 1057 | - iBindex = oBcChain1.e_b == 0 ? 1 : 0; | ||
| 1058 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1059 | - } | ||
| 1060 | - | ||
| 1061 | - } else if (oBcChain1.bcount > oBcChain2.bcount) { | ||
| 1062 | - iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | ||
| 1063 | - iBindex = oBcChain2.s_b == 0 ? 1 : 0; | ||
| 1064 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1065 | - } else { | ||
| 1066 | - iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | ||
| 1067 | - iBindex = oBcChain2.s_b == 0 ? 1 : 0; | ||
| 1068 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1069 | - } | ||
| 1070 | - } | ||
| 1071 | - } | ||
| 1072 | - } | ||
| 1073 | - | ||
| 1074 | - }, | ||
| 1075 | - | ||
| 1076 | - /** | ||
| 1077 | - * 补其他分班班型班次。 | ||
| 1078 | - * 从车次链的后面开始加 | ||
| 1079 | - */ | ||
| 1080 | - fnCalcuLpBx_other: function() { | ||
| 1081 | - // TODO:根据上标线的首班时间确定班型,小于05:59的做一休一,否则做二休一 | ||
| 1082 | - var oSt = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 1083 | - var iBxIndex = 4; | ||
| 1084 | - if (oSt.isBefore(_paramObj.toTimeObj("05:59"))) { | ||
| 1085 | - iBxIndex = 5; | ||
| 1086 | - } | ||
| 1087 | - // 计算做5休2班型所需的班次数 | ||
| 1088 | - var iQBcount = _aBxDesc[iBxIndex].fQCount; | ||
| 1089 | - var iBxBcount = Math.round(iQBcount) * 2; | ||
| 1090 | - | ||
| 1091 | - var i; | ||
| 1092 | - var j; | ||
| 1093 | - var oLp; | ||
| 1094 | - var iAddBcCount; | ||
| 1095 | - var oBcChain1; | ||
| 1096 | - var oBcChain2; | ||
| 1097 | - var iQindex; | ||
| 1098 | - var iBindex; | ||
| 1099 | - | ||
| 1100 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1101 | - oLp = _internalLpArray[i]; | ||
| 1102 | - if (oLp.isBxFb() && !oLp.isBxFb5_2()) { | ||
| 1103 | - iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数 | ||
| 1104 | - for (j = 1; j <= iAddBcCount; j++) { | ||
| 1105 | - oBcChain1 = oLp.fnGetBcChainInfo(0); | ||
| 1106 | - oBcChain2 = oLp.fnGetBcChainInfo(1); | ||
| 1107 | - | ||
| 1108 | - if (oBcChain1.bcount < oBcChain2.bcount) { | ||
| 1109 | - iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | ||
| 1110 | - iBindex = oBcChain1.e_b == 0 ? 1 : 0; | ||
| 1111 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1112 | - } else if (oBcChain1.bcount > oBcChain2.bcount) { | ||
| 1113 | - iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | ||
| 1114 | - iBindex = oBcChain2.e_b == 0 ? 1 : 0; | ||
| 1115 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1116 | - } else { | ||
| 1117 | - iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | ||
| 1118 | - iBindex = oBcChain2.e_b == 0 ? 1 : 0; | ||
| 1119 | - _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1120 | - } | ||
| 1121 | - } | ||
| 1122 | - } | ||
| 1123 | - } | ||
| 1124 | - | ||
| 1125 | - }, | ||
| 1126 | - | ||
| 1127 | - /** | ||
| 1128 | - * 补充连班路牌班次。 | ||
| 1129 | - * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢 | ||
| 1130 | - * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢 | ||
| 1131 | - */ | ||
| 1132 | - fnCalcuLpBx_lb: function() { | ||
| 1133 | - // 补充连班的班次,参照上标线,中标线补充不足的班次 | ||
| 1134 | - | ||
| 1135 | - var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引 | ||
| 1136 | - var i; | ||
| 1137 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1138 | - if (_internalLpArray[i].isBxLb() && i != 0) { | ||
| 1139 | - aLbLpindexes.push(i); | ||
| 1140 | - } | ||
| 1141 | - } | ||
| 1142 | - | ||
| 1143 | - var oEndsj = // 结束时间 | ||
| 1144 | - _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ? | ||
| 1145 | - _paramObj.getDownLastDTimeObj() : | ||
| 1146 | - _paramObj.getUpLastDtimeObj(); | ||
| 1147 | - | ||
| 1148 | - var oLp; | ||
| 1149 | - var aMinbcPos; | ||
| 1150 | - var oBc; | ||
| 1151 | - var j; | ||
| 1152 | - var iTempBcIndex; | ||
| 1153 | - | ||
| 1154 | - // 1、从最小班次开始,往后补充班次 | ||
| 1155 | - for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1156 | - oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1157 | - | ||
| 1158 | - // 最小班次索引 | ||
| 1159 | - aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1160 | - // 使用纵向分隔补充班次,从最小班次向后补 | ||
| 1161 | - iTempBcIndex = aMinbcPos[1] == 0 ? 1 : 0; | ||
| 1162 | - j = iTempBcIndex == 0 ? aMinbcPos[0] + 1 : aMinbcPos[0]; | ||
| 1163 | - | ||
| 1164 | - while (j < _qCount) { | ||
| 1165 | - while (iTempBcIndex <= 1) { | ||
| 1166 | - oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex); | ||
| 1167 | - if (oBc && | ||
| 1168 | - oBc.getFcTimeObj().isBefore(oEndsj) ) { | ||
| 1169 | - oLp.setBc(j, iTempBcIndex, oBc); | ||
| 1170 | - } | ||
| 1171 | - iTempBcIndex++; | ||
| 1172 | - } | ||
| 1173 | - iTempBcIndex = 0; | ||
| 1174 | - j++; | ||
| 1175 | - } | ||
| 1176 | - | ||
| 1177 | - } | ||
| 1178 | - | ||
| 1179 | - // 2、上标线中标线之间的路牌,从最小的班次往前补充班次 | ||
| 1180 | - | ||
| 1181 | - // 还要补充缺失的班次,差上标线几个班次要往前补上 | ||
| 1182 | - var iBccount; | ||
| 1183 | - var iQindex; | ||
| 1184 | - var iBindex; | ||
| 1185 | - // 补上标线到中标线之间的连班路牌的班次 | ||
| 1186 | - for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1187 | - // 中标线可能也要补充,因为中标线生成算法有变 | ||
| 1188 | - // 如果上标线==中标线为止,不用补了 | ||
| 1189 | - | ||
| 1190 | - if (aLbLpindexes[i] > 0 && aLbLpindexes[i] <= _iZbx_lpIndex) { | ||
| 1191 | - oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1192 | - aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1193 | - iQindex = aMinbcPos[0]; | ||
| 1194 | - iBindex = aMinbcPos[1]; | ||
| 1195 | - iBccount = (iQindex - 1) * 2 + iBindex; // 距离上标线起始站点差几个班次 | ||
| 1196 | - for (j = 0; j < iBccount; j++) { | ||
| 1197 | - if (iBindex == 0) { | ||
| 1198 | - iQindex --; | ||
| 1199 | - iBindex = 1; | ||
| 1200 | - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1201 | - } else if (iBindex == 1) { | ||
| 1202 | - iBindex --; | ||
| 1203 | - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1204 | - } | ||
| 1205 | - } | ||
| 1206 | - | ||
| 1207 | - } | ||
| 1208 | - | ||
| 1209 | - } | ||
| 1210 | - | ||
| 1211 | - // 3、中标线之后的路牌,从最小的班次往前补充班次 | ||
| 1212 | - | ||
| 1213 | - // 补中标线以下的连班路牌的班次 | ||
| 1214 | - for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1215 | - if (aLbLpindexes[i] > _iZbx_lpIndex) { | ||
| 1216 | - oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1217 | - aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1218 | - iQindex = aMinbcPos[0]; | ||
| 1219 | - iBindex = aMinbcPos[1]; | ||
| 1220 | - iBccount = (iQindex - 0) * 2 + iBindex - 1; // 距离上标线起始站点差几个班次 | ||
| 1221 | - for (j = 0; j < iBccount; j++) { | ||
| 1222 | - if (iBindex == 0) { | ||
| 1223 | - iQindex --; | ||
| 1224 | - iBindex = 1; | ||
| 1225 | - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1226 | - } else if (iBindex == 1) { | ||
| 1227 | - iBindex --; | ||
| 1228 | - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1229 | - } | ||
| 1230 | - } | ||
| 1231 | - } | ||
| 1232 | - } | ||
| 1233 | - | ||
| 1234 | - }, | ||
| 1235 | - | ||
| 1236 | - /** | ||
| 1237 | - * 计算末班车。 | ||
| 1238 | - * 1、将上下行拉成上下行两个班次列表(包括标记班次) | ||
| 1239 | - * 2、分别找出离末班车发车时间最近的班次,并替换时间 | ||
| 1240 | - * 3、删除之后的班次 | ||
| 1241 | - */ | ||
| 1242 | - fnCalcuLastBc: function() { | ||
| 1243 | - var i; | ||
| 1244 | - var iTimeDiff; | ||
| 1245 | - var iTempTime; | ||
| 1246 | - var aBc; | ||
| 1247 | - var oLastBcTime; | ||
| 1248 | - var oLastBcIsUp; | ||
| 1249 | - var iModifyIndex; | ||
| 1250 | - | ||
| 1251 | - // 查找末班车早的末班车时间和方向 | ||
| 1252 | - if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) { | ||
| 1253 | - oLastBcTime = _paramObj.getUpLastDtimeObj(); | ||
| 1254 | - oLastBcIsUp = true; | ||
| 1255 | - } else { | ||
| 1256 | - oLastBcTime = _paramObj.getDownLastDTimeObj(); | ||
| 1257 | - oLastBcIsUp = false; | ||
| 1258 | - } | ||
| 1259 | - | ||
| 1260 | - // 确定早的末班车时间 | ||
| 1261 | - aBc = _fnGetBcList(oLastBcIsUp); | ||
| 1262 | - for (i = 0; i < aBc.length; i++) { | ||
| 1263 | - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m"); | ||
| 1264 | - if (iTimeDiff == undefined) { | ||
| 1265 | - iTimeDiff = iTempTime; | ||
| 1266 | - iModifyIndex = i; | ||
| 1267 | - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) { | ||
| 1268 | - iTimeDiff = iTempTime; | ||
| 1269 | - iModifyIndex = i; | ||
| 1270 | - } | ||
| 1271 | - } | ||
| 1272 | - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间 | ||
| 1273 | - aBc[iModifyIndex].fnSetDelFlag(false); | ||
| 1274 | - aBc[iModifyIndex].fnSetIsLastBc(true); | ||
| 1275 | - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次 | ||
| 1276 | - _qIsUp == oLastBcIsUp ? | ||
| 1277 | - aBc[i]._$$_internal_group_obj.setBc1(undefined) : | ||
| 1278 | - aBc[i]._$$_internal_group_obj.setBc2(undefined); | ||
| 1279 | - } | ||
| 1280 | - | ||
| 1281 | - // 查找末班车晚的末班车时间和方向 | ||
| 1282 | - if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) { | ||
| 1283 | - oLastBcTime = _paramObj.getDownLastDTimeObj(); | ||
| 1284 | - oLastBcIsUp = false; | ||
| 1285 | - } else { | ||
| 1286 | - oLastBcTime = _paramObj.getUpLastDtimeObj(); | ||
| 1287 | - oLastBcIsUp = true; | ||
| 1288 | - } | ||
| 1289 | - // 确定晚的末班车时间 | ||
| 1290 | - aBc = _fnGetBcList(oLastBcIsUp); | ||
| 1291 | - var oBc; | ||
| 1292 | - var aBcIndex; | ||
| 1293 | - var iLpIndex; | ||
| 1294 | - var iQIndex; | ||
| 1295 | - var iBcIndex; | ||
| 1296 | - | ||
| 1297 | - iTimeDiff = undefined; | ||
| 1298 | - for (i = 0; i < aBc.length; i++) { | ||
| 1299 | - oBc = aBc[i]; | ||
| 1300 | - aBcIndex = _fnGetBcIndex(oBc); | ||
| 1301 | - | ||
| 1302 | - iLpIndex = aBcIndex[0]; | ||
| 1303 | - iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1]; | ||
| 1304 | - iBcIndex = aBcIndex[2] == 0 ? 1 : 0; | ||
| 1305 | - | ||
| 1306 | - if (!_internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) { | ||
| 1307 | - continue; | ||
| 1308 | - } | ||
| 1309 | - | ||
| 1310 | - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m"); | ||
| 1311 | - if (iTimeDiff == undefined) { | ||
| 1312 | - iTimeDiff = iTempTime; | ||
| 1313 | - iModifyIndex = i; | ||
| 1314 | - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) { | ||
| 1315 | - iTimeDiff = iTempTime; | ||
| 1316 | - iModifyIndex = i; | ||
| 1317 | - } | ||
| 1318 | - } | ||
| 1319 | - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间 | ||
| 1320 | - aBc[iModifyIndex].fnSetDelFlag(false); | ||
| 1321 | - aBc[iModifyIndex].fnSetIsLastBc(true); | ||
| 1322 | - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次 | ||
| 1323 | - _qIsUp == oLastBcIsUp ? | ||
| 1324 | - aBc[i]._$$_internal_group_obj.setBc1(undefined) : | ||
| 1325 | - aBc[i]._$$_internal_group_obj.setBc2(undefined); | ||
| 1326 | - } | ||
| 1327 | - | ||
| 1328 | - }, | ||
| 1329 | - | ||
| 1330 | - /** | ||
| 1331 | - * 添加吃饭班次。 | ||
| 1332 | - */ | ||
| 1333 | - fnCalcuEatBc: function() { | ||
| 1334 | - // 吃午饭时间范围,10:15 到 12:15 | ||
| 1335 | - // 吃晚饭时间范围,18:00 到 19:00 | ||
| 1336 | - | ||
| 1337 | - if (!_paramObj.fnIsEat()) { | ||
| 1338 | - return; | ||
| 1339 | - } | ||
| 1340 | - | ||
| 1341 | - // 午饭index | ||
| 1342 | - var aLEIndex; | ||
| 1343 | - // 晚饭index | ||
| 1344 | - var aDEIndex; | ||
| 1345 | - | ||
| 1346 | - console.log("吃饭"); | ||
| 1347 | - // 所有吃饭都默认在一个方向,两个方向暂时不考虑 | ||
| 1348 | - if (_paramObj.fnIsUpEat()) { | ||
| 1349 | - aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false); | ||
| 1350 | - aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), true, false); | ||
| 1351 | - } else { | ||
| 1352 | - aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), false, true); | ||
| 1353 | - aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), false, true); | ||
| 1354 | - } | ||
| 1355 | - | ||
| 1356 | - // 午饭第几圈,第几个班次 | ||
| 1357 | - var iLEQIndex = aLEIndex[0]; | ||
| 1358 | - var iLEBIndex = aLEIndex[1]; | ||
| 1359 | - // 晚饭第几圈,第几个班次 | ||
| 1360 | - var iDEQIndex = aDEIndex[0]; | ||
| 1361 | - var iDEBIndex = aDEIndex[1]; | ||
| 1362 | - | ||
| 1363 | - // TODO:注意,本模型只有连班才有吃饭 | ||
| 1364 | - | ||
| 1365 | - var i; | ||
| 1366 | - var oLp; | ||
| 1367 | - var aLbIndex = []; // 连班班型的路牌索引 | ||
| 1368 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1369 | - oLp = _internalLpArray[i]; | ||
| 1370 | - if (oLp.isBxLb()) { | ||
| 1371 | - aLbIndex.push(i); | ||
| 1372 | - } | ||
| 1373 | - } | ||
| 1374 | - | ||
| 1375 | - var iLTime; | ||
| 1376 | - var iDtime; | ||
| 1377 | - var j; | ||
| 1378 | - for (i = 0; i < aLbIndex.length; i++) { | ||
| 1379 | - oLp = _internalLpArray[aLbIndex[i]]; | ||
| 1380 | - // 午饭 | ||
| 1381 | - iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj); | ||
| 1382 | - // 晚饭 | ||
| 1383 | - iDtime = oLp.fnAddEatBc(iDEQIndex, iDEBIndex, _factory, _paramObj); | ||
| 1384 | - | ||
| 1385 | - if (i == aLbIndex.length - 1) { | ||
| 1386 | - for (j = aLbIndex[i]; j < _internalLpArray.length; j++) { | ||
| 1387 | - oLp = _internalLpArray[j]; | ||
| 1388 | - if (oLp.isBxFb()) { // 5休2班型不调整 | ||
| 1389 | - // 修正午饭之后路牌班次的发车时间 | ||
| 1390 | - oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); | ||
| 1391 | - oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); | ||
| 1392 | - } | ||
| 1393 | - } | ||
| 1394 | - } else { | ||
| 1395 | - for (j = aLbIndex[i]; j < aLbIndex[i + 1]; j++) { | ||
| 1396 | - oLp = _internalLpArray[j]; | ||
| 1397 | - if (oLp.isBxFb()) { | ||
| 1398 | - // 修正午饭之后路牌班次的发车时间 | ||
| 1399 | - oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); | ||
| 1400 | - oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); | ||
| 1401 | - } | ||
| 1402 | - } | ||
| 1403 | - } | ||
| 1404 | - } | ||
| 1405 | - | ||
| 1406 | - }, | ||
| 1407 | - | ||
| 1408 | - /** | ||
| 1409 | - * 补每个路牌的其他班次(进出场,例保班次)。 | ||
| 1410 | - */ | ||
| 1411 | - fnCalcuOtherBc_: function() { | ||
| 1412 | - var i; | ||
| 1413 | - var _lpObj; | ||
| 1414 | - var _minBcIndex; | ||
| 1415 | - var _maxBcIndex; | ||
| 1416 | - var _minBc; | ||
| 1417 | - var _maxBc; | ||
| 1418 | - var _otherbc = []; | ||
| 1419 | - var _oFbbc; | ||
| 1420 | - | ||
| 1421 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1422 | - _lpObj = _internalLpArray[i]; | ||
| 1423 | - _minBcIndex = _lpObj.getMinBcObjPosition(); | ||
| 1424 | - _maxBcIndex = _lpObj.getMaxBcObjPosition(); | ||
| 1425 | - _minBc = _lpObj.getBc(_minBcIndex[0], _minBcIndex[1]); | ||
| 1426 | - _maxBc = _lpObj.getBc(_maxBcIndex[0], _maxBcIndex[1]); | ||
| 1427 | - | ||
| 1428 | - _otherbc = []; | ||
| 1429 | - _otherbc.push(_factory.createBcObj( | ||
| 1430 | - _lpObj, "bd", true, 1, | ||
| 1431 | - _minBc.getFcTimeObj(), | ||
| 1432 | - _paramObj | ||
| 1433 | - )); | ||
| 1434 | - _otherbc.push(_factory.createBcObj( | ||
| 1435 | - _lpObj, "out", true, 1, | ||
| 1436 | - _minBc.getFcTimeObj(), | ||
| 1437 | - _paramObj | ||
| 1438 | - )); | ||
| 1439 | - | ||
| 1440 | - _maxBc.setArrTimeObj(_paramObj.addMinute(_maxBc.getFcTimeObj(), _maxBc.getBcTime())); | ||
| 1441 | - _maxBc.setStopTime(0); | ||
| 1442 | - _otherbc.push(_factory.createBcObj( | ||
| 1443 | - _lpObj, "in", true, 1, | ||
| 1444 | - _maxBc.getArrTimeObj(), | ||
| 1445 | - _paramObj | ||
| 1446 | - )); | ||
| 1447 | - _otherbc.push(_factory.createBcObj( | ||
| 1448 | - _lpObj, "lc", true, 1, | ||
| 1449 | - _maxBc.getArrTimeObj(), | ||
| 1450 | - _paramObj | ||
| 1451 | - )); | ||
| 1452 | - | ||
| 1453 | - // 5休2分班出场例保班次 | ||
| 1454 | - if (_lpObj.isBxFb5_2()) { | ||
| 1455 | - _oFbbc = _lpObj.getBc( | ||
| 1456 | - _lpObj.fnGetBcChainInfo(1)["s_q"], | ||
| 1457 | - _lpObj.fnGetBcChainInfo(1)["s_b"] | ||
| 1458 | - ); | ||
| 1459 | - | ||
| 1460 | - _otherbc.push(_factory.createBcObj( | ||
| 1461 | - _lpObj, "bd", true, 1, | ||
| 1462 | - _oFbbc.getFcTimeObj(), | ||
| 1463 | - _paramObj | ||
| 1464 | - )); | ||
| 1465 | - _otherbc.push(_factory.createBcObj( | ||
| 1466 | - _lpObj, "out", true, 1, | ||
| 1467 | - _oFbbc.getFcTimeObj(), | ||
| 1468 | - _paramObj | ||
| 1469 | - )); | ||
| 1470 | - } | ||
| 1471 | - | ||
| 1472 | - _lpObj.addOtherBcArray(_otherbc); | ||
| 1473 | - } | ||
| 1474 | - | ||
| 1475 | - }, | ||
| 1476 | - | ||
| 1477 | - /** | ||
| 1478 | - * 补每个路牌的其他班次(进出场,例保班次) | ||
| 1479 | - * 所有的车次链前后都加进出场、报道班次 | ||
| 1480 | - */ | ||
| 1481 | - fnCalcuOtherBc: function() { | ||
| 1482 | - var i; | ||
| 1483 | - var j; | ||
| 1484 | - var iBcChainCount; | ||
| 1485 | - var oLp; | ||
| 1486 | - var aOtherBc; | ||
| 1487 | - var oStartBc; | ||
| 1488 | - var oEndBc; | ||
| 1489 | - | ||
| 1490 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1491 | - aOtherBc = []; | ||
| 1492 | - oLp = _internalLpArray[i]; | ||
| 1493 | - iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 1494 | - | ||
| 1495 | - if (iBcChainCount == 1) { // 只有一个车次链,是连班班型 | ||
| 1496 | - // 头部要添加出场,例保班次 | ||
| 1497 | - oStartBc = oLp.getBc( | ||
| 1498 | - oLp.fnGetBcChainInfo(0)["s_q"], | ||
| 1499 | - oLp.fnGetBcChainInfo(0)["s_b"] | ||
| 1500 | - ); | ||
| 1501 | - aOtherBc.push(_factory.createBcObj( | ||
| 1502 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 1503 | - oStartBc.getFcTimeObj(), | ||
| 1504 | - _paramObj | ||
| 1505 | - )); | ||
| 1506 | - aOtherBc.push(_factory.createBcObj( | ||
| 1507 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 1508 | - oStartBc.getFcTimeObj(), | ||
| 1509 | - _paramObj | ||
| 1510 | - )); | ||
| 1511 | - | ||
| 1512 | - // 尾部需添加进场,例保班次 | ||
| 1513 | - oEndBc = oLp.getBc( | ||
| 1514 | - oLp.fnGetBcChainInfo(0)["e_q"], | ||
| 1515 | - oLp.fnGetBcChainInfo(0)["e_b"] | ||
| 1516 | - ); | ||
| 1517 | - oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置 | ||
| 1518 | - oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置 | ||
| 1519 | - aOtherBc.push(_factory.createBcObj( | ||
| 1520 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 1521 | - oEndBc.getArrTimeObj(), | ||
| 1522 | - _paramObj | ||
| 1523 | - )); | ||
| 1524 | - aOtherBc.push(_factory.createBcObj( | ||
| 1525 | - oLp, "lc", !oEndBc.isUp(), 1, | ||
| 1526 | - oEndBc.getArrTimeObj(), | ||
| 1527 | - _paramObj | ||
| 1528 | - )); | ||
| 1529 | - } else if (iBcChainCount == 2) { // 两个车次链,是分班班型 | ||
| 1530 | - // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次 | ||
| 1531 | - oStartBc = oLp.getBc( | ||
| 1532 | - oLp.fnGetBcChainInfo(0)["s_q"], | ||
| 1533 | - oLp.fnGetBcChainInfo(0)["s_b"] | ||
| 1534 | - ); | ||
| 1535 | - aOtherBc.push(_factory.createBcObj( | ||
| 1536 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 1537 | - oStartBc.getFcTimeObj(), | ||
| 1538 | - _paramObj | ||
| 1539 | - )); | ||
| 1540 | - aOtherBc.push(_factory.createBcObj( | ||
| 1541 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 1542 | - oStartBc.getFcTimeObj(), | ||
| 1543 | - _paramObj | ||
| 1544 | - )); | ||
| 1545 | - | ||
| 1546 | - oEndBc = oLp.getBc( | ||
| 1547 | - oLp.fnGetBcChainInfo(0)["e_q"], | ||
| 1548 | - oLp.fnGetBcChainInfo(0)["e_b"] | ||
| 1549 | - ); | ||
| 1550 | - aOtherBc.push(_factory.createBcObj( | ||
| 1551 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 1552 | - oEndBc.getArrTimeObj(), | ||
| 1553 | - _paramObj | ||
| 1554 | - )); | ||
| 1555 | - | ||
| 1556 | - // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次 | ||
| 1557 | - oStartBc = oLp.getBc( | ||
| 1558 | - oLp.fnGetBcChainInfo(1)["s_q"], | ||
| 1559 | - oLp.fnGetBcChainInfo(1)["s_b"] | ||
| 1560 | - ); | ||
| 1561 | - aOtherBc.push(_factory.createBcObj( | ||
| 1562 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 1563 | - oStartBc.getFcTimeObj(), | ||
| 1564 | - _paramObj | ||
| 1565 | - )); | ||
| 1566 | - aOtherBc.push(_factory.createBcObj( | ||
| 1567 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 1568 | - oStartBc.getFcTimeObj(), | ||
| 1569 | - _paramObj | ||
| 1570 | - )); | ||
| 1571 | - | ||
| 1572 | - oEndBc = oLp.getBc( | ||
| 1573 | - oLp.fnGetBcChainInfo(1)["e_q"], | ||
| 1574 | - oLp.fnGetBcChainInfo(1)["e_b"] | ||
| 1575 | - ); | ||
| 1576 | - aOtherBc.push(_factory.createBcObj( | ||
| 1577 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 1578 | - oEndBc.getArrTimeObj(), | ||
| 1579 | - _paramObj | ||
| 1580 | - )); | ||
| 1581 | - aOtherBc.push(_factory.createBcObj( | ||
| 1582 | - oLp, "lc", !oEndBc.isUp(), 1, | ||
| 1583 | - oEndBc.getArrTimeObj(), | ||
| 1584 | - _paramObj | ||
| 1585 | - )); | ||
| 1586 | - | ||
| 1587 | - | ||
| 1588 | - } else { | ||
| 1589 | - // 2个车次链以上,暂时没有此班型 | ||
| 1590 | - } | ||
| 1591 | - | ||
| 1592 | - oLp.addOtherBcArray(aOtherBc); | ||
| 1593 | - } | ||
| 1594 | - }, | ||
| 1595 | - | ||
| 1596 | - /** | ||
| 1597 | - * 祛除上标线开头的删除标记的班次。 | ||
| 1598 | - */ | ||
| 1599 | - fnRemoveDelFirstFlagBc: function() { | ||
| 1600 | - var oLp = _internalLpArray[0]; | ||
| 1601 | - var aMinBcIndex = oLp.getMinBcObjPosition(); | ||
| 1602 | - if (oLp.getBc(aMinBcIndex[0], aMinBcIndex[1]).fnIsDelFlag()) { | ||
| 1603 | - oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]); | ||
| 1604 | - } | ||
| 1605 | - }, | ||
| 1606 | - /** | ||
| 1607 | - * 祛除上标线结尾的删除标记的班次。 | ||
| 1608 | - */ | ||
| 1609 | - fnRemoveDelLastFlagBc: function() { | ||
| 1610 | - var oLp = _internalLpArray[0]; | ||
| 1611 | - var aMaxBcIndex = oLp.getMaxBcObjPosition(); | ||
| 1612 | - if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) { | ||
| 1613 | - oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]); | ||
| 1614 | - } | ||
| 1615 | - }, | ||
| 1616 | - | ||
| 1617 | - /** | ||
| 1618 | - * 调整路牌班次间隔(核准周转时间,停站时间)。 | ||
| 1619 | - * @param iFre int 迭代次数 | ||
| 1620 | - */ | ||
| 1621 | - fnAdjustLpBcInterval: function(iFre) { | ||
| 1622 | - // if (iFre > 0) { | ||
| 1623 | - // for (var i = 0; i < _internalLpArray.length; i++) { | ||
| 1624 | - // _internalLpArray[i].fnAdjustBcInterval( | ||
| 1625 | - // this.fnCalcuAverPeakStopTime(), | ||
| 1626 | - // this.fnCalcuAverTroughStopTime(), | ||
| 1627 | - // _paramObj); | ||
| 1628 | - // } | ||
| 1629 | - // | ||
| 1630 | - // this.fnAdjustLpBcInterval(iFre - 1); | ||
| 1631 | - // } | ||
| 1632 | - | ||
| 1633 | - for (var i = 0; i < _internalLpArray.length; i++) { | ||
| 1634 | - _internalLpArray[i].fnAdjustBcTime_layover(_paramObj); | ||
| 1635 | - } | ||
| 1636 | - }, | ||
| 1637 | - | ||
| 1638 | - /** | ||
| 1639 | - * 调整班次间隔。 | ||
| 1640 | - * @param bIsUp 是否上行 | ||
| 1641 | - * @param oStartTime 开始时间对象 | ||
| 1642 | - * @param iFre 迭代次数 | ||
| 1643 | - */ | ||
| 1644 | - fnAdjustBcInterval2_: function(bIsUp, oStartTime, iFre) { | ||
| 1645 | - if (iFre > 0) { | ||
| 1646 | - var aBc = _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表 | ||
| 1647 | - aBc.sort(function(o1, o2) { | ||
| 1648 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1649 | - return -1; | ||
| 1650 | - } else { | ||
| 1651 | - return 1; | ||
| 1652 | - } | ||
| 1653 | - }); | ||
| 1654 | - var i; | ||
| 1655 | - var j; | ||
| 1656 | - | ||
| 1657 | - var iBcCountOfGroup = 3; // 3个班次取一次计算 | ||
| 1658 | - var aBcOfGroup; // 3个班次列表 | ||
| 1659 | - var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 1660 | - | ||
| 1661 | - for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 1662 | - aBcOfGroup = []; | ||
| 1663 | - aBcIntervalOfGroup = []; | ||
| 1664 | - for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 1665 | - aBcOfGroup.push(aBc[j]); | ||
| 1666 | - } | ||
| 1667 | - | ||
| 1668 | - for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 1669 | - if (j < aBcOfGroup.length - 1) { | ||
| 1670 | - aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 1671 | - aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 1672 | - } | ||
| 1673 | - } | ||
| 1674 | - | ||
| 1675 | - if (aBcIntervalOfGroup[0] < 19) { | ||
| 1676 | - aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 1677 | - } else if (aBcIntervalOfGroup[0] > 20) { | ||
| 1678 | - aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 1679 | - } else { | ||
| 1680 | - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 1681 | - //continue; | ||
| 1682 | - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 1683 | - aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 1684 | - } else { | ||
| 1685 | - aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 1686 | - } | ||
| 1687 | - } | ||
| 1688 | - | ||
| 1689 | - } | ||
| 1690 | - | ||
| 1691 | - this.fnAdjustBcInterval2(bIsUp, oStartTime, iFre - 1); | ||
| 1692 | - } | ||
| 1693 | - }, | ||
| 1694 | - | ||
| 1695 | - /** | ||
| 1696 | - * 调整班次间隔(使用策略类)。 | ||
| 1697 | - * @param oStartTime 开始时间对象 | ||
| 1698 | - */ | ||
| 1699 | - fnAdjustBcInterval: function(oStartTime) { | ||
| 1700 | - // 获取上行班次列表 | ||
| 1701 | - var aUpBc = !oStartTime ? _fnGetBcList(true) : _fnGetBcList2(true, oStartTime); // 指定方向的班次列表 | ||
| 1702 | - var aDownBc = !oStartTime ? _fnGetBcList(false) : _fnGetBcList2(false, oStartTime); // 指定方向的班次列表 | ||
| 1703 | - // 使用策略类调用指定策略函数,注意 AdjustTripStrategy.js 导入 | ||
| 1704 | - // console.log(StrategyUtils); | ||
| 1705 | - eval("var _oFn = " + _paramObj.fnGetAdjustStrategyId() + ";"); | ||
| 1706 | - StrategyUtils.sConfig("ADJUST_TRIP", _oFn); | ||
| 1707 | - StrategyUtils.sFn("ADJUST_TRIP")(aUpBc, aDownBc, this, _paramObj); | ||
| 1708 | - | ||
| 1709 | - }, | ||
| 1710 | - | ||
| 1711 | - /** | ||
| 1712 | - * 调整班次间隔(平均间隔)。 | ||
| 1713 | - * @param bIsUp 是否上行 | ||
| 1714 | - * @param oStartTime 开始时间对象 | ||
| 1715 | - */ | ||
| 1716 | - fnAdjustBcInterval2_avg: function(bIsUp, oStartTime) { | ||
| 1717 | - var aBc = !oStartTime ? _fnGetBcList(bIsUp) : _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表 | ||
| 1718 | - aBc.sort(function(o1, o2) { | ||
| 1719 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1720 | - return -1; | ||
| 1721 | - } else { | ||
| 1722 | - return 1; | ||
| 1723 | - } | ||
| 1724 | - }); | ||
| 1725 | - | ||
| 1726 | - if (aBc.length == 0) { | ||
| 1727 | - return; | ||
| 1728 | - } | ||
| 1729 | - | ||
| 1730 | - var j; | ||
| 1731 | - var iCount = aBc.length - 1; | ||
| 1732 | - var iC1 = Math.floor(aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") / iCount); | ||
| 1733 | - var iC2 = aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") % iCount; | ||
| 1734 | - var iTempTime; | ||
| 1735 | - | ||
| 1736 | - for (j = 0; j < iCount - iC2; j++) { | ||
| 1737 | - iTempTime = aBc[j + 1].getFcTimeObj().diff(aBc[j].getFcTimeObj(), "m"); | ||
| 1738 | - aBc[j + 1].addMinuteToFcsj(iC1 - iTempTime); | ||
| 1739 | - } | ||
| 1740 | - for (j = 0; j < iC2; j++) { | ||
| 1741 | - iTempTime = aBc[iCount - iC2 + j + 1].getFcTimeObj().diff(aBc[iCount - iC2 + j].getFcTimeObj(), "m"); | ||
| 1742 | - aBc[iCount - iC2 + j + 1].addMinuteToFcsj(iC1 + 1 - iTempTime); | ||
| 1743 | - } | ||
| 1744 | - | ||
| 1745 | - }, | ||
| 1746 | - | ||
| 1747 | - /** | ||
| 1748 | - * 计算高峰平均停站时间。 | ||
| 1749 | - */ | ||
| 1750 | - fnCalcuAverPeakStopTime: function() { | ||
| 1751 | - var i; | ||
| 1752 | - var j; | ||
| 1753 | - var aBc; | ||
| 1754 | - var iBcCount = 0; | ||
| 1755 | - var iSum = 0; | ||
| 1756 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1757 | - aBc = _internalLpArray[i].getBcArray(); | ||
| 1758 | - | ||
| 1759 | - for (j = 0; j < aBc.length; j++) { | ||
| 1760 | - if (!_paramObj.isTroughBc(aBc[j].getArrTimeObj())) { | ||
| 1761 | - iBcCount ++; | ||
| 1762 | - iSum += aBc[j].getStopTime(); | ||
| 1763 | - } | ||
| 1764 | - } | ||
| 1765 | - } | ||
| 1766 | - | ||
| 1767 | - return Math.floor(iSum / iBcCount); | ||
| 1768 | - }, | ||
| 1769 | - | ||
| 1770 | - /** | ||
| 1771 | - * 计算低谷平均停站时间。 | ||
| 1772 | - */ | ||
| 1773 | - fnCalcuAverTroughStopTime: function() { | ||
| 1774 | - var i; | ||
| 1775 | - var j; | ||
| 1776 | - var aBc; | ||
| 1777 | - var iBcCount = 0; | ||
| 1778 | - var iSum = 0; | ||
| 1779 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1780 | - aBc = _internalLpArray[i].getBcArray(); | ||
| 1781 | - for (j = 0; j < aBc.length; j++) { | ||
| 1782 | - if (_paramObj.isTroughBc(aBc[j].getArrTimeObj())) { | ||
| 1783 | - iBcCount ++; | ||
| 1784 | - iSum += aBc[j].getStopTime(); | ||
| 1785 | - } | ||
| 1786 | - } | ||
| 1787 | - } | ||
| 1788 | - | ||
| 1789 | - return Math.floor(iSum / iBcCount); | ||
| 1790 | - }, | ||
| 1791 | - | ||
| 1792 | - //------------- 其他方法 -------------// | ||
| 1793 | - /** | ||
| 1794 | - * 返回内部路牌数据列表。 | ||
| 1795 | - * @returns {Array} | ||
| 1796 | - */ | ||
| 1797 | - fnGetLpArray: function() { | ||
| 1798 | - return _internalLpArray; | ||
| 1799 | - }, | ||
| 1800 | - | ||
| 1801 | - /** | ||
| 1802 | - * 内部数据转化成显示用的班次数组。 | ||
| 1803 | - */ | ||
| 1804 | - fnToGanttBcArray: function() { | ||
| 1805 | - var aAllBc = []; | ||
| 1806 | - var aLpBc = []; | ||
| 1807 | - var aEatBc = []; | ||
| 1808 | - var oLp; | ||
| 1809 | - var i; | ||
| 1810 | - var j; | ||
| 1811 | - | ||
| 1812 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1813 | - oLp = _internalLpArray[i]; | ||
| 1814 | - aLpBc = []; | ||
| 1815 | - aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray()); | ||
| 1816 | - | ||
| 1817 | - aEatBc = []; | ||
| 1818 | - // 根据班次的吃饭时间添加吃饭班次 | ||
| 1819 | - for (j = 0; j < aLpBc.length; j++) { | ||
| 1820 | - if (aLpBc[j].fnGetEatTime() > 0) { | ||
| 1821 | - aEatBc.push(_factory.createBcObj( | ||
| 1822 | - oLp, | ||
| 1823 | - "cf", | ||
| 1824 | - !aLpBc[j].isUp(), // 和上一个班次方向相反 | ||
| 1825 | - 1, | ||
| 1826 | - _paramObj.addMinute(aLpBc[j].getArrTimeObj(), aLpBc[j].getStopTime()), // 使用上一个班次的到达时间作为开始时间 | ||
| 1827 | - _paramObj | ||
| 1828 | - )); | ||
| 1829 | - } | ||
| 1830 | - } | ||
| 1831 | - aLpBc = aLpBc.concat(aEatBc); | ||
| 1832 | - | ||
| 1833 | - // 按照发车时间排序 | ||
| 1834 | - aLpBc.sort(function(o1, o2) { | ||
| 1835 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1836 | - return -1; | ||
| 1837 | - } else { | ||
| 1838 | - return 1; | ||
| 1839 | - } | ||
| 1840 | - }); | ||
| 1841 | - | ||
| 1842 | - // 重新赋值fcno | ||
| 1843 | - for (j = 0; j < aLpBc.length; j++) { | ||
| 1844 | - aLpBc[j].fnSetFcno(j + 1); | ||
| 1845 | - } | ||
| 1846 | - | ||
| 1847 | - aAllBc = aAllBc.concat(aLpBc); | ||
| 1848 | - } | ||
| 1849 | - | ||
| 1850 | - var aGanttBc = []; | ||
| 1851 | - for (i = 0; i < aAllBc.length; i++) { | ||
| 1852 | - aGanttBc.push(aAllBc[i].toGanttBcObj()); | ||
| 1853 | - } | ||
| 1854 | - | ||
| 1855 | - return aGanttBc; | ||
| 1856 | - } | ||
| 1857 | - | ||
| 1858 | - }; | ||
| 1859 | - | 1 | +/** |
| 2 | + * 内部行车计划对象。 | ||
| 3 | + * @constructor | ||
| 4 | + */ | ||
| 5 | +var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 6 | + // 参数对象 | ||
| 7 | + var _paramObj = paramObj; | ||
| 8 | + // 外部的路牌数组 | ||
| 9 | + var _lpArray = lpArray; | ||
| 10 | + // 工厂对象 | ||
| 11 | + var _factory = factory; | ||
| 12 | + | ||
| 13 | + //------------------ 初始化方法1,以及计算关联的内部变量 -----------------// | ||
| 14 | + var _qIsUp; // 每一圈是上行开始还是下行开始 | ||
| 15 | + var _qCount = 0; // 总的圈数 | ||
| 16 | + var _internalLpArray = []; // 内部对象数组 | ||
| 17 | + var _aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时) | ||
| 18 | + {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 19 | + {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 20 | + {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 21 | + {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 22 | + {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 23 | + {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 24 | + {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0}, | ||
| 25 | + {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0} | ||
| 26 | + ]; | ||
| 27 | + | ||
| 28 | + var _fnInitFun1 = function() { // 初始化方法1 | ||
| 29 | + console.log("//---------------- 行车计划,初始化方法1 start ----------------//"); | ||
| 30 | + | ||
| 31 | + //----------------------- 1、确定上标线的方向,圈的方向 -------------------// | ||
| 32 | + | ||
| 33 | + // 确定_qIsUp,哪个方向的首班车晚就用哪个 | ||
| 34 | + _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore( | ||
| 35 | + _paramObj.getDownFirstDTimeObj()) ? false : true; | ||
| 36 | + // 上标线开始时间,就是方向的首班车时间 | ||
| 37 | + var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 38 | + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | ||
| 39 | + var et; | ||
| 40 | + var et_IsUp; | ||
| 41 | + if (_paramObj.getUpLastDtimeObj().isBefore( | ||
| 42 | + _paramObj.getDownLastDTimeObj())) { | ||
| 43 | + et = _paramObj.getDownLastDTimeObj(); | ||
| 44 | + et_IsUp = false; | ||
| 45 | + } else { | ||
| 46 | + et = _paramObj.getUpLastDtimeObj(); | ||
| 47 | + et_IsUp = true; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + //------------------------ 2、计算总共有多少圈 ------------------------// | ||
| 51 | + | ||
| 52 | + // 以开始时间,结束时间,构造上标线用连班班次发车时间 | ||
| 53 | + var bcFcsjArrays = []; // 班次发车时间对象数组 | ||
| 54 | + var bcArsjArrays = []; // 班次到达时间对象数组 | ||
| 55 | + var isUp = _qIsUp; // 方向 | ||
| 56 | + var bcCount = 1; // 班次数 | ||
| 57 | + | ||
| 58 | + var _kssj = st; // 开始时间 | ||
| 59 | + var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时 | ||
| 60 | + var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间 | ||
| 61 | + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); // 停站时间 | ||
| 62 | + | ||
| 63 | + do { | ||
| 64 | + bcFcsjArrays.push(_kssj); | ||
| 65 | + bcArsjArrays.push(_arrsj); | ||
| 66 | + | ||
| 67 | + _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime); | ||
| 68 | + _bcsj = paramObj.calcuTravelTime(_kssj, isUp); | ||
| 69 | + _arrsj = paramObj.addMinute(_kssj, _bcsj); | ||
| 70 | + _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); | ||
| 71 | + | ||
| 72 | + bcCount ++; | ||
| 73 | + isUp = !isUp; | ||
| 74 | + } while(_kssj.isBefore(et)); | ||
| 75 | + bcCount--; // 因为先做do,所以总的班次要减1 | ||
| 76 | + //if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) { | ||
| 77 | + // // 如果最后一个班次的到达时间超过结束时间,也要去除 | ||
| 78 | + // bcFcsjArrays.splice(bcCount - 1, 1); | ||
| 79 | + // bcArsjArrays.splice(bcCount - 1, 1); | ||
| 80 | + // bcCount--; | ||
| 81 | + //} | ||
| 82 | + var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈 | ||
| 83 | + var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈 | ||
| 84 | + | ||
| 85 | + // 利用连班数组计算圈数 | ||
| 86 | + _qCount = 1; // 前面加1圈,补中标线的班次 | ||
| 87 | + _qCount += _qCount_p1; | ||
| 88 | + _qCount += _qCount_p2; | ||
| 89 | + | ||
| 90 | + // 计算最后是不是还要补一圈 | ||
| 91 | + if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题) | ||
| 92 | + if (_qCount_p2 == 0) { // 没有余下班次,整数圈数 | ||
| 93 | + // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行 | ||
| 94 | + // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致 | ||
| 95 | + if (!_qIsUp == et_IsUp) { | ||
| 96 | + // 一致不用加圈数 | ||
| 97 | + } else { | ||
| 98 | + // 不一致需要加圈补最后一个结束时间班次 | ||
| 99 | + _qCount ++; | ||
| 100 | + } | ||
| 101 | + } else { | ||
| 102 | + // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里 | ||
| 103 | + // 不需要在补圈数了 | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------// | ||
| 108 | + | ||
| 109 | + // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中 | ||
| 110 | + var i; | ||
| 111 | + for (i = 0; i < _lpArray.length; i++) { | ||
| 112 | + _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp)); | ||
| 113 | + } | ||
| 114 | + // 初始化上标线,从第1圈开始 | ||
| 115 | + _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory); | ||
| 116 | + | ||
| 117 | + // 以上标线为基础,计算各种班型工时对应的圈数、班次数 | ||
| 118 | + var aBcArray = _internalLpArray[0].getBcArray(); | ||
| 119 | + aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识 | ||
| 120 | + | ||
| 121 | + if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算 | ||
| 122 | + aBcArray.splice(aBcArray.length - 1, 1); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + // 午饭吃饭时间 | ||
| 126 | + var iLTime = _paramObj.fnGetLunchTime(); | ||
| 127 | + // 晚饭吃饭时间 | ||
| 128 | + var iDTime = _paramObj.fnGetDinnerTime(); | ||
| 129 | + // 出场时间 | ||
| 130 | + var iOutTime = _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime(); | ||
| 131 | + // 进场时间 | ||
| 132 | + var iInTime = _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime(); | ||
| 133 | + // 例保时间 | ||
| 134 | + var iBTime = _paramObj.getLbTime(); | ||
| 135 | + | ||
| 136 | + var sum = 0; // 总班次时间 | ||
| 137 | + for (i = 0; i < aBcArray.length; i++) { | ||
| 138 | + sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime(); | ||
| 139 | + } | ||
| 140 | + sum += iLTime; // 加午饭时间 | ||
| 141 | + sum += iDTime; // 加晚饭时间 | ||
| 142 | + for (i = 0; i < _aBxDesc.length; i++) { | ||
| 143 | + _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间 | ||
| 144 | + | ||
| 145 | + // 计算5休2的班次数(双进出场,4个例保) | ||
| 146 | + if (i == 6) { | ||
| 147 | + _aBxDesc[i].fQCount = | ||
| 148 | + (_aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) / | ||
| 149 | + _aBxDesc[i].fAverTime; | ||
| 150 | + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2; | ||
| 151 | + } else { // 进出场,2个例保 | ||
| 152 | + _aBxDesc[i].fQCount = | ||
| 153 | + (_aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) / | ||
| 154 | + _aBxDesc[i].fAverTime; | ||
| 155 | + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2; | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + // 在第一个班次之前再添加一个模拟班次,用于中标线的作用 | ||
| 161 | + // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除 | ||
| 162 | + var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime(); | ||
| 163 | + var iFirstStopTime = | ||
| 164 | + _paramObj.fnCalcuFixedStopNumber( | ||
| 165 | + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), | ||
| 166 | + !_qIsUp, | ||
| 167 | + iXXTime | ||
| 168 | + ); | ||
| 169 | + var oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 170 | + _internalLpArray[0], | ||
| 171 | + "normal", | ||
| 172 | + !_qIsUp, | ||
| 173 | + 1, | ||
| 174 | + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), | ||
| 175 | + _paramObj | ||
| 176 | + ); | ||
| 177 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 178 | + | ||
| 179 | + _internalLpArray[0].setBc(0, 1, oFlagBc); | ||
| 180 | + | ||
| 181 | + // 在最后一圈也补上一个或者2个模拟班次,暂时标记,最后需要删除 | ||
| 182 | + var aMaxBcIndex = _internalLpArray[0].getMaxBcObjPosition(); | ||
| 183 | + if (aMaxBcIndex[0] == _qCount - 1) { // 可能加半圈 | ||
| 184 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 185 | + _internalLpArray[0], | ||
| 186 | + "normal", | ||
| 187 | + !_qIsUp, | ||
| 188 | + 1, | ||
| 189 | + _paramObj.addMinute( | ||
| 190 | + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 191 | + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 192 | + _paramObj | ||
| 193 | + ); | ||
| 194 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 195 | + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 196 | + | ||
| 197 | + } else { // 加完整的一圈 | ||
| 198 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 199 | + _internalLpArray[0], | ||
| 200 | + "normal", | ||
| 201 | + _qIsUp, | ||
| 202 | + 1, | ||
| 203 | + _paramObj.addMinute( | ||
| 204 | + _internalLpArray[0].getBc(_qCount - 2, 1).getArrTimeObj(), | ||
| 205 | + _internalLpArray[0].getBc(_qCount - 2, 1).getStopTime()), | ||
| 206 | + _paramObj | ||
| 207 | + ); | ||
| 208 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 209 | + _internalLpArray[0].setBc(_qCount - 1, 0, oFlagBc); | ||
| 210 | + | ||
| 211 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 212 | + _internalLpArray[0], | ||
| 213 | + "normal", | ||
| 214 | + !_qIsUp, | ||
| 215 | + 1, | ||
| 216 | + _paramObj.addMinute( | ||
| 217 | + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 218 | + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 219 | + _paramObj | ||
| 220 | + ); | ||
| 221 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 222 | + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 223 | + | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") + | ||
| 227 | + "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm")); | ||
| 228 | + console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") + | ||
| 229 | + "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm")); | ||
| 230 | + console.log("总共计算的圈数:" + _qCount); | ||
| 231 | + console.log("圈的方向isUP:" + _qIsUp); | ||
| 232 | + console.log("班型描述(以下):"); | ||
| 233 | + console.log(_aBxDesc); | ||
| 234 | + console.log("所有路牌间隔描述(以下):"); | ||
| 235 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 236 | + console.log(_internalLpArray[i]._$_aVerticalIntervalTime); | ||
| 237 | + } | ||
| 238 | + console.log("//---------------- 行车计划,初始化方法1 end ----------------//"); | ||
| 239 | + | ||
| 240 | + }; | ||
| 241 | + | ||
| 242 | + //------------------ 初始化方法2,以及计算关联的内部变量 ----------------// | ||
| 243 | + var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出 | ||
| 244 | + var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行) | ||
| 245 | + var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出 | ||
| 246 | + var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行) | ||
| 247 | + | ||
| 248 | + var _fnInitFun2 = function() { // 初始化方法2 | ||
| 249 | + console.log("//---------------- 行车计划,初始化方法2 start ----------------//"); | ||
| 250 | + | ||
| 251 | + //------------------------ 1、计算车辆总数 ------------------------// | ||
| 252 | + // 是用高峰上行周转时间除以高峰平均间隔得到的 | ||
| 253 | + // 这样算还算合理,车辆不多不少,待以后有新的算法再修正 | ||
| 254 | + var iClCount = _paramObj.calcuClzx(); | ||
| 255 | + | ||
| 256 | + //------------------------ 2、计算所有路牌的发车在各个圈中的间隔 --------------------// | ||
| 257 | + var i; | ||
| 258 | + var j; | ||
| 259 | + var iBindex = 1; | ||
| 260 | + var iZzsj; | ||
| 261 | + var oLp; | ||
| 262 | + var iC1; | ||
| 263 | + var iC2; | ||
| 264 | + | ||
| 265 | + for (i = 0; i < _qCount - 1; i++) { | ||
| 266 | + while (iBindex <= 1) { | ||
| 267 | + // 每圈每个方向的周转时间不一致,以上标线为主 | ||
| 268 | + oLp = _internalLpArray[0]; | ||
| 269 | + iZzsj = oLp.getBc(i + 1, iBindex).getFcTimeObj().diff( | ||
| 270 | + oLp.getBc(i, iBindex).getFcTimeObj(), "m" | ||
| 271 | + ); | ||
| 272 | + | ||
| 273 | + iC1 = Math.floor(iZzsj / iClCount); | ||
| 274 | + iC2 = iZzsj % iClCount; | ||
| 275 | + | ||
| 276 | + for (j = 0; j < iClCount - iC2; j++) { | ||
| 277 | + oLp = _internalLpArray[j]; | ||
| 278 | + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1); | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + for (j = 0; j < iC2; j++) { | ||
| 282 | + oLp = _internalLpArray[iClCount - iC2 + j]; | ||
| 283 | + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1 + 1); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + iBindex ++; | ||
| 287 | + | ||
| 288 | + } | ||
| 289 | + iBindex = 0; | ||
| 290 | + } | ||
| 291 | + // 最后一圈没有下一圈的参照,周转时间没发获取,由于都是低谷,所以使用倒数第二圈的间隔最为最后一圈的间隔 | ||
| 292 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 293 | + oLp = _internalLpArray[i]; | ||
| 294 | + oLp.fnSetVerticalIntervalTime(_qCount - 1, 0, oLp.fnGetVerticalIntervalTime(_qCount - 2, 0)); | ||
| 295 | + oLp.fnSetVerticalIntervalTime(_qCount - 1, 1, oLp.fnGetVerticalIntervalTime(_qCount - 2, 1)); | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + //------------------------ 3、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | ||
| 299 | + | ||
| 300 | + // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次 | ||
| 301 | + // 以这个班次为早高峰起点,全部出车策略 | ||
| 302 | + var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime( | ||
| 303 | + _paramObj.getMPeakStartTimeObj(), true, true); | ||
| 304 | + var qIndex = qbcIndexArray[0]; // 第几圈 | ||
| 305 | + var bIndex = qbcIndexArray[1]; // 第几个班次 | ||
| 306 | + | ||
| 307 | + for (i = 1; i < _internalLpArray.length; i++) { | ||
| 308 | + _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + _approximate_zgfQIndex = qIndex; | ||
| 312 | + _approximate_zgfBIndex = bIndex; | ||
| 313 | + | ||
| 314 | + //------------------------ 4、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | ||
| 315 | + | ||
| 316 | + // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次 | ||
| 317 | + // 以这个班次为早高峰起点,全部出车策略 | ||
| 318 | + qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime( | ||
| 319 | + _paramObj.getEPeakStartTimeObj(), true, true); | ||
| 320 | + qIndex = qbcIndexArray[0]; // 第几圈 | ||
| 321 | + bIndex = qbcIndexArray[1]; // 第几个班次 | ||
| 322 | + | ||
| 323 | + for (i = 1; i < _internalLpArray.length; i++) { | ||
| 324 | + _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + _approximate_wgfQIndex = qIndex; | ||
| 328 | + _approximate_wgfBIndex = bIndex; | ||
| 329 | + | ||
| 330 | + console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟"); | ||
| 331 | + console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟"); | ||
| 332 | + console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出"); | ||
| 333 | + console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出"); | ||
| 334 | + console.log("//---------------- 行车计划,初始化方法2 end ----------------//"); | ||
| 335 | + }; | ||
| 336 | + | ||
| 337 | + //----------------------- 初始化方法3,计算连班分班的路牌分布 ----------------// | ||
| 338 | + var _iBx_lb_lpcount; // 连班路牌数 | ||
| 339 | + var _iBx_5_2_fb_lpcount; // 5休2分班路牌数 | ||
| 340 | + var _iBx_other_fb_lpcount; // 其他分班路牌数 | ||
| 341 | + | ||
| 342 | + var _fnInitFun3 = function() { // 初始化方法3 | ||
| 343 | + console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | ||
| 344 | + | ||
| 345 | + //--------------------- 1、计算分班连班班型车辆分布数 --------------------// | ||
| 346 | + // 总共车辆数(高峰最大车辆数) | ||
| 347 | + var iCls = _paramObj.calcuClzx(); | ||
| 348 | + // 低谷最少配车(连班车数量) | ||
| 349 | + var iDgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx()); | ||
| 350 | + // 加班车路牌数(做5休2的路牌数) | ||
| 351 | + var i_5_2_lpes = _paramObj.getJBLpes(); | ||
| 352 | + | ||
| 353 | + // 做些简单的验证 | ||
| 354 | + if (iCls < iDgminpc) { | ||
| 355 | + alert("总配车数小于低谷最小配车"); | ||
| 356 | + throw "总配车数小于低谷最小配车"; | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + if (iDgminpc < 2) { | ||
| 360 | + // alert("连班路牌小于2,办不到啊"); | ||
| 361 | + // throw "连班路牌小于2,办不到啊"; | ||
| 362 | + console.log("连班路牌小于2,则5休2之外的车辆数则为连班车辆数"); | ||
| 363 | + iDgminpc = iCls - i_5_2_lpes; | ||
| 364 | + } | ||
| 365 | + if (iCls - iDgminpc < i_5_2_lpes) { | ||
| 366 | + // alert("总分班路牌数小于加班路牌数"); | ||
| 367 | + // throw "总分班路牌数小于加班路牌数"; | ||
| 368 | + console.log("总分班路牌数小于加班路牌数,则忽略其他分班路牌数"); | ||
| 369 | + iDgminpc = iCls - i_5_2_lpes; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20 | ||
| 373 | + //while(_paramObj.calcuPeakZzsj() / iDgminpc > 20) { | ||
| 374 | + // iDgminpc ++; | ||
| 375 | + //} | ||
| 376 | + _iBx_lb_lpcount = iDgminpc; | ||
| 377 | + | ||
| 378 | + _iBx_5_2_fb_lpcount = i_5_2_lpes; | ||
| 379 | + _iBx_other_fb_lpcount = iCls - _iBx_lb_lpcount - i_5_2_lpes; | ||
| 380 | + | ||
| 381 | + //------------------------ 2、利用间隔法计算连班路牌分布 --------------------// | ||
| 382 | + var i; | ||
| 383 | + var j; | ||
| 384 | + var iC1 = Math.floor(_internalLpArray.length / _iBx_lb_lpcount); | ||
| 385 | + var iC2 = _internalLpArray.length % _iBx_lb_lpcount; | ||
| 386 | + var iLpIndex; | ||
| 387 | + | ||
| 388 | + for (i = 0; i < _iBx_lb_lpcount - iC2; i++) { | ||
| 389 | + iLpIndex = i * iC1; | ||
| 390 | + _internalLpArray[iLpIndex].setBxLb(true); | ||
| 391 | + _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 392 | + } | ||
| 393 | + for (j = 0; j < iC2; j++) { | ||
| 394 | + iLpIndex = i * iC1 + j * (iC1 + 1); | ||
| 395 | + _internalLpArray[iLpIndex].setBxLb(true); | ||
| 396 | + _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + //------------------------ 3、利用间隔法计算分班班型路牌分布 --------------------// | ||
| 400 | + // 获取分班路牌索引 | ||
| 401 | + var aNotLbIndexes = []; | ||
| 402 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 403 | + if (!_internalLpArray[i].isBxLb()) { | ||
| 404 | + aNotLbIndexes.push(i); | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + // 先5休2分班 | ||
| 408 | + iC1 = Math.floor(aNotLbIndexes.length / _iBx_5_2_fb_lpcount); | ||
| 409 | + iC2 = aNotLbIndexes.length % _iBx_5_2_fb_lpcount; | ||
| 410 | + | ||
| 411 | + for (i = 0; i < _iBx_5_2_fb_lpcount - iC2; i++) { | ||
| 412 | + iLpIndex = aNotLbIndexes[i * iC1]; | ||
| 413 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 414 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 415 | + _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 416 | + _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 417 | + } | ||
| 418 | + for (i = 0; i < iC2; i++) { | ||
| 419 | + iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)]; | ||
| 420 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 421 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 422 | + _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 423 | + _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 424 | + } | ||
| 425 | + // 其他分班 | ||
| 426 | + for (i = 0; i < aNotLbIndexes.length; i++) { | ||
| 427 | + iLpIndex = aNotLbIndexes[i]; | ||
| 428 | + if (!_internalLpArray[iLpIndex].isBxFb5_2()) { | ||
| 429 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 430 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 431 | + _internalLpArray[iLpIndex].setBxFb5_2(false); | ||
| 432 | + _internalLpArray[iLpIndex].setBxDesc("其他分班"); | ||
| 433 | + } | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + console.log("高峰周转时间:" + _paramObj.calcuPeakZzsj()); | ||
| 437 | + console.log("连班路牌数:" + _iBx_lb_lpcount); | ||
| 438 | + console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount); | ||
| 439 | + console.log("其他分班路牌数:" + _iBx_other_fb_lpcount); | ||
| 440 | + var aLbIndexes = []; | ||
| 441 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 442 | + if (_internalLpArray[i].isBxLb()) { | ||
| 443 | + aLbIndexes.push(i); | ||
| 444 | + } | ||
| 445 | + } | ||
| 446 | + console.log("连班路牌indexes=" + aLbIndexes); | ||
| 447 | + var a_5_2_fbIndexes = []; | ||
| 448 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 449 | + if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) { | ||
| 450 | + a_5_2_fbIndexes.push(i); | ||
| 451 | + } | ||
| 452 | + } | ||
| 453 | + console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes); | ||
| 454 | + var a_other_fbIndexes = []; | ||
| 455 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 456 | + if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) { | ||
| 457 | + a_other_fbIndexes.push(i); | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + console.log("其他分班路牌indexes=" + a_other_fbIndexes); | ||
| 461 | + | ||
| 462 | + console.log("//---------------- 行车计划,初始化方法3 end ----------------//"); | ||
| 463 | + }; | ||
| 464 | + | ||
| 465 | + //----------------------- 初始化方法4,计算中标线位置 -------------------------// | ||
| 466 | + var _iZbx_lpIndex; // 中标线对应第几个路牌 | ||
| 467 | + var _fnInitFun4 = function() { // 初始化方法4 | ||
| 468 | + console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); | ||
| 469 | + | ||
| 470 | + // 中标线开始时间,早的首班车时间,和上标线的开始时间方向相反 | ||
| 471 | + var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 472 | + | ||
| 473 | + // 1、使用上标线的开始时间的之前的虚拟班次,往下拉,模拟构造每个路牌的开头的虚拟班次 | ||
| 474 | + var i; | ||
| 475 | + var _aFBc = []; | ||
| 476 | + _aFBc.push(_internalLpArray[0].getBc(0, 1)); // 第一个班次是上标线的开头虚拟班次 | ||
| 477 | + for (i = 1; i < _internalLpArray.length; i++) { | ||
| 478 | + _aFBc.push(_fnGenerateBc(i, 0, 1)); | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + // 2、使用中标线开始时间,比对虚拟班次,找出最接近的(但是要大于等于时间) | ||
| 482 | + var _iLpIndex = -1; // 中标线的路牌索引 | ||
| 483 | + for (i = 0; i < _aFBc.length; i++) { | ||
| 484 | + console.log("比较班次的发车时间=" + _aFBc[i].getFcTimeObj().format("HH:mm")); | ||
| 485 | + | ||
| 486 | + if (!_internalLpArray[i].isBxLb()) { | ||
| 487 | + // 如果不是连班,不计算 | ||
| 488 | + continue; | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + if (_aFBc[i].getFcTimeObj().diff(oSt) >= 0) { | ||
| 492 | + _iLpIndex = i; | ||
| 493 | + break; | ||
| 494 | + } | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + _iZbx_lpIndex = _iLpIndex; // 中标线放在第几个路牌 | ||
| 498 | + | ||
| 499 | + // 3、设定中标线班次 | ||
| 500 | + _aFBc[_iZbx_lpIndex].fnSetIsFirstBc(true); // 设置首班班次标识 | ||
| 501 | + _aFBc[_iZbx_lpIndex].setLp(_internalLpArray[_iZbx_lpIndex]); // 设置关联的路牌 | ||
| 502 | + _aFBc[_iZbx_lpIndex].fnSetDelFlag(false); // 不是标识班次 | ||
| 503 | + _internalLpArray[_iZbx_lpIndex].setBc(0, 1, _aFBc[_iZbx_lpIndex]); // 将班次加入路牌 | ||
| 504 | + | ||
| 505 | + // 4、修改班次时间为中标时间 | ||
| 506 | + var _iDiffTime = _aFBc[_iZbx_lpIndex].getFcTimeObj().diff(oSt, "m"); | ||
| 507 | + _aFBc[_iZbx_lpIndex].getFcTimeObj().add(-_iDiffTime, "m"); | ||
| 508 | + _aFBc[_iZbx_lpIndex].getArrTimeObj().add(-_iDiffTime, "m"); | ||
| 509 | + _aFBc[_iZbx_lpIndex].setStopTime(_aFBc[_iZbx_lpIndex].getStopTime() + _iDiffTime); | ||
| 510 | + | ||
| 511 | + | ||
| 512 | + // 5、如果中标线的开始时间比较早,则中标线下一个班次可能空,补,一直到前面添加的高峰班次为止 | ||
| 513 | + for (i = 1; i < _qCount; i++) { // 从第二圈开始,因为第一圈第二个班次就是中标线的开始时间 | ||
| 514 | + if (_internalLpArray[_iZbx_lpIndex].getBc(i, 0)) { | ||
| 515 | + break; | ||
| 516 | + } else { | ||
| 517 | + _fnGenerateBcAndSetBc(_iZbx_lpIndex, i, 0); | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + if (_internalLpArray[_iZbx_lpIndex].getBc(i, 1)) { | ||
| 521 | + break; | ||
| 522 | + } else { | ||
| 523 | + _fnGenerateBcAndSetBc(_iZbx_lpIndex, i, 1); | ||
| 524 | + } | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌"); | ||
| 528 | + | ||
| 529 | + console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); | ||
| 530 | + | ||
| 531 | + | ||
| 532 | + }; | ||
| 533 | + | ||
| 534 | + //-------------------- 重要的内部方法 -----------------------// | ||
| 535 | + /** | ||
| 536 | + * 核心方法,利用路牌间隔纵向生成班次。 | ||
| 537 | + * @param iLpindex 路牌索引 | ||
| 538 | + * @param iQindex 圈索引 | ||
| 539 | + * @param iBcindex 班次索引 | ||
| 540 | + * @returns object InternalBcObj,失败 false | ||
| 541 | + */ | ||
| 542 | + var _fnGenerateBc = function(iLpindex, iQindex, iBcindex) { | ||
| 543 | + // 以上标线为起始点,使用路牌在不同圈,班次索引的发车间隔,计算班次 | ||
| 544 | + // 注意,发车间隔是指下一个班次应该距离当前班次间隔,是从下往上的 | ||
| 545 | + | ||
| 546 | + // 1、参数验证 | ||
| 547 | + if (iLpindex == 0) { // 上标线的班次不需要生成 | ||
| 548 | + return false; | ||
| 549 | + } | ||
| 550 | + | ||
| 551 | + // 2、计算间隔 | ||
| 552 | + var i; | ||
| 553 | + var oLp; | ||
| 554 | + var iTime = 0; | ||
| 555 | + for (i = 0; i < iLpindex; i++) { | ||
| 556 | + oLp = _internalLpArray[i]; | ||
| 557 | + iTime += oLp.fnGetVerticalIntervalTime(iQindex, iBcindex); | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + // 3、生成班次 | ||
| 561 | + var _oKsbc = _internalLpArray[0].getBc(iQindex, iBcindex); | ||
| 562 | + if (!_oKsbc) { | ||
| 563 | + return false; | ||
| 564 | + } | ||
| 565 | + var _oKssj = _paramObj.addMinute(_oKsbc.getFcTimeObj(), iTime); | ||
| 566 | + var _oBc = _factory.createBcObj( | ||
| 567 | + _internalLpArray[iLpindex], | ||
| 568 | + "normal", _oKsbc.isUp(), | ||
| 569 | + 1, _oKssj, _paramObj); | ||
| 570 | + | ||
| 571 | + return _oBc; | ||
| 572 | + | ||
| 573 | + }; | ||
| 574 | + | ||
| 575 | + /** | ||
| 576 | + * 核心方法,在指定位置生成班次并添加到路牌指定位置中。 | ||
| 577 | + * @param lpIndex 第几个路牌 | ||
| 578 | + * @param qIndex 第几圈 | ||
| 579 | + * @param bcIndex 第几个班次 | ||
| 580 | + */ | ||
| 581 | + var _fnGenerateBcAndSetBc = function(lpIndex, qIndex, bcIndex) { | ||
| 582 | + var _bcObj = _fnGenerateBc(lpIndex, qIndex, bcIndex); | ||
| 583 | + if (_bcObj) { | ||
| 584 | + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj); | ||
| 585 | + } | ||
| 586 | + }; | ||
| 587 | + | ||
| 588 | + /** | ||
| 589 | + * 获取班次列表。 | ||
| 590 | + * @param oIsUp 是否上行 | ||
| 591 | + * @param oStartTime 开始时间对象 | ||
| 592 | + * @returns [(InternalBcObj)] | ||
| 593 | + */ | ||
| 594 | + var _fnGetBcList2 = function(oIsUp, oStartTime) { | ||
| 595 | + var i; | ||
| 596 | + var j; | ||
| 597 | + var oLp; | ||
| 598 | + var oBc; | ||
| 599 | + var aBc = []; | ||
| 600 | + | ||
| 601 | + for (j = 0; j < _qCount; j++) { | ||
| 602 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 603 | + oLp = _internalLpArray[i]; | ||
| 604 | + oBc = oLp.getBc( | ||
| 605 | + j, | ||
| 606 | + _qIsUp == oIsUp ? 0 : 1 | ||
| 607 | + ); | ||
| 608 | + if (oBc && oBc.getFcTimeObj().isAfter(oStartTime)) { | ||
| 609 | + aBc.push(oBc); | ||
| 610 | + } | ||
| 611 | + } | ||
| 612 | + } | ||
| 613 | + | ||
| 614 | + var aBcFcTime = []; | ||
| 615 | + for (i = 0; i < aBc.length; i++) { | ||
| 616 | + oBc = aBc[i]; | ||
| 617 | + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm")); | ||
| 618 | + } | ||
| 619 | + console.log((oIsUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(",")); | ||
| 620 | + | ||
| 621 | + return aBc; | ||
| 622 | + }; | ||
| 623 | + | ||
| 624 | + /** | ||
| 625 | + * 获取班次列表。 | ||
| 626 | + * @param isUp boolean 是否上行 | ||
| 627 | + * @returns [(InternalBcObj)] | ||
| 628 | + */ | ||
| 629 | + var _fnGetBcList = function(isUp) { | ||
| 630 | + var i; | ||
| 631 | + var j; | ||
| 632 | + var oLp; | ||
| 633 | + var oBc; | ||
| 634 | + var aBc = []; | ||
| 635 | + | ||
| 636 | + for (j = 0; j < _qCount; j++) { | ||
| 637 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 638 | + oLp = _internalLpArray[i]; | ||
| 639 | + oBc = oLp.getBc( | ||
| 640 | + j, | ||
| 641 | + _qIsUp == isUp ? 0 : 1 | ||
| 642 | + ); | ||
| 643 | + if (oBc) { | ||
| 644 | + aBc.push(oBc); | ||
| 645 | + } | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + | ||
| 649 | + var aBcFcTime = []; | ||
| 650 | + for (i = 0; i < aBc.length; i++) { | ||
| 651 | + oBc = aBc[i]; | ||
| 652 | + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm")); | ||
| 653 | + } | ||
| 654 | + console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(",")); | ||
| 655 | + | ||
| 656 | + return aBc; | ||
| 657 | + }; | ||
| 658 | + | ||
| 659 | + /** | ||
| 660 | + * 查找离指定时间最近的前面的班次索引信息 | ||
| 661 | + * @param timeObj 查找时间 | ||
| 662 | + * @param isUp 是否上行 | ||
| 663 | + * @returns [{路牌index},{圈index},{班次index}] | ||
| 664 | + */ | ||
| 665 | + var _fnFindUpClosedBcIndexWithTime = function(timeObj, isUp) { | ||
| 666 | + | ||
| 667 | + var _lpObj; | ||
| 668 | + var _groupObj; | ||
| 669 | + var _bcObj; | ||
| 670 | + var _i; | ||
| 671 | + var _j; | ||
| 672 | + var timediff; // 时间差取绝对值 | ||
| 673 | + | ||
| 674 | + var _lpIndex; | ||
| 675 | + var _up_qIndex; | ||
| 676 | + var _up_bIndex; | ||
| 677 | + | ||
| 678 | + for (_i = 0; _i < _qCount; _i++) { | ||
| 679 | + for (_j = 0; _j < _internalLpArray.length; _j++) { | ||
| 680 | + _lpObj = _internalLpArray[_j]; | ||
| 681 | + _groupObj = _lpObj.getGroup(_i); | ||
| 682 | + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2(); | ||
| 683 | + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的 | ||
| 684 | + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1); | ||
| 685 | + } | ||
| 686 | + if (_bcObj) { | ||
| 687 | + if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) { | ||
| 688 | + if (!timediff) { | ||
| 689 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 690 | + _lpIndex = _j; | ||
| 691 | + _up_qIndex = _i; | ||
| 692 | + _up_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 693 | + } else { | ||
| 694 | + if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) { | ||
| 695 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 696 | + _lpIndex = _j; | ||
| 697 | + _up_qIndex = _i; | ||
| 698 | + _up_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 699 | + } | ||
| 700 | + } | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + } | ||
| 704 | + } | ||
| 705 | + | ||
| 706 | + if (_lpIndex == undefined) { | ||
| 707 | + return false; | ||
| 708 | + } | ||
| 709 | + | ||
| 710 | + var bcindex = []; | ||
| 711 | + bcindex.push(_lpIndex); | ||
| 712 | + bcindex.push(_up_qIndex); | ||
| 713 | + bcindex.push(_up_bIndex); | ||
| 714 | + | ||
| 715 | + return bcindex; | ||
| 716 | + }; | ||
| 717 | + | ||
| 718 | + /** | ||
| 719 | + * 查找离指定时间最近的后面的班次索引信息 | ||
| 720 | + * @param timeObj 查找时间 | ||
| 721 | + * @param isUp 是否上行 | ||
| 722 | + * @returns [{路牌index},{圈index},{班次index}] | ||
| 723 | + */ | ||
| 724 | + var _fnFindDownClosedBcIndexWithTime = function(timeObj, isUp) { | ||
| 725 | + var _lpObj; | ||
| 726 | + var _groupObj; | ||
| 727 | + var _bcObj; | ||
| 728 | + var _i; | ||
| 729 | + var _j; | ||
| 730 | + var timediff; // 时间差取绝对值 | ||
| 731 | + | ||
| 732 | + var _lpIndex; | ||
| 733 | + var _down_qIndex; | ||
| 734 | + var _down_bIndex; | ||
| 735 | + | ||
| 736 | + var flag; | ||
| 737 | + | ||
| 738 | + for (_i = 0; _i < _qCount; _i++) { | ||
| 739 | + for (_j = 0; _j < _internalLpArray.length; _j++) { | ||
| 740 | + _lpObj = _internalLpArray[_j]; | ||
| 741 | + _groupObj = _lpObj.getGroup(_i); | ||
| 742 | + // TODO:bug | ||
| 743 | + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2(); | ||
| 744 | + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的 | ||
| 745 | + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1); | ||
| 746 | + } | ||
| 747 | + if (_bcObj) { | ||
| 748 | + //console.log("timeobj -> bcobj diff flag " + | ||
| 749 | + // timeObj.format("HH:mm") + "->" + | ||
| 750 | + // _bcObj.getFcTimeObj().format("HH:mm") + | ||
| 751 | + // timeObj.diff(_bcObj.getFcTimeObj()) + | ||
| 752 | + // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0) | ||
| 753 | + //); | ||
| 754 | + | ||
| 755 | + flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0; | ||
| 756 | + | ||
| 757 | + if (flag) { | ||
| 758 | + if (!timediff) { | ||
| 759 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 760 | + _lpIndex = _j; | ||
| 761 | + _down_qIndex = _i; | ||
| 762 | + _down_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 763 | + } else { | ||
| 764 | + if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) { | ||
| 765 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | ||
| 766 | + _lpIndex = _j; | ||
| 767 | + _down_qIndex = _i; | ||
| 768 | + _down_bIndex = isUp == _qIsUp ? 0 : 1; | ||
| 769 | + } | ||
| 770 | + } | ||
| 771 | + } | ||
| 772 | + } | ||
| 773 | + } | ||
| 774 | + } | ||
| 775 | + | ||
| 776 | + if (_lpIndex == undefined) { | ||
| 777 | + return false; | ||
| 778 | + } | ||
| 779 | + | ||
| 780 | + var bcindex = []; | ||
| 781 | + bcindex.push(_lpIndex); | ||
| 782 | + bcindex.push(_down_qIndex); | ||
| 783 | + bcindex.push(_down_bIndex); | ||
| 784 | + | ||
| 785 | + return bcindex; | ||
| 786 | + }; | ||
| 787 | + | ||
| 788 | + /** | ||
| 789 | + * 获取班次索引。 | ||
| 790 | + * @param oBc 班次对象 | ||
| 791 | + * @returns [{路牌索引},{圈索引},{班次索引}] | ||
| 792 | + */ | ||
| 793 | + var _fnGetBcIndex = function(oBc) { | ||
| 794 | + // 路牌索引 | ||
| 795 | + var i; | ||
| 796 | + var iLpIndex; | ||
| 797 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 798 | + if (_internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) { | ||
| 799 | + iLpIndex = i; | ||
| 800 | + break; | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + // 圈索引 | ||
| 804 | + var j; | ||
| 805 | + var iGroupIndex; | ||
| 806 | + var bFlag = false; | ||
| 807 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 808 | + if (bFlag) { | ||
| 809 | + break; | ||
| 810 | + } | ||
| 811 | + for (j = 0; j < _qCount; j++) { | ||
| 812 | + if (_internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) { | ||
| 813 | + iGroupIndex = j; | ||
| 814 | + bFlag = true; | ||
| 815 | + break; | ||
| 816 | + } | ||
| 817 | + } | ||
| 818 | + } | ||
| 819 | + // 班次索引 | ||
| 820 | + var iBcIndex = _qIsUp == oBc.isUp() ? 0 : 1; | ||
| 821 | + | ||
| 822 | + if (iLpIndex == undefined) { | ||
| 823 | + return null; | ||
| 824 | + } else { | ||
| 825 | + return [].concat(iLpIndex, iGroupIndex, iBcIndex); | ||
| 826 | + } | ||
| 827 | + | ||
| 828 | + }; | ||
| 829 | + | ||
| 830 | + return { | ||
| 831 | + //------------- 布局初始化方法 ------------// | ||
| 832 | + /** | ||
| 833 | + * 初始化数据,使用标线初始化 | ||
| 834 | + */ | ||
| 835 | + fnInitDataWithBxLayout: function() { | ||
| 836 | + // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中 | ||
| 837 | + _fnInitFun1(); | ||
| 838 | + // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次,计算路牌在各个圈中的间隔 | ||
| 839 | + _fnInitFun2(); | ||
| 840 | + // 初始化布局3,计算连班分班路牌分布 | ||
| 841 | + _fnInitFun3(); | ||
| 842 | + // 初始化布局4,计算中标线位置 | ||
| 843 | + _fnInitFun4(); | ||
| 844 | + | ||
| 845 | + }, | ||
| 846 | + | ||
| 847 | + /** | ||
| 848 | + * 调整高峰班次, | ||
| 849 | + * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间 | ||
| 850 | + * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后 | ||
| 851 | + * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的) | ||
| 852 | + * @param isZgf 是否早高峰 | ||
| 853 | + * @param isUp 是否上行 | ||
| 854 | + */ | ||
| 855 | + fnAdjustGfbc : function(isZgf, isUp) { | ||
| 856 | + var oStartTime; // 开始时间 | ||
| 857 | + var oEndTime; // 结束时间 | ||
| 858 | + var aStartBcIndex; // 开始班次索引 | ||
| 859 | + var aEndBcIndex; // 结束班次索引 | ||
| 860 | + | ||
| 861 | + oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj(); | ||
| 862 | + oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj(); | ||
| 863 | + | ||
| 864 | + aStartBcIndex = _fnFindUpClosedBcIndexWithTime(oStartTime, isUp); | ||
| 865 | + aEndBcIndex = _fnFindDownClosedBcIndexWithTime(oEndTime, isUp); | ||
| 866 | + | ||
| 867 | + var iLpIndex; | ||
| 868 | + var iQIndex; | ||
| 869 | + var iBcIndex; | ||
| 870 | + var iQInternelCount; // 高峰时间段中间包含的圈数 | ||
| 871 | + var i; | ||
| 872 | + var j; | ||
| 873 | + | ||
| 874 | + var oLp; | ||
| 875 | + | ||
| 876 | + if (aStartBcIndex && aEndBcIndex) { | ||
| 877 | + iLpIndex = aStartBcIndex[0]; | ||
| 878 | + iQIndex = aStartBcIndex[1]; | ||
| 879 | + iBcIndex = aStartBcIndex[2]; | ||
| 880 | + | ||
| 881 | + // 处理头 | ||
| 882 | + // 删除头部多余班次 | ||
| 883 | + for (j = 0; j < iLpIndex; j++) { | ||
| 884 | + oLp = _internalLpArray[j]; | ||
| 885 | + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 886 | + oLp.removeBc(iQIndex, iBcIndex); | ||
| 887 | + } | ||
| 888 | + } | ||
| 889 | + | ||
| 890 | + for (j = iLpIndex; j < _internalLpArray.length; j++) { | ||
| 891 | + oLp = _internalLpArray[j]; | ||
| 892 | + if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 893 | + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 894 | + } | ||
| 895 | + } | ||
| 896 | + | ||
| 897 | + // 处理中间 | ||
| 898 | + iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1; | ||
| 899 | + for (i = 1; i <= iQInternelCount; i++) { | ||
| 900 | + | ||
| 901 | + for (j = 0; j < _internalLpArray.length; j++) { | ||
| 902 | + oLp = _internalLpArray[j]; | ||
| 903 | + if (!oLp.getBc(iQIndex + i, iBcIndex)) { | ||
| 904 | + _fnGenerateBcAndSetBc(j, iQIndex + i, iBcIndex); | ||
| 905 | + } | ||
| 906 | + } | ||
| 907 | + | ||
| 908 | + } | ||
| 909 | + | ||
| 910 | + // 处理尾部 | ||
| 911 | + iLpIndex = aEndBcIndex[0]; | ||
| 912 | + iQIndex = aEndBcIndex[1]; | ||
| 913 | + iBcIndex = aEndBcIndex[2]; | ||
| 914 | + | ||
| 915 | + // 删除尾部多余的班次 | ||
| 916 | + for (j = iLpIndex; j < _internalLpArray.length; j++) { | ||
| 917 | + oLp = _internalLpArray[j]; | ||
| 918 | + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 919 | + oLp.removeBc(iQIndex, iBcIndex); | ||
| 920 | + } | ||
| 921 | + } | ||
| 922 | + | ||
| 923 | + if (aStartBcIndex[1] != aEndBcIndex[1]) { // 指定时间范围跨圈 | ||
| 924 | + for (j = 0; j < iLpIndex; j++) { | ||
| 925 | + oLp = _internalLpArray[j]; | ||
| 926 | + if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 927 | + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 928 | + } | ||
| 929 | + } | ||
| 930 | + } else { | ||
| 931 | + // 不跨圈,不用处理,处理头的时候已经加了 | ||
| 932 | + } | ||
| 933 | + | ||
| 934 | + } | ||
| 935 | + | ||
| 936 | + }, | ||
| 937 | + | ||
| 938 | + /** | ||
| 939 | + * 按照营运时间要求补充班次, | ||
| 940 | + * 早高峰7:45分以前出场运营, | ||
| 941 | + * 晚高峰16:10分以前出场运营 | ||
| 942 | + */ | ||
| 943 | + fnCalcuLpBc_yy: function() { | ||
| 944 | + // 补班次的时候,针对的是分班班型 | ||
| 945 | + var i; | ||
| 946 | + var _oLp; | ||
| 947 | + var _oBc; | ||
| 948 | + var _aMinBcIndex; | ||
| 949 | + var _aMaxBcIndex; | ||
| 950 | + | ||
| 951 | + var _qIndex; | ||
| 952 | + var _bIndex; | ||
| 953 | + | ||
| 954 | + var _zgfCDate = _paramObj.toTimeObj("7:45"); | ||
| 955 | + var _wgfCDate = _paramObj.toTimeObj("16:10"); | ||
| 956 | + var _ccsj; | ||
| 957 | + | ||
| 958 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 959 | + _oLp = _internalLpArray[i]; | ||
| 960 | + if (_oLp.isBxFb()) { // 分班路牌 | ||
| 961 | + // 早高峰部分 | ||
| 962 | + _aMinBcIndex = _oLp.getMinBcObjPosition(); | ||
| 963 | + _qIndex = _aMinBcIndex[0]; | ||
| 964 | + _bIndex = _aMinBcIndex[1]; | ||
| 965 | + _oBc = _oLp.getBc(_qIndex, _bIndex); | ||
| 966 | + if (_qIsUp) { | ||
| 967 | + _ccsj = _bIndex == 0 ? | ||
| 968 | + _paramObj.getUpOutTime() : | ||
| 969 | + _paramObj.getDownOutTime(); | ||
| 970 | + } else { | ||
| 971 | + _ccsj = _bIndex == 0 ? | ||
| 972 | + _paramObj.getDownOutTime() : | ||
| 973 | + _paramObj.getUpOutTime(); | ||
| 974 | + } | ||
| 975 | + if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | ||
| 976 | + _fnGenerateBcAndSetBc( | ||
| 977 | + i, | ||
| 978 | + _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 979 | + _bIndex == 0 ? 1 : 0 | ||
| 980 | + ) | ||
| 981 | + } | ||
| 982 | + | ||
| 983 | + // 晚高峰部分 | ||
| 984 | + _aMaxBcIndex = _oLp.getMaxBcObjPosition(); | ||
| 985 | + _qIndex = _aMaxBcIndex[0]; | ||
| 986 | + _bIndex = _aMaxBcIndex[1]; | ||
| 987 | + _oBc = _oLp.getBc( | ||
| 988 | + _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 989 | + _bIndex == 0 ? 1 : 0 | ||
| 990 | + ); | ||
| 991 | + if (!_oBc) { // 前一个班次不存在,再判定加不加 | ||
| 992 | + _oBc = _oLp.getBc(_qIndex, _bIndex); | ||
| 993 | + if (_qIsUp) { | ||
| 994 | + _ccsj = _bIndex == 0 ? | ||
| 995 | + _paramObj.getUpOutTime() : | ||
| 996 | + _paramObj.getDownOutTime(); | ||
| 997 | + } else { | ||
| 998 | + _ccsj = _bIndex == 0 ? | ||
| 999 | + _paramObj.getDownOutTime() : | ||
| 1000 | + _paramObj.getUpOutTime(); | ||
| 1001 | + } | ||
| 1002 | + if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | ||
| 1003 | + _fnGenerateBcAndSetBc( | ||
| 1004 | + i, | ||
| 1005 | + _bIndex == 0 ? _qIndex - 1 : _qIndex, | ||
| 1006 | + _bIndex == 0 ? 1 : 0 | ||
| 1007 | + ) | ||
| 1008 | + } | ||
| 1009 | + } | ||
| 1010 | + } | ||
| 1011 | + } | ||
| 1012 | + }, | ||
| 1013 | + | ||
| 1014 | + /** | ||
| 1015 | + * 补充做5休2的班型班次。 | ||
| 1016 | + * 1、确认5_2班型大致多少圈(小数点过.7进位) | ||
| 1017 | + * 2、获取当前5_2两端车次链的信息,每段的班次数目,还差几个班次没加 | ||
| 1018 | + * 3、如果前面的车次链班次少,则从前面的车次链开始加 | ||
| 1019 | + * 4、如果车次链班次数一样,从从后面的车次链开始加 | ||
| 1020 | + * 5、加班次时都是往车次链前方加 | ||
| 1021 | + * 6、如果前面车次链不能再加班次了,从后面车次链加 | ||
| 1022 | + */ | ||
| 1023 | + fnCalcuLpBx_5_2: function() { | ||
| 1024 | + // 计算做5休2班型所需的班次数 | ||
| 1025 | + var iBxBcount = _aBxDesc[6].fBcCount; | ||
| 1026 | + if (iBxBcount - Math.floor(iBxBcount) > 0.7) { | ||
| 1027 | + iBxBcount = Math.floor(iBxBcount) + 1; | ||
| 1028 | + } else { | ||
| 1029 | + iBxBcount = Math.floor(iBxBcount); | ||
| 1030 | + } | ||
| 1031 | + | ||
| 1032 | + var i; | ||
| 1033 | + var j; | ||
| 1034 | + var oLp; | ||
| 1035 | + var iAddBcCount; | ||
| 1036 | + var oBcChain1; | ||
| 1037 | + var oBcChain2; | ||
| 1038 | + var iQindex; | ||
| 1039 | + var iBindex; | ||
| 1040 | + | ||
| 1041 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1042 | + oLp = _internalLpArray[i]; | ||
| 1043 | + if (oLp.isBxFb5_2()) { | ||
| 1044 | + iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数 | ||
| 1045 | + for (j = 1; j <= iAddBcCount; j++) { | ||
| 1046 | + oBcChain1 = oLp.fnGetBcChainInfo(0); | ||
| 1047 | + oBcChain2 = oLp.fnGetBcChainInfo(1); | ||
| 1048 | + | ||
| 1049 | + if (oBcChain1.bcount < oBcChain2.bcount) { | ||
| 1050 | + iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q; | ||
| 1051 | + iBindex = oBcChain1.s_b == 0 ? 1 : 0; | ||
| 1052 | + // 往车次链往前不能加,就往后加 | ||
| 1053 | + if (_fnGenerateBc(i, iQindex, iBindex)) { | ||
| 1054 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1055 | + } else { | ||
| 1056 | + iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | ||
| 1057 | + iBindex = oBcChain1.e_b == 0 ? 1 : 0; | ||
| 1058 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1059 | + } | ||
| 1060 | + | ||
| 1061 | + } else if (oBcChain1.bcount > oBcChain2.bcount) { | ||
| 1062 | + iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | ||
| 1063 | + iBindex = oBcChain2.s_b == 0 ? 1 : 0; | ||
| 1064 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1065 | + } else { | ||
| 1066 | + iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | ||
| 1067 | + iBindex = oBcChain2.s_b == 0 ? 1 : 0; | ||
| 1068 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1069 | + } | ||
| 1070 | + } | ||
| 1071 | + } | ||
| 1072 | + } | ||
| 1073 | + | ||
| 1074 | + }, | ||
| 1075 | + | ||
| 1076 | + /** | ||
| 1077 | + * 补其他分班班型班次。 | ||
| 1078 | + * 从车次链的后面开始加 | ||
| 1079 | + */ | ||
| 1080 | + fnCalcuLpBx_other: function() { | ||
| 1081 | + // TODO:根据上标线的首班时间确定班型,小于05:59的做一休一,否则做二休一 | ||
| 1082 | + var oSt = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | ||
| 1083 | + var iBxIndex = 4; | ||
| 1084 | + if (oSt.isBefore(_paramObj.toTimeObj("05:59"))) { | ||
| 1085 | + iBxIndex = 5; | ||
| 1086 | + } | ||
| 1087 | + // 计算做5休2班型所需的班次数 | ||
| 1088 | + var iQBcount = _aBxDesc[iBxIndex].fQCount; | ||
| 1089 | + var iBxBcount = Math.round(iQBcount) * 2; | ||
| 1090 | + | ||
| 1091 | + var i; | ||
| 1092 | + var j; | ||
| 1093 | + var oLp; | ||
| 1094 | + var iAddBcCount; | ||
| 1095 | + var oBcChain1; | ||
| 1096 | + var oBcChain2; | ||
| 1097 | + var iQindex; | ||
| 1098 | + var iBindex; | ||
| 1099 | + | ||
| 1100 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1101 | + oLp = _internalLpArray[i]; | ||
| 1102 | + if (oLp.isBxFb() && !oLp.isBxFb5_2()) { | ||
| 1103 | + iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数 | ||
| 1104 | + for (j = 1; j <= iAddBcCount; j++) { | ||
| 1105 | + oBcChain1 = oLp.fnGetBcChainInfo(0); | ||
| 1106 | + oBcChain2 = oLp.fnGetBcChainInfo(1); | ||
| 1107 | + | ||
| 1108 | + if (oBcChain1.bcount < oBcChain2.bcount) { | ||
| 1109 | + iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | ||
| 1110 | + iBindex = oBcChain1.e_b == 0 ? 1 : 0; | ||
| 1111 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1112 | + } else if (oBcChain1.bcount > oBcChain2.bcount) { | ||
| 1113 | + iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | ||
| 1114 | + iBindex = oBcChain2.e_b == 0 ? 1 : 0; | ||
| 1115 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1116 | + } else { | ||
| 1117 | + iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | ||
| 1118 | + iBindex = oBcChain2.e_b == 0 ? 1 : 0; | ||
| 1119 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 1120 | + } | ||
| 1121 | + } | ||
| 1122 | + } | ||
| 1123 | + } | ||
| 1124 | + | ||
| 1125 | + }, | ||
| 1126 | + | ||
| 1127 | + /** | ||
| 1128 | + * 补充连班路牌班次。 | ||
| 1129 | + * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢 | ||
| 1130 | + * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢 | ||
| 1131 | + */ | ||
| 1132 | + fnCalcuLpBx_lb: function() { | ||
| 1133 | + // 补充连班的班次,参照上标线,中标线补充不足的班次 | ||
| 1134 | + | ||
| 1135 | + var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引 | ||
| 1136 | + var i; | ||
| 1137 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1138 | + if (_internalLpArray[i].isBxLb() && i != 0) { | ||
| 1139 | + aLbLpindexes.push(i); | ||
| 1140 | + } | ||
| 1141 | + } | ||
| 1142 | + | ||
| 1143 | + var oEndsj = // 结束时间 | ||
| 1144 | + _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ? | ||
| 1145 | + _paramObj.getDownLastDTimeObj() : | ||
| 1146 | + _paramObj.getUpLastDtimeObj(); | ||
| 1147 | + | ||
| 1148 | + var oLp; | ||
| 1149 | + var aMinbcPos; | ||
| 1150 | + var oBc; | ||
| 1151 | + var j; | ||
| 1152 | + var iTempBcIndex; | ||
| 1153 | + | ||
| 1154 | + // 1、从最小班次开始,往后补充班次 | ||
| 1155 | + for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1156 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1157 | + | ||
| 1158 | + // 最小班次索引 | ||
| 1159 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1160 | + // 使用纵向分隔补充班次,从最小班次向后补 | ||
| 1161 | + iTempBcIndex = aMinbcPos[1] == 0 ? 1 : 0; | ||
| 1162 | + j = iTempBcIndex == 0 ? aMinbcPos[0] + 1 : aMinbcPos[0]; | ||
| 1163 | + | ||
| 1164 | + while (j < _qCount) { | ||
| 1165 | + while (iTempBcIndex <= 1) { | ||
| 1166 | + oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex); | ||
| 1167 | + if (oBc && | ||
| 1168 | + oBc.getFcTimeObj().isBefore(oEndsj) ) { | ||
| 1169 | + oLp.setBc(j, iTempBcIndex, oBc); | ||
| 1170 | + } | ||
| 1171 | + iTempBcIndex++; | ||
| 1172 | + } | ||
| 1173 | + iTempBcIndex = 0; | ||
| 1174 | + j++; | ||
| 1175 | + } | ||
| 1176 | + | ||
| 1177 | + } | ||
| 1178 | + | ||
| 1179 | + // 2、上标线中标线之间的路牌,从最小的班次往前补充班次 | ||
| 1180 | + | ||
| 1181 | + // 还要补充缺失的班次,差上标线几个班次要往前补上 | ||
| 1182 | + var iBccount; | ||
| 1183 | + var iQindex; | ||
| 1184 | + var iBindex; | ||
| 1185 | + // 补上标线到中标线之间的连班路牌的班次 | ||
| 1186 | + for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1187 | + // 中标线可能也要补充,因为中标线生成算法有变 | ||
| 1188 | + // 如果上标线==中标线为止,不用补了 | ||
| 1189 | + | ||
| 1190 | + if (aLbLpindexes[i] > 0 && aLbLpindexes[i] <= _iZbx_lpIndex) { | ||
| 1191 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1192 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1193 | + iQindex = aMinbcPos[0]; | ||
| 1194 | + iBindex = aMinbcPos[1]; | ||
| 1195 | + iBccount = (iQindex - 1) * 2 + iBindex; // 距离上标线起始站点差几个班次 | ||
| 1196 | + for (j = 0; j < iBccount; j++) { | ||
| 1197 | + if (iBindex == 0) { | ||
| 1198 | + iQindex --; | ||
| 1199 | + iBindex = 1; | ||
| 1200 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1201 | + } else if (iBindex == 1) { | ||
| 1202 | + iBindex --; | ||
| 1203 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1204 | + } | ||
| 1205 | + } | ||
| 1206 | + | ||
| 1207 | + } | ||
| 1208 | + | ||
| 1209 | + } | ||
| 1210 | + | ||
| 1211 | + // 3、中标线之后的路牌,从最小的班次往前补充班次 | ||
| 1212 | + | ||
| 1213 | + // 补中标线以下的连班路牌的班次 | ||
| 1214 | + for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1215 | + if (aLbLpindexes[i] > _iZbx_lpIndex) { | ||
| 1216 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1217 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1218 | + iQindex = aMinbcPos[0]; | ||
| 1219 | + iBindex = aMinbcPos[1]; | ||
| 1220 | + iBccount = (iQindex - 0) * 2 + iBindex - 1; // 距离上标线起始站点差几个班次 | ||
| 1221 | + for (j = 0; j < iBccount; j++) { | ||
| 1222 | + if (iBindex == 0) { | ||
| 1223 | + iQindex --; | ||
| 1224 | + iBindex = 1; | ||
| 1225 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1226 | + } else if (iBindex == 1) { | ||
| 1227 | + iBindex --; | ||
| 1228 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1229 | + } | ||
| 1230 | + } | ||
| 1231 | + } | ||
| 1232 | + } | ||
| 1233 | + | ||
| 1234 | + }, | ||
| 1235 | + | ||
| 1236 | + /** | ||
| 1237 | + * 计算末班车。 | ||
| 1238 | + * 1、将上下行拉成上下行两个班次列表(包括标记班次) | ||
| 1239 | + * 2、分别找出离末班车发车时间最近的班次,并替换时间 | ||
| 1240 | + * 3、删除之后的班次 | ||
| 1241 | + */ | ||
| 1242 | + fnCalcuLastBc: function() { | ||
| 1243 | + var i; | ||
| 1244 | + var iTimeDiff; | ||
| 1245 | + var iTempTime; | ||
| 1246 | + var aBc; | ||
| 1247 | + var oLastBcTime; | ||
| 1248 | + var oLastBcIsUp; | ||
| 1249 | + var iModifyIndex; | ||
| 1250 | + | ||
| 1251 | + // 查找末班车早的末班车时间和方向 | ||
| 1252 | + if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) { | ||
| 1253 | + oLastBcTime = _paramObj.getUpLastDtimeObj(); | ||
| 1254 | + oLastBcIsUp = true; | ||
| 1255 | + } else { | ||
| 1256 | + oLastBcTime = _paramObj.getDownLastDTimeObj(); | ||
| 1257 | + oLastBcIsUp = false; | ||
| 1258 | + } | ||
| 1259 | + | ||
| 1260 | + // 确定早的末班车时间 | ||
| 1261 | + aBc = _fnGetBcList(oLastBcIsUp); | ||
| 1262 | + for (i = 0; i < aBc.length; i++) { | ||
| 1263 | + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m"); | ||
| 1264 | + if (iTimeDiff == undefined) { | ||
| 1265 | + iTimeDiff = iTempTime; | ||
| 1266 | + iModifyIndex = i; | ||
| 1267 | + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) { | ||
| 1268 | + iTimeDiff = iTempTime; | ||
| 1269 | + iModifyIndex = i; | ||
| 1270 | + } | ||
| 1271 | + } | ||
| 1272 | + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间 | ||
| 1273 | + aBc[iModifyIndex].fnSetDelFlag(false); | ||
| 1274 | + aBc[iModifyIndex].fnSetIsLastBc(true); | ||
| 1275 | + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次 | ||
| 1276 | + _qIsUp == oLastBcIsUp ? | ||
| 1277 | + aBc[i]._$$_internal_group_obj.setBc1(undefined) : | ||
| 1278 | + aBc[i]._$$_internal_group_obj.setBc2(undefined); | ||
| 1279 | + } | ||
| 1280 | + | ||
| 1281 | + // 查找末班车晚的末班车时间和方向 | ||
| 1282 | + if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) { | ||
| 1283 | + oLastBcTime = _paramObj.getDownLastDTimeObj(); | ||
| 1284 | + oLastBcIsUp = false; | ||
| 1285 | + } else { | ||
| 1286 | + oLastBcTime = _paramObj.getUpLastDtimeObj(); | ||
| 1287 | + oLastBcIsUp = true; | ||
| 1288 | + } | ||
| 1289 | + // 确定晚的末班车时间 | ||
| 1290 | + aBc = _fnGetBcList(oLastBcIsUp); | ||
| 1291 | + var oBc; | ||
| 1292 | + var aBcIndex; | ||
| 1293 | + var iLpIndex; | ||
| 1294 | + var iQIndex; | ||
| 1295 | + var iBcIndex; | ||
| 1296 | + | ||
| 1297 | + iTimeDiff = undefined; | ||
| 1298 | + for (i = 0; i < aBc.length; i++) { | ||
| 1299 | + oBc = aBc[i]; | ||
| 1300 | + aBcIndex = _fnGetBcIndex(oBc); | ||
| 1301 | + | ||
| 1302 | + iLpIndex = aBcIndex[0]; | ||
| 1303 | + iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1]; | ||
| 1304 | + iBcIndex = aBcIndex[2] == 0 ? 1 : 0; | ||
| 1305 | + | ||
| 1306 | + if (!_internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) { | ||
| 1307 | + continue; | ||
| 1308 | + } | ||
| 1309 | + | ||
| 1310 | + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m"); | ||
| 1311 | + if (iTimeDiff == undefined) { | ||
| 1312 | + iTimeDiff = iTempTime; | ||
| 1313 | + iModifyIndex = i; | ||
| 1314 | + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) { | ||
| 1315 | + iTimeDiff = iTempTime; | ||
| 1316 | + iModifyIndex = i; | ||
| 1317 | + } | ||
| 1318 | + } | ||
| 1319 | + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间 | ||
| 1320 | + aBc[iModifyIndex].fnSetDelFlag(false); | ||
| 1321 | + aBc[iModifyIndex].fnSetIsLastBc(true); | ||
| 1322 | + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次 | ||
| 1323 | + _qIsUp == oLastBcIsUp ? | ||
| 1324 | + aBc[i]._$$_internal_group_obj.setBc1(undefined) : | ||
| 1325 | + aBc[i]._$$_internal_group_obj.setBc2(undefined); | ||
| 1326 | + } | ||
| 1327 | + | ||
| 1328 | + }, | ||
| 1329 | + | ||
| 1330 | + /** | ||
| 1331 | + * 添加吃饭班次。 | ||
| 1332 | + */ | ||
| 1333 | + fnCalcuEatBc: function() { | ||
| 1334 | + // 吃午饭时间范围,10:15 到 12:15 | ||
| 1335 | + // 吃晚饭时间范围,18:00 到 19:00 | ||
| 1336 | + | ||
| 1337 | + if (!_paramObj.fnIsEat()) { | ||
| 1338 | + return; | ||
| 1339 | + } | ||
| 1340 | + | ||
| 1341 | + // 午饭index | ||
| 1342 | + var aLEIndex; | ||
| 1343 | + // 晚饭index | ||
| 1344 | + var aDEIndex; | ||
| 1345 | + | ||
| 1346 | + console.log("吃饭"); | ||
| 1347 | + // 所有吃饭都默认在一个方向,两个方向暂时不考虑 | ||
| 1348 | + if (_paramObj.fnIsUpEat()) { | ||
| 1349 | + aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false); | ||
| 1350 | + aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), true, false); | ||
| 1351 | + } else { | ||
| 1352 | + aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), false, true); | ||
| 1353 | + aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), false, true); | ||
| 1354 | + } | ||
| 1355 | + | ||
| 1356 | + // 午饭第几圈,第几个班次 | ||
| 1357 | + var iLEQIndex = aLEIndex[0]; | ||
| 1358 | + var iLEBIndex = aLEIndex[1]; | ||
| 1359 | + // 晚饭第几圈,第几个班次 | ||
| 1360 | + var iDEQIndex = aDEIndex[0]; | ||
| 1361 | + var iDEBIndex = aDEIndex[1]; | ||
| 1362 | + | ||
| 1363 | + // TODO:注意,本模型只有连班才有吃饭 | ||
| 1364 | + | ||
| 1365 | + var i; | ||
| 1366 | + var oLp; | ||
| 1367 | + var aLbIndex = []; // 连班班型的路牌索引 | ||
| 1368 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1369 | + oLp = _internalLpArray[i]; | ||
| 1370 | + if (oLp.isBxLb()) { | ||
| 1371 | + aLbIndex.push(i); | ||
| 1372 | + } | ||
| 1373 | + } | ||
| 1374 | + | ||
| 1375 | + var iLTime; | ||
| 1376 | + var iDtime; | ||
| 1377 | + var j; | ||
| 1378 | + for (i = 0; i < aLbIndex.length; i++) { | ||
| 1379 | + oLp = _internalLpArray[aLbIndex[i]]; | ||
| 1380 | + // 午饭 | ||
| 1381 | + iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj); | ||
| 1382 | + // 晚饭 | ||
| 1383 | + iDtime = oLp.fnAddEatBc(iDEQIndex, iDEBIndex, _factory, _paramObj); | ||
| 1384 | + | ||
| 1385 | + if (i == aLbIndex.length - 1) { | ||
| 1386 | + for (j = aLbIndex[i]; j < _internalLpArray.length; j++) { | ||
| 1387 | + oLp = _internalLpArray[j]; | ||
| 1388 | + if (oLp.isBxFb()) { // 5休2班型不调整 | ||
| 1389 | + // 修正午饭之后路牌班次的发车时间 | ||
| 1390 | + oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); | ||
| 1391 | + oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); | ||
| 1392 | + } | ||
| 1393 | + } | ||
| 1394 | + } else { | ||
| 1395 | + for (j = aLbIndex[i]; j < aLbIndex[i + 1]; j++) { | ||
| 1396 | + oLp = _internalLpArray[j]; | ||
| 1397 | + if (oLp.isBxFb()) { | ||
| 1398 | + // 修正午饭之后路牌班次的发车时间 | ||
| 1399 | + oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); | ||
| 1400 | + oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); | ||
| 1401 | + } | ||
| 1402 | + } | ||
| 1403 | + } | ||
| 1404 | + } | ||
| 1405 | + | ||
| 1406 | + }, | ||
| 1407 | + | ||
| 1408 | + /** | ||
| 1409 | + * 补每个路牌的其他班次(进出场,例保班次)。 | ||
| 1410 | + */ | ||
| 1411 | + fnCalcuOtherBc_: function() { | ||
| 1412 | + var i; | ||
| 1413 | + var _lpObj; | ||
| 1414 | + var _minBcIndex; | ||
| 1415 | + var _maxBcIndex; | ||
| 1416 | + var _minBc; | ||
| 1417 | + var _maxBc; | ||
| 1418 | + var _otherbc = []; | ||
| 1419 | + var _oFbbc; | ||
| 1420 | + | ||
| 1421 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1422 | + _lpObj = _internalLpArray[i]; | ||
| 1423 | + _minBcIndex = _lpObj.getMinBcObjPosition(); | ||
| 1424 | + _maxBcIndex = _lpObj.getMaxBcObjPosition(); | ||
| 1425 | + _minBc = _lpObj.getBc(_minBcIndex[0], _minBcIndex[1]); | ||
| 1426 | + _maxBc = _lpObj.getBc(_maxBcIndex[0], _maxBcIndex[1]); | ||
| 1427 | + | ||
| 1428 | + _otherbc = []; | ||
| 1429 | + _otherbc.push(_factory.createBcObj( | ||
| 1430 | + _lpObj, "bd", true, 1, | ||
| 1431 | + _minBc.getFcTimeObj(), | ||
| 1432 | + _paramObj | ||
| 1433 | + )); | ||
| 1434 | + _otherbc.push(_factory.createBcObj( | ||
| 1435 | + _lpObj, "out", true, 1, | ||
| 1436 | + _minBc.getFcTimeObj(), | ||
| 1437 | + _paramObj | ||
| 1438 | + )); | ||
| 1439 | + | ||
| 1440 | + _maxBc.setArrTimeObj(_paramObj.addMinute(_maxBc.getFcTimeObj(), _maxBc.getBcTime())); | ||
| 1441 | + _maxBc.setStopTime(0); | ||
| 1442 | + _otherbc.push(_factory.createBcObj( | ||
| 1443 | + _lpObj, "in", true, 1, | ||
| 1444 | + _maxBc.getArrTimeObj(), | ||
| 1445 | + _paramObj | ||
| 1446 | + )); | ||
| 1447 | + _otherbc.push(_factory.createBcObj( | ||
| 1448 | + _lpObj, "lc", true, 1, | ||
| 1449 | + _maxBc.getArrTimeObj(), | ||
| 1450 | + _paramObj | ||
| 1451 | + )); | ||
| 1452 | + | ||
| 1453 | + // 5休2分班出场例保班次 | ||
| 1454 | + if (_lpObj.isBxFb5_2()) { | ||
| 1455 | + _oFbbc = _lpObj.getBc( | ||
| 1456 | + _lpObj.fnGetBcChainInfo(1)["s_q"], | ||
| 1457 | + _lpObj.fnGetBcChainInfo(1)["s_b"] | ||
| 1458 | + ); | ||
| 1459 | + | ||
| 1460 | + _otherbc.push(_factory.createBcObj( | ||
| 1461 | + _lpObj, "bd", true, 1, | ||
| 1462 | + _oFbbc.getFcTimeObj(), | ||
| 1463 | + _paramObj | ||
| 1464 | + )); | ||
| 1465 | + _otherbc.push(_factory.createBcObj( | ||
| 1466 | + _lpObj, "out", true, 1, | ||
| 1467 | + _oFbbc.getFcTimeObj(), | ||
| 1468 | + _paramObj | ||
| 1469 | + )); | ||
| 1470 | + } | ||
| 1471 | + | ||
| 1472 | + _lpObj.addOtherBcArray(_otherbc); | ||
| 1473 | + } | ||
| 1474 | + | ||
| 1475 | + }, | ||
| 1476 | + | ||
| 1477 | + /** | ||
| 1478 | + * 补每个路牌的其他班次(进出场,例保班次) | ||
| 1479 | + * 所有的车次链前后都加进出场、报道班次 | ||
| 1480 | + */ | ||
| 1481 | + fnCalcuOtherBc: function() { | ||
| 1482 | + var i; | ||
| 1483 | + var j; | ||
| 1484 | + var iBcChainCount; | ||
| 1485 | + var oLp; | ||
| 1486 | + var aOtherBc; | ||
| 1487 | + var oStartBc; | ||
| 1488 | + var oEndBc; | ||
| 1489 | + | ||
| 1490 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1491 | + aOtherBc = []; | ||
| 1492 | + oLp = _internalLpArray[i]; | ||
| 1493 | + iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 1494 | + | ||
| 1495 | + if (iBcChainCount == 1) { // 只有一个车次链,是连班班型 | ||
| 1496 | + // 头部要添加出场,例保班次 | ||
| 1497 | + oStartBc = oLp.getBc( | ||
| 1498 | + oLp.fnGetBcChainInfo(0)["s_q"], | ||
| 1499 | + oLp.fnGetBcChainInfo(0)["s_b"] | ||
| 1500 | + ); | ||
| 1501 | + aOtherBc.push(_factory.createBcObj( | ||
| 1502 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 1503 | + oStartBc.getFcTimeObj(), | ||
| 1504 | + _paramObj | ||
| 1505 | + )); | ||
| 1506 | + aOtherBc.push(_factory.createBcObj( | ||
| 1507 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 1508 | + oStartBc.getFcTimeObj(), | ||
| 1509 | + _paramObj | ||
| 1510 | + )); | ||
| 1511 | + | ||
| 1512 | + // 尾部需添加进场,例保班次 | ||
| 1513 | + oEndBc = oLp.getBc( | ||
| 1514 | + oLp.fnGetBcChainInfo(0)["e_q"], | ||
| 1515 | + oLp.fnGetBcChainInfo(0)["e_b"] | ||
| 1516 | + ); | ||
| 1517 | + oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置 | ||
| 1518 | + oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置 | ||
| 1519 | + aOtherBc.push(_factory.createBcObj( | ||
| 1520 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 1521 | + oEndBc.getArrTimeObj(), | ||
| 1522 | + _paramObj | ||
| 1523 | + )); | ||
| 1524 | + aOtherBc.push(_factory.createBcObj( | ||
| 1525 | + oLp, "lc", !oEndBc.isUp(), 1, | ||
| 1526 | + oEndBc.getArrTimeObj(), | ||
| 1527 | + _paramObj | ||
| 1528 | + )); | ||
| 1529 | + } else if (iBcChainCount == 2) { // 两个车次链,是分班班型 | ||
| 1530 | + // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次 | ||
| 1531 | + oStartBc = oLp.getBc( | ||
| 1532 | + oLp.fnGetBcChainInfo(0)["s_q"], | ||
| 1533 | + oLp.fnGetBcChainInfo(0)["s_b"] | ||
| 1534 | + ); | ||
| 1535 | + aOtherBc.push(_factory.createBcObj( | ||
| 1536 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 1537 | + oStartBc.getFcTimeObj(), | ||
| 1538 | + _paramObj | ||
| 1539 | + )); | ||
| 1540 | + aOtherBc.push(_factory.createBcObj( | ||
| 1541 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 1542 | + oStartBc.getFcTimeObj(), | ||
| 1543 | + _paramObj | ||
| 1544 | + )); | ||
| 1545 | + | ||
| 1546 | + oEndBc = oLp.getBc( | ||
| 1547 | + oLp.fnGetBcChainInfo(0)["e_q"], | ||
| 1548 | + oLp.fnGetBcChainInfo(0)["e_b"] | ||
| 1549 | + ); | ||
| 1550 | + aOtherBc.push(_factory.createBcObj( | ||
| 1551 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 1552 | + oEndBc.getArrTimeObj(), | ||
| 1553 | + _paramObj | ||
| 1554 | + )); | ||
| 1555 | + | ||
| 1556 | + // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次 | ||
| 1557 | + oStartBc = oLp.getBc( | ||
| 1558 | + oLp.fnGetBcChainInfo(1)["s_q"], | ||
| 1559 | + oLp.fnGetBcChainInfo(1)["s_b"] | ||
| 1560 | + ); | ||
| 1561 | + aOtherBc.push(_factory.createBcObj( | ||
| 1562 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 1563 | + oStartBc.getFcTimeObj(), | ||
| 1564 | + _paramObj | ||
| 1565 | + )); | ||
| 1566 | + aOtherBc.push(_factory.createBcObj( | ||
| 1567 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 1568 | + oStartBc.getFcTimeObj(), | ||
| 1569 | + _paramObj | ||
| 1570 | + )); | ||
| 1571 | + | ||
| 1572 | + oEndBc = oLp.getBc( | ||
| 1573 | + oLp.fnGetBcChainInfo(1)["e_q"], | ||
| 1574 | + oLp.fnGetBcChainInfo(1)["e_b"] | ||
| 1575 | + ); | ||
| 1576 | + aOtherBc.push(_factory.createBcObj( | ||
| 1577 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 1578 | + oEndBc.getArrTimeObj(), | ||
| 1579 | + _paramObj | ||
| 1580 | + )); | ||
| 1581 | + aOtherBc.push(_factory.createBcObj( | ||
| 1582 | + oLp, "lc", !oEndBc.isUp(), 1, | ||
| 1583 | + oEndBc.getArrTimeObj(), | ||
| 1584 | + _paramObj | ||
| 1585 | + )); | ||
| 1586 | + | ||
| 1587 | + | ||
| 1588 | + } else { | ||
| 1589 | + // 2个车次链以上,暂时没有此班型 | ||
| 1590 | + } | ||
| 1591 | + | ||
| 1592 | + oLp.addOtherBcArray(aOtherBc); | ||
| 1593 | + } | ||
| 1594 | + }, | ||
| 1595 | + | ||
| 1596 | + /** | ||
| 1597 | + * 祛除上标线开头的删除标记的班次。 | ||
| 1598 | + */ | ||
| 1599 | + fnRemoveDelFirstFlagBc: function() { | ||
| 1600 | + var oLp = _internalLpArray[0]; | ||
| 1601 | + var aMinBcIndex = oLp.getMinBcObjPosition(); | ||
| 1602 | + if (oLp.getBc(aMinBcIndex[0], aMinBcIndex[1]).fnIsDelFlag()) { | ||
| 1603 | + oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]); | ||
| 1604 | + } | ||
| 1605 | + }, | ||
| 1606 | + /** | ||
| 1607 | + * 祛除上标线结尾的删除标记的班次。 | ||
| 1608 | + */ | ||
| 1609 | + fnRemoveDelLastFlagBc: function() { | ||
| 1610 | + var oLp = _internalLpArray[0]; | ||
| 1611 | + var aMaxBcIndex = oLp.getMaxBcObjPosition(); | ||
| 1612 | + if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) { | ||
| 1613 | + oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]); | ||
| 1614 | + } | ||
| 1615 | + }, | ||
| 1616 | + | ||
| 1617 | + /** | ||
| 1618 | + * 调整路牌班次间隔(核准周转时间,停站时间)。 | ||
| 1619 | + * @param iFre int 迭代次数 | ||
| 1620 | + */ | ||
| 1621 | + fnAdjustLpBcInterval: function(iFre) { | ||
| 1622 | + // if (iFre > 0) { | ||
| 1623 | + // for (var i = 0; i < _internalLpArray.length; i++) { | ||
| 1624 | + // _internalLpArray[i].fnAdjustBcInterval( | ||
| 1625 | + // this.fnCalcuAverPeakStopTime(), | ||
| 1626 | + // this.fnCalcuAverTroughStopTime(), | ||
| 1627 | + // _paramObj); | ||
| 1628 | + // } | ||
| 1629 | + // | ||
| 1630 | + // this.fnAdjustLpBcInterval(iFre - 1); | ||
| 1631 | + // } | ||
| 1632 | + | ||
| 1633 | + for (var i = 0; i < _internalLpArray.length; i++) { | ||
| 1634 | + _internalLpArray[i].fnAdjustBcTime_layover(_paramObj); | ||
| 1635 | + } | ||
| 1636 | + }, | ||
| 1637 | + | ||
| 1638 | + /** | ||
| 1639 | + * 调整班次间隔。 | ||
| 1640 | + * @param bIsUp 是否上行 | ||
| 1641 | + * @param oStartTime 开始时间对象 | ||
| 1642 | + * @param iFre 迭代次数 | ||
| 1643 | + */ | ||
| 1644 | + fnAdjustBcInterval2_: function(bIsUp, oStartTime, iFre) { | ||
| 1645 | + if (iFre > 0) { | ||
| 1646 | + var aBc = _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表 | ||
| 1647 | + aBc.sort(function(o1, o2) { | ||
| 1648 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1649 | + return -1; | ||
| 1650 | + } else { | ||
| 1651 | + return 1; | ||
| 1652 | + } | ||
| 1653 | + }); | ||
| 1654 | + var i; | ||
| 1655 | + var j; | ||
| 1656 | + | ||
| 1657 | + var iBcCountOfGroup = 3; // 3个班次取一次计算 | ||
| 1658 | + var aBcOfGroup; // 3个班次列表 | ||
| 1659 | + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 1660 | + | ||
| 1661 | + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 1662 | + aBcOfGroup = []; | ||
| 1663 | + aBcIntervalOfGroup = []; | ||
| 1664 | + for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 1665 | + aBcOfGroup.push(aBc[j]); | ||
| 1666 | + } | ||
| 1667 | + | ||
| 1668 | + for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 1669 | + if (j < aBcOfGroup.length - 1) { | ||
| 1670 | + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 1671 | + aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 1672 | + } | ||
| 1673 | + } | ||
| 1674 | + | ||
| 1675 | + if (aBcIntervalOfGroup[0] < 19) { | ||
| 1676 | + aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 1677 | + } else if (aBcIntervalOfGroup[0] > 20) { | ||
| 1678 | + aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 1679 | + } else { | ||
| 1680 | + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 1681 | + //continue; | ||
| 1682 | + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 1683 | + aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 1684 | + } else { | ||
| 1685 | + aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 1686 | + } | ||
| 1687 | + } | ||
| 1688 | + | ||
| 1689 | + } | ||
| 1690 | + | ||
| 1691 | + this.fnAdjustBcInterval2(bIsUp, oStartTime, iFre - 1); | ||
| 1692 | + } | ||
| 1693 | + }, | ||
| 1694 | + | ||
| 1695 | + /** | ||
| 1696 | + * 调整班次间隔(使用策略类)。 | ||
| 1697 | + * @param oStartTime 开始时间对象 | ||
| 1698 | + */ | ||
| 1699 | + fnAdjustBcInterval: function(oStartTime) { | ||
| 1700 | + // 获取上行班次列表 | ||
| 1701 | + var aUpBc = !oStartTime ? _fnGetBcList(true) : _fnGetBcList2(true, oStartTime); // 指定方向的班次列表 | ||
| 1702 | + var aDownBc = !oStartTime ? _fnGetBcList(false) : _fnGetBcList2(false, oStartTime); // 指定方向的班次列表 | ||
| 1703 | + // 使用策略类调用指定策略函数,注意 AdjustTripStrategy.js 导入 | ||
| 1704 | + // console.log(StrategyUtils); | ||
| 1705 | + eval("var _oFn = " + _paramObj.fnGetAdjustStrategyId() + ";"); | ||
| 1706 | + StrategyUtils.sConfig("ADJUST_TRIP", _oFn); | ||
| 1707 | + StrategyUtils.sFn("ADJUST_TRIP")(aUpBc, aDownBc, this, _paramObj); | ||
| 1708 | + | ||
| 1709 | + }, | ||
| 1710 | + | ||
| 1711 | + /** | ||
| 1712 | + * 调整班次间隔(平均间隔)。 | ||
| 1713 | + * @param bIsUp 是否上行 | ||
| 1714 | + * @param oStartTime 开始时间对象 | ||
| 1715 | + */ | ||
| 1716 | + fnAdjustBcInterval2_avg: function(bIsUp, oStartTime) { | ||
| 1717 | + var aBc = !oStartTime ? _fnGetBcList(bIsUp) : _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表 | ||
| 1718 | + aBc.sort(function(o1, o2) { | ||
| 1719 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1720 | + return -1; | ||
| 1721 | + } else { | ||
| 1722 | + return 1; | ||
| 1723 | + } | ||
| 1724 | + }); | ||
| 1725 | + | ||
| 1726 | + if (aBc.length == 0) { | ||
| 1727 | + return; | ||
| 1728 | + } | ||
| 1729 | + | ||
| 1730 | + var j; | ||
| 1731 | + var iCount = aBc.length - 1; | ||
| 1732 | + var iC1 = Math.floor(aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") / iCount); | ||
| 1733 | + var iC2 = aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") % iCount; | ||
| 1734 | + var iTempTime; | ||
| 1735 | + | ||
| 1736 | + for (j = 0; j < iCount - iC2; j++) { | ||
| 1737 | + iTempTime = aBc[j + 1].getFcTimeObj().diff(aBc[j].getFcTimeObj(), "m"); | ||
| 1738 | + aBc[j + 1].addMinuteToFcsj(iC1 - iTempTime); | ||
| 1739 | + } | ||
| 1740 | + for (j = 0; j < iC2; j++) { | ||
| 1741 | + iTempTime = aBc[iCount - iC2 + j + 1].getFcTimeObj().diff(aBc[iCount - iC2 + j].getFcTimeObj(), "m"); | ||
| 1742 | + aBc[iCount - iC2 + j + 1].addMinuteToFcsj(iC1 + 1 - iTempTime); | ||
| 1743 | + } | ||
| 1744 | + | ||
| 1745 | + }, | ||
| 1746 | + | ||
| 1747 | + /** | ||
| 1748 | + * 计算高峰平均停站时间。 | ||
| 1749 | + */ | ||
| 1750 | + fnCalcuAverPeakStopTime: function() { | ||
| 1751 | + var i; | ||
| 1752 | + var j; | ||
| 1753 | + var aBc; | ||
| 1754 | + var iBcCount = 0; | ||
| 1755 | + var iSum = 0; | ||
| 1756 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1757 | + aBc = _internalLpArray[i].getBcArray(); | ||
| 1758 | + | ||
| 1759 | + for (j = 0; j < aBc.length; j++) { | ||
| 1760 | + if (!_paramObj.isTroughBc(aBc[j].getArrTimeObj())) { | ||
| 1761 | + iBcCount ++; | ||
| 1762 | + iSum += aBc[j].getStopTime(); | ||
| 1763 | + } | ||
| 1764 | + } | ||
| 1765 | + } | ||
| 1766 | + | ||
| 1767 | + return Math.floor(iSum / iBcCount); | ||
| 1768 | + }, | ||
| 1769 | + | ||
| 1770 | + /** | ||
| 1771 | + * 计算低谷平均停站时间。 | ||
| 1772 | + */ | ||
| 1773 | + fnCalcuAverTroughStopTime: function() { | ||
| 1774 | + var i; | ||
| 1775 | + var j; | ||
| 1776 | + var aBc; | ||
| 1777 | + var iBcCount = 0; | ||
| 1778 | + var iSum = 0; | ||
| 1779 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1780 | + aBc = _internalLpArray[i].getBcArray(); | ||
| 1781 | + for (j = 0; j < aBc.length; j++) { | ||
| 1782 | + if (_paramObj.isTroughBc(aBc[j].getArrTimeObj())) { | ||
| 1783 | + iBcCount ++; | ||
| 1784 | + iSum += aBc[j].getStopTime(); | ||
| 1785 | + } | ||
| 1786 | + } | ||
| 1787 | + } | ||
| 1788 | + | ||
| 1789 | + return Math.floor(iSum / iBcCount); | ||
| 1790 | + }, | ||
| 1791 | + | ||
| 1792 | + //------------- 其他方法 -------------// | ||
| 1793 | + /** | ||
| 1794 | + * 返回内部路牌数据列表。 | ||
| 1795 | + * @returns {Array} | ||
| 1796 | + */ | ||
| 1797 | + fnGetLpArray: function() { | ||
| 1798 | + return _internalLpArray; | ||
| 1799 | + }, | ||
| 1800 | + | ||
| 1801 | + /** | ||
| 1802 | + * 内部数据转化成显示用的班次数组。 | ||
| 1803 | + */ | ||
| 1804 | + fnToGanttBcArray: function() { | ||
| 1805 | + var aAllBc = []; | ||
| 1806 | + var aLpBc = []; | ||
| 1807 | + var aEatBc = []; | ||
| 1808 | + var oLp; | ||
| 1809 | + var i; | ||
| 1810 | + var j; | ||
| 1811 | + | ||
| 1812 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1813 | + oLp = _internalLpArray[i]; | ||
| 1814 | + aLpBc = []; | ||
| 1815 | + aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray()); | ||
| 1816 | + | ||
| 1817 | + aEatBc = []; | ||
| 1818 | + // 根据班次的吃饭时间添加吃饭班次 | ||
| 1819 | + for (j = 0; j < aLpBc.length; j++) { | ||
| 1820 | + if (aLpBc[j].fnGetEatTime() > 0) { | ||
| 1821 | + aEatBc.push(_factory.createBcObj( | ||
| 1822 | + oLp, | ||
| 1823 | + "cf", | ||
| 1824 | + !aLpBc[j].isUp(), // 和上一个班次方向相反 | ||
| 1825 | + 1, | ||
| 1826 | + _paramObj.addMinute(aLpBc[j].getArrTimeObj(), aLpBc[j].getStopTime()), // 使用上一个班次的到达时间作为开始时间 | ||
| 1827 | + _paramObj | ||
| 1828 | + )); | ||
| 1829 | + } | ||
| 1830 | + } | ||
| 1831 | + aLpBc = aLpBc.concat(aEatBc); | ||
| 1832 | + | ||
| 1833 | + // 按照发车时间排序 | ||
| 1834 | + aLpBc.sort(function(o1, o2) { | ||
| 1835 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 1836 | + return -1; | ||
| 1837 | + } else { | ||
| 1838 | + return 1; | ||
| 1839 | + } | ||
| 1840 | + }); | ||
| 1841 | + | ||
| 1842 | + // 重新赋值fcno | ||
| 1843 | + for (j = 0; j < aLpBc.length; j++) { | ||
| 1844 | + aLpBc[j].fnSetFcno(j + 1); | ||
| 1845 | + } | ||
| 1846 | + | ||
| 1847 | + aAllBc = aAllBc.concat(aLpBc); | ||
| 1848 | + } | ||
| 1849 | + | ||
| 1850 | + var aGanttBc = []; | ||
| 1851 | + for (i = 0; i < aAllBc.length; i++) { | ||
| 1852 | + aGanttBc.push(aAllBc[i].toGanttBcObj()); | ||
| 1853 | + } | ||
| 1854 | + | ||
| 1855 | + return aGanttBc; | ||
| 1856 | + } | ||
| 1857 | + | ||
| 1858 | + }; | ||
| 1859 | + | ||
| 1860 | }; | 1860 | }; |
| 1861 | \ No newline at end of file | 1861 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| 1 | -/** | ||
| 2 | - * 主类。 | ||
| 3 | - */ | ||
| 4 | -var Main_v2 = function() { | ||
| 5 | - | ||
| 6 | - // 内部工厂类 | ||
| 7 | - var _factoryFun = function() { | ||
| 8 | - return { | ||
| 9 | - // 创建参数 | ||
| 10 | - createParameterObj: function(formMap, dataMap) { | ||
| 11 | - var paramObj = ParameterObj(); | ||
| 12 | - paramObj.wrap(formMap, dataMap); | ||
| 13 | - return paramObj; | ||
| 14 | - }, | ||
| 15 | - // 创建班次对象 | ||
| 16 | - createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) { | ||
| 17 | - var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType); | ||
| 18 | - var _fcsj = fcTimeObj; | ||
| 19 | - var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); | ||
| 20 | - var _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 21 | - //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); | ||
| 22 | - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, isUp, paramObj.calcuTravelTime(_fcsj, isUp)); | ||
| 23 | - var _tccid = paramObj.getTTinfoId(); | ||
| 24 | - var _ttinfoid = paramObj.getTTinfoId(); | ||
| 25 | - var _xl = paramObj.getXlId(); | ||
| 26 | - var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id; | ||
| 27 | - var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id; | ||
| 28 | - | ||
| 29 | - if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间 | ||
| 30 | - if (isUp) { // 上行 | ||
| 31 | - _fcsj = paramObj.addMinute( | ||
| 32 | - _fcsj, | ||
| 33 | - -(paramObj.getUpOutTime() + paramObj.getLbTime())); | ||
| 34 | - _bcsj = paramObj.getLbTime(); | ||
| 35 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 36 | - _stoptime = 0; | ||
| 37 | - } else { // 下行 | ||
| 38 | - _fcsj = paramObj.addMinute( | ||
| 39 | - _fcsj, | ||
| 40 | - -(paramObj.getDownOutTime() + paramObj.getLbTime())); | ||
| 41 | - _bcsj = paramObj.getLbTime(); | ||
| 42 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 43 | - _stoptime = 0; | ||
| 44 | - } | ||
| 45 | - } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间 | ||
| 46 | - if (isUp) { // 上行 | ||
| 47 | - _fcsj = paramObj.addMinute( | ||
| 48 | - _fcsj, | ||
| 49 | - paramObj.getUpInTime()); | ||
| 50 | - _bcsj = paramObj.getLbTime(); | ||
| 51 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 52 | - _stoptime = 0; | ||
| 53 | - } else { // 下行 | ||
| 54 | - _fcsj = paramObj.addMinute( | ||
| 55 | - _fcsj, | ||
| 56 | - paramObj.getDownInTime()); | ||
| 57 | - _bcsj = paramObj.getLbTime(); | ||
| 58 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 59 | - _stoptime = 0; | ||
| 60 | - } | ||
| 61 | - } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间 | ||
| 62 | - if (isUp) { // 上行 | ||
| 63 | - _fcsj = paramObj.addMinute( | ||
| 64 | - _fcsj, | ||
| 65 | - -paramObj.getUpOutTime()); | ||
| 66 | - _bcsj = paramObj.getUpOutTime(); | ||
| 67 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 68 | - _stoptime = 0; | ||
| 69 | - } else { // 下行 | ||
| 70 | - _fcsj = paramObj.addMinute( | ||
| 71 | - _fcsj, | ||
| 72 | - -paramObj.getDownOutTime()); | ||
| 73 | - _bcsj = paramObj.getDownOutTime(); | ||
| 74 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 75 | - _stoptime = 0; | ||
| 76 | - } | ||
| 77 | - } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间 | ||
| 78 | - if (isUp) { // 上行 | ||
| 79 | - _bcsj = paramObj.getUpInTime(); | ||
| 80 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 81 | - _stoptime = 0; | ||
| 82 | - } else { // 下行 | ||
| 83 | - _bcsj = paramObj.getDownInTime(); | ||
| 84 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 85 | - _stoptime = 0; | ||
| 86 | - } | ||
| 87 | - } else if (bcType == "cf") { // 吃饭班次 | ||
| 88 | - // 以13:00为分界,之前的为午饭,之后的为晚饭 | ||
| 89 | - if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) { | ||
| 90 | - _bcsj = paramObj.fnGetLunchTime(); | ||
| 91 | - } else { | ||
| 92 | - _bcsj = paramObj.fnGetDinnerTime(); | ||
| 93 | - } | ||
| 94 | - _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 95 | - _stoptime = 0; | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - var bcParamObj = {}; | ||
| 99 | - bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等) | ||
| 100 | - bcParamObj.isUp = isUp; // boolean是否上下行 | ||
| 101 | - bcParamObj.fcno = fcno; // 发车顺序号 | ||
| 102 | - bcParamObj.fcTimeObj = _fcsj; // 发车时间对象 | ||
| 103 | - bcParamObj.bclc = _bclc; // 班次里程 | ||
| 104 | - bcParamObj.bcsj = _bcsj; // 班次历时 | ||
| 105 | - bcParamObj.arrtime = _arrsj; // 到达时间对象 | ||
| 106 | - bcParamObj.stoptime = _stoptime; // 停站时间 | ||
| 107 | - bcParamObj.tccid = _tccid; // 停车场id | ||
| 108 | - bcParamObj.ttinfoid = _ttinfoid; // 时刻表id | ||
| 109 | - bcParamObj.xl = _xl; // 线路id | ||
| 110 | - bcParamObj.qdzid = _qdz; // 起点站id | ||
| 111 | - bcParamObj.zdzid = _zdz; // 终点站id | ||
| 112 | - | ||
| 113 | - return new InternalBcObj(lpObj, bcParamObj); | ||
| 114 | - } | ||
| 115 | - }; | ||
| 116 | - }; | ||
| 117 | - var _factory = _factoryFun(); | ||
| 118 | - | ||
| 119 | - // 所有的时间使用moment.js计算 | ||
| 120 | - | ||
| 121 | - var _paramObj; // 参数对象 | ||
| 122 | - | ||
| 123 | - var _bxDesc = [ // 班型描述 | ||
| 124 | - {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0}, | ||
| 125 | - {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0}, | ||
| 126 | - {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0}, | ||
| 127 | - {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0}, | ||
| 128 | - {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0}, | ||
| 129 | - {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0}, | ||
| 130 | - {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0}, | ||
| 131 | - {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0} | ||
| 132 | - ]; | ||
| 133 | - | ||
| 134 | - var _funCalcuExportData_lpObjList = function(aInternalLpObj) { | ||
| 135 | - // 构造路牌对象 | ||
| 136 | - var aLpObj = []; | ||
| 137 | - var i; | ||
| 138 | - var j; | ||
| 139 | - var z; | ||
| 140 | - var oInternalLp; | ||
| 141 | - var oInternalBc; | ||
| 142 | - var oInternalBc_temp; | ||
| 143 | - var oLp; | ||
| 144 | - var iZlc; | ||
| 145 | - var iYylc; | ||
| 146 | - var iKslc; | ||
| 147 | - var iZbc; | ||
| 148 | - var iZgs; | ||
| 149 | - var iYygs; | ||
| 150 | - var iYybc; | ||
| 151 | - for (i = 0; i < aInternalLpObj.length; i++) { | ||
| 152 | - oInternalLp = aInternalLpObj[i]; | ||
| 153 | - iZlc = 0; | ||
| 154 | - iYylc = 0; | ||
| 155 | - iKslc = 0; | ||
| 156 | - iZgs = 0; | ||
| 157 | - iZbc = 0; | ||
| 158 | - iYygs = 0; | ||
| 159 | - iYybc = 0; | ||
| 160 | - oLp = { | ||
| 161 | - "lpname": oInternalLp.getLpName(), // 路牌名字 | ||
| 162 | - "isUp": oInternalLp.isUp(), // 每圈的第一个班次是否上行 | ||
| 163 | - "bcObjList": [], // 班次列表 | ||
| 164 | - "groupCount": oInternalLp.fnGetGroupCount(), // 总圈数 | ||
| 165 | - "zlc": 0, // 总里程 | ||
| 166 | - "yylc": 0, // 营运里程 | ||
| 167 | - "kslc": 0, // 空驶里程 | ||
| 168 | - "zgs": 0, // 总工时 | ||
| 169 | - "zbc": 0, // 总班次 | ||
| 170 | - "yygs": 0, // 营运工时 | ||
| 171 | - "yybc": 0, // 营运班次 | ||
| 172 | - "stationRouteId1": 0, // 第一个班次起点站路由id | ||
| 173 | - "stationRouteId2": 0 // 第二个班次起点站路由id | ||
| 174 | - }; | ||
| 175 | - | ||
| 176 | - // 将报到班次,进出场班次加到班次的时间上 | ||
| 177 | - var iBcChainCount; | ||
| 178 | - var oStartBc; | ||
| 179 | - var oEndBc; | ||
| 180 | - var oTempBc; | ||
| 181 | - var aFcsj = []; | ||
| 182 | - | ||
| 183 | - iBcChainCount = oInternalLp.fnGetBcChainCount(); | ||
| 184 | - if (iBcChainCount == 1) { // 单一车次链,连班班型 | ||
| 185 | - oStartBc = oInternalLp.getBc( | ||
| 186 | - oInternalLp.fnGetBcChainInfo(0)["s_q"], | ||
| 187 | - oInternalLp.fnGetBcChainInfo(0)["s_b"] | ||
| 188 | - ); | ||
| 189 | - oTempBc = _factory.createBcObj( | ||
| 190 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 191 | - oStartBc.getFcTimeObj(), | ||
| 192 | - _paramObj | ||
| 193 | - ); | ||
| 194 | - aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 195 | - oLp.bcObjList.push({ // 报到班次 | ||
| 196 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 197 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 198 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 199 | - | ||
| 200 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 201 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 202 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 203 | - | ||
| 204 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 205 | - "isFb": false, // 是否分班 | ||
| 206 | - | ||
| 207 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 208 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 209 | - | ||
| 210 | - "groupNo": -1, // 第几圈 | ||
| 211 | - "groupBcNo": -1 // 圈里第几个班次 | ||
| 212 | - | ||
| 213 | - }); | ||
| 214 | - | ||
| 215 | - oTempBc = _factory.createBcObj( | ||
| 216 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 217 | - oStartBc.getFcTimeObj(), | ||
| 218 | - _paramObj | ||
| 219 | - ); | ||
| 220 | - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 221 | - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 222 | - oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 223 | - | ||
| 224 | - oLp.bcObjList.push({ // 出场班次 | ||
| 225 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 226 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 227 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 228 | - | ||
| 229 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 230 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 231 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 232 | - | ||
| 233 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 234 | - "isFb": false, // 是否分班 | ||
| 235 | - | ||
| 236 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 237 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 238 | - | ||
| 239 | - "groupNo": -1, // 第几圈 | ||
| 240 | - "groupBcNo": -2 // 圈里第几个班次 | ||
| 241 | - | ||
| 242 | - }); | ||
| 243 | - | ||
| 244 | - aFcsj = []; | ||
| 245 | - | ||
| 246 | - oEndBc = oInternalLp.getBc( | ||
| 247 | - oInternalLp.fnGetBcChainInfo(0)["e_q"], | ||
| 248 | - oInternalLp.fnGetBcChainInfo(0)["e_b"] | ||
| 249 | - ); | ||
| 250 | - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 251 | - oTempBc = _factory.createBcObj( | ||
| 252 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 253 | - oEndBc.getArrTimeObj(), | ||
| 254 | - _paramObj | ||
| 255 | - ); | ||
| 256 | - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 257 | - | ||
| 258 | - oLp.bcObjList.push({ // 进场班次 | ||
| 259 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 260 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 261 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 262 | - | ||
| 263 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 264 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 265 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 266 | - | ||
| 267 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 268 | - "isFb": false, // 是否分班 | ||
| 269 | - | ||
| 270 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 271 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 272 | - | ||
| 273 | - "groupNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? | ||
| 274 | - oInternalLp.fnGetBcChainInfo(0)["e_q"] : | ||
| 275 | - oInternalLp.fnGetBcChainInfo(0)["e_q"] + 1, // 第几圈 | ||
| 276 | - "groupBcNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 277 | - | ||
| 278 | - }); | ||
| 279 | - | ||
| 280 | - oTempBc = _factory.createBcObj( | ||
| 281 | - oLp, "lc", !oEndBc.isUp(), 1, | ||
| 282 | - oEndBc.getArrTimeObj(), | ||
| 283 | - _paramObj | ||
| 284 | - ); | ||
| 285 | - aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 286 | - oLp.bcObjList.push({ // 离场班次 | ||
| 287 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 288 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 289 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 290 | - | ||
| 291 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 292 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 293 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 294 | - | ||
| 295 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 296 | - "isFb": false, // 是否分班 | ||
| 297 | - | ||
| 298 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 299 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 300 | - | ||
| 301 | - "groupNo": -2, // 第几圈 | ||
| 302 | - "groupBcNo": -4 // 圈里第几个班次 | ||
| 303 | - | ||
| 304 | - }); | ||
| 305 | - | ||
| 306 | - oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 307 | - | ||
| 308 | - } else if (iBcChainCount == 2) { // 两个车次链,分班班型 | ||
| 309 | - oStartBc = oInternalLp.getBc( | ||
| 310 | - oInternalLp.fnGetBcChainInfo(0)["s_q"], | ||
| 311 | - oInternalLp.fnGetBcChainInfo(0)["s_b"] | ||
| 312 | - ); | ||
| 313 | - oTempBc = _factory.createBcObj( | ||
| 314 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 315 | - oStartBc.getFcTimeObj(), | ||
| 316 | - _paramObj | ||
| 317 | - ); | ||
| 318 | - aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 319 | - oLp.bcObjList.push({ // 报到班次 | ||
| 320 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 321 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 322 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 323 | - | ||
| 324 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 325 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 326 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 327 | - | ||
| 328 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 329 | - "isFb": false, // 是否分班 | ||
| 330 | - | ||
| 331 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 332 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 333 | - | ||
| 334 | - "groupNo": -1, // 第几圈 | ||
| 335 | - "groupBcNo": -1 // 圈里第几个班次 | ||
| 336 | - | ||
| 337 | - }); | ||
| 338 | - | ||
| 339 | - oTempBc = _factory.createBcObj( | ||
| 340 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 341 | - oStartBc.getFcTimeObj(), | ||
| 342 | - _paramObj | ||
| 343 | - ); | ||
| 344 | - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 345 | - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 346 | - oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 347 | - | ||
| 348 | - oLp.bcObjList.push({ // 出场班次 | ||
| 349 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 350 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 351 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 352 | - | ||
| 353 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 354 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 355 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 356 | - | ||
| 357 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 358 | - "isFb": false, // 是否分班 | ||
| 359 | - | ||
| 360 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 361 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 362 | - | ||
| 363 | - "groupNo": -1, // 第几圈 | ||
| 364 | - "groupBcNo": -2 // 圈里第几个班次 | ||
| 365 | - | ||
| 366 | - }); | ||
| 367 | - | ||
| 368 | - aFcsj = []; | ||
| 369 | - | ||
| 370 | - oEndBc = oInternalLp.getBc( | ||
| 371 | - oInternalLp.fnGetBcChainInfo(0)["e_q"], | ||
| 372 | - oInternalLp.fnGetBcChainInfo(0)["e_b"] | ||
| 373 | - ); | ||
| 374 | - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 375 | - oTempBc = _factory.createBcObj( | ||
| 376 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 377 | - oEndBc.getArrTimeObj(), | ||
| 378 | - _paramObj | ||
| 379 | - ); | ||
| 380 | - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 381 | - oLp.bcObjList.push({ // 进场班次 | ||
| 382 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 383 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 384 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 385 | - | ||
| 386 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 387 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 388 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 389 | - | ||
| 390 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 391 | - "isFb": true, // 是否分班 | ||
| 392 | - | ||
| 393 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 394 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 395 | - | ||
| 396 | - "groupNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? | ||
| 397 | - oInternalLp.fnGetBcChainInfo(0)["e_q"] : | ||
| 398 | - oInternalLp.fnGetBcChainInfo(0)["e_q"] + 1, // 第几圈 | ||
| 399 | - "groupBcNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 400 | - | ||
| 401 | - }); | ||
| 402 | - oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 403 | - | ||
| 404 | - aFcsj = []; | ||
| 405 | - | ||
| 406 | - oStartBc = oInternalLp.getBc( | ||
| 407 | - oInternalLp.fnGetBcChainInfo(1)["s_q"], | ||
| 408 | - oInternalLp.fnGetBcChainInfo(1)["s_b"] | ||
| 409 | - ); | ||
| 410 | - oTempBc = _factory.createBcObj( | ||
| 411 | - oLp, "bd", oStartBc.isUp(), 1, | ||
| 412 | - oStartBc.getFcTimeObj(), | ||
| 413 | - _paramObj | ||
| 414 | - ); | ||
| 415 | - aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 416 | - oLp.bcObjList.push({ // 报到班次 | ||
| 417 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 418 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 419 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 420 | - | ||
| 421 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 422 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 423 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 424 | - | ||
| 425 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 426 | - "isFb": true, // 是否分班 | ||
| 427 | - | ||
| 428 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 429 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 430 | - | ||
| 431 | - "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1, // 第几圈 | ||
| 432 | - "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] // 圈里第几个班次 | ||
| 433 | - | ||
| 434 | - }); | ||
| 435 | - | ||
| 436 | - oTempBc = _factory.createBcObj( | ||
| 437 | - oLp, "out", oStartBc.isUp(), 1, | ||
| 438 | - oStartBc.getFcTimeObj(), | ||
| 439 | - _paramObj | ||
| 440 | - ); | ||
| 441 | - oLp.bcObjList.push({ // 出场班次 | ||
| 442 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 443 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 444 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 445 | - | ||
| 446 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 447 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 448 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 449 | - | ||
| 450 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 451 | - "isFb": true, // 是否分班 | ||
| 452 | - | ||
| 453 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 454 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 455 | - | ||
| 456 | - "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ? | ||
| 457 | - oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1 : | ||
| 458 | - oInternalLp.fnGetBcChainInfo(1)["s_q"], // 第几圈 | ||
| 459 | - "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 460 | - | ||
| 461 | - }); | ||
| 462 | - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 463 | - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 464 | - oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 465 | - | ||
| 466 | - aFcsj = []; | ||
| 467 | - | ||
| 468 | - oEndBc = oInternalLp.getBc( | ||
| 469 | - oInternalLp.fnGetBcChainInfo(1)["e_q"], | ||
| 470 | - oInternalLp.fnGetBcChainInfo(1)["e_b"] | ||
| 471 | - ); | ||
| 472 | - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 473 | - oTempBc = _factory.createBcObj( | ||
| 474 | - oLp, "in", !oEndBc.isUp(), 1, | ||
| 475 | - oEndBc.getArrTimeObj(), | ||
| 476 | - _paramObj | ||
| 477 | - ); | ||
| 478 | - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 479 | - | ||
| 480 | - oLp.bcObjList.push({ // 进场班次 | ||
| 481 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 482 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 483 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 484 | - | ||
| 485 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 486 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 487 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 488 | - | ||
| 489 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 490 | - "isFb": false, // 是否分班 | ||
| 491 | - | ||
| 492 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 493 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 494 | - | ||
| 495 | - "groupNo": oInternalLp.fnGetBcChainInfo(1)["e_b"] == 0 ? | ||
| 496 | - oInternalLp.fnGetBcChainInfo(1)["e_q"] : | ||
| 497 | - oInternalLp.fnGetBcChainInfo(1)["e_q"] + 1, // 第几圈 | ||
| 498 | - "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 499 | - | ||
| 500 | - }); | ||
| 501 | - | ||
| 502 | - oTempBc = _factory.createBcObj( | ||
| 503 | - oLp, "lc", !oEndBc.isUp(), 1, | ||
| 504 | - oEndBc.getArrTimeObj(), | ||
| 505 | - _paramObj | ||
| 506 | - ); | ||
| 507 | - | ||
| 508 | - oLp.bcObjList.push({ // 离场班次 | ||
| 509 | - "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 510 | - "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 511 | - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 512 | - | ||
| 513 | - "tccid": oTempBc._$_tccid, // 停车场id | ||
| 514 | - "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 515 | - "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 516 | - | ||
| 517 | - "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 518 | - "isFb": false, // 是否分班 | ||
| 519 | - | ||
| 520 | - "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 521 | - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 522 | - | ||
| 523 | - "groupNo": -2, // 第几圈 | ||
| 524 | - "groupBcNo": -4 // 圈里第几个班次 | ||
| 525 | - | ||
| 526 | - }); | ||
| 527 | - | ||
| 528 | - aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 529 | - oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 530 | - | ||
| 531 | - } | ||
| 532 | - | ||
| 533 | - for (j = 0; j < oInternalLp.fnGetGroupCount(); j++) { | ||
| 534 | - for (z = 0; z < 2; z++) { | ||
| 535 | - oInternalBc = oInternalLp.getBc(j, z); | ||
| 536 | - if (oInternalBc) { | ||
| 537 | - if (oInternalBc.fnGetEatTime() > 0) { | ||
| 538 | - // 吃饭班次是下一个班次开始吃,和本班次方向相反 | ||
| 539 | - oInternalBc_temp = oInternalLp.getBc( | ||
| 540 | - z == 1 ? j + 1 : j, | ||
| 541 | - z == 1 ? 0 : 1); | ||
| 542 | - | ||
| 543 | - oInternalBc_temp._$_isRealEat = true; | ||
| 544 | - oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")"; | ||
| 545 | - } | ||
| 546 | - | ||
| 547 | - oLp.bcObjList.push({ | ||
| 548 | - "bcsj": oInternalBc.getBcTime(), // 班次时间 | ||
| 549 | - "ssj": oInternalBc.getStopTime(), // 停站时间 | ||
| 550 | - "eatsj": oInternalBc.fnGetEatTime(), // 吃饭时间 | ||
| 551 | - | ||
| 552 | - "tccid": oInternalBc._$_tccid, // 停车场id | ||
| 553 | - "qdzid": oInternalBc._$_qdzid, // 起点站id | ||
| 554 | - "zdzid": oInternalBc._$_zdzid, // 终点站id | ||
| 555 | - | ||
| 556 | - "isUp": oInternalBc._$_isUp, // 是否上行 | ||
| 557 | - | ||
| 558 | - "bcType": oInternalBc._$_bcType, // 班次类型 | ||
| 559 | - "fcsj": oInternalBc._$_isRealEat ? | ||
| 560 | - ("*" + oInternalBc._$_fcsjObj.format("HH:mm")) : | ||
| 561 | - oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 562 | - "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"), | ||
| 563 | - | ||
| 564 | - "groupNo": j, // 第几圈 | ||
| 565 | - "groupBcNo": z // 圈里第几个班次 | ||
| 566 | - | ||
| 567 | - }); | ||
| 568 | - | ||
| 569 | - // iZlc = 0; | ||
| 570 | - // iYylc = 0; | ||
| 571 | - // iKslc = 0; | ||
| 572 | - // iZgs = 0; | ||
| 573 | - // iZbc = 0; | ||
| 574 | - // iYygs = 0; | ||
| 575 | - // iYybc = 0; | ||
| 576 | - | ||
| 577 | - iZlc = iZlc + | ||
| 578 | - oInternalBc._$_bclc; // 里程 | ||
| 579 | - iYylc = iYylc + | ||
| 580 | - oInternalBc._$_bclc; // 里程 | ||
| 581 | - iYygs = iYygs + | ||
| 582 | - oInternalBc.getBcTime() + // 班次时间 | ||
| 583 | - oInternalBc.getStopTime() + // 停站时间 | ||
| 584 | - oInternalBc.fnGetEatTime(); // 吃饭时间 | ||
| 585 | - iYybc = iYybc + 1; | ||
| 586 | - | ||
| 587 | - iZgs = iZgs + | ||
| 588 | - oInternalBc.getBcTime() + // 班次时间 | ||
| 589 | - oInternalBc.getStopTime() + // 停站时间 | ||
| 590 | - oInternalBc.fnGetEatTime(); // 吃饭时间 | ||
| 591 | - iZbc = iZbc + 1; | ||
| 592 | - | ||
| 593 | - // 设置圈站点路由id | ||
| 594 | - if (oInternalBc.isUp() == oInternalLp.isUp()) { // 第一个班次 | ||
| 595 | - if (oLp.stationRouteId1 == 0) { | ||
| 596 | - oLp.stationRouteId1 = oInternalBc._$_qdzid; | ||
| 597 | - } | ||
| 598 | - } else { // 第二个班次 | ||
| 599 | - if (oLp.stationRouteId2 == 0) { | ||
| 600 | - oLp.stationRouteId2 = oInternalBc._$_qdzid; | ||
| 601 | - } | ||
| 602 | - } | ||
| 603 | - | ||
| 604 | - } | ||
| 605 | - } | ||
| 606 | - | ||
| 607 | - } | ||
| 608 | - | ||
| 609 | - for (z = 0; z < oInternalLp.getOtherBcArray().length; z++) { | ||
| 610 | - oInternalBc = oInternalLp.getOtherBcArray()[z]; | ||
| 611 | - iKslc = iKslc + | ||
| 612 | - oInternalBc._$_bclc; // 里程 | ||
| 613 | - iZlc = iZlc + | ||
| 614 | - oInternalBc._$_bclc; // 里程 | ||
| 615 | - iZgs = iZgs + | ||
| 616 | - oInternalBc.getBcTime() + // 班次时间 | ||
| 617 | - oInternalBc.getStopTime(); // 停站时间 | ||
| 618 | - if (oInternalBc._$_bcType != "bd" && | ||
| 619 | - oInternalBc._$_bcType != "lc" && | ||
| 620 | - oInternalBc._$_bcType != "cf") { | ||
| 621 | - iZbc = iZbc + 1; | ||
| 622 | - } | ||
| 623 | - } | ||
| 624 | - | ||
| 625 | - oLp.zlc = iZlc; | ||
| 626 | - oLp.yylc = iYylc; | ||
| 627 | - oLp.kslc = iKslc; | ||
| 628 | - oLp.zgs = iZgs; | ||
| 629 | - oLp.zbc = iZbc; | ||
| 630 | - oLp.yygs = iYygs; | ||
| 631 | - oLp.yybc = iYybc; | ||
| 632 | - aLpObj.push(oLp); | ||
| 633 | - } | ||
| 634 | - | ||
| 635 | - return aLpObj; | ||
| 636 | - }; | ||
| 637 | - | ||
| 638 | - var _funCalcuExportData_statInfoList = function(aInternalLpObj) { | ||
| 639 | - var countBc = 0, // 总班次 | ||
| 640 | - serviceBc = 0, // 营运班次 | ||
| 641 | - jcbc = 0, // 进场总班次. | ||
| 642 | - ccbc = 0, // 出场总班次. | ||
| 643 | - cfbc = 0, // 吃饭总班次. | ||
| 644 | - zwlbbc = 0, // 早晚例保总班次. | ||
| 645 | - countGs = 0.0, // 总工时 | ||
| 646 | - servicesj = 0, // 营运班次总时间 | ||
| 647 | - jcsj = 0.0, // 进场总时间. | ||
| 648 | - ccsj = 0.0, // 出场总时间. | ||
| 649 | - cfsj = 0.0, // 吃饭总时间. | ||
| 650 | - zwlbsj = 0.0, // 早晚例保总时间. | ||
| 651 | - ksBc = 0, // 空驶班次 | ||
| 652 | - serviceLc = 0.0, // 营运里程 | ||
| 653 | - ksLc = 0.0, // 空驶里程 | ||
| 654 | - avgTzjx = 0.0, // 平均停站间隙 | ||
| 655 | - gfServiceBc = 0, // 高峰营运班次 | ||
| 656 | - dgServiceBc = 0, // 低谷营运班次 | ||
| 657 | - gfAvgTzjx = 0.0, // 高峰平均停站间隙 | ||
| 658 | - dgAvgTzjx = 0.0; // 低谷平均停站间隙 | ||
| 659 | - | ||
| 660 | - var aAllBc = []; | ||
| 661 | - var oLp; | ||
| 662 | - var oBc; | ||
| 663 | - var i; | ||
| 664 | - var j; | ||
| 665 | - | ||
| 666 | - for (i = 0; i < aInternalLpObj.length; i++) { | ||
| 667 | - oLp = aInternalLpObj[i]; | ||
| 668 | - for (j = 0; j < oLp.getBcArray().length; j++) { | ||
| 669 | - aAllBc.push(oLp.getBcArray()[j]); | ||
| 670 | - } | ||
| 671 | - for (j = 0; j < oLp.getOtherBcArray().length; j++) { | ||
| 672 | - aAllBc.push(oLp.getOtherBcArray()[j]); | ||
| 673 | - } | ||
| 674 | - } | ||
| 675 | - | ||
| 676 | - for (i = 0; i < aAllBc.length; i++) { | ||
| 677 | - oBc = aAllBc[i]; | ||
| 678 | - | ||
| 679 | - if (oBc.getBcTime() > 0) { | ||
| 680 | - countBc = countBc + 1; | ||
| 681 | - countGs = countGs + oBc.getStopTime() + oBc.getBcTime(); | ||
| 682 | - if (_paramObj.isTroughBc(oBc.getFcTimeObj())) { | ||
| 683 | - if (oBc._$_bcType == "normal") { | ||
| 684 | - dgServiceBc = dgServiceBc + 1; | ||
| 685 | - dgAvgTzjx = dgAvgTzjx + oBc.getStopTime(); | ||
| 686 | - } | ||
| 687 | - } else { | ||
| 688 | - if (oBc._$_bcType == "normal") { | ||
| 689 | - gfServiceBc = gfServiceBc + 1; | ||
| 690 | - gfAvgTzjx = gfAvgTzjx + oBc.getStopTime(); | ||
| 691 | - } | ||
| 692 | - } | ||
| 693 | - | ||
| 694 | - if (oBc._$_bcType == "normal") { | ||
| 695 | - serviceBc = serviceBc + 1; | ||
| 696 | - serviceLc = serviceLc + oBc._$_bclc; | ||
| 697 | - servicesj = servicesj + oBc.getBcTime(); | ||
| 698 | - avgTzjx = avgTzjx + oBc.getStopTime(); | ||
| 699 | - | ||
| 700 | - if (oBc.fnGetEatTime() > 0) { | ||
| 701 | - cfbc = cfbc + 1; | ||
| 702 | - cfsj = cfsj + oBc.fnGetEatTime(); | ||
| 703 | - } | ||
| 704 | - } else if (oBc._$_bcType == "in") { | ||
| 705 | - jcbc = jcbc + 1; | ||
| 706 | - jcsj = jcsj + oBc.getBcTime(); | ||
| 707 | - } else if (oBc._$_bcType == "out") { | ||
| 708 | - ccbc = ccbc + 1; | ||
| 709 | - ccsj = ccsj + oBc.getBcTime(); | ||
| 710 | - } else if (oBc._$_bcType == "bd") { | ||
| 711 | - zwlbbc = zwlbbc + 1; | ||
| 712 | - zwlbsj = zwlbsj + oBc.getBcTime(); | ||
| 713 | - } else if (oBc._$_bcType == "lc") { | ||
| 714 | - zwlbbc = zwlbbc + 1; | ||
| 715 | - zwlbsj = zwlbsj + oBc.getBcTime(); | ||
| 716 | - } | ||
| 717 | - } | ||
| 718 | - } | ||
| 719 | - | ||
| 720 | - dgAvgTzjx = dgAvgTzjx / dgServiceBc; | ||
| 721 | - gfAvgTzjx = gfAvgTzjx / gfServiceBc; | ||
| 722 | - avgTzjx = avgTzjx / dgServiceBc; | ||
| 723 | - | ||
| 724 | - return [ | ||
| 725 | - {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc}, | ||
| 726 | - {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc}, | ||
| 727 | - {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc}, | ||
| 728 | - {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc}, | ||
| 729 | - {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc}, | ||
| 730 | - {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc}, | ||
| 731 | - {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60}, | ||
| 732 | - {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60}, | ||
| 733 | - {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60}, | ||
| 734 | - {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60}, | ||
| 735 | - {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60}, | ||
| 736 | - {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60}, | ||
| 737 | - {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc}, | ||
| 738 | - {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc}, | ||
| 739 | - {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc}, | ||
| 740 | - {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx}, | ||
| 741 | - {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc}, | ||
| 742 | - {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc}, | ||
| 743 | - {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx}, | ||
| 744 | - {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx}, | ||
| 745 | - {'statItem': '综合评估', 'statValue': 3} | ||
| 746 | - ]; | ||
| 747 | - | ||
| 748 | - }; | ||
| 749 | - | ||
| 750 | - var __funCalcuExportData_paramInfoList = function() { | ||
| 751 | - return [ | ||
| 752 | - {'paramItem' : '上行首班时间', 'paramValue' : _paramObj.getUpFirstDTimeObj().format("HH:mm")}, | ||
| 753 | - {'paramItem' : '上行末班时间', 'paramValue' : _paramObj.getUpLastDtimeObj().format("HH:mm")}, | ||
| 754 | - {'paramItem' : '下行首班时间', 'paramValue' : _paramObj.getDownFirstDTimeObj().format("HH:mm")}, | ||
| 755 | - {'paramItem' : '下行末班时间', 'paramValue' : _paramObj.getDownLastDTimeObj().format("HH:mm")}, | ||
| 756 | - {'paramItem' : '早高峰开始时间', 'paramValue' : _paramObj.getMPeakStartTimeObj().format("HH:mm")}, | ||
| 757 | - {'paramItem' : '早高峰结束时间', 'paramValue' : _paramObj.getMPeakEndTimeObj().format("HH:mm")}, | ||
| 758 | - {'paramItem' : '晚高峰开始时间', 'paramValue' : _paramObj.getEPeakStartTimeObj().format("HH:mm")}, | ||
| 759 | - {'paramItem' : '晚高峰结束时间', 'paramValue' : _paramObj.getEPeakEndTimeObj().format("HH:mm")}, | ||
| 760 | - {'paramItem' : '上行进场时间', 'paramValue' : _paramObj.getUpInTime()}, | ||
| 761 | - {'paramItem' : '上行出场时间', 'paramValue' : _paramObj.getUpOutTime()}, | ||
| 762 | - {'paramItem' : '下行进场时间', 'paramValue' : _paramObj.getDownInTime()}, | ||
| 763 | - {'paramItem' : '下行出场时间', 'paramValue' : _paramObj.getDownOutTime()}, | ||
| 764 | - {'paramItem' : '早高峰上行时间', 'paramValue' : _paramObj.getUpMPeakTime()}, | ||
| 765 | - {'paramItem' : '早高峰下行时间', 'paramValue' : _paramObj.getDownMPeakTime()}, | ||
| 766 | - {'paramItem' : '晚高峰上行时间', 'paramValue' : _paramObj.getUpEPeakTime()}, | ||
| 767 | - {'paramItem' : '晚高峰下行时间', 'paramValue' : _paramObj.getDownEPeakTime()}, | ||
| 768 | - {'paramItem' : '低谷上行时间', 'paramValue' : _paramObj.getUpTroughTime()}, | ||
| 769 | - {'paramItem' : '低谷下行时间', 'paramValue' : _paramObj.getDownTroughTime()}, | ||
| 770 | - {'paramItem' : '线路规划类型', 'paramValue' : "双向"}, | ||
| 771 | - {'paramItem' : '吃饭地点', 'paramValue' : _paramObj.fnIsEat() ? (_paramObj.fnIsBothEat() ? "上下行" : (_paramObj.fnIsUpEat() ? "上行" : "下行")) : "不吃饭"}, | ||
| 772 | - {'paramItem' : '早晚例行保养', 'paramValue' : _paramObj.getLbTime()}, | ||
| 773 | - {'paramItem' : '停车场', 'paramValue' : _paramObj.getTccId()}, | ||
| 774 | - {'paramItem' : '工作餐午餐时间', 'paramValue' : _paramObj.fnGetLunchTime()}, | ||
| 775 | - {'paramItem' : '工作餐晚餐时间', 'paramValue' : _paramObj.fnGetDinnerTime()}, | ||
| 776 | - {'paramItem' : '早高峰发车间隔', 'paramValue' : "[" + _paramObj.getMPeakMinFcjx() + "," + _paramObj.getMPeakMaxFcjx() + "]"}, | ||
| 777 | - {'paramItem' : '晚高峰发车间隔', 'paramValue' : "[" + _paramObj.getEPeakMinFcjx() + "," + _paramObj.getEPeakMaxFcjx() + "]"}, | ||
| 778 | - {'paramItem' : '低谷发车间隔', 'paramValue' : "[" + _paramObj.getTroughMinFcjx() + "," + _paramObj.getTroughMaxFcjx() + "]"}, | ||
| 779 | - {'paramItem' : '建议加班路牌数', 'paramValue' : _paramObj.getJBLpes()}, | ||
| 780 | - {'paramItem' : '停站类型', 'paramValue' : _paramObj.isTwoWayStop() ? "双向停站" : (_paramObj.isUpOneWayStop() ? "上行主站" : "下行主站") }, | ||
| 781 | - {'paramItem' : '建议高峰配车数', 'paramValue' : _paramObj.getAdvicePeakClzs()} | ||
| 782 | - ] | ||
| 783 | - }; | ||
| 784 | - | ||
| 785 | - return { | ||
| 786 | - /** | ||
| 787 | - * 工厂对象,创建不同的对象。 | ||
| 788 | - * @returns {{createParameterObj, createBcObj}} | ||
| 789 | - */ | ||
| 790 | - getFactory: function() { | ||
| 791 | - return _factory; | ||
| 792 | - }, | ||
| 793 | - | ||
| 794 | - /** | ||
| 795 | - * 使用发车间隔策略生成时刻表。 | ||
| 796 | - * @param paramObj 参数对象 | ||
| 797 | - * @param lpArray 路牌数组 | ||
| 798 | - * @constructor | ||
| 799 | - */ | ||
| 800 | - BXPplaceClassesTime03 : function(paramObj, lpArray) { | ||
| 801 | - // 参数对象 | ||
| 802 | - _paramObj = paramObj; | ||
| 803 | - | ||
| 804 | - // 1、初始化行车计划 | ||
| 805 | - var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); | ||
| 806 | - schedule.fnInitDataWithBxLayout(); | ||
| 807 | - // 2、将连班路牌的班次补足 | ||
| 808 | - schedule.fnCalcuLpBx_lb(); | ||
| 809 | - | ||
| 810 | - // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除 | ||
| 811 | - schedule.fnAdjustGfbc(true, true); // 修正上行早高峰 | ||
| 812 | - schedule.fnAdjustGfbc(true, false); // 修正下行早高峰 | ||
| 813 | - schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰 | ||
| 814 | - schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰 | ||
| 815 | - | ||
| 816 | - // 6、补吃饭班次 | ||
| 817 | - schedule.fnCalcuEatBc(); | ||
| 818 | - | ||
| 819 | - // 4、按照车辆投入运营要求补充班次 | ||
| 820 | - schedule.fnCalcuLpBc_yy(); | ||
| 821 | - | ||
| 822 | - // 5、根据班型补充所有的不足班次 | ||
| 823 | - schedule.fnCalcuLpBx_5_2(); | ||
| 824 | - schedule.fnCalcuLpBx_other(); | ||
| 825 | - | ||
| 826 | - // 7、祛除上标线开头有删除标记的班次 | ||
| 827 | - schedule.fnRemoveDelFirstFlagBc(); | ||
| 828 | - | ||
| 829 | - // 8、调整路牌班次间隔(使用平均停站时间) | ||
| 830 | - schedule.fnAdjustLpBcInterval(1); | ||
| 831 | - | ||
| 832 | - // 9、调整班次发车间隔 | ||
| 833 | - schedule.fnAdjustBcInterval(false); | ||
| 834 | - | ||
| 835 | - // 10、确定末班车 | ||
| 836 | - schedule.fnCalcuLastBc(); | ||
| 837 | - | ||
| 838 | - // 11、祛除上标线结尾有删除标记的班次 | ||
| 839 | - schedule.fnRemoveDelLastFlagBc(); | ||
| 840 | - | ||
| 841 | - // TODO:12、平均化指定时间后的班次列表间隔 | ||
| 842 | - // // schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50")); | ||
| 843 | - // // schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50")); | ||
| 844 | - // | ||
| 845 | - // 10、补进出场例保班次 | ||
| 846 | - schedule.fnCalcuOtherBc(); | ||
| 847 | - | ||
| 848 | - //-------------------- 输出ganut图上的班次,班型描述 ----------------------// | ||
| 849 | - // TODO:班型再议 | ||
| 850 | - return { | ||
| 851 | - 'json':schedule.fnToGanttBcArray(),'bxrcgs':null, | ||
| 852 | - 'aInternalLpObj': schedule.fnGetLpArray() | ||
| 853 | - }; | ||
| 854 | - | ||
| 855 | - }, | ||
| 856 | - /** | ||
| 857 | - * 导出时刻表配置。 | ||
| 858 | - * @param aInternalLpObj 内部路牌对象列表 | ||
| 859 | - */ | ||
| 860 | - exportDataConfig: function(aInternalLpObj) { | ||
| 861 | - $('.exportAddXls').off('click'); | ||
| 862 | - $('.exportAddXlsx').off('click'); | ||
| 863 | - | ||
| 864 | - $('.exportAddXls').on('click', function() { | ||
| 865 | - var aInfos = { | ||
| 866 | - "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | ||
| 867 | - "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 | ||
| 868 | - "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 869 | - }; | ||
| 870 | - | ||
| 871 | - console.log(aInfos); | ||
| 872 | - | ||
| 873 | - $(".exportAdd").addClass("disabled"); | ||
| 874 | - $(".exportAddSpan").html("正在导出..."); | ||
| 875 | - | ||
| 876 | - // 提交 | ||
| 877 | - $.ajax({ | ||
| 878 | - type: 'POST', | ||
| 879 | - url: "/tidc/exportDTDFile/xls", | ||
| 880 | - dataType: 'binary', | ||
| 881 | - contentType: "application/json", | ||
| 882 | - data: JSON.stringify(aInfos), | ||
| 883 | - success: function(data){ | ||
| 884 | - Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); | ||
| 885 | - | ||
| 886 | - $(".exportAdd").removeClass("disabled"); | ||
| 887 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 888 | - }, | ||
| 889 | - error: function(xhr, type){ | ||
| 890 | - alert('错误:TODO'); | ||
| 891 | - | ||
| 892 | - $(".exportAdd").removeClass("disabled"); | ||
| 893 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 894 | - } | ||
| 895 | - }); | ||
| 896 | - }); | ||
| 897 | - | ||
| 898 | - $('.exportAddXlsx').on('click', function() { | ||
| 899 | - var aInfos = { | ||
| 900 | - "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | ||
| 901 | - "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 | ||
| 902 | - "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 903 | - }; | ||
| 904 | - | ||
| 905 | - console.log(aInfos); | ||
| 906 | - | ||
| 907 | - $(".exportAdd").addClass("disabled"); | ||
| 908 | - $(".exportAddSpan").html("正在导出..."); | ||
| 909 | - | ||
| 910 | - // 提交 | ||
| 911 | - $.ajax({ | ||
| 912 | - type: 'POST', | ||
| 913 | - url: "/tidc/exportDTDFile/xlsx", | ||
| 914 | - dataType: 'binary', | ||
| 915 | - contentType: "application/json", | ||
| 916 | - data: JSON.stringify(aInfos), | ||
| 917 | - success: function(data){ | ||
| 918 | - Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx"); | ||
| 919 | - | ||
| 920 | - $(".exportAdd").removeClass("disabled"); | ||
| 921 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 922 | - }, | ||
| 923 | - error: function(xhr, type){ | ||
| 924 | - alert('错误:TODO'); | ||
| 925 | - | ||
| 926 | - $(".exportAdd").removeClass("disabled"); | ||
| 927 | - $(".exportAddSpan").html(" 导出数据"); | ||
| 928 | - } | ||
| 929 | - }); | ||
| 930 | - }); | ||
| 931 | - }, | ||
| 932 | - | ||
| 933 | - downloadFile: function (data, mimeType, fileName) { | ||
| 934 | - var success = false; | ||
| 935 | - var blob = new Blob([data], { type: mimeType }); | ||
| 936 | - try { | ||
| 937 | - if (navigator.msSaveBlob) | ||
| 938 | - navigator.msSaveBlob(blob, fileName); | ||
| 939 | - else { | ||
| 940 | - // Try using other saveBlob implementations, if available | ||
| 941 | - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | ||
| 942 | - if (saveBlob === undefined) throw "Not supported"; | ||
| 943 | - saveBlob(blob, fileName); | ||
| 944 | - } | ||
| 945 | - success = true; | ||
| 946 | - } catch (ex) { | ||
| 947 | - console.log("saveBlob method failed with the following exception:"); | ||
| 948 | - console.log(ex); | ||
| 949 | - } | ||
| 950 | - | ||
| 951 | - if (!success) { | ||
| 952 | - // Get the blob url creator | ||
| 953 | - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | ||
| 954 | - if (urlCreator) { | ||
| 955 | - // Try to use a download link | ||
| 956 | - var link = document.createElement('a'); | ||
| 957 | - if ('download' in link) { | ||
| 958 | - // Try to simulate a click | ||
| 959 | - try { | ||
| 960 | - // Prepare a blob URL | ||
| 961 | - var url = urlCreator.createObjectURL(blob); | ||
| 962 | - link.setAttribute('href', url); | ||
| 963 | - | ||
| 964 | - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | ||
| 965 | - link.setAttribute("download", fileName); | ||
| 966 | - | ||
| 967 | - // Simulate clicking the download link | ||
| 968 | - var event = document.createEvent('MouseEvents'); | ||
| 969 | - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
| 970 | - link.dispatchEvent(event); | ||
| 971 | - success = true; | ||
| 972 | - | ||
| 973 | - } catch (ex) { | ||
| 974 | - console.log("Download link method with simulated click failed with the following exception:"); | ||
| 975 | - console.log(ex); | ||
| 976 | - } | ||
| 977 | - } | ||
| 978 | - | ||
| 979 | - if (!success) { | ||
| 980 | - // Fallback to window.location method | ||
| 981 | - try { | ||
| 982 | - // Prepare a blob URL | ||
| 983 | - // Use application/octet-stream when using window.location to force download | ||
| 984 | - var url = urlCreator.createObjectURL(blob); | ||
| 985 | - window.location = url; | ||
| 986 | - console.log("Download link method with window.location succeeded"); | ||
| 987 | - success = true; | ||
| 988 | - } catch (ex) { | ||
| 989 | - console.log("Download link method with window.location failed with the following exception:"); | ||
| 990 | - console.log(ex); | ||
| 991 | - } | ||
| 992 | - } | ||
| 993 | - } | ||
| 994 | - } | ||
| 995 | - | ||
| 996 | - if (!success) { | ||
| 997 | - // Fallback to window.open method | ||
| 998 | - console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | ||
| 999 | - window.open("", '_blank', ''); | ||
| 1000 | - } | ||
| 1001 | - } | ||
| 1002 | - | ||
| 1003 | - }; | ||
| 1004 | - | ||
| 1005 | -}(); | ||
| 1006 | - | ||
| 1007 | - | 1 | +/** |
| 2 | + * 主类。 | ||
| 3 | + */ | ||
| 4 | +var Main_v2 = function() { | ||
| 5 | + | ||
| 6 | + // 内部工厂类 | ||
| 7 | + var _factoryFun = function() { | ||
| 8 | + return { | ||
| 9 | + // 创建参数 | ||
| 10 | + createParameterObj: function(formMap, dataMap) { | ||
| 11 | + var paramObj = ParameterObj(); | ||
| 12 | + paramObj.wrap(formMap, dataMap); | ||
| 13 | + return paramObj; | ||
| 14 | + }, | ||
| 15 | + // 创建班次对象 | ||
| 16 | + createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) { | ||
| 17 | + var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType); | ||
| 18 | + var _fcsj = fcTimeObj; | ||
| 19 | + var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); | ||
| 20 | + var _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 21 | + //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); | ||
| 22 | + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, isUp, paramObj.calcuTravelTime(_fcsj, isUp)); | ||
| 23 | + var _tccid = paramObj.getTTinfoId(); | ||
| 24 | + var _ttinfoid = paramObj.getTTinfoId(); | ||
| 25 | + var _xl = paramObj.getXlId(); | ||
| 26 | + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id; | ||
| 27 | + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id; | ||
| 28 | + | ||
| 29 | + if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间 | ||
| 30 | + if (isUp) { // 上行 | ||
| 31 | + _fcsj = paramObj.addMinute( | ||
| 32 | + _fcsj, | ||
| 33 | + -(paramObj.getUpOutTime() + paramObj.getLbTime())); | ||
| 34 | + _bcsj = paramObj.getLbTime(); | ||
| 35 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 36 | + _stoptime = 0; | ||
| 37 | + } else { // 下行 | ||
| 38 | + _fcsj = paramObj.addMinute( | ||
| 39 | + _fcsj, | ||
| 40 | + -(paramObj.getDownOutTime() + paramObj.getLbTime())); | ||
| 41 | + _bcsj = paramObj.getLbTime(); | ||
| 42 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 43 | + _stoptime = 0; | ||
| 44 | + } | ||
| 45 | + } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间 | ||
| 46 | + if (isUp) { // 上行 | ||
| 47 | + _fcsj = paramObj.addMinute( | ||
| 48 | + _fcsj, | ||
| 49 | + paramObj.getUpInTime()); | ||
| 50 | + _bcsj = paramObj.getLbTime(); | ||
| 51 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 52 | + _stoptime = 0; | ||
| 53 | + } else { // 下行 | ||
| 54 | + _fcsj = paramObj.addMinute( | ||
| 55 | + _fcsj, | ||
| 56 | + paramObj.getDownInTime()); | ||
| 57 | + _bcsj = paramObj.getLbTime(); | ||
| 58 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 59 | + _stoptime = 0; | ||
| 60 | + } | ||
| 61 | + } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间 | ||
| 62 | + if (isUp) { // 上行 | ||
| 63 | + _fcsj = paramObj.addMinute( | ||
| 64 | + _fcsj, | ||
| 65 | + -paramObj.getUpOutTime()); | ||
| 66 | + _bcsj = paramObj.getUpOutTime(); | ||
| 67 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 68 | + _stoptime = 0; | ||
| 69 | + } else { // 下行 | ||
| 70 | + _fcsj = paramObj.addMinute( | ||
| 71 | + _fcsj, | ||
| 72 | + -paramObj.getDownOutTime()); | ||
| 73 | + _bcsj = paramObj.getDownOutTime(); | ||
| 74 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 75 | + _stoptime = 0; | ||
| 76 | + } | ||
| 77 | + } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间 | ||
| 78 | + if (isUp) { // 上行 | ||
| 79 | + _bcsj = paramObj.getUpInTime(); | ||
| 80 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 81 | + _stoptime = 0; | ||
| 82 | + } else { // 下行 | ||
| 83 | + _bcsj = paramObj.getDownInTime(); | ||
| 84 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 85 | + _stoptime = 0; | ||
| 86 | + } | ||
| 87 | + } else if (bcType == "cf") { // 吃饭班次 | ||
| 88 | + // 以13:00为分界,之前的为午饭,之后的为晚饭 | ||
| 89 | + if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) { | ||
| 90 | + _bcsj = paramObj.fnGetLunchTime(); | ||
| 91 | + } else { | ||
| 92 | + _bcsj = paramObj.fnGetDinnerTime(); | ||
| 93 | + } | ||
| 94 | + _arrsj = paramObj.addMinute(_fcsj, _bcsj); | ||
| 95 | + _stoptime = 0; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + var bcParamObj = {}; | ||
| 99 | + bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等) | ||
| 100 | + bcParamObj.isUp = isUp; // boolean是否上下行 | ||
| 101 | + bcParamObj.fcno = fcno; // 发车顺序号 | ||
| 102 | + bcParamObj.fcTimeObj = _fcsj; // 发车时间对象 | ||
| 103 | + bcParamObj.bclc = _bclc; // 班次里程 | ||
| 104 | + bcParamObj.bcsj = _bcsj; // 班次历时 | ||
| 105 | + bcParamObj.arrtime = _arrsj; // 到达时间对象 | ||
| 106 | + bcParamObj.stoptime = _stoptime; // 停站时间 | ||
| 107 | + bcParamObj.tccid = _tccid; // 停车场id | ||
| 108 | + bcParamObj.ttinfoid = _ttinfoid; // 时刻表id | ||
| 109 | + bcParamObj.xl = _xl; // 线路id | ||
| 110 | + bcParamObj.qdzid = _qdz; // 起点站id | ||
| 111 | + bcParamObj.zdzid = _zdz; // 终点站id | ||
| 112 | + | ||
| 113 | + return new InternalBcObj(lpObj, bcParamObj); | ||
| 114 | + } | ||
| 115 | + }; | ||
| 116 | + }; | ||
| 117 | + var _factory = _factoryFun(); | ||
| 118 | + | ||
| 119 | + // 所有的时间使用moment.js计算 | ||
| 120 | + | ||
| 121 | + var _paramObj; // 参数对象 | ||
| 122 | + | ||
| 123 | + var _bxDesc = [ // 班型描述 | ||
| 124 | + {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0}, | ||
| 125 | + {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0}, | ||
| 126 | + {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0}, | ||
| 127 | + {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0}, | ||
| 128 | + {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0}, | ||
| 129 | + {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0}, | ||
| 130 | + {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0}, | ||
| 131 | + {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0} | ||
| 132 | + ]; | ||
| 133 | + | ||
| 134 | + var _funCalcuExportData_lpObjList = function(aInternalLpObj) { | ||
| 135 | + // 构造路牌对象 | ||
| 136 | + var aLpObj = []; | ||
| 137 | + var i; | ||
| 138 | + var j; | ||
| 139 | + var z; | ||
| 140 | + var oInternalLp; | ||
| 141 | + var oInternalBc; | ||
| 142 | + var oInternalBc_temp; | ||
| 143 | + var oLp; | ||
| 144 | + var iZlc; | ||
| 145 | + var iYylc; | ||
| 146 | + var iKslc; | ||
| 147 | + var iZbc; | ||
| 148 | + var iZgs; | ||
| 149 | + var iYygs; | ||
| 150 | + var iYybc; | ||
| 151 | + for (i = 0; i < aInternalLpObj.length; i++) { | ||
| 152 | + oInternalLp = aInternalLpObj[i]; | ||
| 153 | + iZlc = 0; | ||
| 154 | + iYylc = 0; | ||
| 155 | + iKslc = 0; | ||
| 156 | + iZgs = 0; | ||
| 157 | + iZbc = 0; | ||
| 158 | + iYygs = 0; | ||
| 159 | + iYybc = 0; | ||
| 160 | + oLp = { | ||
| 161 | + "lpname": oInternalLp.getLpName(), // 路牌名字 | ||
| 162 | + "isUp": oInternalLp.isUp(), // 每圈的第一个班次是否上行 | ||
| 163 | + "bcObjList": [], // 班次列表 | ||
| 164 | + "groupCount": oInternalLp.fnGetGroupCount(), // 总圈数 | ||
| 165 | + "zlc": 0, // 总里程 | ||
| 166 | + "yylc": 0, // 营运里程 | ||
| 167 | + "kslc": 0, // 空驶里程 | ||
| 168 | + "zgs": 0, // 总工时 | ||
| 169 | + "zbc": 0, // 总班次 | ||
| 170 | + "yygs": 0, // 营运工时 | ||
| 171 | + "yybc": 0, // 营运班次 | ||
| 172 | + "stationRouteId1": 0, // 第一个班次起点站路由id | ||
| 173 | + "stationRouteId2": 0 // 第二个班次起点站路由id | ||
| 174 | + }; | ||
| 175 | + | ||
| 176 | + // 将报到班次,进出场班次加到班次的时间上 | ||
| 177 | + var iBcChainCount; | ||
| 178 | + var oStartBc; | ||
| 179 | + var oEndBc; | ||
| 180 | + var oTempBc; | ||
| 181 | + var aFcsj = []; | ||
| 182 | + | ||
| 183 | + iBcChainCount = oInternalLp.fnGetBcChainCount(); | ||
| 184 | + if (iBcChainCount == 1) { // 单一车次链,连班班型 | ||
| 185 | + oStartBc = oInternalLp.getBc( | ||
| 186 | + oInternalLp.fnGetBcChainInfo(0)["s_q"], | ||
| 187 | + oInternalLp.fnGetBcChainInfo(0)["s_b"] | ||
| 188 | + ); | ||
| 189 | + oTempBc = _factory.createBcObj( | ||
| 190 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 191 | + oStartBc.getFcTimeObj(), | ||
| 192 | + _paramObj | ||
| 193 | + ); | ||
| 194 | + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 195 | + oLp.bcObjList.push({ // 报到班次 | ||
| 196 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 197 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 198 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 199 | + | ||
| 200 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 201 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 202 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 203 | + | ||
| 204 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 205 | + "isFb": false, // 是否分班 | ||
| 206 | + | ||
| 207 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 208 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 209 | + | ||
| 210 | + "groupNo": -1, // 第几圈 | ||
| 211 | + "groupBcNo": -1 // 圈里第几个班次 | ||
| 212 | + | ||
| 213 | + }); | ||
| 214 | + | ||
| 215 | + oTempBc = _factory.createBcObj( | ||
| 216 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 217 | + oStartBc.getFcTimeObj(), | ||
| 218 | + _paramObj | ||
| 219 | + ); | ||
| 220 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 221 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 222 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 223 | + | ||
| 224 | + oLp.bcObjList.push({ // 出场班次 | ||
| 225 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 226 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 227 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 228 | + | ||
| 229 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 230 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 231 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 232 | + | ||
| 233 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 234 | + "isFb": false, // 是否分班 | ||
| 235 | + | ||
| 236 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 237 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 238 | + | ||
| 239 | + "groupNo": -1, // 第几圈 | ||
| 240 | + "groupBcNo": -2 // 圈里第几个班次 | ||
| 241 | + | ||
| 242 | + }); | ||
| 243 | + | ||
| 244 | + aFcsj = []; | ||
| 245 | + | ||
| 246 | + oEndBc = oInternalLp.getBc( | ||
| 247 | + oInternalLp.fnGetBcChainInfo(0)["e_q"], | ||
| 248 | + oInternalLp.fnGetBcChainInfo(0)["e_b"] | ||
| 249 | + ); | ||
| 250 | + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 251 | + oTempBc = _factory.createBcObj( | ||
| 252 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 253 | + oEndBc.getArrTimeObj(), | ||
| 254 | + _paramObj | ||
| 255 | + ); | ||
| 256 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 257 | + | ||
| 258 | + oLp.bcObjList.push({ // 进场班次 | ||
| 259 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 260 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 261 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 262 | + | ||
| 263 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 264 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 265 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 266 | + | ||
| 267 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 268 | + "isFb": false, // 是否分班 | ||
| 269 | + | ||
| 270 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 271 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 272 | + | ||
| 273 | + "groupNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? | ||
| 274 | + oInternalLp.fnGetBcChainInfo(0)["e_q"] : | ||
| 275 | + oInternalLp.fnGetBcChainInfo(0)["e_q"] + 1, // 第几圈 | ||
| 276 | + "groupBcNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 277 | + | ||
| 278 | + }); | ||
| 279 | + | ||
| 280 | + oTempBc = _factory.createBcObj( | ||
| 281 | + oLp, "lc", !oEndBc.isUp(), 1, | ||
| 282 | + oEndBc.getArrTimeObj(), | ||
| 283 | + _paramObj | ||
| 284 | + ); | ||
| 285 | + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 286 | + oLp.bcObjList.push({ // 离场班次 | ||
| 287 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 288 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 289 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 290 | + | ||
| 291 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 292 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 293 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 294 | + | ||
| 295 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 296 | + "isFb": false, // 是否分班 | ||
| 297 | + | ||
| 298 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 299 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 300 | + | ||
| 301 | + "groupNo": -2, // 第几圈 | ||
| 302 | + "groupBcNo": -4 // 圈里第几个班次 | ||
| 303 | + | ||
| 304 | + }); | ||
| 305 | + | ||
| 306 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 307 | + | ||
| 308 | + } else if (iBcChainCount == 2) { // 两个车次链,分班班型 | ||
| 309 | + oStartBc = oInternalLp.getBc( | ||
| 310 | + oInternalLp.fnGetBcChainInfo(0)["s_q"], | ||
| 311 | + oInternalLp.fnGetBcChainInfo(0)["s_b"] | ||
| 312 | + ); | ||
| 313 | + oTempBc = _factory.createBcObj( | ||
| 314 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 315 | + oStartBc.getFcTimeObj(), | ||
| 316 | + _paramObj | ||
| 317 | + ); | ||
| 318 | + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 319 | + oLp.bcObjList.push({ // 报到班次 | ||
| 320 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 321 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 322 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 323 | + | ||
| 324 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 325 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 326 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 327 | + | ||
| 328 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 329 | + "isFb": false, // 是否分班 | ||
| 330 | + | ||
| 331 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 332 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 333 | + | ||
| 334 | + "groupNo": -1, // 第几圈 | ||
| 335 | + "groupBcNo": -1 // 圈里第几个班次 | ||
| 336 | + | ||
| 337 | + }); | ||
| 338 | + | ||
| 339 | + oTempBc = _factory.createBcObj( | ||
| 340 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 341 | + oStartBc.getFcTimeObj(), | ||
| 342 | + _paramObj | ||
| 343 | + ); | ||
| 344 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 345 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 346 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 347 | + | ||
| 348 | + oLp.bcObjList.push({ // 出场班次 | ||
| 349 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 350 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 351 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 352 | + | ||
| 353 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 354 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 355 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 356 | + | ||
| 357 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 358 | + "isFb": false, // 是否分班 | ||
| 359 | + | ||
| 360 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 361 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 362 | + | ||
| 363 | + "groupNo": -1, // 第几圈 | ||
| 364 | + "groupBcNo": -2 // 圈里第几个班次 | ||
| 365 | + | ||
| 366 | + }); | ||
| 367 | + | ||
| 368 | + aFcsj = []; | ||
| 369 | + | ||
| 370 | + oEndBc = oInternalLp.getBc( | ||
| 371 | + oInternalLp.fnGetBcChainInfo(0)["e_q"], | ||
| 372 | + oInternalLp.fnGetBcChainInfo(0)["e_b"] | ||
| 373 | + ); | ||
| 374 | + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 375 | + oTempBc = _factory.createBcObj( | ||
| 376 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 377 | + oEndBc.getArrTimeObj(), | ||
| 378 | + _paramObj | ||
| 379 | + ); | ||
| 380 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 381 | + oLp.bcObjList.push({ // 进场班次 | ||
| 382 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 383 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 384 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 385 | + | ||
| 386 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 387 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 388 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 389 | + | ||
| 390 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 391 | + "isFb": true, // 是否分班 | ||
| 392 | + | ||
| 393 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 394 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 395 | + | ||
| 396 | + "groupNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? | ||
| 397 | + oInternalLp.fnGetBcChainInfo(0)["e_q"] : | ||
| 398 | + oInternalLp.fnGetBcChainInfo(0)["e_q"] + 1, // 第几圈 | ||
| 399 | + "groupBcNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 400 | + | ||
| 401 | + }); | ||
| 402 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 403 | + | ||
| 404 | + aFcsj = []; | ||
| 405 | + | ||
| 406 | + oStartBc = oInternalLp.getBc( | ||
| 407 | + oInternalLp.fnGetBcChainInfo(1)["s_q"], | ||
| 408 | + oInternalLp.fnGetBcChainInfo(1)["s_b"] | ||
| 409 | + ); | ||
| 410 | + oTempBc = _factory.createBcObj( | ||
| 411 | + oLp, "bd", oStartBc.isUp(), 1, | ||
| 412 | + oStartBc.getFcTimeObj(), | ||
| 413 | + _paramObj | ||
| 414 | + ); | ||
| 415 | + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 416 | + oLp.bcObjList.push({ // 报到班次 | ||
| 417 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 418 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 419 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 420 | + | ||
| 421 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 422 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 423 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 424 | + | ||
| 425 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 426 | + "isFb": true, // 是否分班 | ||
| 427 | + | ||
| 428 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 429 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 430 | + | ||
| 431 | + "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1, // 第几圈 | ||
| 432 | + "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] // 圈里第几个班次 | ||
| 433 | + | ||
| 434 | + }); | ||
| 435 | + | ||
| 436 | + oTempBc = _factory.createBcObj( | ||
| 437 | + oLp, "out", oStartBc.isUp(), 1, | ||
| 438 | + oStartBc.getFcTimeObj(), | ||
| 439 | + _paramObj | ||
| 440 | + ); | ||
| 441 | + oLp.bcObjList.push({ // 出场班次 | ||
| 442 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 443 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 444 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 445 | + | ||
| 446 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 447 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 448 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 449 | + | ||
| 450 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 451 | + "isFb": true, // 是否分班 | ||
| 452 | + | ||
| 453 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 454 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 455 | + | ||
| 456 | + "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ? | ||
| 457 | + oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1 : | ||
| 458 | + oInternalLp.fnGetBcChainInfo(1)["s_q"], // 第几圈 | ||
| 459 | + "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 460 | + | ||
| 461 | + }); | ||
| 462 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 463 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 464 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | ||
| 465 | + | ||
| 466 | + aFcsj = []; | ||
| 467 | + | ||
| 468 | + oEndBc = oInternalLp.getBc( | ||
| 469 | + oInternalLp.fnGetBcChainInfo(1)["e_q"], | ||
| 470 | + oInternalLp.fnGetBcChainInfo(1)["e_b"] | ||
| 471 | + ); | ||
| 472 | + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 473 | + oTempBc = _factory.createBcObj( | ||
| 474 | + oLp, "in", !oEndBc.isUp(), 1, | ||
| 475 | + oEndBc.getArrTimeObj(), | ||
| 476 | + _paramObj | ||
| 477 | + ); | ||
| 478 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 479 | + | ||
| 480 | + oLp.bcObjList.push({ // 进场班次 | ||
| 481 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 482 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 483 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 484 | + | ||
| 485 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 486 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 487 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 488 | + | ||
| 489 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 490 | + "isFb": false, // 是否分班 | ||
| 491 | + | ||
| 492 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 493 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 494 | + | ||
| 495 | + "groupNo": oInternalLp.fnGetBcChainInfo(1)["e_b"] == 0 ? | ||
| 496 | + oInternalLp.fnGetBcChainInfo(1)["e_q"] : | ||
| 497 | + oInternalLp.fnGetBcChainInfo(1)["e_q"] + 1, // 第几圈 | ||
| 498 | + "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次 | ||
| 499 | + | ||
| 500 | + }); | ||
| 501 | + | ||
| 502 | + oTempBc = _factory.createBcObj( | ||
| 503 | + oLp, "lc", !oEndBc.isUp(), 1, | ||
| 504 | + oEndBc.getArrTimeObj(), | ||
| 505 | + _paramObj | ||
| 506 | + ); | ||
| 507 | + | ||
| 508 | + oLp.bcObjList.push({ // 离场班次 | ||
| 509 | + "bcsj": oTempBc.getBcTime(), // 班次时间 | ||
| 510 | + "ssj": oTempBc.getStopTime(), // 停站时间 | ||
| 511 | + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间 | ||
| 512 | + | ||
| 513 | + "tccid": oTempBc._$_tccid, // 停车场id | ||
| 514 | + "qdzid": oTempBc._$_qdzid, // 起点站id | ||
| 515 | + "zdzid": oTempBc._$_zdzid, // 终点站id | ||
| 516 | + | ||
| 517 | + "isUp": oTempBc._$_isUp, // 是否上行 | ||
| 518 | + "isFb": false, // 是否分班 | ||
| 519 | + | ||
| 520 | + "bcType": oTempBc._$_bcType, // 班次类型 | ||
| 521 | + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 522 | + | ||
| 523 | + "groupNo": -2, // 第几圈 | ||
| 524 | + "groupBcNo": -4 // 圈里第几个班次 | ||
| 525 | + | ||
| 526 | + }); | ||
| 527 | + | ||
| 528 | + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | ||
| 529 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | ||
| 530 | + | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + for (j = 0; j < oInternalLp.fnGetGroupCount(); j++) { | ||
| 534 | + for (z = 0; z < 2; z++) { | ||
| 535 | + oInternalBc = oInternalLp.getBc(j, z); | ||
| 536 | + if (oInternalBc) { | ||
| 537 | + if (oInternalBc.fnGetEatTime() > 0) { | ||
| 538 | + // 吃饭班次是下一个班次开始吃,和本班次方向相反 | ||
| 539 | + oInternalBc_temp = oInternalLp.getBc( | ||
| 540 | + z == 1 ? j + 1 : j, | ||
| 541 | + z == 1 ? 0 : 1); | ||
| 542 | + | ||
| 543 | + oInternalBc_temp._$_isRealEat = true; | ||
| 544 | + oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")"; | ||
| 545 | + } | ||
| 546 | + | ||
| 547 | + oLp.bcObjList.push({ | ||
| 548 | + "bcsj": oInternalBc.getBcTime(), // 班次时间 | ||
| 549 | + "ssj": oInternalBc.getStopTime(), // 停站时间 | ||
| 550 | + "eatsj": oInternalBc.fnGetEatTime(), // 吃饭时间 | ||
| 551 | + | ||
| 552 | + "tccid": oInternalBc._$_tccid, // 停车场id | ||
| 553 | + "qdzid": oInternalBc._$_qdzid, // 起点站id | ||
| 554 | + "zdzid": oInternalBc._$_zdzid, // 终点站id | ||
| 555 | + | ||
| 556 | + "isUp": oInternalBc._$_isUp, // 是否上行 | ||
| 557 | + | ||
| 558 | + "bcType": oInternalBc._$_bcType, // 班次类型 | ||
| 559 | + "fcsj": oInternalBc._$_isRealEat ? | ||
| 560 | + ("*" + oInternalBc._$_fcsjObj.format("HH:mm")) : | ||
| 561 | + oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | ||
| 562 | + "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"), | ||
| 563 | + | ||
| 564 | + "groupNo": j, // 第几圈 | ||
| 565 | + "groupBcNo": z // 圈里第几个班次 | ||
| 566 | + | ||
| 567 | + }); | ||
| 568 | + | ||
| 569 | + // iZlc = 0; | ||
| 570 | + // iYylc = 0; | ||
| 571 | + // iKslc = 0; | ||
| 572 | + // iZgs = 0; | ||
| 573 | + // iZbc = 0; | ||
| 574 | + // iYygs = 0; | ||
| 575 | + // iYybc = 0; | ||
| 576 | + | ||
| 577 | + iZlc = iZlc + | ||
| 578 | + oInternalBc._$_bclc; // 里程 | ||
| 579 | + iYylc = iYylc + | ||
| 580 | + oInternalBc._$_bclc; // 里程 | ||
| 581 | + iYygs = iYygs + | ||
| 582 | + oInternalBc.getBcTime() + // 班次时间 | ||
| 583 | + oInternalBc.getStopTime() + // 停站时间 | ||
| 584 | + oInternalBc.fnGetEatTime(); // 吃饭时间 | ||
| 585 | + iYybc = iYybc + 1; | ||
| 586 | + | ||
| 587 | + iZgs = iZgs + | ||
| 588 | + oInternalBc.getBcTime() + // 班次时间 | ||
| 589 | + oInternalBc.getStopTime() + // 停站时间 | ||
| 590 | + oInternalBc.fnGetEatTime(); // 吃饭时间 | ||
| 591 | + iZbc = iZbc + 1; | ||
| 592 | + | ||
| 593 | + // 设置圈站点路由id | ||
| 594 | + if (oInternalBc.isUp() == oInternalLp.isUp()) { // 第一个班次 | ||
| 595 | + if (oLp.stationRouteId1 == 0) { | ||
| 596 | + oLp.stationRouteId1 = oInternalBc._$_qdzid; | ||
| 597 | + } | ||
| 598 | + } else { // 第二个班次 | ||
| 599 | + if (oLp.stationRouteId2 == 0) { | ||
| 600 | + oLp.stationRouteId2 = oInternalBc._$_qdzid; | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + } | ||
| 605 | + } | ||
| 606 | + | ||
| 607 | + } | ||
| 608 | + | ||
| 609 | + for (z = 0; z < oInternalLp.getOtherBcArray().length; z++) { | ||
| 610 | + oInternalBc = oInternalLp.getOtherBcArray()[z]; | ||
| 611 | + iKslc = iKslc + | ||
| 612 | + oInternalBc._$_bclc; // 里程 | ||
| 613 | + iZlc = iZlc + | ||
| 614 | + oInternalBc._$_bclc; // 里程 | ||
| 615 | + iZgs = iZgs + | ||
| 616 | + oInternalBc.getBcTime() + // 班次时间 | ||
| 617 | + oInternalBc.getStopTime(); // 停站时间 | ||
| 618 | + if (oInternalBc._$_bcType != "bd" && | ||
| 619 | + oInternalBc._$_bcType != "lc" && | ||
| 620 | + oInternalBc._$_bcType != "cf") { | ||
| 621 | + iZbc = iZbc + 1; | ||
| 622 | + } | ||
| 623 | + } | ||
| 624 | + | ||
| 625 | + oLp.zlc = iZlc; | ||
| 626 | + oLp.yylc = iYylc; | ||
| 627 | + oLp.kslc = iKslc; | ||
| 628 | + oLp.zgs = iZgs; | ||
| 629 | + oLp.zbc = iZbc; | ||
| 630 | + oLp.yygs = iYygs; | ||
| 631 | + oLp.yybc = iYybc; | ||
| 632 | + aLpObj.push(oLp); | ||
| 633 | + } | ||
| 634 | + | ||
| 635 | + return aLpObj; | ||
| 636 | + }; | ||
| 637 | + | ||
| 638 | + var _funCalcuExportData_statInfoList = function(aInternalLpObj) { | ||
| 639 | + var countBc = 0, // 总班次 | ||
| 640 | + serviceBc = 0, // 营运班次 | ||
| 641 | + jcbc = 0, // 进场总班次. | ||
| 642 | + ccbc = 0, // 出场总班次. | ||
| 643 | + cfbc = 0, // 吃饭总班次. | ||
| 644 | + zwlbbc = 0, // 早晚例保总班次. | ||
| 645 | + countGs = 0.0, // 总工时 | ||
| 646 | + servicesj = 0, // 营运班次总时间 | ||
| 647 | + jcsj = 0.0, // 进场总时间. | ||
| 648 | + ccsj = 0.0, // 出场总时间. | ||
| 649 | + cfsj = 0.0, // 吃饭总时间. | ||
| 650 | + zwlbsj = 0.0, // 早晚例保总时间. | ||
| 651 | + ksBc = 0, // 空驶班次 | ||
| 652 | + serviceLc = 0.0, // 营运里程 | ||
| 653 | + ksLc = 0.0, // 空驶里程 | ||
| 654 | + avgTzjx = 0.0, // 平均停站间隙 | ||
| 655 | + gfServiceBc = 0, // 高峰营运班次 | ||
| 656 | + dgServiceBc = 0, // 低谷营运班次 | ||
| 657 | + gfAvgTzjx = 0.0, // 高峰平均停站间隙 | ||
| 658 | + dgAvgTzjx = 0.0; // 低谷平均停站间隙 | ||
| 659 | + | ||
| 660 | + var aAllBc = []; | ||
| 661 | + var oLp; | ||
| 662 | + var oBc; | ||
| 663 | + var i; | ||
| 664 | + var j; | ||
| 665 | + | ||
| 666 | + for (i = 0; i < aInternalLpObj.length; i++) { | ||
| 667 | + oLp = aInternalLpObj[i]; | ||
| 668 | + for (j = 0; j < oLp.getBcArray().length; j++) { | ||
| 669 | + aAllBc.push(oLp.getBcArray()[j]); | ||
| 670 | + } | ||
| 671 | + for (j = 0; j < oLp.getOtherBcArray().length; j++) { | ||
| 672 | + aAllBc.push(oLp.getOtherBcArray()[j]); | ||
| 673 | + } | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + for (i = 0; i < aAllBc.length; i++) { | ||
| 677 | + oBc = aAllBc[i]; | ||
| 678 | + | ||
| 679 | + if (oBc.getBcTime() > 0) { | ||
| 680 | + countBc = countBc + 1; | ||
| 681 | + countGs = countGs + oBc.getStopTime() + oBc.getBcTime(); | ||
| 682 | + if (_paramObj.isTroughBc(oBc.getFcTimeObj())) { | ||
| 683 | + if (oBc._$_bcType == "normal") { | ||
| 684 | + dgServiceBc = dgServiceBc + 1; | ||
| 685 | + dgAvgTzjx = dgAvgTzjx + oBc.getStopTime(); | ||
| 686 | + } | ||
| 687 | + } else { | ||
| 688 | + if (oBc._$_bcType == "normal") { | ||
| 689 | + gfServiceBc = gfServiceBc + 1; | ||
| 690 | + gfAvgTzjx = gfAvgTzjx + oBc.getStopTime(); | ||
| 691 | + } | ||
| 692 | + } | ||
| 693 | + | ||
| 694 | + if (oBc._$_bcType == "normal") { | ||
| 695 | + serviceBc = serviceBc + 1; | ||
| 696 | + serviceLc = serviceLc + oBc._$_bclc; | ||
| 697 | + servicesj = servicesj + oBc.getBcTime(); | ||
| 698 | + avgTzjx = avgTzjx + oBc.getStopTime(); | ||
| 699 | + | ||
| 700 | + if (oBc.fnGetEatTime() > 0) { | ||
| 701 | + cfbc = cfbc + 1; | ||
| 702 | + cfsj = cfsj + oBc.fnGetEatTime(); | ||
| 703 | + } | ||
| 704 | + } else if (oBc._$_bcType == "in") { | ||
| 705 | + jcbc = jcbc + 1; | ||
| 706 | + jcsj = jcsj + oBc.getBcTime(); | ||
| 707 | + } else if (oBc._$_bcType == "out") { | ||
| 708 | + ccbc = ccbc + 1; | ||
| 709 | + ccsj = ccsj + oBc.getBcTime(); | ||
| 710 | + } else if (oBc._$_bcType == "bd") { | ||
| 711 | + zwlbbc = zwlbbc + 1; | ||
| 712 | + zwlbsj = zwlbsj + oBc.getBcTime(); | ||
| 713 | + } else if (oBc._$_bcType == "lc") { | ||
| 714 | + zwlbbc = zwlbbc + 1; | ||
| 715 | + zwlbsj = zwlbsj + oBc.getBcTime(); | ||
| 716 | + } | ||
| 717 | + } | ||
| 718 | + } | ||
| 719 | + | ||
| 720 | + dgAvgTzjx = dgAvgTzjx / dgServiceBc; | ||
| 721 | + gfAvgTzjx = gfAvgTzjx / gfServiceBc; | ||
| 722 | + avgTzjx = avgTzjx / dgServiceBc; | ||
| 723 | + | ||
| 724 | + return [ | ||
| 725 | + {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc}, | ||
| 726 | + {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc}, | ||
| 727 | + {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc}, | ||
| 728 | + {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc}, | ||
| 729 | + {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc}, | ||
| 730 | + {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc}, | ||
| 731 | + {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60}, | ||
| 732 | + {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60}, | ||
| 733 | + {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60}, | ||
| 734 | + {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60}, | ||
| 735 | + {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60}, | ||
| 736 | + {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60}, | ||
| 737 | + {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc}, | ||
| 738 | + {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc}, | ||
| 739 | + {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc}, | ||
| 740 | + {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx}, | ||
| 741 | + {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc}, | ||
| 742 | + {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc}, | ||
| 743 | + {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx}, | ||
| 744 | + {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx}, | ||
| 745 | + {'statItem': '综合评估', 'statValue': 3} | ||
| 746 | + ]; | ||
| 747 | + | ||
| 748 | + }; | ||
| 749 | + | ||
| 750 | + var __funCalcuExportData_paramInfoList = function() { | ||
| 751 | + return [ | ||
| 752 | + {'paramItem' : '上行首班时间', 'paramValue' : _paramObj.getUpFirstDTimeObj().format("HH:mm")}, | ||
| 753 | + {'paramItem' : '上行末班时间', 'paramValue' : _paramObj.getUpLastDtimeObj().format("HH:mm")}, | ||
| 754 | + {'paramItem' : '下行首班时间', 'paramValue' : _paramObj.getDownFirstDTimeObj().format("HH:mm")}, | ||
| 755 | + {'paramItem' : '下行末班时间', 'paramValue' : _paramObj.getDownLastDTimeObj().format("HH:mm")}, | ||
| 756 | + {'paramItem' : '早高峰开始时间', 'paramValue' : _paramObj.getMPeakStartTimeObj().format("HH:mm")}, | ||
| 757 | + {'paramItem' : '早高峰结束时间', 'paramValue' : _paramObj.getMPeakEndTimeObj().format("HH:mm")}, | ||
| 758 | + {'paramItem' : '晚高峰开始时间', 'paramValue' : _paramObj.getEPeakStartTimeObj().format("HH:mm")}, | ||
| 759 | + {'paramItem' : '晚高峰结束时间', 'paramValue' : _paramObj.getEPeakEndTimeObj().format("HH:mm")}, | ||
| 760 | + {'paramItem' : '上行进场时间', 'paramValue' : _paramObj.getUpInTime()}, | ||
| 761 | + {'paramItem' : '上行出场时间', 'paramValue' : _paramObj.getUpOutTime()}, | ||
| 762 | + {'paramItem' : '下行进场时间', 'paramValue' : _paramObj.getDownInTime()}, | ||
| 763 | + {'paramItem' : '下行出场时间', 'paramValue' : _paramObj.getDownOutTime()}, | ||
| 764 | + {'paramItem' : '早高峰上行时间', 'paramValue' : _paramObj.getUpMPeakTime()}, | ||
| 765 | + {'paramItem' : '早高峰下行时间', 'paramValue' : _paramObj.getDownMPeakTime()}, | ||
| 766 | + {'paramItem' : '晚高峰上行时间', 'paramValue' : _paramObj.getUpEPeakTime()}, | ||
| 767 | + {'paramItem' : '晚高峰下行时间', 'paramValue' : _paramObj.getDownEPeakTime()}, | ||
| 768 | + {'paramItem' : '低谷上行时间', 'paramValue' : _paramObj.getUpTroughTime()}, | ||
| 769 | + {'paramItem' : '低谷下行时间', 'paramValue' : _paramObj.getDownTroughTime()}, | ||
| 770 | + {'paramItem' : '线路规划类型', 'paramValue' : "双向"}, | ||
| 771 | + {'paramItem' : '吃饭地点', 'paramValue' : _paramObj.fnIsEat() ? (_paramObj.fnIsBothEat() ? "上下行" : (_paramObj.fnIsUpEat() ? "上行" : "下行")) : "不吃饭"}, | ||
| 772 | + {'paramItem' : '早晚例行保养', 'paramValue' : _paramObj.getLbTime()}, | ||
| 773 | + {'paramItem' : '停车场', 'paramValue' : _paramObj.getTccId()}, | ||
| 774 | + {'paramItem' : '工作餐午餐时间', 'paramValue' : _paramObj.fnGetLunchTime()}, | ||
| 775 | + {'paramItem' : '工作餐晚餐时间', 'paramValue' : _paramObj.fnGetDinnerTime()}, | ||
| 776 | + {'paramItem' : '早高峰发车间隔', 'paramValue' : "[" + _paramObj.getMPeakMinFcjx() + "," + _paramObj.getMPeakMaxFcjx() + "]"}, | ||
| 777 | + {'paramItem' : '晚高峰发车间隔', 'paramValue' : "[" + _paramObj.getEPeakMinFcjx() + "," + _paramObj.getEPeakMaxFcjx() + "]"}, | ||
| 778 | + {'paramItem' : '低谷发车间隔', 'paramValue' : "[" + _paramObj.getTroughMinFcjx() + "," + _paramObj.getTroughMaxFcjx() + "]"}, | ||
| 779 | + {'paramItem' : '建议加班路牌数', 'paramValue' : _paramObj.getJBLpes()}, | ||
| 780 | + {'paramItem' : '停站类型', 'paramValue' : _paramObj.isTwoWayStop() ? "双向停站" : (_paramObj.isUpOneWayStop() ? "上行主站" : "下行主站") }, | ||
| 781 | + {'paramItem' : '建议高峰配车数', 'paramValue' : _paramObj.getAdvicePeakClzs()} | ||
| 782 | + ] | ||
| 783 | + }; | ||
| 784 | + | ||
| 785 | + return { | ||
| 786 | + /** | ||
| 787 | + * 工厂对象,创建不同的对象。 | ||
| 788 | + * @returns {{createParameterObj, createBcObj}} | ||
| 789 | + */ | ||
| 790 | + getFactory: function() { | ||
| 791 | + return _factory; | ||
| 792 | + }, | ||
| 793 | + | ||
| 794 | + /** | ||
| 795 | + * 使用发车间隔策略生成时刻表。 | ||
| 796 | + * @param paramObj 参数对象 | ||
| 797 | + * @param lpArray 路牌数组 | ||
| 798 | + * @constructor | ||
| 799 | + */ | ||
| 800 | + BXPplaceClassesTime03 : function(paramObj, lpArray) { | ||
| 801 | + // 参数对象 | ||
| 802 | + _paramObj = paramObj; | ||
| 803 | + | ||
| 804 | + // 1、初始化行车计划 | ||
| 805 | + var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); | ||
| 806 | + schedule.fnInitDataWithBxLayout(); | ||
| 807 | + // 2、将连班路牌的班次补足 | ||
| 808 | + schedule.fnCalcuLpBx_lb(); | ||
| 809 | + | ||
| 810 | + // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除 | ||
| 811 | + schedule.fnAdjustGfbc(true, true); // 修正上行早高峰 | ||
| 812 | + schedule.fnAdjustGfbc(true, false); // 修正下行早高峰 | ||
| 813 | + schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰 | ||
| 814 | + schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰 | ||
| 815 | + | ||
| 816 | + // 6、补吃饭班次 | ||
| 817 | + schedule.fnCalcuEatBc(); | ||
| 818 | + | ||
| 819 | + // 4、按照车辆投入运营要求补充班次 | ||
| 820 | + schedule.fnCalcuLpBc_yy(); | ||
| 821 | + | ||
| 822 | + // 5、根据班型补充所有的不足班次 | ||
| 823 | + schedule.fnCalcuLpBx_5_2(); | ||
| 824 | + schedule.fnCalcuLpBx_other(); | ||
| 825 | + | ||
| 826 | + // 7、祛除上标线开头有删除标记的班次 | ||
| 827 | + schedule.fnRemoveDelFirstFlagBc(); | ||
| 828 | + | ||
| 829 | + // 8、调整路牌班次间隔(使用平均停站时间) | ||
| 830 | + schedule.fnAdjustLpBcInterval(1); | ||
| 831 | + | ||
| 832 | + // 9、调整班次发车间隔 | ||
| 833 | + schedule.fnAdjustBcInterval(false); | ||
| 834 | + | ||
| 835 | + // 10、确定末班车 | ||
| 836 | + schedule.fnCalcuLastBc(); | ||
| 837 | + | ||
| 838 | + // 11、祛除上标线结尾有删除标记的班次 | ||
| 839 | + schedule.fnRemoveDelLastFlagBc(); | ||
| 840 | + | ||
| 841 | + // TODO:12、平均化指定时间后的班次列表间隔 | ||
| 842 | + // // schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50")); | ||
| 843 | + // // schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50")); | ||
| 844 | + // | ||
| 845 | + // 10、补进出场例保班次 | ||
| 846 | + schedule.fnCalcuOtherBc(); | ||
| 847 | + | ||
| 848 | + //-------------------- 输出ganut图上的班次,班型描述 ----------------------// | ||
| 849 | + // TODO:班型再议 | ||
| 850 | + return { | ||
| 851 | + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null, | ||
| 852 | + 'aInternalLpObj': schedule.fnGetLpArray() | ||
| 853 | + }; | ||
| 854 | + | ||
| 855 | + }, | ||
| 856 | + /** | ||
| 857 | + * 导出时刻表配置。 | ||
| 858 | + * @param aInternalLpObj 内部路牌对象列表 | ||
| 859 | + */ | ||
| 860 | + exportDataConfig: function(aInternalLpObj) { | ||
| 861 | + $('.exportAddXls').off('click'); | ||
| 862 | + $('.exportAddXlsx').off('click'); | ||
| 863 | + | ||
| 864 | + $('.exportAddXls').on('click', function() { | ||
| 865 | + var aInfos = { | ||
| 866 | + "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | ||
| 867 | + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 | ||
| 868 | + "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 869 | + }; | ||
| 870 | + | ||
| 871 | + console.log(aInfos); | ||
| 872 | + | ||
| 873 | + $(".exportAdd").addClass("disabled"); | ||
| 874 | + $(".exportAddSpan").html("正在导出..."); | ||
| 875 | + | ||
| 876 | + // 提交 | ||
| 877 | + $.ajax({ | ||
| 878 | + type: 'POST', | ||
| 879 | + url: "/tidc/exportDTDFile/xls", | ||
| 880 | + dataType: 'binary', | ||
| 881 | + contentType: "application/json", | ||
| 882 | + data: JSON.stringify(aInfos), | ||
| 883 | + success: function(data){ | ||
| 884 | + Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); | ||
| 885 | + | ||
| 886 | + $(".exportAdd").removeClass("disabled"); | ||
| 887 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 888 | + }, | ||
| 889 | + error: function(xhr, type){ | ||
| 890 | + alert('错误:TODO'); | ||
| 891 | + | ||
| 892 | + $(".exportAdd").removeClass("disabled"); | ||
| 893 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 894 | + } | ||
| 895 | + }); | ||
| 896 | + }); | ||
| 897 | + | ||
| 898 | + $('.exportAddXlsx').on('click', function() { | ||
| 899 | + var aInfos = { | ||
| 900 | + "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | ||
| 901 | + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 | ||
| 902 | + "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 903 | + }; | ||
| 904 | + | ||
| 905 | + console.log(aInfos); | ||
| 906 | + | ||
| 907 | + $(".exportAdd").addClass("disabled"); | ||
| 908 | + $(".exportAddSpan").html("正在导出..."); | ||
| 909 | + | ||
| 910 | + // 提交 | ||
| 911 | + $.ajax({ | ||
| 912 | + type: 'POST', | ||
| 913 | + url: "/tidc/exportDTDFile/xlsx", | ||
| 914 | + dataType: 'binary', | ||
| 915 | + contentType: "application/json", | ||
| 916 | + data: JSON.stringify(aInfos), | ||
| 917 | + success: function(data){ | ||
| 918 | + Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx"); | ||
| 919 | + | ||
| 920 | + $(".exportAdd").removeClass("disabled"); | ||
| 921 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 922 | + }, | ||
| 923 | + error: function(xhr, type){ | ||
| 924 | + alert('错误:TODO'); | ||
| 925 | + | ||
| 926 | + $(".exportAdd").removeClass("disabled"); | ||
| 927 | + $(".exportAddSpan").html(" 导出数据"); | ||
| 928 | + } | ||
| 929 | + }); | ||
| 930 | + }); | ||
| 931 | + }, | ||
| 932 | + | ||
| 933 | + downloadFile: function (data, mimeType, fileName) { | ||
| 934 | + var success = false; | ||
| 935 | + var blob = new Blob([data], { type: mimeType }); | ||
| 936 | + try { | ||
| 937 | + if (navigator.msSaveBlob) | ||
| 938 | + navigator.msSaveBlob(blob, fileName); | ||
| 939 | + else { | ||
| 940 | + // Try using other saveBlob implementations, if available | ||
| 941 | + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | ||
| 942 | + if (saveBlob === undefined) throw "Not supported"; | ||
| 943 | + saveBlob(blob, fileName); | ||
| 944 | + } | ||
| 945 | + success = true; | ||
| 946 | + } catch (ex) { | ||
| 947 | + console.log("saveBlob method failed with the following exception:"); | ||
| 948 | + console.log(ex); | ||
| 949 | + } | ||
| 950 | + | ||
| 951 | + if (!success) { | ||
| 952 | + // Get the blob url creator | ||
| 953 | + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | ||
| 954 | + if (urlCreator) { | ||
| 955 | + // Try to use a download link | ||
| 956 | + var link = document.createElement('a'); | ||
| 957 | + if ('download' in link) { | ||
| 958 | + // Try to simulate a click | ||
| 959 | + try { | ||
| 960 | + // Prepare a blob URL | ||
| 961 | + var url = urlCreator.createObjectURL(blob); | ||
| 962 | + link.setAttribute('href', url); | ||
| 963 | + | ||
| 964 | + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | ||
| 965 | + link.setAttribute("download", fileName); | ||
| 966 | + | ||
| 967 | + // Simulate clicking the download link | ||
| 968 | + var event = document.createEvent('MouseEvents'); | ||
| 969 | + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
| 970 | + link.dispatchEvent(event); | ||
| 971 | + success = true; | ||
| 972 | + | ||
| 973 | + } catch (ex) { | ||
| 974 | + console.log("Download link method with simulated click failed with the following exception:"); | ||
| 975 | + console.log(ex); | ||
| 976 | + } | ||
| 977 | + } | ||
| 978 | + | ||
| 979 | + if (!success) { | ||
| 980 | + // Fallback to window.location method | ||
| 981 | + try { | ||
| 982 | + // Prepare a blob URL | ||
| 983 | + // Use application/octet-stream when using window.location to force download | ||
| 984 | + var url = urlCreator.createObjectURL(blob); | ||
| 985 | + window.location = url; | ||
| 986 | + console.log("Download link method with window.location succeeded"); | ||
| 987 | + success = true; | ||
| 988 | + } catch (ex) { | ||
| 989 | + console.log("Download link method with window.location failed with the following exception:"); | ||
| 990 | + console.log(ex); | ||
| 991 | + } | ||
| 992 | + } | ||
| 993 | + } | ||
| 994 | + } | ||
| 995 | + | ||
| 996 | + if (!success) { | ||
| 997 | + // Fallback to window.open method | ||
| 998 | + console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | ||
| 999 | + window.open("", '_blank', ''); | ||
| 1000 | + } | ||
| 1001 | + } | ||
| 1002 | + | ||
| 1003 | + }; | ||
| 1004 | + | ||
| 1005 | +}(); | ||
| 1006 | + | ||
| 1007 | + |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/StrategyUtils.js
| 1 | -/** | ||
| 2 | - * 策略工具类。 | ||
| 3 | - */ | ||
| 4 | -var StrategyUtils = (function() { | ||
| 5 | - /** | ||
| 6 | - * 内部策略配置封装类。 | ||
| 7 | - * @constructor | ||
| 8 | - */ | ||
| 9 | - function InternalStrategy() { | ||
| 10 | - // 策略函数对应,每个函数都由一个标识符号对应,类似配置函数 | ||
| 11 | - this._oSTRATIGIS = { | ||
| 12 | - // ADJUST_TRIP表示调整发车间隔的策略,都放在strategy/adjust目录下 | ||
| 13 | - // 每种策略对应一个js文件,里面的变量名就是策略名 | ||
| 14 | - "ADJUST_TRIP": AdjustTripS1 | ||
| 15 | - }; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - /** | ||
| 19 | - * 返回策略函数 | ||
| 20 | - * @param str 标识 | ||
| 21 | - * @returns {function} | ||
| 22 | - */ | ||
| 23 | - InternalStrategy.prototype.sFn = function(str) { | ||
| 24 | - if (!this._oSTRATIGIS[str]) { | ||
| 25 | - throw "指定标识" + str + "策略函数不存在!"; | ||
| 26 | - } | ||
| 27 | - return this._oSTRATIGIS[str]; | ||
| 28 | - }; | ||
| 29 | - /** | ||
| 30 | - * 替换策略配置 | ||
| 31 | - * @param str 策略函数标识 | ||
| 32 | - * @param fn 策略函数 | ||
| 33 | - */ | ||
| 34 | - InternalStrategy.prototype.sConfig = function(str, fn) { | ||
| 35 | - this._oSTRATIGIS[str] = fn; | ||
| 36 | - }; | ||
| 37 | - | ||
| 38 | - return new InternalStrategy(); | 1 | +/** |
| 2 | + * 策略工具类。 | ||
| 3 | + */ | ||
| 4 | +var StrategyUtils = (function() { | ||
| 5 | + /** | ||
| 6 | + * 内部策略配置封装类。 | ||
| 7 | + * @constructor | ||
| 8 | + */ | ||
| 9 | + function InternalStrategy() { | ||
| 10 | + // 策略函数对应,每个函数都由一个标识符号对应,类似配置函数 | ||
| 11 | + this._oSTRATIGIS = { | ||
| 12 | + // ADJUST_TRIP表示调整发车间隔的策略,都放在strategy/adjust目录下 | ||
| 13 | + // 每种策略对应一个js文件,里面的变量名就是策略名 | ||
| 14 | + "ADJUST_TRIP": AdjustTripS1 | ||
| 15 | + }; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 返回策略函数 | ||
| 20 | + * @param str 标识 | ||
| 21 | + * @returns {function} | ||
| 22 | + */ | ||
| 23 | + InternalStrategy.prototype.sFn = function(str) { | ||
| 24 | + if (!this._oSTRATIGIS[str]) { | ||
| 25 | + throw "指定标识" + str + "策略函数不存在!"; | ||
| 26 | + } | ||
| 27 | + return this._oSTRATIGIS[str]; | ||
| 28 | + }; | ||
| 29 | + /** | ||
| 30 | + * 替换策略配置 | ||
| 31 | + * @param str 策略函数标识 | ||
| 32 | + * @param fn 策略函数 | ||
| 33 | + */ | ||
| 34 | + InternalStrategy.prototype.sConfig = function(str, fn) { | ||
| 35 | + this._oSTRATIGIS[str] = fn; | ||
| 36 | + }; | ||
| 37 | + | ||
| 38 | + return new InternalStrategy(); | ||
| 39 | } ()); | 39 | } ()); |
| 40 | \ No newline at end of file | 40 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS2.js
| 1 | -/** | ||
| 2 | - * 平衡车距策略2(太死板,速度慢,效果不佳啊,建议不使用)。 | ||
| 3 | - * 调整策略如下(有点像滤波器): | ||
| 4 | - * 1、从头开始,连续取3个班次,获取2个间隔,根据间隔的不同及其他规则,调整中间班次的发车时间 | ||
| 5 | - * 2、基本调整如下, | ||
| 6 | - * (1)、如果2个间隔时间差1分钟,不调整 | ||
| 7 | - * (2)、如果第一个间隔在区间间隔范围外,调整发车时间1分钟到指定的边界 | ||
| 8 | - * (3)、如果第一个间隔大,调整中间班次发车时间-1分钟,如果调整后的间隔在区间间隔范围外,不调整 | ||
| 9 | - * (4)、如果第二个间隔大,调整中间班次发车时间+1分钟,如果调整后的间隔在区间间隔范围外,不调整 | ||
| 10 | - * 3、如果可调整,但是相关的停站时间无法满足,不调整 | ||
| 11 | - * | ||
| 12 | - * 以1分钟调整,不停的迭代上述步骤 | ||
| 13 | - * | ||
| 14 | - * 4、如果还有没有满足要求的班次,此时需要智能修改分班路牌头尾班次,删除,或这加入,然后再次迭代 | ||
| 15 | - */ | ||
| 16 | -var AdjustTripS2 = (function() { | ||
| 17 | - var iBcCountOfGroup = 3; // 3个班次一次参与计算 | ||
| 18 | - var aBcOfGroup = []; | ||
| 19 | - var aBcIntervalOfGroup = []; // 班次间隔列表,3个班次,2个间隔 | ||
| 20 | - var oBcFcTime; // 班次发车时间 | ||
| 21 | - | ||
| 22 | - /** | ||
| 23 | - * 按照规则计算班次列表。 | ||
| 24 | - * @param iStartIndex {int} 开始索引 | ||
| 25 | - * @param aBc {array} 班次列表 | ||
| 26 | - * @private | ||
| 27 | - */ | ||
| 28 | - function _calcuBcGroup(iStartIndex, aBc) { | ||
| 29 | - var i; | ||
| 30 | - var j; | ||
| 31 | - | ||
| 32 | - aBcOfGroup = []; | ||
| 33 | - aBcIntervalOfGroup = []; | ||
| 34 | - for (i = iStartIndex; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 35 | - for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 36 | - aBcOfGroup.push(aBc[j]); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 40 | - if (j < aBcOfGroup.length - 1) { | ||
| 41 | - aBcIntervalOfGroup.push( | ||
| 42 | - aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 43 | - aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - } | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * 排序班次列表。 | ||
| 51 | - * @param aBc {array} 班次列表 | ||
| 52 | - * @param isAsc {boolean} 是否升序 | ||
| 53 | - * @private | ||
| 54 | - */ | ||
| 55 | - function _sortBc(aBc, isAsc) { | ||
| 56 | - aBc.sort(function(o1, o2) { | ||
| 57 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 58 | - return -1; | ||
| 59 | - } else { | ||
| 60 | - return 1; | ||
| 61 | - } | ||
| 62 | - }); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 是否可以调整班次发车时间。 | ||
| 67 | - * @param oLp {InternalLpObj} 路牌对象 | ||
| 68 | - * @param oBc {InternalBcObj} 班次对象 | ||
| 69 | - * @param oParam {ParameterObj} 参数对象 | ||
| 70 | - * @param iStep {int} 修正时间步长 | ||
| 71 | - * @private | ||
| 72 | - */ | ||
| 73 | - function _isModifyBcFcsj(oLp, oBc, oParam, iStep) { | ||
| 74 | - // 获取车次链个数 | ||
| 75 | - var iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 76 | - | ||
| 77 | - var i; | ||
| 78 | - var j; | ||
| 79 | - var oBcIndex; | ||
| 80 | - var iQIndex; | ||
| 81 | - var iBcIndex; | ||
| 82 | - var iBcCount; | ||
| 83 | - var oPreBc; | ||
| 84 | - | ||
| 85 | - var iBcStopTime; | ||
| 86 | - | ||
| 87 | - var aRangeStopTime; | ||
| 88 | - | ||
| 89 | - for (i = 0; i < iBcChainCount; i++) { | ||
| 90 | - oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 91 | - iQIndex = oBcIndex["s_q"]; | ||
| 92 | - iBcIndex = oBcIndex["s_b"]; | ||
| 93 | - iBcCount = oBcIndex["bcount"]; | ||
| 94 | - | ||
| 95 | - oPreBc = oLp.getPreBc(oBc); | ||
| 96 | - | ||
| 97 | - // 如果是第一个班次 | ||
| 98 | - if (!oPreBc) { | ||
| 99 | - if (oBc.fnIsFirstBc()) { // 如果是方向头班车 | ||
| 100 | - return false; | ||
| 101 | - } else { | ||
| 102 | - return true; | ||
| 103 | - } | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - if (oPreBc.fnGetEatTime() > 0) { // 如果是吃饭班次,不能修改发车时间 | ||
| 107 | - return false; | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - aRangeStopTime = oParam.calcuTripLayoverTimeRange( | ||
| 111 | - oPreBc.getArrTimeObj(), oPreBc.isUp(), oPreBc.getBcTime() | ||
| 112 | - ); | ||
| 113 | - iBcStopTime = oPreBc.getStopTime() + iStep; | ||
| 114 | - if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime <= aRangeStopTime[1]) { | ||
| 115 | - return true; | ||
| 116 | - } else { | ||
| 117 | - return false; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - /** | ||
| 125 | - * 调整发车时间(调整当前班次后,需要处理后续路牌的所有班次)。 | ||
| 126 | - * @param olp {InternalLpObj} 路牌对象 | ||
| 127 | - * @param oBc {InternalBcObj} 班次对象 | ||
| 128 | - * @param iMin {int} 分钟 | ||
| 129 | - * @param oParam {ParameterObj} 参数对象 | ||
| 130 | - * @private | ||
| 131 | - */ | ||
| 132 | - function _modifyFcsj(olp, oBc, iMin, oParam) { | ||
| 133 | - oBc._$_fcsjObj.add(iMin, "m"); | ||
| 134 | - oBc.setArrTimeObj(oParam.addMinute( | ||
| 135 | - oBc.getFcTimeObj(), | ||
| 136 | - oParam.calcuTravelTime( | ||
| 137 | - oBc.getFcTimeObj(), | ||
| 138 | - oBc.isUp()) | ||
| 139 | - )); | ||
| 140 | - | ||
| 141 | - // 平衡当前路牌的所有班次时间(修正不准确的停站时间) | ||
| 142 | - olp.fnAdjustBcTime_layover(oParam); | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - /** | ||
| 146 | - * 平衡车距内部方法。 | ||
| 147 | - * @param aBc {array} 班次列表 | ||
| 148 | - * @param aSchedule {InternalScheduleObj} 行车计划对象 | ||
| 149 | - * @param oParam {ParameterObj} 参数对象 | ||
| 150 | - * @param iFre {int} 递归次数 | ||
| 151 | - * @private | ||
| 152 | - */ | ||
| 153 | - function _f1(aBc, aSchedule, oParam, iFre) { | ||
| 154 | - if (iFre > 0) { | ||
| 155 | - // 按照时间升序班次列表 | ||
| 156 | - _sortBc(aBc, true); | ||
| 157 | - | ||
| 158 | - var i; | ||
| 159 | - for (i = 0; i <= aBc.length; i++) { | ||
| 160 | - // 获取班次列表 | ||
| 161 | - _calcuBcGroup(i, aBc); | ||
| 162 | - | ||
| 163 | - if (aBcOfGroup.length > 0) { | ||
| 164 | - // 获取中间预调整的班次时间 | ||
| 165 | - oBcFcTime = aBcOfGroup[1].getFcTimeObj(); | ||
| 166 | - | ||
| 167 | - if (oParam.isMPeakBc(oBcFcTime)) { // 早高峰 | ||
| 168 | - if (aBcIntervalOfGroup[0] < oParam.getMPeakMinFcjx()) { | ||
| 169 | - // +1分钟 | ||
| 170 | - if (_isModifyBcFcsj( | ||
| 171 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 172 | - aBcOfGroup[1], | ||
| 173 | - oParam, | ||
| 174 | - 1 | ||
| 175 | - )) { | ||
| 176 | - _modifyFcsj( | ||
| 177 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 178 | - aBcOfGroup[1], | ||
| 179 | - 1, | ||
| 180 | - oParam | ||
| 181 | - ); | ||
| 182 | - } | ||
| 183 | - } else if (aBcIntervalOfGroup[0] > oParam.getMPeakMaxFcjx()) { | ||
| 184 | - // -1分钟 | ||
| 185 | - if (_isModifyBcFcsj( | ||
| 186 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 187 | - aBcOfGroup[1], | ||
| 188 | - oParam, | ||
| 189 | - -1 | ||
| 190 | - )) { | ||
| 191 | - _modifyFcsj( | ||
| 192 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 193 | - aBcOfGroup[1], | ||
| 194 | - -1, | ||
| 195 | - oParam | ||
| 196 | - ); | ||
| 197 | - } | ||
| 198 | - } else { | ||
| 199 | - // -1或+1分钟 | ||
| 200 | - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 201 | - // 两个间隔相差1分钟,不处理 | ||
| 202 | - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 203 | - if (_isModifyBcFcsj( | ||
| 204 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 205 | - aBcOfGroup[1], | ||
| 206 | - oParam, | ||
| 207 | - -1 | ||
| 208 | - )) { | ||
| 209 | - _modifyFcsj( | ||
| 210 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 211 | - aBcOfGroup[1], | ||
| 212 | - -1, | ||
| 213 | - oParam | ||
| 214 | - ); | ||
| 215 | - } | ||
| 216 | - } else { | ||
| 217 | - if (_isModifyBcFcsj( | ||
| 218 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 219 | - aBcOfGroup[1], | ||
| 220 | - oParam, | ||
| 221 | - +1 | ||
| 222 | - )) { | ||
| 223 | - _modifyFcsj( | ||
| 224 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 225 | - aBcOfGroup[1], | ||
| 226 | - +1, | ||
| 227 | - oParam | ||
| 228 | - ); | ||
| 229 | - } | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - } else if (oParam.isEPeakBc(oBcFcTime)) { // 晚高峰 | ||
| 235 | - if (aBcIntervalOfGroup[0] < oParam.getEPeakMinFcjx()) { | ||
| 236 | - // +1分钟 | ||
| 237 | - if (_isModifyBcFcsj( | ||
| 238 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 239 | - aBcOfGroup[1], | ||
| 240 | - oParam, | ||
| 241 | - 1 | ||
| 242 | - )) { | ||
| 243 | - _modifyFcsj( | ||
| 244 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 245 | - aBcOfGroup[1], | ||
| 246 | - 1, | ||
| 247 | - oParam | ||
| 248 | - ); | ||
| 249 | - } | ||
| 250 | - } else if (aBcIntervalOfGroup[0] > oParam.getEPeakMaxFcjx()) { | ||
| 251 | - // -1分钟 | ||
| 252 | - if (_isModifyBcFcsj( | ||
| 253 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 254 | - aBcOfGroup[1], | ||
| 255 | - oParam, | ||
| 256 | - -1 | ||
| 257 | - )) { | ||
| 258 | - _modifyFcsj( | ||
| 259 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 260 | - aBcOfGroup[1], | ||
| 261 | - -1, | ||
| 262 | - oParam | ||
| 263 | - ); | ||
| 264 | - } | ||
| 265 | - } else { | ||
| 266 | - // -1或+1分钟 | ||
| 267 | - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 268 | - // 两个间隔相差1分钟,不处理 | ||
| 269 | - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 270 | - if (_isModifyBcFcsj( | ||
| 271 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 272 | - aBcOfGroup[1], | ||
| 273 | - oParam, | ||
| 274 | - -1 | ||
| 275 | - )) { | ||
| 276 | - _modifyFcsj( | ||
| 277 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 278 | - aBcOfGroup[1], | ||
| 279 | - -1, | ||
| 280 | - oParam | ||
| 281 | - ); | ||
| 282 | - } | ||
| 283 | - } else { | ||
| 284 | - if (_isModifyBcFcsj( | ||
| 285 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 286 | - aBcOfGroup[1], | ||
| 287 | - oParam, | ||
| 288 | - +1 | ||
| 289 | - )) { | ||
| 290 | - _modifyFcsj( | ||
| 291 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 292 | - aBcOfGroup[1], | ||
| 293 | - +1, | ||
| 294 | - oParam | ||
| 295 | - ); | ||
| 296 | - } | ||
| 297 | - } | ||
| 298 | - } | ||
| 299 | - } else { // 低谷 | ||
| 300 | - if (aBcIntervalOfGroup[0] < oParam.getTroughMinFcjx()) { | ||
| 301 | - // +1分钟 | ||
| 302 | - if (_isModifyBcFcsj( | ||
| 303 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 304 | - aBcOfGroup[1], | ||
| 305 | - oParam, | ||
| 306 | - 1 | ||
| 307 | - )) { | ||
| 308 | - _modifyFcsj( | ||
| 309 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 310 | - aBcOfGroup[1], | ||
| 311 | - 1, | ||
| 312 | - oParam | ||
| 313 | - ); | ||
| 314 | - } | ||
| 315 | - } else if (aBcIntervalOfGroup[0] > oParam.getTroughMaxFcjx()) { | ||
| 316 | - // -1分钟 | ||
| 317 | - if (_isModifyBcFcsj( | ||
| 318 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 319 | - aBcOfGroup[1], | ||
| 320 | - oParam, | ||
| 321 | - -1 | ||
| 322 | - )) { | ||
| 323 | - _modifyFcsj( | ||
| 324 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 325 | - aBcOfGroup[1], | ||
| 326 | - -1, | ||
| 327 | - oParam | ||
| 328 | - ); | ||
| 329 | - } | ||
| 330 | - } else { | ||
| 331 | - // -1或+1分钟 | ||
| 332 | - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 333 | - // 两个间隔相差1分钟,不处理 | ||
| 334 | - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 335 | - if (_isModifyBcFcsj( | ||
| 336 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 337 | - aBcOfGroup[1], | ||
| 338 | - oParam, | ||
| 339 | - -1 | ||
| 340 | - )) { | ||
| 341 | - _modifyFcsj( | ||
| 342 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 343 | - aBcOfGroup[1], | ||
| 344 | - -1, | ||
| 345 | - oParam | ||
| 346 | - ); | ||
| 347 | - } | ||
| 348 | - } else { | ||
| 349 | - if (_isModifyBcFcsj( | ||
| 350 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 351 | - aBcOfGroup[1], | ||
| 352 | - oParam, | ||
| 353 | - +1 | ||
| 354 | - )) { | ||
| 355 | - _modifyFcsj( | ||
| 356 | - aBcOfGroup[1].getGroup().getLp(), | ||
| 357 | - aBcOfGroup[1], | ||
| 358 | - +1, | ||
| 359 | - oParam | ||
| 360 | - ); | ||
| 361 | - } | ||
| 362 | - } | ||
| 363 | - } | ||
| 364 | - } | ||
| 365 | - } | ||
| 366 | - | ||
| 367 | - } | ||
| 368 | - | ||
| 369 | - // 递归迭代 | ||
| 370 | - _f1(aBc, aSchedule, oParam, iFre - 1); | ||
| 371 | - } | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - /** | ||
| 375 | - * 主函数-返回的策略函数。 | ||
| 376 | - * @param aUpBc {array} 上行班次数组 | ||
| 377 | - * @param aDownBc {array} 下行班次数组 | ||
| 378 | - * @param oSchedule {InternalScheduleObj} 行车计划对象 | ||
| 379 | - * @param oParam {ParameterObj} 参数对象 | ||
| 380 | - */ | ||
| 381 | - function main(aUpBc, aDownBc, oSchedule, oParam) { | ||
| 382 | - // TODO:以后这里可能需要检测参数的正确性 | ||
| 383 | - | ||
| 384 | - _f1(aUpBc, oSchedule, oParam, 5); | ||
| 385 | - _f1(aDownBc, oSchedule, oParam, 5); | ||
| 386 | - | ||
| 387 | - // oSchedule.fnAdjustLpBcInterval(1); | ||
| 388 | - | ||
| 389 | - // _f1(aUpBc, oSchedule, oParam, 5); | ||
| 390 | - // _f1(aDownBc, oSchedule, oParam, 5); | ||
| 391 | - | ||
| 392 | - } | ||
| 393 | - | ||
| 394 | - return main; | 1 | +/** |
| 2 | + * 平衡车距策略2(太死板,速度慢,效果不佳啊,建议不使用)。 | ||
| 3 | + * 调整策略如下(有点像滤波器): | ||
| 4 | + * 1、从头开始,连续取3个班次,获取2个间隔,根据间隔的不同及其他规则,调整中间班次的发车时间 | ||
| 5 | + * 2、基本调整如下, | ||
| 6 | + * (1)、如果2个间隔时间差1分钟,不调整 | ||
| 7 | + * (2)、如果第一个间隔在区间间隔范围外,调整发车时间1分钟到指定的边界 | ||
| 8 | + * (3)、如果第一个间隔大,调整中间班次发车时间-1分钟,如果调整后的间隔在区间间隔范围外,不调整 | ||
| 9 | + * (4)、如果第二个间隔大,调整中间班次发车时间+1分钟,如果调整后的间隔在区间间隔范围外,不调整 | ||
| 10 | + * 3、如果可调整,但是相关的停站时间无法满足,不调整 | ||
| 11 | + * | ||
| 12 | + * 以1分钟调整,不停的迭代上述步骤 | ||
| 13 | + * | ||
| 14 | + * 4、如果还有没有满足要求的班次,此时需要智能修改分班路牌头尾班次,删除,或这加入,然后再次迭代 | ||
| 15 | + */ | ||
| 16 | +var AdjustTripS2 = (function() { | ||
| 17 | + var iBcCountOfGroup = 3; // 3个班次一次参与计算 | ||
| 18 | + var aBcOfGroup = []; | ||
| 19 | + var aBcIntervalOfGroup = []; // 班次间隔列表,3个班次,2个间隔 | ||
| 20 | + var oBcFcTime; // 班次发车时间 | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 按照规则计算班次列表。 | ||
| 24 | + * @param iStartIndex {int} 开始索引 | ||
| 25 | + * @param aBc {array} 班次列表 | ||
| 26 | + * @private | ||
| 27 | + */ | ||
| 28 | + function _calcuBcGroup(iStartIndex, aBc) { | ||
| 29 | + var i; | ||
| 30 | + var j; | ||
| 31 | + | ||
| 32 | + aBcOfGroup = []; | ||
| 33 | + aBcIntervalOfGroup = []; | ||
| 34 | + for (i = iStartIndex; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 35 | + for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 36 | + aBcOfGroup.push(aBc[j]); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 40 | + if (j < aBcOfGroup.length - 1) { | ||
| 41 | + aBcIntervalOfGroup.push( | ||
| 42 | + aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 43 | + aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 排序班次列表。 | ||
| 51 | + * @param aBc {array} 班次列表 | ||
| 52 | + * @param isAsc {boolean} 是否升序 | ||
| 53 | + * @private | ||
| 54 | + */ | ||
| 55 | + function _sortBc(aBc, isAsc) { | ||
| 56 | + aBc.sort(function(o1, o2) { | ||
| 57 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 58 | + return -1; | ||
| 59 | + } else { | ||
| 60 | + return 1; | ||
| 61 | + } | ||
| 62 | + }); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 是否可以调整班次发车时间。 | ||
| 67 | + * @param oLp {InternalLpObj} 路牌对象 | ||
| 68 | + * @param oBc {InternalBcObj} 班次对象 | ||
| 69 | + * @param oParam {ParameterObj} 参数对象 | ||
| 70 | + * @param iStep {int} 修正时间步长 | ||
| 71 | + * @private | ||
| 72 | + */ | ||
| 73 | + function _isModifyBcFcsj(oLp, oBc, oParam, iStep) { | ||
| 74 | + // 获取车次链个数 | ||
| 75 | + var iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 76 | + | ||
| 77 | + var i; | ||
| 78 | + var j; | ||
| 79 | + var oBcIndex; | ||
| 80 | + var iQIndex; | ||
| 81 | + var iBcIndex; | ||
| 82 | + var iBcCount; | ||
| 83 | + var oPreBc; | ||
| 84 | + | ||
| 85 | + var iBcStopTime; | ||
| 86 | + | ||
| 87 | + var aRangeStopTime; | ||
| 88 | + | ||
| 89 | + for (i = 0; i < iBcChainCount; i++) { | ||
| 90 | + oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 91 | + iQIndex = oBcIndex["s_q"]; | ||
| 92 | + iBcIndex = oBcIndex["s_b"]; | ||
| 93 | + iBcCount = oBcIndex["bcount"]; | ||
| 94 | + | ||
| 95 | + oPreBc = oLp.getPreBc(oBc); | ||
| 96 | + | ||
| 97 | + // 如果是第一个班次 | ||
| 98 | + if (!oPreBc) { | ||
| 99 | + if (oBc.fnIsFirstBc()) { // 如果是方向头班车 | ||
| 100 | + return false; | ||
| 101 | + } else { | ||
| 102 | + return true; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + if (oPreBc.fnGetEatTime() > 0) { // 如果是吃饭班次,不能修改发车时间 | ||
| 107 | + return false; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + aRangeStopTime = oParam.calcuTripLayoverTimeRange( | ||
| 111 | + oPreBc.getArrTimeObj(), oPreBc.isUp(), oPreBc.getBcTime() | ||
| 112 | + ); | ||
| 113 | + iBcStopTime = oPreBc.getStopTime() + iStep; | ||
| 114 | + if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime <= aRangeStopTime[1]) { | ||
| 115 | + return true; | ||
| 116 | + } else { | ||
| 117 | + return false; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 调整发车时间(调整当前班次后,需要处理后续路牌的所有班次)。 | ||
| 126 | + * @param olp {InternalLpObj} 路牌对象 | ||
| 127 | + * @param oBc {InternalBcObj} 班次对象 | ||
| 128 | + * @param iMin {int} 分钟 | ||
| 129 | + * @param oParam {ParameterObj} 参数对象 | ||
| 130 | + * @private | ||
| 131 | + */ | ||
| 132 | + function _modifyFcsj(olp, oBc, iMin, oParam) { | ||
| 133 | + oBc._$_fcsjObj.add(iMin, "m"); | ||
| 134 | + oBc.setArrTimeObj(oParam.addMinute( | ||
| 135 | + oBc.getFcTimeObj(), | ||
| 136 | + oParam.calcuTravelTime( | ||
| 137 | + oBc.getFcTimeObj(), | ||
| 138 | + oBc.isUp()) | ||
| 139 | + )); | ||
| 140 | + | ||
| 141 | + // 平衡当前路牌的所有班次时间(修正不准确的停站时间) | ||
| 142 | + olp.fnAdjustBcTime_layover(oParam); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 平衡车距内部方法。 | ||
| 147 | + * @param aBc {array} 班次列表 | ||
| 148 | + * @param aSchedule {InternalScheduleObj} 行车计划对象 | ||
| 149 | + * @param oParam {ParameterObj} 参数对象 | ||
| 150 | + * @param iFre {int} 递归次数 | ||
| 151 | + * @private | ||
| 152 | + */ | ||
| 153 | + function _f1(aBc, aSchedule, oParam, iFre) { | ||
| 154 | + if (iFre > 0) { | ||
| 155 | + // 按照时间升序班次列表 | ||
| 156 | + _sortBc(aBc, true); | ||
| 157 | + | ||
| 158 | + var i; | ||
| 159 | + for (i = 0; i <= aBc.length; i++) { | ||
| 160 | + // 获取班次列表 | ||
| 161 | + _calcuBcGroup(i, aBc); | ||
| 162 | + | ||
| 163 | + if (aBcOfGroup.length > 0) { | ||
| 164 | + // 获取中间预调整的班次时间 | ||
| 165 | + oBcFcTime = aBcOfGroup[1].getFcTimeObj(); | ||
| 166 | + | ||
| 167 | + if (oParam.isMPeakBc(oBcFcTime)) { // 早高峰 | ||
| 168 | + if (aBcIntervalOfGroup[0] < oParam.getMPeakMinFcjx()) { | ||
| 169 | + // +1分钟 | ||
| 170 | + if (_isModifyBcFcsj( | ||
| 171 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 172 | + aBcOfGroup[1], | ||
| 173 | + oParam, | ||
| 174 | + 1 | ||
| 175 | + )) { | ||
| 176 | + _modifyFcsj( | ||
| 177 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 178 | + aBcOfGroup[1], | ||
| 179 | + 1, | ||
| 180 | + oParam | ||
| 181 | + ); | ||
| 182 | + } | ||
| 183 | + } else if (aBcIntervalOfGroup[0] > oParam.getMPeakMaxFcjx()) { | ||
| 184 | + // -1分钟 | ||
| 185 | + if (_isModifyBcFcsj( | ||
| 186 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 187 | + aBcOfGroup[1], | ||
| 188 | + oParam, | ||
| 189 | + -1 | ||
| 190 | + )) { | ||
| 191 | + _modifyFcsj( | ||
| 192 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 193 | + aBcOfGroup[1], | ||
| 194 | + -1, | ||
| 195 | + oParam | ||
| 196 | + ); | ||
| 197 | + } | ||
| 198 | + } else { | ||
| 199 | + // -1或+1分钟 | ||
| 200 | + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 201 | + // 两个间隔相差1分钟,不处理 | ||
| 202 | + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 203 | + if (_isModifyBcFcsj( | ||
| 204 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 205 | + aBcOfGroup[1], | ||
| 206 | + oParam, | ||
| 207 | + -1 | ||
| 208 | + )) { | ||
| 209 | + _modifyFcsj( | ||
| 210 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 211 | + aBcOfGroup[1], | ||
| 212 | + -1, | ||
| 213 | + oParam | ||
| 214 | + ); | ||
| 215 | + } | ||
| 216 | + } else { | ||
| 217 | + if (_isModifyBcFcsj( | ||
| 218 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 219 | + aBcOfGroup[1], | ||
| 220 | + oParam, | ||
| 221 | + +1 | ||
| 222 | + )) { | ||
| 223 | + _modifyFcsj( | ||
| 224 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 225 | + aBcOfGroup[1], | ||
| 226 | + +1, | ||
| 227 | + oParam | ||
| 228 | + ); | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + } else if (oParam.isEPeakBc(oBcFcTime)) { // 晚高峰 | ||
| 235 | + if (aBcIntervalOfGroup[0] < oParam.getEPeakMinFcjx()) { | ||
| 236 | + // +1分钟 | ||
| 237 | + if (_isModifyBcFcsj( | ||
| 238 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 239 | + aBcOfGroup[1], | ||
| 240 | + oParam, | ||
| 241 | + 1 | ||
| 242 | + )) { | ||
| 243 | + _modifyFcsj( | ||
| 244 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 245 | + aBcOfGroup[1], | ||
| 246 | + 1, | ||
| 247 | + oParam | ||
| 248 | + ); | ||
| 249 | + } | ||
| 250 | + } else if (aBcIntervalOfGroup[0] > oParam.getEPeakMaxFcjx()) { | ||
| 251 | + // -1分钟 | ||
| 252 | + if (_isModifyBcFcsj( | ||
| 253 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 254 | + aBcOfGroup[1], | ||
| 255 | + oParam, | ||
| 256 | + -1 | ||
| 257 | + )) { | ||
| 258 | + _modifyFcsj( | ||
| 259 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 260 | + aBcOfGroup[1], | ||
| 261 | + -1, | ||
| 262 | + oParam | ||
| 263 | + ); | ||
| 264 | + } | ||
| 265 | + } else { | ||
| 266 | + // -1或+1分钟 | ||
| 267 | + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 268 | + // 两个间隔相差1分钟,不处理 | ||
| 269 | + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 270 | + if (_isModifyBcFcsj( | ||
| 271 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 272 | + aBcOfGroup[1], | ||
| 273 | + oParam, | ||
| 274 | + -1 | ||
| 275 | + )) { | ||
| 276 | + _modifyFcsj( | ||
| 277 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 278 | + aBcOfGroup[1], | ||
| 279 | + -1, | ||
| 280 | + oParam | ||
| 281 | + ); | ||
| 282 | + } | ||
| 283 | + } else { | ||
| 284 | + if (_isModifyBcFcsj( | ||
| 285 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 286 | + aBcOfGroup[1], | ||
| 287 | + oParam, | ||
| 288 | + +1 | ||
| 289 | + )) { | ||
| 290 | + _modifyFcsj( | ||
| 291 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 292 | + aBcOfGroup[1], | ||
| 293 | + +1, | ||
| 294 | + oParam | ||
| 295 | + ); | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + } | ||
| 299 | + } else { // 低谷 | ||
| 300 | + if (aBcIntervalOfGroup[0] < oParam.getTroughMinFcjx()) { | ||
| 301 | + // +1分钟 | ||
| 302 | + if (_isModifyBcFcsj( | ||
| 303 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 304 | + aBcOfGroup[1], | ||
| 305 | + oParam, | ||
| 306 | + 1 | ||
| 307 | + )) { | ||
| 308 | + _modifyFcsj( | ||
| 309 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 310 | + aBcOfGroup[1], | ||
| 311 | + 1, | ||
| 312 | + oParam | ||
| 313 | + ); | ||
| 314 | + } | ||
| 315 | + } else if (aBcIntervalOfGroup[0] > oParam.getTroughMaxFcjx()) { | ||
| 316 | + // -1分钟 | ||
| 317 | + if (_isModifyBcFcsj( | ||
| 318 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 319 | + aBcOfGroup[1], | ||
| 320 | + oParam, | ||
| 321 | + -1 | ||
| 322 | + )) { | ||
| 323 | + _modifyFcsj( | ||
| 324 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 325 | + aBcOfGroup[1], | ||
| 326 | + -1, | ||
| 327 | + oParam | ||
| 328 | + ); | ||
| 329 | + } | ||
| 330 | + } else { | ||
| 331 | + // -1或+1分钟 | ||
| 332 | + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 333 | + // 两个间隔相差1分钟,不处理 | ||
| 334 | + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 335 | + if (_isModifyBcFcsj( | ||
| 336 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 337 | + aBcOfGroup[1], | ||
| 338 | + oParam, | ||
| 339 | + -1 | ||
| 340 | + )) { | ||
| 341 | + _modifyFcsj( | ||
| 342 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 343 | + aBcOfGroup[1], | ||
| 344 | + -1, | ||
| 345 | + oParam | ||
| 346 | + ); | ||
| 347 | + } | ||
| 348 | + } else { | ||
| 349 | + if (_isModifyBcFcsj( | ||
| 350 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 351 | + aBcOfGroup[1], | ||
| 352 | + oParam, | ||
| 353 | + +1 | ||
| 354 | + )) { | ||
| 355 | + _modifyFcsj( | ||
| 356 | + aBcOfGroup[1].getGroup().getLp(), | ||
| 357 | + aBcOfGroup[1], | ||
| 358 | + +1, | ||
| 359 | + oParam | ||
| 360 | + ); | ||
| 361 | + } | ||
| 362 | + } | ||
| 363 | + } | ||
| 364 | + } | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + // 递归迭代 | ||
| 370 | + _f1(aBc, aSchedule, oParam, iFre - 1); | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + /** | ||
| 375 | + * 主函数-返回的策略函数。 | ||
| 376 | + * @param aUpBc {array} 上行班次数组 | ||
| 377 | + * @param aDownBc {array} 下行班次数组 | ||
| 378 | + * @param oSchedule {InternalScheduleObj} 行车计划对象 | ||
| 379 | + * @param oParam {ParameterObj} 参数对象 | ||
| 380 | + */ | ||
| 381 | + function main(aUpBc, aDownBc, oSchedule, oParam) { | ||
| 382 | + // TODO:以后这里可能需要检测参数的正确性 | ||
| 383 | + | ||
| 384 | + _f1(aUpBc, oSchedule, oParam, 5); | ||
| 385 | + _f1(aDownBc, oSchedule, oParam, 5); | ||
| 386 | + | ||
| 387 | + // oSchedule.fnAdjustLpBcInterval(1); | ||
| 388 | + | ||
| 389 | + // _f1(aUpBc, oSchedule, oParam, 5); | ||
| 390 | + // _f1(aDownBc, oSchedule, oParam, 5); | ||
| 391 | + | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + return main; | ||
| 395 | }()); | 395 | }()); |
| 396 | \ No newline at end of file | 396 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS3.js
| 1 | -/** | ||
| 2 | - * 平衡车距策略3。 | ||
| 3 | - * 将逻辑拆成三个部分,做什么,是否能做,修正班次时间 | ||
| 4 | - * 不考虑停站,吃饭时间的问题,直接调整发车时间 | ||
| 5 | - * 1、发车间隔调整规则: | ||
| 6 | - * (1)、从班次列表头开始,连续取3个班次,获取2个间隔,根据不通的条件调整中间班次的发车时间 | ||
| 7 | - * (2)、如果当前班次在指定时间段的发车间隔范围外,则小的+1,大的-1 | ||
| 8 | - * (3)、如果在范围内,但是下一个班次不在指定时间段内,不处理 | ||
| 9 | - * (4)、如果下一个班次也在指定时间段内,则左右平滑+1或-1 | ||
| 10 | - * 2、使用方法 | ||
| 11 | - * (1)、上行班次列表平衡5次 | ||
| 12 | - * (2)、下行班次列表平衡5次 | ||
| 13 | - * | ||
| 14 | - */ | ||
| 15 | -var AdjustTripS3 = (function() { | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 排序班次列表。 | ||
| 19 | - * @param aBc {array} 班次列表 | ||
| 20 | - * @param isAsc {boolean} 是否升序 | ||
| 21 | - * @private | ||
| 22 | - */ | ||
| 23 | - function _sortBc(aBc, isAsc) { | ||
| 24 | - aBc.sort(function(o1, o2) { | ||
| 25 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 26 | - return -1; | ||
| 27 | - } else { | ||
| 28 | - return 1; | ||
| 29 | - } | ||
| 30 | - }); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - //--------------- 每个trip调整分为三步(以下)----------------// | ||
| 34 | - // 1、做什么,返回需要调整的时间 | ||
| 35 | - function _whatToDo(aTripOfGroup, aTripIntervalOfGroup, paramObj) { | ||
| 36 | - // 中间班次的发车时间,参与计算 | ||
| 37 | - var oTripFcTime = aTripOfGroup[1].getFcTimeObj(); | ||
| 38 | - var oNextTripFcTime = aTripOfGroup[2].getFcTimeObj() | ||
| 39 | - if (paramObj.isMPeakBc(oTripFcTime)) { // 早高峰 | ||
| 40 | - if (aTripIntervalOfGroup[0] < paramObj.getMPeakMinFcjx()) { | ||
| 41 | - // +1分钟 | ||
| 42 | - return 1; | ||
| 43 | - } else if (aTripIntervalOfGroup[0] > paramObj.getMPeakMaxFcjx()) { | ||
| 44 | - // -1分钟 | ||
| 45 | - return -1; | ||
| 46 | - } else { | ||
| 47 | - if (!paramObj.isMPeakBc(oNextTripFcTime)) { | ||
| 48 | - // 下一个班次不是早高峰,不处理 | ||
| 49 | - } else { | ||
| 50 | - // -1或+1分钟 | ||
| 51 | - if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 52 | - return 0; | ||
| 53 | - } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 54 | - return -1; | ||
| 55 | - } else { | ||
| 56 | - return 1; | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - } else if (paramObj.isEPeakBc(oTripFcTime)) { // 晚高峰 | ||
| 62 | - if (aTripIntervalOfGroup[0] < paramObj.getEPeakMinFcjx()) { | ||
| 63 | - // +1分钟 | ||
| 64 | - return 1; | ||
| 65 | - } else if (aTripIntervalOfGroup[0] > paramObj.getEPeakMaxFcjx()) { | ||
| 66 | - // -1分钟 | ||
| 67 | - return -1; | ||
| 68 | - } else { | ||
| 69 | - if (!paramObj.isEPeakBc(oNextTripFcTime)) { | ||
| 70 | - // 下一个班次不是晚高峰,不处理 | ||
| 71 | - } else { | ||
| 72 | - // -1或+1分钟 | ||
| 73 | - if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 74 | - return 0; | ||
| 75 | - } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 76 | - return -1; | ||
| 77 | - } else { | ||
| 78 | - return 1; | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | - } else { // 低谷 | ||
| 83 | - if (aTripIntervalOfGroup[0] < paramObj.getTroughMinFcjx()) { | ||
| 84 | - // +1分钟 | ||
| 85 | - return 1; | ||
| 86 | - } else if (aTripIntervalOfGroup[0] > paramObj.getTroughMaxFcjx()) { | ||
| 87 | - // -1分钟 | ||
| 88 | - return -1; | ||
| 89 | - } else { | ||
| 90 | - if (!paramObj.isTroughBc(oNextTripFcTime)) { | ||
| 91 | - // 下一个班次不是低谷班次,不处理 | ||
| 92 | - } else { | ||
| 93 | - // -1或+1分钟 | ||
| 94 | - if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 95 | - return 0; | ||
| 96 | - } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 97 | - return -1; | ||
| 98 | - } else { | ||
| 99 | - return 1; | ||
| 100 | - } | ||
| 101 | - } | ||
| 102 | - } | ||
| 103 | - } | ||
| 104 | - } | ||
| 105 | - // 2、是否能做,返回true/false | ||
| 106 | - function _canDo(aTripOfGroup, iTime, paramObj) { | ||
| 107 | - // TODO | ||
| 108 | - return iTime != 0; | ||
| 109 | - } | ||
| 110 | - // 3、修正班次时间 | ||
| 111 | - function _do(aBc, iIndex, iTime, paramObj) { | ||
| 112 | - // // 从当前班次开始,后续所有的班次都要调整 | ||
| 113 | - // var i; | ||
| 114 | - // for (i = iIndex; i < aBc.length; i++) { | ||
| 115 | - // aBc[i]._$_fcsjObj.add(iTime, "m"); | ||
| 116 | - // aBc[i].setArrTimeObj(paramObj.addMinute( | ||
| 117 | - // aBc[i].getFcTimeObj(), | ||
| 118 | - // paramObj.calcuTravelTime( | ||
| 119 | - // aBc[i].getFcTimeObj(), | ||
| 120 | - // aBc[i].isUp()) | ||
| 121 | - // )); | ||
| 122 | - // } | ||
| 123 | - aBc[iIndex]._$_fcsjObj.add(iTime, "m"); | ||
| 124 | - aBc[iIndex].setBcTime(paramObj.calcuTravelTime( | ||
| 125 | - aBc[iIndex].getFcTimeObj(), aBc[iIndex].isUp())); | ||
| 126 | - aBc[iIndex].setArrTimeObj(paramObj.addMinute( | ||
| 127 | - aBc[iIndex].getFcTimeObj(), aBc[iIndex].getBcTime())); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - //--------------- 每个trip调整分为三步(以上)----------------// | ||
| 131 | - | ||
| 132 | - function _f1(aBc, schedule, paramObj, fre) { | ||
| 133 | - if (fre > 0) { | ||
| 134 | - // 生序排列班次 | ||
| 135 | - _sortBc(aBc, true); | ||
| 136 | - | ||
| 137 | - var i; | ||
| 138 | - var j; | ||
| 139 | - var k; | ||
| 140 | - | ||
| 141 | - var iTripCountOfGroup = 3; // 3个班次取一次计算 | ||
| 142 | - var aTripOfGroup; // 3个班次列表 | ||
| 143 | - var aTripIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 144 | - var iTime; // 调整的时间 | ||
| 145 | - | ||
| 146 | - for (i = 0; i <= aBc.length - iTripCountOfGroup; i++) { | ||
| 147 | - aTripOfGroup = []; | ||
| 148 | - aTripIntervalOfGroup = []; | ||
| 149 | - // 连续计算3个班次参与计算 | ||
| 150 | - for (j = i; j < i + iTripCountOfGroup; j++) { | ||
| 151 | - aTripOfGroup.push(aBc[j]); | ||
| 152 | - } | ||
| 153 | - // 连续2个班次间隔参与计算 | ||
| 154 | - for (k = 0; k < aTripOfGroup.length; k++) { | ||
| 155 | - if (k < aTripOfGroup.length - 1) { | ||
| 156 | - aTripIntervalOfGroup.push(aTripOfGroup[k + 1].getFcTimeObj().diff( | ||
| 157 | - aTripOfGroup[k].getFcTimeObj(), "m")); | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - iTime = _whatToDo(aTripOfGroup, aTripIntervalOfGroup, paramObj); | ||
| 162 | - if (_canDo(aTripOfGroup, iTime, paramObj)) { | ||
| 163 | - _do(aBc, j - 2, iTime, paramObj); | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - _f1(aBc, schedule, paramObj, fre - 1); | ||
| 169 | - | ||
| 170 | - } | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * 主函数-返回的策略函数。 | ||
| 177 | - * @param aUpBc {array} 上行班次数组 | ||
| 178 | - * @param aDownBc {array} 下行班次数组 | ||
| 179 | - * @param oSchedule {InternalScheduleObj} 行车计划对象 | ||
| 180 | - * @param oParam {ParameterObj} 参数对象 | ||
| 181 | - */ | ||
| 182 | - function main(aUpBc, aDownBc, oSchedule, oParam) { | ||
| 183 | - // TODO:以后这里可能需要检测参数的正确性 | ||
| 184 | - _f1(aUpBc, oSchedule, oParam, 5); | ||
| 185 | - _f1(aDownBc, oSchedule, oParam, 5); | ||
| 186 | - | ||
| 187 | - // oSchedule.fnAdjustLpBcInterval(1); | ||
| 188 | - | ||
| 189 | - // _f1(aUpBc, oSchedule, oParam, 5); | ||
| 190 | - // _f1(aDownBc, oSchedule, oParam, 5); | ||
| 191 | - | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | - return main; | ||
| 195 | - | 1 | +/** |
| 2 | + * 平衡车距策略3。 | ||
| 3 | + * 将逻辑拆成三个部分,做什么,是否能做,修正班次时间 | ||
| 4 | + * 不考虑停站,吃饭时间的问题,直接调整发车时间 | ||
| 5 | + * 1、发车间隔调整规则: | ||
| 6 | + * (1)、从班次列表头开始,连续取3个班次,获取2个间隔,根据不通的条件调整中间班次的发车时间 | ||
| 7 | + * (2)、如果当前班次在指定时间段的发车间隔范围外,则小的+1,大的-1 | ||
| 8 | + * (3)、如果在范围内,但是下一个班次不在指定时间段内,不处理 | ||
| 9 | + * (4)、如果下一个班次也在指定时间段内,则左右平滑+1或-1 | ||
| 10 | + * 2、使用方法 | ||
| 11 | + * (1)、上行班次列表平衡5次 | ||
| 12 | + * (2)、下行班次列表平衡5次 | ||
| 13 | + * | ||
| 14 | + */ | ||
| 15 | +var AdjustTripS3 = (function() { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 排序班次列表。 | ||
| 19 | + * @param aBc {array} 班次列表 | ||
| 20 | + * @param isAsc {boolean} 是否升序 | ||
| 21 | + * @private | ||
| 22 | + */ | ||
| 23 | + function _sortBc(aBc, isAsc) { | ||
| 24 | + aBc.sort(function(o1, o2) { | ||
| 25 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 26 | + return -1; | ||
| 27 | + } else { | ||
| 28 | + return 1; | ||
| 29 | + } | ||
| 30 | + }); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + //--------------- 每个trip调整分为三步(以下)----------------// | ||
| 34 | + // 1、做什么,返回需要调整的时间 | ||
| 35 | + function _whatToDo(aTripOfGroup, aTripIntervalOfGroup, paramObj) { | ||
| 36 | + // 中间班次的发车时间,参与计算 | ||
| 37 | + var oTripFcTime = aTripOfGroup[1].getFcTimeObj(); | ||
| 38 | + var oNextTripFcTime = aTripOfGroup[2].getFcTimeObj() | ||
| 39 | + if (paramObj.isMPeakBc(oTripFcTime)) { // 早高峰 | ||
| 40 | + if (aTripIntervalOfGroup[0] < paramObj.getMPeakMinFcjx()) { | ||
| 41 | + // +1分钟 | ||
| 42 | + return 1; | ||
| 43 | + } else if (aTripIntervalOfGroup[0] > paramObj.getMPeakMaxFcjx()) { | ||
| 44 | + // -1分钟 | ||
| 45 | + return -1; | ||
| 46 | + } else { | ||
| 47 | + if (!paramObj.isMPeakBc(oNextTripFcTime)) { | ||
| 48 | + // 下一个班次不是早高峰,不处理 | ||
| 49 | + } else { | ||
| 50 | + // -1或+1分钟 | ||
| 51 | + if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 52 | + return 0; | ||
| 53 | + } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 54 | + return -1; | ||
| 55 | + } else { | ||
| 56 | + return 1; | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + } else if (paramObj.isEPeakBc(oTripFcTime)) { // 晚高峰 | ||
| 62 | + if (aTripIntervalOfGroup[0] < paramObj.getEPeakMinFcjx()) { | ||
| 63 | + // +1分钟 | ||
| 64 | + return 1; | ||
| 65 | + } else if (aTripIntervalOfGroup[0] > paramObj.getEPeakMaxFcjx()) { | ||
| 66 | + // -1分钟 | ||
| 67 | + return -1; | ||
| 68 | + } else { | ||
| 69 | + if (!paramObj.isEPeakBc(oNextTripFcTime)) { | ||
| 70 | + // 下一个班次不是晚高峰,不处理 | ||
| 71 | + } else { | ||
| 72 | + // -1或+1分钟 | ||
| 73 | + if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 74 | + return 0; | ||
| 75 | + } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 76 | + return -1; | ||
| 77 | + } else { | ||
| 78 | + return 1; | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + } else { // 低谷 | ||
| 83 | + if (aTripIntervalOfGroup[0] < paramObj.getTroughMinFcjx()) { | ||
| 84 | + // +1分钟 | ||
| 85 | + return 1; | ||
| 86 | + } else if (aTripIntervalOfGroup[0] > paramObj.getTroughMaxFcjx()) { | ||
| 87 | + // -1分钟 | ||
| 88 | + return -1; | ||
| 89 | + } else { | ||
| 90 | + if (!paramObj.isTroughBc(oNextTripFcTime)) { | ||
| 91 | + // 下一个班次不是低谷班次,不处理 | ||
| 92 | + } else { | ||
| 93 | + // -1或+1分钟 | ||
| 94 | + if (Math.abs(aTripIntervalOfGroup[0] - aTripIntervalOfGroup[1]) <= 1) { | ||
| 95 | + return 0; | ||
| 96 | + } else if (aTripIntervalOfGroup[0] > aTripIntervalOfGroup[1]) { | ||
| 97 | + return -1; | ||
| 98 | + } else { | ||
| 99 | + return 1; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + // 2、是否能做,返回true/false | ||
| 106 | + function _canDo(aTripOfGroup, iTime, paramObj) { | ||
| 107 | + // TODO | ||
| 108 | + return iTime != 0; | ||
| 109 | + } | ||
| 110 | + // 3、修正班次时间 | ||
| 111 | + function _do(aBc, iIndex, iTime, paramObj) { | ||
| 112 | + // // 从当前班次开始,后续所有的班次都要调整 | ||
| 113 | + // var i; | ||
| 114 | + // for (i = iIndex; i < aBc.length; i++) { | ||
| 115 | + // aBc[i]._$_fcsjObj.add(iTime, "m"); | ||
| 116 | + // aBc[i].setArrTimeObj(paramObj.addMinute( | ||
| 117 | + // aBc[i].getFcTimeObj(), | ||
| 118 | + // paramObj.calcuTravelTime( | ||
| 119 | + // aBc[i].getFcTimeObj(), | ||
| 120 | + // aBc[i].isUp()) | ||
| 121 | + // )); | ||
| 122 | + // } | ||
| 123 | + aBc[iIndex]._$_fcsjObj.add(iTime, "m"); | ||
| 124 | + aBc[iIndex].setBcTime(paramObj.calcuTravelTime( | ||
| 125 | + aBc[iIndex].getFcTimeObj(), aBc[iIndex].isUp())); | ||
| 126 | + aBc[iIndex].setArrTimeObj(paramObj.addMinute( | ||
| 127 | + aBc[iIndex].getFcTimeObj(), aBc[iIndex].getBcTime())); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + //--------------- 每个trip调整分为三步(以上)----------------// | ||
| 131 | + | ||
| 132 | + function _f1(aBc, schedule, paramObj, fre) { | ||
| 133 | + if (fre > 0) { | ||
| 134 | + // 生序排列班次 | ||
| 135 | + _sortBc(aBc, true); | ||
| 136 | + | ||
| 137 | + var i; | ||
| 138 | + var j; | ||
| 139 | + var k; | ||
| 140 | + | ||
| 141 | + var iTripCountOfGroup = 3; // 3个班次取一次计算 | ||
| 142 | + var aTripOfGroup; // 3个班次列表 | ||
| 143 | + var aTripIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 144 | + var iTime; // 调整的时间 | ||
| 145 | + | ||
| 146 | + for (i = 0; i <= aBc.length - iTripCountOfGroup; i++) { | ||
| 147 | + aTripOfGroup = []; | ||
| 148 | + aTripIntervalOfGroup = []; | ||
| 149 | + // 连续计算3个班次参与计算 | ||
| 150 | + for (j = i; j < i + iTripCountOfGroup; j++) { | ||
| 151 | + aTripOfGroup.push(aBc[j]); | ||
| 152 | + } | ||
| 153 | + // 连续2个班次间隔参与计算 | ||
| 154 | + for (k = 0; k < aTripOfGroup.length; k++) { | ||
| 155 | + if (k < aTripOfGroup.length - 1) { | ||
| 156 | + aTripIntervalOfGroup.push(aTripOfGroup[k + 1].getFcTimeObj().diff( | ||
| 157 | + aTripOfGroup[k].getFcTimeObj(), "m")); | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + iTime = _whatToDo(aTripOfGroup, aTripIntervalOfGroup, paramObj); | ||
| 162 | + if (_canDo(aTripOfGroup, iTime, paramObj)) { | ||
| 163 | + _do(aBc, j - 2, iTime, paramObj); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + _f1(aBc, schedule, paramObj, fre - 1); | ||
| 169 | + | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * 主函数-返回的策略函数。 | ||
| 177 | + * @param aUpBc {array} 上行班次数组 | ||
| 178 | + * @param aDownBc {array} 下行班次数组 | ||
| 179 | + * @param oSchedule {InternalScheduleObj} 行车计划对象 | ||
| 180 | + * @param oParam {ParameterObj} 参数对象 | ||
| 181 | + */ | ||
| 182 | + function main(aUpBc, aDownBc, oSchedule, oParam) { | ||
| 183 | + // TODO:以后这里可能需要检测参数的正确性 | ||
| 184 | + _f1(aUpBc, oSchedule, oParam, 5); | ||
| 185 | + _f1(aDownBc, oSchedule, oParam, 5); | ||
| 186 | + | ||
| 187 | + // oSchedule.fnAdjustLpBcInterval(1); | ||
| 188 | + | ||
| 189 | + // _f1(aUpBc, oSchedule, oParam, 5); | ||
| 190 | + // _f1(aDownBc, oSchedule, oParam, 5); | ||
| 191 | + | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + return main; | ||
| 195 | + | ||
| 196 | } ()); | 196 | } ()); |
| 197 | \ No newline at end of file | 197 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS4.js
| 1 | -/** | ||
| 2 | - * 发车间隔调整策略4. | ||
| 3 | - * TODO: | ||
| 4 | - * | ||
| 5 | - */ | ||
| 6 | -var AdjustTripS4 = (function() { | ||
| 7 | - function _f1(aBc, schedule, paramObj, fre) { | ||
| 8 | - if (fre > 0) { | ||
| 9 | - aBc.sort(function (o1, o2) { | ||
| 10 | - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 11 | - return -1; | ||
| 12 | - } else { | ||
| 13 | - return 1; | ||
| 14 | - } | ||
| 15 | - }); | ||
| 16 | - | ||
| 17 | - var i; | ||
| 18 | - var j; | ||
| 19 | - | ||
| 20 | - var iBcCountOfGroup = 3; // 3个班次取一次计算 | ||
| 21 | - var aBcOfGroup; // 3个班次列表 | ||
| 22 | - var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 23 | - var oBcFcTime; // 班次发车时间 | ||
| 24 | - | ||
| 25 | - for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 26 | - aBcOfGroup = []; | ||
| 27 | - aBcIntervalOfGroup = []; | ||
| 28 | - for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 29 | - aBcOfGroup.push(aBc[j]); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 33 | - if (j < aBcOfGroup.length - 1) { | ||
| 34 | - aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 35 | - aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 36 | - } | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - // 判定规则 | ||
| 40 | - oBcFcTime = aBcOfGroup[1].getFcTimeObj(); | ||
| 41 | - | ||
| 42 | - // 第一个班次发车时间不动,根据间隔,调整中间一个班次 | ||
| 43 | - // 如果3个班次2个间隔时间差1分钟,不调整 | ||
| 44 | - // 如果第一个间隔大,调整第二个班次往前1分钟 | ||
| 45 | - // 如果第二个间隔大,调整第二个班次往后1分钟 | ||
| 46 | - | ||
| 47 | - if (paramObj.isTroughBc(oBcFcTime) && | ||
| 48 | - aBcIntervalOfGroup[0] > paramObj.getTroughMaxFcjx()) { | ||
| 49 | - | ||
| 50 | - // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 51 | - | ||
| 52 | - // 判定是否能调整发车时间 | ||
| 53 | - // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) { | ||
| 54 | - aBcOfGroup[1]._$_fcsjObj.add(-1, "m"); | ||
| 55 | - aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 56 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 57 | - paramObj.calcuTravelTime( | ||
| 58 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 59 | - aBcOfGroup[1].isUp()) | ||
| 60 | - )); | ||
| 61 | - | ||
| 62 | - // } | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - //else if (_paramObj.isMPeakBc(oBcFcTime) && | ||
| 66 | - // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) { | ||
| 67 | - // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 68 | - //} else if (_paramObj.isMPeakBc(oBcFcTime) && | ||
| 69 | - // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) { | ||
| 70 | - // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 71 | - //} else if (_paramObj.isEPeakBc(oBcFcTime) && | ||
| 72 | - // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) { | ||
| 73 | - // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 74 | - //} else if (_paramObj.isEPeakBc(oBcFcTime) && | ||
| 75 | - // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) { | ||
| 76 | - // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 77 | - //} | ||
| 78 | - | ||
| 79 | - | ||
| 80 | - else { | ||
| 81 | - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 82 | - //continue; | ||
| 83 | - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - // 判定是否能调整发车时间 | ||
| 87 | - // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) { | ||
| 88 | - aBcOfGroup[1]._$_fcsjObj.add(-1, "m"); | ||
| 89 | - aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 90 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 91 | - paramObj.calcuTravelTime( | ||
| 92 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 93 | - aBcOfGroup[1].isUp()) | ||
| 94 | - )); | ||
| 95 | - // } | ||
| 96 | - | ||
| 97 | - // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 98 | - } else { | ||
| 99 | - // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 100 | - | ||
| 101 | - // 判定是否能调整发车时间 | ||
| 102 | - // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], 1, _paramObj)) { | ||
| 103 | - aBcOfGroup[1]._$_fcsjObj.add(1, "m"); | ||
| 104 | - aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 105 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 106 | - paramObj.calcuTravelTime( | ||
| 107 | - aBcOfGroup[1].getFcTimeObj(), | ||
| 108 | - aBcOfGroup[1].isUp()) | ||
| 109 | - )); | ||
| 110 | - // } | ||
| 111 | - } | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 115 | - // //continue; | ||
| 116 | - //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 117 | - // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 118 | - //} else { | ||
| 119 | - // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 120 | - //} | ||
| 121 | - | ||
| 122 | - | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - _f1(aBc, schedule, paramObj, fre - 1); | ||
| 126 | - | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - // TODO | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | - * 重新计算路牌班次的停站时间(负数有可能,表示周转时间不够) | ||
| 134 | - * @param oLp | ||
| 135 | - * @private | ||
| 136 | - */ | ||
| 137 | - function _reCalcuStopTime(oLp) { | ||
| 138 | - // 获取车次链个数(连班路牌1个,分班路牌2个) | ||
| 139 | - var iBlockCount = oLp.fnGetBcChainCount(); | ||
| 140 | - | ||
| 141 | - var i; | ||
| 142 | - var j; | ||
| 143 | - var aTrip; // 每个block关联的trip列表 | ||
| 144 | - var trip; // 当前班次 | ||
| 145 | - var nextTrip; // 下一个班次 | ||
| 146 | - var layOverTime; | ||
| 147 | - var aLayOverTimeRange; | ||
| 148 | - | ||
| 149 | - var oBcIndex; | ||
| 150 | - var iQIndex; // block开始第几圈缩影 | ||
| 151 | - var iBcIndex; // block开始第几个班次 | ||
| 152 | - var iBcCount; // block的trip数目 | ||
| 153 | - | ||
| 154 | - | ||
| 155 | - for (i = 0; i < iBlockCount; i++) { | ||
| 156 | - // 获取block关联的trip列表 | ||
| 157 | - oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 158 | - iQIndex = oBcIndex["s_q"]; | ||
| 159 | - iBcIndex = oBcIndex["s_b"]; | ||
| 160 | - iBcCount = oBcIndex["bcount"]; | ||
| 161 | - | ||
| 162 | - aTrip = []; | ||
| 163 | - for (j = 0; j < iBcCount; j++) { | ||
| 164 | - aTrip.push(oLp.getBc(iQIndex, iBcIndex)); | ||
| 165 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 166 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - if (aTrip.length < 2) { | ||
| 170 | - // 两个trip一起处理,只有1个trip的block不处理 | ||
| 171 | - continue; | ||
| 172 | - } | ||
| 173 | - // 迭代block,处理trip的发车,到达,停站时间 | ||
| 174 | - for (j = 0; j < aTrip.length - 1; j++) { | ||
| 175 | - trip = aTrip[j]; | ||
| 176 | - nextTrip = aTrip[j + 1]; | ||
| 177 | - | ||
| 178 | - // 计算layover时间 | ||
| 179 | - layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 180 | - // 吃饭班次处理 | ||
| 181 | - if (trip.fnGetEatTime() > 0) { // 吃饭班次 | ||
| 182 | - trip.setStopTime(0); | ||
| 183 | - // 吃饭班次的实际时间添加一个变量直接表示 | ||
| 184 | - trip._iEatTimeTemp = layOverTime; | ||
| 185 | - } else { // 正常班次 | ||
| 186 | - trip.setStopTime(layOverTime); | ||
| 187 | - } | ||
| 188 | - } | ||
| 189 | - // 最后一个trip的layover时间为0 | ||
| 190 | - aTrip[j].setStopTime(0); | ||
| 191 | - | ||
| 192 | - } | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - function _f2(schedule) { | ||
| 196 | - var j = 0; | ||
| 197 | - var _aLp = schedule.fnGetLpArray(); | ||
| 198 | - for (j = 0; j < _aLp.length; j++) { | ||
| 199 | - _reCalcuStopTime(_aLp[j]); | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - /** | ||
| 204 | - * 获取指定路牌班次后的所有班次集合(单一车次链) | ||
| 205 | - * @param oBc | ||
| 206 | - * @private | ||
| 207 | - */ | ||
| 208 | - function _f3_getNextBcs(oBc) { | ||
| 209 | - var oLp = oBc.getGroup().getLp(); | ||
| 210 | - | ||
| 211 | - // 获取车次链个数 | ||
| 212 | - var iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 213 | - | ||
| 214 | - var i; | ||
| 215 | - var j; | ||
| 216 | - var oBcIndex; | ||
| 217 | - var iQIndex; | ||
| 218 | - var iBcIndex; | ||
| 219 | - var iBcCount; | ||
| 220 | - var _bFindCurrentBc = false; | ||
| 221 | - | ||
| 222 | - var _aNextBc = []; | ||
| 223 | - | ||
| 224 | - for (i = 0; i < iBcChainCount; i++) { | ||
| 225 | - oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 226 | - iQIndex = oBcIndex["s_q"]; | ||
| 227 | - iBcIndex = oBcIndex["s_b"]; | ||
| 228 | - iBcCount = oBcIndex["bcount"]; | ||
| 229 | - | ||
| 230 | - if (_aNextBc.length > 0) { // 已经在上一个车次链中找到 | ||
| 231 | - break; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - for (j = 0; j < iBcCount - 1; j++) { | ||
| 235 | - if (_bFindCurrentBc) { | ||
| 236 | - _aNextBc.push(oLp.getBc(iQIndex, iBcIndex)); | ||
| 237 | - } else if (oBc.getFcTimeObj().format("HH:mm") == | ||
| 238 | - oLp.getBc(iQIndex, iBcIndex).getFcTimeObj().format("HH:mm")) { | ||
| 239 | - _bFindCurrentBc = true; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - // 进入到下一圈 | ||
| 243 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 244 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | - return _aNextBc; | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - /** | ||
| 253 | - * 调整班次数组中班次的发车时间和到达时间。 | ||
| 254 | - * @param aBc | ||
| 255 | - * @param iTime | ||
| 256 | - * @private | ||
| 257 | - */ | ||
| 258 | - function _f3_adjustTime(aBc, iTime) { | ||
| 259 | - // TODO:因为改动的时间比较少,直接修改时间,暂时不考虑周转时间的变化 | ||
| 260 | - for (var i = 0; i < aBc.length; i++) { | ||
| 261 | - aBc[i]._$_fcsjObj.add(iTime, "m"); | ||
| 262 | - aBc[i]._$_arrtime.add(iTime, "m"); | ||
| 263 | - } | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - function _f3(aBc) { | ||
| 267 | - var i; | ||
| 268 | - var oBc; | ||
| 269 | - var aNextBc; | ||
| 270 | - var iTime; | ||
| 271 | - | ||
| 272 | - for (i = 0; i < aBc.length; i++) { | ||
| 273 | - oBc = aBc[i]; | ||
| 274 | - if (oBc.getStopTime() < 0) { // 停站时间小于0 | ||
| 275 | - iTime = Math.abs(oBc.getStopTime()) + 1; | ||
| 276 | - aNextBc = _f3_getNextBcs(oBc); | ||
| 277 | - _f3_adjustTime(aNextBc, iTime); | ||
| 278 | - oBc.setStopTime(1); | ||
| 279 | - } | ||
| 280 | - if (oBc._iEatTimeTemp != undefined && | ||
| 281 | - oBc._iEatTimeTemp != oBc.fnGetEatTime()) { // 吃饭班次问题 | ||
| 282 | - iTime = oBc.fnGetEatTime() - oBc._iEatTimeTemp; | ||
| 283 | - aNextBc = _f3_getNextBcs(oBc); | ||
| 284 | - _f3_adjustTime(aNextBc, iTime); | ||
| 285 | - } | ||
| 286 | - | ||
| 287 | - // TODO: | ||
| 288 | - } | ||
| 289 | - } | ||
| 290 | - | ||
| 291 | - | ||
| 292 | - function f1(aUpBc, aDownBc, schedule, paramObj) { | ||
| 293 | - // 1、调整纵向班次间隔 | ||
| 294 | - _f1(aUpBc, schedule, paramObj, 5); | ||
| 295 | - _f1(aDownBc, schedule, paramObj, 5); | ||
| 296 | - | ||
| 297 | - schedule.fnAdjustLpBcInterval(1); | ||
| 298 | - | ||
| 299 | - _f1(aUpBc, schedule, paramObj, 5); | ||
| 300 | - _f1(aDownBc, schedule, paramObj, 5); | ||
| 301 | - | ||
| 302 | - // 2、计算实际的停站时间 | ||
| 303 | - _f2(schedule); | ||
| 304 | - | ||
| 305 | - // 3、调整停站时间不够,吃饭时间不够的班次 | ||
| 306 | - _f3(aUpBc); | ||
| 307 | - _f3(aDownBc); | ||
| 308 | - } | ||
| 309 | - | ||
| 310 | - return f1; | ||
| 311 | - | 1 | +/** |
| 2 | + * 发车间隔调整策略4. | ||
| 3 | + * TODO: | ||
| 4 | + * | ||
| 5 | + */ | ||
| 6 | +var AdjustTripS4 = (function() { | ||
| 7 | + function _f1(aBc, schedule, paramObj, fre) { | ||
| 8 | + if (fre > 0) { | ||
| 9 | + aBc.sort(function (o1, o2) { | ||
| 10 | + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) { | ||
| 11 | + return -1; | ||
| 12 | + } else { | ||
| 13 | + return 1; | ||
| 14 | + } | ||
| 15 | + }); | ||
| 16 | + | ||
| 17 | + var i; | ||
| 18 | + var j; | ||
| 19 | + | ||
| 20 | + var iBcCountOfGroup = 3; // 3个班次取一次计算 | ||
| 21 | + var aBcOfGroup; // 3个班次列表 | ||
| 22 | + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔 | ||
| 23 | + var oBcFcTime; // 班次发车时间 | ||
| 24 | + | ||
| 25 | + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) { | ||
| 26 | + aBcOfGroup = []; | ||
| 27 | + aBcIntervalOfGroup = []; | ||
| 28 | + for (j = i; j < i + iBcCountOfGroup; j++) { | ||
| 29 | + aBcOfGroup.push(aBc[j]); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + for (j = 0; j < aBcOfGroup.length; j++) { | ||
| 33 | + if (j < aBcOfGroup.length - 1) { | ||
| 34 | + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff( | ||
| 35 | + aBcOfGroup[j].getFcTimeObj(), "m")); | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + // 判定规则 | ||
| 40 | + oBcFcTime = aBcOfGroup[1].getFcTimeObj(); | ||
| 41 | + | ||
| 42 | + // 第一个班次发车时间不动,根据间隔,调整中间一个班次 | ||
| 43 | + // 如果3个班次2个间隔时间差1分钟,不调整 | ||
| 44 | + // 如果第一个间隔大,调整第二个班次往前1分钟 | ||
| 45 | + // 如果第二个间隔大,调整第二个班次往后1分钟 | ||
| 46 | + | ||
| 47 | + if (paramObj.isTroughBc(oBcFcTime) && | ||
| 48 | + aBcIntervalOfGroup[0] > paramObj.getTroughMaxFcjx()) { | ||
| 49 | + | ||
| 50 | + // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 51 | + | ||
| 52 | + // 判定是否能调整发车时间 | ||
| 53 | + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) { | ||
| 54 | + aBcOfGroup[1]._$_fcsjObj.add(-1, "m"); | ||
| 55 | + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 56 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 57 | + paramObj.calcuTravelTime( | ||
| 58 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 59 | + aBcOfGroup[1].isUp()) | ||
| 60 | + )); | ||
| 61 | + | ||
| 62 | + // } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + //else if (_paramObj.isMPeakBc(oBcFcTime) && | ||
| 66 | + // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) { | ||
| 67 | + // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 68 | + //} else if (_paramObj.isMPeakBc(oBcFcTime) && | ||
| 69 | + // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) { | ||
| 70 | + // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 71 | + //} else if (_paramObj.isEPeakBc(oBcFcTime) && | ||
| 72 | + // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) { | ||
| 73 | + // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 74 | + //} else if (_paramObj.isEPeakBc(oBcFcTime) && | ||
| 75 | + // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) { | ||
| 76 | + // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 77 | + //} | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + else { | ||
| 81 | + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 82 | + //continue; | ||
| 83 | + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + // 判定是否能调整发车时间 | ||
| 87 | + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], -1, _paramObj)) { | ||
| 88 | + aBcOfGroup[1]._$_fcsjObj.add(-1, "m"); | ||
| 89 | + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 90 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 91 | + paramObj.calcuTravelTime( | ||
| 92 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 93 | + aBcOfGroup[1].isUp()) | ||
| 94 | + )); | ||
| 95 | + // } | ||
| 96 | + | ||
| 97 | + // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 98 | + } else { | ||
| 99 | + // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 100 | + | ||
| 101 | + // 判定是否能调整发车时间 | ||
| 102 | + // if (aBcOfGroup[1].getGroup().getLp().isModifyBcFcsj(aBcOfGroup[1], 1, _paramObj)) { | ||
| 103 | + aBcOfGroup[1]._$_fcsjObj.add(1, "m"); | ||
| 104 | + aBcOfGroup[1].setArrTimeObj(paramObj.addMinute( | ||
| 105 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 106 | + paramObj.calcuTravelTime( | ||
| 107 | + aBcOfGroup[1].getFcTimeObj(), | ||
| 108 | + aBcOfGroup[1].isUp()) | ||
| 109 | + )); | ||
| 110 | + // } | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) { | ||
| 115 | + // //continue; | ||
| 116 | + //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) { | ||
| 117 | + // aBcOfGroup[1].addMinuteToFcsj(-1); | ||
| 118 | + //} else { | ||
| 119 | + // aBcOfGroup[1].addMinuteToFcsj(1); | ||
| 120 | + //} | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + _f1(aBc, schedule, paramObj, fre - 1); | ||
| 126 | + | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + // TODO | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * 重新计算路牌班次的停站时间(负数有可能,表示周转时间不够) | ||
| 134 | + * @param oLp | ||
| 135 | + * @private | ||
| 136 | + */ | ||
| 137 | + function _reCalcuStopTime(oLp) { | ||
| 138 | + // 获取车次链个数(连班路牌1个,分班路牌2个) | ||
| 139 | + var iBlockCount = oLp.fnGetBcChainCount(); | ||
| 140 | + | ||
| 141 | + var i; | ||
| 142 | + var j; | ||
| 143 | + var aTrip; // 每个block关联的trip列表 | ||
| 144 | + var trip; // 当前班次 | ||
| 145 | + var nextTrip; // 下一个班次 | ||
| 146 | + var layOverTime; | ||
| 147 | + var aLayOverTimeRange; | ||
| 148 | + | ||
| 149 | + var oBcIndex; | ||
| 150 | + var iQIndex; // block开始第几圈缩影 | ||
| 151 | + var iBcIndex; // block开始第几个班次 | ||
| 152 | + var iBcCount; // block的trip数目 | ||
| 153 | + | ||
| 154 | + | ||
| 155 | + for (i = 0; i < iBlockCount; i++) { | ||
| 156 | + // 获取block关联的trip列表 | ||
| 157 | + oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 158 | + iQIndex = oBcIndex["s_q"]; | ||
| 159 | + iBcIndex = oBcIndex["s_b"]; | ||
| 160 | + iBcCount = oBcIndex["bcount"]; | ||
| 161 | + | ||
| 162 | + aTrip = []; | ||
| 163 | + for (j = 0; j < iBcCount; j++) { | ||
| 164 | + aTrip.push(oLp.getBc(iQIndex, iBcIndex)); | ||
| 165 | + iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 166 | + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + if (aTrip.length < 2) { | ||
| 170 | + // 两个trip一起处理,只有1个trip的block不处理 | ||
| 171 | + continue; | ||
| 172 | + } | ||
| 173 | + // 迭代block,处理trip的发车,到达,停站时间 | ||
| 174 | + for (j = 0; j < aTrip.length - 1; j++) { | ||
| 175 | + trip = aTrip[j]; | ||
| 176 | + nextTrip = aTrip[j + 1]; | ||
| 177 | + | ||
| 178 | + // 计算layover时间 | ||
| 179 | + layOverTime = nextTrip.getFcTimeObj().diff(trip.getArrTimeObj(), "m"); | ||
| 180 | + // 吃饭班次处理 | ||
| 181 | + if (trip.fnGetEatTime() > 0) { // 吃饭班次 | ||
| 182 | + trip.setStopTime(0); | ||
| 183 | + // 吃饭班次的实际时间添加一个变量直接表示 | ||
| 184 | + trip._iEatTimeTemp = layOverTime; | ||
| 185 | + } else { // 正常班次 | ||
| 186 | + trip.setStopTime(layOverTime); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + // 最后一个trip的layover时间为0 | ||
| 190 | + aTrip[j].setStopTime(0); | ||
| 191 | + | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + function _f2(schedule) { | ||
| 196 | + var j = 0; | ||
| 197 | + var _aLp = schedule.fnGetLpArray(); | ||
| 198 | + for (j = 0; j < _aLp.length; j++) { | ||
| 199 | + _reCalcuStopTime(_aLp[j]); | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * 获取指定路牌班次后的所有班次集合(单一车次链) | ||
| 205 | + * @param oBc | ||
| 206 | + * @private | ||
| 207 | + */ | ||
| 208 | + function _f3_getNextBcs(oBc) { | ||
| 209 | + var oLp = oBc.getGroup().getLp(); | ||
| 210 | + | ||
| 211 | + // 获取车次链个数 | ||
| 212 | + var iBcChainCount = oLp.fnGetBcChainCount(); | ||
| 213 | + | ||
| 214 | + var i; | ||
| 215 | + var j; | ||
| 216 | + var oBcIndex; | ||
| 217 | + var iQIndex; | ||
| 218 | + var iBcIndex; | ||
| 219 | + var iBcCount; | ||
| 220 | + var _bFindCurrentBc = false; | ||
| 221 | + | ||
| 222 | + var _aNextBc = []; | ||
| 223 | + | ||
| 224 | + for (i = 0; i < iBcChainCount; i++) { | ||
| 225 | + oBcIndex = oLp.fnGetBcChainInfo(i); | ||
| 226 | + iQIndex = oBcIndex["s_q"]; | ||
| 227 | + iBcIndex = oBcIndex["s_b"]; | ||
| 228 | + iBcCount = oBcIndex["bcount"]; | ||
| 229 | + | ||
| 230 | + if (_aNextBc.length > 0) { // 已经在上一个车次链中找到 | ||
| 231 | + break; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + for (j = 0; j < iBcCount - 1; j++) { | ||
| 235 | + if (_bFindCurrentBc) { | ||
| 236 | + _aNextBc.push(oLp.getBc(iQIndex, iBcIndex)); | ||
| 237 | + } else if (oBc.getFcTimeObj().format("HH:mm") == | ||
| 238 | + oLp.getBc(iQIndex, iBcIndex).getFcTimeObj().format("HH:mm")) { | ||
| 239 | + _bFindCurrentBc = true; | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + // 进入到下一圈 | ||
| 243 | + iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 244 | + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + return _aNextBc; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * 调整班次数组中班次的发车时间和到达时间。 | ||
| 254 | + * @param aBc | ||
| 255 | + * @param iTime | ||
| 256 | + * @private | ||
| 257 | + */ | ||
| 258 | + function _f3_adjustTime(aBc, iTime) { | ||
| 259 | + // TODO:因为改动的时间比较少,直接修改时间,暂时不考虑周转时间的变化 | ||
| 260 | + for (var i = 0; i < aBc.length; i++) { | ||
| 261 | + aBc[i]._$_fcsjObj.add(iTime, "m"); | ||
| 262 | + aBc[i]._$_arrtime.add(iTime, "m"); | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + function _f3(aBc) { | ||
| 267 | + var i; | ||
| 268 | + var oBc; | ||
| 269 | + var aNextBc; | ||
| 270 | + var iTime; | ||
| 271 | + | ||
| 272 | + for (i = 0; i < aBc.length; i++) { | ||
| 273 | + oBc = aBc[i]; | ||
| 274 | + if (oBc.getStopTime() < 0) { // 停站时间小于0 | ||
| 275 | + iTime = Math.abs(oBc.getStopTime()) + 1; | ||
| 276 | + aNextBc = _f3_getNextBcs(oBc); | ||
| 277 | + _f3_adjustTime(aNextBc, iTime); | ||
| 278 | + oBc.setStopTime(1); | ||
| 279 | + } | ||
| 280 | + if (oBc._iEatTimeTemp != undefined && | ||
| 281 | + oBc._iEatTimeTemp != oBc.fnGetEatTime()) { // 吃饭班次问题 | ||
| 282 | + iTime = oBc.fnGetEatTime() - oBc._iEatTimeTemp; | ||
| 283 | + aNextBc = _f3_getNextBcs(oBc); | ||
| 284 | + _f3_adjustTime(aNextBc, iTime); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + // TODO: | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + | ||
| 292 | + function f1(aUpBc, aDownBc, schedule, paramObj) { | ||
| 293 | + // 1、调整纵向班次间隔 | ||
| 294 | + _f1(aUpBc, schedule, paramObj, 5); | ||
| 295 | + _f1(aDownBc, schedule, paramObj, 5); | ||
| 296 | + | ||
| 297 | + schedule.fnAdjustLpBcInterval(1); | ||
| 298 | + | ||
| 299 | + _f1(aUpBc, schedule, paramObj, 5); | ||
| 300 | + _f1(aDownBc, schedule, paramObj, 5); | ||
| 301 | + | ||
| 302 | + // 2、计算实际的停站时间 | ||
| 303 | + _f2(schedule); | ||
| 304 | + | ||
| 305 | + // 3、调整停站时间不够,吃饭时间不够的班次 | ||
| 306 | + _f3(aUpBc); | ||
| 307 | + _f3(aDownBc); | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + return f1; | ||
| 311 | + | ||
| 312 | } ()); | 312 | } ()); |
| 313 | \ No newline at end of file | 313 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/paramadd.html
| 1 | -<!-- 统计数据 --> | ||
| 2 | -<style> | ||
| 3 | - .form-control:focus { | ||
| 4 | - border-color: #53ced9; | ||
| 5 | - } | ||
| 6 | - .tagsDiv { | ||
| 7 | - border: 1px solid #c2cad8; | ||
| 8 | - margin-left: 15px; | ||
| 9 | - padding: 4px 15px 4px 15px; | ||
| 10 | - width: 50%; | ||
| 11 | - } | ||
| 12 | -</style> | ||
| 13 | -<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 14 | - <div class="modal-dialog" style="margin-left: 100px;"> | ||
| 15 | - <div class="modal-content" style="width: 1000px;"> | ||
| 16 | - <div class="modal-header"> | ||
| 17 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 18 | - <h4 class="modal-title">参数数据 </h4> | ||
| 19 | - </div> | ||
| 20 | - <div class="modal-body"> | ||
| 21 | - <form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate"> | ||
| 22 | - <div class="form-body"> | ||
| 23 | - <div class="alert alert-danger display-hide"> | ||
| 24 | - <button class="close" data-close="alert"></button> | ||
| 25 | - 您的输入有误,请检查下面的输入项 | ||
| 26 | - </div> | ||
| 27 | - <div class="alert alert-success display-none"> | ||
| 28 | - <button class="close" data-dismiss="alert"></button> | ||
| 29 | - 验证成功! | ||
| 30 | - </div> | ||
| 31 | - | ||
| 32 | - </div> | ||
| 33 | - | ||
| 34 | - <div class="tab-pane" id="ptab"> | ||
| 35 | - | ||
| 36 | - </div> | ||
| 37 | - </form> | ||
| 38 | - </div> | ||
| 39 | - | ||
| 40 | - <div class="modal-footer"> | ||
| 41 | - <button type="button" class="btn default" data-dismiss="modal" id="paramcancel"> | ||
| 42 | - <span class="paramcancelSpan">取消</span> | ||
| 43 | - </button> | ||
| 44 | - <button type="button" class="btn btn-primary" id="paramnext"> | ||
| 45 | - <span class="paramnextSpan">确定</span> | ||
| 46 | - </button> | ||
| 47 | - </div> | ||
| 48 | - | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | -</div> | ||
| 52 | - | ||
| 53 | -<script type="text/html" id = "paramAdd_temp"> | ||
| 54 | - <div class="form-group"> | ||
| 55 | - <div class="col-md-6"> | ||
| 56 | - <label class="control-label col-md-5"> | ||
| 57 | - <span class="required"> * </span> 上行首班时间 : | ||
| 58 | - </label> | ||
| 59 | - <div class="col-md-5"> | ||
| 60 | - <input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id" | ||
| 61 | - placeholder="请输入起始站首班时间"> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - <div class="col-md-6"> | ||
| 65 | - <label class="control-label col-md-5"> | ||
| 66 | - <span class="required"> * </span> 上行末班时间 : | ||
| 67 | - </label> | ||
| 68 | - <div class="col-md-5"> | ||
| 69 | - <input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id" | ||
| 70 | - placeholder="请输入起始站末班时间"> | ||
| 71 | - </div> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - | ||
| 75 | - <div class="form-group"> | ||
| 76 | - <div class="col-md-6"> | ||
| 77 | - <label class="control-label col-md-5"> | ||
| 78 | - <span class="required"> * </span> 下行首班时间 : | ||
| 79 | - </label> | ||
| 80 | - <div class="col-md-5"> | ||
| 81 | - <input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id" | ||
| 82 | - placeholder="请输入终点站首班时间"> | ||
| 83 | - </div> | ||
| 84 | - </div> | ||
| 85 | - <div class="col-md-6"> | ||
| 86 | - <label class="control-label col-md-5"> | ||
| 87 | - <span class="required"> * </span> 下行末班时间 : | ||
| 88 | - </label> | ||
| 89 | - <div class="col-md-5"> | ||
| 90 | - <input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id" | ||
| 91 | - placeholder="请输入终点站末班时间"> | ||
| 92 | - </div> | ||
| 93 | - </div> | ||
| 94 | - </div> | ||
| 95 | - | ||
| 96 | - <div class="form-group"> | ||
| 97 | - <div class="col-md-6"> | ||
| 98 | - <label class="control-label col-md-5"> | ||
| 99 | - <span class="required"> * </span> 早高峰开始时间 : | ||
| 100 | - </label> | ||
| 101 | - <div class="col-md-5"> | ||
| 102 | - <input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id" | ||
| 103 | - placeholder="请输入早高峰开始时间"> | ||
| 104 | - </div> | ||
| 105 | - </div> | ||
| 106 | - <div class="col-md-6"> | ||
| 107 | - <label class="control-label col-md-5"> | ||
| 108 | - <span class="required"> * </span> 早高峰结束时间 : | ||
| 109 | - </label> | ||
| 110 | - <div class="col-md-5"> | ||
| 111 | - <input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id" | ||
| 112 | - placeholder="请输入早高峰结束时间"> | ||
| 113 | - </div> | ||
| 114 | - </div> | ||
| 115 | - </div> | ||
| 116 | - | ||
| 117 | - <div class="form-group"> | ||
| 118 | - <div class="col-md-6"> | ||
| 119 | - <label class="control-label col-md-5"> | ||
| 120 | - <span class="required"> * </span> 晚高峰开始时间 : | ||
| 121 | - </label> | ||
| 122 | - <div class="col-md-5"> | ||
| 123 | - <input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id" | ||
| 124 | - placeholder="请输入晚高峰开始时间"> | ||
| 125 | - </div> | ||
| 126 | - </div> | ||
| 127 | - <div class="col-md-6"> | ||
| 128 | - <label class="control-label col-md-5"> | ||
| 129 | - <span class="required"> * </span> 晚高峰结束时间 : | ||
| 130 | - </label> | ||
| 131 | - <div class="col-md-5"> | ||
| 132 | - <input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id" | ||
| 133 | - placeholder="请输入晚高峰结束时间"> | ||
| 134 | - </div> | ||
| 135 | - </div> | ||
| 136 | - </div> | ||
| 137 | - | ||
| 138 | - <div class="form-group"> | ||
| 139 | - <div class="col-md-6"> | ||
| 140 | - <label class="control-label col-md-5">上行进场时间 : | ||
| 141 | - </label> | ||
| 142 | - <div class="col-md-5"> | ||
| 143 | - <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id" | ||
| 144 | - placeholder="请输入上行进场时间"> | ||
| 145 | - </div> | ||
| 146 | - </div> | ||
| 147 | - <div class="col-md-6"> | ||
| 148 | - <label class="control-label col-md-5">上行出场时间 : | ||
| 149 | - </label> | ||
| 150 | - <div class="col-md-5"> | ||
| 151 | - <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id" | ||
| 152 | - placeholder="请输入上行出场时间"> | ||
| 153 | - </div> | ||
| 154 | - </div> | ||
| 155 | - </div> | ||
| 156 | - | ||
| 157 | - <div class="form-group"> | ||
| 158 | - <div class="col-md-6"> | ||
| 159 | - <label class="control-label col-md-5">下行进场时间 : | ||
| 160 | - </label> | ||
| 161 | - <div class="col-md-5"> | ||
| 162 | - <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id" | ||
| 163 | - placeholder="请输入下行进场时间"> | ||
| 164 | - </div> | ||
| 165 | - </div> | ||
| 166 | - <div class="col-md-6"> | ||
| 167 | - <label class="control-label col-md-5">下行出场时间 : | ||
| 168 | - </label> | ||
| 169 | - <div class="col-md-5"> | ||
| 170 | - <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id" | ||
| 171 | - placeholder="请输入下行出场时间"> | ||
| 172 | - </div> | ||
| 173 | - </div> | ||
| 174 | - </div> | ||
| 175 | - | ||
| 176 | - <div class="form-group"> | ||
| 177 | - <div class="col-md-6"> | ||
| 178 | - <label class="control-label col-md-5">早高峰上行时间 :</label> | ||
| 179 | - <div class="col-md-5"> | ||
| 180 | - <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id" | ||
| 181 | - placeholder="请输入早高峰上行时间"> | ||
| 182 | - </div> | ||
| 183 | - </div> | ||
| 184 | - <div class="col-md-6"> | ||
| 185 | - <label class="control-label col-md-5">早高峰下行时间 :</label> | ||
| 186 | - <div class="col-md-5"> | ||
| 187 | - <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id" | ||
| 188 | - placeholder="请输入早高峰下行时间"> | ||
| 189 | - </div> | ||
| 190 | - </div> | ||
| 191 | - </div> | ||
| 192 | - | ||
| 193 | - <div class="form-group"> | ||
| 194 | - <div class="col-md-6"> | ||
| 195 | - <label class="control-label col-md-5">晚高峰上行时间 :</label> | ||
| 196 | - <div class="col-md-5"> | ||
| 197 | - <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id" | ||
| 198 | - placeholder="请输入晚高峰上行时间"> | ||
| 199 | - </div> | ||
| 200 | - </div> | ||
| 201 | - <div class="col-md-6"> | ||
| 202 | - <label class="control-label col-md-5">晚高峰下行时间 :</label> | ||
| 203 | - <div class="col-md-5"> | ||
| 204 | - <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id" | ||
| 205 | - placeholder="请输入晚高峰下行时间"> | ||
| 206 | - </div> | ||
| 207 | - </div> | ||
| 208 | - </div> | ||
| 209 | - | ||
| 210 | - <div class="form-group"> | ||
| 211 | - <div class="col-md-6"> | ||
| 212 | - <label class="control-label col-md-5">低谷上行时间 :</label> | ||
| 213 | - <div class="col-md-5"> | ||
| 214 | - <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id" | ||
| 215 | - placeholder="请输入低谷上行时间"> | ||
| 216 | - </div> | ||
| 217 | - </div> | ||
| 218 | - <div class="col-md-6"> | ||
| 219 | - <label class="control-label col-md-5">低谷下行时间 :</label> | ||
| 220 | - <div class="col-md-5"> | ||
| 221 | - <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id" | ||
| 222 | - placeholder="请输入低谷下行时间"> | ||
| 223 | - </div> | ||
| 224 | - </div> | ||
| 225 | - </div> | ||
| 226 | - | ||
| 227 | - <div class="form-group"> | ||
| 228 | - <div class="col-md-6"> | ||
| 229 | - <label class="control-label col-md-5"> | ||
| 230 | - <span class="required"> * </span> 线路规划类型 : | ||
| 231 | - </label> | ||
| 232 | - <div class="col-md-5"> | ||
| 233 | - <select name="linePlayType" class="form-control" id="linePlayType_id"> | ||
| 234 | - <option value="">-- 请选择线路类型 --</option> | ||
| 235 | - <option value="0">双向</option> | ||
| 236 | - <option value="1">环线</option> | ||
| 237 | - </select> | ||
| 238 | - </div> | ||
| 239 | - </div> | ||
| 240 | - <div class="col-md-6"> | ||
| 241 | - <label class="control-label col-md-5">吃饭地点 :</label> | ||
| 242 | - <div class="col-md-5"> | ||
| 243 | - <select type="text" class="form-control" name="cfdd" id="cfdd_id"> | ||
| 244 | - <option value="">请选择...</option> | ||
| 245 | - <option value="0">{{map.startStationName}}</option> | ||
| 246 | - <option value="1">{{map.endStationName}}</option> | ||
| 247 | - <option value="allYes">起终点站都可以</option> | ||
| 248 | - </select> | ||
| 249 | - </div> | ||
| 250 | - </div> | ||
| 251 | - </div> | ||
| 252 | - | ||
| 253 | - <div class="form-group"> | ||
| 254 | - <div class="col-md-6"> | ||
| 255 | - <label class="control-label col-md-5">早晚例行保养 :</label> | ||
| 256 | - <div class="col-md-5"> | ||
| 257 | - <input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id" | ||
| 258 | - placeholder="请输入早晚例行保养"> | ||
| 259 | - </div> | ||
| 260 | - </div> | ||
| 261 | - <div class="col-md-6"> | ||
| 262 | - <label class="control-label col-md-5">停车场 :</label> | ||
| 263 | - <div class="col-md-5"> | ||
| 264 | - <select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select> | ||
| 265 | - </div> | ||
| 266 | - </div> | ||
| 267 | - </div> | ||
| 268 | - | ||
| 269 | - | ||
| 270 | - <div class="form-group"> | ||
| 271 | - <div class="col-md-6"> | ||
| 272 | - <label class="control-label col-md-5">工作餐午餐时间 :</label> | ||
| 273 | - <div class="col-md-5"> | ||
| 274 | - <input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id" | ||
| 275 | - placeholder="请输入工作餐午餐时间"> | ||
| 276 | - </div> | ||
| 277 | - </div> | ||
| 278 | - <div class="col-md-6"> | ||
| 279 | - <label class="control-label col-md-5">工作餐晚餐时间 :</label> | ||
| 280 | - <div class="col-md-5"> | ||
| 281 | - <input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id" | ||
| 282 | - placeholder="请输入工作餐晚餐时间"> | ||
| 283 | - </div> | ||
| 284 | - </div> | ||
| 285 | - </div> | ||
| 286 | - | ||
| 287 | - <div class="form-group"> | ||
| 288 | - <div class="col-md-6"> | ||
| 289 | - <label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label> | ||
| 290 | - <div class="col-md-3" style="padding-right: 0px;"> | ||
| 291 | - <input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id" | ||
| 292 | - placeholder="最小间隔"> | ||
| 293 | - </div> | ||
| 294 | - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 295 | - <div class="col-md-3" style="padding-left: 0px;"> | ||
| 296 | - <input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id" | ||
| 297 | - placeholder="最大间隔"> | ||
| 298 | - </div> | ||
| 299 | - </div> | ||
| 300 | - <div class="col-md-6"> | ||
| 301 | - <label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label> | ||
| 302 | - <div class="col-md-3" style="padding-right: 0px;"> | ||
| 303 | - <input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id" | ||
| 304 | - placeholder="最小间隔"> | ||
| 305 | - </div> | ||
| 306 | - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 307 | - <div class="col-md-3" style="padding-left: 0px;"> | ||
| 308 | - <input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id" | ||
| 309 | - placeholder="最大间隔"> | ||
| 310 | - </div> | ||
| 311 | - </div> | ||
| 312 | - </div> | ||
| 313 | - | ||
| 314 | - <div class="form-group"> | ||
| 315 | - <div class="col-md-6"> | ||
| 316 | - <label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label> | ||
| 317 | - <div class="col-md-3" style="padding-right: 0px;"> | ||
| 318 | - <input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id" | ||
| 319 | - placeholder="最小间隔"> | ||
| 320 | - </div> | ||
| 321 | - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 322 | - <div class="col-md-3" style="padding-left: 0px;"> | ||
| 323 | - <input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id" | ||
| 324 | - placeholder="最大间隔"> | ||
| 325 | - </div> | ||
| 326 | - </div> | ||
| 327 | - <div class="col-md-6"> | ||
| 328 | - <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label> | ||
| 329 | - <div class="col-md-5"> | ||
| 330 | - <input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id" | ||
| 331 | - placeholder="为0表示是周末时刻表"> | ||
| 332 | - </div> | ||
| 333 | - </div> | ||
| 334 | - </div> | ||
| 335 | - | ||
| 336 | - <div class="form-group"> | ||
| 337 | - <div class="col-md-6"> | ||
| 338 | - <label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label> | ||
| 339 | - <div class="col-md-5 tagsDiv"> | ||
| 340 | - <div class="row" style="margin-left: 15px;"> | ||
| 341 | - <input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;"> | ||
| 342 | - </div> | ||
| 343 | - | ||
| 344 | - <div class="row" style="margin-top: 10px;"> | ||
| 345 | - <label class="control-label col-md-4">停站类型:</label> | ||
| 346 | - <div class="col-md-8"> | ||
| 347 | - <select name="stopType" class="form-control" id="stopType_id"> | ||
| 348 | - <option value="">-- 请选择停站类型 --</option> | ||
| 349 | - <option value="0">主站停站</option> | ||
| 350 | - <option value="1">双向停站</option> | ||
| 351 | - </select> | ||
| 352 | - </div> | ||
| 353 | - </div> | ||
| 354 | - | ||
| 355 | - <div class="row" style="margin-top: 10px;"> | ||
| 356 | - <label class="control-label col-md-4">主站:</label> | ||
| 357 | - <div class="col-md-8"> | ||
| 358 | - <select name="masterStop" class="form-control" id="masterStop_id"> | ||
| 359 | - <option value="">请选择...</option> | ||
| 360 | - <option value="0">{{map.startStationName}}</option> | ||
| 361 | - <option value="1">{{map.endStationName}}</option> | ||
| 362 | - </select> | ||
| 363 | - </div> | ||
| 364 | - </div> | ||
| 365 | - | ||
| 366 | - <div class="row" style="margin-top: 10px;margin-left: 116px;"> | ||
| 367 | - <a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a> | ||
| 368 | - </div> | ||
| 369 | - </div> | ||
| 370 | - | ||
| 371 | - </div> | ||
| 372 | - | ||
| 373 | - <div class="col-md-6"> | ||
| 374 | - <div class="form-group"> | ||
| 375 | - <label class="control-label col-md-5"> | ||
| 376 | - <span class="required"> * </span> 建议高峰配车数 :</label> | ||
| 377 | - <div class="col-md-5"> | ||
| 378 | - <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" | ||
| 379 | - id="gfjypcsInput" min="1" value="{{map.gfjypcs}}"> | ||
| 380 | - </div> | ||
| 381 | - </div> | ||
| 382 | - <div class="form-group"> | ||
| 383 | - <label class="control-label col-md-5"> | ||
| 384 | - <span class="required"> * </span> 生成策略 : | ||
| 385 | - </label> | ||
| 386 | - <div class="col-md-5"> | ||
| 387 | - <select name="strategy" class="form-control" id="strategy_id"> | ||
| 388 | - <option value="AdjustTripS1" selected>AdjustTripS1</option> | ||
| 389 | - <option value="AdjustTripS2" disabled>AdjustTripS2</option> | ||
| 390 | - <option value="AdjustTripS3">AdjustTripS3</option> | ||
| 391 | - <option value="AdjustTripS4">AdjustTripS4</option> | ||
| 392 | - </select> | ||
| 393 | - </div> | ||
| 394 | - </div> | ||
| 395 | - </div> | ||
| 396 | - | ||
| 397 | - | ||
| 398 | - </div> | ||
| 399 | - | ||
| 400 | - | ||
| 401 | - <!-- 隐藏字段-时间 --> | ||
| 402 | - <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/> | ||
| 403 | - <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/> | ||
| 404 | - <input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/> | ||
| 405 | - <input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/> | ||
| 406 | - <input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/> | ||
| 407 | - | ||
| 408 | - <!-- 上下行行驶时间 --> | ||
| 409 | - <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/> | ||
| 410 | - <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/> | ||
| 411 | - | ||
| 412 | - <!-- 隐藏字段-里程 --> | ||
| 413 | - <!-- 上下行行驶里程 --> | ||
| 414 | - <input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/> | ||
| 415 | - <input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/> | ||
| 416 | - <!-- 上下行进场出场里程 --> | ||
| 417 | - <input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/> | ||
| 418 | - <input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/> | ||
| 419 | - <input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/> | ||
| 420 | - <input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/> | ||
| 421 | - | ||
| 422 | - | ||
| 423 | -</script> | ||
| 424 | - | ||
| 425 | -<script type="text/javascript"> | ||
| 426 | - $('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun){ | ||
| 427 | - | ||
| 428 | - var _mainFun = mainFun; | ||
| 429 | - | ||
| 430 | - // 加载延迟200毫秒显示mobal | ||
| 431 | - setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 432 | - var param = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 433 | - | ||
| 434 | - // 获取表单元素 | ||
| 435 | - var form = $('#param_form'); | ||
| 436 | - // 错误提示元素 | ||
| 437 | - var paramAlert = $('.alert-danger', form); | ||
| 438 | - // 确定事件点击 | ||
| 439 | - $('#paramnext').on('click', function() { | ||
| 440 | - $("#paramcancel").addClass("disabled"); | ||
| 441 | - $("#paramnext").addClass("disabled"); | ||
| 442 | - $(".paramnextSpan").html("正在生成..."); | ||
| 443 | - | ||
| 444 | - setTimeout(function() { | ||
| 445 | - form.submit();// 表单提交 | ||
| 446 | - }, 500); | ||
| 447 | - | ||
| 448 | - // $("#paramnext").removeClass("disabled"); | ||
| 449 | - // $("#paramnext").html("确定"); | ||
| 450 | - }); | ||
| 451 | - | ||
| 452 | - // 表单验证 | ||
| 453 | - form.validate({ | ||
| 454 | - errorElement : 'span', | ||
| 455 | - errorClass : 'help-block help-block-error', | ||
| 456 | - focusInvalid : false, | ||
| 457 | - rules: { | ||
| 458 | - 'skbName' : {required : true,},// 时刻表名称,必填项. | ||
| 459 | - 'lineName' : {required : true,},// 线路名称,必填项. | ||
| 460 | - 'lineVersion': {required: true}, // 站点路由版本,必填项, | ||
| 461 | - 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. | ||
| 462 | - 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. | ||
| 463 | - 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项. | ||
| 464 | - 'endStationEndTime' : {required : true}, // 终点站末班时间,必填项. | ||
| 465 | - 'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 . | ||
| 466 | - 'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 . | ||
| 467 | - 'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 . | ||
| 468 | - 'lateEndTime' : {required : true},// 晚高峰结束时间,必填项. | ||
| 469 | - 'upInTimer' : {number : true},// 上行进场时间,必须为数字. | ||
| 470 | - 'upOutTimer' : {number : true},// 上行出场时间,必须为数字. | ||
| 471 | - 'downInTimer' : {number : true},// 下行进场时间,必须为数字. | ||
| 472 | - 'downOutTimer' : {number : true},// 下行出场时间,必须为数字. | ||
| 473 | - 'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字. | ||
| 474 | - 'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字. | ||
| 475 | - 'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字. | ||
| 476 | - 'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字. | ||
| 477 | - 'troughUpTime' : {number : true},// 低谷上行时间,必须为数字. | ||
| 478 | - 'troughDownTime' : {number : true},// 低谷下行时间,必须为数字. | ||
| 479 | - 'linePlayType' : {required : true},// 线路规划类型,必填项 | ||
| 480 | - 'lb' : {number : true},// 早晚例行保养,必须为数字. | ||
| 481 | - 'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字. | ||
| 482 | - 'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字. | ||
| 483 | - 'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔. | ||
| 484 | - 'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔. | ||
| 485 | - 'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔. | ||
| 486 | - 'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔. | ||
| 487 | - 'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔. | ||
| 488 | - 'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔. | ||
| 489 | - 'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数 | ||
| 490 | - 'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数. | ||
| 491 | - 'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数. | ||
| 492 | - 'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数. | ||
| 493 | - 'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数. | ||
| 494 | - 'upInMileage' : {number : true},// 上行进场里程,必须为数字. | ||
| 495 | - 'upOutMileage' : {number : true},// 上行出场里程,必须为数字. | ||
| 496 | - 'downInMileage' : {number : true},// 下行进场里程,必须为数字. | ||
| 497 | - 'downOutMileage' : {number : true}, // 下行出场里程,必须为数字. | ||
| 498 | - | ||
| 499 | - 'strategy' : {required : true} // 生成策略标识 | ||
| 500 | - | ||
| 501 | - // TODO | ||
| 502 | - }, | ||
| 503 | - invalidHandler : function(event, validator) { | ||
| 504 | - paramAlert.show(); | ||
| 505 | - App.scrollTo(paramAlert, -200); | ||
| 506 | - }, | ||
| 507 | - highlight : function(element) { | ||
| 508 | - $(element).closest('.form-group').addClass('has-error'); | ||
| 509 | - }, | ||
| 510 | - unhighlight : function(element) { | ||
| 511 | - $(element).closest('.form-group').removeClass('has-error'); | ||
| 512 | - }, | ||
| 513 | - success : function(label) { | ||
| 514 | - label.closest('.form-group').removeClass('has-error'); | ||
| 515 | - }, | ||
| 516 | - submitHandler : function(f) { | ||
| 517 | - // 1、 获取表单内容,并序列化 | ||
| 518 | - var fp = form.serializeJSON(); | ||
| 519 | - | ||
| 520 | - console.log(fp); | ||
| 521 | - | ||
| 522 | - // 2、重新刷新表单数据 | ||
| 523 | - var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 524 | - var key; | ||
| 525 | - for (key in fp) { | ||
| 526 | - if (ganttMap[key]) { | ||
| 527 | - if (ganttMap[key] != fp[key]) { | ||
| 528 | - ganttMap[key] = fp[key]; | ||
| 529 | - } | ||
| 530 | - } else { | ||
| 531 | - ganttMap[key] = fp[key]; | ||
| 532 | - } | ||
| 533 | - } | ||
| 534 | - window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap)); | ||
| 535 | - | ||
| 536 | - // TODO | ||
| 537 | - var pp = getParamObjAndDataMap(); | ||
| 538 | - var paramObj = pp[0]; | ||
| 539 | - var dataMap = pp[1]; | ||
| 540 | - var csMap = getCSMap(paramObj); | ||
| 541 | - // console.log(graph); | ||
| 542 | - | ||
| 543 | - var data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar); | ||
| 544 | - _mainFun.exportDataConfig(data.aInternalLpObj); | ||
| 545 | - | ||
| 546 | - // var data = obj.getDataArray(); | ||
| 547 | - // // 2、 调整路牌对应的班次总数 | ||
| 548 | - // updFormParams(params,data); | ||
| 549 | - // 删除图形. | ||
| 550 | - $('svg.svg-chart').remove(); | ||
| 551 | - // 重新创建图形. | ||
| 552 | - var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data)); | ||
| 553 | - // 根据数据重新渲染图形. | ||
| 554 | - graph.data(data.json); | ||
| 555 | - // 记录早操.并保存历史班次数据 | ||
| 556 | - graph.addHistory(); | ||
| 557 | - // 隐藏错误提示 | ||
| 558 | - paramAlert.hide(); | ||
| 559 | - // 隐藏 reladplus_mobal 弹出层 | ||
| 560 | - $('#paramadd_mobal').modal('hide'); | ||
| 561 | - layer.msg('成功!'); | ||
| 562 | - } | ||
| 563 | - }); | ||
| 564 | - | ||
| 565 | - | ||
| 566 | - // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。 | ||
| 567 | - $('#paramadd_mobal').on('show.bs.modal', function () { | ||
| 568 | - // TODO | ||
| 569 | - // 把数据填充到模版中 | ||
| 570 | - // var tbodyHtml = template('countAdd_temp',{list:countDate}); | ||
| 571 | - // // 把渲染好的模版html文本追加到表格中 | ||
| 572 | - // $('#datatable_countadd tbody').html(tbodyHtml); | ||
| 573 | - var htmldata = template('paramAdd_temp', {map : param}); | ||
| 574 | - $('#ptab').html(htmldata); | ||
| 575 | - | ||
| 576 | - // 线路规划类型 | ||
| 577 | - $('#linePlayType_id').val(param.linePlayType); | ||
| 578 | - // 策略类型 | ||
| 579 | - $('#strategy_id').val(param.strategy || "AdjustTripS1"); | ||
| 580 | - // 吃饭地点 | ||
| 581 | - $get('/stationroute/all', { | ||
| 582 | - 'line.id_eq': param.lineName.split('_')[0], | ||
| 583 | - 'destroy_eq': 0, | ||
| 584 | - 'versions_eq': param.lineVersion}, | ||
| 585 | - function(result) { | ||
| 586 | - var opt = []; | ||
| 587 | - opt.push('<option value="">请选择...</option>'); | ||
| 588 | - $.each(result, function(i, d) { | ||
| 589 | - if (d.stationMark == 'B' && d.directions == 0) { | ||
| 590 | - opt.push("<option value='0'>" + d.stationName + "</option>"); | ||
| 591 | - } else if (d.stationMark == 'E' && d.directions == 0) { | ||
| 592 | - opt.push("<option value='1'>" + d.stationName + "</option>"); | ||
| 593 | - } | ||
| 594 | - }); | ||
| 595 | - initTagsinput(opt.join(",")); | ||
| 596 | - | ||
| 597 | - opt.push("<option value='allYes'>起终点站都可以</option>"); | ||
| 598 | - $('#cfdd_id').html(opt.join("")); | ||
| 599 | - $('#cfdd_id').val(param.cfdd); | ||
| 600 | - | ||
| 601 | - } | ||
| 602 | - ); | ||
| 603 | - // 停车场 | ||
| 604 | - $get('/carpark/all',null, function(cd) { | ||
| 605 | - var opt = []; | ||
| 606 | - opt.push('<option value="">请选择...</option><optgroup label="停车场">'); | ||
| 607 | - var $_len = cd.length; | ||
| 608 | - if($_len > 0) { | ||
| 609 | - $.each(cd, function(i, d){ | ||
| 610 | - opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>'); | ||
| 611 | - }); | ||
| 612 | - } | ||
| 613 | - opt.push('</optgroup>'); | ||
| 614 | - $('#carPark_id').html(opt.join(",")).select2(); | ||
| 615 | - $('#carPark_id').select2("val", param.carPark); | ||
| 616 | - }); | ||
| 617 | - | ||
| 618 | - // 上下行首末班日期控件 | ||
| 619 | - $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 620 | - $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 621 | - $('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 622 | - $('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 623 | - | ||
| 624 | - // 早高峰晚高峰日期控件 | ||
| 625 | - $('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 626 | - $('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 627 | - $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 628 | - $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 629 | - | ||
| 630 | - }); | ||
| 631 | - | ||
| 632 | - | ||
| 633 | - | ||
| 634 | - //--------------------- 其他方法 ------------------------// | ||
| 635 | - | ||
| 636 | - function initTagsinput(htmlStr) { | ||
| 637 | - $('#masterStop_id').html(htmlStr); | ||
| 638 | - | ||
| 639 | - var elt = $('#stoptype_tagsinput'); | ||
| 640 | - var value = elt.val(); | ||
| 641 | - var stoptype = value.split("/")[0]; | ||
| 642 | - var masterstop = value.split("/")[1]; | ||
| 643 | - | ||
| 644 | - $('#stopType_id').val(stoptype); | ||
| 645 | - $('#masterStop_id').val(masterstop); | ||
| 646 | - | ||
| 647 | - elt.tagsinput({ | ||
| 648 | - tagClass: function(item) { | ||
| 649 | - return 'label label-danger label-important'; | ||
| 650 | - }, | ||
| 651 | - itemValue: 'value', | ||
| 652 | - itemText: 'text' | ||
| 653 | - }); | ||
| 654 | - | ||
| 655 | - $('#stoptype_tagsinput').on('beforeItemAdd', function(event) { | ||
| 656 | - // TODO:这里可以做一些逻辑判定 | ||
| 657 | - }); | ||
| 658 | - | ||
| 659 | - $('#stoptype_tagsinput_add').on('click', function(){ | ||
| 660 | - var stoptype = $("#stopType_id").val(); | ||
| 661 | - var masterstop = $("#masterStop_id").val(); | ||
| 662 | - var masterstop_text = $("#masterStop_id option:selected").text(); | ||
| 663 | - | ||
| 664 | - if (stoptype && stoptype != "") { | ||
| 665 | - if (stoptype == "0" && masterstop && masterstop != "") { | ||
| 666 | - elt.tagsinput('add', { | ||
| 667 | - "value": stoptype + '/' + masterstop, | ||
| 668 | - "text": "主站停站" + "/" + masterstop_text | ||
| 669 | - }); | ||
| 670 | - } else { | ||
| 671 | - elt.tagsinput('add', { | ||
| 672 | - "value": 1, | ||
| 673 | - "text": "双向停站" | ||
| 674 | - }); | ||
| 675 | - } | ||
| 676 | - } | ||
| 677 | - }); | ||
| 678 | - | ||
| 679 | - if (stoptype && stoptype != "") { | ||
| 680 | - elt.tagsinput('add', { | ||
| 681 | - "value": stoptype + '/' + masterstop, | ||
| 682 | - "text": | ||
| 683 | - $("#stopType_id option:selected").text() + "/" + | ||
| 684 | - $("#masterStop_id option:selected").text() | ||
| 685 | - }); | ||
| 686 | - } | ||
| 687 | - | ||
| 688 | - } | ||
| 689 | - | ||
| 690 | - function getMinDate(d1,d2) { | ||
| 691 | - // 1、定义返回字符串. | ||
| 692 | - var str = ''; | ||
| 693 | - // 2、判断时间大小. | ||
| 694 | - if(strToTime(d1)>strToTime(d2)) | ||
| 695 | - str = d2; | ||
| 696 | - else | ||
| 697 | - str = d1; | ||
| 698 | - // 3、返回最小时间(字符串). | ||
| 699 | - return str; | ||
| 700 | - } | ||
| 701 | - | ||
| 702 | - function strToTime(t) { | ||
| 703 | - var d = new Date(); | ||
| 704 | - if(t) { | ||
| 705 | - var _str = t.split(':'); | ||
| 706 | - d.setHours(parseInt(_str[0])); | ||
| 707 | - d.setMinutes(parseInt(_str[1])); | ||
| 708 | - } | ||
| 709 | - return d; | ||
| 710 | - } | ||
| 711 | - | ||
| 712 | - function getMaxDate(d1,d2) { | ||
| 713 | - // 1、定义返回时间字符串. | ||
| 714 | - var str = ''; | ||
| 715 | - // 2、判断时间大小. | ||
| 716 | - if(strToTime(d1)>strToTime(d2)) | ||
| 717 | - str = d1; | ||
| 718 | - else | ||
| 719 | - str = d2; | ||
| 720 | - // 3、返回一个最大时间(字符串). | ||
| 721 | - return str; | ||
| 722 | - } | ||
| 723 | - | ||
| 724 | - function getEndDate(date) { | ||
| 725 | - var lastEndDate = Date.now(); | ||
| 726 | - if (date) { | ||
| 727 | - var str = date.replace(/-/g,"/"); | ||
| 728 | - lastEndDate = new Date(str); | ||
| 729 | - } | ||
| 730 | - // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间) | ||
| 731 | - return lastEndDate; | ||
| 732 | - } | ||
| 733 | - | ||
| 734 | - function formatPairing(v1,v2) { | ||
| 735 | - v1 = v1 == '' ? 0 : parseInt(v1); | ||
| 736 | - v2 = v2 == ''? 0 : parseInt(v2) ; | ||
| 737 | - return [v1,v2]; | ||
| 738 | - } | ||
| 739 | - | ||
| 740 | - function qzdz(zd1,zd2) { | ||
| 741 | - return [zd1,zd2]; | ||
| 742 | - } | ||
| 743 | - | ||
| 744 | - function formatksjssj(gp) { | ||
| 745 | - return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}]; | ||
| 746 | - } | ||
| 747 | - | ||
| 748 | - function getsd(st,ed) { | ||
| 749 | - return [{'st':st,'ed':ed}]; | ||
| 750 | - } | ||
| 751 | - | ||
| 752 | - function getDateTime(time) { | ||
| 753 | - var dateTime = new Date(); | ||
| 754 | - var timeArr; | ||
| 755 | - if(time !=null && time !='' && typeof(time) !='undefined') { | ||
| 756 | - timeArr = time.split(':'); | ||
| 757 | - dateTime.setHours(parseInt(timeArr[0])); | ||
| 758 | - dateTime.setMinutes(parseInt(timeArr[1])); | ||
| 759 | - } | ||
| 760 | - return dateTime; | ||
| 761 | - } | ||
| 762 | - | ||
| 763 | - function getYAxisCarArray(len) { | ||
| 764 | - var array = new Array(); | ||
| 765 | - if(len>0) { | ||
| 766 | - for(var y = 0; y<len; y++) { | ||
| 767 | - array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象 | ||
| 768 | - }; | ||
| 769 | - } | ||
| 770 | - return array; | ||
| 771 | - } | ||
| 772 | - | ||
| 773 | - function getylp(arr) { | ||
| 774 | - var ra = new Array(),name = new Array(); | ||
| 775 | - for(var i = 0 ; i<arr.length;i++) { | ||
| 776 | - ra.push(arr[i].lpNo); | ||
| 777 | - name.push(arr[i].lpName); | ||
| 778 | - } | ||
| 779 | - return {'lpNoA':ra,'lpNameA':name,}; | ||
| 780 | - } | ||
| 781 | - | ||
| 782 | - function getParamObjAndDataMap() { | ||
| 783 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 784 | - // seMap | ||
| 785 | - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 786 | - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 787 | - // dirA | ||
| 788 | - var dirA = ['relationshipGraph-up', 'relationshipGraph-down']; | ||
| 789 | - // bcTypeArr | ||
| 790 | - var bcTypeArr = { | ||
| 791 | - 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc', | ||
| 792 | - 'major': 'major', 'venting': 'venting', 'region': 'region' | ||
| 793 | - }; | ||
| 794 | - // seDate | ||
| 795 | - var newDate = new Date(); | ||
| 796 | - var kssj = d3.time.hour.offset(getEndDate( | ||
| 797 | - newDate.getFullYear()+ "-" + | ||
| 798 | - (newDate.getMonth()+1) + "-" + | ||
| 799 | - newDate.getDate() + ' ' + | ||
| 800 | - seMap.s.split(':')[0] + ':00'),-1); | ||
| 801 | - | ||
| 802 | - var year = '' , month = '',dt = ''; | ||
| 803 | - if(newDate.getDate()+1>31) | ||
| 804 | - dt = '01'; | ||
| 805 | - else | ||
| 806 | - dt = newDate.getDate()+1; | ||
| 807 | - if(newDate.getMonth()+1>12) | ||
| 808 | - month = '01'; | ||
| 809 | - else if(newDate.getDate()+1>31) | ||
| 810 | - month = newDate.getMonth()+2; | ||
| 811 | - else | ||
| 812 | - month = newDate.getMonth()+1; | ||
| 813 | - if(newDate.getMonth()+1>12) | ||
| 814 | - year = newDate.getFullYear()+1; | ||
| 815 | - else | ||
| 816 | - year = newDate.getFullYear(); | ||
| 817 | - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 818 | - seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 819 | - | ||
| 820 | - // dataMap | ||
| 821 | - var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下] | ||
| 822 | - 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下] | ||
| 823 | - 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下] | ||
| 824 | - 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下] | ||
| 825 | - 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下] | ||
| 826 | - 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime, | ||
| 827 | - map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下] | ||
| 828 | - 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime, | ||
| 829 | - map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下] | ||
| 830 | - 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下] | ||
| 831 | - 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下] | ||
| 832 | - 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下] | ||
| 833 | - 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚] | ||
| 834 | - 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间] | ||
| 835 | - 'zgfsjd' : getsd(getDateTime(map.earlyStartTime), | ||
| 836 | - getDateTime(map.earlyEndTime)), // 早高峰时间段 | ||
| 837 | - 'wgfsjd' : getsd(getDateTime(map.lateStartTime), | ||
| 838 | - getDateTime(map.lateEndTime)),// 晚高峰时间段 | ||
| 839 | - 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime), | ||
| 840 | - getDateTime(map.lateStartTime)),//高峰之间时间段. | ||
| 841 | - 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime), | ||
| 842 | - getDateTime(seMap.e)),// 晚高峰之后时间段 | ||
| 843 | - 'zgfzqsjd': getsd(getDateTime(seMap.s), | ||
| 844 | - getDateTime(map.earlyStartTime)),//早高峰之前时间段. | ||
| 845 | - 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下] | ||
| 846 | - 'bcTypeArr' : bcTypeArr,// 班次类型 | ||
| 847 | - 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间. | ||
| 848 | - // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间. | ||
| 849 | - // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间. | ||
| 850 | - // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间. | ||
| 851 | - 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间. | ||
| 852 | - 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间. | ||
| 853 | - 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间. | ||
| 854 | - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙. | ||
| 855 | - 'map' : map, | ||
| 856 | - 'zzsj':map.zzsj,// 周转时间. | ||
| 857 | - }; | ||
| 858 | - | ||
| 859 | - var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap); | ||
| 860 | - map.clzs = _paramObj.calcuClzx(); | ||
| 861 | - return [_paramObj, dataMap]; | ||
| 862 | - | ||
| 863 | - } | ||
| 864 | - | ||
| 865 | - function getCSMap(parmObj) { | ||
| 866 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 867 | - return {'gattA':null, | ||
| 868 | - 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) , | ||
| 869 | - 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()), | ||
| 870 | - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)}, | ||
| 871 | - 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))}; | ||
| 872 | - } | ||
| 873 | - | ||
| 874 | - function getGraphArgus(CSMap, dataMap, data) { | ||
| 875 | - // TODO | ||
| 876 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 877 | - var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 878 | - | ||
| 879 | - // seMap | ||
| 880 | - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 881 | - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 882 | - | ||
| 883 | - // seDate | ||
| 884 | - var newDate = new Date(); | ||
| 885 | - var kssj = d3.time.hour.offset(getEndDate( | ||
| 886 | - newDate.getFullYear()+ "-" + | ||
| 887 | - (newDate.getMonth()+1) + "-" + | ||
| 888 | - newDate.getDate() + ' ' + | ||
| 889 | - seMap.s.split(':')[0] + ':00'),-1); | ||
| 890 | - | ||
| 891 | - var year = '' , month = '',dt = ''; | ||
| 892 | - if(newDate.getDate()+1>31) | ||
| 893 | - dt = '01'; | ||
| 894 | - else | ||
| 895 | - dt = newDate.getDate()+1; | ||
| 896 | - if(newDate.getMonth()+1>12) | ||
| 897 | - month = '01'; | ||
| 898 | - else if(newDate.getDate()+1>31) | ||
| 899 | - month = newDate.getMonth()+2; | ||
| 900 | - else | ||
| 901 | - month = newDate.getMonth()+1; | ||
| 902 | - if(newDate.getMonth()+1>12) | ||
| 903 | - year = newDate.getFullYear()+1; | ||
| 904 | - else | ||
| 905 | - year = newDate.getFullYear(); | ||
| 906 | - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 907 | - seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 908 | - | ||
| 909 | - | ||
| 910 | - var bs = sxsj > 40 ? 4 : 2; | ||
| 911 | - var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs; | ||
| 912 | - var VALUEKEYNAME = 'Worldwide Gross' , | ||
| 913 | - DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240, | ||
| 914 | - MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60, | ||
| 915 | - STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true; | ||
| 916 | - var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ; | ||
| 917 | - // 计算出相差天数 | ||
| 918 | - var days=Math.floor(dx_time/(24*3600*1000)); | ||
| 919 | - // 计算出小时数 | ||
| 920 | - var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数 | ||
| 921 | - var hours=Math.floor(leave1/(3600*1000)); | ||
| 922 | - DXHOURS = days*24+hours; | ||
| 923 | - WIDTH = DXHOURS*MINUTE*MULTIPLE; | ||
| 924 | - // debugger; | ||
| 925 | - var lpsplitA = getylp(CSMap.maxCar); | ||
| 926 | - | ||
| 927 | - var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 928 | - var xxsj = parseInt(map.downTravelTime);// 下行时间. | ||
| 929 | - var stopAraay = [{ | ||
| 930 | - 'sxsj':sxsj,// 上行时间. | ||
| 931 | - 'xxsj':xxsj,// 下行时间. | ||
| 932 | - 'zzsj':map.zzsj,// 周转时间. | ||
| 933 | - 'wcsj':parseInt(map.workeLunch),// 午餐时间. | ||
| 934 | - 'wcsj':parseInt(map.workeDinner),// 晚餐时间. | ||
| 935 | - 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间. | ||
| 936 | - 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间. | ||
| 937 | - 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间. | ||
| 938 | - 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间. | ||
| 939 | - 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间. | ||
| 940 | - 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间. | ||
| 941 | - 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间. | ||
| 942 | - 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间. | ||
| 943 | - 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程. | ||
| 944 | - 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程. | ||
| 945 | - 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程. | ||
| 946 | - 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程. | ||
| 947 | - 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间. | ||
| 948 | - }]; | ||
| 949 | - | ||
| 950 | - var args = { | ||
| 951 | - 'valueKeyName': VALUEKEYNAME, | ||
| 952 | - 'hours' : DXHOURS, | ||
| 953 | - 'dxHours' : 24 - DXHOURS, | ||
| 954 | - 'multiple': MULTIPLE, | ||
| 955 | - 'width':WIDTH, | ||
| 956 | - 'widtMargin':MARGINLEFT, | ||
| 957 | - 'height':HEIGHT, | ||
| 958 | - 'heightMargin':MARGINBOTTOM, | ||
| 959 | - 'offsetX':OFFSETX, | ||
| 960 | - 'offsetY':OFFSETY, | ||
| 961 | - 'downDy':OFFSETDOWNY, | ||
| 962 | - 'upDy':OFFSETUPY, | ||
| 963 | - 'timeDomainStart' :STARTDATETIME, | ||
| 964 | - 'timeDomainEnd' : ENDDATETIME, | ||
| 965 | - 'startStr':'' + STARTDATETIME, | ||
| 966 | - 'endStr': '' +ENDDATETIME, | ||
| 967 | - 'taskTypes': TASKTYPES, | ||
| 968 | - 'lpNoA':lpsplitA.lpNoA, | ||
| 969 | - 'lpNameA':lpsplitA.lpNameA, | ||
| 970 | - 'tickFormat': TICKFORMAT, | ||
| 971 | - 'stopAraay' : stopAraay, | ||
| 972 | - 'dataMap':dataMap, | ||
| 973 | - 'showTooltips': SHOWTOOLTIPS, | ||
| 974 | - 'bxrcgs':data.bxrcgs | ||
| 975 | - }; | ||
| 976 | - return args; | ||
| 977 | - } | ||
| 978 | - | ||
| 979 | - | ||
| 980 | - | ||
| 981 | - }); | ||
| 982 | - | 1 | +<!-- 统计数据 --> |
| 2 | +<style> | ||
| 3 | + .form-control:focus { | ||
| 4 | + border-color: #53ced9; | ||
| 5 | + } | ||
| 6 | + .tagsDiv { | ||
| 7 | + border: 1px solid #c2cad8; | ||
| 8 | + margin-left: 15px; | ||
| 9 | + padding: 4px 15px 4px 15px; | ||
| 10 | + width: 50%; | ||
| 11 | + } | ||
| 12 | +</style> | ||
| 13 | +<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 14 | + <div class="modal-dialog" style="margin-left: 100px;"> | ||
| 15 | + <div class="modal-content" style="width: 1000px;"> | ||
| 16 | + <div class="modal-header"> | ||
| 17 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 18 | + <h4 class="modal-title">参数数据 </h4> | ||
| 19 | + </div> | ||
| 20 | + <div class="modal-body"> | ||
| 21 | + <form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate"> | ||
| 22 | + <div class="form-body"> | ||
| 23 | + <div class="alert alert-danger display-hide"> | ||
| 24 | + <button class="close" data-close="alert"></button> | ||
| 25 | + 您的输入有误,请检查下面的输入项 | ||
| 26 | + </div> | ||
| 27 | + <div class="alert alert-success display-none"> | ||
| 28 | + <button class="close" data-dismiss="alert"></button> | ||
| 29 | + 验证成功! | ||
| 30 | + </div> | ||
| 31 | + | ||
| 32 | + </div> | ||
| 33 | + | ||
| 34 | + <div class="tab-pane" id="ptab"> | ||
| 35 | + | ||
| 36 | + </div> | ||
| 37 | + </form> | ||
| 38 | + </div> | ||
| 39 | + | ||
| 40 | + <div class="modal-footer"> | ||
| 41 | + <button type="button" class="btn default" data-dismiss="modal" id="paramcancel"> | ||
| 42 | + <span class="paramcancelSpan">取消</span> | ||
| 43 | + </button> | ||
| 44 | + <button type="button" class="btn btn-primary" id="paramnext"> | ||
| 45 | + <span class="paramnextSpan">确定</span> | ||
| 46 | + </button> | ||
| 47 | + </div> | ||
| 48 | + | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | +</div> | ||
| 52 | + | ||
| 53 | +<script type="text/html" id = "paramAdd_temp"> | ||
| 54 | + <div class="form-group"> | ||
| 55 | + <div class="col-md-6"> | ||
| 56 | + <label class="control-label col-md-5"> | ||
| 57 | + <span class="required"> * </span> 上行首班时间 : | ||
| 58 | + </label> | ||
| 59 | + <div class="col-md-5"> | ||
| 60 | + <input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id" | ||
| 61 | + placeholder="请输入起始站首班时间"> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + <div class="col-md-6"> | ||
| 65 | + <label class="control-label col-md-5"> | ||
| 66 | + <span class="required"> * </span> 上行末班时间 : | ||
| 67 | + </label> | ||
| 68 | + <div class="col-md-5"> | ||
| 69 | + <input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id" | ||
| 70 | + placeholder="请输入起始站末班时间"> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + | ||
| 75 | + <div class="form-group"> | ||
| 76 | + <div class="col-md-6"> | ||
| 77 | + <label class="control-label col-md-5"> | ||
| 78 | + <span class="required"> * </span> 下行首班时间 : | ||
| 79 | + </label> | ||
| 80 | + <div class="col-md-5"> | ||
| 81 | + <input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id" | ||
| 82 | + placeholder="请输入终点站首班时间"> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + <div class="col-md-6"> | ||
| 86 | + <label class="control-label col-md-5"> | ||
| 87 | + <span class="required"> * </span> 下行末班时间 : | ||
| 88 | + </label> | ||
| 89 | + <div class="col-md-5"> | ||
| 90 | + <input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id" | ||
| 91 | + placeholder="请输入终点站末班时间"> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + | ||
| 96 | + <div class="form-group"> | ||
| 97 | + <div class="col-md-6"> | ||
| 98 | + <label class="control-label col-md-5"> | ||
| 99 | + <span class="required"> * </span> 早高峰开始时间 : | ||
| 100 | + </label> | ||
| 101 | + <div class="col-md-5"> | ||
| 102 | + <input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id" | ||
| 103 | + placeholder="请输入早高峰开始时间"> | ||
| 104 | + </div> | ||
| 105 | + </div> | ||
| 106 | + <div class="col-md-6"> | ||
| 107 | + <label class="control-label col-md-5"> | ||
| 108 | + <span class="required"> * </span> 早高峰结束时间 : | ||
| 109 | + </label> | ||
| 110 | + <div class="col-md-5"> | ||
| 111 | + <input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id" | ||
| 112 | + placeholder="请输入早高峰结束时间"> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + </div> | ||
| 116 | + | ||
| 117 | + <div class="form-group"> | ||
| 118 | + <div class="col-md-6"> | ||
| 119 | + <label class="control-label col-md-5"> | ||
| 120 | + <span class="required"> * </span> 晚高峰开始时间 : | ||
| 121 | + </label> | ||
| 122 | + <div class="col-md-5"> | ||
| 123 | + <input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id" | ||
| 124 | + placeholder="请输入晚高峰开始时间"> | ||
| 125 | + </div> | ||
| 126 | + </div> | ||
| 127 | + <div class="col-md-6"> | ||
| 128 | + <label class="control-label col-md-5"> | ||
| 129 | + <span class="required"> * </span> 晚高峰结束时间 : | ||
| 130 | + </label> | ||
| 131 | + <div class="col-md-5"> | ||
| 132 | + <input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id" | ||
| 133 | + placeholder="请输入晚高峰结束时间"> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + | ||
| 138 | + <div class="form-group"> | ||
| 139 | + <div class="col-md-6"> | ||
| 140 | + <label class="control-label col-md-5">上行进场时间 : | ||
| 141 | + </label> | ||
| 142 | + <div class="col-md-5"> | ||
| 143 | + <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id" | ||
| 144 | + placeholder="请输入上行进场时间"> | ||
| 145 | + </div> | ||
| 146 | + </div> | ||
| 147 | + <div class="col-md-6"> | ||
| 148 | + <label class="control-label col-md-5">上行出场时间 : | ||
| 149 | + </label> | ||
| 150 | + <div class="col-md-5"> | ||
| 151 | + <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id" | ||
| 152 | + placeholder="请输入上行出场时间"> | ||
| 153 | + </div> | ||
| 154 | + </div> | ||
| 155 | + </div> | ||
| 156 | + | ||
| 157 | + <div class="form-group"> | ||
| 158 | + <div class="col-md-6"> | ||
| 159 | + <label class="control-label col-md-5">下行进场时间 : | ||
| 160 | + </label> | ||
| 161 | + <div class="col-md-5"> | ||
| 162 | + <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id" | ||
| 163 | + placeholder="请输入下行进场时间"> | ||
| 164 | + </div> | ||
| 165 | + </div> | ||
| 166 | + <div class="col-md-6"> | ||
| 167 | + <label class="control-label col-md-5">下行出场时间 : | ||
| 168 | + </label> | ||
| 169 | + <div class="col-md-5"> | ||
| 170 | + <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id" | ||
| 171 | + placeholder="请输入下行出场时间"> | ||
| 172 | + </div> | ||
| 173 | + </div> | ||
| 174 | + </div> | ||
| 175 | + | ||
| 176 | + <div class="form-group"> | ||
| 177 | + <div class="col-md-6"> | ||
| 178 | + <label class="control-label col-md-5">早高峰上行时间 :</label> | ||
| 179 | + <div class="col-md-5"> | ||
| 180 | + <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id" | ||
| 181 | + placeholder="请输入早高峰上行时间"> | ||
| 182 | + </div> | ||
| 183 | + </div> | ||
| 184 | + <div class="col-md-6"> | ||
| 185 | + <label class="control-label col-md-5">早高峰下行时间 :</label> | ||
| 186 | + <div class="col-md-5"> | ||
| 187 | + <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id" | ||
| 188 | + placeholder="请输入早高峰下行时间"> | ||
| 189 | + </div> | ||
| 190 | + </div> | ||
| 191 | + </div> | ||
| 192 | + | ||
| 193 | + <div class="form-group"> | ||
| 194 | + <div class="col-md-6"> | ||
| 195 | + <label class="control-label col-md-5">晚高峰上行时间 :</label> | ||
| 196 | + <div class="col-md-5"> | ||
| 197 | + <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id" | ||
| 198 | + placeholder="请输入晚高峰上行时间"> | ||
| 199 | + </div> | ||
| 200 | + </div> | ||
| 201 | + <div class="col-md-6"> | ||
| 202 | + <label class="control-label col-md-5">晚高峰下行时间 :</label> | ||
| 203 | + <div class="col-md-5"> | ||
| 204 | + <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id" | ||
| 205 | + placeholder="请输入晚高峰下行时间"> | ||
| 206 | + </div> | ||
| 207 | + </div> | ||
| 208 | + </div> | ||
| 209 | + | ||
| 210 | + <div class="form-group"> | ||
| 211 | + <div class="col-md-6"> | ||
| 212 | + <label class="control-label col-md-5">低谷上行时间 :</label> | ||
| 213 | + <div class="col-md-5"> | ||
| 214 | + <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id" | ||
| 215 | + placeholder="请输入低谷上行时间"> | ||
| 216 | + </div> | ||
| 217 | + </div> | ||
| 218 | + <div class="col-md-6"> | ||
| 219 | + <label class="control-label col-md-5">低谷下行时间 :</label> | ||
| 220 | + <div class="col-md-5"> | ||
| 221 | + <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id" | ||
| 222 | + placeholder="请输入低谷下行时间"> | ||
| 223 | + </div> | ||
| 224 | + </div> | ||
| 225 | + </div> | ||
| 226 | + | ||
| 227 | + <div class="form-group"> | ||
| 228 | + <div class="col-md-6"> | ||
| 229 | + <label class="control-label col-md-5"> | ||
| 230 | + <span class="required"> * </span> 线路规划类型 : | ||
| 231 | + </label> | ||
| 232 | + <div class="col-md-5"> | ||
| 233 | + <select name="linePlayType" class="form-control" id="linePlayType_id"> | ||
| 234 | + <option value="">-- 请选择线路类型 --</option> | ||
| 235 | + <option value="0">双向</option> | ||
| 236 | + <option value="1">环线</option> | ||
| 237 | + </select> | ||
| 238 | + </div> | ||
| 239 | + </div> | ||
| 240 | + <div class="col-md-6"> | ||
| 241 | + <label class="control-label col-md-5">吃饭地点 :</label> | ||
| 242 | + <div class="col-md-5"> | ||
| 243 | + <select type="text" class="form-control" name="cfdd" id="cfdd_id"> | ||
| 244 | + <option value="">请选择...</option> | ||
| 245 | + <option value="0">{{map.startStationName}}</option> | ||
| 246 | + <option value="1">{{map.endStationName}}</option> | ||
| 247 | + <option value="allYes">起终点站都可以</option> | ||
| 248 | + </select> | ||
| 249 | + </div> | ||
| 250 | + </div> | ||
| 251 | + </div> | ||
| 252 | + | ||
| 253 | + <div class="form-group"> | ||
| 254 | + <div class="col-md-6"> | ||
| 255 | + <label class="control-label col-md-5">早晚例行保养 :</label> | ||
| 256 | + <div class="col-md-5"> | ||
| 257 | + <input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id" | ||
| 258 | + placeholder="请输入早晚例行保养"> | ||
| 259 | + </div> | ||
| 260 | + </div> | ||
| 261 | + <div class="col-md-6"> | ||
| 262 | + <label class="control-label col-md-5">停车场 :</label> | ||
| 263 | + <div class="col-md-5"> | ||
| 264 | + <select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select> | ||
| 265 | + </div> | ||
| 266 | + </div> | ||
| 267 | + </div> | ||
| 268 | + | ||
| 269 | + | ||
| 270 | + <div class="form-group"> | ||
| 271 | + <div class="col-md-6"> | ||
| 272 | + <label class="control-label col-md-5">工作餐午餐时间 :</label> | ||
| 273 | + <div class="col-md-5"> | ||
| 274 | + <input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id" | ||
| 275 | + placeholder="请输入工作餐午餐时间"> | ||
| 276 | + </div> | ||
| 277 | + </div> | ||
| 278 | + <div class="col-md-6"> | ||
| 279 | + <label class="control-label col-md-5">工作餐晚餐时间 :</label> | ||
| 280 | + <div class="col-md-5"> | ||
| 281 | + <input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id" | ||
| 282 | + placeholder="请输入工作餐晚餐时间"> | ||
| 283 | + </div> | ||
| 284 | + </div> | ||
| 285 | + </div> | ||
| 286 | + | ||
| 287 | + <div class="form-group"> | ||
| 288 | + <div class="col-md-6"> | ||
| 289 | + <label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label> | ||
| 290 | + <div class="col-md-3" style="padding-right: 0px;"> | ||
| 291 | + <input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id" | ||
| 292 | + placeholder="最小间隔"> | ||
| 293 | + </div> | ||
| 294 | + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 295 | + <div class="col-md-3" style="padding-left: 0px;"> | ||
| 296 | + <input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id" | ||
| 297 | + placeholder="最大间隔"> | ||
| 298 | + </div> | ||
| 299 | + </div> | ||
| 300 | + <div class="col-md-6"> | ||
| 301 | + <label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label> | ||
| 302 | + <div class="col-md-3" style="padding-right: 0px;"> | ||
| 303 | + <input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id" | ||
| 304 | + placeholder="最小间隔"> | ||
| 305 | + </div> | ||
| 306 | + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 307 | + <div class="col-md-3" style="padding-left: 0px;"> | ||
| 308 | + <input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id" | ||
| 309 | + placeholder="最大间隔"> | ||
| 310 | + </div> | ||
| 311 | + </div> | ||
| 312 | + </div> | ||
| 313 | + | ||
| 314 | + <div class="form-group"> | ||
| 315 | + <div class="col-md-6"> | ||
| 316 | + <label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label> | ||
| 317 | + <div class="col-md-3" style="padding-right: 0px;"> | ||
| 318 | + <input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id" | ||
| 319 | + placeholder="最小间隔"> | ||
| 320 | + </div> | ||
| 321 | + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div> | ||
| 322 | + <div class="col-md-3" style="padding-left: 0px;"> | ||
| 323 | + <input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id" | ||
| 324 | + placeholder="最大间隔"> | ||
| 325 | + </div> | ||
| 326 | + </div> | ||
| 327 | + <div class="col-md-6"> | ||
| 328 | + <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label> | ||
| 329 | + <div class="col-md-5"> | ||
| 330 | + <input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id" | ||
| 331 | + placeholder="为0表示是周末时刻表"> | ||
| 332 | + </div> | ||
| 333 | + </div> | ||
| 334 | + </div> | ||
| 335 | + | ||
| 336 | + <div class="form-group"> | ||
| 337 | + <div class="col-md-6"> | ||
| 338 | + <label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label> | ||
| 339 | + <div class="col-md-5 tagsDiv"> | ||
| 340 | + <div class="row" style="margin-left: 15px;"> | ||
| 341 | + <input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;"> | ||
| 342 | + </div> | ||
| 343 | + | ||
| 344 | + <div class="row" style="margin-top: 10px;"> | ||
| 345 | + <label class="control-label col-md-4">停站类型:</label> | ||
| 346 | + <div class="col-md-8"> | ||
| 347 | + <select name="stopType" class="form-control" id="stopType_id"> | ||
| 348 | + <option value="">-- 请选择停站类型 --</option> | ||
| 349 | + <option value="0">主站停站</option> | ||
| 350 | + <option value="1">双向停站</option> | ||
| 351 | + </select> | ||
| 352 | + </div> | ||
| 353 | + </div> | ||
| 354 | + | ||
| 355 | + <div class="row" style="margin-top: 10px;"> | ||
| 356 | + <label class="control-label col-md-4">主站:</label> | ||
| 357 | + <div class="col-md-8"> | ||
| 358 | + <select name="masterStop" class="form-control" id="masterStop_id"> | ||
| 359 | + <option value="">请选择...</option> | ||
| 360 | + <option value="0">{{map.startStationName}}</option> | ||
| 361 | + <option value="1">{{map.endStationName}}</option> | ||
| 362 | + </select> | ||
| 363 | + </div> | ||
| 364 | + </div> | ||
| 365 | + | ||
| 366 | + <div class="row" style="margin-top: 10px;margin-left: 116px;"> | ||
| 367 | + <a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a> | ||
| 368 | + </div> | ||
| 369 | + </div> | ||
| 370 | + | ||
| 371 | + </div> | ||
| 372 | + | ||
| 373 | + <div class="col-md-6"> | ||
| 374 | + <div class="form-group"> | ||
| 375 | + <label class="control-label col-md-5"> | ||
| 376 | + <span class="required"> * </span> 建议高峰配车数 :</label> | ||
| 377 | + <div class="col-md-5"> | ||
| 378 | + <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" | ||
| 379 | + id="gfjypcsInput" min="1" value="{{map.gfjypcs}}"> | ||
| 380 | + </div> | ||
| 381 | + </div> | ||
| 382 | + <div class="form-group"> | ||
| 383 | + <label class="control-label col-md-5"> | ||
| 384 | + <span class="required"> * </span> 生成策略 : | ||
| 385 | + </label> | ||
| 386 | + <div class="col-md-5"> | ||
| 387 | + <select name="strategy" class="form-control" id="strategy_id"> | ||
| 388 | + <option value="AdjustTripS1" selected>AdjustTripS1</option> | ||
| 389 | + <option value="AdjustTripS2" disabled>AdjustTripS2</option> | ||
| 390 | + <option value="AdjustTripS3">AdjustTripS3</option> | ||
| 391 | + <option value="AdjustTripS4">AdjustTripS4</option> | ||
| 392 | + </select> | ||
| 393 | + </div> | ||
| 394 | + </div> | ||
| 395 | + </div> | ||
| 396 | + | ||
| 397 | + | ||
| 398 | + </div> | ||
| 399 | + | ||
| 400 | + | ||
| 401 | + <!-- 隐藏字段-时间 --> | ||
| 402 | + <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/> | ||
| 403 | + <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/> | ||
| 404 | + <input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/> | ||
| 405 | + <input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/> | ||
| 406 | + <input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/> | ||
| 407 | + | ||
| 408 | + <!-- 上下行行驶时间 --> | ||
| 409 | + <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/> | ||
| 410 | + <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/> | ||
| 411 | + | ||
| 412 | + <!-- 隐藏字段-里程 --> | ||
| 413 | + <!-- 上下行行驶里程 --> | ||
| 414 | + <input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/> | ||
| 415 | + <input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/> | ||
| 416 | + <!-- 上下行进场出场里程 --> | ||
| 417 | + <input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/> | ||
| 418 | + <input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/> | ||
| 419 | + <input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/> | ||
| 420 | + <input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/> | ||
| 421 | + | ||
| 422 | + | ||
| 423 | +</script> | ||
| 424 | + | ||
| 425 | +<script type="text/javascript"> | ||
| 426 | + $('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun){ | ||
| 427 | + | ||
| 428 | + var _mainFun = mainFun; | ||
| 429 | + | ||
| 430 | + // 加载延迟200毫秒显示mobal | ||
| 431 | + setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 432 | + var param = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 433 | + | ||
| 434 | + // 获取表单元素 | ||
| 435 | + var form = $('#param_form'); | ||
| 436 | + // 错误提示元素 | ||
| 437 | + var paramAlert = $('.alert-danger', form); | ||
| 438 | + // 确定事件点击 | ||
| 439 | + $('#paramnext').on('click', function() { | ||
| 440 | + $("#paramcancel").addClass("disabled"); | ||
| 441 | + $("#paramnext").addClass("disabled"); | ||
| 442 | + $(".paramnextSpan").html("正在生成..."); | ||
| 443 | + | ||
| 444 | + setTimeout(function() { | ||
| 445 | + form.submit();// 表单提交 | ||
| 446 | + }, 500); | ||
| 447 | + | ||
| 448 | + // $("#paramnext").removeClass("disabled"); | ||
| 449 | + // $("#paramnext").html("确定"); | ||
| 450 | + }); | ||
| 451 | + | ||
| 452 | + // 表单验证 | ||
| 453 | + form.validate({ | ||
| 454 | + errorElement : 'span', | ||
| 455 | + errorClass : 'help-block help-block-error', | ||
| 456 | + focusInvalid : false, | ||
| 457 | + rules: { | ||
| 458 | + 'skbName' : {required : true,},// 时刻表名称,必填项. | ||
| 459 | + 'lineName' : {required : true,},// 线路名称,必填项. | ||
| 460 | + 'lineVersion': {required: true}, // 站点路由版本,必填项, | ||
| 461 | + 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. | ||
| 462 | + 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. | ||
| 463 | + 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项. | ||
| 464 | + 'endStationEndTime' : {required : true}, // 终点站末班时间,必填项. | ||
| 465 | + 'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 . | ||
| 466 | + 'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 . | ||
| 467 | + 'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 . | ||
| 468 | + 'lateEndTime' : {required : true},// 晚高峰结束时间,必填项. | ||
| 469 | + 'upInTimer' : {number : true},// 上行进场时间,必须为数字. | ||
| 470 | + 'upOutTimer' : {number : true},// 上行出场时间,必须为数字. | ||
| 471 | + 'downInTimer' : {number : true},// 下行进场时间,必须为数字. | ||
| 472 | + 'downOutTimer' : {number : true},// 下行出场时间,必须为数字. | ||
| 473 | + 'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字. | ||
| 474 | + 'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字. | ||
| 475 | + 'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字. | ||
| 476 | + 'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字. | ||
| 477 | + 'troughUpTime' : {number : true},// 低谷上行时间,必须为数字. | ||
| 478 | + 'troughDownTime' : {number : true},// 低谷下行时间,必须为数字. | ||
| 479 | + 'linePlayType' : {required : true},// 线路规划类型,必填项 | ||
| 480 | + 'lb' : {number : true},// 早晚例行保养,必须为数字. | ||
| 481 | + 'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字. | ||
| 482 | + 'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字. | ||
| 483 | + 'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔. | ||
| 484 | + 'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔. | ||
| 485 | + 'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔. | ||
| 486 | + 'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔. | ||
| 487 | + 'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔. | ||
| 488 | + 'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔. | ||
| 489 | + 'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数 | ||
| 490 | + 'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数. | ||
| 491 | + 'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数. | ||
| 492 | + 'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数. | ||
| 493 | + 'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数. | ||
| 494 | + 'upInMileage' : {number : true},// 上行进场里程,必须为数字. | ||
| 495 | + 'upOutMileage' : {number : true},// 上行出场里程,必须为数字. | ||
| 496 | + 'downInMileage' : {number : true},// 下行进场里程,必须为数字. | ||
| 497 | + 'downOutMileage' : {number : true}, // 下行出场里程,必须为数字. | ||
| 498 | + | ||
| 499 | + 'strategy' : {required : true} // 生成策略标识 | ||
| 500 | + | ||
| 501 | + // TODO | ||
| 502 | + }, | ||
| 503 | + invalidHandler : function(event, validator) { | ||
| 504 | + paramAlert.show(); | ||
| 505 | + App.scrollTo(paramAlert, -200); | ||
| 506 | + }, | ||
| 507 | + highlight : function(element) { | ||
| 508 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 509 | + }, | ||
| 510 | + unhighlight : function(element) { | ||
| 511 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 512 | + }, | ||
| 513 | + success : function(label) { | ||
| 514 | + label.closest('.form-group').removeClass('has-error'); | ||
| 515 | + }, | ||
| 516 | + submitHandler : function(f) { | ||
| 517 | + // 1、 获取表单内容,并序列化 | ||
| 518 | + var fp = form.serializeJSON(); | ||
| 519 | + | ||
| 520 | + console.log(fp); | ||
| 521 | + | ||
| 522 | + // 2、重新刷新表单数据 | ||
| 523 | + var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 524 | + var key; | ||
| 525 | + for (key in fp) { | ||
| 526 | + if (ganttMap[key]) { | ||
| 527 | + if (ganttMap[key] != fp[key]) { | ||
| 528 | + ganttMap[key] = fp[key]; | ||
| 529 | + } | ||
| 530 | + } else { | ||
| 531 | + ganttMap[key] = fp[key]; | ||
| 532 | + } | ||
| 533 | + } | ||
| 534 | + window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap)); | ||
| 535 | + | ||
| 536 | + // TODO | ||
| 537 | + var pp = getParamObjAndDataMap(); | ||
| 538 | + var paramObj = pp[0]; | ||
| 539 | + var dataMap = pp[1]; | ||
| 540 | + var csMap = getCSMap(paramObj); | ||
| 541 | + // console.log(graph); | ||
| 542 | + | ||
| 543 | + var data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar); | ||
| 544 | + _mainFun.exportDataConfig(data.aInternalLpObj); | ||
| 545 | + | ||
| 546 | + // var data = obj.getDataArray(); | ||
| 547 | + // // 2、 调整路牌对应的班次总数 | ||
| 548 | + // updFormParams(params,data); | ||
| 549 | + // 删除图形. | ||
| 550 | + $('svg.svg-chart').remove(); | ||
| 551 | + // 重新创建图形. | ||
| 552 | + var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data)); | ||
| 553 | + // 根据数据重新渲染图形. | ||
| 554 | + graph.data(data.json); | ||
| 555 | + // 记录早操.并保存历史班次数据 | ||
| 556 | + graph.addHistory(); | ||
| 557 | + // 隐藏错误提示 | ||
| 558 | + paramAlert.hide(); | ||
| 559 | + // 隐藏 reladplus_mobal 弹出层 | ||
| 560 | + $('#paramadd_mobal').modal('hide'); | ||
| 561 | + layer.msg('成功!'); | ||
| 562 | + } | ||
| 563 | + }); | ||
| 564 | + | ||
| 565 | + | ||
| 566 | + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。 | ||
| 567 | + $('#paramadd_mobal').on('show.bs.modal', function () { | ||
| 568 | + // TODO | ||
| 569 | + // 把数据填充到模版中 | ||
| 570 | + // var tbodyHtml = template('countAdd_temp',{list:countDate}); | ||
| 571 | + // // 把渲染好的模版html文本追加到表格中 | ||
| 572 | + // $('#datatable_countadd tbody').html(tbodyHtml); | ||
| 573 | + var htmldata = template('paramAdd_temp', {map : param}); | ||
| 574 | + $('#ptab').html(htmldata); | ||
| 575 | + | ||
| 576 | + // 线路规划类型 | ||
| 577 | + $('#linePlayType_id').val(param.linePlayType); | ||
| 578 | + // 策略类型 | ||
| 579 | + $('#strategy_id').val(param.strategy || "AdjustTripS1"); | ||
| 580 | + // 吃饭地点 | ||
| 581 | + $get('/stationroute/all', { | ||
| 582 | + 'line.id_eq': param.lineName.split('_')[0], | ||
| 583 | + 'destroy_eq': 0, | ||
| 584 | + 'versions_eq': param.lineVersion}, | ||
| 585 | + function(result) { | ||
| 586 | + var opt = []; | ||
| 587 | + opt.push('<option value="">请选择...</option>'); | ||
| 588 | + $.each(result, function(i, d) { | ||
| 589 | + if (d.stationMark == 'B' && d.directions == 0) { | ||
| 590 | + opt.push("<option value='0'>" + d.stationName + "</option>"); | ||
| 591 | + } else if (d.stationMark == 'E' && d.directions == 0) { | ||
| 592 | + opt.push("<option value='1'>" + d.stationName + "</option>"); | ||
| 593 | + } | ||
| 594 | + }); | ||
| 595 | + initTagsinput(opt.join(",")); | ||
| 596 | + | ||
| 597 | + opt.push("<option value='allYes'>起终点站都可以</option>"); | ||
| 598 | + $('#cfdd_id').html(opt.join("")); | ||
| 599 | + $('#cfdd_id').val(param.cfdd); | ||
| 600 | + | ||
| 601 | + } | ||
| 602 | + ); | ||
| 603 | + // 停车场 | ||
| 604 | + $get('/carpark/all',null, function(cd) { | ||
| 605 | + var opt = []; | ||
| 606 | + opt.push('<option value="">请选择...</option><optgroup label="停车场">'); | ||
| 607 | + var $_len = cd.length; | ||
| 608 | + if($_len > 0) { | ||
| 609 | + $.each(cd, function(i, d){ | ||
| 610 | + opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>'); | ||
| 611 | + }); | ||
| 612 | + } | ||
| 613 | + opt.push('</optgroup>'); | ||
| 614 | + $('#carPark_id').html(opt.join(",")).select2(); | ||
| 615 | + $('#carPark_id').select2("val", param.carPark); | ||
| 616 | + }); | ||
| 617 | + | ||
| 618 | + // 上下行首末班日期控件 | ||
| 619 | + $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 620 | + $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 621 | + $('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 622 | + $('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 623 | + | ||
| 624 | + // 早高峰晚高峰日期控件 | ||
| 625 | + $('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 626 | + $('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 627 | + $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 628 | + $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 629 | + | ||
| 630 | + }); | ||
| 631 | + | ||
| 632 | + | ||
| 633 | + | ||
| 634 | + //--------------------- 其他方法 ------------------------// | ||
| 635 | + | ||
| 636 | + function initTagsinput(htmlStr) { | ||
| 637 | + $('#masterStop_id').html(htmlStr); | ||
| 638 | + | ||
| 639 | + var elt = $('#stoptype_tagsinput'); | ||
| 640 | + var value = elt.val(); | ||
| 641 | + var stoptype = value.split("/")[0]; | ||
| 642 | + var masterstop = value.split("/")[1]; | ||
| 643 | + | ||
| 644 | + $('#stopType_id').val(stoptype); | ||
| 645 | + $('#masterStop_id').val(masterstop); | ||
| 646 | + | ||
| 647 | + elt.tagsinput({ | ||
| 648 | + tagClass: function(item) { | ||
| 649 | + return 'label label-danger label-important'; | ||
| 650 | + }, | ||
| 651 | + itemValue: 'value', | ||
| 652 | + itemText: 'text' | ||
| 653 | + }); | ||
| 654 | + | ||
| 655 | + $('#stoptype_tagsinput').on('beforeItemAdd', function(event) { | ||
| 656 | + // TODO:这里可以做一些逻辑判定 | ||
| 657 | + }); | ||
| 658 | + | ||
| 659 | + $('#stoptype_tagsinput_add').on('click', function(){ | ||
| 660 | + var stoptype = $("#stopType_id").val(); | ||
| 661 | + var masterstop = $("#masterStop_id").val(); | ||
| 662 | + var masterstop_text = $("#masterStop_id option:selected").text(); | ||
| 663 | + | ||
| 664 | + if (stoptype && stoptype != "") { | ||
| 665 | + if (stoptype == "0" && masterstop && masterstop != "") { | ||
| 666 | + elt.tagsinput('add', { | ||
| 667 | + "value": stoptype + '/' + masterstop, | ||
| 668 | + "text": "主站停站" + "/" + masterstop_text | ||
| 669 | + }); | ||
| 670 | + } else { | ||
| 671 | + elt.tagsinput('add', { | ||
| 672 | + "value": 1, | ||
| 673 | + "text": "双向停站" | ||
| 674 | + }); | ||
| 675 | + } | ||
| 676 | + } | ||
| 677 | + }); | ||
| 678 | + | ||
| 679 | + if (stoptype && stoptype != "") { | ||
| 680 | + elt.tagsinput('add', { | ||
| 681 | + "value": stoptype + '/' + masterstop, | ||
| 682 | + "text": | ||
| 683 | + $("#stopType_id option:selected").text() + "/" + | ||
| 684 | + $("#masterStop_id option:selected").text() | ||
| 685 | + }); | ||
| 686 | + } | ||
| 687 | + | ||
| 688 | + } | ||
| 689 | + | ||
| 690 | + function getMinDate(d1,d2) { | ||
| 691 | + // 1、定义返回字符串. | ||
| 692 | + var str = ''; | ||
| 693 | + // 2、判断时间大小. | ||
| 694 | + if(strToTime(d1)>strToTime(d2)) | ||
| 695 | + str = d2; | ||
| 696 | + else | ||
| 697 | + str = d1; | ||
| 698 | + // 3、返回最小时间(字符串). | ||
| 699 | + return str; | ||
| 700 | + } | ||
| 701 | + | ||
| 702 | + function strToTime(t) { | ||
| 703 | + var d = new Date(); | ||
| 704 | + if(t) { | ||
| 705 | + var _str = t.split(':'); | ||
| 706 | + d.setHours(parseInt(_str[0])); | ||
| 707 | + d.setMinutes(parseInt(_str[1])); | ||
| 708 | + } | ||
| 709 | + return d; | ||
| 710 | + } | ||
| 711 | + | ||
| 712 | + function getMaxDate(d1,d2) { | ||
| 713 | + // 1、定义返回时间字符串. | ||
| 714 | + var str = ''; | ||
| 715 | + // 2、判断时间大小. | ||
| 716 | + if(strToTime(d1)>strToTime(d2)) | ||
| 717 | + str = d1; | ||
| 718 | + else | ||
| 719 | + str = d2; | ||
| 720 | + // 3、返回一个最大时间(字符串). | ||
| 721 | + return str; | ||
| 722 | + } | ||
| 723 | + | ||
| 724 | + function getEndDate(date) { | ||
| 725 | + var lastEndDate = Date.now(); | ||
| 726 | + if (date) { | ||
| 727 | + var str = date.replace(/-/g,"/"); | ||
| 728 | + lastEndDate = new Date(str); | ||
| 729 | + } | ||
| 730 | + // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间) | ||
| 731 | + return lastEndDate; | ||
| 732 | + } | ||
| 733 | + | ||
| 734 | + function formatPairing(v1,v2) { | ||
| 735 | + v1 = v1 == '' ? 0 : parseInt(v1); | ||
| 736 | + v2 = v2 == ''? 0 : parseInt(v2) ; | ||
| 737 | + return [v1,v2]; | ||
| 738 | + } | ||
| 739 | + | ||
| 740 | + function qzdz(zd1,zd2) { | ||
| 741 | + return [zd1,zd2]; | ||
| 742 | + } | ||
| 743 | + | ||
| 744 | + function formatksjssj(gp) { | ||
| 745 | + return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}]; | ||
| 746 | + } | ||
| 747 | + | ||
| 748 | + function getsd(st,ed) { | ||
| 749 | + return [{'st':st,'ed':ed}]; | ||
| 750 | + } | ||
| 751 | + | ||
| 752 | + function getDateTime(time) { | ||
| 753 | + var dateTime = new Date(); | ||
| 754 | + var timeArr; | ||
| 755 | + if(time !=null && time !='' && typeof(time) !='undefined') { | ||
| 756 | + timeArr = time.split(':'); | ||
| 757 | + dateTime.setHours(parseInt(timeArr[0])); | ||
| 758 | + dateTime.setMinutes(parseInt(timeArr[1])); | ||
| 759 | + } | ||
| 760 | + return dateTime; | ||
| 761 | + } | ||
| 762 | + | ||
| 763 | + function getYAxisCarArray(len) { | ||
| 764 | + var array = new Array(); | ||
| 765 | + if(len>0) { | ||
| 766 | + for(var y = 0; y<len; y++) { | ||
| 767 | + array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象 | ||
| 768 | + }; | ||
| 769 | + } | ||
| 770 | + return array; | ||
| 771 | + } | ||
| 772 | + | ||
| 773 | + function getylp(arr) { | ||
| 774 | + var ra = new Array(),name = new Array(); | ||
| 775 | + for(var i = 0 ; i<arr.length;i++) { | ||
| 776 | + ra.push(arr[i].lpNo); | ||
| 777 | + name.push(arr[i].lpName); | ||
| 778 | + } | ||
| 779 | + return {'lpNoA':ra,'lpNameA':name,}; | ||
| 780 | + } | ||
| 781 | + | ||
| 782 | + function getParamObjAndDataMap() { | ||
| 783 | + var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 784 | + // seMap | ||
| 785 | + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 786 | + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 787 | + // dirA | ||
| 788 | + var dirA = ['relationshipGraph-up', 'relationshipGraph-down']; | ||
| 789 | + // bcTypeArr | ||
| 790 | + var bcTypeArr = { | ||
| 791 | + 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc', | ||
| 792 | + 'major': 'major', 'venting': 'venting', 'region': 'region' | ||
| 793 | + }; | ||
| 794 | + // seDate | ||
| 795 | + var newDate = new Date(); | ||
| 796 | + var kssj = d3.time.hour.offset(getEndDate( | ||
| 797 | + newDate.getFullYear()+ "-" + | ||
| 798 | + (newDate.getMonth()+1) + "-" + | ||
| 799 | + newDate.getDate() + ' ' + | ||
| 800 | + seMap.s.split(':')[0] + ':00'),-1); | ||
| 801 | + | ||
| 802 | + var year = '' , month = '',dt = ''; | ||
| 803 | + if(newDate.getDate()+1>31) | ||
| 804 | + dt = '01'; | ||
| 805 | + else | ||
| 806 | + dt = newDate.getDate()+1; | ||
| 807 | + if(newDate.getMonth()+1>12) | ||
| 808 | + month = '01'; | ||
| 809 | + else if(newDate.getDate()+1>31) | ||
| 810 | + month = newDate.getMonth()+2; | ||
| 811 | + else | ||
| 812 | + month = newDate.getMonth()+1; | ||
| 813 | + if(newDate.getMonth()+1>12) | ||
| 814 | + year = newDate.getFullYear()+1; | ||
| 815 | + else | ||
| 816 | + year = newDate.getFullYear(); | ||
| 817 | + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 818 | + seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 819 | + | ||
| 820 | + // dataMap | ||
| 821 | + var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下] | ||
| 822 | + 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下] | ||
| 823 | + 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下] | ||
| 824 | + 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下] | ||
| 825 | + 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下] | ||
| 826 | + 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime, | ||
| 827 | + map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下] | ||
| 828 | + 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime, | ||
| 829 | + map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下] | ||
| 830 | + 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下] | ||
| 831 | + 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下] | ||
| 832 | + 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下] | ||
| 833 | + 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚] | ||
| 834 | + 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间] | ||
| 835 | + 'zgfsjd' : getsd(getDateTime(map.earlyStartTime), | ||
| 836 | + getDateTime(map.earlyEndTime)), // 早高峰时间段 | ||
| 837 | + 'wgfsjd' : getsd(getDateTime(map.lateStartTime), | ||
| 838 | + getDateTime(map.lateEndTime)),// 晚高峰时间段 | ||
| 839 | + 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime), | ||
| 840 | + getDateTime(map.lateStartTime)),//高峰之间时间段. | ||
| 841 | + 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime), | ||
| 842 | + getDateTime(seMap.e)),// 晚高峰之后时间段 | ||
| 843 | + 'zgfzqsjd': getsd(getDateTime(seMap.s), | ||
| 844 | + getDateTime(map.earlyStartTime)),//早高峰之前时间段. | ||
| 845 | + 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下] | ||
| 846 | + 'bcTypeArr' : bcTypeArr,// 班次类型 | ||
| 847 | + 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间. | ||
| 848 | + // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间. | ||
| 849 | + // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间. | ||
| 850 | + // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间. | ||
| 851 | + 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间. | ||
| 852 | + 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间. | ||
| 853 | + 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间. | ||
| 854 | + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙. | ||
| 855 | + 'map' : map, | ||
| 856 | + 'zzsj':map.zzsj,// 周转时间. | ||
| 857 | + }; | ||
| 858 | + | ||
| 859 | + var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap); | ||
| 860 | + map.clzs = _paramObj.calcuClzx(); | ||
| 861 | + return [_paramObj, dataMap]; | ||
| 862 | + | ||
| 863 | + } | ||
| 864 | + | ||
| 865 | + function getCSMap(parmObj) { | ||
| 866 | + var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 867 | + return {'gattA':null, | ||
| 868 | + 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) , | ||
| 869 | + 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()), | ||
| 870 | + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)}, | ||
| 871 | + 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))}; | ||
| 872 | + } | ||
| 873 | + | ||
| 874 | + function getGraphArgus(CSMap, dataMap, data) { | ||
| 875 | + // TODO | ||
| 876 | + var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 877 | + var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 878 | + | ||
| 879 | + // seMap | ||
| 880 | + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 881 | + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 882 | + | ||
| 883 | + // seDate | ||
| 884 | + var newDate = new Date(); | ||
| 885 | + var kssj = d3.time.hour.offset(getEndDate( | ||
| 886 | + newDate.getFullYear()+ "-" + | ||
| 887 | + (newDate.getMonth()+1) + "-" + | ||
| 888 | + newDate.getDate() + ' ' + | ||
| 889 | + seMap.s.split(':')[0] + ':00'),-1); | ||
| 890 | + | ||
| 891 | + var year = '' , month = '',dt = ''; | ||
| 892 | + if(newDate.getDate()+1>31) | ||
| 893 | + dt = '01'; | ||
| 894 | + else | ||
| 895 | + dt = newDate.getDate()+1; | ||
| 896 | + if(newDate.getMonth()+1>12) | ||
| 897 | + month = '01'; | ||
| 898 | + else if(newDate.getDate()+1>31) | ||
| 899 | + month = newDate.getMonth()+2; | ||
| 900 | + else | ||
| 901 | + month = newDate.getMonth()+1; | ||
| 902 | + if(newDate.getMonth()+1>12) | ||
| 903 | + year = newDate.getFullYear()+1; | ||
| 904 | + else | ||
| 905 | + year = newDate.getFullYear(); | ||
| 906 | + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 907 | + seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 908 | + | ||
| 909 | + | ||
| 910 | + var bs = sxsj > 40 ? 4 : 2; | ||
| 911 | + var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs; | ||
| 912 | + var VALUEKEYNAME = 'Worldwide Gross' , | ||
| 913 | + DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240, | ||
| 914 | + MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60, | ||
| 915 | + STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true; | ||
| 916 | + var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ; | ||
| 917 | + // 计算出相差天数 | ||
| 918 | + var days=Math.floor(dx_time/(24*3600*1000)); | ||
| 919 | + // 计算出小时数 | ||
| 920 | + var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数 | ||
| 921 | + var hours=Math.floor(leave1/(3600*1000)); | ||
| 922 | + DXHOURS = days*24+hours; | ||
| 923 | + WIDTH = DXHOURS*MINUTE*MULTIPLE; | ||
| 924 | + // debugger; | ||
| 925 | + var lpsplitA = getylp(CSMap.maxCar); | ||
| 926 | + | ||
| 927 | + var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 928 | + var xxsj = parseInt(map.downTravelTime);// 下行时间. | ||
| 929 | + var stopAraay = [{ | ||
| 930 | + 'sxsj':sxsj,// 上行时间. | ||
| 931 | + 'xxsj':xxsj,// 下行时间. | ||
| 932 | + 'zzsj':map.zzsj,// 周转时间. | ||
| 933 | + 'wcsj':parseInt(map.workeLunch),// 午餐时间. | ||
| 934 | + 'wcsj':parseInt(map.workeDinner),// 晚餐时间. | ||
| 935 | + 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间. | ||
| 936 | + 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间. | ||
| 937 | + 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间. | ||
| 938 | + 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间. | ||
| 939 | + 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间. | ||
| 940 | + 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间. | ||
| 941 | + 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间. | ||
| 942 | + 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间. | ||
| 943 | + 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程. | ||
| 944 | + 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程. | ||
| 945 | + 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程. | ||
| 946 | + 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程. | ||
| 947 | + 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间. | ||
| 948 | + }]; | ||
| 949 | + | ||
| 950 | + var args = { | ||
| 951 | + 'valueKeyName': VALUEKEYNAME, | ||
| 952 | + 'hours' : DXHOURS, | ||
| 953 | + 'dxHours' : 24 - DXHOURS, | ||
| 954 | + 'multiple': MULTIPLE, | ||
| 955 | + 'width':WIDTH, | ||
| 956 | + 'widtMargin':MARGINLEFT, | ||
| 957 | + 'height':HEIGHT, | ||
| 958 | + 'heightMargin':MARGINBOTTOM, | ||
| 959 | + 'offsetX':OFFSETX, | ||
| 960 | + 'offsetY':OFFSETY, | ||
| 961 | + 'downDy':OFFSETDOWNY, | ||
| 962 | + 'upDy':OFFSETUPY, | ||
| 963 | + 'timeDomainStart' :STARTDATETIME, | ||
| 964 | + 'timeDomainEnd' : ENDDATETIME, | ||
| 965 | + 'startStr':'' + STARTDATETIME, | ||
| 966 | + 'endStr': '' +ENDDATETIME, | ||
| 967 | + 'taskTypes': TASKTYPES, | ||
| 968 | + 'lpNoA':lpsplitA.lpNoA, | ||
| 969 | + 'lpNameA':lpsplitA.lpNameA, | ||
| 970 | + 'tickFormat': TICKFORMAT, | ||
| 971 | + 'stopAraay' : stopAraay, | ||
| 972 | + 'dataMap':dataMap, | ||
| 973 | + 'showTooltips': SHOWTOOLTIPS, | ||
| 974 | + 'bxrcgs':data.bxrcgs | ||
| 975 | + }; | ||
| 976 | + return args; | ||
| 977 | + } | ||
| 978 | + | ||
| 979 | + | ||
| 980 | + | ||
| 981 | + }); | ||
| 982 | + | ||
| 983 | </script> | 983 | </script> |
| 984 | \ No newline at end of file | 984 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/statisticsDaily.html
| @@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
| 74 | </tr> | 74 | </tr> |
| 75 | <tr> | 75 | <tr> |
| 76 | <td rowspan="3"><span >路线名</span></td> | 76 | <td rowspan="3"><span >路线名</span></td> |
| 77 | - <td colspan="20">全日营运里程(公里)</td> | 77 | + <td colspan="20">全日营运里程(公里)(注:实际营运里程、实际空驶里程、实际总里程均已包含临加里程)</td> |
| 78 | <td colspan="15">全日营运班次</td> | 78 | <td colspan="15">全日营运班次</td> |
| 79 | <td colspan="9">大间隔情况</td> | 79 | <td colspan="9">大间隔情况</td> |
| 80 | </tr> | 80 | </tr> |
src/main/resources/static/pages/forms/statement/statisticsDailyCalc2.html
| @@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
| 74 | </tr> | 74 | </tr> |
| 75 | <tr> | 75 | <tr> |
| 76 | <td rowspan="3"><span >路线名</span></td> | 76 | <td rowspan="3"><span >路线名</span></td> |
| 77 | - <td colspan="20">全日营运里程(公里)</td> | 77 | + <td colspan="20">全日营运里程(公里)(注:实际营运里程、实际空驶里程、实际总里程均已包含临加里程)</td> |
| 78 | <td colspan="15">全日营运班次</td> | 78 | <td colspan="15">全日营运班次</td> |
| 79 | <td colspan="9">大间隔情况</td> | 79 | <td colspan="9">大间隔情况</td> |
| 80 | </tr> | 80 | </tr> |
src/main/resources/static/pages/permission/authorize_all/user_auth.html
| @@ -149,9 +149,9 @@ | @@ -149,9 +149,9 @@ | ||
| 149 | var fgs_name_mapp={ | 149 | var fgs_name_mapp={ |
| 150 | '55_3': '上南公司(六分公司)', '55_1': '上南公司(二分公司)', '55_2': '上南公司(三分公司)', '55_4': '上南公司(一分公司)', '55_5': '上南公司(培训部)', | 150 | '55_3': '上南公司(六分公司)', '55_1': '上南公司(二分公司)', '55_2': '上南公司(三分公司)', '55_4': '上南公司(一分公司)', '55_5': '上南公司(培训部)', |
| 151 | '22_2': '金高公司(二分公司)', '22_1': '金高公司(四分公司)', '22_3': '金高公司(三分公司)', '22_5': '金高公司(一分公司)', | 151 | '22_2': '金高公司(二分公司)', '22_1': '金高公司(四分公司)', '22_3': '金高公司(三分公司)', '22_5': '金高公司(一分公司)', |
| 152 | - '26_3': '南汇公司(三分公司)', '26_2': '南汇公司(南汇二分)', '26_1': '南汇公司(南汇一分)', '26_4': '南汇公司(南汇维修公司)', '26_5': '南汇公司(南汇公司)', '26_6': '南汇公司(航头枢纽站)', | 152 | + '26_3': '南汇公司(三分公司)', '26_2': '南汇公司(南汇二分)', '26_1': '南汇公司(南汇一分)', '26_4': '南汇公司(南汇维修公司)', '26_5': '南汇公司(南汇公司)', '26_6': '南汇公司(南汇六分)', |
| 153 | '05_5': '杨高公司(杨高分公司)', '05_6': '杨高公司(周浦分公司)', '05_3': '杨高公司(芦潮港分公司)', '05_1': '杨高公司(川沙分公司)', '05_2': '杨高公司(金桥分公司)', | 153 | '05_5': '杨高公司(杨高分公司)', '05_6': '杨高公司(周浦分公司)', '05_3': '杨高公司(芦潮港分公司)', '05_1': '杨高公司(川沙分公司)', '05_2': '杨高公司(金桥分公司)', |
| 154 | - '77_78': '闵行公司', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队' | 154 | + '77_78': '闵行公司','300_301': '金球公交', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队' |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | var defauleConfig; | 157 | var defauleConfig; |
src/main/resources/static/pages/report/countMileage/countLine/countLineMileage.html
| @@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
| 28 | 28 | ||
| 29 | <div class="page-head"> | 29 | <div class="page-head"> |
| 30 | <div class="page-title"> | 30 | <div class="page-title"> |
| 31 | - <h1>线路公里统计表(审计)</h1> | 31 | + <h1>线路公里统计表(审计)(按年、月、季度查询请点击<a href="/pages/calc/countLineMileage.html" target="_blank">统计查询</a>)</h1> |
| 32 | </div> | 32 | </div> |
| 33 | </div> | 33 | </div> |
| 34 | 34 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
| @@ -178,6 +178,7 @@ | @@ -178,6 +178,7 @@ | ||
| 178 | <input type="text" class="form-control" | 178 | <input type="text" class="form-control" |
| 179 | name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" | 179 | name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" |
| 180 | required placeholder="请输入设备终端号" | 180 | required placeholder="请输入设备终端号" |
| 181 | + readonly | ||
| 181 | remote-Validation | 182 | remote-Validation |
| 182 | remotevtype="cars_sbbh" | 183 | remotevtype="cars_sbbh" |
| 183 | remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}" | 184 | remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}" |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
| @@ -293,6 +293,14 @@ angular.module('ScheduleApp').controller( | @@ -293,6 +293,14 @@ angular.module('ScheduleApp').controller( | ||
| 293 | // 提交方法 | 293 | // 提交方法 |
| 294 | self.submit = function() { | 294 | self.submit = function() { |
| 295 | console.log(self.busInfoForSave); | 295 | console.log(self.busInfoForSave); |
| 296 | + | ||
| 297 | + // 报废的车辆,修改原来的车辆终端号 | ||
| 298 | + if (self.busInfoForSave.scrapState == true) { | ||
| 299 | + self.busInfoForSave.equipmentCode = "BF-" + self.busInfoForSave.equipmentCode; | ||
| 300 | + self.busInfoForSave.scrapCode = "BF-" + self.busInfoForSave.equipmentCode; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + | ||
| 296 | // 保存或者更新 | 304 | // 保存或者更新 |
| 297 | self.busInfoForSave.$save(function() { | 305 | self.busInfoForSave.$save(function() { |
| 298 | DataStore.refreshData("cl"); | 306 | DataStore.refreshData("cl"); |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| @@ -770,7 +770,7 @@ var gb_schedule_table = (function () { | @@ -770,7 +770,7 @@ var gb_schedule_table = (function () { | ||
| 770 | */ | 770 | */ |
| 771 | var showLateBadge = function (lineCode, id, minute) { | 771 | var showLateBadge = function (lineCode, id, minute) { |
| 772 | var dfCell = cancelLateBadge(lineCode, id); | 772 | var dfCell = cancelLateBadge(lineCode, id); |
| 773 | - $(dfCell).append('<span class="late-badge">?+5</span>'); | 773 | + $(dfCell).append('<span class="late-badge">?+'+minute+'</span>'); |
| 774 | }; | 774 | }; |
| 775 | 775 | ||
| 776 | /** | 776 | /** |
src/main/resources/static/real_control_v2/js/utils/svg_data_convert_bf.js deleted
100644 → 0
| 1 | -var gb_svg_data_convert = (function () { | ||
| 2 | - | ||
| 3 | - /** | ||
| 4 | - * 合并上下行路由 | ||
| 5 | - * type 0 上行 1 下行 2 同名合并 3 异名合并 | ||
| 6 | - * | ||
| 7 | - * enableAttr: 是否启用配置信息 | ||
| 8 | - */ | ||
| 9 | - function mergeRoute(routes, enableAttr, lineCode, loopLine) { | ||
| 10 | - console.log('routesroutes', routes); | ||
| 11 | - //按上下行拆分 | ||
| 12 | - routes = gb_common.groupBy(routes, 'directions'); | ||
| 13 | - var up = routes[0], | ||
| 14 | - down = routes[1]; | ||
| 15 | - //排序 | ||
| 16 | - up.sort(upSort); | ||
| 17 | - down.sort(downSort); | ||
| 18 | - var data = []; | ||
| 19 | - | ||
| 20 | - //根据配置处理一下数据 | ||
| 21 | - if (enableAttr) { | ||
| 22 | - var svgAttr = gb_data_basic.getSvgAttr(lineCode); | ||
| 23 | - if (svgAttr) { | ||
| 24 | - up = filterByAttrs(svgAttr, up); | ||
| 25 | - down = filterByAttrs(svgAttr, down); | ||
| 26 | - } | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - //环线 只画上行 | ||
| 30 | - if(loopLine){ | ||
| 31 | - for (var j = 0; j < up.length; j++) { | ||
| 32 | - var upS = nvl_get(up, j); | ||
| 33 | - op = { | ||
| 34 | - name: [upS.stationName], | ||
| 35 | - id: [get_station_code(upS)], | ||
| 36 | - type: 0, | ||
| 37 | - stationMark: upS.stationMark | ||
| 38 | - }; | ||
| 39 | - data.push(op); | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - //上下行GPS容器 | ||
| 43 | - $.each(data, function () { | ||
| 44 | - this.gpsUps = []; | ||
| 45 | - this.gpsDowns = []; | ||
| 46 | - }); | ||
| 47 | - | ||
| 48 | - return data; | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - //同名站点合并 | ||
| 53 | - for (var j = 0; j < up.length; j++) { | ||
| 54 | - var upS = nvl_get(up, j), | ||
| 55 | - downS = nvl_get(down, j), | ||
| 56 | - op = { | ||
| 57 | - name: [upS.stationName], | ||
| 58 | - id: [get_station_code(upS), get_station_code(downS)], | ||
| 59 | - type: 2, | ||
| 60 | - stationMark: upS.stationMark//站点标记 | ||
| 61 | - }; | ||
| 62 | - | ||
| 63 | - if (upS.stationName != downS.stationName) { | ||
| 64 | - //下行站点在上行路由中是否存在 | ||
| 65 | - var dIndex = station_indexof(down, upS, j); | ||
| 66 | - //上行站点在下行路由中是否存在 | ||
| 67 | - var uIndex = station_indexof(up, downS, j); | ||
| 68 | - if (dIndex == -1 || dIndex - j > 4) { | ||
| 69 | - if (uIndex == -1 && dIndex - j < 4) { | ||
| 70 | - op.type = 3; | ||
| 71 | - op.name = [upS.stationName, downS.stationName]; | ||
| 72 | - } | ||
| 73 | - else { | ||
| 74 | - op.type = 0; | ||
| 75 | - op.id = [get_station_code(upS), -1]; | ||
| 76 | - //占位 | ||
| 77 | - down.splice(j, 0, {}); | ||
| 78 | - } | ||
| 79 | - } else { | ||
| 80 | - for (var t = j; t < dIndex - 1; t++) { | ||
| 81 | - var temp = down[t]; | ||
| 82 | - data.push({ | ||
| 83 | - name: [temp.stationName], | ||
| 84 | - type: 1, | ||
| 85 | - id: [get_station_code(temp)] | ||
| 86 | - }); | ||
| 87 | - } | ||
| 88 | - //delete | ||
| 89 | - down.splice(j, dIndex - 1 - j); | ||
| 90 | - j--; | ||
| 91 | - continue; | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - data.push(op); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - //将上下行挨着的异名站点合并 | ||
| 98 | - var len = data.length - 1, | ||
| 99 | - first, sec; | ||
| 100 | - for (var s = 0; s < len; s++) { | ||
| 101 | - first = data[s]; | ||
| 102 | - sec = data[s + 1]; | ||
| 103 | - | ||
| 104 | - if (first.type == 0 && | ||
| 105 | - sec.type == 1) { | ||
| 106 | - data.splice(s, 2, { | ||
| 107 | - name: [first['name'][0], sec['name'][0]], | ||
| 108 | - type: 3, | ||
| 109 | - id: [first['id'][0], sec['id'][0]] | ||
| 110 | - }); | ||
| 111 | - len--; | ||
| 112 | - } else if (first.type == 1 && sec.type == 0) { | ||
| 113 | - data.splice(s, 2, { | ||
| 114 | - name: [first['name'][0], sec['name'][0]], | ||
| 115 | - type: 3, | ||
| 116 | - id: [first['id'][0], sec['id'][0]] | ||
| 117 | - }); | ||
| 118 | - len--; | ||
| 119 | - } | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - //上下行GPS容器 | ||
| 123 | - $.each(data, function () { | ||
| 124 | - this.gpsUps = []; | ||
| 125 | - this.gpsDowns = []; | ||
| 126 | - }); | ||
| 127 | - return data; | ||
| 128 | - }; | ||
| 129 | - | ||
| 130 | - var filterByAttrs = function (svgAttr, routes) { | ||
| 131 | - var hideStations = svgAttr.hideStations ? svgAttr.hideStations : []; | ||
| 132 | - var nicknames = svgAttr.nicknames ? svgAttr.nicknames : {}; | ||
| 133 | - var stationCode; | ||
| 134 | - $.each(routes, function (i) { | ||
| 135 | - stationCode = this.stationCode | ||
| 136 | - //要隐藏的站点 | ||
| 137 | - $.each(hideStations, function (j, hide) { | ||
| 138 | - if (stationCode == hide) | ||
| 139 | - delete routes[i]; | ||
| 140 | - }); | ||
| 141 | - | ||
| 142 | - //要重命名的站点 | ||
| 143 | - if (nicknames[this.stationName]) { | ||
| 144 | - this.stationName = nicknames[this.stationName]; | ||
| 145 | - } | ||
| 146 | - }); | ||
| 147 | - | ||
| 148 | - var newRoutes = []; | ||
| 149 | - $.each(routes, function (i, station) { | ||
| 150 | - if(station) | ||
| 151 | - newRoutes.push(station); | ||
| 152 | - }); | ||
| 153 | - | ||
| 154 | - return newRoutes; | ||
| 155 | - }; | ||
| 156 | - | ||
| 157 | - var upSort = function (a, b) { | ||
| 158 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 159 | - }; | ||
| 160 | - | ||
| 161 | - var downSort = function (a, b) { | ||
| 162 | - return b.stationRouteCode - a.stationRouteCode; | ||
| 163 | - }; | ||
| 164 | - | ||
| 165 | - var station_indexof = function (array, station, start) { | ||
| 166 | - var res = -1; | ||
| 167 | - for (var i = start, obj; obj = array[i++];) { | ||
| 168 | - if (obj.stationName == station.stationName) { | ||
| 169 | - res = i; | ||
| 170 | - break; | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - return res; | ||
| 174 | - }; | ||
| 175 | - | ||
| 176 | - var get_station_code = function (station) { | ||
| 177 | - return station.stationCode + '_' + station.directions; | ||
| 178 | - }; | ||
| 179 | - | ||
| 180 | - var nvl_get = function (list, index) { | ||
| 181 | - return list[index] == null ? {} : list[index]; | ||
| 182 | - }; | ||
| 183 | - | ||
| 184 | - var groupByStationAndUpdown = function (data) { | ||
| 185 | - //gb_common.groupBy(data, 'stopNo') | ||
| 186 | - var rs = {}, | ||
| 187 | - key; | ||
| 188 | - $.each(data, function () { | ||
| 189 | - key = this['stopNo'] + '_' + this['upDown']; | ||
| 190 | - if (!rs[key]) | ||
| 191 | - rs[key] = []; | ||
| 192 | - | ||
| 193 | - rs[key].push(this); | ||
| 194 | - }); | ||
| 195 | - | ||
| 196 | - return rs; | ||
| 197 | - }; | ||
| 198 | - return {mergeRoute: mergeRoute, groupByStationAndUpdown: groupByStationAndUpdown}; | ||
| 199 | -})(); |