Commit 01e7c277c6ae285ff2f25405e925d121d75633c4
Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong
Showing
42 changed files
with
1983 additions
and
1179 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/calc/CalcWaybillController.java
| 1 | package com.bsth.controller.calc; | 1 | package com.bsth.controller.calc; |
| 2 | 2 | ||
| 3 | -import java.util.HashMap; | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Map; | ||
| 6 | - | ||
| 7 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 8 | import com.bsth.controller.BaseController; | 4 | import com.bsth.controller.BaseController; |
| 9 | import com.bsth.entity.calc.CalcStatistics; | 5 | import com.bsth.entity.calc.CalcStatistics; |
| 10 | import com.bsth.entity.calc.CalcWaybill; | 6 | import com.bsth.entity.calc.CalcWaybill; |
| 11 | import com.bsth.service.calc.CalcWaybillService; | 7 | import com.bsth.service.calc.CalcWaybillService; |
| 12 | - | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | import org.springframework.web.bind.annotation.RequestParam; | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 16 | import org.springframework.web.bind.annotation.RestController; | 11 | import org.springframework.web.bind.annotation.RestController; |
| 17 | 12 | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 18 | /** | 17 | /** |
| 19 | * Created by 17/10/23. | 18 | * Created by 17/10/23. |
| 20 | */ | 19 | */ |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -635,6 +635,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -635,6 +635,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | int code = dayOfSchedule.reloadSch(lineCode); | 637 | int code = dayOfSchedule.reloadSch(lineCode); |
| 638 | + | ||
| 639 | + //重新按公司编码索引数据 | ||
| 640 | + dayOfSchedule.groupByGsbm(); | ||
| 638 | rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); | 641 | rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); |
| 639 | return rs; | 642 | return rs; |
| 640 | } | 643 | } |
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; |
| @@ -103,7 +105,7 @@ public class ServiceDataInterface { | @@ -103,7 +105,7 @@ public class ServiceDataInterface { | ||
| 103 | if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) | 105 | if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) |
| 104 | return null; | 106 | return null; |
| 105 | 107 | ||
| 106 | - List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>(); | 108 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findByGsbm(companyId)), rs = new ArrayList<>(); |
| 107 | for (ScheduleRealInfo sch : all) { | 109 | for (ScheduleRealInfo sch : all) { |
| 108 | if (sch.getGsBm() != null | 110 | if (sch.getGsBm() != null |
| 109 | && sch.getGsBm().equals(companyId) | 111 | && sch.getGsBm().equals(companyId) |
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| @@ -132,8 +132,6 @@ public class InStationProcess { | @@ -132,8 +132,6 @@ public class InStationProcess { | ||
| 132 | 132 | ||
| 133 | sch.setZdsjActualAll(rsT); | 133 | sch.setZdsjActualAll(rsT); |
| 134 | sch.setSiginCompate(2); | 134 | sch.setSiginCompate(2); |
| 135 | - //通知误点停靠程序,有车辆到站 | ||
| 136 | - LateAdjustHandle.carArrive(gps); | ||
| 137 | 135 | ||
| 138 | //持久化 | 136 | //持久化 |
| 139 | dayOfSchedule.save(sch); | 137 | dayOfSchedule.save(sch); |
| @@ -147,6 +145,10 @@ public class InStationProcess { | @@ -147,6 +145,10 @@ public class InStationProcess { | ||
| 147 | else | 145 | else |
| 148 | dayOfSchedule.removeExecPlan(nbbm); | 146 | dayOfSchedule.removeExecPlan(nbbm); |
| 149 | 147 | ||
| 148 | + //通知误点停靠程序,有车辆到站 | ||
| 149 | + LateAdjustHandle.carArrive(gps, next); | ||
| 150 | + //LateAdjustHandle.carArrive(gps); | ||
| 151 | + | ||
| 150 | //路牌的下一个班次,页面显示起点实际到达时间 | 152 | //路牌的下一个班次,页面显示起点实际到达时间 |
| 151 | ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); | 153 | ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); |
| 152 | if (lpNext != null) { | 154 | if (lpNext != null) { |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -56,13 +56,16 @@ public class DayOfSchedule { | @@ -56,13 +56,16 @@ public class DayOfSchedule { | ||
| 56 | //按线路分组的 “原始计划” 排班数据 | 56 | //按线路分组的 “原始计划” 排班数据 |
| 57 | public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; | 57 | public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; |
| 58 | 58 | ||
| 59 | - // 按车辆分组的班次数据 | 59 | + // 按车辆索引的班次数据 |
| 60 | private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; | 60 | private static ListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; |
| 61 | 61 | ||
| 62 | - //按线路分组计划用车 | 62 | + // 按营运公司索引的班次数据 |
| 63 | + private static ListMultimap<String, ScheduleRealInfo> gsBmScheduleMap; | ||
| 64 | + | ||
| 65 | + //按线路索引计划用车 | ||
| 63 | private static HashMultimap<String, String> lineNbbmsMap; | 66 | private static HashMultimap<String, String> lineNbbmsMap; |
| 64 | 67 | ||
| 65 | - //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list | 68 | + //按路牌索引班次数据 线路编码_路牌名称 ——> 班次list |
| 66 | private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; | 69 | private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; |
| 67 | 70 | ||
| 68 | // 班次主键映射 | 71 | // 班次主键映射 |
| @@ -108,6 +111,7 @@ public class DayOfSchedule { | @@ -108,6 +111,7 @@ public class DayOfSchedule { | ||
| 108 | nbbmScheduleMap = ArrayListMultimap.create(); | 111 | nbbmScheduleMap = ArrayListMultimap.create(); |
| 109 | nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap); | 112 | nbbmScheduleMap = Multimaps.synchronizedListMultimap(nbbmScheduleMap); |
| 110 | 113 | ||
| 114 | + gsBmScheduleMap = ArrayListMultimap.create(); | ||
| 111 | lpScheduleMap = ArrayListMultimap.create(); | 115 | lpScheduleMap = ArrayListMultimap.create(); |
| 112 | lineNbbmsMap = HashMultimap.create(); | 116 | lineNbbmsMap = HashMultimap.create(); |
| 113 | 117 | ||
| @@ -629,7 +633,7 @@ public class DayOfSchedule { | @@ -629,7 +633,7 @@ public class DayOfSchedule { | ||
| 629 | continue; | 633 | continue; |
| 630 | 634 | ||
| 631 | //出站既出场,忽略出场班次 | 635 | //出站既出场,忽略出场班次 |
| 632 | - if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0)) | 636 | + if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp) |
| 633 | && (!limitPark || parks.contains(temp.getQdzCode()))) | 637 | && (!limitPark || parks.contains(temp.getQdzCode()))) |
| 634 | continue; | 638 | continue; |
| 635 | 639 | ||
| @@ -641,6 +645,10 @@ public class DayOfSchedule { | @@ -641,6 +645,10 @@ public class DayOfSchedule { | ||
| 641 | return next; | 645 | return next; |
| 642 | } | 646 | } |
| 643 | 647 | ||
| 648 | + private boolean isEmptyMileage(ScheduleRealInfo sch) { | ||
| 649 | + return sch.getBcsj() == 0 || sch.getJhlcOrig().intValue() == 0; | ||
| 650 | + } | ||
| 651 | + | ||
| 644 | /** | 652 | /** |
| 645 | * 下一个班次 | 653 | * 下一个班次 |
| 646 | * | 654 | * |
| @@ -688,7 +696,7 @@ public class DayOfSchedule { | @@ -688,7 +696,7 @@ public class DayOfSchedule { | ||
| 688 | } | 696 | } |
| 689 | 697 | ||
| 690 | //出站既出场,忽略出场班次 | 698 | //出站既出场,忽略出场班次 |
| 691 | - if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0)) | 699 | + if (outConfig == 2 && temp.getBcType().equals("out") && isEmptyMileage(temp) |
| 692 | && (!limitPark || parks.contains(temp.getQdzCode()))) | 700 | && (!limitPark || parks.contains(temp.getQdzCode()))) |
| 693 | continue; | 701 | continue; |
| 694 | 702 | ||
| @@ -1131,4 +1139,26 @@ public class DayOfSchedule { | @@ -1131,4 +1139,26 @@ public class DayOfSchedule { | ||
| 1131 | public String sizeString(){ | 1139 | public String sizeString(){ |
| 1132 | return id2SchedulMap.size() + "/" + nbbmScheduleMap.size(); | 1140 | return id2SchedulMap.size() + "/" + nbbmScheduleMap.size(); |
| 1133 | } | 1141 | } |
| 1142 | + | ||
| 1143 | + | ||
| 1144 | + /** | ||
| 1145 | + * 按公司编码分组数据 | ||
| 1146 | + */ | ||
| 1147 | + public void groupByGsbm(){ | ||
| 1148 | + Collection<ScheduleRealInfo> all = findAll(); | ||
| 1149 | + ListMultimap<String, ScheduleRealInfo> gsBmMaps = ArrayListMultimap.create(); | ||
| 1150 | + | ||
| 1151 | + for(ScheduleRealInfo sch : all){ | ||
| 1152 | + gsBmMaps.put(sch.getGsBm(), sch); | ||
| 1153 | + } | ||
| 1154 | + | ||
| 1155 | + if(gsBmMaps.size() > 0){ | ||
| 1156 | + gsBmScheduleMap = null; | ||
| 1157 | + gsBmScheduleMap = gsBmMaps; | ||
| 1158 | + } | ||
| 1159 | + } | ||
| 1160 | + | ||
| 1161 | + public Collection<ScheduleRealInfo> findByGsbm(String gsbm){ | ||
| 1162 | + return gsBmScheduleMap.get(gsbm); | ||
| 1163 | + } | ||
| 1134 | } | 1164 | } |
| 1135 | \ No newline at end of file | 1165 | \ No newline at end of file |
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); | 60 | + //班次压入 |
| 61 | + if (!lateSchMap.containsKey(sch.getId())) { | ||
| 62 | + logger.info("29【应发未到 班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | ||
| 69 | 63 | ||
| 70 | - //班次被压入 | ||
| 71 | - if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) { | ||
| 72 | - | ||
| 73 | - logger.info("【应发未到 -多个(" + 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,67 +100,54 @@ public class LateAdjustHandle implements ApplicationContextAware { | @@ -154,67 +100,54 @@ 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() | ||
| 174 | - , name1 = BasicData.stationCode2NameMap.get(key)//站点名称 | ||
| 175 | - , name2 = null; | ||
| 176 | - if (StringUtils.isNotEmpty(gps.getCarparkNo())) { | ||
| 177 | - name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo()); | ||
| 178 | - } | 117 | + if (!lateSchMap.containsKey(sch.getId())) |
| 118 | + return; | ||
| 179 | 119 | ||
| 180 | - if (gps.getInstation() == 2) { | ||
| 181 | - name1 = name2;//进场,没有站 | 120 | + logger.info("线程空隙漏掉的误点,id: " + sch.getId()); |
| 121 | + } else | ||
| 122 | + return; | ||
| 182 | } | 123 | } |
| 183 | 124 | ||
| 184 | - gps.setStationName(name1); | ||
| 185 | - //根据起点站获取误点班次 | ||
| 186 | - ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), name1, name2); | ||
| 187 | - | ||
| 188 | - if (null == sch) | ||
| 189 | - return; | ||
| 190 | 125 | ||
| 191 | //可能是延迟信号,gps时间没有误点 | 126 | //可能是延迟信号,gps时间没有误点 |
| 192 | if (gps.getTimestamp() <= sch.getDfsjT()) { | 127 | if (gps.getTimestamp() <= sch.getDfsjT()) { |
| 193 | sch.setLate2(false); | 128 | sch.setLate2(false); |
| 194 | - lateSchMaps.remove(sch.getClZbh(), sch); | 129 | + lateSchMap.remove(sch.getId()); |
| 195 | return; | 130 | return; |
| 196 | } | 131 | } |
| 197 | 132 | ||
| 198 | - if (gps.getStationName().equals(sch.getQdzName()) | ||
| 199 | - || gps.getStopNo().equals(sch.getQdzCode())) { | ||
| 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); |
| 215 | } | 147 | } |
| 216 | } | 148 | } |
| 217 | 149 | ||
| 150 | + | ||
| 218 | @Override | 151 | @Override |
| 219 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | 152 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| 220 | lineConfigData = applicationContext.getBean(LineConfigData.class); | 153 | lineConfigData = applicationContext.getBean(LineConfigData.class); |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| @@ -77,6 +77,9 @@ public class ScheduleRefreshThread extends Thread{ | @@ -77,6 +77,9 @@ public class ScheduleRefreshThread extends Thread{ | ||
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | + //按公司编码索引数据 | ||
| 81 | + dayOfSchedule.groupByGsbm(); | ||
| 82 | + | ||
| 80 | //首末班入库(给网关用的数据) | 83 | //首末班入库(给网关用的数据) |
| 81 | FirstAndLastHandler.saveAll(); | 84 | FirstAndLastHandler.saveAll(); |
| 82 | } catch (Exception e) { | 85 | } catch (Exception e) { |
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/TrafficManageServiceImpl.java
| @@ -35,6 +35,7 @@ import org.springframework.data.domain.Sort.Direction; | @@ -35,6 +35,7 @@ import org.springframework.data.domain.Sort.Direction; | ||
| 35 | import org.springframework.stereotype.Service; | 35 | import org.springframework.stereotype.Service; |
| 36 | 36 | ||
| 37 | import java.io.*; | 37 | import java.io.*; |
| 38 | +import java.net.InetAddress; | ||
| 38 | import java.sql.Connection; | 39 | import java.sql.Connection; |
| 39 | import java.sql.PreparedStatement; | 40 | import java.sql.PreparedStatement; |
| 40 | import java.sql.ResultSet; | 41 | import java.sql.ResultSet; |
| @@ -530,7 +531,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -530,7 +531,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 530 | try { | 531 | try { |
| 531 | //发送邮件 | 532 | //发送邮件 |
| 532 | EmailBean mail = new EmailBean(); | 533 | EmailBean mail = new EmailBean(); |
| 533 | - mail.setSubject("浦东路单日志数据"+date); | 534 | + mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date); |
| 534 | mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure); | 535 | mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure); |
| 535 | sendEmailController.sendMail(emailSendToAddress, mail); | 536 | sendEmailController.sendMail(emailSendToAddress, mail); |
| 536 | logger.info("setLD-sendMail:邮件发送成功!"); | 537 | logger.info("setLD-sendMail:邮件发送成功!"); |
| @@ -945,8 +946,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -945,8 +946,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 945 | DecimalFormat df = new DecimalFormat("######0.000"); | 946 | DecimalFormat df = new DecimalFormat("######0.000"); |
| 946 | try { | 947 | try { |
| 947 | String[] idArray = ids.split(","); | 948 | String[] idArray = ids.split(","); |
| 948 | - StringBuffer sBufferA ,sBufferB = null,sBufferC = null; | ||
| 949 | - double zlc = 0.0f,yylc = 0.0f,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程 | 949 | + StringBuffer sBufferA ,sBufferB ,sBufferC ; |
| 950 | + double zlc,yylc,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程 | ||
| 950 | String bcType,sxx;// 班次类型、上下行 | 951 | String bcType,sxx;// 班次类型、上下行 |
| 951 | // 上传的时刻表集合 | 952 | // 上传的时刻表集合 |
| 952 | List<TTInfo> ttinfoList = new ArrayList<>(); | 953 | List<TTInfo> ttinfoList = new ArrayList<>(); |
| @@ -963,6 +964,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -963,6 +964,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 963 | if(ttInfo == null) | 964 | if(ttInfo == null) |
| 964 | continue; | 965 | continue; |
| 965 | ttinfoList.add(ttInfo); // 保存时刻表 | 966 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 967 | + zlc = 0.0f; | ||
| 968 | + yylc = 0.0f; | ||
| 966 | // 获得时刻表 | 969 | // 获得时刻表 |
| 967 | param = new HashMap(); | 970 | param = new HashMap(); |
| 968 | param.put("ttinfo.id_eq", ttInfo.getId()); | 971 | param.put("ttinfo.id_eq", ttInfo.getId()); |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -236,7 +236,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -236,7 +236,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 236 | return rs; | 236 | return rs; |
| 237 | } | 237 | } |
| 238 | else if (!fgsbm.equals(spy.getBrancheCompanyCode())) { | 238 | else if (!fgsbm.equals(spy.getBrancheCompanyCode())) { |
| 239 | - msg = ("【售票员】: " + jGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); | 239 | + msg = ("【售票员】: " + sGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); |
| 240 | rs.put("msg", msg); | 240 | rs.put("msg", msg); |
| 241 | rs.put("checkStatus", -1); | 241 | rs.put("checkStatus", -1); |
| 242 | return rs; | 242 | return rs; |
| @@ -3473,7 +3473,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3473,7 +3473,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3473 | } | 3473 | } |
| 3474 | 3474 | ||
| 3475 | if (StringUtils.isNotEmpty(cpc.getJsy())) { | 3475 | if (StringUtils.isNotEmpty(cpc.getJsy())) { |
| 3476 | - jGh = cpc.getJsy().split("/")[0]; | 3476 | + try{ |
| 3477 | + jGh = cpc.getJsy().split("/")[0]; | ||
| 3478 | + }catch (Exception e){ | ||
| 3479 | + logger.error("", e); | ||
| 3480 | + rs.put("msg", "驾驶员参数异常!!"); | ||
| 3481 | + rs.put("status", ResponseCode.ERROR); | ||
| 3482 | + return rs; | ||
| 3483 | + } | ||
| 3484 | + | ||
| 3477 | jName = getPersonName(sch.getGsBm(), jGh); | 3485 | jName = getPersonName(sch.getGsBm(), jGh); |
| 3478 | if (StringUtils.isEmpty(jName)) { | 3486 | if (StringUtils.isEmpty(jName)) { |
| 3479 | rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | 3487 | rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); |
| @@ -5138,6 +5146,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5138,6 +5146,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5138 | List<String> leftList = Splitter.on(",").splitToList(leftIdx); | 5146 | List<String> leftList = Splitter.on(",").splitToList(leftIdx); |
| 5139 | List<String> rightList = Splitter.on(",").splitToList(rightIdx); | 5147 | List<String> rightList = Splitter.on(",").splitToList(rightIdx); |
| 5140 | Set<String> lpSet = new HashSet<>(); | 5148 | Set<String> lpSet = new HashSet<>(); |
| 5149 | + Set<String> carSet = new HashSet<>(); | ||
| 5141 | 5150 | ||
| 5142 | List<ScheduleRealInfo> largeList, smallList; | 5151 | List<ScheduleRealInfo> largeList, smallList; |
| 5143 | if (leftList.size() > rightList.size()) { | 5152 | if (leftList.size() > rightList.size()) { |
| @@ -5168,6 +5177,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5168,6 +5177,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5168 | 5177 | ||
| 5169 | lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | 5178 | lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); |
| 5170 | lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); | 5179 | lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); |
| 5180 | + | ||
| 5181 | + carSet.add(leftSch.getClZbh()); | ||
| 5182 | + carSet.add(rightSch.getClZbh()); | ||
| 5171 | } | 5183 | } |
| 5172 | 5184 | ||
| 5173 | //重新计算路牌的起点应到时间 | 5185 | //重新计算路牌的起点应到时间 |
| @@ -5175,6 +5187,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5175,6 +5187,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5175 | ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); | 5187 | ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); |
| 5176 | } | 5188 | } |
| 5177 | 5189 | ||
| 5190 | + //重新就算车辆当前执行班次 | ||
| 5191 | + for(String nbbm : carSet){ | ||
| 5192 | + dayOfSchedule.reCalcExecPlan(nbbm); | ||
| 5193 | + } | ||
| 5194 | + | ||
| 5195 | + | ||
| 5178 | for (ScheduleRealInfo sch : ts) { | 5196 | for (ScheduleRealInfo sch : ts) { |
| 5179 | dayOfSchedule.save(sch); | 5197 | dayOfSchedule.save(sch); |
| 5180 | } | 5198 | } |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| @@ -691,6 +691,44 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -691,6 +691,44 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 691 | sheet.autoSizeColumn(groupCount * 2 + 10); | 691 | sheet.autoSizeColumn(groupCount * 2 + 10); |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | + private void createParameterInfoSheet( | ||
| 695 | + org.apache.poi.ss.usermodel.Workbook wb, | ||
| 696 | + DTInfos dtInfos, ExcelPoiOperator excelPoiOperator) { | ||
| 697 | + org.apache.poi.ss.usermodel.Sheet sheet = excelPoiOperator.createWorkBookSheet(wb, "时刻表信息_参数"); | ||
| 698 | + | ||
| 699 | + //---------------------- 参数对象信息 -----------------------// | ||
| 700 | + List<ParameterInfo> parameterInfoList = dtInfos.getParameterInfoList(); | ||
| 701 | + | ||
| 702 | + int _s = parameterInfoList.size() / 2; | ||
| 703 | + int _y = parameterInfoList.size() % 2; | ||
| 704 | + // 1行2个参数对象值,1个参数对象对应2列,1列描述,1列值 | ||
| 705 | + int rowCount = _s + (_y == 0 ? 0 : 1); | ||
| 706 | + | ||
| 707 | + for (int i = 0; i < rowCount; i++) { | ||
| 708 | + Row row = excelPoiOperator.createSheetRow(sheet, i); | ||
| 709 | + for (int j = 0; j < 4; j++) { | ||
| 710 | + excelPoiOperator.createStringCell(wb, row, (short) j, ""); | ||
| 711 | + } | ||
| 712 | + } | ||
| 713 | + | ||
| 714 | + for (int i = 0; i < parameterInfoList.size(); i++) { | ||
| 715 | + int row = i / 2; | ||
| 716 | + int col1 = (i % 2) == 0 ? 0 : 2; | ||
| 717 | + int col2 = (i % 2) == 0 ? 1 : 3; | ||
| 718 | + | ||
| 719 | + ParameterInfo parameterInfo = parameterInfoList.get(i); | ||
| 720 | + | ||
| 721 | + sheet.getRow(row).getCell(col1).setCellValue(parameterInfo.getParamItem()); | ||
| 722 | + sheet.getRow(row).getCell(col2).setCellValue(parameterInfo.getParamValue()); | ||
| 723 | + } | ||
| 724 | + | ||
| 725 | + sheet.autoSizeColumn(0); | ||
| 726 | + sheet.autoSizeColumn(1); | ||
| 727 | + sheet.autoSizeColumn(2); | ||
| 728 | + sheet.autoSizeColumn(3); | ||
| 729 | + | ||
| 730 | + } | ||
| 731 | + | ||
| 694 | @Override | 732 | @Override |
| 695 | public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException { | 733 | public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException { |
| 696 | try { | 734 | try { |
| @@ -707,6 +745,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -707,6 +745,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 707 | org.apache.poi.ss.usermodel.Workbook wb = excelPoiOperator.createWorkBook(); | 745 | org.apache.poi.ss.usermodel.Workbook wb = excelPoiOperator.createWorkBook(); |
| 708 | this.createDynamicTTinfoSheet(wb, dtInfos, excelPoiOperator); | 746 | this.createDynamicTTinfoSheet(wb, dtInfos, excelPoiOperator); |
| 709 | this.createDynamicTTinfoStatSheet(wb, dtInfos, excelPoiOperator); | 747 | this.createDynamicTTinfoStatSheet(wb, dtInfos, excelPoiOperator); |
| 748 | + this.createParameterInfoSheet(wb, dtInfos, excelPoiOperator); | ||
| 710 | 749 | ||
| 711 | // wb内存写入文件 | 750 | // wb内存写入文件 |
| 712 | String filepath = dataToolsProperties.getFileoutputDir() + | 751 | String filepath = dataToolsProperties.getFileoutputDir() + |
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
| @@ -14,7 +14,7 @@ import java.util.List; | @@ -14,7 +14,7 @@ import java.util.List; | ||
| 14 | public interface TTinfoDetailDynamicData { | 14 | public interface TTinfoDetailDynamicData { |
| 15 | 15 | ||
| 16 | //---------------------- 生成时刻表用对象(以下) ---------------------// | 16 | //---------------------- 生成时刻表用对象(以下) ---------------------// |
| 17 | - public static enum BcType { // 班次类型枚举 | 17 | + enum BcType { // 班次类型枚举 |
| 18 | IN("in"), // 进场 | 18 | IN("in"), // 进场 |
| 19 | OUT("out"), // 出场 | 19 | OUT("out"), // 出场 |
| 20 | BD("bd"), // 早例保 | 20 | BD("bd"), // 早例保 |
| @@ -37,7 +37,7 @@ public interface TTinfoDetailDynamicData { | @@ -37,7 +37,7 @@ public interface TTinfoDetailDynamicData { | ||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | - public static class BcObj { // 班次对象 | 40 | + class BcObj { // 班次对象 |
| 41 | /** 班次时间 */ | 41 | /** 班次时间 */ |
| 42 | private Integer bcsj; | 42 | private Integer bcsj; |
| 43 | /** 停站时间 */ | 43 | /** 停站时间 */ |
| @@ -175,7 +175,7 @@ public interface TTinfoDetailDynamicData { | @@ -175,7 +175,7 @@ public interface TTinfoDetailDynamicData { | ||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | - public static class LpObj { // 路牌对象 | 178 | + class LpObj { // 路牌对象 |
| 179 | /** 路牌名字 */ | 179 | /** 路牌名字 */ |
| 180 | private String lpname; | 180 | private String lpname; |
| 181 | /** 每圈的第一个班次是否上行 */ | 181 | /** 每圈的第一个班次是否上行 */ |
| @@ -321,7 +321,7 @@ public interface TTinfoDetailDynamicData { | @@ -321,7 +321,7 @@ public interface TTinfoDetailDynamicData { | ||
| 321 | 321 | ||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | - public static class StatInfo { // 统计数据对象 | 324 | + class StatInfo { // 统计数据对象 |
| 325 | /** 统计项目 */ | 325 | /** 统计项目 */ |
| 326 | private String statItem; | 326 | private String statItem; |
| 327 | /** 统计值 */ | 327 | /** 统计值 */ |
| @@ -344,11 +344,36 @@ public interface TTinfoDetailDynamicData { | @@ -344,11 +344,36 @@ public interface TTinfoDetailDynamicData { | ||
| 344 | } | 344 | } |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | - public static class DTInfos { // 所有数据信息 | 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 { // 所有数据信息 | ||
| 348 | /** 路牌班次数据列表 */ | 371 | /** 路牌班次数据列表 */ |
| 349 | private List<LpObj> lpObjList; | 372 | private List<LpObj> lpObjList; |
| 350 | /** 统计数据列表 */ | 373 | /** 统计数据列表 */ |
| 351 | private List<StatInfo> statInfoList; | 374 | private List<StatInfo> statInfoList; |
| 375 | + /** 参数对象信息 */ | ||
| 376 | + private List<ParameterInfo> parameterInfoList; | ||
| 352 | 377 | ||
| 353 | public List<LpObj> getLpObjList() { | 378 | public List<LpObj> getLpObjList() { |
| 354 | return lpObjList; | 379 | return lpObjList; |
| @@ -365,6 +390,14 @@ public interface TTinfoDetailDynamicData { | @@ -365,6 +390,14 @@ public interface TTinfoDetailDynamicData { | ||
| 365 | public void setStatInfoList(List<StatInfo> statInfoList) { | 390 | public void setStatInfoList(List<StatInfo> statInfoList) { |
| 366 | this.statInfoList = statInfoList; | 391 | this.statInfoList = statInfoList; |
| 367 | } | 392 | } |
| 393 | + | ||
| 394 | + public List<ParameterInfo> getParameterInfoList() { | ||
| 395 | + return parameterInfoList; | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + public void setParameterInfoList(List<ParameterInfo> parameterInfoList) { | ||
| 399 | + this.parameterInfoList = parameterInfoList; | ||
| 400 | + } | ||
| 368 | } | 401 | } |
| 369 | 402 | ||
| 370 | //---------------------- 生成时刻表用对象(以上) ---------------------// | 403 | //---------------------- 生成时刻表用对象(以上) ---------------------// |
| @@ -375,5 +408,5 @@ public interface TTinfoDetailDynamicData { | @@ -375,5 +408,5 @@ public interface TTinfoDetailDynamicData { | ||
| 375 | * @return | 408 | * @return |
| 376 | * @throws ScheduleException | 409 | * @throws ScheduleException |
| 377 | */ | 410 | */ |
| 378 | - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException; | 411 | + DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException; |
| 379 | } | 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/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/timesmodel/gantt.html
| @@ -152,7 +152,11 @@ | @@ -152,7 +152,11 @@ | ||
| 152 | <script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script> | 152 | <script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script> |
| 153 | <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script> | 153 | <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script> |
| 154 | <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script> | 154 | <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script> |
| 155 | -<script src="/pages/base/timesmodel/js/v2/AdjustTripStrategy.js"></script> | 155 | +<script src="/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS1.js"></script> |
| 156 | +<script src="/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS2.js"></script> | ||
| 157 | +<script src="/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS3.js"></script> | ||
| 158 | +<script src="/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS4.js"></script> | ||
| 159 | +<script src="/pages/base/timesmodel/js/v2/strategy/StrategyUtils.js"></script> | ||
| 156 | <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script> | 160 | <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script> |
| 157 | <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script> | 161 | <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script> |
| 158 | <script src="/pages/base/timesmodel/js/errorinfo.js"></script> | 162 | <script src="/pages/base/timesmodel/js/errorinfo.js"></script> |
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
| @@ -321,7 +321,7 @@ $('.parambtn').on('click', function() { | @@ -321,7 +321,7 @@ $('.parambtn').on('click', function() { | ||
| 321 | $.get('/pages/base/timesmodel/paramadd.html', function(m){ | 321 | $.get('/pages/base/timesmodel/paramadd.html', function(m){ |
| 322 | $(pjaxContainer).append(m); | 322 | $(pjaxContainer).append(m); |
| 323 | // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。 | 323 | // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。 |
| 324 | - $('#paramadd_mobal').trigger('paramAddMobal.show', $_GlobalGraph); | 324 | + $('#paramadd_mobal').trigger('paramAddMobal.show', Main_v2); |
| 325 | }); | 325 | }); |
| 326 | }); | 326 | }); |
| 327 | 327 |
src/main/resources/static/pages/base/timesmodel/js/v2/ParameterObj.js
| @@ -372,6 +372,13 @@ var ParameterObj = function() { | @@ -372,6 +372,13 @@ var ParameterObj = function() { | ||
| 372 | 372 | ||
| 373 | }, | 373 | }, |
| 374 | 374 | ||
| 375 | + //------------ 获取生成策略函数 ------------// | ||
| 376 | + fnGetAdjustStrategyId : function() { | ||
| 377 | + return _formMap.strategy || 'AdjustTripS1'; | ||
| 378 | + }, | ||
| 379 | + | ||
| 380 | + // TODO:还有其他策略 | ||
| 381 | + | ||
| 375 | //------------ 获取首班末班时间 ------------// | 382 | //------------ 获取首班末班时间 ------------// |
| 376 | /** | 383 | /** |
| 377 | * 获取上行首班时间对象。 | 384 | * 获取上行首班时间对象。 |
| @@ -680,7 +687,7 @@ var ParameterObj = function() { | @@ -680,7 +687,7 @@ var ParameterObj = function() { | ||
| 680 | return _fcjxIntervalObj.epeakfcjx.min; | 687 | return _fcjxIntervalObj.epeakfcjx.min; |
| 681 | }, | 688 | }, |
| 682 | /** | 689 | /** |
| 683 | - * 获取晚高峰最小发车间隙。 | 690 | + * 获取晚高峰最大发车间隙。 |
| 684 | * @returns int | 691 | * @returns int |
| 685 | */ | 692 | */ |
| 686 | getEPeakMaxFcjx: function() { | 693 | getEPeakMaxFcjx: function() { |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
| @@ -140,6 +140,9 @@ InternalBcObj.prototype.setArrTimeObj = function(oTime) { | @@ -140,6 +140,9 @@ InternalBcObj.prototype.setArrTimeObj = function(oTime) { | ||
| 140 | InternalBcObj.prototype.getBcTime = function() { | 140 | InternalBcObj.prototype.getBcTime = function() { |
| 141 | return this._$_bcsj; | 141 | return this._$_bcsj; |
| 142 | }; | 142 | }; |
| 143 | +InternalBcObj.prototype.setBcTime = function(iTime) { | ||
| 144 | + this._$_bcsj = iTime; | ||
| 145 | +}; | ||
| 143 | /** | 146 | /** |
| 144 | * 获取停站时间。 | 147 | * 获取停站时间。 |
| 145 | * @returns int | 148 | * @returns int |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
| @@ -492,7 +492,8 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | @@ -492,7 +492,8 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | ||
| 492 | group = groupArray[i]; | 492 | group = groupArray[i]; |
| 493 | if (group) { | 493 | if (group) { |
| 494 | oBc = group.getBc1(); | 494 | oBc = group.getBc1(); |
| 495 | - if (oBc != undefined && (oBc.isUp() == hasUp || oBc.isUp() == hasDown)) { | 495 | + |
| 496 | + if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { | ||
| 496 | bc1time = group.getBc1().getFcTimeObj(); | 497 | bc1time = group.getBc1().getFcTimeObj(); |
| 497 | console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff); | 498 | console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff); |
| 498 | tempdiff = Math.abs(bc1time.diff(fctime)); | 499 | tempdiff = Math.abs(bc1time.diff(fctime)); |
| @@ -518,7 +519,7 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | @@ -518,7 +519,7 @@ InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function( | ||
| 518 | } | 519 | } |
| 519 | 520 | ||
| 520 | oBc = group.getBc2(); | 521 | oBc = group.getBc2(); |
| 521 | - if (oBc != undefined && (oBc.isUp() == hasUp || oBc.isUp() == hasDown)) { | 522 | + if (oBc != undefined && ((hasUp && hasDown) || (hasUp && (oBc.isUp() == hasUp)) || (hasDown && (!oBc.isUp() == hasDown)))) { |
| 522 | bc2time = group.getBc2().getFcTimeObj(); | 523 | bc2time = group.getBc2().getFcTimeObj(); |
| 523 | console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff); | 524 | console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff); |
| 524 | tempdiff = Math.abs(bc2time.diff(fctime)); | 525 | tempdiff = Math.abs(bc2time.diff(fctime)); |
| @@ -755,6 +756,11 @@ InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, para | @@ -755,6 +756,11 @@ InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, para | ||
| 755 | var oPreBc; | 756 | var oPreBc; |
| 756 | var oEatBc; | 757 | var oEatBc; |
| 757 | var iBcModifyTime; | 758 | var iBcModifyTime; |
| 759 | + | ||
| 760 | + if (!this.getBc(groupIndex, bcIndex)) { // | ||
| 761 | + return 0; | ||
| 762 | + } | ||
| 763 | + | ||
| 758 | oPreBc = this.getBc( // 前一个邻接班次 | 764 | oPreBc = this.getBc( // 前一个邻接班次 |
| 759 | bcIndex == 0 ? groupIndex - 1 : groupIndex, | 765 | bcIndex == 0 ? groupIndex - 1 : groupIndex, |
| 760 | bcIndex == 1 ? 0 : 1); | 766 | bcIndex == 1 ? 0 : 1); |
| @@ -855,113 +861,6 @@ InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTrough | @@ -855,113 +861,6 @@ InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTrough | ||
| 855 | }; | 861 | }; |
| 856 | 862 | ||
| 857 | /** | 863 | /** |
| 858 | - * 调整车次block的班次停站时间,如果不在范围内,调整成平均停站时间。 | ||
| 859 | - * @param oParam {ParameterObj} 参数对象 | ||
| 860 | - */ | ||
| 861 | -InternalLpObj.prototype.fnAdjustBcTime = function(oParam) { | ||
| 862 | - // 获取车次链个数 | ||
| 863 | - var iBcChainCount = this.fnGetBcChainCount(); | ||
| 864 | - | ||
| 865 | - var i; | ||
| 866 | - var j; | ||
| 867 | - var oBcIndex; | ||
| 868 | - var iQIndex; | ||
| 869 | - var iBcIndex; | ||
| 870 | - var iBcCount; | ||
| 871 | - var oBc; | ||
| 872 | - var oNextBc; | ||
| 873 | - | ||
| 874 | - var iBcStopTime; | ||
| 875 | - | ||
| 876 | - var aRangeStopTime; | ||
| 877 | - | ||
| 878 | - for (i = 0; i < iBcChainCount; i++) { | ||
| 879 | - oBcIndex = this.fnGetBcChainInfo(i); | ||
| 880 | - iQIndex = oBcIndex["s_q"]; | ||
| 881 | - iBcIndex = oBcIndex["s_b"]; | ||
| 882 | - iBcCount = oBcIndex["bcount"]; | ||
| 883 | - | ||
| 884 | - for (j = 0; j < iBcCount - 1; j++) { | ||
| 885 | - oBc = this.getBc(iQIndex, iBcIndex); | ||
| 886 | - oNextBc = this.getBc( | ||
| 887 | - iBcIndex == 0 ? iQIndex : iQIndex + 1, | ||
| 888 | - iBcIndex == 0 ? 1 : 0); | ||
| 889 | - | ||
| 890 | - if (oNextBc.fnIsFirstBc()) { // 如果同一路牌连续2个方向首站班次,都不做处理 | ||
| 891 | - // 两个班次都是头班车,则停站时间不考虑范围,直接计算 | ||
| 892 | - iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m"); | ||
| 893 | - oBc.setStopTime(iBcStopTime); | ||
| 894 | - | ||
| 895 | - } else { | ||
| 896 | - // 获取当前班次的停站时间范围 | ||
| 897 | - aRangeStopTime = oParam.calcuTripLayoverTimeRange( | ||
| 898 | - oBc.getArrTimeObj(), oBc.isUp(), oBc.getBcTime() | ||
| 899 | - ); | ||
| 900 | - // 获取当前班次停站时间 | ||
| 901 | - iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m"); | ||
| 902 | - | ||
| 903 | - // 不改变当前班次的行驶时间,修正停站时间和下一个班次的发车时间和停站时间 | ||
| 904 | - if (oBc.fnGetEatTime() > 0) { | ||
| 905 | - // 当前班次后有吃饭时间, 则没有停站时间了 | ||
| 906 | - oBc.setStopTime(0); | ||
| 907 | - // 修改下一个班次的发车时间,到达时间 | ||
| 908 | - oNextBc.setFcTimeObj(oParam.addMinute( | ||
| 909 | - oBc.getArrTimeObj(), | ||
| 910 | - oBc.fnGetEatTime()) | ||
| 911 | - ); | ||
| 912 | - oNextBc.setArrTimeObj(oParam.addMinute( | ||
| 913 | - oNextBc.getFcTimeObj(), | ||
| 914 | - oParam.calcuTravelTime( | ||
| 915 | - oNextBc.getFcTimeObj(), | ||
| 916 | - oNextBc.isUp()) | ||
| 917 | - )); | ||
| 918 | - } else { | ||
| 919 | - if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime<= aRangeStopTime[1]) { | ||
| 920 | - // 在范围内,重新设置以下停站时间 | ||
| 921 | - oBc.setStopTime(iBcStopTime); | ||
| 922 | - | ||
| 923 | - } else if (iBcStopTime < aRangeStopTime[0]) { | ||
| 924 | - oBc.setStopTime(aRangeStopTime[0]); | ||
| 925 | - // 修改下一个班次的发车时间,到达时间 | ||
| 926 | - oNextBc.setFcTimeObj(oParam.addMinute( | ||
| 927 | - oBc.getArrTimeObj(), | ||
| 928 | - oBc.getStopTime()) | ||
| 929 | - ); | ||
| 930 | - oNextBc.setArrTimeObj(oParam.addMinute( | ||
| 931 | - oNextBc.getFcTimeObj(), | ||
| 932 | - oParam.calcuTravelTime( | ||
| 933 | - oNextBc.getFcTimeObj(), | ||
| 934 | - oNextBc.isUp()) | ||
| 935 | - )); | ||
| 936 | - } else { | ||
| 937 | - oBc.setStopTime(aRangeStopTime[1]); | ||
| 938 | - // 修改下一个班次的发车时间,到达时间 | ||
| 939 | - oNextBc.setFcTimeObj(oParam.addMinute( | ||
| 940 | - oBc.getArrTimeObj(), | ||
| 941 | - oBc.getStopTime()) | ||
| 942 | - ); | ||
| 943 | - oNextBc.setArrTimeObj(oParam.addMinute( | ||
| 944 | - oNextBc.getFcTimeObj(), | ||
| 945 | - oParam.calcuTravelTime( | ||
| 946 | - oNextBc.getFcTimeObj(), | ||
| 947 | - oNextBc.isUp()) | ||
| 948 | - )); | ||
| 949 | - } | ||
| 950 | - } | ||
| 951 | - } | ||
| 952 | - | ||
| 953 | - | ||
| 954 | - iBcIndex = iBcIndex == 0 ? 1 : 0; | ||
| 955 | - iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex; | ||
| 956 | - | ||
| 957 | - } | ||
| 958 | - | ||
| 959 | - // 最后一个班次停站时间为0 | ||
| 960 | - this.getBc(iQIndex, iBcIndex).setStopTime(0); | ||
| 961 | - } | ||
| 962 | -}; | ||
| 963 | - | ||
| 964 | -/** | ||
| 965 | * 返回指定班次的上一个班次。 | 864 | * 返回指定班次的上一个班次。 |
| 966 | * @param oBc {moment} 指定班次 | 865 | * @param oBc {moment} 指定班次 |
| 967 | * @returns {object} 上一个班次,如果没有,返回false | 866 | * @returns {object} 上一个班次,如果没有,返回false |
| @@ -1014,61 +913,104 @@ InternalLpObj.prototype.getPreBc = function(oBc) { | @@ -1014,61 +913,104 @@ InternalLpObj.prototype.getPreBc = function(oBc) { | ||
| 1014 | }; | 913 | }; |
| 1015 | 914 | ||
| 1016 | /** | 915 | /** |
| 1017 | - * 是否能调整班次的发车时间。 | ||
| 1018 | - * @param oBc 指定班次 | ||
| 1019 | - * @param iStep 修正步长 | ||
| 1020 | - * @param oParam 参数对象 | 916 | + * 通过修改layover时间,修正班次的发车,到达时间。 |
| 917 | + * 如果layover时间不符合范围要求,修改成平均时间。 | ||
| 918 | + * @param oParam {ParameterObj} 参数对象 | ||
| 1021 | */ | 919 | */ |
| 1022 | -InternalLpObj.prototype.isModifyBcFcsj = function(oBc, iStep, oParam) { | ||
| 1023 | - // 获取车次链个数 | ||
| 1024 | - var iBcChainCount = this.fnGetBcChainCount(); | 920 | +InternalLpObj.prototype.fnAdjustBcTime_layover = function(oParam) { |
| 921 | + // 获取车次链个数(连班路牌1个,分班路牌2个) | ||
| 922 | + var iBlockCount = this.fnGetBcChainCount(); | ||
| 1025 | 923 | ||
| 1026 | var i; | 924 | var i; |
| 1027 | var j; | 925 | var j; |
| 1028 | - var oBcIndex; | ||
| 1029 | - var iQIndex; | ||
| 1030 | - var iBcIndex; | ||
| 1031 | - var iBcCount; | ||
| 1032 | - var oPreBc; | 926 | + var aTrip; // 每个block关联的trip列表 |
| 927 | + var trip; // 当前班次 | ||
| 928 | + var nextTrip; // 下一个班次 | ||
| 929 | + var layOverTime; | ||
| 930 | + var aLayOverTimeRange; | ||
| 1033 | 931 | ||
| 1034 | - var iBcStopTime; | 932 | + var oBcIndex; |
| 933 | + var iQIndex; // block开始第几圈缩影 | ||
| 934 | + var iBcIndex; // block开始第几个班次 | ||
| 935 | + var iBcCount; // block的trip数目 | ||
| 1035 | 936 | ||
| 1036 | - var aRangeStopTime; | ||
| 1037 | 937 | ||
| 1038 | - for (i = 0; i < iBcChainCount; i++) { | 938 | + for (i = 0; i < iBlockCount; i++) { |
| 939 | + // 获取block关联的trip列表 | ||
| 1039 | oBcIndex = this.fnGetBcChainInfo(i); | 940 | oBcIndex = this.fnGetBcChainInfo(i); |
| 1040 | iQIndex = oBcIndex["s_q"]; | 941 | iQIndex = oBcIndex["s_q"]; |
| 1041 | iBcIndex = oBcIndex["s_b"]; | 942 | iBcIndex = oBcIndex["s_b"]; |
| 1042 | iBcCount = oBcIndex["bcount"]; | 943 | iBcCount = oBcIndex["bcount"]; |
| 1043 | 944 | ||
| 1044 | - oPreBc = this.getPreBc(oBc); | ||
| 1045 | - | ||
| 1046 | - // 如果是第一个班次 | ||
| 1047 | - if (!oPreBc) { | ||
| 1048 | - if (oBc.fnIsFirstBc()) { // 如果是方向头班车 | ||
| 1049 | - return false; | ||
| 1050 | - } else { | ||
| 1051 | - return true; | ||
| 1052 | - } | 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; | ||
| 1053 | } | 950 | } |
| 1054 | 951 | ||
| 1055 | - if (oPreBc.fnGetEatTime() > 0) { // 如果是吃饭班次,不能修改发车时间 | ||
| 1056 | - return false; | 952 | + if (aTrip.length < 2) { |
| 953 | + // 两个trip一起处理,只有1个trip的block不处理 | ||
| 954 | + continue; | ||
| 1057 | } | 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 | + } | ||
| 1058 | 968 | ||
| 1059 | - aRangeStopTime = oParam.calcuTripLayoverTimeRange( | ||
| 1060 | - oPreBc.getArrTimeObj(), oPreBc.isUp(), oPreBc.getBcTime() | ||
| 1061 | - ); | ||
| 1062 | - iBcStopTime = oPreBc.getStopTime() + iStep; | ||
| 1063 | - if (iBcStopTime >= aRangeStopTime[0] && iBcStopTime <= aRangeStopTime[1]) { | ||
| 1064 | - return true; | ||
| 1065 | - } else { | ||
| 1066 | - return false; | ||
| 1067 | - } | 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 | + ); | ||
| 1068 | 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); | ||
| 1069 | 1012 | ||
| 1070 | } | 1013 | } |
| 1071 | - | ||
| 1072 | }; | 1014 | }; |
| 1073 | 1015 | ||
| 1074 | // TODO | 1016 | // TODO |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| @@ -163,7 +163,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -163,7 +163,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 163 | var iFirstStopTime = | 163 | var iFirstStopTime = |
| 164 | _paramObj.fnCalcuFixedStopNumber( | 164 | _paramObj.fnCalcuFixedStopNumber( |
| 165 | _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), | 165 | _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), |
| 166 | - _qIsUp, | 166 | + !_qIsUp, |
| 167 | iXXTime | 167 | iXXTime |
| 168 | ); | 168 | ); |
| 169 | var oFlagBc = _factory.createBcObj( // 标记班次 | 169 | var oFlagBc = _factory.createBcObj( // 标记班次 |
| @@ -174,9 +174,6 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -174,9 +174,6 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 174 | _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), | 174 | _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), |
| 175 | _paramObj | 175 | _paramObj |
| 176 | ); | 176 | ); |
| 177 | - console.log("ddfdfdf=" + (iFirstStopTime)); | ||
| 178 | - console.log("ddfdfdf=" + (iXXTime)); | ||
| 179 | - console.log("ttt ==" + oFlagBc.getFcTimeObj().format("HH:mm")); | ||
| 180 | oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | 177 | oFlagBc.fnSetDelFlag(true); // 标记了删除记号 |
| 181 | 178 | ||
| 182 | _internalLpArray[0].setBc(0, 1, oFlagBc); | 179 | _internalLpArray[0].setBc(0, 1, oFlagBc); |
| @@ -467,109 +464,71 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -467,109 +464,71 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 467 | 464 | ||
| 468 | //----------------------- 初始化方法4,计算中标线位置 -------------------------// | 465 | //----------------------- 初始化方法4,计算中标线位置 -------------------------// |
| 469 | var _iZbx_lpIndex; // 中标线对应第几个路牌 | 466 | var _iZbx_lpIndex; // 中标线对应第几个路牌 |
| 470 | - | ||
| 471 | var _fnInitFun4 = function() { // 初始化方法4 | 467 | var _fnInitFun4 = function() { // 初始化方法4 |
| 472 | console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); | 468 | console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); |
| 473 | 469 | ||
| 474 | - //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------// | ||
| 475 | - // 构造中标线 | ||
| 476 | - // 中标线开始时间,就是方向的首班车时间 | 470 | + // 中标线开始时间,早的首班车时间,和上标线的开始时间方向相反 |
| 477 | var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | 471 | var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); |
| 478 | - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | ||
| 479 | - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | ||
| 480 | - var oEt; | ||
| 481 | - if (_paramObj.getUpLastDtimeObj().isBefore( | ||
| 482 | - _paramObj.getDownLastDTimeObj())) { | ||
| 483 | - oEt = _paramObj.getDownLastDTimeObj(); | ||
| 484 | - } else { | ||
| 485 | - oEt = _paramObj.getUpLastDtimeObj(); | ||
| 486 | - } | ||
| 487 | 472 | ||
| 488 | - var oTempLp = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp); | ||
| 489 | - oTempLp.initDataFromTimeToTime( | ||
| 490 | - oSt, | ||
| 491 | - oEt, | ||
| 492 | - !_qIsUp, | ||
| 493 | - 0, | ||
| 494 | - _paramObj, | ||
| 495 | - _factory | ||
| 496 | - ); | ||
| 497 | - | ||
| 498 | - //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------// | ||
| 499 | - // 找出中标线对应的早高峰的班次对象 | ||
| 500 | - var oZb_gf_bc = oTempLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); | ||
| 501 | - //alert(oZb_gf_bc.getFcTimeObj().format("HH:mm")); | ||
| 502 | - | ||
| 503 | - // 把所有连班路牌高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌 | ||
| 504 | - // 中标线和上标线一样在连班路牌上 | ||
| 505 | - var aTempq = []; | ||
| 506 | - var oTempq; | ||
| 507 | - var oTempb; | 473 | + // 1、使用上标线的开始时间的之前的虚拟班次,往下拉,模拟构造每个路牌的开头的虚拟班次 |
| 508 | var i; | 474 | var i; |
| 509 | - var oLp; | ||
| 510 | - | ||
| 511 | - var aLbIndexes = []; // 连班的路牌索引 | ||
| 512 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 513 | - if (_internalLpArray[i].isBxLb()) { | ||
| 514 | - aLbIndexes.push(i); | ||
| 515 | - } | 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)); | ||
| 516 | } | 479 | } |
| 517 | 480 | ||
| 518 | - for (i = 0; i < aLbIndexes.length; i++) { | ||
| 519 | - oLp = _internalLpArray[aLbIndexes[i]]; | 481 | + // 2、使用中标线开始时间,比对虚拟班次,找出最接近的(但是要大于等于时间) |
| 482 | + var _iLpIndex = -1; // 中标线的路牌索引 | ||
| 483 | + for (i = 0; i < _aFBc.length; i++) { | ||
| 484 | + console.log("比较班次的发车时间=" + _aFBc[i].getFcTimeObj().format("HH:mm")); | ||
| 520 | 485 | ||
| 521 | - oTempb = oLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); | ||
| 522 | - if (oTempb.isUp() == _qIsUp) { | ||
| 523 | - oTempq = new InternalGroupObj(oLp, _qIsUp, oTempb, undefined); | ||
| 524 | - } else { | ||
| 525 | - oTempq = new InternalGroupObj(oLp, _qIsUp, undefined, oTempb); | 486 | + if (!_internalLpArray[i].isBxLb()) { |
| 487 | + // 如果不是连班,不计算 | ||
| 488 | + continue; | ||
| 526 | } | 489 | } |
| 527 | - aTempq.push(oTempq); | ||
| 528 | 490 | ||
| 491 | + if (_aFBc[i].getFcTimeObj().diff(oSt) >= 0) { | ||
| 492 | + _iLpIndex = i; | ||
| 493 | + break; | ||
| 494 | + } | ||
| 529 | } | 495 | } |
| 530 | 496 | ||
| 531 | - var aTtindex = oTempLp.fnGetQBcIndexWithFcTimeFromGroupArray( // 找出最接近中标线的路牌索引 | ||
| 532 | - oZb_gf_bc.getFcTimeObj(), | ||
| 533 | - aTempq, | ||
| 534 | - true, | ||
| 535 | - true | ||
| 536 | - ); | 497 | + _iZbx_lpIndex = _iLpIndex; // 中标线放在第几个路牌 |
| 537 | 498 | ||
| 538 | - _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌 | 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]); // 将班次加入路牌 | ||
| 539 | 504 | ||
| 540 | - oTempLp.getMinBcObj().fnSetIsFirstBc(true); // 设置首班班次标识 | 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); | ||
| 541 | 510 | ||
| 542 | - if (_iZbx_lpIndex == 0) { // 如果中标线和上标线一致 | ||
| 543 | - var oFirstBcIndexes = oTempLp.getMinBcObjPosition(); | ||
| 544 | - var oFirstBc = oTempLp.getMinBcObj(); | ||
| 545 | - oFirstBc.setLp(_internalLpArray[_iZbx_lpIndex]); | ||
| 546 | - oFirstBc.fnSetDelFlag(false); | ||
| 547 | - _internalLpArray[_iZbx_lpIndex].setBc(oFirstBcIndexes[0], oFirstBcIndexes[1], oFirstBc); | ||
| 548 | - } else { | ||
| 549 | - oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象 | ||
| 550 | - oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔 | ||
| 551 | - oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb()); | ||
| 552 | - oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb()); | ||
| 553 | - oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2()); | ||
| 554 | - | ||
| 555 | - // 修正除了第一个班次外,其余其他班次 | ||
| 556 | - var iBcindex = 0; | ||
| 557 | - for (i = 1; i < _qCount; i++) { | ||
| 558 | - while (iBcindex <= 1) { | ||
| 559 | - if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次 | ||
| 560 | - oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex)); | ||
| 561 | - } | ||
| 562 | - iBcindex ++; | ||
| 563 | - } | ||
| 564 | - iBcindex = 0; | 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); | ||
| 565 | } | 518 | } |
| 566 | 519 | ||
| 567 | - _internalLpArray[_iZbx_lpIndex] = oTempLp; | 520 | + if (_internalLpArray[_iZbx_lpIndex].getBc(i, 1)) { |
| 521 | + break; | ||
| 522 | + } else { | ||
| 523 | + _fnGenerateBcAndSetBc(_iZbx_lpIndex, i, 1); | ||
| 524 | + } | ||
| 568 | } | 525 | } |
| 569 | 526 | ||
| 570 | console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌"); | 527 | console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌"); |
| 571 | 528 | ||
| 572 | console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); | 529 | console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); |
| 530 | + | ||
| 531 | + | ||
| 573 | }; | 532 | }; |
| 574 | 533 | ||
| 575 | //-------------------- 重要的内部方法 -----------------------// | 534 | //-------------------- 重要的内部方法 -----------------------// |
| @@ -1176,7 +1135,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1176,7 +1135,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1176 | var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引 | 1135 | var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引 |
| 1177 | var i; | 1136 | var i; |
| 1178 | for (i = 0; i < _internalLpArray.length; i++) { | 1137 | for (i = 0; i < _internalLpArray.length; i++) { |
| 1179 | - if (_internalLpArray[i].isBxLb() && i != 0 && i != _iZbx_lpIndex) { | 1138 | + if (_internalLpArray[i].isBxLb() && i != 0) { |
| 1180 | aLbLpindexes.push(i); | 1139 | aLbLpindexes.push(i); |
| 1181 | } | 1140 | } |
| 1182 | } | 1141 | } |
| @@ -1225,7 +1184,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1225,7 +1184,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1225 | var iBindex; | 1184 | var iBindex; |
| 1226 | // 补上标线到中标线之间的连班路牌的班次 | 1185 | // 补上标线到中标线之间的连班路牌的班次 |
| 1227 | for (i = 0; i < aLbLpindexes.length; i++) { | 1186 | for (i = 0; i < aLbLpindexes.length; i++) { |
| 1228 | - if (aLbLpindexes[i] > 0 && aLbLpindexes[i] < _iZbx_lpIndex) { | 1187 | + // 中标线可能也要补充,因为中标线生成算法有变 |
| 1188 | + // 如果上标线==中标线为止,不用补了 | ||
| 1189 | + | ||
| 1190 | + if (aLbLpindexes[i] > 0 && aLbLpindexes[i] <= _iZbx_lpIndex) { | ||
| 1229 | oLp = _internalLpArray[aLbLpindexes[i]]; | 1191 | oLp = _internalLpArray[aLbLpindexes[i]]; |
| 1230 | aMinbcPos = oLp.getMinBcObjPosition(); | 1192 | aMinbcPos = oLp.getMinBcObjPosition(); |
| 1231 | iQindex = aMinbcPos[0]; | 1193 | iQindex = aMinbcPos[0]; |
| @@ -1398,7 +1360,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1398,7 +1360,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1398 | var iDEQIndex = aDEIndex[0]; | 1360 | var iDEQIndex = aDEIndex[0]; |
| 1399 | var iDEBIndex = aDEIndex[1]; | 1361 | var iDEBIndex = aDEIndex[1]; |
| 1400 | 1362 | ||
| 1401 | - // 注意,本模型只有连班才有吃饭 | 1363 | + // TODO:注意,本模型只有连班才有吃饭 |
| 1402 | 1364 | ||
| 1403 | var i; | 1365 | var i; |
| 1404 | var oLp; | 1366 | var oLp; |
| @@ -1415,7 +1377,6 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1415,7 +1377,6 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1415 | var j; | 1377 | var j; |
| 1416 | for (i = 0; i < aLbIndex.length; i++) { | 1378 | for (i = 0; i < aLbIndex.length; i++) { |
| 1417 | oLp = _internalLpArray[aLbIndex[i]]; | 1379 | oLp = _internalLpArray[aLbIndex[i]]; |
| 1418 | - | ||
| 1419 | // 午饭 | 1380 | // 午饭 |
| 1420 | iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj); | 1381 | iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj); |
| 1421 | // 晚饭 | 1382 | // 晚饭 |
| @@ -1670,7 +1631,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1670,7 +1631,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1670 | // } | 1631 | // } |
| 1671 | 1632 | ||
| 1672 | for (var i = 0; i < _internalLpArray.length; i++) { | 1633 | for (var i = 0; i < _internalLpArray.length; i++) { |
| 1673 | - _internalLpArray[i].fnAdjustBcTime(_paramObj); | 1634 | + _internalLpArray[i].fnAdjustBcTime_layover(_paramObj); |
| 1674 | } | 1635 | } |
| 1675 | }, | 1636 | }, |
| 1676 | 1637 | ||
| @@ -1740,7 +1701,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1740,7 +1701,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1740 | var aUpBc = !oStartTime ? _fnGetBcList(true) : _fnGetBcList2(true, oStartTime); // 指定方向的班次列表 | 1701 | var aUpBc = !oStartTime ? _fnGetBcList(true) : _fnGetBcList2(true, oStartTime); // 指定方向的班次列表 |
| 1741 | var aDownBc = !oStartTime ? _fnGetBcList(false) : _fnGetBcList2(false, oStartTime); // 指定方向的班次列表 | 1702 | var aDownBc = !oStartTime ? _fnGetBcList(false) : _fnGetBcList2(false, oStartTime); // 指定方向的班次列表 |
| 1742 | // 使用策略类调用指定策略函数,注意 AdjustTripStrategy.js 导入 | 1703 | // 使用策略类调用指定策略函数,注意 AdjustTripStrategy.js 导入 |
| 1743 | - AdjustTripStrategy.sFn("ADJUST_TRIP")(aUpBc, aDownBc, this, _paramObj); | 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); | ||
| 1744 | 1708 | ||
| 1745 | }, | 1709 | }, |
| 1746 | 1710 |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| @@ -747,6 +747,41 @@ var Main_v2 = function() { | @@ -747,6 +747,41 @@ var Main_v2 = function() { | ||
| 747 | 747 | ||
| 748 | }; | 748 | }; |
| 749 | 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 | + | ||
| 750 | return { | 785 | return { |
| 751 | /** | 786 | /** |
| 752 | * 工厂对象,创建不同的对象。 | 787 | * 工厂对象,创建不同的对象。 |
| @@ -794,7 +829,7 @@ var Main_v2 = function() { | @@ -794,7 +829,7 @@ var Main_v2 = function() { | ||
| 794 | // 8、调整路牌班次间隔(使用平均停站时间) | 829 | // 8、调整路牌班次间隔(使用平均停站时间) |
| 795 | schedule.fnAdjustLpBcInterval(1); | 830 | schedule.fnAdjustLpBcInterval(1); |
| 796 | 831 | ||
| 797 | - // 9、调整纵向班次间隔 | 832 | + // 9、调整班次发车间隔 |
| 798 | schedule.fnAdjustBcInterval(false); | 833 | schedule.fnAdjustBcInterval(false); |
| 799 | 834 | ||
| 800 | // 10、确定末班车 | 835 | // 10、确定末班车 |
| @@ -804,9 +839,9 @@ var Main_v2 = function() { | @@ -804,9 +839,9 @@ var Main_v2 = function() { | ||
| 804 | schedule.fnRemoveDelLastFlagBc(); | 839 | schedule.fnRemoveDelLastFlagBc(); |
| 805 | 840 | ||
| 806 | // TODO:12、平均化指定时间后的班次列表间隔 | 841 | // TODO:12、平均化指定时间后的班次列表间隔 |
| 807 | - // schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50")); | ||
| 808 | - // schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50")); | ||
| 809 | - | 842 | + // // schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50")); |
| 843 | + // // schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50")); | ||
| 844 | + // | ||
| 810 | // 10、补进出场例保班次 | 845 | // 10、补进出场例保班次 |
| 811 | schedule.fnCalcuOtherBc(); | 846 | schedule.fnCalcuOtherBc(); |
| 812 | 847 | ||
| @@ -823,10 +858,14 @@ var Main_v2 = function() { | @@ -823,10 +858,14 @@ var Main_v2 = function() { | ||
| 823 | * @param aInternalLpObj 内部路牌对象列表 | 858 | * @param aInternalLpObj 内部路牌对象列表 |
| 824 | */ | 859 | */ |
| 825 | exportDataConfig: function(aInternalLpObj) { | 860 | exportDataConfig: function(aInternalLpObj) { |
| 861 | + $('.exportAddXls').off('click'); | ||
| 862 | + $('.exportAddXlsx').off('click'); | ||
| 863 | + | ||
| 826 | $('.exportAddXls').on('click', function() { | 864 | $('.exportAddXls').on('click', function() { |
| 827 | var aInfos = { | 865 | var aInfos = { |
| 828 | "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | 866 | "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 |
| 829 | - "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表 | 867 | + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 |
| 868 | + "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 830 | }; | 869 | }; |
| 831 | 870 | ||
| 832 | console.log(aInfos); | 871 | console.log(aInfos); |
| @@ -859,7 +898,8 @@ var Main_v2 = function() { | @@ -859,7 +898,8 @@ var Main_v2 = function() { | ||
| 859 | $('.exportAddXlsx').on('click', function() { | 898 | $('.exportAddXlsx').on('click', function() { |
| 860 | var aInfos = { | 899 | var aInfos = { |
| 861 | "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | 900 | "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 |
| 862 | - "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表 | 901 | + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表 |
| 902 | + "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象 | ||
| 863 | }; | 903 | }; |
| 864 | 904 | ||
| 865 | console.log(aInfos); | 905 | console.log(aInfos); |
| @@ -963,3 +1003,5 @@ var Main_v2 = function() { | @@ -963,3 +1003,5 @@ var Main_v2 = function() { | ||
| 963 | }; | 1003 | }; |
| 964 | 1004 | ||
| 965 | }(); | 1005 | }(); |
| 1006 | + | ||
| 1007 | + |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/StrategyUtils.js
0 → 100644
| 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 | +} ()); | ||
| 0 | \ No newline at end of file | 40 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/AdjustTripStrategy.js renamed to src/main/resources/static/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS1.js
| 1 | -//------------------ 策略模块(以下) -----------------// | ||
| 2 | - | 1 | +/** |
| 2 | + * 发车间隔调整策略1。 | ||
| 3 | + * 不考虑停站,吃饭时间的问题,直接调整发车间隔 | ||
| 4 | + * 1、发车间隔调整规则: | ||
| 5 | + * (1)、从班次列表头开始,连续取3个班次,获取2个间隔,根据中间班次的情况,调整它的发车时间 | ||
| 6 | + * (2)、如果中间班次在低谷,并且发车间隔大于晚高峰最大发车间隔,中间班次调整-1分钟 | ||
| 7 | + * (3)、如果第一个间隔与第二个间隔相差1分钟,不调整 | ||
| 8 | + * (4)、如果第一个间隔大于第二个间隔,则中间班次发车时间-1分钟 | ||
| 9 | + * (5)、如果第一个间隔小于第二个间隔,则中间班次发车时间+1分钟 | ||
| 10 | + * 2、使用方法 | ||
| 11 | + * (1)、上行班次列表平衡5次 | ||
| 12 | + * (2)、下行班次列表平衡5次 | ||
| 13 | + * (3)、路牌班次调整1次(调整停站时间,吃饭时间) | ||
| 14 | + * (4)、上行班次列表平衡5次 | ||
| 15 | + * (5)、下行班次列表平衡5次 | ||
| 16 | + * | ||
| 17 | + * | ||
| 18 | + * TODO:存在的问题,待解决 | ||
| 19 | + * (1)、行驶时间还是不够,就是平衡的时候的停站时间不够,吃饭时间也不够 | ||
| 20 | + * (2)、发车间隔还是有问题,超出范围,添加多个发车间隔时间段 | ||
| 21 | + */ | ||
| 3 | var AdjustTripS1 = (function() { | 22 | var AdjustTripS1 = (function() { |
| 4 | 23 | ||
| 5 | function _f1(aBc, schedule, paramObj, fre) { | 24 | function _f1(aBc, schedule, paramObj, fre) { |
| @@ -138,47 +157,4 @@ var AdjustTripS1 = (function() { | @@ -138,47 +157,4 @@ var AdjustTripS1 = (function() { | ||
| 138 | } | 157 | } |
| 139 | 158 | ||
| 140 | return f1; | 159 | 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 | }()); | 160 | }()); |
| 185 | \ No newline at end of file | 161 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v2/strategy/adjust/AdjustTripS2.js
0 → 100644
| 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 | +}()); | ||
| 0 | \ 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
0 → 100644
| 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 | +} ()); | ||
| 0 | \ 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
0 → 100644
| 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 | +} ()); | ||
| 0 | \ No newline at end of file | 313 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/paramadd.html
| @@ -38,8 +38,12 @@ | @@ -38,8 +38,12 @@ | ||
| 38 | </div> | 38 | </div> |
| 39 | 39 | ||
| 40 | <div class="modal-footer"> | 40 | <div class="modal-footer"> |
| 41 | - <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 42 | - <button type="button" class="btn btn-primary" id="paramnext">确定</button> | 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> | ||
| 43 | </div> | 47 | </div> |
| 44 | 48 | ||
| 45 | </div> | 49 | </div> |
| @@ -367,16 +371,33 @@ | @@ -367,16 +371,33 @@ | ||
| 367 | </div> | 371 | </div> |
| 368 | 372 | ||
| 369 | <div class="col-md-6"> | 373 | <div class="col-md-6"> |
| 370 | - <label class="control-label col-md-5"> | ||
| 371 | - <span class="required"> * </span> 建议高峰配车数 :</label> | ||
| 372 | - <div class="col-md-5"> | ||
| 373 | - <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" | ||
| 374 | - id="gfjypcsInput" min="1" value="{{map.gfjypcs}}"> | 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> | ||
| 375 | </div> | 394 | </div> |
| 376 | </div> | 395 | </div> |
| 377 | 396 | ||
| 397 | + | ||
| 378 | </div> | 398 | </div> |
| 379 | 399 | ||
| 400 | + | ||
| 380 | <!-- 隐藏字段-时间 --> | 401 | <!-- 隐藏字段-时间 --> |
| 381 | <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/> | 402 | <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/> |
| 382 | <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/> | 403 | <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/> |
| @@ -402,7 +423,10 @@ | @@ -402,7 +423,10 @@ | ||
| 402 | </script> | 423 | </script> |
| 403 | 424 | ||
| 404 | <script type="text/javascript"> | 425 | <script type="text/javascript"> |
| 405 | - $('#paramadd_mobal').on('paramAddMobal.show', function(e, g_){ | 426 | + $('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun){ |
| 427 | + | ||
| 428 | + var _mainFun = mainFun; | ||
| 429 | + | ||
| 406 | // 加载延迟200毫秒显示mobal | 430 | // 加载延迟200毫秒显示mobal |
| 407 | setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | 431 | setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); |
| 408 | var param = JSON.parse(window.localStorage.Gantt_AgursData); | 432 | var param = JSON.parse(window.localStorage.Gantt_AgursData); |
| @@ -413,7 +437,16 @@ | @@ -413,7 +437,16 @@ | ||
| 413 | var paramAlert = $('.alert-danger', form); | 437 | var paramAlert = $('.alert-danger', form); |
| 414 | // 确定事件点击 | 438 | // 确定事件点击 |
| 415 | $('#paramnext').on('click', function() { | 439 | $('#paramnext').on('click', function() { |
| 416 | - form.submit();// 表单提交 | 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("确定"); | ||
| 417 | }); | 450 | }); |
| 418 | 451 | ||
| 419 | // 表单验证 | 452 | // 表单验证 |
| @@ -461,7 +494,9 @@ | @@ -461,7 +494,9 @@ | ||
| 461 | 'upInMileage' : {number : true},// 上行进场里程,必须为数字. | 494 | 'upInMileage' : {number : true},// 上行进场里程,必须为数字. |
| 462 | 'upOutMileage' : {number : true},// 上行出场里程,必须为数字. | 495 | 'upOutMileage' : {number : true},// 上行出场里程,必须为数字. |
| 463 | 'downInMileage' : {number : true},// 下行进场里程,必须为数字. | 496 | 'downInMileage' : {number : true},// 下行进场里程,必须为数字. |
| 464 | - 'downOutMileage' : {number : true}// 下行出场里程,必须为数字. | 497 | + 'downOutMileage' : {number : true}, // 下行出场里程,必须为数字. |
| 498 | + | ||
| 499 | + 'strategy' : {required : true} // 生成策略标识 | ||
| 465 | 500 | ||
| 466 | // TODO | 501 | // TODO |
| 467 | }, | 502 | }, |
| @@ -504,8 +539,9 @@ | @@ -504,8 +539,9 @@ | ||
| 504 | var dataMap = pp[1]; | 539 | var dataMap = pp[1]; |
| 505 | var csMap = getCSMap(paramObj); | 540 | var csMap = getCSMap(paramObj); |
| 506 | // console.log(graph); | 541 | // console.log(graph); |
| 507 | - var data = Main_v2.BXPplaceClassesTime03(paramObj, csMap.maxCar); | ||
| 508 | - Main_v2.exportDataConfig(data.aInternalLpObj); | 542 | + |
| 543 | + var data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar); | ||
| 544 | + _mainFun.exportDataConfig(data.aInternalLpObj); | ||
| 509 | 545 | ||
| 510 | // var data = obj.getDataArray(); | 546 | // var data = obj.getDataArray(); |
| 511 | // // 2、 调整路牌对应的班次总数 | 547 | // // 2、 调整路牌对应的班次总数 |
| @@ -539,6 +575,8 @@ | @@ -539,6 +575,8 @@ | ||
| 539 | 575 | ||
| 540 | // 线路规划类型 | 576 | // 线路规划类型 |
| 541 | $('#linePlayType_id').val(param.linePlayType); | 577 | $('#linePlayType_id').val(param.linePlayType); |
| 578 | + // 策略类型 | ||
| 579 | + $('#strategy_id').val(param.strategy || "AdjustTripS1"); | ||
| 542 | // 吃饭地点 | 580 | // 吃饭地点 |
| 543 | $get('/stationroute/all', { | 581 | $get('/stationroute/all', { |
| 544 | 'line.id_eq': param.lineName.split('_')[0], | 582 | 'line.id_eq': param.lineName.split('_')[0], |
| @@ -590,348 +628,356 @@ | @@ -590,348 +628,356 @@ | ||
| 590 | $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | 628 | $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); |
| 591 | 629 | ||
| 592 | }); | 630 | }); |
| 593 | - }); | ||
| 594 | 631 | ||
| 595 | - function initTagsinput(htmlStr) { | ||
| 596 | - $('#masterStop_id').html(htmlStr); | ||
| 597 | 632 | ||
| 598 | - var elt = $('#stoptype_tagsinput'); | ||
| 599 | - var value = elt.val(); | ||
| 600 | - var stoptype = value.split("/")[0]; | ||
| 601 | - var masterstop = value.split("/")[1]; | ||
| 602 | 633 | ||
| 603 | - $('#stopType_id').val(stoptype); | ||
| 604 | - $('#masterStop_id').val(masterstop); | 634 | + //--------------------- 其他方法 ------------------------// |
| 605 | 635 | ||
| 606 | - elt.tagsinput({ | ||
| 607 | - tagClass: function(item) { | ||
| 608 | - return 'label label-danger label-important'; | ||
| 609 | - }, | ||
| 610 | - itemValue: 'value', | ||
| 611 | - itemText: 'text' | ||
| 612 | - }); | 636 | + function initTagsinput(htmlStr) { |
| 637 | + $('#masterStop_id').html(htmlStr); | ||
| 613 | 638 | ||
| 614 | - $('#stoptype_tagsinput').on('beforeItemAdd', function(event) { | ||
| 615 | - // TODO:这里可以做一些逻辑判定 | ||
| 616 | - }); | 639 | + var elt = $('#stoptype_tagsinput'); |
| 640 | + var value = elt.val(); | ||
| 641 | + var stoptype = value.split("/")[0]; | ||
| 642 | + var masterstop = value.split("/")[1]; | ||
| 617 | 643 | ||
| 618 | - $('#stoptype_tagsinput_add').on('click', function(){ | ||
| 619 | - var stoptype = $("#stopType_id").val(); | ||
| 620 | - var masterstop = $("#masterStop_id").val(); | ||
| 621 | - var masterstop_text = $("#masterStop_id option:selected").text(); | 644 | + $('#stopType_id').val(stoptype); |
| 645 | + $('#masterStop_id').val(masterstop); | ||
| 622 | 646 | ||
| 623 | - if (stoptype && stoptype != "") { | ||
| 624 | - if (stoptype == "0" && masterstop && masterstop != "") { | ||
| 625 | - elt.tagsinput('add', { | ||
| 626 | - "value": stoptype + '/' + masterstop, | ||
| 627 | - "text": "主站停站" + "/" + masterstop_text | ||
| 628 | - }); | ||
| 629 | - } else { | ||
| 630 | - elt.tagsinput('add', { | ||
| 631 | - "value": 1, | ||
| 632 | - "text": "双向停站" | ||
| 633 | - }); | 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 | + } | ||
| 634 | } | 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 | + }); | ||
| 635 | } | 686 | } |
| 636 | - }); | ||
| 637 | 687 | ||
| 638 | - if (stoptype && stoptype != "") { | ||
| 639 | - elt.tagsinput('add', { | ||
| 640 | - "value": stoptype + '/' + masterstop, | ||
| 641 | - "text": | ||
| 642 | - $("#stopType_id option:selected").text() + "/" + | ||
| 643 | - $("#masterStop_id option:selected").text() | ||
| 644 | - }); | ||
| 645 | } | 688 | } |
| 646 | 689 | ||
| 647 | - } | 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 | + } | ||
| 648 | 701 | ||
| 649 | - function getMinDate(d1,d2) { | ||
| 650 | - // 1、定义返回字符串. | ||
| 651 | - var str = ''; | ||
| 652 | - // 2、判断时间大小. | ||
| 653 | - if(strToTime(d1)>strToTime(d2)) | ||
| 654 | - str = d2; | ||
| 655 | - else | ||
| 656 | - str = d1; | ||
| 657 | - // 3、返回最小时间(字符串). | ||
| 658 | - return str; | ||
| 659 | - } | 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 | + } | ||
| 660 | 711 | ||
| 661 | - function strToTime(t) { | ||
| 662 | - var d = new Date(); | ||
| 663 | - if(t) { | ||
| 664 | - var _str = t.split(':'); | ||
| 665 | - d.setHours(parseInt(_str[0])); | ||
| 666 | - d.setMinutes(parseInt(_str[1])); | 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; | ||
| 667 | } | 722 | } |
| 668 | - return d; | ||
| 669 | - } | ||
| 670 | 723 | ||
| 671 | - function getMaxDate(d1,d2) { | ||
| 672 | - // 1、定义返回时间字符串. | ||
| 673 | - var str = ''; | ||
| 674 | - // 2、判断时间大小. | ||
| 675 | - if(strToTime(d1)>strToTime(d2)) | ||
| 676 | - str = d1; | ||
| 677 | - else | ||
| 678 | - str = d2; | ||
| 679 | - // 3、返回一个最大时间(字符串). | ||
| 680 | - return str; | ||
| 681 | - } | 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 | + } | ||
| 682 | 733 | ||
| 683 | - function getEndDate(date) { | ||
| 684 | - var lastEndDate = Date.now(); | ||
| 685 | - if (date) { | ||
| 686 | - var str = date.replace(/-/g,"/"); | ||
| 687 | - lastEndDate = new Date(str); | 734 | + function formatPairing(v1,v2) { |
| 735 | + v1 = v1 == '' ? 0 : parseInt(v1); | ||
| 736 | + v2 = v2 == ''? 0 : parseInt(v2) ; | ||
| 737 | + return [v1,v2]; | ||
| 688 | } | 738 | } |
| 689 | - // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间) | ||
| 690 | - return lastEndDate; | ||
| 691 | - } | ||
| 692 | 739 | ||
| 693 | - function formatPairing(v1,v2) { | ||
| 694 | - v1 = v1 == '' ? 0 : parseInt(v1); | ||
| 695 | - v2 = v2 == ''? 0 : parseInt(v2) ; | ||
| 696 | - return [v1,v2]; | ||
| 697 | - } | 740 | + function qzdz(zd1,zd2) { |
| 741 | + return [zd1,zd2]; | ||
| 742 | + } | ||
| 698 | 743 | ||
| 699 | - function qzdz(zd1,zd2) { | ||
| 700 | - return [zd1,zd2]; | ||
| 701 | - } | 744 | + function formatksjssj(gp) { |
| 745 | + return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}]; | ||
| 746 | + } | ||
| 702 | 747 | ||
| 703 | - function formatksjssj(gp) { | ||
| 704 | - return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}]; | ||
| 705 | - } | 748 | + function getsd(st,ed) { |
| 749 | + return [{'st':st,'ed':ed}]; | ||
| 750 | + } | ||
| 706 | 751 | ||
| 707 | - function getsd(st,ed) { | ||
| 708 | - return [{'st':st,'ed':ed}]; | ||
| 709 | - } | 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 | + } | ||
| 710 | 762 | ||
| 711 | - function getDateTime(time) { | ||
| 712 | - var dateTime = new Date(); | ||
| 713 | - var timeArr; | ||
| 714 | - if(time !=null && time !='' && typeof(time) !='undefined') { | ||
| 715 | - timeArr = time.split(':'); | ||
| 716 | - dateTime.setHours(parseInt(timeArr[0])); | ||
| 717 | - dateTime.setMinutes(parseInt(timeArr[1])); | 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; | ||
| 718 | } | 771 | } |
| 719 | - return dateTime; | ||
| 720 | - } | ||
| 721 | 772 | ||
| 722 | - function getYAxisCarArray(len) { | ||
| 723 | - var array = new Array(); | ||
| 724 | - if(len>0) { | ||
| 725 | - for(var y = 0; y<len; y++) { | ||
| 726 | - array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象 | 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' | ||
| 727 | }; | 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 | + | ||
| 728 | } | 863 | } |
| 729 | - return array; | ||
| 730 | - } | ||
| 731 | 864 | ||
| 732 | - function getylp(arr) { | ||
| 733 | - var ra = new Array(),name = new Array(); | ||
| 734 | - for(var i = 0 ; i<arr.length;i++) { | ||
| 735 | - ra.push(arr[i].lpNo); | ||
| 736 | - name.push(arr[i].lpName); | 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()))}; | ||
| 737 | } | 872 | } |
| 738 | - return {'lpNoA':ra,'lpNameA':name,}; | ||
| 739 | - } | ||
| 740 | 873 | ||
| 741 | - function getParamObjAndDataMap() { | ||
| 742 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 743 | - // seMap | ||
| 744 | - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 745 | - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 746 | - // dirA | ||
| 747 | - var dirA = ['relationshipGraph-up', 'relationshipGraph-down']; | ||
| 748 | - // bcTypeArr | ||
| 749 | - var bcTypeArr = { | ||
| 750 | - 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc', | ||
| 751 | - 'major': 'major', 'venting': 'venting', 'region': 'region' | ||
| 752 | - }; | ||
| 753 | - // seDate | ||
| 754 | - var newDate = new Date(); | ||
| 755 | - var kssj = d3.time.hour.offset(getEndDate( | ||
| 756 | - newDate.getFullYear()+ "-" + | ||
| 757 | - (newDate.getMonth()+1) + "-" + | ||
| 758 | - newDate.getDate() + ' ' + | ||
| 759 | - seMap.s.split(':')[0] + ':00'),-1); | ||
| 760 | - | ||
| 761 | - var year = '' , month = '',dt = ''; | ||
| 762 | - if(newDate.getDate()+1>31) | ||
| 763 | - dt = '01'; | ||
| 764 | - else | ||
| 765 | - dt = newDate.getDate()+1; | ||
| 766 | - if(newDate.getMonth()+1>12) | ||
| 767 | - month = '01'; | ||
| 768 | - else if(newDate.getDate()+1>31) | ||
| 769 | - month = newDate.getMonth()+2; | ||
| 770 | - else | ||
| 771 | - month = newDate.getMonth()+1; | ||
| 772 | - if(newDate.getMonth()+1>12) | ||
| 773 | - year = newDate.getFullYear()+1; | ||
| 774 | - else | ||
| 775 | - year = newDate.getFullYear(); | ||
| 776 | - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 777 | - seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 778 | - | ||
| 779 | - // dataMap | ||
| 780 | - var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下] | ||
| 781 | - 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下] | ||
| 782 | - 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下] | ||
| 783 | - 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下] | ||
| 784 | - 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下] | ||
| 785 | - 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime, | ||
| 786 | - map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下] | ||
| 787 | - 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime, | ||
| 788 | - map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下] | ||
| 789 | - 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下] | ||
| 790 | - 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下] | ||
| 791 | - 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下] | ||
| 792 | - 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚] | ||
| 793 | - 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间] | ||
| 794 | - 'zgfsjd' : getsd(getDateTime(map.earlyStartTime), | ||
| 795 | - getDateTime(map.earlyEndTime)), // 早高峰时间段 | ||
| 796 | - 'wgfsjd' : getsd(getDateTime(map.lateStartTime), | ||
| 797 | - getDateTime(map.lateEndTime)),// 晚高峰时间段 | ||
| 798 | - 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime), | ||
| 799 | - getDateTime(map.lateStartTime)),//高峰之间时间段. | ||
| 800 | - 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime), | ||
| 801 | - getDateTime(seMap.e)),// 晚高峰之后时间段 | ||
| 802 | - 'zgfzqsjd': getsd(getDateTime(seMap.s), | ||
| 803 | - getDateTime(map.earlyStartTime)),//早高峰之前时间段. | ||
| 804 | - 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下] | ||
| 805 | - 'bcTypeArr' : bcTypeArr,// 班次类型 | ||
| 806 | - 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间. | ||
| 807 | - // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间. | ||
| 808 | - // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间. | ||
| 809 | - // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间. | ||
| 810 | - 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间. | ||
| 811 | - 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间. | ||
| 812 | - 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间. | ||
| 813 | - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙. | ||
| 814 | - 'map' : map, | ||
| 815 | - 'zzsj':map.zzsj,// 周转时间. | ||
| 816 | - }; | ||
| 817 | - | ||
| 818 | - var _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap); | ||
| 819 | - map.clzs = _paramObj.calcuClzx(); | ||
| 820 | - return [_paramObj, dataMap]; | 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 | + } | ||
| 821 | 978 | ||
| 822 | - } | ||
| 823 | 979 | ||
| 824 | - function getCSMap(parmObj) { | ||
| 825 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 826 | - return {'gattA':null, | ||
| 827 | - 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) , | ||
| 828 | - 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()), | ||
| 829 | - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)}, | ||
| 830 | - 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))}; | ||
| 831 | - } | ||
| 832 | 980 | ||
| 833 | - function getGraphArgus(CSMap, dataMap, data) { | ||
| 834 | - // TODO | ||
| 835 | - var map = JSON.parse(window.localStorage.Gantt_AgursData); | ||
| 836 | - var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 837 | - | ||
| 838 | - // seMap | ||
| 839 | - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 840 | - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)}; | ||
| 841 | - | ||
| 842 | - // seDate | ||
| 843 | - var newDate = new Date(); | ||
| 844 | - var kssj = d3.time.hour.offset(getEndDate( | ||
| 845 | - newDate.getFullYear()+ "-" + | ||
| 846 | - (newDate.getMonth()+1) + "-" + | ||
| 847 | - newDate.getDate() + ' ' + | ||
| 848 | - seMap.s.split(':')[0] + ':00'),-1); | ||
| 849 | - | ||
| 850 | - var year = '' , month = '',dt = ''; | ||
| 851 | - if(newDate.getDate()+1>31) | ||
| 852 | - dt = '01'; | ||
| 853 | - else | ||
| 854 | - dt = newDate.getDate()+1; | ||
| 855 | - if(newDate.getMonth()+1>12) | ||
| 856 | - month = '01'; | ||
| 857 | - else if(newDate.getDate()+1>31) | ||
| 858 | - month = newDate.getMonth()+2; | ||
| 859 | - else | ||
| 860 | - month = newDate.getMonth()+1; | ||
| 861 | - if(newDate.getMonth()+1>12) | ||
| 862 | - year = newDate.getFullYear()+1; | ||
| 863 | - else | ||
| 864 | - year = newDate.getFullYear(); | ||
| 865 | - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | ||
| 866 | - seDate = {'kssj' : kssj, 'jssj' : jssj}; | ||
| 867 | - | ||
| 868 | - | ||
| 869 | - var bs = sxsj > 40 ? 4 : 2; | ||
| 870 | - var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs; | ||
| 871 | - var VALUEKEYNAME = 'Worldwide Gross' , | ||
| 872 | - DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240, | ||
| 873 | - MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60, | ||
| 874 | - STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true; | ||
| 875 | - var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ; | ||
| 876 | - // 计算出相差天数 | ||
| 877 | - var days=Math.floor(dx_time/(24*3600*1000)); | ||
| 878 | - // 计算出小时数 | ||
| 879 | - var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数 | ||
| 880 | - var hours=Math.floor(leave1/(3600*1000)); | ||
| 881 | - DXHOURS = days*24+hours; | ||
| 882 | - WIDTH = DXHOURS*MINUTE*MULTIPLE; | ||
| 883 | - // debugger; | ||
| 884 | - var lpsplitA = getylp(CSMap.maxCar); | ||
| 885 | - | ||
| 886 | - var sxsj = parseInt(map.upTravelTime);// 上行时间. | ||
| 887 | - var xxsj = parseInt(map.downTravelTime);// 下行时间. | ||
| 888 | - var stopAraay = [{ | ||
| 889 | - 'sxsj':sxsj,// 上行时间. | ||
| 890 | - 'xxsj':xxsj,// 下行时间. | ||
| 891 | - 'zzsj':map.zzsj,// 周转时间. | ||
| 892 | - 'wcsj':parseInt(map.workeLunch),// 午餐时间. | ||
| 893 | - 'wcsj':parseInt(map.workeDinner),// 晚餐时间. | ||
| 894 | - 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间. | ||
| 895 | - 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间. | ||
| 896 | - 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间. | ||
| 897 | - 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间. | ||
| 898 | - 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间. | ||
| 899 | - 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间. | ||
| 900 | - 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间. | ||
| 901 | - 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间. | ||
| 902 | - 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程. | ||
| 903 | - 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程. | ||
| 904 | - 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程. | ||
| 905 | - 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程. | ||
| 906 | - 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间. | ||
| 907 | - }]; | ||
| 908 | - | ||
| 909 | - var args = { | ||
| 910 | - 'valueKeyName': VALUEKEYNAME, | ||
| 911 | - 'hours' : DXHOURS, | ||
| 912 | - 'dxHours' : 24 - DXHOURS, | ||
| 913 | - 'multiple': MULTIPLE, | ||
| 914 | - 'width':WIDTH, | ||
| 915 | - 'widtMargin':MARGINLEFT, | ||
| 916 | - 'height':HEIGHT, | ||
| 917 | - 'heightMargin':MARGINBOTTOM, | ||
| 918 | - 'offsetX':OFFSETX, | ||
| 919 | - 'offsetY':OFFSETY, | ||
| 920 | - 'downDy':OFFSETDOWNY, | ||
| 921 | - 'upDy':OFFSETUPY, | ||
| 922 | - 'timeDomainStart' :STARTDATETIME, | ||
| 923 | - 'timeDomainEnd' : ENDDATETIME, | ||
| 924 | - 'startStr':'' + STARTDATETIME, | ||
| 925 | - 'endStr': '' +ENDDATETIME, | ||
| 926 | - 'taskTypes': TASKTYPES, | ||
| 927 | - 'lpNoA':lpsplitA.lpNoA, | ||
| 928 | - 'lpNameA':lpsplitA.lpNameA, | ||
| 929 | - 'tickFormat': TICKFORMAT, | ||
| 930 | - 'stopAraay' : stopAraay, | ||
| 931 | - 'dataMap':dataMap, | ||
| 932 | - 'showTooltips': SHOWTOOLTIPS, | ||
| 933 | - 'bxrcgs':data.bxrcgs | ||
| 934 | - } | ||
| 935 | - return args; | ||
| 936 | - } | 981 | + }); |
| 982 | + | ||
| 937 | </script> | 983 | </script> |
| 938 | \ 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/pages/trafficManage/timeTempletUpload.html
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | <form class="form-inline" action=""> | 10 | <form class="form-inline" action=""> |
| 11 | <div style="display: inline-block;" class="param"> | 11 | <div style="display: inline-block;" class="param"> |
| 12 | <span class="item-label" style="width: 80px;">线路: </span> | 12 | <span class="item-label" style="width: 80px;">线路: </span> |
| 13 | - <select class="form-control" name="xl.lineCode_like" id="line" style="width: 180px;"></select> | 13 | + <select class="form-control" name="xl.id_eq" id="line" style="width: 180px;"></select> |
| 14 | </div> | 14 | </div> |
| 15 | <div style="display: inline-block;margin-left: 15px;" class="param"> | 15 | <div style="display: inline-block;margin-left: 15px;" class="param"> |
| 16 | <span class="item-label" style="width: 80px;">模板名称(关键字): </span> | 16 | <span class="item-label" style="width: 80px;">模板名称(关键字): </span> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html
| @@ -659,9 +659,10 @@ | @@ -659,9 +659,10 @@ | ||
| 659 | else if(ai==-1 && bi!=-1) | 659 | else if(ai==-1 && bi!=-1) |
| 660 | return 1; | 660 | return 1; |
| 661 | else | 661 | else |
| 662 | - return a.name.localeCompare(b.name); | 662 | + return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN'); |
| 663 | }); | 663 | }); |
| 664 | 664 | ||
| 665 | + /** | ||
| 665 | /*var rs = {}; | 666 | /*var rs = {}; |
| 666 | $.each(array, function () { | 667 | $.each(array, function () { |
| 667 | rs[this.code]=this.name; | 668 | rs[this.code]=this.name; |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/temp_sch/main.html
| @@ -300,7 +300,7 @@ | @@ -300,7 +300,7 @@ | ||
| 300 | else if(ai==-1 && bi!=-1) | 300 | else if(ai==-1 && bi!=-1) |
| 301 | return 1; | 301 | return 1; |
| 302 | else | 302 | else |
| 303 | - return a.name.localeCompare(b.name); | 303 | + return $.trim(a.name).localeCompare($.trim(b.name), 'zh-CN'); |
| 304 | }); | 304 | }); |
| 305 | return array; | 305 | return array; |
| 306 | } | 306 | } |
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
| @@ -144,7 +144,7 @@ var gb_schedule_context_menu = (function () { | @@ -144,7 +144,7 @@ var gb_schedule_context_menu = (function () { | ||
| 144 | jgtz: function (schArray) { | 144 | jgtz: function (schArray) { |
| 145 | //忽略进出场班次 | 145 | //忽略进出场班次 |
| 146 | schArray = schArray.filter(function (sch) { | 146 | schArray = schArray.filter(function (sch) { |
| 147 | - return sch.bcType != 'in' && sch.bcType != 'out'; | 147 | + return sch.bcType != 'in' && sch.bcType != 'out' && sch.status!=-1; |
| 148 | }); | 148 | }); |
| 149 | 149 | ||
| 150 | var idArr = [], qdz = schArray[0].qdzCode; | 150 | var idArr = [], qdz = schArray[0].qdzCode; |
| @@ -153,7 +153,7 @@ var gb_schedule_context_menu = (function () { | @@ -153,7 +153,7 @@ var gb_schedule_context_menu = (function () { | ||
| 153 | idArr.push(this.id); | 153 | idArr.push(this.id); |
| 154 | }); | 154 | }); |
| 155 | 155 | ||
| 156 | - var ps = '<div class="ps-help-panel"><small>1、忽略进出场班次</small><small>2、与选中的第一个班次起点站不同的也将被忽略</small></div>'; | 156 | + var ps = '<div class="ps-help-panel"><small>1、忽略进出场班次</small><small>2、与选中的第一个班次起点站不同的也将被忽略</small><small>3、忽略烂班</small></div>'; |
| 157 | var elem = UIkit.modal.prompt('请输入间隔(分钟)' + ps, 0, function (newValue) { | 157 | var elem = UIkit.modal.prompt('请输入间隔(分钟)' + ps, 0, function (newValue) { |
| 158 | if (!isNaN(newValue) && newValue > 0) { | 158 | if (!isNaN(newValue) && newValue > 0) { |
| 159 | gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) { | 159 | gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) { |
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 | -})(); |