Commit bff0718aa2a8d5c48416b62a10eb4e886ecd97e4

Authored by 潘钊
2 parents c6de4555 52cf1396

Merge branch 'pudong' into jiading 0307

Showing 116 changed files with 7916 additions and 6090 deletions
src/main/java/com/bsth/XDApplication.java
... ... @@ -161,7 +161,7 @@ public class XDApplication implements CommandLineRunner {
161 161 sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
162 162 sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
163 163 sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
164   - sexec.scheduleWithFixedDelay(directivesPstThread, 180, 120, TimeUnit.SECONDS);//调度指令延迟入库
  164 + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
165 165 sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
166 166 sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
167 167 sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新
... ...
src/main/java/com/bsth/controller/SectionRouteController.java
... ... @@ -37,14 +37,22 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer
37 37 SectionRouteService routeService;
38 38  
39 39 /**
40   - * @param String
  40 + * @param map
41 41 * @throws
42 42 * @Description: TODO(批量撤销路段)
43 43 */
44   - @RequestMapping(value = "/batchDestroy", method = RequestMethod.GET)
  44 + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST)
45 45 public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) {
46 46 return routeService.updateSectionRouteInfoFormId(map);
47 47 }
  48 + /**
  49 + * @param id //路段路由id
  50 + * @Description: TODO(撤销路段)
  51 + */
  52 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  53 + public Map<String, Object> destroy(@RequestParam Integer id) {
  54 + return routeService.destroy(id);
  55 + }
48 56  
49 57 /**
50 58 * @param @param map
... ...
src/main/java/com/bsth/controller/StationRouteController.java
... ... @@ -137,6 +137,18 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
137 137 public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
138 138 return service.getStationRouteCenterPoints(map);
139 139 }
  140 +
  141 + /**
  142 + * @Description :TODO(查询线路某方向下所有站点)
  143 + *
  144 + * @param map <lineId:线路ID; direction:方向>
  145 + *
  146 + * @return List<Map<String, Object>>
  147 + */
  148 + @RequestMapping(value = "/getStationRouteList" , method = RequestMethod.GET)
  149 + public List<Map<String, Object>> getStationRouteList(@RequestParam Map<String, Object> map) {
  150 + return service.getStationRouteList(map);
  151 + }
140 152  
141 153 /**
142 154 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
... ...
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java renamed to src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4   -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
5   -import com.bsth.data.msg_queue.DirectivePushQueue;
6   -import com.bsth.data.msg_queue.WebSocketPushQueue;
7   -import com.bsth.data.schedule.DayOfSchedule;
8   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.web.bind.annotation.RequestMapping;
13   -import org.springframework.web.bind.annotation.RequestMethod;
14   -import org.springframework.web.bind.annotation.RequestParam;
15   -import org.springframework.web.bind.annotation.RestController;
16   -
17   -import java.util.HashMap;
18   -import java.util.List;
19   -import java.util.Map;
20   -
21   -/**
22   - * Created by panzhao on 2017/4/14.
23   - */
24   -@RestController
25   -@RequestMapping("anomalyCheck")
26   -public class anomalyCheckController {
27   -
28   -
29   - Logger logger = LoggerFactory.getLogger(this.getClass());
30   -
31   - @Autowired
32   - DayOfSchedule dayOfSchedule;
33   -
34   - @Autowired
35   - GeoCacheData geoCacheData;
36   -
37   - /**
38   - * 出现重复班次的车辆
39   - * @param nbbm
40   - */
41   - @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
42   - public void schRepeat(@RequestParam String nbbm){
43   - logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
44   - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
45   - logger.info("检测前,车辆班次数量:" + list.size());
46   -
47   - Map<Long, ScheduleRealInfo> map = new HashMap<>();
48   - for(ScheduleRealInfo sch : list){
49   - if(map.containsKey(sch.getId())){
50   - logger.info("检测到重复ID: " + sch.getId());
51   - }
52   - map.put(sch.getId(), sch);
53   - }
54   -
55   - logger.info("检测后,车辆班次数量:" + list.size());
56   - if(map.values().size() > 0){
57   - dayOfSchedule.replaceByNbbm(nbbm, map.values());
58   - }
59   - }
60   -
61   - @RequestMapping(value = "/directivePushQueue")
62   - public void directivePushQueue(){
63   - DirectivePushQueue.start();
64   - }
65   -
66   - @RequestMapping(value = "/directiveQueueSize")
67   - public void directiveQueueSize(){
68   - DirectivePushQueue.size();
69   - }
70   -
71   - @RequestMapping(value = "/webSocketPushQueue")
72   - public void webSocketPushQueue(){
73   - WebSocketPushQueue.start();
74   - }
75   -
76   - @RequestMapping(value = "/webSocketQueueSize")
77   - public void webSocketQueueSize(){
78   - WebSocketPushQueue.size();
79   - }
80   -
81   - @RequestMapping(value = "/setHttpFlag")
82   - public void setHttpFlag(@RequestParam int flag){
83   - if(flag != 0 && flag != -1)
84   - return;
85   - GpsDataLoaderThread.setFlag(flag);
86   - }
87   -
88   - @RequestMapping(value = "/updateCacheBuff")
89   - public void updateCacheBuff(){
90   - geoCacheData.loadData();
91   - }
92   -
93   - @RequestMapping(value = "/reCalcLpSch")
94   - public void reCalcLpSch(){
95   - dayOfSchedule._test_reCalcLpSch();
96   - }
97   -
98   - @RequestMapping(value = "/findSchByLpName")
99   - public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
100   - return dayOfSchedule.getLpScheduleMap().get(lpName);
101   - }
102   -
103   - @RequestMapping(value = "/findSchByNbbm")
104   - public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){
105   - return dayOfSchedule.findByNbbm(nbbm);
106   - }
107   -
108   - @RequestMapping(value = "/removeExecPlan")
109   - public int removeExecPlan(@RequestParam String nbbm){
110   - dayOfSchedule.removeExecPlan(nbbm);
111   - return 1;
112   - }
113   -
114   - @RequestMapping(value = "/sch_re_calc_id_maps")
115   - public int reCalcIdMaps(){
116   - return dayOfSchedule.reCalcIdMaps();
117   - }
118   -
119   - @RequestMapping(value = "/sch_size_string")
120   - public String schSizeString(){
121   - return dayOfSchedule.sizeString();
122   - }
123   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.directive.DayOfDirectives;
  4 +import com.bsth.data.directive.DirectivesPstThread;
  5 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  6 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  7 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  8 +import com.bsth.data.msg_queue.DirectivePushQueue;
  9 +import com.bsth.data.msg_queue.WebSocketPushQueue;
  10 +import com.bsth.data.pilot80.PilotReport;
  11 +import com.bsth.data.schedule.DayOfSchedule;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.websocket.handler.SendUtils;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RequestParam;
  19 +import org.springframework.web.bind.annotation.RestController;
  20 +
  21 +import java.util.HashMap;
  22 +import java.util.List;
  23 +import java.util.Map;
  24 +
  25 +/**
  26 + * Created by panzhao on 2017/4/14.
  27 + */
  28 +@RestController
  29 +@RequestMapping("adminUtils")
  30 +public class AdminUtilsController {
  31 +
  32 +
  33 + Logger logger = LoggerFactory.getLogger(this.getClass());
  34 +
  35 + @Autowired
  36 + DayOfSchedule dayOfSchedule;
  37 +
  38 + @Autowired
  39 + GeoCacheData geoCacheData;
  40 +
  41 + @Autowired
  42 + DayOfDirectives dayOfDirectives;
  43 +
  44 + @Autowired
  45 + SendUtils sendUtils;
  46 +
  47 + @Autowired
  48 + PilotReport pilotReport;
  49 +
  50 + /**
  51 + * 出现重复班次的车辆
  52 + * @param
  53 +
  54 + @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
  55 + public void schRepeat(@RequestParam String nbbm){
  56 + logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
  57 + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
  58 + logger.info("检测前,车辆班次数量:" + list.size());
  59 +
  60 + Map<Long, ScheduleRealInfo> map = new HashMap<>();
  61 + for(ScheduleRealInfo sch : list){
  62 + if(map.containsKey(sch.getId())){
  63 + logger.info("检测到重复ID: " + sch.getId());
  64 + }
  65 + map.put(sch.getId(), sch);
  66 + }
  67 +
  68 + logger.info("检测后,车辆班次数量:" + list.size());
  69 + if(map.values().size() > 0){
  70 + dayOfSchedule.replaceByNbbm(nbbm, map.values());
  71 + }
  72 + }*/
  73 +
  74 +/* @RequestMapping(value = "/directivePushQueue")
  75 + public void directivePushQueue(){
  76 + DirectivePushQueue.start();
  77 + }*/
  78 +
  79 + @RequestMapping(value = "/directiveQueueSize")
  80 + public void directiveQueueSize(){
  81 + DirectivePushQueue.size();
  82 + }
  83 +
  84 + /*@RequestMapping(value = "/webSocketPushQueue")
  85 + public void webSocketPushQueue(){
  86 + WebSocketPushQueue.start();
  87 + }*/
  88 +
  89 + @RequestMapping(value = "/webSocketQueueSize")
  90 + public void webSocketQueueSize(){
  91 + WebSocketPushQueue.size();
  92 + }
  93 +
  94 + @RequestMapping(value = "/setHttpFlag")
  95 + public void setHttpFlag(@RequestParam int flag){
  96 + if(flag != 0 && flag != -1)
  97 + return;
  98 + GpsDataLoaderThread.setFlag(flag);
  99 + }
  100 +
  101 + @RequestMapping(value = "/updateCacheBuff")
  102 + public void updateCacheBuff(){
  103 + geoCacheData.loadData();
  104 + }
  105 +
  106 + @RequestMapping(value = "/reCalcLpSch")
  107 + public void reCalcLpSch(){
  108 + dayOfSchedule._test_reCalcLpSch();
  109 + }
  110 +
  111 + @RequestMapping(value = "/findSchByLpName")
  112 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
  113 + return dayOfSchedule.getLpScheduleMap().get(lpName);
  114 + }
  115 +
  116 + @RequestMapping(value = "/findSchByNbbm")
  117 + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){
  118 + return dayOfSchedule.findByNbbm(nbbm);
  119 + }
  120 +
  121 + @RequestMapping(value = "/removeExecPlan")
  122 + public int removeExecPlan(@RequestParam String nbbm){
  123 + dayOfSchedule.removeExecPlan(nbbm);
  124 + return 1;
  125 + }
  126 +
  127 + @RequestMapping(value = "/sch_re_calc_id_maps")
  128 + public int reCalcIdMaps(){
  129 + return dayOfSchedule.reCalcIdMaps();
  130 + }
  131 +
  132 + @RequestMapping(value = "/sch_size_string")
  133 + public String schSizeString(){
  134 + return dayOfSchedule.sizeString();
  135 + }
  136 +
  137 + @RequestMapping(value = "/containerSize")
  138 + public Map<String, Integer> containerSize(){
  139 + Map<String, Integer> rs = new HashMap<>();
  140 + rs.put("60_size", dayOfDirectives.all60().size());
  141 + rs.put("80_size", pilotReport.findAll().size());
  142 + rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
  143 + rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
  144 + rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
  145 + rs.put("pst_sch_size", dayOfSchedule.getPstSize());
  146 + rs.put("speeds_size", OverspeedProcess.size());
  147 + return rs;
  148 + }
  149 +
  150 + @RequestMapping(value = "/websocketRadioText")
  151 + public int radioText(String t, String lineCode){
  152 + sendUtils.sendRadioText(t, lineCode);
  153 + return 0;
  154 + }
  155 +
  156 + @Autowired
  157 + DirectivesPstThread directivesPstThread;
  158 +
  159 + @RequestMapping(value = "/_sd_60_pst")
  160 + public void sd_60_pst(){
  161 + logger.info("手动入库指令....");
  162 + directivesPstThread.run();
  163 + }
  164 +}
124 165 \ No newline at end of file
... ...
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
... ... @@ -194,15 +194,10 @@ public class ServiceDataInterface {
194 194 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
195 195 d60.setHttpCode(code);
196 196  
197   - if (code == 0) {
198   - // 添加到缓存
199   - dayOfDirectives.put60(d60, true);
200   - } else {
  197 + if (code != 0)
201 198 d60.setErrorText("网关通讯失败, code: " + code);
202   - d60Repository.save(d60);
203   - dayOfDirectives.put60(d60, false);
204   - }
205 199  
  200 + dayOfDirectives.put60(d60);
206 201 return d60.getMsgId();
207 202 }catch (Exception e){
208 203 logger.error("", e);
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
... ... @@ -16,6 +16,8 @@ import org.springframework.stereotype.Component;
16 16  
17 17 import java.util.*;
18 18 import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentLinkedQueue;
  20 +import java.util.concurrent.ConcurrentMap;
19 21  
20 22 /**
21 23 *
... ... @@ -29,16 +31,15 @@ import java.util.concurrent.ConcurrentHashMap;
29 31 public class DayOfDirectives {
30 32  
31 33 // 当日60指令缓存
32   - private static Map<Integer, D60> d60Map;
  34 + private static ConcurrentMap<Integer, D60> d60Map;
33 35  
34 36 // 线路切换指令 64
35   - public static Map<String, D64> d64Map;
36   -
37   - //等待C0_A4回复的用户
38   - //public static Map<K, V>
  37 + public static ConcurrentMap<String, D64> d64Map;
39 38  
40   - //等待入库的指令
41   - public static LinkedList<Directive> pstDirectives;
  39 + //等待插入的指令
  40 + public static ConcurrentLinkedQueue<Directive> pstDirectives;
  41 + //等待更新的指令
  42 + public static ConcurrentLinkedQueue<D60> pstD60s;
42 43  
43 44 @Autowired
44 45 DirectiveService directiveService;
... ... @@ -55,14 +56,14 @@ public class DayOfDirectives {
55 56 static{
56 57 d60Map = new ConcurrentHashMap<>();
57 58 d64Map = new ConcurrentHashMap<>();
58   - pstDirectives = new LinkedList<>();
  59 + pstDirectives = new ConcurrentLinkedQueue<>();
  60 + pstD60s = new ConcurrentLinkedQueue<>();
59 61 }
60 62  
61   - public void put60(D60 d60, boolean pst) {
  63 + public void put60(D60 d60) {
62 64 d60Map.put(d60.getMsgId(), d60);
63 65 //等待持久化
64   - if(pst)
65   - pstDirectives.add(d60);
  66 + pstDirectives.add(d60);
66 67 }
67 68  
68 69 public void put64(D64 d64) {
... ... @@ -102,9 +103,9 @@ public class DayOfDirectives {
102 103 d60.setReply47Time(System.currentTimeMillis());
103 104 break;
104 105 }
105   - // 等待持久化
106   - if(!pstDirectives.contains(d60))
107   - pstDirectives.add(d60);
  106 +
  107 + //更新60数据
  108 + pstD60s.add(d60);
108 109  
109 110 ScheduleRealInfo sch = d60.getSch();
110 111 if (null == sch)
... ... @@ -135,64 +136,20 @@ public class DayOfDirectives {
135 136 if (null == data)
136 137 logger.warn("64响应 data is null ,json: " + json);
137 138 else {
138   - d64.setRespAck(data.getShort("requestAck"));
139   - // 持久化
140   - if(!pstDirectives.contains(d64))
141   - pstDirectives.add(d64);
  139 + logger.info(d64.getDeviceId() + "_" + d64.getData().getLineId() + "响应:" + data.getShort("requestAck"));
  140 + /*d64.setRespAck(data.getShort("requestAck"));
  141 + // 持久化*/
  142 + //64 响应不入库了...
142 143 }
143 144 }
144 145 }
145 146  
146   -/* private void saveD60(D60 d60) {
147   - // 等47再入库
148   - if (d60.getReply47() == null)
149   - return;
150   -
151   - directiveService.save(d60);
152   - }*/
153   -
154   - public void clear(String device){
155   - int c60 = 0, c64 = 0;
156   -
157   - Collection<D60> d60s = d60Map.values();
158   - List<D60> rem60List = new ArrayList<>();
159   - for(D60 d60 : d60s){
160   - if(device.equals(d60.getDeviceId()))
161   - rem60List.add(d60);
162   - }
163   -
164   - //清除60数据
165   - for(D60 d60 : rem60List){
166   - if(d60.getReply47() == null)
167   - directiveService.save(d60);
168   - if(null != d60Map.remove(d60.getMsgId()))
169   - c60 ++;
170   - }
171   -
172   - rem60List.clear();
173   - if(c60 > 0)
174   - logger.info("清除60数据 ," + c60);
175   -
176   - //找到该设备的64数据
177   - Collection<D64> d64s = d64Map.values();
178   - List<D64> rem64List = new ArrayList<>();
179   - for(D64 d64 : d64s){
180   - if(device.equals(d64.getDeviceId()))
181   - rem64List.add(d64);
182   - }
183   -
184   - //清除64数据
185   - for(D64 d64 : rem64List){
186   - if(d64.getRespAck() == null)
187   - directiveService.save64(d64);
188   -
189   - if(null != d64Map.remove(d64.getKey()))
190   - c64 ++;
191   - }
192   -
193   - rem64List.clear();
194   - if(c64 > 0)
195   - logger.info("清除64数据 ," + c64);
  147 + @Autowired
  148 + DirectivesPstThread directivesPstThread;
  149 + public void clearAll(){
  150 + d60Map = new ConcurrentHashMap<>();
  151 + d64Map = new ConcurrentHashMap<>();
  152 + logger.info("清除指令数据 ,,,");
196 153 }
197 154  
198 155 public Collection<D60> all60(){
... ...
src/main/java/com/bsth/data/directive/DirectiveCreator.java
... ... @@ -81,7 +81,7 @@ public class DirectiveCreator {
81 81 }
82 82  
83 83  
84   - public D60 createD60_01(String nbbm, String text, int upDown, int state, Date alarmTime){
  84 + public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){
85 85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm");
86 86  
87 87 Long timestamp = System.currentTimeMillis();
... ... @@ -102,7 +102,7 @@ public class DirectiveCreator {
102 102 directive.setMsgId(msgId);
103 103 // 构造数据
104 104 data.setDeviceId(deviceId);
105   - data.setDispatchInstruct((short) 0x01);
  105 + data.setDispatchInstruct((short) 0x02);
106 106 data.setTimestamp(timestamp);
107 107 data.setCompanyCode(company);
108 108 data.setMsgId(msgId);
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
1 1 package com.bsth.data.directive;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.bsth.data.schedule.DayOfSchedule;
4 5 import com.bsth.entity.directive.D60;
5 6 import com.bsth.entity.directive.D64;
6 7 import com.bsth.entity.directive.Directive;
7   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
8 8 import com.bsth.repository.directive.D60Repository;
9 9 import com.bsth.repository.directive.D64Repository;
10 10 import org.joda.time.format.DateTimeFormat;
... ... @@ -12,9 +12,20 @@ import org.joda.time.format.DateTimeFormatter;
12 12 import org.slf4j.Logger;
13 13 import org.slf4j.LoggerFactory;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  16 +import org.springframework.jdbc.core.JdbcTemplate;
  17 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
15 18 import org.springframework.stereotype.Component;
  19 +import org.springframework.transaction.TransactionDefinition;
  20 +import org.springframework.transaction.TransactionStatus;
  21 +import org.springframework.transaction.support.DefaultTransactionDefinition;
16 22  
17   -import java.util.LinkedList;
  23 +import java.sql.PreparedStatement;
  24 +import java.sql.SQLException;
  25 +import java.sql.Types;
  26 +import java.util.ArrayList;
  27 +import java.util.List;
  28 +import java.util.concurrent.ConcurrentLinkedQueue;
18 29  
19 30 /**
20 31 * 指令持久化线程
... ... @@ -34,40 +45,258 @@ public class DirectivesPstThread extends Thread {
34 45 @Autowired
35 46 DayOfSchedule dayOfSchedule;
36 47  
  48 + @Autowired
  49 + JdbcTemplate jdbcTemplate;
  50 +
37 51 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
38 52  
39 53 @Override
40 54 public void run() {
  55 + try{
  56 + ConcurrentLinkedQueue<Directive> list = DayOfDirectives.pstDirectives;
41 57  
42   - LinkedList<Directive> list = DayOfDirectives.pstDirectives;
43   -
44   - Directive directive;
45   - for (int i = 0; i < 1000; i++) {
46   - try {
  58 + List<D60> d60s = new ArrayList<>();
  59 + List<D64> d64s = new ArrayList<>();
  60 + //按 60 和 64 分组
  61 + Directive directive;
  62 + D60 d60;
  63 + for (int i = 0; i < 2000; i++) {
47 64 directive = list.poll();
48 65 if(null == directive)
49 66 break;
  67 +
50 68 //日期
51 69 directive.setRq(fmtyyyyMMdd.print(directive.getTimestamp()));
  70 +
52 71 if (directive instanceof D60) {
53   - D60 d60 = (D60) directive;
54   - if(d60.isDispatch()){
55   - ScheduleRealInfo sch = d60.getSch();
56   - //如果关联的班次已经不存在了,放弃入库
57   - if(sch.isDeleted()){
58   - logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId());
59   - continue;
60   - }
61   - }
62   - d60Repository.save(d60);
  72 + d60 = (D60) directive;
  73 + if(isDelete(d60))
  74 + continue;
  75 + d60s.add(d60);
  76 + }
  77 + else if(directive instanceof D64)
  78 + d64s.add((D64) directive);
  79 + }
  80 +
  81 + //入库60
  82 + save60(d60s);
  83 + //入库64
  84 + save64(d64s);
  85 +
  86 +
  87 + // 60 指令更新(车载响应)
  88 + ConcurrentLinkedQueue<D60> updateD60s = DayOfDirectives.pstD60s;
  89 + d60s = new ArrayList<>();
  90 + for (int i = 0; i < 2000; i++) {
  91 + d60 = updateD60s.poll();
  92 + if(null == d60)
  93 + break;
  94 + d60s.add(d60);
  95 + }
  96 +
  97 + if(d60s.size() > 0)
  98 + update60(d60s);
  99 + }catch (Exception e){
  100 + logger.error("指令入库出现异常", e);
  101 + }
  102 + }
  103 +
  104 + private void save64(final List<D64> d64s) {
  105 + if(null == d64s || d64s.size() == 0)
  106 + return;
  107 +
  108 + String sql = "insert into bsth_v_directive_64(device_id,error_text,http_code,oper_code,rq,sender,timestamp,city_code,line_id,txt_content,resp_ack) " +
  109 + " values(?,?,?,?,?,?,?,?,?,?,?)";
  110 +
  111 + //编程式事务
  112 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  113 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  114 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  115 + TransactionStatus status = tran.getTransaction(def);
  116 +
  117 + try{
  118 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  119 + @Override
  120 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  121 + D64 d64 = d64s.get(i);
  122 + ps.setString(1 , d64.getDeviceId());
  123 + ps.setString(2, isNvl(d64.getErrorText()));
  124 + ps.setInt(3, d64.getHttpCode());
  125 + ps.setShort(4, isNvl(d64.getOperCode()));
  126 + ps.setString(5, d64.getRq());
  127 +
  128 + ps.setString(6, isNvl(d64.getSender()));
  129 + ps.setLong(7, d64.getTimestamp());
  130 +
  131 + ps.setShort(8, isNvl(d64.getData().getCityCode()));
  132 + ps.setString(9, isNvl(d64.getData().getLineId()));
  133 + ps.setString(10, isNvl(d64.getData().getTxtContent()));
  134 + ps.setShort(11, isNvl(d64.getRespAck()));
  135 + }
  136 +
  137 + @Override
  138 + public int getBatchSize() {
  139 + return d64s.size();
63 140 }
  141 + });
  142 +
  143 + tran.commit(status);
  144 +
  145 + logger.info("64 入库成功: " + d64s.size());
  146 + }catch (Exception e){
  147 + tran.rollback(status);
  148 + logger.error("", e);
  149 + logger.warn("失败的数据:" + JSON.toJSONString(d64s));
  150 + }
  151 + }
  152 +
  153 + private void update60(final List<D60> d60s) {
  154 + if(null == d60s || d60s.size() == 0)
  155 + return;
  156 +
  157 + String sql = "update bsth_v_directive_60 set reply46=?,reply46time=?,reply47=?,reply47time=? where device_id=? and timestamp=? and msg_id=?";
  158 +
  159 + //编程式事务
  160 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  161 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  162 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  163 + TransactionStatus status = tran.getTransaction(def);
  164 +
  165 + try{
  166 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  167 + @Override
  168 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  169 + D60 d60 = d60s.get(i);
  170 + ps.setShort(1, isNvl(d60.getReply46()));
  171 + if(null == d60.getReply46Time())
  172 + ps.setNull(2, Types.BIGINT);
  173 + else
  174 + ps.setLong(2, d60.getReply46Time());
  175 +
  176 + ps.setShort(3, isNvl(d60.getReply47()));
64 177  
65   - if (directive instanceof D64) {
66   - d64Repository.save((D64) directive);
  178 + if(null == d60.getReply47Time())
  179 + ps.setNull(4, Types.BIGINT);
  180 + else
  181 + ps.setLong(4, d60.getReply47Time());
  182 + ps.setString(5, d60.getDeviceId());
  183 + ps.setLong(6, d60.getTimestamp());
  184 + ps.setInt(7, d60.getMsgId());
67 185 }
68   - } catch (Exception e) {
69   - logger.error("", e);
  186 +
  187 + @Override
  188 + public int getBatchSize() {
  189 + return d60s.size();
  190 + }
  191 + });
  192 +
  193 + tran.commit(status);
  194 +
  195 + logger.info("60 更新成功: " + d60s.size());
  196 + }catch (Exception e){
  197 + tran.rollback(status);
  198 + logger.error("", e);
  199 + logger.warn("失败的数据:" + JSON.toJSONString(d60s));
  200 + }
  201 + }
  202 +
  203 + private void save60(final List<D60> d60s) {
  204 + if(null == d60s || d60s.size() == 0)
  205 + return;
  206 +
  207 + String sql = "insert into bsth_v_directive_60(device_id,error_text,http_code,oper_code,rq,sender,timestamp" +
  208 + ",alarm_time,company_code,dispatch_instruct,instruct_type,msg_id,service_state,txt_content,is_dispatch" +
  209 + ",line_code,reply46,reply46time,reply47,reply47time,sch) " +
  210 + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  211 +
  212 + //编程式事务
  213 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  214 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  215 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  216 + TransactionStatus status = tran.getTransaction(def);
  217 +
  218 + try{
  219 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  220 + @Override
  221 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  222 + D60 d60 = d60s.get(i);
  223 + ps.setString(1, d60.getDeviceId());
  224 + ps.setString(2, isNvl(d60.getErrorText()));
  225 + ps.setInt(3, d60.getHttpCode());
  226 + ps.setShort(4, d60.getOperCode());
  227 + ps.setString(5, d60.getRq());
  228 + ps.setString(6, d60.getSender());
  229 + ps.setLong(7, d60.getTimestamp());
  230 +
  231 + ps.setLong(8, isNvl(d60.getData().getAlarmTime()));
  232 + ps.setShort(9, isNvl(d60.getData().getCompanyCode()));
  233 + ps.setShort(10, isNvl(d60.getData().getDispatchInstruct()));
  234 + ps.setInt(11, d60.getData().getInstructType());
  235 + ps.setInt(12, d60.getData().getMsgId());
  236 + ps.setLong(13, d60.getData().getServiceState());
  237 + ps.setString(14, d60.getData().getTxtContent());
  238 + ps.setBoolean(15, d60.isDispatch());
  239 +
  240 + ps.setString(16, isNvl(d60.getLineCode()));
  241 + ps.setShort(17, isNvl(d60.getReply46()));
  242 +
  243 + if(null == d60.getReply46Time())
  244 + ps.setNull(18, Types.BIGINT);
  245 + else
  246 + ps.setLong(18, d60.getReply46Time());
  247 +
  248 + ps.setShort(19, isNvl(d60.getReply47()));
  249 +
  250 + if(null == d60.getReply47Time())
  251 + ps.setNull(20, Types.BIGINT);
  252 + else
  253 + ps.setLong(20, d60.getReply47Time());
  254 +
  255 + if(d60.getSch()==null)
  256 + ps.setNull(21, Types.BIGINT);
  257 + else
  258 + ps.setLong(21, d60.getSch().getId());
  259 + }
  260 +
  261 + @Override
  262 + public int getBatchSize() {
  263 + return d60s.size();
  264 + }
  265 + });
  266 +
  267 + tran.commit(status);
  268 +
  269 + logger.info("60 入库成功: " + d60s.size());
  270 + }catch (Exception e){
  271 + tran.rollback(status);
  272 + logger.error("", e);
  273 + logger.warn("失败的数据:" + JSON.toJSONString(d60s));
  274 + }
  275 + }
  276 +
  277 + private String isNvl(String v) {
  278 + return v==null?"":v;
  279 + }
  280 +
  281 + private short isNvl(Short v) {
  282 + return v==null?0:v;
  283 + }
  284 +
  285 + private long isNvl(Long v) {
  286 + return v==null?0:v;
  287 + }
  288 +
  289 + private boolean isDelete(D60 d60){
  290 + try{
  291 + //如果关联的班次已经不存在了,放弃入库,很低概率出现
  292 + if(d60.isDispatch() && d60.getSch().isDeleted()){
  293 + logger.warn("save 指令,发现 deleted=true 的班次,id=" + d60.getSch().getId());
  294 + return true;
70 295 }
  296 + }catch (Exception e){
  297 + logger.error("", e);
71 298 }
  299 +
  300 + return false;
72 301 }
73 302 }
... ...
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
... ... @@ -32,8 +32,8 @@ public class GatewayHttpUtils {
32 32 httpClient = HttpClients.createDefault();
33 33 post = new HttpPost(url);
34 34 requestConfig = RequestConfig.custom()
35   - .setConnectTimeout(2000).setConnectionRequestTimeout(1000)
36   - .setSocketTimeout(2000).build();
  35 + .setConnectTimeout(3000).setConnectionRequestTimeout(2000)
  36 + .setSocketTimeout(3000).build();
37 37 post.setConfig(requestConfig);
38 38 }
39 39  
... ... @@ -48,9 +48,7 @@ public class GatewayHttpUtils {
48 48  
49 49 int statusCode = response.getStatusLine().getStatusCode();
50 50 if(statusCode != 200){
51   - //post.abort();
52 51 logger.error("http client status code: " + statusCode);
53   - //return code;
54 52 }
55 53  
56 54 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
... ...
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
... ... @@ -124,6 +124,8 @@ public class GpsRealData {
124 124 */
125 125 public List<GpsEntity> getByLine(String lineCode) {
126 126 NavigableSet<String> set = lineCode2Devices.get(lineCode);//实际车载
  127 + if(null == set)
  128 + set = new TreeSet();
127 129 Set<String> nbbmSet = dayOfSchedule.findCarByLineCode(lineCode);//计划用车
128 130  
129 131 Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
... ...
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
... ... @@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
13 13 public class GpsEntity implements Cloneable{
14 14  
15 15 /** 公司代码 */
  16 + @JsonIgnore
16 17 private Short companyCode;
17 18  
18 19 /** 线路编码 */
... ... @@ -31,6 +32,7 @@ public class GpsEntity implements Cloneable{
31 32 private String stationName;
32 33  
33 34 /** 到站时间 */
  35 + @JsonIgnore
34 36 private long arrTime;
35 37  
36 38 /** 经度 */
... ... @@ -56,6 +58,12 @@ public class GpsEntity implements Cloneable{
56 58  
57 59 /** 上下行(0 上行 , 1 下行 , -1 无效) */
58 60 private Byte upDown;
  61 +
  62 + /**
  63 + * 设备原始走向_营运状态
  64 + * 当设备状态和系统不一致时,该字段有值
  65 + */
  66 + private String origStateStr;
59 67  
60 68 /** 车辆内部编码 */
61 69 private String nbbm;
... ... @@ -379,4 +387,12 @@ public class GpsEntity implements Cloneable{
379 387 public void setPlanCode(String planCode) {
380 388 this.planCode = planCode;
381 389 }
  390 +
  391 + public String getOrigStateStr() {
  392 + return origStateStr;
  393 + }
  394 +
  395 + public void setOrigStateStr(String origStateStr) {
  396 + this.origStateStr = origStateStr;
  397 + }
382 398 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
... ... @@ -7,6 +7,9 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 7 import org.springframework.beans.factory.annotation.Autowired;
8 8 import org.springframework.stereotype.Component;
9 9  
  10 +import java.util.concurrent.ConcurrentHashMap;
  11 +import java.util.concurrent.ConcurrentMap;
  12 +
10 13 /**
11 14 * GPS 状态处理
12 15 * Created by panzhao on 2017/11/15.
... ... @@ -20,6 +23,13 @@ public class GpsStateProcess {
20 23 @Autowired
21 24 GpsStatusManager gpsStatusManager;
22 25  
  26 + /**
  27 + * 设置状态差异连续次数
  28 + */
  29 + private static ConcurrentMap<String, Integer> stateDiffMap = new ConcurrentHashMap<>();
  30 +
  31 + private final static int CHANGE_THRESHOLD = 2;
  32 +
23 33 public void process(GpsEntity gps) {
24 34 //在执行的任务
25 35 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
... ... @@ -27,16 +37,40 @@ public class GpsStateProcess {
27 37 if (null == sch)
28 38 return;
29 39  
30   - byte upDown = Byte.parseByte(sch.getXlDir());
  40 + int upDown = Integer.parseInt(sch.getXlDir());
31 41 int schState = dayOfSchedule.emptyService(sch)?1:0;
32   -
  42 + String device = gps.getDeviceId();
  43 + /**
  44 + * 网关在进终点的时候,会直接将当前点位状态改变
  45 + * 为避免出现单个点的状态跳动,设置一下切换阈值
  46 + */
33 47 if(gps.getState() != schState || gps.getUpDown() != upDown){
34   - //下发指令纠正车载的 营运状态 和 走向
35   - gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统");
  48 + Integer count = 0;
  49 + if(stateDiffMap.containsKey(device))
  50 + count = stateDiffMap.get(device);
  51 +
  52 + count ++;
  53 +
  54 + if(count >= CHANGE_THRESHOLD){
  55 + //下发指令纠正车载的 营运状态 和 走向
  56 + gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统");
  57 + count = 0;
  58 + }
  59 +
  60 + stateDiffMap.put(device, count);
  61 +
  62 + //记录原始设备状态
  63 + gps.setOrigStateStr(gps.getUpDown() + "_" + gps.getState());
36 64 }
  65 + else
  66 + stateDiffMap.put(device, 0);
37 67  
38 68 if (gps.getUpDown() != upDown) {
39   - gps.setUpDown(upDown);//修正走向
  69 + gps.setUpDown((byte) upDown);//修正走向
  70 + }
  71 +
  72 + if(gps.getState() != schState){
  73 + gps.setState(schState);//修正营运状态
40 74 }
41 75  
42 76 if (!sch.getXlBm().equals(gps.getLineId())) {
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
... ... @@ -144,6 +144,8 @@ public class InStationProcess {
144 144 dayOfSchedule.addExecPlan(next);
145 145 inStationAndInPark(sch, next);//进站既进场
146 146 }
  147 + else
  148 + dayOfSchedule.removeExecPlan(nbbm);
147 149  
148 150 //路牌的下一个班次,页面显示起点实际到达时间
149 151 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
... ... @@ -176,9 +178,14 @@ public class InStationProcess {
176 178 if(null == next && gps.isService()){
177 179 nonService(sch, "结束@系统");//营运结束
178 180 }
179   - //下发运营指令
180   - DirectivePushQueue.put6003(next, "到站@系统");
181 181  
  182 + /**
  183 + * 下一班不是全程班次的时候,下发运营指令
  184 + * 全程班次时,由网关根据进出起终点,自动切换走向
  185 +
  186 + if(null != next && !next.getBcType().equals("normal"))
  187 + DirectivePushQueue.put6003(next, "到站@系统");
  188 + */
182 189 //下发调度指令
183 190 DirectivePushQueue.put6002(next, doneSum, "到站@系统", "");
184 191 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
... ... @@ -39,7 +39,7 @@ public class OutStationProcess {
39 39  
40 40 @Autowired
41 41 GpsStatusManager gpsStatusManager;
42   - private final static int MAX_BEFORE_TIME = 1000 * 60 * 120;
  42 + private final static int MAX_BEFORE_TIME = 1000 * 60 * 60 * 3;
43 43  
44 44 public void process(GpsEntity gps) {
45 45 //自动执行的线路,滚蛋
... ... @@ -86,8 +86,8 @@ public class OutStationProcess {
86 86 }
87 87  
88 88 int diff = (int) (sch.getDfsjT() - gps.getTimestamp());
89   - //首班出场最多提前2小时
90   - if ((dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) || diff > MAX_BEFORE_TIME / 2)
  89 + //首班出场最多提前3小时
  90 + if (dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME)
91 91 return;
92 92  
93 93 gps.setPremiseCode(null);//清除前置围栏标记
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/overspeed/OverspeedProcess.java
... ... @@ -43,7 +43,7 @@ public class OverspeedProcess {
43 43 */
44 44 private static Map<String, Integer> contSpeedMap;
45 45  
46   - Logger logger = LoggerFactory.getLogger(this.getClass());
  46 + static Logger logger = LoggerFactory.getLogger(OverspeedProcess.class);
47 47  
48 48 static{
49 49 multimap = ArrayListMultimap.create();
... ... @@ -51,6 +51,10 @@ public class OverspeedProcess {
51 51 realOverspeedMap = new HashMap();
52 52 }
53 53  
  54 + public static int size(){
  55 + return multimap.size();
  56 + }
  57 +
54 58 public static void clear(){
55 59 multimap = null;
56 60 multimap = ArrayListMultimap.create();
... ... @@ -60,6 +64,8 @@ public class OverspeedProcess {
60 64  
61 65 realOverspeedMap = null;
62 66 realOverspeedMap = new HashMap();
  67 +
  68 + logger.info("清理超速缓存数据,,,");
63 69 }
64 70  
65 71 public boolean process(GpsEntity gps){
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
... ... @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
84 84 Calendar calendar = Calendar.getInstance();
85 85 int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
86 86  
87   - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear;
  87 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear;
88 88 JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
89 89  
90 90 List<GpsEntity> list =
... ... @@ -102,6 +102,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
102 102 gps.setTimestamp(rs.getLong("TS"));
103 103 gps.setUpDown((byte) getUpOrDown(rs.getLong("SERVICE_STATE")));
104 104 gps.setServerTimestamp(rs.getLong("SERVER_TS"));
  105 + gps.setState((int) getService(rs.getLong("SERVICE_STATE")));
105 106 return gps;
106 107 }
107 108 });
... ... @@ -109,6 +110,17 @@ public class GpsDataRecovery implements ApplicationContextAware {
109 110 }
110 111  
111 112 /**
  113 + * 获取运营状态
  114 + *
  115 + * @return -1无效 0运营 1未运营
  116 + */
  117 + public static byte getService(long serviceState) {
  118 + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000)
  119 + return -1;
  120 + return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0);
  121 + }
  122 +
  123 + /**
112 124 * 王通 2016/6/29 9:23:24 获取车辆线路上下行
113 125 *
114 126 * @return -1无效 0上行 1下行
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
... ... @@ -15,6 +15,8 @@ public class GpsDataUtils {
15 15  
16 16 static Logger logger = LoggerFactory.getLogger(GpsDataUtils.class);
17 17  
  18 + private final static long MAX_DIFF = 1000 * 60 * 60 * 24;
  19 +
18 20 /**
19 21 * 过滤无效的gps点位
20 22 *
... ... @@ -24,9 +26,16 @@ public class GpsDataUtils {
24 26 public static List<GpsEntity> clearInvalid(List<GpsEntity> list) {
25 27 List<GpsEntity> rs = new ArrayList<>();
26 28  
  29 + long t = System.currentTimeMillis();
27 30 try {
28 31 GpsEntity prev;
29 32 for (GpsEntity gps : list) {
  33 + if(Math.abs(gps.getTimestamp() - t) > MAX_DIFF){
  34 + //尝试校准GPS时间
  35 + gps.setTimestamp(t + 1);
  36 + gps.setAbnormalStatus("timeError");
  37 + }
  38 +
30 39 prev = GpsRealData.get(gps.getDeviceId());
31 40  
32 41 //不接收过期数据
... ... @@ -48,7 +57,7 @@ public class GpsDataUtils {
48 57 if (rs.size() < list.size())
49 58 logger.info("过滤无效的点位 : " + (list.size() - rs.size()));
50 59 } catch (Exception e) {
51   - logger.error("", e);
  60 + logger.error("过滤GPS出现异常", e);
52 61 rs = list;
53 62 }
54 63 return rs;
... ...
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
... ... @@ -24,7 +24,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
24 24 static ConcurrentLinkedQueue<QueueData_Directive> linkedList;
25 25 static DataPushThread thread;
26 26 static DirectiveService directiveService;
27   - static long t;
  27 + static long threadT;
28 28  
29 29 /**
30 30 * 下发运营指令6003的最小间隔时间
... ... @@ -34,11 +34,11 @@ public class DirectivePushQueue implements ApplicationContextAware {
34 34 /**
35 35 * 车辆 ——> 上次下发6003的时间
36 36 */
37   - static ConcurrentMap<String, Long> lastSend6003Map;
  37 + static ConcurrentMap<String, Long> lastSend60TimeMap;
38 38  
39 39 static {
40 40 linkedList = new ConcurrentLinkedQueue<>();
41   - lastSend6003Map = new ConcurrentHashMap<>();
  41 + lastSend60TimeMap = new ConcurrentHashMap<>();
42 42 }
43 43  
44 44 public static void put6002(ScheduleRealInfo sch, int finish, String sender, String txtPrefix){
... ... @@ -52,12 +52,13 @@ public class DirectivePushQueue implements ApplicationContextAware {
52 52 qd6002.setTxtPrefix(txtPrefix);
53 53  
54 54 linkedList.add(qd6002);
  55 + lastSend60TimeMap.put(sch.getClZbh(), System.currentTimeMillis());
55 56 }
56 57  
57 58 public static void put6003(String nbbm, int state, int upDown, String sender){
58 59 long t = System.currentTimeMillis();
59   - if(lastSend6003Map.containsKey(nbbm)
60   - && t - lastSend6003Map.get(nbbm) < MIN_SEND6003_SPACE)
  60 + if(lastSend60TimeMap.containsKey(nbbm)
  61 + && t - lastSend60TimeMap.get(nbbm) < MIN_SEND6003_SPACE)
61 62 return; //最短下发间隔
62 63  
63 64 QueueData_Directive qd6003 = new QueueData_Directive();
... ... @@ -68,7 +69,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
68 69 qd6003.setCode("60_03");
69 70  
70 71 linkedList.add(qd6003);
71   - lastSend6003Map.put(nbbm, t);
  72 + lastSend60TimeMap.put(nbbm, t);
72 73 }
73 74  
74 75 public static void put6003(ScheduleRealInfo sch, String sender){
... ... @@ -146,7 +147,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
146 147 sleepFlag = true;
147 148 }
148 149 }
149   - t = System.currentTimeMillis();
  150 + threadT = System.currentTimeMillis();
150 151 }
151 152 catch(InterruptedException e){
152 153 log.error("", e);
... ...
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
... ... @@ -3,6 +3,8 @@ package com.bsth.data.safe_driv;
3 3 import com.bsth.websocket.handler.SendUtils;
4 4 import org.joda.time.format.DateTimeFormat;
5 5 import org.joda.time.format.DateTimeFormatter;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
6 8 import org.springframework.beans.BeansException;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.context.ApplicationContext;
... ... @@ -33,6 +35,8 @@ public class SafeDrivCenter implements ApplicationContextAware {
33 35 */
34 36 private static Map<String, SafeDriv> safeMap;
35 37  
  38 + static Logger logger = LoggerFactory.getLogger(SafeDrivCenter.class);
  39 +
36 40 static {
37 41 data = new HashSet<>();
38 42 safeMap = new HashMap<>();
... ... @@ -61,6 +65,7 @@ public class SafeDrivCenter implements ApplicationContextAware {
61 65 public static void clear(){
62 66 data = new HashSet<>();
63 67 safeMap = new HashMap<>();
  68 + logger.info("清除安全驾驶数据,,,");
64 69 }
65 70  
66 71 @Override
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -861,6 +861,18 @@ public class DayOfSchedule {
861 861 return nbbmScheduleMap.values();
862 862 }
863 863  
  864 + public Collection<ScheduleRealInfo> findAllByLpContainer() {
  865 + return lpScheduleMap.values();
  866 + }
  867 +
  868 + public Collection<ScheduleRealInfo> findAllByIdContainer() {
  869 + return id2SchedulMap.values();
  870 + }
  871 +
  872 + public int getPstSize() {
  873 + return pstBuffer.size();
  874 + }
  875 +
864 876 public boolean addExecPlan(ScheduleRealInfo sch) {
865 877 ScheduleRealInfo oldExec = executeCurr(sch.getClZbh());
866 878 if (sch != null){
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
  3 +import com.bsth.data.directive.DayOfDirectives;
3 4 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  5 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
4 6 import com.bsth.service.oil.DlbService;
5 7 import com.bsth.data.safe_driv.SafeDrivCenter;
6 8 import com.bsth.service.oil.YlbService;
... ... @@ -27,6 +29,9 @@ public class CalcOilThread extends Thread{
27 29 SheetService sheetService;
28 30 Logger logger = LoggerFactory.getLogger(this.getClass());
29 31  
  32 + @Autowired
  33 + DayOfDirectives dayOfDirectives;
  34 +
30 35 @Override
31 36 public void run() {
32 37 try{
... ... @@ -37,12 +42,18 @@ public class CalcOilThread extends Thread{
37 42 logger.info("开始计算班次准点率....");
38 43 sheetService.saveSheetList("");
39 44 logger.info("计算班次准点率结束!");
40   - //清除安全驾驶数据 先临时蹭这个线程
41   - SafeDrivCenter.clear();
42   - //清除超速缓存数据
43   - OverspeedProcess.clear();
44 45 } catch(Exception e){
45 46 logger.error("计算路单里程加注量失败",e);
46 47 }
  48 +
  49 + //清除指令数据
  50 + dayOfDirectives.clearAll();
  51 + //清除安全驾驶数据
  52 + SafeDrivCenter.clear();
  53 + //清除超速缓存数据
  54 + OverspeedProcess.clear();
  55 +
  56 + GpsDataLoaderThread.setFlag(0);
  57 +
47 58 }
48 59 }
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
3   -import com.bsth.data.BasicData;
4 3 import com.bsth.data.LineConfigData;
5 4 import com.bsth.data.directive.DayOfDirectives;
6 5 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
... ... @@ -56,17 +55,15 @@ public class ScheduleRefreshThread extends Thread{
56 55  
57 56 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
58 57  
59   - //logger.info(lineCode + "开始翻班, " + currSchDate);
60   -
61 58 try{
62   - //清除指令数据
63 59 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
64 60 for(String car : cars){
65   - dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car));
66 61 GpsCacheData.remove(car);
67 62 }
68 63 //清除驾驶员上报数据
69 64 pilotReport.clear(lineCode);
  65 + //清除指令数据 指令数据,直接定时全部清空
  66 + //dayOfDirectives.clear(lineCode);
70 67 }catch (Exception e){
71 68 logger.error("清理 60 和 80出现问题", e);
72 69 }
... ...
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
... ... @@ -136,6 +136,14 @@ public class SchedulePlanInfo extends BEntity {
136 136 /** 时刻表的明细备注 */
137 137 private String remark;
138 138  
  139 + //---------------- 修改时使用的字段 -----------------//
  140 + /** 调整原因(在调度执勤日报页面中修改,选择营运状态) */
  141 + private Integer modifyReason;
  142 + /** 调整的备注(在调度执勤日报页面中修改,与时刻表的班次备注区分开) */
  143 + private String modifyRemark;
  144 + /** 调整的次数(在调度执勤日报页面,排班计划明细里,改的话都会增加) */
  145 + private Integer modifyCount;
  146 +
139 147  
140 148 // @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
141 149 // @JoinTable(
... ... @@ -761,4 +769,28 @@ public class SchedulePlanInfo extends BEntity {
761 769 public void setSchedulePlan(SchedulePlan schedulePlan) {
762 770 this.schedulePlan = schedulePlan;
763 771 }
  772 +
  773 + public Integer getModifyReason() {
  774 + return modifyReason;
  775 + }
  776 +
  777 + public void setModifyReason(Integer modifyReason) {
  778 + this.modifyReason = modifyReason;
  779 + }
  780 +
  781 + public String getModifyRemark() {
  782 + return modifyRemark;
  783 + }
  784 +
  785 + public void setModifyRemark(String modifyRemark) {
  786 + this.modifyRemark = modifyRemark;
  787 + }
  788 +
  789 + public Integer getModifyCount() {
  790 + return modifyCount;
  791 + }
  792 +
  793 + public void setModifyCount(Integer modifyCount) {
  794 + this.modifyCount = modifyCount;
  795 + }
764 796 }
... ...
src/main/java/com/bsth/filter/AccessLogFilter.java
... ... @@ -46,6 +46,7 @@ public class AccessLogFilter extends BaseFilter {
46 46 String url = request.getRequestURI();
47 47 String params = getParams(request);
48 48 String headers = getHeaders(request);
  49 + String method = request.getMethod();
49 50  
50 51 StringBuilder s = new StringBuilder();
51 52 s.append(getBlock(username + " -" + name));
... ... @@ -53,6 +54,7 @@ public class AccessLogFilter extends BaseFilter {
53 54 s.append(getBlock(ip));
54 55 s.append(getBlock(userAgent));
55 56 s.append(getBlock(url));
  57 + s.append(getBlock(method));
56 58 s.append(getBlock(params));
57 59 s.append(getBlock(headers));
58 60 s.append(getBlock(request.getHeader("Referer")));
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -301,7 +301,77 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
301 301 " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.id = ?1 ) a " +
302 302 " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
303 303 List<Object[]> findStationRouteInfo(Integer id);
304   -
  304 +
  305 + /**
  306 + * @Description : TODO(根据站点路由Id查询详情)
  307 + *
  308 + * @param id:站点路由ID
  309 + *
  310 + * @return List<Object[]>
  311 + */
  312 + @Query(value = "SELECT a.stationRouteLine," +
  313 + " a.stationRouteStation," +
  314 + " a.stationRouteCode," +
  315 + " a.stationRouteLIneCode," +
  316 + " a.stationRouteStationMark," +
  317 + " a.stationOutStationNmber," +
  318 + " a.stationRoutedirections," +
  319 + " a.stationRouteDistances," +
  320 + " a.stationRouteToTime," +
  321 + " a.staitonRouteFirstTime," +
  322 + " a.stationRouteEndTime," +
  323 + " a.stationRouteDescriptions," +
  324 + " a.stationRouteDestroy," +
  325 + " a.stationRouteVersions," +
  326 + " a.stationRouteCreateBy," +
  327 + " a.stationRouteCreateDate," +
  328 + " a.stationRouteUpdateBy," +
  329 + " a.stationRouteUpdateDate," +
  330 + " b.id AS stationId," +
  331 + " b.station_cod AS stationCode," +
  332 + " a.stationRouteName," +
  333 + " b.road_coding AS stationRoadCoding," +
  334 + " b.db_type AS stationDbType," +
  335 + " b.b_jwpoints AS stationJwpoints," +
  336 + " b.g_lonx AS stationGlonx," +
  337 + " b.g_laty AS stationGlaty," +
  338 + " b.x AS stationX," +
  339 + " b.y AS stationY," +
  340 + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  341 + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
  342 + " b.destroy AS stationDestroy," +
  343 + " b.radius AS stationRadius," +
  344 + " b.shapes_type AS stationShapesType," +
  345 + " b.versions AS stationVersions," +
  346 + " b.descriptions AS sttationDescriptions," +
  347 + " b.create_by AS stationCreateBy," +
  348 + " b.create_date AS stationCreateDate," +
  349 + " b.update_by AS stationUpdateBy," +
  350 + " b.update_date AS stationUpdateDate," +
  351 + " a.stationRouteId,b.station_name as zdmc "+
  352 + " FROM ( SELECT s.id AS stationRouteId," +
  353 + " s.line AS stationRouteLine," +
  354 + " s.station as stationRouteStation," +
  355 + " s.station_name AS stationRouteName," +
  356 + " s.station_route_code as stationRouteCode," +
  357 + " s.line_code AS stationRouteLIneCode," +
  358 + " s.station_mark AS stationRouteStationMark," +
  359 + " s.out_station_nmber AS stationOutStationNmber," +
  360 + " s.directions AS stationRoutedirections," +
  361 + " s.distances AS stationRouteDistances," +
  362 + " s.to_time AS stationRouteToTime," +
  363 + " s.first_time AS staitonRouteFirstTime," +
  364 + " s.end_time AS stationRouteEndTime," +
  365 + " s.descriptions AS stationRouteDescriptions," +
  366 + " s.destroy AS stationRouteDestroy," +
  367 + " s.versions AS stationRouteVersions," +
  368 + " s.create_by AS stationRouteCreateBy," +
  369 + " s.create_date AS stationRouteCreateDate," +
  370 + " s.update_by AS stationRouteUpdateBy," +
  371 + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.destroy = 0) a " +
  372 + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
  373 + List<Object[]> getStationRouteList(Integer lineId, Integer dir);
  374 +
305 375 List<StationRoute> findByLine(Line line);
306 376  
307 377 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/service/SectionRouteService.java
... ... @@ -67,5 +67,5 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt;
67 67  
68 68 void batchUpdate(Integer lineId, String lineCode);
69 69  
70   -
  70 + Map<String,Object> destroy(Integer id);
71 71 }
... ...
src/main/java/com/bsth/service/StationRouteService.java
... ... @@ -92,6 +92,15 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
92 92 * @return List<Map<String, Object>>
93 93 */
94 94 List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map);
  95 +
  96 + /**
  97 + * @Description :TODO(查询线路某方向下所有站点)
  98 + *
  99 + * @param map <lineId:线路ID; direction:方向>
  100 + *
  101 + * @return List<Map<String, Object>>
  102 + */
  103 + List<Map<String, Object>> getStationRouteList(Map<String, Object> map);
95 104  
96 105 /**
97 106 * @Description :TODO(撤销站点)
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -96,14 +96,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
96 96 d60.setSender(sender);
97 97 d60.setHttpCode(code);
98 98  
99   - if (code == 0) {
100   - // 添加到缓存
101   - dayOfDirectives.put60(d60, true);
102   - } else {
  99 + if (code != 0)
103 100 d60.setErrorText("网关通讯失败, code: " + code);
104   - d60Repository.save(d60);
105   - dayOfDirectives.put60(d60, false);
106   - }
  101 +
  102 + dayOfDirectives.put60(d60);
107 103 return code;
108 104 }
109 105  
... ... @@ -128,7 +124,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
128 124 text += " (放站到"+sch.getMajorStationName()+"带客)";
129 125 }
130 126  
131   - //下发0x01指令 调度指令(闹钟有效)
  127 + //下发0x02指令 调度指令(闹钟有效)
132 128 long t = System.currentTimeMillis() + 1000 * 30,
133 129 alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT();
134 130  
... ... @@ -139,7 +135,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
139 135 int state = 0;//营运状态
140 136 if(dayOfSchedule.emptyService(sch))
141 137 state = 1;
142   - d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
  138 + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
143 139 , state, new Date(alarmTime));
144 140  
145 141 d60.setLineCode(sch.getXlBm());
... ... @@ -171,16 +167,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
171 167  
172 168 if (code == 0) {
173 169 sch.setDirectiveState(60);
174   - // 添加到缓存,延迟入库
175   - dayOfDirectives.put60(d60, true);
176 170 // 通知页面
177 171 sendD60ToPage(sch);
178 172 } else {
179 173 d60.setErrorText("网关通讯失败, code: " + code);
180   - dayOfDirectives.put60(d60, false);
181   - d60Repository.save(d60);
182 174 }
183 175  
  176 + dayOfDirectives.put60(d60);
184 177 return code;
185 178 }
186 179  
... ... @@ -227,18 +220,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
227 220 int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
228 221 // 添加到缓存,等待入库
229 222 d60.setHttpCode(code);
230   - /*if (null != sch){
231   - d60.setSch(sch);
232   - d60.setLineCode(sch.getXlBm());
233   - }*/
234 223  
235   - if (code == 0) {
236   - dayOfDirectives.put60(d60, true);
237   - } else {
  224 + GpsEntity gps = gpsRealDataBuffer.getByNbbm(nbbm);
  225 + if(null != gps)
  226 + d60.setLineCode(gps.getLineId());
  227 +
  228 + if (code != 0)
238 229 d60.setErrorText("网关通讯失败, code: " + code);
239   - d60Repository.save(d60);
240   - dayOfDirectives.put60(d60, false);
241   - }
  230 +
  231 + dayOfDirectives.put60(d60);
242 232 return code;
243 233 }
244 234  
... ... @@ -268,15 +258,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
268 258 // 入库
269 259 d64.setHttpCode(code);
270 260 d64.getData().setTxtContent("切换线路[" + BasicData.lineCode2NameMap.get(lineCode) + "]");
271   - dayOfDirectives.put64(d64);
272   -
273 261 // 通知设备刷新线路文件,忽略结果
274 262 if (code == 0)
275 263 GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
276 264 else
277 265 d64.setErrorText(" 网关通讯失败, code: " + code);
278 266  
279   - d64Repository.save(d64);
  267 + dayOfDirectives.put64(d64);
280 268 return code;
281 269 }
282 270  
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -5,6 +5,7 @@ import com.bsth.data.BasicData;
5 5 import com.bsth.data.forecast.entity.ArrivalEntity;
6 6 import com.bsth.data.gpsdata_v2.GpsRealData;
7 7 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  8 +import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
8 9 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
9 10 import com.bsth.data.gpsdata_v2.utils.GeoUtils;
10 11 import com.bsth.data.pilot80.PilotReport;
... ... @@ -232,16 +233,10 @@ public class GpsServiceImpl implements GpsService {
232 233 Map<String, Object> map = null;
233 234 for(Map<String, Object> rs : dataList){
234 235 serviceState = map_get_long(rs, "SERVICE_STATE");
235   -
236   - if(getGpsValid(serviceState) == 1)
237   - continue;
238   -
239   - map = new HashMap<>();
240 236 if(getGpsValid(serviceState) == 1)
241 237 continue;
242 238  
243 239 map = new HashMap<>();
244   -
245 240 lon = map_get_float(rs, "LON");
246 241 lat = map_get_float(rs, "LAT");
247 242 // 高德坐标
... ... @@ -274,7 +269,7 @@ public class GpsServiceImpl implements GpsService {
274 269 map.put("inout_stop", arrival.getInOut());
275 270 }
276 271  
277   - map.put("nbbm", BasicData.deviceId2NbbmMap.get(map_get_str(rs,"DEVICE_ID")));
  272 + //map.put("nbbm", nbbm);
278 273 map.put("state", getService(serviceState));
279 274 // 上下行
280 275 map.put("upDown", getUpOrDown(serviceState));
... ... @@ -500,6 +495,7 @@ public class GpsServiceImpl implements GpsService {
500 495 try {
501 496  
502 497 gpsRealData.remove(device);
  498 + GpsCacheData.remove(BasicData.deviceId2NbbmMap.get(device));
503 499 rs.put("status", ResponseCode.SUCCESS);
504 500 } catch (Exception e) {
505 501 rs.put("status", ResponseCode.ERROR);
... ...
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
... ... @@ -122,7 +122,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
122 122 }
123 123  
124 124 /**
125   - * @Description :TODO(查询路段信息)
  125 + * @Description :TODO(查询缓存路段信息)
126 126 *
127 127 * @param map <line.id_eq:线路ID; directions_eq:方向>
128 128 *
... ... @@ -408,4 +408,25 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
408 408 public void batchUpdate(Integer lineId, String lineCode) {
409 409 repository.batchUpdate(lineId,lineCode);
410 410 }
  411 +
  412 +
  413 +
  414 + /**
  415 + * @Description : TODO(根据路段路由Id批量撤销路段)
  416 + *
  417 + * @param id <id:路段路由ID>
  418 + */
  419 + @Override
  420 + @Transactional
  421 + public Map<String, Object> destroy(Integer id) {
  422 + Map<String, Object> resultMap = new HashMap<String, Object>();
  423 + try {
  424 + repository.sectionRouteIsDestroyUpdBatch(id);
  425 + resultMap.put("status", ResponseCode.SUCCESS);
  426 + } catch (Exception e) {
  427 + resultMap.put("status", ResponseCode.ERROR);
  428 + logger.error("save erro.", e);
  429 + }
  430 + return resultMap;
  431 + }
411 432 }
412 433 \ No newline at end of file
... ...
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
... ... @@ -453,7 +453,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
453 453 if(!sectionsBpoints.equals("")) {
454 454 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
455 455 }
456   - repository.systemSave(sectionCode, sectionName, "", "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId);
  456 + repository.systemSave(sectionCode, sectionName, null, "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId);
457 457  
458 458 routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode+i);
459 459 SectionRoute route = new SectionRoute();
... ... @@ -636,7 +636,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
636 636 // 原坐标类型
637 637 String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
638 638 // 说明
639   - String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  639 + String descriptions = "";
640 640 // 是否撤销
641 641 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
642 642 // 方向
... ... @@ -662,14 +662,19 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
662 662 // 路段路由
663 663 Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
664 664 SectionRoute resultS = routeRepository.findOne(sectionRouteId);
665   -// int old_code = resultS.getSectionrouteCode();
666   - // 如果为空,默认在第一个路段
667   - if(sectionrouteCode!=null) {
668   - sectionrouteCode += 1;
669   - }else {
670   - sectionrouteCode = 1;
671   - }
672   - routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
  665 + int old_code = resultS.getSectionrouteCode();
  666 + // 是否修改路段序号标记
  667 + boolean type = false;
  668 + if(sectionrouteCode!=null) {
  669 + if(++sectionrouteCode == old_code) {
  670 + type = true;
  671 + }
  672 + // 默认是最前面路段
  673 + }else {
  674 + sectionrouteCode = 1;
  675 + }
  676 + if(!type)
  677 + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
673 678 // 限速
674 679 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
675 680 // 版本
... ... @@ -709,7 +714,6 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
709 714 route.setDirections(directions);
710 715 route.setVersions(version);
711 716 route.setDestroy(destroy);
712   - route.setDescriptions(descriptions);
713 717 route.setCreateBy(createBy);
714 718 route.setUpdateBy(updateBy);
715 719 route.setLine(line);
... ... @@ -784,17 +788,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
784 788 // 路段时长
785 789 Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
786 790 // 路段路由
787   -// Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
788   - Integer sectionrouteCode = 1;
  791 + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  792 +// Integer sectionrouteCode = 1;
789 793 SectionRouteCache resultS = routeCacheRepository.findOne(sectionRouteId);
790 794 int old_code = resultS.getSectionrouteCode();
  795 + // 是否修改路段序号标记
  796 + boolean type = false;
791 797 if(sectionrouteCode!=null) {
792   - sectionrouteCode += 1;
  798 + if(sectionrouteCode == old_code) {
  799 + type = true;
  800 + } else {
  801 + sectionrouteCode += 1;
  802 + }
793 803 // 默认是最前面路段
794 804 }else {
795 805 sectionrouteCode = 1;
796 806 }
797   - routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
  807 + if(!type)
  808 + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
798 809 // 限速
799 810 Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
800 811 // 版本
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
... ... @@ -196,123 +196,80 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
196 196 List<Map<String, Object>> staitonChildren= new ArrayList<Map<String, Object>>();
197 197  
198 198 if(stationList.size()>0) {
199   -
200 199 for(int i = 0 ; i < stationList.size(); i++) {
201   -
202 200 Map<String, Object> tempM = new HashMap<String, Object>();
203   -
204 201 // 站点路由ID
205 202 tempM.put("stationRouteId", stationList.get(i)[0]);
206   -
207 203 // 站点路由线路ID
208 204 tempM.put("stationRouteLine", stationList.get(i)[1]);
209   -
210 205 // 站点路由站点ID
211 206 tempM.put("stationRouteStation", stationList.get(i)[2]);
212   -
213 207 // 站点路由名称
214   - tempM.put("stationRouteStationName", stationList.get(i)[3]);
215   -
  208 + tempM.put("stationRouteName", stationList.get(i)[3]);
216 209 // 站点路由站点序号
217   - tempM.put("stationRouteStationRouteCode", stationList.get(i)[4]);
218   -
  210 + tempM.put("stationRouteCode", stationList.get(i)[4]);
219 211 // 站点路由线路编码
220 212 tempM.put("stationRouteLineCode", stationList.get(i)[5]);
221   -
222 213 // 站点路由站点类型
223 214 tempM.put("stationRouteStationMark", stationList.get(i)[6]);
224   -
225 215 // 站点路由出站的序号
226 216 tempM.put("stationRouteOutStationNmber", stationList.get(i)[7]);
227   -
228 217 // 站点路由站点方向
229   - tempM.put("stationRouteDirections", stationList.get(i)[8]);
230   -
  218 + tempM.put("stationRoutedirections", stationList.get(i)[8]);
231 219 // 站点路由站点到站距离
232 220 tempM.put("stationRouteDistances", stationList.get(i)[9]);
233   -
234 221 // 站点路由到站时间
235 222 tempM.put("stationRouteToTime", stationList.get(i)[10]);
236   -
237 223 // 站点路由站点首班时间
238 224 tempM.put("stationRouteFirstTime", stationList.get(i)[11]);
239   -
240 225 // 站点路由站点末班时间
241 226 tempM.put("stationRouteEndTime", stationList.get(i)[12]);
242   -
243 227 // 站点路由站点说明
244 228 tempM.put("stationRouteDescriptions", stationList.get(i)[13]);
245   -
246 229 // 站点路由版本
247 230 tempM.put("stationRouteVersions", stationList.get(i)[14]);
248   -
249 231 // 站点ID
250 232 tempM.put("stationId", stationList.get(i)[15]);
251   -
252 233 // 站点编码
253   - tempM.put("stationStationCod", stationList.get(i)[16]);
254   -
  234 + tempM.put("stationCode", stationList.get(i)[16]);
255 235 // 站点名称
256 236 tempM.put("stationStationName", stationList.get(i)[17]);
257   -
258 237 // 路段编码
259 238 tempM.put("stationRoadCoding", stationList.get(i)[18]);
260   -
261 239 // 原坐标类型
262 240 tempM.put("stationDbType", stationList.get(i)[19]);
263   -
264 241 // 中心点(百度坐标)
265   - tempM.put("stationBJwpoints", stationList.get(i)[20]);
266   -
  242 + tempM.put("stationJwpoints", stationList.get(i)[20]);
267 243 // 中心点(WGS经度)
268 244 tempM.put("stationGLonx", stationList.get(i)[21]);
269   -
270 245 // 中心点(WGS纬度)
271 246 tempM.put("stationGLaty", stationList.get(i)[22]);
272   -
273 247 // 城建坐标x
274 248 tempM.put("stationx", stationList.get(i)[23]);
275   -
276 249 // 城建坐标y
277 250 tempM.put("stationy", stationList.get(i)[24]);
278   -
279 251 // 站点图形类型
280 252 tempM.put("stationShapesType", stationList.get(i)[25]);
281   -
282 253 // 站点圆半径
283 254 tempM.put("stationRadius", stationList.get(i)[26]);
284   -
285 255 // 站点图形WGS坐标
286 256 tempM.put("stationGPolygonGrid", stationList.get(i)[27]);
287   -
288 257 // 站点图形百度坐标
289 258 tempM.put("stationBPolygonGrid", stationList.get(i)[28]);
290   -
291 259 // 是否撤销
292 260 tempM.put("stationDestroy", stationList.get(i)[29]);
293   -
294 261 // 站点版本
295 262 tempM.put("stationVersions", stationList.get(i)[30]);
296   -
297 263 // 站点说明
298 264 tempM.put("stationDescriptions", stationList.get(i)[31]);
299   -
300   - tempM.put("name", stationList.get(i)[3]);
301   -
  265 + tempM.put("zdmc", stationList.get(i)[3]);
302 266 tempM.put("text", stationList.get(i)[3]);
303   -
304 267 tempM.put("icon", "fa fa-bus");
305   -
306 268 tempM.put("pId", 200);
307   -
308 269 tempM.put("id", i+1);
309   -
310 270 tempM.put("groupType", "3");
311   -
312 271 tempM.put("chaildredType", "station");
313   -
314 272 tempM.put("enable", true);
315   -
316 273 staitonChildren.add(tempM);
317 274 }
318 275 }
... ... @@ -321,107 +278,87 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
321 278 List<Map<String, Object>> sectionChildren = new ArrayList<Map<String, Object>>();
322 279  
323 280 if(sectionList.size()>0) {
324   -
325 281 for(int i = 0 ; i<sectionList.size() ; i++){
326   -
327 282 Map<String, Object> tempM = new HashMap<String, Object>();
328   -
329 283 // 路段路由ID
330 284 tempM.put("sectionrouteId",sectionList.get(i)[0]);
331   -
332 285 // 路段路由线路ID
333 286 tempM.put("sectionrouteLine",sectionList.get(i)[1]);
334   -
335 287 // 路段路由线路编码
336 288 tempM.put("sectionrouteLineCode",sectionList.get(i)[2]);
337   -
338 289 // 路段路由路段ID
339 290 tempM.put("sectionrouteSection",sectionList.get(i)[3]);
340   -
341 291 // 路段路由路段编码
342 292 tempM.put("sectionrouteSectionCode",sectionList.get(i)[4]);
343   -
344 293 tempM.put("sectionrouteCode",sectionList.get(i)[5]);
345   -
346 294 tempM.put("sectionrouteDirections",sectionList.get(i)[6]);
347   -
348 295 // 路段ID
349 296 tempM.put("sectionId",sectionList.get(i)[7]);
350   -
351 297 // 路段编码
352 298 tempM.put("sectionCode",sectionList.get(i)[8]);
353   -
354 299 // 路段名称
355 300 tempM.put("sectionName",sectionList.get(i)[9]);
356   -
357 301 // 道路编码
358 302 tempM.put("sectionCrosesRoad",sectionList.get(i)[10]);
359   -
360 303 // 终点站
361 304 tempM.put("sectionEndNode",sectionList.get(i)[11]);
362   -
363 305 // 起始节点
364 306 tempM.put("sectionStartNode",sectionList.get(i)[12]);
365   -
366 307 // 中间节点
367 308 tempM.put("sectionMiddleNode",sectionList.get(i)[13]);
368   -
369 309 // 路段类型
370 310 tempM.put("sectionType",sectionList.get(i)[14]);
371   -
372 311 // 路段折线图形城建坐标
373 312 tempM.put("sectionCsectionVector",sectionList.get(i)[15]);
374   -
375 313 // 路段折线图形百度坐标
376 314 tempM.put("sectionBsectionVector",sectionList.get(i)[16]);
377   -
378 315 // 路段折线图形WGS坐标
379 316 tempM.put("sectionGsectionVector",sectionList.get(i)[17]);
380   -
381 317 // 道路编码
382 318 tempM.put("sectionRoadCoding",sectionList.get(i)[18]);
383   -
384 319 // 路段距离
385 320 tempM.put("sectionDistance",sectionList.get(i)[19]);
386   -
387 321 // 路段时间
388 322 tempM.put("sectionTime",sectionList.get(i)[20]);
389   -
390 323 // 路段原坐标类型
391 324 tempM.put("sectiondbType",sectionList.get(i)[21]);
392   -
393 325 // 限速
394 326 tempM.put("sectionSpeedLimet",sectionList.get(i)[22]);
395   -
396 327 // 是否撤销
397 328 tempM.put("destroy",sectionList.get(i)[23]);
398   -
399 329 // 版本号
400 330 tempM.put("versions",sectionList.get(i)[24]);
401   -
402 331 // 说明
403 332 tempM.put("descriptions",sectionList.get(i)[25]);
404 333 // 说明
405 334 tempM.put("isRoadeSpeed",sectionList.get(i)[26]);
406   -
407 335 tempM.put("name", sectionList.get(i)[9]);
408   -
409 336 tempM.put("text", sectionList.get(i)[9]);
410   -
411 337 tempM.put("icon", null);
412   -
413 338 tempM.put("pId", 300);
414   -
415 339 tempM.put("id", (i+1)*1000);
416   -
417 340 tempM.put("groupType", "3");
418   -
419 341 tempM.put("chaildredType", "section");
420   -
421 342 tempM.put("enable", true);
422   -
423 343 sectionChildren.add(tempM);
424   -
  344 + }
  345 + } else {
  346 + if(stationList.size()>0) {
  347 + Map<String, Object> tempM = new HashMap<String, Object>();
  348 + tempM.put("name", "添加路段");
  349 + tempM.put("text", "添加路段");
  350 + tempM.put("lineId", stationList.get(0)[1]);
  351 + tempM.put("lineCode", stationList.get(0)[5]);
  352 + tempM.put("dir", stationList.get(0)[8]);
  353 + tempM.put("versions", stationList.get(0)[14]);
  354 + tempM.put("icon", null);
  355 + tempM.put("pId", 300);
  356 + tempM.put("id", 1000);
  357 + tempM.put("groupType", "3");
  358 + tempM.put("chaildredType", "addSection");
  359 + tempM.put("sectionBsectionVector", "LINESTRING("+stationList.get(0)[20]+")");
  360 + tempM.put("enable", true);
  361 + sectionChildren.add(tempM);
425 362 }
426 363 }
427 364  
... ... @@ -563,98 +500,102 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
563 500 int len = objects.size();
564 501  
565 502 if(objects.size()>0) {
  503 + // 遍历站点
  504 + traversalStation(objects, resultList, len);
  505 + }
  506 + return resultList;
  507 + }
566 508  
567   - for(int i = 0 ; i < len; i++) {
568   - Map<String, Object> tempM = new HashMap<String,Object>();
  509 + private void traversalStation(List<Object[]> objects, List<Map<String, Object>> resultList, int len) {
  510 + for(int i = 0 ; i < len; i++) {
  511 + Map<String, Object> tempM = new HashMap<String,Object>();
569 512  
570   - tempM.put("stationRouteLine", objects.get(i)[0]);
  513 + tempM.put("stationRouteLine", objects.get(i)[0]);
571 514  
572   - tempM.put("stationRouteStation", objects.get(i)[1]);
  515 + tempM.put("stationRouteStation", objects.get(i)[1]);
573 516  
574   - tempM.put("stationRouteCode", objects.get(i)[2]);
  517 + tempM.put("stationRouteCode", objects.get(i)[2]);
575 518  
576   - tempM.put("stationRouteLIneCode", objects.get(i)[3]);
  519 + tempM.put("stationRouteLIneCode", objects.get(i)[3]);
577 520  
578   - tempM.put("stationRouteStationMark", objects.get(i)[4]);
  521 + tempM.put("stationRouteStationMark", objects.get(i)[4]);
579 522  
580   - tempM.put("stationOutStationNmber", objects.get(i)[5]);
  523 + tempM.put("stationOutStationNmber", objects.get(i)[5]);
581 524  
582   - tempM.put("stationRoutedirections", objects.get(i)[6]);
  525 + tempM.put("stationRoutedirections", objects.get(i)[6]);
583 526  
584   - tempM.put("stationRouteDistances", objects.get(i)[7]);
  527 + tempM.put("stationRouteDistances", objects.get(i)[7]);
585 528  
586   - tempM.put("stationRouteToTime", objects.get(i)[8]);
  529 + tempM.put("stationRouteToTime", objects.get(i)[8]);
587 530  
588   - tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
  531 + tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
589 532  
590   - tempM.put("stationRouteEndTime", objects.get(i)[10]);
  533 + tempM.put("stationRouteEndTime", objects.get(i)[10]);
591 534  
592   - tempM.put("stationRouteDescriptions", objects.get(i)[11]);
  535 + tempM.put("stationRouteDescriptions", objects.get(i)[11]);
593 536  
594   - tempM.put("stationRouteDestroy", objects.get(i)[12]);
  537 + tempM.put("stationRouteDestroy", objects.get(i)[12]);
595 538  
596   - tempM.put("stationRouteVersions", objects.get(i)[13]);
  539 + tempM.put("stationRouteVersions", objects.get(i)[13]);
597 540  
598   - tempM.put("stationRouteCreateBy", objects.get(i)[14]);
  541 + tempM.put("stationRouteCreateBy", objects.get(i)[14]);
599 542  
600   - tempM.put("stationRouteCreateDate", objects.get(i)[15]);
  543 + tempM.put("stationRouteCreateDate", objects.get(i)[15]);
601 544  
602   - tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
  545 + tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
603 546  
604   - tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
  547 + tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
605 548  
606   - tempM.put("stationId", objects.get(i)[18]);
  549 + tempM.put("stationId", objects.get(i)[18]);
607 550  
608   - tempM.put("stationCode", objects.get(i)[19]);
  551 + tempM.put("stationCode", objects.get(i)[19]);
609 552  
610   - tempM.put("stationRouteName", objects.get(i)[20]);
  553 + tempM.put("stationRouteName", objects.get(i)[20]);
611 554  
612   - tempM.put("stationRoadCoding", objects.get(i)[21]);
  555 + tempM.put("stationRoadCoding", objects.get(i)[21]);
613 556  
614   - tempM.put("stationDbType", objects.get(i)[22]);
  557 + tempM.put("stationDbType", objects.get(i)[22]);
615 558  
616   - tempM.put("stationJwpoints", objects.get(i)[23]);
  559 + tempM.put("stationJwpoints", objects.get(i)[23]);
617 560  
618   - tempM.put("stationGlonx", objects.get(i)[24]);
  561 + tempM.put("stationGlonx", objects.get(i)[24]);
619 562  
620   - tempM.put("stationGlaty", objects.get(i)[25]);
  563 + tempM.put("stationGlaty", objects.get(i)[25]);
621 564  
622   - tempM.put("stationX", objects.get(i)[26]);
  565 + tempM.put("stationX", objects.get(i)[26]);
623 566  
624   - tempM.put("stationY", objects.get(i)[27]);
  567 + tempM.put("stationY", objects.get(i)[27]);
625 568  
626   - tempM.put("stationBPolyonGrid", objects.get(i)[28]);
  569 + tempM.put("stationBPolyonGrid", objects.get(i)[28]);
627 570  
628   - tempM.put("stationGPloyonGrid", objects.get(i)[29]);
  571 + tempM.put("stationGPloyonGrid", objects.get(i)[29]);
629 572  
630   - tempM.put("stationDestroy", objects.get(i)[30]);
  573 + tempM.put("stationDestroy", objects.get(i)[30]);
631 574  
632   - tempM.put("stationRadius", objects.get(i)[31]);
  575 + tempM.put("stationRadius", objects.get(i)[31]);
633 576  
634   - tempM.put("stationShapesType", objects.get(i)[32]);
  577 + tempM.put("stationShapesType", objects.get(i)[32]);
635 578  
636   - tempM.put("stationVersions", objects.get(i)[33]);
  579 + tempM.put("stationVersions", objects.get(i)[33]);
637 580  
638   - tempM.put("sttationDescriptions", objects.get(i)[34]);
  581 + tempM.put("sttationDescriptions", objects.get(i)[34]);
639 582  
640   - tempM.put("stationCreateBy", objects.get(i)[35]);
  583 + tempM.put("stationCreateBy", objects.get(i)[35]);
641 584  
642   - tempM.put("stationCreateDate", objects.get(i)[36]);
  585 + tempM.put("stationCreateDate", objects.get(i)[36]);
643 586  
644   - tempM.put("stationUpdateBy", objects.get(i)[37]);
  587 + tempM.put("stationUpdateBy", objects.get(i)[37]);
645 588  
646   - tempM.put("stationUpdateDate", objects.get(i)[38]);
  589 + tempM.put("stationUpdateDate", objects.get(i)[38]);
647 590  
648   - tempM.put("stationRouteId", objects.get(i)[39]);
649   - tempM.put("zdmc", objects.get(i)[40]);
  591 + tempM.put("stationRouteId", objects.get(i)[39]);
  592 + tempM.put("zdmc", objects.get(i)[40]);
650 593  
651   - resultList.add(tempM);
652   - }
653   - }
654   - return resultList;
  594 + resultList.add(tempM);
  595 + }
655 596 }
656 597  
657   - /**
  598 + /**
658 599 * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
659 600 *
660 601 * @param map <lineId:线路ID; direction:方向>
... ... @@ -692,6 +633,29 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
692 633  
693 634 return resultList;
694 635 }
  636 +
  637 + /**
  638 + * @Description :TODO(查询线路某方向下所有站点)
  639 + *
  640 + * @param map <lineId:线路ID; direction:方向>
  641 + *
  642 + * @return List<Map<String, Object>>
  643 + */
  644 + @Override
  645 + public List<Map<String, Object>> getStationRouteList(Map<String, Object> map) {
  646 + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
  647 + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
  648 + List<Object[]> objects = repository.getStationRouteList(lineId, direction);
  649 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  650 +
  651 + int len = objects.size();
  652 +
  653 + if(objects.size()>0) {
  654 + // 遍历站点
  655 + traversalStation(objects, resultList, len);
  656 + }
  657 + return resultList;
  658 + }
695 659  
696 660  
697 661 /**
... ... @@ -774,109 +738,72 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
774 738 */
775 739 @Override
776 740 public Map<String, Object> usingSingle(Map<String, Object> map) {
777   -
778 741 // 返回值map
779 742 Map<String, Object> resultMap = new HashMap<String,Object>();
780   -
781 743 try {
782   -
783 744 // 获取线路ID
784 745 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
785   -
786 746 /** 查询线路信息 @param:<lineId:线路ID> */
787 747 Line line = lineRepository.findOne(lineId);
788   -
789 748 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */
790 749 List<Object[]> objects = repository.usingSingle(lineId);
791   -
792 750 if (objects.size()>0) {
793   -
794 751 /** 获取配置文件里的ftp登录参数 */
795 752 Map<String, Object> FTPParamMap = readPropertiesGetFTPParam();
796   -
797 753 // 压缩文件名
798 754 String odlGzFileName = line.getLineCode() + ".txt.gz";
799   -
800 755 // txt文件名
801 756 String textFileName = line.getLineCode() + ".txt";
802   -
803 757 // 创建一个ftp上传实例
804 758 FTPClientUtils clientUtils = new FTPClientUtils();
805   -
806 759 // IP
807 760 String url = FTPParamMap.get("url").toString();
808   -
809 761 // 端口
810 762 int port = Integer.valueOf(FTPParamMap.get("port").toString());
811   -
812 763 // 用户名
813 764 String username = FTPParamMap.get("username").toString();
814   -
815 765 // 密码
816 766 String password = FTPParamMap.get("password").toString();
817   -
818 767 // 相对路径
819 768 String remotePath = FTPParamMap.get("remotePath").toString();
820   -
821 769 /** 如果已存在相同行单文件名则先删除 */
822 770 clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName);
823   -
824 771 clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName);
825   -
826 772 String textStr = "";
827   -
828   - boolean tempTag = ishxType(objects);
829   -
830   - if(tempTag)
  773 +// boolean tempTag = ishxType(objects);
  774 + Integer linePlayType = line.getLinePlayType() == null ? -1:line.getLinePlayType();
  775 + if(linePlayType == 1)
831 776 textStr = hxTextFileToFtp(objects,lineId);// 环线行单文件内容
832   - else
  777 + else if (linePlayType == 0)
833 778 textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/
834   -
835   - /*textStr = line.getName() + "\t" + "2" + "\r" + textStr;*/
836   -
  779 + else
  780 + resultMap.put("status","NOLinePlayType");// 线路无线路规划类型
837 781 textStr = line.getName() + " " + "2" + "\r" + textStr;
838   -
839 782 InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk"));
840   -
841 783 /** 生成txt文件,上传ftp */
842 784 clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input);
843   -
844 785 // 创建打包实例
845 786 PackTarGZUtils packTarGZUtils= new PackTarGZUtils();
846   -
847 787 /** 获取txt文件 */
848 788 File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName);
849   -
850 789 File target = new File(odlGzFileName);
851   -
852 790 // 将txt文件打包
853 791 File targetFile = PackTarGZUtils.compress(textFile, target);
854   -
855   - /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/
856   -
857 792 clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath);
858   -
859 793 // 删除文件
860 794 textFile.delete();
861 795 targetFile.delete();
862   -
863 796 resultMap.put("status", ResponseCode.SUCCESS);
864   -
865 797 }else {
866   -
867 798 resultMap.put("status","NOTDATA");
868 799 }
869   -
870   -
871 800 } catch (Exception e) {
872   -
873 801 resultMap.put("status", ResponseCode.ERROR);
874   -
875 802 logger.error("save erro.", e);
876   -
877   - }
  803 + }
878 804 return resultMap;
879 805 }
  806 + // 判断线路走向是环线还是双向
880 807 public boolean ishxType(List<Object[]> listObj) {
881 808 boolean tag = true;
882 809 String pointBStr[] = null,pointEStr[] = null;
... ... @@ -889,9 +816,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
889 816 if(Integer.valueOf(listObj.get(i)[8].toString())==1)
890 817 numzd++;
891 818 }
892   - Point p1 = new Point(Double.valueOf(pointBStr[0]),Double.valueOf(pointBStr[1]));
  819 + Point p1 = new Point(Double.valueOf(pointBStr[0]),Double.valueOf(pointBStr[1]));
893 820 Point p2 = new Point(Double.valueOf(pointEStr[0]),Double.valueOf(pointEStr[1]));
894   - if(GeoUtils.getDistance(p1, p2)>100 && numzd>2)
  821 + if(GeoUtils.getDistance(p1, p2)>100 && numzd>2)
895 822 tag = false;
896 823 return tag;
897 824 }
... ... @@ -1241,95 +1168,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1241 1168 int len = objects.size();
1242 1169  
1243 1170 if(objects.size()>0) {
1244   -
1245   - for(int i = 0 ; i < len; i++) {
1246   - Map<String, Object> tempM = new HashMap<String,Object>();
1247   -
1248   - tempM.put("stationRouteLine", objects.get(i)[0]);
1249   -
1250   - tempM.put("stationRouteStation", objects.get(i)[1]);
1251   -
1252   - tempM.put("stationRouteCode", objects.get(i)[2]);
1253   -
1254   - tempM.put("stationRouteLIneCode", objects.get(i)[3]);
1255   -
1256   - tempM.put("stationRouteStationMark", objects.get(i)[4]);
1257   -
1258   - tempM.put("stationOutStationNmber", objects.get(i)[5]);
1259   -
1260   - tempM.put("stationRoutedirections", objects.get(i)[6]);
1261   -
1262   - tempM.put("stationRouteDistances", objects.get(i)[7]);
1263   -
1264   - tempM.put("stationRouteToTime", objects.get(i)[8]);
1265   -
1266   - tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
1267   -
1268   - tempM.put("stationRouteEndTime", objects.get(i)[10]);
1269   -
1270   - tempM.put("stationRouteDescriptions", objects.get(i)[11]);
1271   -
1272   - tempM.put("stationRouteDestroy", objects.get(i)[12]);
1273   -
1274   - tempM.put("stationRouteVersions", objects.get(i)[13]);
1275   -
1276   - tempM.put("stationRouteCreateBy", objects.get(i)[14]);
1277   -
1278   - tempM.put("stationRouteCreateDate", objects.get(i)[15]);
1279   -
1280   - tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
1281   -
1282   - tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
1283   -
1284   - tempM.put("stationId", objects.get(i)[18]);
1285   -
1286   - tempM.put("stationCode", objects.get(i)[19]);
1287   -
1288   - tempM.put("stationRouteName", objects.get(i)[20]);
1289   -
1290   - tempM.put("stationRoadCoding", objects.get(i)[21]);
1291   -
1292   - tempM.put("stationDbType", objects.get(i)[22]);
1293   -
1294   - tempM.put("stationJwpoints", objects.get(i)[23]);
1295   -
1296   - tempM.put("stationGlonx", objects.get(i)[24]);
1297   -
1298   - tempM.put("stationGlaty", objects.get(i)[25]);
1299   -
1300   - tempM.put("stationX", objects.get(i)[26]);
1301   -
1302   - tempM.put("stationY", objects.get(i)[27]);
1303   -
1304   - tempM.put("stationBPolyonGrid", objects.get(i)[28]);
1305   -
1306   - tempM.put("stationGPloyonGrid", objects.get(i)[29]);
1307   -
1308   - tempM.put("stationDestroy", objects.get(i)[30]);
1309   -
1310   - tempM.put("stationRadius", objects.get(i)[31]);
1311   -
1312   - tempM.put("stationShapesType", objects.get(i)[32]);
1313   -
1314   - tempM.put("stationVersions", objects.get(i)[33]);
1315   -
1316   - tempM.put("sttationDescriptions", objects.get(i)[34]);
1317   -
1318   - tempM.put("stationCreateBy", objects.get(i)[35]);
1319   -
1320   - tempM.put("stationCreateDate", objects.get(i)[36]);
1321   -
1322   - tempM.put("stationUpdateBy", objects.get(i)[37]);
1323   -
1324   - tempM.put("stationUpdateDate", objects.get(i)[38]);
1325   -
1326   - tempM.put("stationRouteId", objects.get(i)[39]);
1327   - tempM.put("zdmc", objects.get(i)[40]);
1328   -
1329   - resultList.add(tempM);
1330   - }
1331   -
1332   - }
  1171 +
  1172 + traversalStation(objects, resultList, len);
  1173 +
  1174 + }
1333 1175  
1334 1176 return resultList;
1335 1177 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.bsth.common.ResponseCode;
4 5 import com.bsth.data.BasicData;
5 6 import com.bsth.data.Station2ParkBuffer;
... ... @@ -137,6 +138,8 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
137 138 Map<String, Object> rs = new HashMap();
138 139 try {
139 140 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  141 + logger.info("cts: " + JSON.toJSONString(t));
  142 + logger.info("sch: " + JSON.toJSONString(sch));
140 143 //保存起终点名称
141 144 if(StringUtils.isEmpty(t.getStartStationName()))
142 145 t.setStartStationName(getStationName(sch.getXlBm(), t.getStartStation()));
... ... @@ -151,7 +154,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
151 154 ChildTaskPlan task = null;
152 155 Set<ChildTaskPlan> set = sch.getcTasks();
153 156 for(ChildTaskPlan obj : set){
154   - if(obj.getId() == t.getId()){
  157 + if(obj.getId().intValue() == t.getId().intValue()){
155 158 task = obj;
156 159 break;
157 160 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
698 698 //数据库删除
699 699 rs = super.delete(id);
700 700 if(rs.get("status").equals(ResponseCode.SUCCESS)){
701   - /*ScheduleRealInfo temp = super.findById(id);
702   - if(temp != null){
703   - rs.put("status", ResponseCode.ERROR);
704   - rs.put("msg", "删除失败,请重试!");
705   - return rs;
706   - }*/
707   -
708 701 dayOfSchedule.delete(sch);
709 702 //更新起点应到时间
710 703 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch);
... ... @@ -1027,12 +1020,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1027 1020 !zdsj.equals(zdsjActual) &&
1028 1021 !zdsj.equals("")&&
1029 1022 !zdsjActual.equals("")) {
  1023 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  1024 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
1030 1025 if (zdsj.compareTo(zdsjActual) > 0) {
1031   - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
1032   - maps.put("slow", "");
  1026 + if(zdsjT - zdsjAT > 1000){
  1027 + maps.put("fast", "");
  1028 + maps.put("slow", zdsjAT - zdsjT + 1440);
  1029 + } else {
  1030 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1031 + maps.put("slow", "");
  1032 + }
1033 1033 } else {
1034   - maps.put("fast", "");
1035   - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1034 + if(zdsjAT - zdsjT > 1000){
  1035 + maps.put("fast", zdsjT - zdsjAT + 1440);
  1036 + maps.put("slow", "");
  1037 + } else {
  1038 + maps.put("fast", "");
  1039 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1040 + }
1036 1041 }
1037 1042 } else {
1038 1043 maps.put("fast", "");
... ... @@ -3707,12 +3712,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3707 3712 String zdsjActual = scheduleRealInfo.getZdsjActual();
3708 3713 if (zdsj != null && zdsjActual != null &&
3709 3714 !zdsj.equals(zdsjActual)) {
  3715 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  3716 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
3710 3717 if (zdsj.compareTo(zdsjActual) > 0) {
3711   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
3712   - map.put("slow", "");
  3718 + if(zdsjT - zdsjAT > 1000){
  3719 + map.put("fast", "");
  3720 + map.put("slow", zdsjAT - zdsjT + 1440);
  3721 + } else {
  3722 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3723 + map.put("slow", "");
  3724 + }
3713 3725 } else {
3714   - map.put("fast", "");
3715   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3726 + if(zdsjAT - zdsjT > 1000){
  3727 + map.put("fast", zdsjT - zdsjAT + 1440);
  3728 + map.put("slow", "");
  3729 + } else {
  3730 + map.put("fast", "");
  3731 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3732 + }
3716 3733 }
3717 3734 } else {
3718 3735 map.put("fast", "");
... ... @@ -4703,12 +4720,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4703 4720 !zdsj.equals(zdsjActual) &&
4704 4721 !zdsj.equals("")&&
4705 4722 !zdsjActual.equals("")) {
  4723 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  4724 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
4706 4725 if (zdsj.compareTo(zdsjActual) > 0) {
4707   - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
4708   - maps.put("slow", "");
  4726 + if(zdsjT - zdsjAT > 1000){
  4727 + maps.put("fast", "");
  4728 + maps.put("slow", zdsjAT - zdsjT + 1440);
  4729 + } else {
  4730 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4731 + maps.put("slow", "");
  4732 + }
4709 4733 } else {
4710   - maps.put("fast", "");
4711   - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4734 + if(zdsjAT - zdsjT > 1000){
  4735 + maps.put("fast", zdsjT - zdsjAT + 1440);
  4736 + maps.put("slow", "");
  4737 + } else {
  4738 + maps.put("fast", "");
  4739 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4740 + }
4712 4741 }
4713 4742 } else {
4714 4743 maps.put("fast", "");
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -93,8 +93,10 @@ public class ReportServiceImpl implements ReportService{
93 93 String sbbb=BasicData.deviceId2NbbmMap.inverse().get(clzbh);
94 94 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
95 95 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
96   - Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
97   - Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
  96 +// Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
  97 +// Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
  98 + Long date1=simpleDateFormat.parse(sjfc+":00").getTime();
  99 + Long date2=simpleDateFormat.parse(sjdd+":00").getTime();
98 100 Date dates=simpleDateFormat.parse(date+" 00:00:00");
99 101 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates,date);
100 102  
... ... @@ -129,20 +131,22 @@ public class ReportServiceImpl implements ReportService{
129 131 cal.setTime(dates);
130 132 //周数,表分区字段
131 133 int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
132   -
  134 + int weeks_year_next=weeks_year +1;
133 135 Connection conn = null;
134 136 PreparedStatement ps = null;
135 137 ResultSet rs = null;
136 138 String year=date.substring(0,4);
137   - String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  139 + String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? "
  140 + + " AND weeks_year>=? AND weeks_year<=? AND ts >= ? AND ts <=? order by ts";
138 141 try{
139 142 conn = DBUtils_MS.getConnection();
140 143 ps = conn.prepareStatement(sql);
141 144 ps.setString(1, sbbb);
142 145 ps.setString(2,line);
143 146 ps.setInt(3, weeks_year);
144   - ps.setLong(4, date1);
145   - ps.setLong(5, date2);
  147 + ps.setInt(4, weeks_year_next);
  148 + ps.setLong(5, date1);
  149 + ps.setLong(6, date2);
146 150 rs = ps.executeQuery();
147 151  
148 152 list = resultSet2Set(rs);
... ...
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
... ... @@ -44,6 +44,7 @@ import com.bsth.util.BatchSaveUtils;
44 44 import com.bsth.util.ComparableChild;
45 45 import com.bsth.util.ComparableReal;
46 46 import com.bsth.util.ReportRelatedUtils;
  47 +import com.bsth.util.ReportUtils;
47 48 import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
48 49  
49 50 @Service
... ... @@ -611,6 +612,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
611 612 }
612 613  
613 614 }
  615 +
  616 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  617 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  618 + Map<String, Object> m = new HashMap<String, Object>();
  619 + m.put("date", date);
  620 + m.put("endDate", endDate);
  621 + ReportUtils ee = new ReportUtils();
  622 + try {
  623 + listI.add(listmap.iterator());
  624 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  625 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList.xls",
  626 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  627 + } catch (Exception e) {
  628 + // TODO: handle exception
  629 + e.printStackTrace();
  630 + }
  631 + }
  632 +
614 633 return listmap;
615 634 }
616 635  
... ... @@ -738,7 +757,33 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
738 757 // TODO Auto-generated catch block
739 758 e.printStackTrace();
740 759 }
741   -
  760 + }
  761 +
  762 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  763 + Map<String, Object> m = new HashMap<String, Object>();
  764 + ReportUtils ee = new ReportUtils();
  765 + try {
  766 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  767 + for(int i = 0; i < list.size(); i++){
  768 + Map<String, Object> temp = new HashMap<String, Object>();
  769 + Sheet s = list.get(i);
  770 + temp.put("id", i+1);
  771 + temp.put("date", s.getDate());
  772 + temp.put("line", s.getLine());
  773 + temp.put("zdname", s.getZdname());
  774 + temp.put("jhsj", s.getJhsj());
  775 + temp.put("sjsj", s.getSjsj());
  776 + temp.put("sfzd", s.getSfzd());
  777 + tempList.add(temp);
  778 + }
  779 + listI.add(tempList.iterator());
  780 + m.put("date", sheet.getDate());
  781 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  782 + ee.excelReplace(listI, new Object[]{m}, path + "mould/sheetList2.xls",
  783 + path + "export/发车准点率"+sheet.getDate().replaceAll("-", "")+".xls");
  784 + } catch (Exception e) {
  785 + // TODO: handle exception
  786 + e.printStackTrace();
742 787 }
743 788  
744 789 return list;
... ... @@ -800,6 +845,24 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
800 845 listmap.add(newmap);
801 846 }
802 847 }
  848 +
  849 + if(map.containsKey("type") && map.get("type").toString().equals("export")){
  850 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  851 + Map<String, Object> m = new HashMap<String, Object>();
  852 + m.put("date", date);
  853 + m.put("endDate", endDate);
  854 + ReportUtils ee = new ReportUtils();
  855 + try {
  856 + listI.add(listmap.iterator());
  857 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  858 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "sheetList1.xls",
  859 + path + "export/发车准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  860 + } catch (Exception e) {
  861 + // TODO: handle exception
  862 + e.printStackTrace();
  863 + }
  864 + }
  865 +
803 866 return listmap;
804 867 }
805 868  
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
... ... @@ -63,6 +63,8 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
63 63 /** 售票员工号s */
64 64 private List<String> spyGhs;
65 65  
  66 + /** 创建时间 */
  67 + private Date createDate;
66 68 /** 修改时间 */
67 69 private Date updateDate;
68 70 /** 修改人名 */
... ... @@ -70,6 +72,14 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
70 72 /** 时刻表名字 */
71 73 private String ttInfoName;
72 74  
  75 + //------------------- 修改yuan原因,描述,次数 ------------------------//
  76 + // 修改次数
  77 + private Integer m_count;
  78 + // 修改原因
  79 + private Integer m_reason;
  80 + // 修改描述
  81 + private String m_desc;
  82 +
73 83 @Override
74 84 public int compareTo(SchedulePlanGroupInfo o) {
75 85 // 路牌名字排序,数字路牌名在前,非数字在后
... ... @@ -104,9 +114,13 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
104 114 ", GROUP_CONCAT(distinct info.j_gh order by info.fcno) as jsyGhs " +
105 115 ", GROUP_CONCAT(distinct info.s_name order by info.fcno) as spyNames " +
106 116 ", GROUP_CONCAT(distinct info.s_gh order by info.fcno) as spyGhs " +
  117 + ", max(info.create_date) as createDate " +
107 118 ", max(info.update_date) as updateDate " +
108 119 ", max(user.user_name) as updateUserName " +
109 120 ", max(info.tt_info_name) as ttInfoName " +
  121 + ", max(info.modify_count) as m_count " +
  122 + ", max(info.modify_reason) as m_reason " +
  123 + ", max(info.modify_remark) as m_desc " +
110 124 "from bsth_c_s_sp_info info left join bsth_c_sys_user user on info.update_by = user.id " +
111 125 "left join bsth_c_s_gbi gbi on info.lp = gbi.id " +
112 126 "where info.xl = ? and info.schedule_date = ? " +
... ... @@ -171,10 +185,15 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
171 185 this.spyGhs.addAll(Arrays.asList(spyGhs_temp.split(",")));
172 186 }
173 187  
  188 + this.createDate = new Date(rs.getTimestamp("createDate").getTime());
174 189 this.updateDate = new Date(rs.getTimestamp("updateDate").getTime());
175 190 this.updateByName = rs.getString("updateUserName");
176 191 this.ttInfoName = rs.getString("ttInfoName");
177 192  
  193 + this.m_count = rs.getInt("m_count");
  194 + this.m_reason = rs.getInt("m_reason");
  195 + this.m_desc = rs.getString("m_desc");
  196 +
178 197 }
179 198  
180 199 public Integer getXlId() {
... ... @@ -296,6 +315,38 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
296 315 public void setTtInfoName(String ttInfoName) {
297 316 this.ttInfoName = ttInfoName;
298 317 }
  318 +
  319 + public Integer getM_count() {
  320 + return m_count;
  321 + }
  322 +
  323 + public void setM_count(Integer m_count) {
  324 + this.m_count = m_count;
  325 + }
  326 +
  327 + public Integer getM_reason() {
  328 + return m_reason;
  329 + }
  330 +
  331 + public void setM_reason(Integer m_reason) {
  332 + this.m_reason = m_reason;
  333 + }
  334 +
  335 + public String getM_desc() {
  336 + return m_desc;
  337 + }
  338 +
  339 + public void setM_desc(String m_desc) {
  340 + this.m_desc = m_desc;
  341 + }
  342 +
  343 + public Date getCreateDate() {
  344 + return createDate;
  345 + }
  346 +
  347 + public void setCreateDate(Date createDate) {
  348 + this.createDate = createDate;
  349 + }
299 350 }
300 351  
301 352 //---------------------------- 以下是过去版本 -------------------------------//
... ...
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
... ... @@ -556,15 +556,33 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
556 556 Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1());
557 557 Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2());
558 558 PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1),
  559 + "报到", new Color(0x96b9d7));
  560 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (2),
559 561 "出场", new Color(0x96b9d7));
560 562 for (int i = 1; i <= groupCount; i++) {
561   - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2),
562   - station1.getStationName(), new Color(0x96b9d7));
563 563 PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1),
  564 + station1.getStationName(), new Color(0x96b9d7));
  565 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2),
564 566 station2.getStationName(), new Color(0x96b9d7));
565 567 }
566   - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2),
  568 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 3),
567 569 "进场", new Color(0x96b9d7));
  570 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 4),
  571 + "离场", new Color(0x96b9d7));
  572 +
  573 + // 路牌统计字段
  574 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 5),
  575 + "总公里", new Color(0x96b9d7));
  576 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 6),
  577 + "营业公里", new Color(0x96b9d7));
  578 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 7),
  579 + "空驶公里", new Color(0x96b9d7));
  580 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 8),
  581 + "总工时", new Color(0x96b9d7));
  582 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 9),
  583 + "营业工时", new Color(0x96b9d7));
  584 + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 10),
  585 + "营运班次", new Color(0x96b9d7));
568 586  
569 587 // 构建每个路牌的班次数据
570 588 for (int i = 0; i < lpObjList.size(); i++) {
... ... @@ -572,34 +590,86 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
572 590 XSSFRow lpRow = sheet.createRow((short) (i + 1));
573 591 PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname());
574 592 PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (1));
  593 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (2));
575 594 for (int j = 1; j <= groupCount; j++) {
576   - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2));
577 595 PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1));
  596 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2));
578 597 }
579   - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2));
  598 +
  599 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 3));
  600 + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 4));
580 601  
581 602 for (BcObj bcObj : lpObj.getBcObjList()) {
582 603 if (bcObj.getBcType() == BcType.NORMAL) {
583   - Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 2));
  604 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
584 605 cell.setCellValue(bcObj.getFcsj());
  606 +
  607 + } else if (bcObj.getBcType() == BcType.BD) {
  608 + if (bcObj.getGroupNo() == -1) {
  609 + Cell cell = lpRow.getCell((short) 1);
  610 + cell.setCellValue(bcObj.getFcsj());
  611 + } else if (bcObj.getGroupNo() > 0) { // 分班报到
  612 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  613 + cell.setCellValue("报" + bcObj.getFcsj());
  614 +
  615 + }
  616 +
585 617 } else if (bcObj.getBcType() == BcType.OUT) {
586   - Cell cell = lpRow.getCell((short) (1));
587   - cell.setCellValue(bcObj.getFcsj());
  618 + if (bcObj.getGroupNo() == -1) {
  619 + Cell cell = lpRow.getCell((short) (2));
  620 + cell.setCellValue(bcObj.getFcsj());
  621 + } else if (bcObj.getGroupNo() > 0) { // 分班出场
  622 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  623 + cell.setCellValue("出" + bcObj.getFcsj());
  624 + }
  625 +
588 626 } else if (bcObj.getBcType() == BcType.IN) {
589   - Cell cell = lpRow.getCell((short) (groupCount * 2 + 2));
590   - cell.setCellValue(bcObj.getFcsj());
  627 + if (bcObj.getGroupNo() == -2) {
  628 + Cell cell = lpRow.getCell((short) (groupCount * 2 + 3));
  629 + cell.setCellValue(bcObj.getFcsj());
  630 + } else if (bcObj.getGroupNo() > 0) { //分班进场
  631 + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3));
  632 + // 停驶用 ※
  633 + cell.setCellValue(bcObj.getFcsj() + "X");
  634 + }
  635 +
  636 + } else if (bcObj.getBcType() == BcType.LC) {
  637 + if (bcObj.getGroupNo() == -2) {
  638 + Cell cell = lpRow.getCell((short) (groupCount * 2 + 4));
  639 + cell.setCellValue(bcObj.getFcsj());
  640 + }
  641 +
591 642 }
592 643 }
  644 +
  645 + // 路牌统计字段
  646 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 5), lpObj.getZlc());
  647 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getYylc());
  648 + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getKslc());
  649 + PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 8),
  650 + String.format("%d小时%d分钟", (int) (lpObj.getZgs() / 60), (int) (lpObj.getZgs() % 60)));
  651 + PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 9),
  652 + String.format("%d小时%d分钟", (int) (lpObj.getYygs() / 60), (int) (lpObj.getYygs() % 60)));
  653 + PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 10), lpObj.getYybc());
  654 +
593 655 }
594 656  
595 657 // 自适应单元格长宽
596 658 sheet.autoSizeColumn(0);
597 659 sheet.autoSizeColumn(1);
  660 + sheet.autoSizeColumn(2);
598 661 for (int i = 1; i <= groupCount; i++) {
599   - sheet.autoSizeColumn(i * 2);
600 662 sheet.autoSizeColumn(i * 2 + 1);
  663 + sheet.autoSizeColumn(i * 2 + 2);
601 664 }
602   -
  665 + sheet.autoSizeColumn(groupCount * 2 + 3);
  666 + sheet.autoSizeColumn(groupCount * 2 + 4);
  667 + sheet.autoSizeColumn(groupCount * 2 + 5);
  668 + sheet.autoSizeColumn(groupCount * 2 + 6);
  669 + sheet.autoSizeColumn(groupCount * 2 + 7);
  670 + sheet.autoSizeColumn(groupCount * 2 + 8);
  671 + sheet.autoSizeColumn(groupCount * 2 + 9);
  672 + sheet.autoSizeColumn(groupCount * 2 + 10);
603 673 }
604 674  
605 675 @Override
... ...
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
1   -package com.bsth.service.schedule.datatools;
2   -
3   -import com.bsth.service.schedule.exception.ScheduleException;
4   -import com.bsth.service.schedule.utils.DataToolsFile;
5   -import com.fasterxml.jackson.annotation.JsonCreator;
6   -import com.fasterxml.jackson.annotation.JsonValue;
7   -
8   -import java.util.List;
9   -
10   -/**
11   - * 动态时刻表数据。
12   - */
13   -public interface TTinfoDetailDynamicData {
14   -
15   - //---------------------- 生成时刻表用对象(以下) ---------------------//
16   - public static enum BcType { // 班次类型枚举
17   - IN("in"), // 进场
18   - OUT("out"), // 出场
19   - BD("bd"), // 早例保
20   - LC("lc"), // 晚例保
21   - NORMAL("normal"); // 正常
22   - private String flag;
23   -
24   - @JsonCreator
25   - private BcType(String flag) {
26   - this.flag = flag;
27   - }
28   -
29   - @JsonValue
30   - public String getFlag() {
31   - return flag;
32   - }
33   -
34   - public void setFlag(String flag) {
35   - this.flag = flag;
36   - }
37   - }
38   -
39   - public static class BcObj { // 班次对象
40   - /** 班次时间 */
41   - private Integer bcsj;
42   - /** 停站时间 */
43   - private Integer ssj;
44   - /** 吃饭时间 */
45   - private Integer eatsj;
46   -
47   - /** 停车场id */
48   - private Integer tccid;
49   - /** 起点站id */
50   - private Integer qdzid;
51   - /** 终点站id */
52   - private Integer zdzid;
53   -
54   - /** 是否上行 */
55   - private Boolean isUp;
56   -
57   - /** 班次类型 */
58   - private BcType bcType;
59   - /** 发车时刻 */
60   - private String fcsj;
61   - /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */
62   - private String fcsjDesc;
63   -
64   - /** 第几圈(从1开始) */
65   - private Integer groupNo;
66   - /** 圈里第几个班次(1或者2) */
67   - private Integer groupBcNo;
68   -
69   - public Integer getBcsj() {
70   - return bcsj;
71   - }
72   -
73   - public void setBcsj(Integer bcsj) {
74   - this.bcsj = bcsj;
75   - }
76   -
77   - public Integer getSsj() {
78   - return ssj;
79   - }
80   -
81   - public void setSsj(Integer ssj) {
82   - this.ssj = ssj;
83   - }
84   -
85   - public Integer getEatsj() {
86   - return eatsj;
87   - }
88   -
89   - public void setEatsj(Integer eatsj) {
90   - this.eatsj = eatsj;
91   - }
92   -
93   - public Integer getTccid() {
94   - return tccid;
95   - }
96   -
97   - public void setTccid(Integer tccid) {
98   - this.tccid = tccid;
99   - }
100   -
101   - public Integer getQdzid() {
102   - return qdzid;
103   - }
104   -
105   - public void setQdzid(Integer qdzid) {
106   - this.qdzid = qdzid;
107   - }
108   -
109   - public Integer getZdzid() {
110   - return zdzid;
111   - }
112   -
113   - public void setZdzid(Integer zdzid) {
114   - this.zdzid = zdzid;
115   - }
116   -
117   - public BcType getBcType() {
118   - return bcType;
119   - }
120   -
121   - public void setBcType(BcType bcType) {
122   - this.bcType = bcType;
123   - }
124   -
125   - public String getFcsj() {
126   - return fcsj;
127   - }
128   -
129   - public void setFcsj(String fcsj) {
130   - this.fcsj = fcsj;
131   - }
132   -
133   - public Boolean getIsUp() {
134   - return isUp;
135   - }
136   -
137   - public void setIsUp(Boolean isUp) {
138   - this.isUp = isUp;
139   - }
140   -
141   - public Integer getGroupNo() {
142   - return groupNo;
143   - }
144   -
145   - public void setGroupNo(Integer groupNo) {
146   - this.groupNo = groupNo;
147   - }
148   -
149   - public Integer getGroupBcNo() {
150   - return groupBcNo;
151   - }
152   -
153   - public void setGroupBcNo(Integer groupBcNo) {
154   - this.groupBcNo = groupBcNo;
155   - }
156   -
157   - public Boolean getUp() {
158   - return isUp;
159   - }
160   -
161   - public void setUp(Boolean up) {
162   - isUp = up;
163   - }
164   -
165   - public String getFcsjDesc() {
166   - return fcsjDesc;
167   - }
168   -
169   - public void setFcsjDesc(String fcsjDesc) {
170   - this.fcsjDesc = fcsjDesc;
171   - }
172   - }
173   -
174   - public static class LpObj { // 路牌对象
175   - /** 路牌名字 */
176   - private String lpname;
177   - /** 每圈的第一个班次是否上行 */
178   - private Boolean isUp;
179   -
180   - /** 第一个班次起点站路由id */
181   - private Integer stationRouteId1;
182   - /** 第二个班次起点站路由id */
183   - private Integer stationRouteId2;
184   -
185   - /** 班次列表 */
186   - private List<BcObj> bcObjList;
187   - /** 总圈数 */
188   - private Integer groupCount;
189   -
190   - /** 总工时 */
191   - private Double zgs;
192   - /** 总班次 */
193   - private Integer zbc;
194   -
195   -
196   - public String getLpname() {
197   - return lpname;
198   - }
199   -
200   - public void setLpname(String lpname) {
201   - this.lpname = lpname;
202   - }
203   -
204   - public Boolean getIsUp() {
205   - return isUp;
206   - }
207   -
208   - public void setIsUp(Boolean isUp) {
209   - this.isUp = isUp;
210   - }
211   -
212   - public List<BcObj> getBcObjList() {
213   - return bcObjList;
214   - }
215   -
216   - public void setBcObjList(List<BcObj> bcObjList) {
217   - this.bcObjList = bcObjList;
218   - }
219   -
220   - public Integer getGroupCount() {
221   - return groupCount;
222   - }
223   -
224   - public void setGroupCount(Integer groupCount) {
225   - this.groupCount = groupCount;
226   - }
227   -
228   - public Double getZgs() {
229   - return zgs;
230   - }
231   -
232   - public void setZgs(Double zgs) {
233   - this.zgs = zgs;
234   - }
235   -
236   - public Integer getZbc() {
237   - return zbc;
238   - }
239   -
240   - public void setZbc(Integer zbc) {
241   - this.zbc = zbc;
242   - }
243   -
244   - public Integer getStationRouteId1() {
245   - return stationRouteId1;
246   - }
247   -
248   - public void setStationRouteId1(Integer stationRouteId1) {
249   - this.stationRouteId1 = stationRouteId1;
250   - }
251   -
252   - public Integer getStationRouteId2() {
253   - return stationRouteId2;
254   - }
255   -
256   - public void setStationRouteId2(Integer stationRouteId2) {
257   - this.stationRouteId2 = stationRouteId2;
258   - }
259   - }
260   -
261   - public static class StatInfo { // 统计数据对象
262   - /** 统计项目 */
263   - private String statItem;
264   - /** 统计值 */
265   - private Double statValue;
266   -
267   - public String getStatItem() {
268   - return statItem;
269   - }
270   -
271   - public void setStatItem(String statItem) {
272   - this.statItem = statItem;
273   - }
274   -
275   - public Double getStatValue() {
276   - return statValue;
277   - }
278   -
279   - public void setStatValue(Double statValue) {
280   - this.statValue = statValue;
281   - }
282   - }
283   -
284   - public static class DTInfos { // 所有数据信息
285   - /** 路牌班次数据列表 */
286   - private List<LpObj> lpObjList;
287   - /** 统计数据列表 */
288   - private List<StatInfo> statInfoList;
289   -
290   - public List<LpObj> getLpObjList() {
291   - return lpObjList;
292   - }
293   -
294   - public void setLpObjList(List<LpObj> lpObjList) {
295   - this.lpObjList = lpObjList;
296   - }
297   -
298   - public List<StatInfo> getStatInfoList() {
299   - return statInfoList;
300   - }
301   -
302   - public void setStatInfoList(List<StatInfo> statInfoList) {
303   - this.statInfoList = statInfoList;
304   - }
305   - }
306   -
307   - //---------------------- 生成时刻表用对象(以上) ---------------------//
308   -
309   - /**
310   - * 导出动态时刻表数据。
311   - * @param dtInfos
312   - * @return
313   - * @throws ScheduleException
314   - */
315   - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException;
316   -}
  1 +package com.bsth.service.schedule.datatools;
  2 +
  3 +import com.bsth.service.schedule.exception.ScheduleException;
  4 +import com.bsth.service.schedule.utils.DataToolsFile;
  5 +import com.fasterxml.jackson.annotation.JsonCreator;
  6 +import com.fasterxml.jackson.annotation.JsonValue;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 动态时刻表数据。
  12 + */
  13 +public interface TTinfoDetailDynamicData {
  14 +
  15 + //---------------------- 生成时刻表用对象(以下) ---------------------//
  16 + public static enum BcType { // 班次类型枚举
  17 + IN("in"), // 进场
  18 + OUT("out"), // 出场
  19 + BD("bd"), // 早例保
  20 + LC("lc"), // 晚例保
  21 + NORMAL("normal"); // 正常
  22 + private String flag;
  23 +
  24 + @JsonCreator
  25 + private BcType(String flag) {
  26 + this.flag = flag;
  27 + }
  28 +
  29 + @JsonValue
  30 + public String getFlag() {
  31 + return flag;
  32 + }
  33 +
  34 + public void setFlag(String flag) {
  35 + this.flag = flag;
  36 + }
  37 + }
  38 +
  39 + public static class BcObj { // 班次对象
  40 + /** 班次时间 */
  41 + private Integer bcsj;
  42 + /** 停站时间 */
  43 + private Integer ssj;
  44 + /** 吃饭时间 */
  45 + private Integer eatsj;
  46 +
  47 + /** 停车场id */
  48 + private Integer tccid;
  49 + /** 起点站id */
  50 + private Integer qdzid;
  51 + /** 终点站id */
  52 + private Integer zdzid;
  53 +
  54 + /** 是否上行 */
  55 + private Boolean isUp;
  56 +
  57 + /** 班次类型 */
  58 + private BcType bcType;
  59 + /** 发车时刻 */
  60 + private String fcsj;
  61 + /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */
  62 + private String fcsjDesc;
  63 +
  64 + /** 第几圈(从1开始) */
  65 + private Integer groupNo;
  66 + /** 圈里第几个班次(1或者2) */
  67 + private Integer groupBcNo;
  68 +
  69 + public Integer getBcsj() {
  70 + return bcsj;
  71 + }
  72 +
  73 + public void setBcsj(Integer bcsj) {
  74 + this.bcsj = bcsj;
  75 + }
  76 +
  77 + public Integer getSsj() {
  78 + return ssj;
  79 + }
  80 +
  81 + public void setSsj(Integer ssj) {
  82 + this.ssj = ssj;
  83 + }
  84 +
  85 + public Integer getEatsj() {
  86 + return eatsj;
  87 + }
  88 +
  89 + public void setEatsj(Integer eatsj) {
  90 + this.eatsj = eatsj;
  91 + }
  92 +
  93 + public Integer getTccid() {
  94 + return tccid;
  95 + }
  96 +
  97 + public void setTccid(Integer tccid) {
  98 + this.tccid = tccid;
  99 + }
  100 +
  101 + public Integer getQdzid() {
  102 + return qdzid;
  103 + }
  104 +
  105 + public void setQdzid(Integer qdzid) {
  106 + this.qdzid = qdzid;
  107 + }
  108 +
  109 + public Integer getZdzid() {
  110 + return zdzid;
  111 + }
  112 +
  113 + public void setZdzid(Integer zdzid) {
  114 + this.zdzid = zdzid;
  115 + }
  116 +
  117 + public BcType getBcType() {
  118 + return bcType;
  119 + }
  120 +
  121 + public void setBcType(BcType bcType) {
  122 + this.bcType = bcType;
  123 + }
  124 +
  125 + public String getFcsj() {
  126 + return fcsj;
  127 + }
  128 +
  129 + public void setFcsj(String fcsj) {
  130 + this.fcsj = fcsj;
  131 + }
  132 +
  133 + public Boolean getIsUp() {
  134 + return isUp;
  135 + }
  136 +
  137 + public void setIsUp(Boolean isUp) {
  138 + this.isUp = isUp;
  139 + }
  140 +
  141 + public Integer getGroupNo() {
  142 + return groupNo;
  143 + }
  144 +
  145 + public void setGroupNo(Integer groupNo) {
  146 + this.groupNo = groupNo;
  147 + }
  148 +
  149 + public Integer getGroupBcNo() {
  150 + return groupBcNo;
  151 + }
  152 +
  153 + public void setGroupBcNo(Integer groupBcNo) {
  154 + this.groupBcNo = groupBcNo;
  155 + }
  156 +
  157 + public Boolean getUp() {
  158 + return isUp;
  159 + }
  160 +
  161 + public void setUp(Boolean up) {
  162 + isUp = up;
  163 + }
  164 +
  165 + public String getFcsjDesc() {
  166 + return fcsjDesc;
  167 + }
  168 +
  169 + public void setFcsjDesc(String fcsjDesc) {
  170 + this.fcsjDesc = fcsjDesc;
  171 + }
  172 + }
  173 +
  174 + public static class LpObj { // 路牌对象
  175 + /** 路牌名字 */
  176 + private String lpname;
  177 + /** 每圈的第一个班次是否上行 */
  178 + private Boolean isUp;
  179 +
  180 + /** 第一个班次起点站路由id */
  181 + private Integer stationRouteId1;
  182 + /** 第二个班次起点站路由id */
  183 + private Integer stationRouteId2;
  184 +
  185 + /** 班次列表 */
  186 + private List<BcObj> bcObjList;
  187 + /** 总圈数 */
  188 + private Integer groupCount;
  189 +
  190 + //---------------- 路牌统计 ---------------//
  191 + /** 总里程 */
  192 + private Double zlc;
  193 + /** 营运里程 */
  194 + private Double yylc;
  195 + /** 空驶里程 */
  196 + private Double kslc;
  197 + /** 总工时 */
  198 + private Double zgs;
  199 + /** 总班次 */
  200 + private Integer zbc;
  201 + /** 营运工时 */
  202 + private Double yygs;
  203 + /** 营运班次 */
  204 + private Integer yybc;
  205 +
  206 + public String getLpname() {
  207 + return lpname;
  208 + }
  209 +
  210 + public void setLpname(String lpname) {
  211 + this.lpname = lpname;
  212 + }
  213 +
  214 + public Boolean getIsUp() {
  215 + return isUp;
  216 + }
  217 +
  218 + public void setIsUp(Boolean isUp) {
  219 + this.isUp = isUp;
  220 + }
  221 +
  222 + public List<BcObj> getBcObjList() {
  223 + return bcObjList;
  224 + }
  225 +
  226 + public void setBcObjList(List<BcObj> bcObjList) {
  227 + this.bcObjList = bcObjList;
  228 + }
  229 +
  230 + public Integer getGroupCount() {
  231 + return groupCount;
  232 + }
  233 +
  234 + public void setGroupCount(Integer groupCount) {
  235 + this.groupCount = groupCount;
  236 + }
  237 +
  238 + public Integer getStationRouteId1() {
  239 + return stationRouteId1;
  240 + }
  241 +
  242 + public void setStationRouteId1(Integer stationRouteId1) {
  243 + this.stationRouteId1 = stationRouteId1;
  244 + }
  245 +
  246 + public Integer getStationRouteId2() {
  247 + return stationRouteId2;
  248 + }
  249 +
  250 + public void setStationRouteId2(Integer stationRouteId2) {
  251 + this.stationRouteId2 = stationRouteId2;
  252 + }
  253 +
  254 + public Boolean getUp() {
  255 + return isUp;
  256 + }
  257 +
  258 + public void setUp(Boolean up) {
  259 + isUp = up;
  260 + }
  261 +
  262 + public Double getZlc() {
  263 + return zlc;
  264 + }
  265 +
  266 + public void setZlc(Double zlc) {
  267 + this.zlc = zlc;
  268 + }
  269 +
  270 + public Double getYylc() {
  271 + return yylc;
  272 + }
  273 +
  274 + public void setYylc(Double yylc) {
  275 + this.yylc = yylc;
  276 + }
  277 +
  278 + public Double getKslc() {
  279 + return kslc;
  280 + }
  281 +
  282 + public void setKslc(Double kslc) {
  283 + this.kslc = kslc;
  284 + }
  285 +
  286 + public Double getZgs() {
  287 + return zgs;
  288 + }
  289 +
  290 + public void setZgs(Double zgs) {
  291 + this.zgs = zgs;
  292 + }
  293 +
  294 + public Integer getZbc() {
  295 + return zbc;
  296 + }
  297 +
  298 + public void setZbc(Integer zbc) {
  299 + this.zbc = zbc;
  300 + }
  301 +
  302 + public Double getYygs() {
  303 + return yygs;
  304 + }
  305 +
  306 + public void setYygs(Double yygs) {
  307 + this.yygs = yygs;
  308 + }
  309 +
  310 + public Integer getYybc() {
  311 + return yybc;
  312 + }
  313 +
  314 + public void setYybc(Integer yybc) {
  315 + this.yybc = yybc;
  316 + }
  317 + }
  318 +
  319 + public static class StatInfo { // 统计数据对象
  320 + /** 统计项目 */
  321 + private String statItem;
  322 + /** 统计值 */
  323 + private Double statValue;
  324 +
  325 + public String getStatItem() {
  326 + return statItem;
  327 + }
  328 +
  329 + public void setStatItem(String statItem) {
  330 + this.statItem = statItem;
  331 + }
  332 +
  333 + public Double getStatValue() {
  334 + return statValue;
  335 + }
  336 +
  337 + public void setStatValue(Double statValue) {
  338 + this.statValue = statValue;
  339 + }
  340 + }
  341 +
  342 + public static class DTInfos { // 所有数据信息
  343 + /** 路牌班次数据列表 */
  344 + private List<LpObj> lpObjList;
  345 + /** 统计数据列表 */
  346 + private List<StatInfo> statInfoList;
  347 +
  348 + public List<LpObj> getLpObjList() {
  349 + return lpObjList;
  350 + }
  351 +
  352 + public void setLpObjList(List<LpObj> lpObjList) {
  353 + this.lpObjList = lpObjList;
  354 + }
  355 +
  356 + public List<StatInfo> getStatInfoList() {
  357 + return statInfoList;
  358 + }
  359 +
  360 + public void setStatInfoList(List<StatInfo> statInfoList) {
  361 + this.statInfoList = statInfoList;
  362 + }
  363 + }
  364 +
  365 + //---------------------- 生成时刻表用对象(以上) ---------------------//
  366 +
  367 + /**
  368 + * 导出动态时刻表数据。
  369 + * @param dtInfos
  370 + * @return
  371 + * @throws ScheduleException
  372 + */
  373 + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException;
  374 +}
317 375 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
... ... @@ -636,8 +636,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
636 636  
637 637 if(model.length() != 0){
638 638 // sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";
639   - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
640   -
  639 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'" +
  640 + " and bc_type != 'ldks' and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";
  641 + if(line.length() != 0){
  642 + sql += " and xl_bm = '"+line+"'";
  643 + }
  644 +
641 645 ttList = jdbcTemplate.query(sql,
642 646 new RowMapper<Long>(){
643 647 @Override
... ... @@ -645,7 +649,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
645 649 return rs.getLong("id");
646 650 }
647 651 });
648   -
649 652 }
650 653  
651 654 } catch (Exception e) {
... ... @@ -1126,38 +1129,39 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1126 1129 @Override
1127 1130 public List<Map<String, Object>> getModel(Map<String, Object> map) {
1128 1131 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1129   - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
1130   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1131   - SimpleDateFormat sdfEE = new SimpleDateFormat("EEEE");
  1132 +// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  1133 +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1134 +// SimpleDateFormat sdfEE = new SimpleDateFormat("EEEE");
1132 1135  
1133 1136 String line = map.get("line").toString();
1134 1137 String startDate = map.get("startDate").toString();
1135 1138 String endDate = map.get("endDate").toString();
  1139 + String isCancel = "";
1136 1140  
1137   - if(startDate.length() == 0){
1138   - startDate = sdf.format(new Date());
1139   - }
1140   - if(endDate.length() == 0){
1141   - endDate = sdf.format(new Date());
  1141 + if(map.containsKey("isCancel") && map.get("isCancel").toString().trim().length() > 0){
  1142 + isCancel = map.get("isCancel").toString().trim();
1142 1143 }
1143 1144 try {
1144   -
1145   - String sql = "select tt.id, tt.name, qyrq, tt.rule_days, tt.special_days from bsth_c_s_ttinfo tt left join bsth_c_line cl on cl.id = tt.xl where tt.is_cancel = 0 and tt.is_enable_dis_template = 1";
1146   - if(line.length() != 0){
1147   - sql += " and cl.line_code = '"+line+"'";
  1145 + String sql = "select tt.id, tt.name from bsth_c_s_ttinfo tt left join" +
  1146 + " (select tt_info from bsth_c_s_sp_info where 1=1";
  1147 + if(startDate.trim().length() > 0)
  1148 + sql += " and schedule_date >= '"+startDate+"'";
  1149 + if(endDate.trim().length() > 0)
  1150 + sql += " and schedule_date <= '"+endDate+"'";
  1151 + if(line.trim().length() != 0){
  1152 + sql += " and xl_bm = '"+line+"'";
  1153 + } else {
  1154 + return resList;
1148 1155 }
1149   - sql += " order by tt.create_date desc";
  1156 + sql += " ) sp on sp.tt_info = tt.id where sp.tt_info is not null group by tt.id, tt.name";
1150 1157  
1151   - list = jdbcTemplate.query(sql,
  1158 + resList = jdbcTemplate.query(sql,
1152 1159 new RowMapper<Map<String, Object>>(){
1153 1160 @Override
1154 1161 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1155 1162 Map<String, Object> map = new HashMap<String, Object>();
1156 1163 map.put("id", rs.getString("id"));
1157 1164 map.put("name", rs.getString("name"));
1158   - map.put("qyrq", rs.getString("qyrq"));
1159   - map.put("ruleDays", rs.getString("rule_days"));
1160   - map.put("specialDays", rs.getString("special_days"));
1161 1165 return map;
1162 1166 }
1163 1167 });
... ... @@ -1167,73 +1171,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1167 1171 e.printStackTrace();
1168 1172 }
1169 1173  
1170   - Date date1 = null;
1171   - Date date2 = null;
1172   - try {
1173   - date1 = sdf.parse(startDate);
1174   - date2 = sdf.parse(endDate);
1175   - } catch (ParseException e) {
1176   - // TODO Auto-generated catch block
1177   - e.printStackTrace();
1178   - }
1179   -
1180   - Set<Integer> ruleDays1 = new HashSet<Integer>();
1181   - List<String> specialDays1 = new ArrayList<String>();
1182   - for(long i = 0; ; i++){
1183   - Date tempDate = new Date(date1.getTime() + i*1000*60*60*24);
1184   - if(tempDate.getTime() > date2.getTime())
1185   - break;
1186   - String week = sdfEE.format(tempDate);
1187   - if(week.equals("星期一"))
1188   - ruleDays1.add(0);
1189   - else if(week.equals("星期二"))
1190   - ruleDays1.add(1);
1191   - else if(week.equals("星期三"))
1192   - ruleDays1.add(2);
1193   - else if(week.equals("星期四"))
1194   - ruleDays1.add(3);
1195   - else if(week.equals("星期五"))
1196   - ruleDays1.add(4);
1197   - else if(week.equals("星期六"))
1198   - ruleDays1.add(5);
1199   - else if(week.equals("星期日"))
1200   - ruleDays1.add(6);
1201   - specialDays1.add(sdf.format(tempDate));
1202   - }
1203   - for(Map<String, Object> m : list){
1204   - String[] ruleDays = m.get("ruleDays").toString().split(",");
1205   - String[] specialDays = m.get("specialDays").toString().split(",");
1206   - boolean flag = false;
1207   - DO:{
1208   - try {
1209   - long qyrq = sdf.parse(m.get("qyrq").toString()).getTime();
1210   - if(qyrq > date2.getTime())
1211   - break;
1212   - } catch (ParseException e) {
1213   - // TODO Auto-generated catch block
1214   - e.printStackTrace();
1215   - }
1216   - for(int i = 0; i < ruleDays.length; i++){
1217   - if(ruleDays[i].equals("1")){
1218   - if(ruleDays1.contains(i)){
1219   - flag = true;
1220   - break DO;
1221   - }
1222   - }
1223   - }
1224   - for(int i = 0; i < specialDays.length; i++){
1225   - for(int j = 0; j < specialDays1.size(); j++){
1226   - if(specialDays[i].equals(specialDays1.get(j))){
1227   - flag = true;
1228   - break DO;
1229   - }
1230   - }
1231   - }
1232   - }
1233   - if(flag)
1234   - resList.add(m);
1235   - }
1236   -
1237 1174 return resList;
1238 1175 }
1239 1176  
... ... @@ -1344,7 +1281,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1344 1281 tempMap.put("date", date.substring(5));
1345 1282 tempMap.put("line", xlName);
1346 1283 List<Long> up1 = new ArrayList<Long>();
1347   - List<Long> up2 = new ArrayList<Long>();;
  1284 + List<Long> up2 = new ArrayList<Long>();
1348 1285 List<Long> dn1 = new ArrayList<Long>();
1349 1286 List<Long> dn2 = new ArrayList<Long>();
1350 1287 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1484,7 +1421,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1484 1421 }
1485 1422  
1486 1423 try {
1487   - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
  1424 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"
1488 1425 + " a.cc_service, a.remarks, a.adjust_exps, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line"
1489 1426 + " where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"
1490 1427 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
... ... @@ -1501,6 +1438,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1501 1438 schedule.setScheduleDateStr(rs.getString("schedule_date_str"));
1502 1439 schedule.setRealExecDate(rs.getString("real_exec_date"));
1503 1440 schedule.setXlName(rs.getString("xl_name"));
  1441 + schedule.setXlBm(rs.getString("xl_bm"));
1504 1442 schedule.setFcsj(rs.getString("fcsj"));
1505 1443 schedule.setFcsjActual(rs.getString("fcsj_actual"));
1506 1444 schedule.setZdsj(rs.getString("zdsj"));
... ... @@ -1552,6 +1490,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1552 1490 }
1553 1491  
1554 1492 Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>();
  1493 + Map<String, String> xlMap = new HashMap<String, String>();
1555 1494 String companyName = "", subCompanyName = "";
1556 1495  
1557 1496 for(ScheduleRealInfo s : list){
... ... @@ -1569,6 +1508,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1569 1508 companyName = s.getGsName();
1570 1509 if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0)
1571 1510 subCompanyName = s.getFgsName();
  1511 + xlMap.put(xlName, s.getXlBm());
1572 1512 }
1573 1513  
1574 1514 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
... ... @@ -1589,9 +1529,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1589 1529 String date = dateMap.get(l);
1590 1530 Map<String, Object> temp = new HashMap<String, Object>();
1591 1531 temp.put("date", date.substring(5));
  1532 + temp.put("dates", date);
1592 1533 temp.put("line", xlName);
  1534 + temp.put("xlbm", xlMap.get(xlName));
1593 1535 List<Long> up1 = new ArrayList<Long>();
1594   - List<Long> up2 = new ArrayList<Long>();;
  1536 + List<Long> up2 = new ArrayList<Long>();
1595 1537 List<Long> dn1 = new ArrayList<Long>();
1596 1538 List<Long> dn2 = new ArrayList<Long>();
1597 1539 Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>();
... ... @@ -1633,11 +1575,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1633 1575 temp.put("sjfcLast0", s4.getFcsjActual());
1634 1576 temp.put("delayLast0", delayLast0>0?"+"+delayLast0:delayLast0);
1635 1577 jhbc += 2;
1636   - if(delayFirst0 <= 1l && delayFirst0 >= -3l){
  1578 + if(delayFirst0 <= 1l && delayFirst0 >= -2l){
1637 1579 sjbc++;
1638 1580 } else {
1639 1581 Map<String, Object> m = new HashMap<String, Object>();
1640 1582 m.put("date", date.substring(5));
  1583 + m.put("dates", date);
1641 1584 m.put("line", xlName);
1642 1585 m.put("firstOrLast", "上行首发");
1643 1586 m.put("qdz", s1.getQdzName());
... ... @@ -1649,11 +1592,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1649 1592 m.put("remarks", s1.getRemarks() + s2.getRemarks());
1650 1593 mapList.add(m);
1651 1594 }
1652   - if(delayLast0 <= 1l && delayLast0 >= -3l){
  1595 + if(delayLast0 <= 1l && delayLast0 >= -2l){
1653 1596 sjbc++;
1654 1597 } else {
1655 1598 Map<String, Object> m = new HashMap<String, Object>();
1656 1599 m.put("date", date.substring(5));
  1600 + m.put("dates", date);
1657 1601 m.put("line", xlName);
1658 1602 m.put("firstOrLast", "上行末发");
1659 1603 m.put("qdz", s3.getQdzName());
... ... @@ -1698,6 +1642,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1698 1642 } else {
1699 1643 Map<String, Object> m = new HashMap<String, Object>();
1700 1644 m.put("date", date.substring(5));
  1645 + m.put("dates", date);
1701 1646 m.put("line", xlName);
1702 1647 m.put("firstOrLast", "下行首发");
1703 1648 m.put("qdz", s1.getQdzName());
... ... @@ -1715,6 +1660,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1715 1660 } else {
1716 1661 Map<String, Object> m = new HashMap<String, Object>();
1717 1662 m.put("date", date.substring(5));
  1663 + m.put("dates", date);
1718 1664 m.put("line", xlName);
1719 1665 m.put("firstOrLast", "下行末发");
1720 1666 m.put("qdz", s3.getQdzName());
... ... @@ -1737,13 +1683,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1737 1683 temp.put("sjfcLast1", "/");
1738 1684 temp.put("delayLast1", "/");
1739 1685 }
  1686 + if((up1.size() == 0 || up2.size() == 0) && (dn1.size() == 0 || dn2.size() == 0))
  1687 + continue;
1740 1688 tempList.add(temp);
1741 1689 }
1742 1690 tempMap.put("map", tempList);
1743 1691 tempMap.put("company", companyName);
1744 1692 tempMap.put("subCompany", subCompanyName);
1745   - tempMap.put("date", dates);
  1693 + tempMap.put("xlbm", xlMap.get(xlName));
1746 1694 tempMap.put("line", xlName);
  1695 + tempMap.put("date", dates);
1747 1696 tempMap.put("jhbc", jhbc);
1748 1697 tempMap.put("sjbc", sjbc);
1749 1698 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc *100)) + "%");
... ... @@ -1788,6 +1737,36 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1788 1737 // TODO: handle exception
1789 1738 e.printStackTrace();
1790 1739 }
  1740 + } else if(type.equals("exportMap")){
  1741 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1742 + Map<String,Object> m = new HashMap<String, Object>();
  1743 + ReportUtils ee = new ReportUtils();
  1744 + try {
  1745 + if(resList.size() > 0)
  1746 + listI.add(((List<Map<String, Object>>)resList.get(0).get("map")).iterator());
  1747 + listI.add(resList.iterator());
  1748 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1749 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_map.xls",
  1750 + path+"export/线路首末班明细.xls");
  1751 + } catch (Exception e) {
  1752 + // TODO: handle exception
  1753 + e.printStackTrace();
  1754 + }
  1755 + } else if(type.equals("delay_export")){
  1756 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1757 + Map<String,Object> m = new HashMap<String, Object>();
  1758 + ReportUtils ee = new ReportUtils();
  1759 + try {
  1760 + if(resList.size() > 0)
  1761 + listI.add(((List<Map<String, Object>>)resList.get(resList.size() - 1).get("map")).iterator());
  1762 + listI.add(resList.iterator());
  1763 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1764 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_delay.xls",
  1765 + path+"export/首末班误点班次.xls");
  1766 + } catch (Exception e) {
  1767 + // TODO: handle exception
  1768 + e.printStackTrace();
  1769 + }
1791 1770 }
1792 1771  
1793 1772 return resList;
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
... ... @@ -26,6 +26,17 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl&lt;SchedulePlanInfo,
26 26 private JdbcTemplate jdbcTemplate;
27 27  
28 28 @Override
  29 + public SchedulePlanInfo save(SchedulePlanInfo schedulePlanInfo) {
  30 + // 生成计划不是save,使用的是spring batch插入的
  31 + // 这里是单独修改的时候,需要记录修改次数,用于标识被修改过
  32 +
  33 + Integer currentModifyCount = schedulePlanInfo.getModifyCount();
  34 + schedulePlanInfo.setModifyCount(currentModifyCount == null ? 1 : ++ currentModifyCount);
  35 +
  36 + return super.save(schedulePlanInfo);
  37 + }
  38 +
  39 + @Override
29 40 public List<Date> findLastestPlanDate(Integer xlId) {
30 41 String sql = "select max(schedule_date) as sd from bsth_c_s_sp_info " +
31 42 "where xl = ?";
... ...
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java
... ... @@ -82,7 +82,7 @@ public class PoiUtils {
82 82  
83 83 public static XSSFCell createDoubleXSSFCell(
84 84 XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, Double value) {
85   - return createXSSFCell(
  85 + XSSFCell xssfCell = createXSSFCell(
86 86 xssfWorkbook, xssfRow, column,
87 87 value, XSSFCell.CELL_TYPE_NUMERIC,
88 88 HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
... ... @@ -90,6 +90,10 @@ public class PoiUtils {
90 90 (short) 13, new Color(0x2765A7), "宋体",
91 91 new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
92 92 );
  93 +
  94 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  95 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  96 + return xssfCell;
93 97 }
94 98  
95 99 public static XSSFCell createIntegerXSSFCell(
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
... ... @@ -10,6 +10,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 10 import com.bsth.websocket.dto.WsScheduleRealInfo;
11 11 import com.fasterxml.jackson.core.JsonProcessingException;
12 12 import com.fasterxml.jackson.databind.ObjectMapper;
  13 +import org.apache.commons.lang3.StringUtils;
13 14 import org.slf4j.Logger;
14 15 import org.slf4j.LoggerFactory;
15 16 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -195,4 +196,24 @@ public class SendUtils{
195 196 logger.error("", e);
196 197 }
197 198 }
  199 +
  200 + /**
  201 + * 对所有线调用户进行广播
  202 + * @param t
  203 + */
  204 + public void sendRadioText(String t, String lineCode){
  205 + Map<String, Object> map = new HashMap<>();
  206 + map.put("fn", "admin_radio_text");
  207 + map.put("t", t);
  208 + ObjectMapper mapper = new ObjectMapper();
  209 +
  210 + try {
  211 + if(StringUtils.isNotEmpty(lineCode))
  212 + socketHandler.sendMessageToLine(lineCode, mapper.writeValueAsString(map));
  213 + else
  214 + socketHandler.sendMessage(mapper.writeValueAsString(map));
  215 + } catch (JsonProcessingException e) {
  216 + logger.error("", e);
  217 + }
  218 + }
198 219 }
... ...
src/main/resources/fatso/start.js
... ... @@ -16,7 +16,7 @@ var platform = process.platform;
16 16 var iswin = platform=='win32';
17 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', 'forms','mforms', 'report', 'punctual']
  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 20 ,ep = new EventProxy()
21 21 ,pName = 'bsth_control'
22 22 ,path = process.cwd()
... ...
src/main/resources/static/pages/base/carpark/js/carpark-list-table.js
... ... @@ -30,7 +30,7 @@
30 30 var branchMap = new Map();
31 31 initCompanySelect2(function(array) {
32 32 $.each(array, function() {
33   - companyMap[this.businessCode] = this.businessName;
  33 + companyMap[this.businessCode] = this.busi nessName;
34 34 // companyMap.put(this.businessCode.toString(), this.businessName);
35 35 if(this.businessCode != null || this.businessCode !=''){
36 36 /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
... ...
src/main/resources/static/pages/base/line/js/line-details-info.js
... ... @@ -8,6 +8,18 @@
8 8 */
9 9  
10 10 $(function(){
  11 + // 关闭左侧栏
  12 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  13 + /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
  14 + $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
  15 + /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  16 + $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  17 + /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  18 + $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  19 + /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  20 + $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  21 + /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  22 + $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
11 23  
12 24 // 填充分公司下拉框选择值
13 25 function getbrancheCompanyValues(businessCode,cb){
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
... ... @@ -357,6 +357,9 @@
357 357 }else if(data.status=='NOTDATA') {
358 358 // 弹出添加成功提示消息
359 359 layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!');
  360 + }else if(data.status=='NOLinePlayType') {
  361 + // 弹出添加成功提示消息
  362 + layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!');
360 363 }
361 364 });
362 365 }
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js
... ... @@ -6,8 +6,8 @@
6 6 // 关闭左侧栏
7 7 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
8 8 // 定义 page : 当前页;initPag ; icheckOptions:选择框
9   - var page = 0,
10   - initPag,
  9 + window.page = 0;
  10 + var initPag,
11 11 icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'},
12 12 storage = window.localStorage;
13 13 if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
... ... @@ -301,7 +301,6 @@
301 301 });
302 302 // 线路版本编辑
303 303 $(document).on('click', 'a.update_versions_route_btn', function () {
304   - debugger
305 304 var lineId = $(this).data('lineid');
306 305 swal({
307 306 title: "操作须知",
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -360,6 +360,7 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
360 360 ajaxd.getSectionRouteInfo(Line.id,add_direction_v,function(data) {
361 361 fun.linePanlThree(Line.id,data,add_direction_v);
362 362 });
  363 + fun.editMapStatusRemove();
363 364 }
364 365 function hideMoble() {
365 366 // 隐藏mobal
... ...
src/main/resources/static/pages/base/stationroute/add_manual_select.html
... ... @@ -31,8 +31,8 @@
31 31 </form>
32 32 </div>
33 33 <div class="modal-footer">
34   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
35 34 <button type="button" class="btn btn-primary" id="addManualSelectnextButton">下一步</button>
  35 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
36 36 </div>
37 37 </div>
38 38 </div>
... ...
src/main/resources/static/pages/base/stationroute/add_select.html
... ... @@ -38,8 +38,8 @@
38 38 </form>
39 39 </div>
40 40 <div class="modal-footer">
41   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
42 41 <button type="button" class="btn btn-primary" id="addSelectnextButton">下一步</button>
  42 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
43 43 </div>
44 44 </div>
45 45 </div>
... ... @@ -141,7 +141,7 @@ $(&#39;#add_select_mobal&#39;).on(&#39;AddSelectMobal.show&#39;, function(e,map_,drw,ajaxd_,stat
141 141 map_.localSearchFromAdreesToPoint(stationName,function(Points) {
142 142 if(Points) {
143 143 /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
144   - stationObj.setAddStationBJwpoints(Points);
  144 + stationObj.setAddStationJwpoints(Points);
145 145 /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
146 146 stationObj.setAddStationShapesType('r');
147 147 /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
... ... @@ -164,12 +164,13 @@ $(&#39;#add_select_mobal&#39;).on(&#39;AddSelectMobal.show&#39;, function(e,map_,drw,ajaxd_,stat
164 164 }
165 165 });
166 166 }else if(baseRes==1) {
167   - map_.clearMarkAndOverlays();
  167 + // map_.clearMarkAndOverlays();
168 168 // 以藏站点新增方式mobal
169 169 $('#add_select_mobal').modal('hide');
170 170 // 打开绘制工具
171 171 drw.openDrawingManager();
172   - map_.localtionPoint(stationName);
  172 + // map_.localtionPoint(stationName);
  173 + fun.editMapStatus();
173 174 }
174 175 // 查询是否存在输入的站点名称
175 176 /* ajaxd_.getLikeStationName(stationName,function(data) {
... ...
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
1 1 #bmap_basic{
2 2 min-width: 100%;
3   - /*width: calc(100% + 26px); */
4 3 margin-top: -10px;
5   - border: 2px solid #fdfdfd;
6   - min-height: 1200px;
7 4 height:100%;
8   - overflow: hidden;
  5 +}
  6 +
  7 +.mian-portlet-body{
  8 + height: 100%;
9 9 }
10 10  
11 11 html,body{
12 12 overflow:hidden;
13   - height: 99%;
  13 + height: calc(100% - 10px);
  14 +}
  15 +
  16 +.protlet-box-layer{
  17 + position: absolute;
  18 + z-index: 900;
  19 + height: 100%;
  20 + width: 100%;
  21 + background: #ffffff85;
  22 + display: none;
14 23 }
15 24  
16 25 .rm3_image {
... ... @@ -19,6 +28,52 @@ html,body{
19 28  
20 29 }
21 30  
  31 +.search_panel{
  32 + position: absolute;
  33 + z-index: 99;
  34 + height: 41px;
  35 + top: 30px;
  36 + left: 500px;
  37 + background: #fff1f0;
  38 + padding: 0px;
  39 + box-shadow: 5px 1px 5px rgba(90, 90, 90, 0.48);
  40 +}
  41 +
  42 +.search_input_panel {
  43 + display: inline;
  44 + height: 41px;
  45 +}
  46 +
  47 +.search_input_panel .search_input {
  48 + width: 200px;
  49 + height: 41px;
  50 + padding:0 20px 0 10px;
  51 + float:left;
  52 + border:none;
  53 + outline: 0px;
  54 +}
  55 +
  56 +.search_input_panel .clear {
  57 + right: 40px;
  58 + position: absolute;
  59 + top: 15px;
  60 + width: 20px;
  61 +}
  62 +
  63 +.search_button_panel{
  64 + height: 41px;
  65 + display: inline;
  66 +}
  67 +
  68 +.search_button {
  69 + width: 38px;
  70 + height: 41px;
  71 + background: #fff1f0;
  72 + border:none;
  73 + top: 0;
  74 + outline: 0px;
  75 +}
  76 +
22 77 /* 隐藏百度地图logo */
23 78 .anchorBL,
24 79 .anchorBL,
... ... @@ -36,8 +91,16 @@ html,body{
36 91 height: auto;
37 92 background:transparent;
38 93 border:0px solid;
39   - box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33);
40   - border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;
  94 + /*border-radius: 6px !important;*/
  95 + box-shadow: 5px 5px 5px rgba(90, 90, 90, 0.48);
  96 +
  97 +}
  98 +
  99 +.protlet-box .portlet-title {
  100 + background-color:#fff1f0;
  101 + font-weight: 600;
  102 + color: #000 !important;
  103 + padding: 0 0 0 15px;
41 104 }
42 105  
43 106 .help-block{
... ... @@ -45,47 +108,13 @@ html,body{
45 108 font-size: 15px;
46 109 }
47 110  
48   -/*.BMap_pop div:nth-child(1) ,*/
49   -/*.BMap_pop div:nth-child(2) ,*/
50   -/*.BMap_pop div:nth-child(3) ,*/
51   -/*.BMap_pop div:nth-child(4) ,*/
52   -/*.BMap_pop div:nth-child(5) ,*/
53   -/*.BMap_pop div:nth-child(6) ,*/
54   -/*.BMap_pop div:nth-child(7) {*/
55   - /**/
56   - /*border:0px solid rgb(255, 255, 255) !important;*/
57   - /*background-color:#3B3F51 !important;*/
58   - /**/
59   -/*}*/
60   -
61   -/*.BMap_pop div:nth-child(3){*/
62   - /**/
63   - /*width:23px !important;*/
64   - /**/
65   -/*}*/
66   -
67   -/*.BMap_pop div:nth-child(7) {*/
68   - /**/
69   - /*width:23px !important;*/
70   - /**/
71   - /*height:24px !important;*/
72   - /**/
73   -/*}*/
74   -
75   -/*.BMap_pop div:nth-child(5) {*/
76   - /**/
77   - /*height:24px !important;*/
78   - /**/
79   -/*}*/
80   -
81   -/* 图片以后在弄,先隐藏div */
82   -/*.BMap_pop div:nth-child(8) {*/
83   - /**/
84   - /*height:0px !important;*/
85   - /*!* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; *!*/
86   - /*!* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; *!*/
87   - /**/
88   -/*}*/
  111 +.info_win_btn {
  112 + background: #ff8355;
  113 + color: #fff;
  114 + font-size: 12px;
  115 + margin: 0 5px 0 0;
  116 + border: 1px solid transparent;
  117 +}
89 118  
90 119 .BMap_pop {
91 120  
... ... @@ -94,36 +123,111 @@ html,body{
94 123 }
95 124  
96 125 .defeat-scroll {
97   -width: 98%;
98   -height:380px;
99   -/* overflow:auto; */
100   -overflow:hidden;
  126 + width: 98%;
  127 + height:380px;
  128 + overflow:hidden;
101 129 }
102 130 .defeat-scroll::-webkit-scrollbar {
103   -width:6px;
104   -height:6px;
  131 + width:6px;
  132 + height:6px;
105 133 }
106 134 .defeat-scroll::-webkit-scrollbar-button {
107   -/* background-color:#FF7677; */
108   -background:rgba(255, 255, 255, 0);
  135 + background:rgba(255, 255, 255, 0);
109 136 }
110 137 .defeat-scroll::-webkit-scrollbar-track {
111   -/* background:#FF66D5; */
112   -background:rgba(255, 255, 255, 0);
  138 + background:rgba(255, 255, 255, 0);
113 139 }
114 140 .defeat-scroll::-webkit-scrollbar-track-piece {
115   -/* background:#ff0000; */
116   -background:rgba(255, 255, 255, 0);
  141 + background:rgba(255, 255, 255, 0);
117 142 }
118 143 .defeat-scroll::-webkit-scrollbar-thumb{
119   -background:rgba(197, 196, 196, 0.81);
120   -border-radius:10px !important;
  144 + background:rgba(197, 196, 196, 0.81);
  145 + border-radius:10px !important;
121 146 }
122 147 .defeat-scroll::-webkit-scrollbar-corner {
123   -/* background:#82AFFF; */
124   -background:rgba(255, 255, 255, 0);
  148 + background:rgba(255, 255, 255, 0);
  149 +}
  150 +/*.defeat-scroll::-webkit-scrollbar-resizer {
  151 + background:rgba(255, 255, 255, 0);
  152 +}*/
  153 +
  154 +.add_road_search_point_wrap{
  155 + width: 280px;
  156 + height: 120px;
  157 + position: absolute;
  158 + top: 40px;
  159 + left: calc(50% - 100px);
  160 + z-index: 999;
  161 + background: #fdfdfd;
  162 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  163 +}
  164 +
  165 +.buffer_edit_body{
  166 + padding: 5px 0 0 15px;
  167 +}
  168 +
  169 +.buffer_edit_body .form-group{
  170 + margin-top: 10px;
  171 + margin-bottom: 0px;
  172 + white: 240px
  173 +}
  174 +
  175 +.add_road_search_point_wrap ._title {
  176 + padding-right: 18px;
  177 + text-align: center;
  178 + font-size: 17px;
  179 + color: #2b2b2b;
  180 + /*padding: 2px 0 0 0;*/
  181 + font-weight: 600;
  182 +}
  183 +
  184 +.buffer_edit_body .btns{
  185 + text-align: right;
125 186 }
126   -.defeat-scroll::-webkit-scrollbar-resizer {
127   -/* background:#FF0BEE; */
128   -background:rgba(255, 255, 255, 0);
129   -}
130 187 \ No newline at end of file
  188 +
  189 +.buffer_edit_body .form-group .inline{
  190 + width: 100px !important;
  191 + height: 30px;
  192 + margin-right: 7px;
  193 + display: inline-block;
  194 + position: relative;
  195 + max-width: 100%;
  196 + vertical-align: middle;
  197 +}
  198 +
  199 +.sbmint-btn {
  200 + padding: 0 15px;
  201 + height: 28px;
  202 + line-height: 28px;
  203 + vertical-align: top;
  204 + margin-top: 2px;
  205 + background-color: #1e87f0;
  206 + color: #fff;
  207 + border: 1px solid transparent;
  208 +}
  209 +.cancel-btn {
  210 + padding: 0 15px;
  211 + height: 28px;
  212 + line-height: 28px;
  213 + vertical-align: top;
  214 + margin-top: 2px;
  215 + background-color: transparent;
  216 + color: #333;
  217 + border: 1px solid #e5e5e5;
  218 +}
  219 +
  220 +.draw_polyline_switch{
  221 + display: inline-block;
  222 + font-size: 12px;
  223 + vertical-align: bottom;
  224 + margin-left: 5px;
  225 +}
  226 +
  227 +.draw_polyline_switch>a{
  228 + color: red;
  229 +}
  230 +
  231 +.buffer_edit_body .form-group input{
  232 + height: 30px;
  233 +}
  234 +
... ...
src/main/resources/static/pages/base/stationroute/delete_select.html
... ... @@ -29,9 +29,9 @@
29 29 </form>
30 30 </div>
31 31 <div class="modal-footer">
32   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
33 32 <button type="button" class="btn btn-primary"
34   - id="deleteSelectnextButton">下一步</button>
  33 + id="deleteSelectnextButton">下一步</button>
  34 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
35 35 </div>
36 36 </div>
37 37 </div>
... ...
src/main/resources/static/pages/base/stationroute/deletesection.html
... ... @@ -139,25 +139,25 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line,
139 139 ids = ids.substr(1, ids.length - 1);
140 140 var params = {};
141 141 params.ids = ids;
142   - $.get('/sectionroute/batchDestroy',params,function(resuntDate) {
143   - if (resuntDate.status == 'SUCCESS') {
144   - // 弹出添加成功提示消息
145   - layer.msg('修改成功...');
146   - /** 通知更新缓存区 */
147   - //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})
148   - } else {
149   - // 弹出添加失败提示消息
150   - layer.msg('修改失败...');
151   - }
152   - initSearch();
153   - // 刷新左边树
154   - fun.resjtreeDate(line.id,delBatch.dir);
155   - /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
156   - ajaxd.getSectionRouteInfo(line.id,delBatch.dir,function(data) {
157   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
158   - fun.linePanlThree(line.id,data,delBatch.dir);
159   - });
160   - });
  142 + $.post('/sectionroute/batchDestroy',params,function(resuntDate) {
  143 + if (resuntDate.status == 'SUCCESS') {
  144 + // 弹出添加成功提示消息
  145 + layer.msg('修改成功...');
  146 + /** 通知更新缓存区 */
  147 + //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})
  148 + } else {
  149 + // 弹出添加失败提示消息
  150 + layer.msg('修改失败...');
  151 + }
  152 + initSearch();
  153 + // 刷新左边树
  154 + fun.resjtreeDate(line.id,delBatch.dir);
  155 + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
  156 + ajaxd.getSectionRouteInfo(line.id,delBatch.dir,function(data) {
  157 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
  158 + fun.linePanlThree(line.id,data,delBatch.dir);
  159 + });
  160 + });
161 161 } else {
162 162 layer.msg('请选择要删除的路段!!!');
163 163 }
... ...
src/main/resources/static/pages/base/stationroute/deletestation.html
... ... @@ -141,7 +141,7 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
141 141 ids = ids.substr(1, ids.length - 1);
142 142 var params = {};
143 143 params.ids = ids;
144   - $.get('/stationroute/batchDestroy',params,function(resuntDate) {
  144 + $.post('/stationroute/batchDestroy',params,function(resuntDate) {
145 145 if (resuntDate.status == 'SUCCESS') {
146 146 // 弹出添加成功提示消息
147 147 layer.msg('修改成功...');
... ...
src/main/resources/static/pages/base/stationroute/doublename_road.html
... ... @@ -32,8 +32,8 @@
32 32 </form>
33 33 </div>
34 34 <div class="modal-footer">
35   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
36 35 <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>
  36 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
37 37 </div>
38 38 </div>
39 39 </div>
... ... @@ -79,7 +79,7 @@
79 79 });
80 80 function closeMobleSetClean() {
81 81 // 清除地图覆盖物
82   - map_.clearMarkAndOverlays();
  82 + // map_.clearMarkAndOverlays();
83 83 fun.resjtreeDate(lineId,dir);
84 84 fun.editAChangeCssRemoveDisabled();
85 85 ajaxd.getSectionRouteInfo(lineId,dir,function(data) {
... ... @@ -128,12 +128,11 @@
128 128 params.versions = versions;
129 129 // 生成路段
130 130 $.get('/section/doubleName',params,function (resuntDate) {
131   - debugger
132 131 if(resuntDate.status=='SUCCESS') {
133 132 // 弹出添加成功提示消息
134 133 layer.msg('生成成功...');
135 134 } else if (resuntDate.status=='Failure') {
136   - layer.msg('抱歉,选取的路段太短,无法生成双路段!');
  135 + layer.msg('抱歉,您选取的路段基于高德地图的数据无法生成双路段!');
137 136 } else {
138 137 // 弹出添加失败提示消息
139 138 layer.msg('生成失败...');
... ... @@ -141,7 +140,7 @@
141 140 $('#doublename_road_mobal').modal('hide');
142 141 var dir = params.directions;
143 142 // 刷行左边树
144   - fun.resjtreeDate(lineId,dir);
  143 + // fun.resjtreeDate(lineId,dir);
145 144 closeMobleSetClean();
146 145 });
147 146 });
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -21,25 +21,19 @@
21 21 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
22 22 <input type="hidden" name="x" id="xInput" value=""/>
23 23 <input type="hidden" name="y" id="yInput" value=""/>
  24 + <input type="hidden" name="zdmc" id="zdmcInput"/>
  25 + <input type="hidden" name="descriptions" id="descriptionsTextarea" />
  26 + <input type="hidden" name="directions" id="stationdirSelect" />
  27 +
  28 + <!-- 站点名称 -->
24 29 <!-- 站点名称 -->
25 30 <div class="form-body">
26 31 <div class="form-group">
27 32 <label class="control-label col-md-3">
28   - <span class="required"> * </span> 站点名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
29   - </label>
30   - <div class="col-md-6">
31   - <input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
32   - </div>
33   - </div>
34   - </div>
35   - <!-- 站点路由名称 -->
36   - <div class="form-body">
37   - <div class="form-group">
38   - <label class="control-label col-md-3">
39   - <span class="required"> * </span> 站点路由名称:
  33 + <span class="required"> * </span> 站点名称:
40 34 </label>
41 35 <div class="col-md-6">
42   - <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
  36 + <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点名称" readonly="readonly">
43 37 </div>
44 38 </div>
45 39 </div>
... ... @@ -54,21 +48,6 @@
54 48 </div>
55 49 </div>
56 50 </div>
57   - <!-- 站点方向 -->
58   - <div class="form-body">
59   - <div class="form-group">
60   - <label class="control-label col-md-3">
61   - <span class="required"> * </span>站点方向&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
62   - </label>
63   - <div class="col-md-6">
64   - <select name="directions" class="form-control" id="stationdirSelect">
65   - <option value="">-- 请选择站点类型 --</option>
66   - <option value="0">上行</option>
67   - <option value="1">下行</option>
68   - </select>
69   - </div>
70   - </div>
71   - </div>
72 51 <!-- 站点序号 -->
73 52 <div class="form-body">
74 53 <div class="form-group">
... ... @@ -175,13 +154,6 @@
175 154 </div>
176 155 </div>
177 156 </div>
178   - <!-- 描述/说明 -->
179   - <div class="form-group">
180   - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label>
181   - <div class="col-md-6">
182   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
183   - </div>
184   - </div>
185 157 </form>
186 158 </div>
187 159 <div class="modal-footer">
... ... @@ -198,7 +170,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
198 170 var editStationParmasObj = station_.getEitdStation();
199 171 var addLine = Line_.getLineObj();
200 172 fun.setFormValue(editStationParmasObj);
201   - var initzdlyP = {'lineCode_eq':editStationParmasObj.stationRouteLineCode,'destroy_eq':0,'directions_eq':editStationParmasObj.stationRouteDirections};
  173 + var initzdlyP = {'lineCode_eq':editStationParmasObj.stationRouteLIneCode,'destroy_eq':0,'directions_eq':editStationParmasObj.stationRoutedirections};
202 174 initSelect(initzdlyP);
203 175 // 显示mobal
204 176 $('#edit_station_mobal').modal({show : true,backdrop: 'static',keyboard: false});
... ... @@ -217,6 +189,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
217 189 ajaxd.getSectionRouteInfo(addLine.id,add_direction_v,function(data) {
218 190 fun.linePanlThree(addLine.id,data,add_direction_v);
219 191 });
  192 + fun.editMapStatusRemove();
220 193 }
221 194 // 编辑表单元素
222 195 var form = $('#edit_station_form');
... ... @@ -283,7 +256,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
283 256 var id = addLine.id;
284 257 var dir = params.directions
285 258 // 刷行左边树
286   - fun.resjtreeDate(id,dir);
  259 + // fun.resjtreeDate(id,dir);
287 260 closeMobleSetClean();
288 261 });
289 262 }
... ... @@ -312,7 +285,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
312 285 $.each(array, function(i, g){
313 286 // 判断.
314 287 if(g.name!='' || g.name != null) {
315   - if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) {
  288 + if(g.stationRouteCode != editStationParmasObj.stationRouteCode) {
316 289 // 添加拼音检索下拉框格式数据数组.
317 290 if(editStationParmasObj.stationRouteStationMark=='E' && i == (len_-2)){
318 291 paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions,
... ... @@ -333,13 +306,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
333 306 });
334 307 }
335 308 function setZdlyValue() {
336   - ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) {
  309 + ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRoutedirections,editStationParmasObj.stationRouteCode,function(str) {
337 310 if(str.length>0){
338 311 var upStationRouteCode;
339 312 if (editStationParmasObj.stationRouteStationMark == 'E') {
340   - upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + editStationParmasObj.stationRouteDirections;
  313 + upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + editStationParmasObj.stationRoutedirections;
341 314 } else{
342   - upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections;
  315 + upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRoutedirections;
343 316 }
344 317 $('#stationrouteSelect').select2('val',upStationRouteCode);
345 318 }else {
... ... @@ -374,5 +347,5 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
374 347 }
375 348 return tel;
376 349 }, '方向必须一致!');
377   -});
  350 +});
378 351 </script>
379 352 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/edit_select.html
... ... @@ -19,7 +19,7 @@
19 19 系统无法生成,请选择其他方式新增
20 20 </div>
21 21 <div class="form-group" id="formRequ">
22   - <label class="col-md-3 control-label"><span class="required"> * </span>原始站点名称:</label>
  22 + <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
23 23 <div class="col-md-9" id="errorInfo">
24 24 <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox">
25 25 </div>
... ... @@ -40,17 +40,14 @@
40 40 </form>
41 41 </div>
42 42 <div class="modal-footer">
43   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
44 43 <button type="button" class="btn btn-primary" id="editselectStationNextButton">下一步</button>
  44 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
45 45 </div>
46 46 </div>
47 47 </div>
48 48 </div>
49 49 <script type="text/javascript">
50   -$('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,dir_){
51   - var sel = fun.getCurrSelNode(dir_);
52   - debugger
53   - var Station = sel[0].original;
  50 +$('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,Station){
54 51 // 显示选择修改方式弹出层
55 52 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
56 53 setTimeout(function(){
... ... @@ -75,7 +72,7 @@ $(&#39;#edit_select_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,drw,ajaxd,ed
75 72 setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
76 73 },500);
77 74 // 获取站点名称元素并赋值
78   - $('#stationNamebootbox').val(Station.stationStationName);
  75 + $('#stationNamebootbox').val(Station.stationRouteName);
79 76 // 定义站点图形
80 77 var stationShapesTypeV = Station.stationShapesType;
81 78 // 获取表单元素
... ... @@ -118,28 +115,25 @@ $(&#39;#edit_select_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,drw,ajaxd,ed
118 115 var editStationName = params.stationNamebootbox;
119 116  
120 117 if(params.editselect==0){
121   - $('#downLine').addClass('btn disabled');
122   - $('.btn-circle').addClass('disabled');
123   - $('#upLine').addClass('btn disabled');
124 118 editStationObj.setEitdStation(Station);
125 119 editStationObj.setEitdStationName(editStationName);
126 120  
127   - map_.clearMarkAndOverlays();
  121 + // map_.clearMarkAndOverlays();
128 122 // 打开绘制工具
129 123 drw.openDrawingManager();
130   - map_.localtionPoint(editStationName);
  124 + map_.localtionPoint(editStationName+"公交站点");
  125 + fun.editMapStatus();
131 126 }else if(params.editselect==1){
132   - $('#downLine').addClass('btn disabled');
133   - $('.btn-circle').addClass('disabled');
134   - $('#upLine').addClass('btn disabled');
135 127 editStationObj.setEitdStation(Station);
136 128 editStationObj.setEitdStationName(editStationName);
137   -
  129 + map_.clearMark();
138 130 // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
139 131 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
140 132 shift: 0,time: 3000});
141 133 // 编辑图形
142   - map_.editShapes(editStationName,stationShapesTypeV,mindex);
  134 + // map_.editShapes(editStationName,stationShapesTypeV,mindex);
  135 + map_.editShapes(editStationObj);
  136 + fun.editMapStatus();
143 137 }
144 138 }
145 139 });
... ...
src/main/resources/static/pages/base/stationroute/editsection.html
... ... @@ -14,12 +14,17 @@
14 14 <!-- 线路ID -->
15 15 <input type="hidden" name="sectionId" id="sectionIdInput">
16 16 <input type="hidden" name="sectionRouteId" id="sectionRouteIdInput">
  17 + <input type="hidden" name="sectionCode" id="sectionCodeInput">
17 18 <input type="hidden" name="sectionRouteLine" id="sectionRouteLineInput">
18 19 <input type="hidden" name="lineCode" id="lineCodeInput">
19 20 <input type="hidden" name="bsectionVector" id="bsectionVectorInput" />
20 21 <input type="hidden" name="csectionVector" id="csectionVectorInput" value=""/>
21 22 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
22 23 <input type="hidden" name="isRoadeSpeed" id="isRoadeSpeedInput"/>
  24 + <input type="hidden" name="directions" id="directionsSection">
  25 + <input type="hidden" name="speedLimit" id="speedLimitInput" >
  26 + <input type="hidden" name="roadCoding" id="roadCodingCodInput"/>
  27 + <input type="hidden" name="versions" id="versionsInput"/>
23 28 <!-- 路段名称 -->
24 29 <div class="form-body">
25 30 <div class="form-group">
... ... @@ -31,17 +36,6 @@
31 36 </div>
32 37 </div>
33 38 </div>
34   - <!-- 路段编码 -->
35   - <div class="form-body">
36   - <div class="form-group">
37   - <label class="control-label col-md-3">
38   - <span class="required"> * </span> 路段编码:
39   - </label>
40   - <div class="col-md-6">
41   - <input type="text" class="form-control" name="sectionCode" id="sectionCodeInput" placeholder="路段编码" readonly="readonly">
42   - </div>
43   - </div>
44   - </div>
45 39 <!-- 路段序号 -->
46 40 <div class="form-body">
47 41 <div class="form-group">
... ... @@ -54,103 +48,20 @@
54 48 </div>
55 49 </div>
56 50 </div>
57   - <!-- 路段方向 -->
58   - <div class="form-body">
59   - <div class="form-group">
60   - <label class="control-label col-md-3">
61   - <span class="required"> * </span>路段方向:
62   - </label>
63   - <div class="col-md-6">
64   - <select name="directions" class="form-control" id="directionsSection">
65   - <option value="">-- 请选择路段类型 --</option>
66   - <option value="0">上行</option>
67   - <option value="1">下行</option>
68   - </select>
69   - </div>
70   - </div>
71   - </div>
72   - <!-- 路段限速 -->
73   - <div class="form-body">
74   - <div class="form-group">
75   - <label class="control-label col-md-3">
76   - <span class="required"> * </span> 路段限速:
77   - </label>
78   - <div class="col-md-6">
79   - <input type="text" class="form-control" name="speedLimit" id="speedLimitInput" placeholder="路段限速">
80   - </div>
81   - </div>
82   - </div>
83   - <!-- 是否撤销 -->
84   - <div class="form-body">
85   - <div class="form-group">
86   - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销:</label>
87   - <div class="col-md-6">
88   - <select name="destroy" class="form-control" id="destroySelect">
89   - <option value="">-- 请选择撤销类型 --</option>
90   - <option value="0">否</option>
91   - <option value="1">是</option>
92   - </select>
93   - </div>
94   - </div>
95   - </div>
96   - <!-- 道路编码-->
97   - <div class="form-body">
98   - <div class="form-group">
99   - <label class="control-label col-md-3">道路编码:</label>
100   - <div class="col-md-6">
101   - <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码">
102   - </div>
103   - </div>
104   - </div>
105   - <!-- 路段长度 -->
106   - <div class="form-body">
107   - <div class="form-group">
108   - <label class="col-md-3 control-label">路段长度:</label>
109   - <div class="col-md-6">
110   - <input type="text" class="form-control" name="sectionDistance" id="sectionDistanceInput" placeholder="路段长度">
111   - <span class="help-block">单位:公里(km)</span>
112   - </div>
113   - </div>
114   - </div>
115   - <!-- 路段历时 -->
116   - <div class="form-body">
117   - <div class="form-group">
118   - <label class="col-md-3 control-label">路段历时:</label>
119   - <div class="col-md-6">
120   - <input type="text" class="form-control" name="sectionTime" id="sectionTimeInput" placeholder="路段历时">
121   - <span class="help-block">单位:分钟(min)</span>
122   - </div>
123   - </div>
124   - </div>
125   - <!-- 版本号 -->
126   - <div class="form-body">
127   - <div class="form-group">
128   - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label>
129   - <div class="col-md-6">
130   - <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
131   - </div>
132   - </div>
133   - </div>
134   - <!-- 描述/说明 -->
135   - <div class="form-group">
136   - <label class="control-label col-md-3"> 描述/说明: </label>
137   - <div class="col-md-6">
138   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
139   - </div>
140   - </div>
  51 +
141 52 </form>
142 53 </div>
143 54 <div class="modal-footer">
144   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
145 55 <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>
  56 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
146 57 </div>
147 58 </div>
148 59 </div>
149 60 </div>
150 61 <script type="text/javascript">
151 62  
152   -$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,section,fun){
153   - var Section = section.getEitdSection();
  63 +$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){
  64 + var Section = p.data;
154 65 fun.setSectionFormValue(Section);
155 66 // 方向
156 67 var dir = Section.sectionrouteDirections;
... ... @@ -159,15 +70,6 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
159 70 ajaxd.getStation(lineId,dir,function(treeData) {
160 71 var array = treeData[0].children[1].children,paramsD =new Array();
161 72 var eq_scetionRouteCode = Section.sectionrouteCode;
162   - /* for(var i = 0 ; i<dArray.length; i++){
163   - var ptions_v = dArray[i].sectionrouteCode;
164   - if(eq_scetionRouteCode == ptions_v){
165   - continue;
166   - }
167   - options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')'
168   - + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ;
169   - }
170   - $('#sectionrouteCodeSelect').html(options); */
171 73 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'});
172 74 // 遍历.
173 75 $.each(array, function(i, g){
... ... @@ -195,16 +97,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
195 97 });
196 98 });
197 99 // 显示mobal
198   - $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  100 + $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});//
199 101 // 当调用 hide 实例方法时触发
200 102 $('#edit_section_mobal').on('hide.bs.modal', function () {
201 103 closeMobleSetClean();
202 104 });
203 105 function closeMobleSetClean() {
204   - // 清除地图覆盖物
205   - map_.clearMarkAndOverlays();
206   - /** 设置修改路段集合对象为空 */
207   - section.setEitdSection({});
  106 + // 清除地图覆盖物
  107 + map_.clearMarkAndOverlays();
208 108 fun.resjtreeDate(lineId,dir);
209 109 fun.editAChangeCssRemoveDisabled();
210 110 ajaxd.getSectionRouteInfo(lineId,dir,function(data) {
... ... @@ -227,14 +127,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
227 127 focusInvalid : false,
228 128 rules : {
229 129 'sectionName' : {required : true,maxlength:50},// 路段名称 必填项
230   - 'sectionCode': {required : true,},// 路段编码 必填项
  130 + /*'sectionCode': {required : true,},// 路段编码 必填项
231 131 'directions' : {required : true,},// 路段方向 必填项
232 132 'speedLimit' : {required : true,number : true},// 路段限速 必须输入合法的数字(负数,小数)。
233 133 'destroy' : {required : true,},// 是否撤销 必填项.
234 134 'roadCoding' : {number : true},// 道路编码 必须输入合法的数字(负数,小数)。
235 135 'sectionTime' : {number : true},// 路段时长 必须输入合法的数字(负数,小数)。
236 136 'sectionDistance' : {number : true},// 路段长度 必须输入合法的数字(负数,小数)。
237   - 'descriptions' : {maxlength: 150}// 描述与说明 最大长度.
  137 + 'descriptions' : {maxlength: 150}// 描述与说明 最大长度.*/
238 138 },
239 139 invalidHandler : function(event, validator) {
240 140 error.show();
... ... @@ -250,7 +150,14 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
250 150 label.closest('.form-group').removeClass('has-error');
251 151 },
252 152 submitHandler : function(f) {
  153 + // 获取折线坐标集合
  154 + var editPloyLineArray = p.getPath();
  155 + // 折线坐标集合
  156 + $('#bsectionVectorInput').val(JSON.stringify(editPloyLineArray));
253 157 var params = form.serializeJSON();
  158 + params.destroy=0;
  159 + params.sectionDistance=0;
  160 + params.sectionTime=0;
254 161 error.hide();
255 162 if(params.sectionrouteCode=='请选择...')
256 163 params.sectionrouteCode='';
... ... @@ -264,8 +171,6 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
264 171 }
265 172 $('#edit_section_mobal').modal('hide');
266 173 var dir = params.directions
267   - // 刷行左边树
268   - fun.resjtreeDate(lineId,dir);
269 174 closeMobleSetClean();
270 175 });
271 176 }
... ...
src/main/resources/static/pages/base/stationroute/js/addstationobj.js
... ... @@ -31,7 +31,7 @@ var AddStationObj = function () {
31 31 },
32 32  
33 33 /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
34   - setAddStationBJwpoints : function(bJwpoints) {
  34 + setAddStationJwpoints : function(bJwpoints) {
35 35  
36 36 station.bJwpoints = bJwpoints;
37 37 },
... ...
src/main/resources/static/pages/base/stationroute/js/drawingManager.js
... ... @@ -68,7 +68,7 @@ var DrawingManagerObj = function () {
68 68  
69 69 var pointE = e;
70 70  
71   - // 多变行质心点
  71 + // 多边行中心点
72 72 var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;
73 73  
74 74 var addPolyGonLen_ = pointE.getPath().length;
... ... @@ -96,7 +96,7 @@ var DrawingManagerObj = function () {
96 96 if(!$.isEmptyObject(add)){
97 97  
98 98 /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
99   - AddStationObj.setAddStationBJwpoints(addSttationPoints_);
  99 + AddStationObj.setAddStationJwpoints(addSttationPoints_);
100 100  
101 101 /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
102 102 AddStationObj.setAddStationShapesType('d');
... ... @@ -119,7 +119,7 @@ var DrawingManagerObj = function () {
119 119 if(!$.isEmptyObject(edit)){
120 120  
121 121 /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
122   - EditStationObj.setEitdStationBJwpoints(addSttationPoints_);
  122 + EditStationObj.setEitdStationJwpoints(addSttationPoints_);
123 123  
124 124 /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
125 125 EditStationObj.setEitdStationShapesType('d');
... ...
src/main/resources/static/pages/base/stationroute/js/editstationobj.js
... ... @@ -31,9 +31,9 @@ var EditStationObj = function () {
31 31 },
32 32  
33 33 /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
34   - setEitdStationBJwpoints : function(bJwpoints) {
  34 + setEitdStationJwpoints : function(bJwpoints) {
35 35  
36   - station.stationBJwpoints = bJwpoints;
  36 + station.stationJwpoints = bJwpoints;
37 37 },
38 38  
39 39 /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
... ... @@ -18,7 +18,9 @@
18 18 * - - - - - -》 stationRouteIsDestroy:撤销站点
19 19 *
20 20 * - - - - - -》 sectionUpdate : 编辑线路走向保存
21   - *
  21 + *
  22 + * - - - - - -》 sectionSave : 生成线路走向
  23 + *
22 24 * - - - - - -》 getIdLineName:获取线路名称
23 25 *
24 26 * - - - - - -》 getSectionRouteInfo:查询路段信息
... ... @@ -54,7 +56,7 @@ var GetAjaxData = function(){
54 56 },
55 57 // 查询线路某方向下所有站点的中心百度坐标
56 58 getStationRoutePoint : function(id_,dir_,callback) {
57   - $get('/stationroute/getStationRouteCenterPoints',{lineId:id_,direction:dir_},function(result) {
  59 + $get('/stationroute/getStationRouteList',{lineId:id_,direction:dir_},function(result) {
58 60 callback && callback(result);
59 61 });
60 62 },
... ... @@ -65,7 +67,7 @@ var GetAjaxData = function(){
65 67 callback && callback(array);
66 68 });
67 69 },
68   -
  70 +
69 71 // 查询站点编码
70 72 getStationCode : function(callback) {
71 73 $get('/station/getStationCode',null,function(stationCode) {
... ... @@ -74,6 +76,12 @@ var GetAjaxData = function(){
74 76 }
75 77 });
76 78 },
  79 + // 查询路段编码
  80 + getSectionCode : function(callback) {
  81 + $get('/section/getSectionCode',null,function(sectionCode) {
  82 + callback && callback(sectionCode);
  83 + });
  84 + },
77 85 findUpStationRouteCode : function(lineId,diraction,stationRouteCode,callback) {
78 86 $get('/stationroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,stationRouteCode:stationRouteCode},function(result) {
79 87 callback && callback(result);
... ... @@ -110,15 +118,17 @@ var GetAjaxData = function(){
110 118  
111 119 // 编辑线路走向保存
112 120 sectionUpdate:function(section,callback) {
113   -
114 121 $post('/section/sectionUpdate',section,function(data) {
115   -
116 122 callback && callback(data);
117   -
118 123 })
119   -
120 124 },
121   -
  125 + // 生成线路走向
  126 + sectionSave:function(section,callback){
  127 + $post('/section/sectionSave',section,function(data) {
  128 + callback && callback(data);
  129 + })
  130 + },
  131 +
122 132 // 获取线路名称
123 133 getIdLineName : function (id,callback) {
124 134  
... ... @@ -143,6 +153,12 @@ var GetAjaxData = function(){
143 153 callback && callback(resultdata);
144 154 });
145 155 },
  156 + // 根据ID查询路段信息.
  157 + getSectionRouteInfoById : function(sectionRouteId,callback){
  158 + $get('/sectionroute/findSectionRouteInfoFormId',{id:sectionRouteId},function(r) {
  159 + return callback && callback(r);
  160 + });
  161 + },
146 162  
147 163 // 手动规划线路保存
148 164 manualSave : function(params,callback) {
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
... ... @@ -97,7 +97,6 @@ $(function(){
97 97 WorldsBMap.clearMarkAndOverlays();
98 98 // 刷新左边树
99 99 PublicFunctions.resjtreeDate(Line.id,0);
100   - PublicFunctions.resjtreeDate(Line.id,1);
101 100 /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
102 101 GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) {
103 102 /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -26,548 +26,529 @@
26 26  
27 27 var PublicFunctions = function () {
28 28 var PubFun = {
29   - /** 初始化线路标题与ID */
30   - setTiteText : function(lineId) {
31   - // 根据线路ID获取线路名称
32   - GetAjaxData.getIdLineName(lineId,function(data) {
33   - // 定义线路名称
34   - var lineNameV = data.name;
35   - $('.portlet-title .caption').text(lineNameV);
36   - });
37   - },
38   - /** @param diraction 方向 @return array */
39   - getCurrSelNode : function(diraction){
40   - // 定义Obj
41   - var array = [];
42   - try {
  29 + /** 初始化线路标题与ID */
  30 + setTiteText : function(lineId) {
  31 + // 根据线路ID获取线路名称
  32 + GetAjaxData.getIdLineName(lineId,function(data) {
  33 + // 定义线路名称
  34 + var lineNameV = data.name;
  35 + $('.portlet-title .caption').text(lineNameV);
  36 + });
  37 + },
  38 + /** @param diraction 方向 @return array */
  39 + getCurrSelNode : function(diraction){
  40 + // 定义Obj
  41 + var array = [];
  42 + try {
  43 + // 上行
  44 + if(diraction=='0'){
  45 + // 获取上行选中节点
  46 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  47 + // 下行
  48 + }else if(diraction=='1'){
  49 + // 获取下行选中节点
  50 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  51 + }
  52 + } catch (e) {
  53 + console.log(e);
  54 + }
  55 + // 返回Obj
  56 + return array;
  57 + },
  58 + /** @param id:线路ID ;directionData:方向 */
  59 + resjtreeDate : function(id,directionData){
  60 + // 获取树数据
  61 + GetAjaxData.getStation(id,directionData,function(treeDateJson) {
  62 + // 获取数据长度
  63 + var len = treeDateJson[0].children[0].children.length;
  64 + // 上行
  65 + if(directionData==0){
  66 + // 长度大于零
  67 + if(len>0) {
  68 + // 隐藏上行规划
  69 + $('#upToolsMobal').hide();
  70 + // 显示树
  71 + $('#uptreeMobal').show();
  72 + // 刷新树
  73 + StationTreeData.upreloadeTree(treeDateJson);
  74 + }else {
  75 + // 显示上行规划
  76 + $('#upToolsMobal').show();
  77 + // 隐藏上行树
  78 + $('#uptreeMobal').hide();
  79 + }
  80 +
  81 + // 下行
  82 + }else if(directionData==1){
  83 + // 如果长度大于
  84 + if(len>0) {
  85 + // 隐藏下行规划
  86 + $('#downToolsMobal').hide();
  87 + // 显示下行树
  88 + $('#DowntreeMobal').show();
  89 + // 跟新树
  90 + StationTreeData.dwonreloadeTree(treeDateJson);
  91 + }else {
  92 + // 显示下行规划
  93 + $('#downToolsMobal').show();
  94 + // 隐藏下行树
  95 + $('#DowntreeMobal').hide();
  96 + }
  97 + }
  98 + });
  99 + },
  100 +
  101 + /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */
  102 + lineNameIsHaveInterval : function(directionData) {
  103 + // 定义线路名称
  104 + var lineNameV = $('.portlet-title .caption').text();
  105 + // 线路名称是否为区间线路
  106 + if(lineNameV.indexOf('区间')>0){
  107 + // 截去区间
  108 + var lineNameNew = lineNameV.replace('区间','');
  109 + // 是否继续弹出层
  110 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  111 + btn : [ '确认提示并提交', '取消' ]
  112 + }, function(index) {
  113 + // 关闭弹出层
  114 + layer.close(index);
  115 + // 线路名称去掉区间
  116 + lineNameV = lineNameNew;
  117 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  118 + PublicFunctions.systemLineStation(lineNameV,directionData);
  119 + },function(){
  120 + // 关闭弹出层
  121 + layer.closeAll();
43 122 // 上行
44   - if(diraction=='0'){
45   - // 获取上行选中节点
46   - array = $.jstree.reference("#station_Up_tree").get_selected(true);
  123 + if(directionData==0){
  124 + // 显示上行规划
  125 + $('#upToolsMobal').show();
47 126 // 下行
48   - }else if(diraction=='1'){
49   - // 获取下行选中节点
50   - array = $.jstree.reference("#station_Down_tree").get_selected(true);
  127 + }else if(directionData==1){
  128 + // 显示下行规划
  129 + $('#downToolsMobal').show();
51 130 }
52   - } catch (e) {
53   - console.log(e);
54   - }
55   - // 返回Obj
56   - return array;
57   - },
58   - /** @param id:线路ID ;directionData:方向 */
59   - resjtreeDate : function(id,directionData){
60   - // 获取树数据
61   - GetAjaxData.getStation(id,directionData,function(treeDateJson) {
62   - // 获取数据长度
63   - var len = treeDateJson[0].children[0].children.length;
  131 + });
  132 +
  133 + // 线路名称是否为定班线路
  134 + }else if(lineNameV.indexOf('定班')>0){
  135 + // 截去定班
  136 + var lineNameNew = lineNameV.replace('定班','');
  137 + // 是否继续弹出层
  138 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  139 + btn : [ '确认提示并提交', '取消' ]
  140 + }, function(index) {
  141 + // 关闭弹出层
  142 + layer.close(index);
  143 + // 线路名称去掉区间
  144 + lineNameV = lineNameNew;
  145 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  146 + PublicFunctions.systemLineStation(lineNameV,directionData);
  147 + },function(){
  148 + // 关闭弹出层
  149 + layer.closeAll();
64 150 // 上行
65 151 if(directionData==0){
66   - // 长度大于零
67   - if(len>0) {
68   - // 隐藏上行规划
69   - $('#upToolsMobal').hide();
70   - // 显示树
71   - $('#uptreeMobal').show();
72   - // 刷新树
73   - StationTreeData.upreloadeTree(treeDateJson);
74   - }else {
75   - // 显示上行规划
76   - $('#upToolsMobal').show();
77   - // 隐藏上行树
78   - $('#uptreeMobal').hide();
79   - }
80   -
  152 + // 显示上行规划
  153 + $('#upToolsMobal').show();
81 154 // 下行
82 155 }else if(directionData==1){
83   - // 如果长度大于
84   - if(len>0) {
85   - // 隐藏下行规划
86   - $('#downToolsMobal').hide();
87   - // 显示下行树
88   - $('#DowntreeMobal').show();
89   - // 跟新树
90   - StationTreeData.dwonreloadeTree(treeDateJson);
91   - }else {
92   - // 显示下行规划
93   - $('#downToolsMobal').show();
94   - // 隐藏下行树
95   - $('#DowntreeMobal').hide();
96   - }
  156 + // 显示下行规划
  157 + $('#downToolsMobal').show();
97 158 }
98 159 });
99   - },
100   -
101   - /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */
102   - lineNameIsHaveInterval : function(directionData) {
103   - // 定义线路名称
104   - var lineNameV = $('.portlet-title .caption').text();
105   - // 线路名称是否为区间线路
106   - if(lineNameV.indexOf('区间')>0){
107   - // 截去区间
108   - var lineNameNew = lineNameV.replace('区间','');
109   - // 是否继续弹出层
110   - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
111   - btn : [ '确认提示并提交', '取消' ]
112   - }, function(index) {
113   - // 关闭弹出层
114   - layer.close(index);
115   - // 线路名称去掉区间
116   - lineNameV = lineNameNew;
117   - /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
118   - PublicFunctions.systemLineStation(lineNameV,directionData);
119   - },function(){
120   - // 关闭弹出层
121   - layer.closeAll();
122   - // 上行
123   - if(directionData==0){
124   - // 显示上行规划
125   - $('#upToolsMobal').show();
126   - // 下行
127   - }else if(directionData==1){
128   - // 显示下行规划
129   - $('#downToolsMobal').show();
130   - }
  160 + }else {
  161 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  162 + PublicFunctions.systemLineStation(lineNameV,directionData);
  163 + }
  164 +
  165 + },
  166 +
  167 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  168 + systemLineStation : function(lineNameV,directionData) {
  169 + /** 从百度地图获取线路信息 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行);callback>*/
  170 + WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){
  171 + // 如果线路信息不为空
  172 + if(BusLine) {
  173 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  174 + var Polygon = BusLine.getPolyline();
  175 + // 返回多边型的点数组(自1.2新增)
  176 + var polyGonArray = Polygon.getPath();
  177 + // 获取公交站点个数(自 1.2 新增)
  178 + var stationNumber = BusLine.getNumBusStations();
  179 + // 定义线路信息集合
  180 + var stationInfo = [];
  181 + // 遍历
  182 + for(var k = 0 ; k < stationNumber; k++) {
  183 + // 定义线路信息集合
  184 + var tempM = {};
  185 + // 添加站点名称
  186 + tempM.name = BusLine.getBusStation(k).name;
  187 + // 添加站点坐标
  188 + tempM.potion = BusLine.getBusStation(k).position;
  189 + tempM.wgs = {x:'',y:''};
  190 + // 添加
  191 + stationInfo.push(tempM);
  192 + }
  193 + // 获取站点之间的距离与时间
  194 + WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {
  195 + // 设置第一个站的距离
  196 + json[0].distance = '';
  197 + // 设置第一个站的时间
  198 + json[0].duration = '';
  199 + // 定义站点信息JSON字符串
  200 + var stationJSON = JSON.stringify(json);
  201 + // 定义路段信息字符串
  202 + var sectionJSON = JSON.stringify(polyGonArray);
  203 + // 参数集合
  204 + var params = {};
  205 + // 站点信息JSON字符串
  206 + params.stationJSON = stationJSON;
  207 + var addLine = LineObj.getLineObj();
  208 + // 线路ID
  209 + params.lineId = addLine.id;
  210 + // 方向
  211 + params.directions = directionData;
  212 + // 原始坐标类型
  213 + params.dbType = 'b';
  214 + // 圆形半径
  215 + params.radius = '100';
  216 + // 图形类型(r:圆形;p:多边形)
  217 + params.shapesType = 'r';
  218 + // destroy:是否撤销
  219 + params.destroy = '0';
  220 +
  221 + // 路段信息JSON字符串
  222 + params.sectionJSON = sectionJSON;
  223 + // 限速
  224 + params.speedLimit = '60';
  225 + params.baseRes = 'No';
  226 + // 获取版本号后提交添加
  227 + $.get('/lineVersions/findByLineId',{'lineId':addLine.id},function(lineVersions){
  228 + $.each(lineVersions,function(){
  229 + if (this.status == 1) {
  230 + // versions:版本号
  231 + params.versions = this.versions;
  232 + // 保存
  233 + GetAjaxData.collectionSave(params,function(rd) {
  234 + if(rd.status='SUCCESS') {
  235 + // 关闭弹出层
  236 + layer.closeAll();
  237 + layer.msg('保存成功!');
  238 + }else {
  239 + // 保存失败
  240 + layer.msg('保存失败!');
  241 + }
  242 + // 刷新树
  243 + PublicFunctions.resjtreeDate(addLine.id,directionData);
  244 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
  245 + GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {
  246 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  247 + PublicFunctions.linePanlThree(addLine.id,data,directionData);
  248 + });
  249 + });
  250 + }
  251 + })
  252 + });
131 253 });
132   -
133   - // 线路名称是否为定班线路
134   - }else if(lineNameV.indexOf('定班')>0){
135   - // 截去定班
136   - var lineNameNew = lineNameV.replace('定班','');
137   - // 是否继续弹出层
138   - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
139   - btn : [ '确认提示并提交', '取消' ]
140   - }, function(index) {
141   - // 关闭弹出层
142   - layer.close(index);
143   - // 线路名称去掉区间
144   - lineNameV = lineNameNew;
145   - /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
146   - PublicFunctions.systemLineStation(lineNameV,directionData);
147   - },function(){
  254 + // 关闭弹出层
  255 + layer.closeAll();
  256 + // 上行
  257 + if(directionData==0){
  258 + $('#stationDown').removeClass('active');
  259 + $('#stationDown').removeClass('in');
  260 + $('#stationDown').addClass('fade');
  261 + $('#stationUp').addClass('active in');
  262 + $('#downLine').parent().removeClass('active');
  263 + $('#upLine').parent().addClass('active');
  264 + // 下行
  265 + }else if(directionData==1){
  266 + $('#stationUp').removeClass('active');
  267 + $('#stationUp').removeClass('in');
  268 + $('#stationUp').addClass('fade');
  269 + $('#stationDown').addClass('active in');
  270 + $('#upLine').parent().removeClass('active');
  271 + $('#downLine').parent().addClass('active');
  272 + }
  273 + } else {
  274 + layer.msg('百度地图中没有此线路,无法系统规划!');
  275 + setTimeout(function() {
148 276 // 关闭弹出层
149 277 layer.closeAll();
150 278 // 上行
151 279 if(directionData==0){
152 280 // 显示上行规划
153 281 $('#upToolsMobal').show();
154   - // 下行
  282 + // 下行
155 283 }else if(directionData==1){
156 284 // 显示下行规划
157 285 $('#downToolsMobal').show();
158 286 }
159   - });
160   - }else {
161   - /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
162   - PublicFunctions.systemLineStation(lineNameV,directionData);
  287 + }, 3000);
163 288 }
  289 + });
  290 + },
164 291  
165   - },
166   -
167   - /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
168   - systemLineStation : function(lineNameV,directionData) {
169   - /** 从百度地图获取线路信息 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行);callback>*/
170   - WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){
171   - // 如果线路信息不为空
172   - if(BusLine) {
173   - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
174   - var Polygon = BusLine.getPolyline();
175   - // 返回多边型的点数组(自1.2新增)
176   - var polyGonArray = Polygon.getPath();
177   - // 获取公交站点个数(自 1.2 新增)
178   - var stationNumber = BusLine.getNumBusStations();
179   - // 定义线路信息集合
180   - var stationInfo = [];
181   - // 遍历
182   - for(var k = 0 ; k < stationNumber; k++) {
183   - // 定义线路信息集合
184   - var tempM = {};
185   - // 添加站点名称
186   - tempM.name = BusLine.getBusStation(k).name;
187   - // 添加站点坐标
188   - tempM.potion = BusLine.getBusStation(k).position;
189   - tempM.wgs = {x:'',y:''};
190   - // 添加
191   - stationInfo.push(tempM);
192   - }
193   - // 获取站点之间的距离与时间
194   - WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {
195   - // 设置第一个站的距离
196   - json[0].distance = '';
197   - // 设置第一个站的时间
198   - json[0].duration = '';
199   - // 定义站点信息JSON字符串
200   - var stationJSON = JSON.stringify(json);
201   - // 定义路段信息字符串
202   - var sectionJSON = JSON.stringify(polyGonArray);
203   - // 参数集合
204   - var params = {};
205   - // 站点信息JSON字符串
206   - params.stationJSON = stationJSON;
207   - var addLine = LineObj.getLineObj();
208   - // 线路ID
209   - params.lineId = addLine.id;
210   - // 方向
211   - params.directions = directionData;
212   - // 原始坐标类型
213   - params.dbType = 'b';
214   - // 圆形半径
215   - params.radius = '100';
216   - // 图形类型(r:圆形;p:多边形)
217   - params.shapesType = 'r';
218   - // destroy:是否撤销
219   - params.destroy = '0';
220   -
221   - // 路段信息JSON字符串
222   - params.sectionJSON = sectionJSON;
223   - // 限速
224   - params.speedLimit = '60';
225   - params.baseRes = 'No';
226   - // 获取版本号后提交添加
227   - $.get('/lineVersions/findByLineId',{'lineId':addLine.id},function(lineVersions){
228   - $.each(lineVersions,function(){
229   - if (this.status == 1) {
230   - // versions:版本号
231   - params.versions = this.versions;
232   - // 保存
233   - GetAjaxData.collectionSave(params,function(rd) {
234   - if(rd.status='SUCCESS') {
235   - // 关闭弹出层
236   - layer.closeAll();
237   - layer.msg('保存成功!');
238   - }else {
239   - // 保存失败
240   - layer.msg('保存失败!');
241   - }
242   - // 刷新树
243   - PublicFunctions.resjtreeDate(addLine.id,directionData);
244   - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
245   - GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {
246   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
247   - PublicFunctions.linePanlThree(addLine.id,data,directionData);
248   - });
249   - });
250   - }
251   - })
252   - });
253   - });
254   - // 关闭弹出层
255   - layer.closeAll();
256   - // 上行
257   - if(directionData==0){
258   - $('#stationDown').removeClass('active');
259   - $('#stationDown').removeClass('in');
260   - $('#stationDown').addClass('fade');
261   - $('#stationUp').addClass('active in');
262   - $('#downLine').parent().removeClass('active');
263   - $('#upLine').parent().addClass('active');
264   - // 下行
265   - }else if(directionData==1){
266   - $('#stationUp').removeClass('active');
267   - $('#stationUp').removeClass('in');
268   - $('#stationUp').addClass('fade');
269   - $('#stationDown').addClass('active in');
270   - $('#upLine').parent().removeClass('active');
271   - $('#downLine').parent().addClass('active');
272   - }
273   - } else {
274   - layer.msg('百度地图中没有此线路,无法系统规划!');
275   - setTimeout(function() {
276   - // 关闭弹出层
277   - layer.closeAll();
278   - // 上行
279   - if(directionData==0){
280   - // 显示上行规划
281   - $('#upToolsMobal').show();
282   - // 下行
283   - }else if(directionData==1){
284   - // 显示下行规划
285   - $('#downToolsMobal').show();
286   - }
287   - }, 3000);
288   - }
289   - });
290   - },
291   -
292   - /** @param directionV_ :方向 */
293   - stationRevoke : function(directionV_) {
294   - // 获取树选中节点对象
295   - var obj = PublicFunctions.getCurrSelNode(directionV_);
296   - // 是否选中,选中节点是否为站点
297   - if(obj.length == 0 || obj[0].original.chaildredType !='station'){
298   - // 弹出提示层
299   - layer.msg('请先选择要删除的站点!');
300   - return;
301   - }
302   - // 弹出是否撤销提示框
303   - layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
304   - // 站点路由ID
305   - var stationRouteId = obj[0].original.stationRouteId;
306   - // 撤销参数集合
307   - var params = {stationRouteId:stationRouteId,destroy:'1'};
308   - // 方向
309   - var stationRouteDirections = obj[0].original.stationRouteDirections;
310   - // 撤销
311   - GetAjaxData.stationRouteIsDestroy(params,function(result) {
312   - // 关闭弹出框
313   - layer.close(index);
314   - if(result.status=='SUCCESS'){
315   - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');
316   - }else{
317   - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');
318   - }
319   - WorldsBMap.clearMarkAndOverlays();
320   - var Line = LineObj.getLineObj();
321   - // 刷行左边树
322   - PublicFunctions.resjtreeDate(Line.id,stationRouteDirections);
323   - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
324   - GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,function(data) {
325   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
326   - PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections);
327   - });
  292 + /** @param directionV_ :方向 */
  293 + stationRevoke : function(directionV_) {
  294 + // 获取树选中节点对象
  295 + var obj = PublicFunctions.getCurrSelNode(directionV_);
  296 + // 是否选中,选中节点是否为站点
  297 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  298 + // 弹出提示层
  299 + layer.msg('请先选择要删除的站点!');
  300 + return;
  301 + }
  302 + // 弹出是否撤销提示框
  303 + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
  304 + // 站点路由ID
  305 + var stationRouteId = obj[0].original.stationRouteId;
  306 + // 撤销参数集合
  307 + var params = {stationRouteId:stationRouteId,destroy:'1'};
  308 + // 方向
  309 + var stationRouteDirections = obj[0].original.stationRouteDirections;
  310 + // 撤销
  311 + GetAjaxData.stationRouteIsDestroy(params,function(result) {
  312 + // 关闭弹出框
  313 + layer.close(index);
  314 + if(result.status=='SUCCESS'){
  315 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');
  316 + }else{
  317 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');
  318 + }
  319 + WorldsBMap.clearMarkAndOverlays();
  320 + var Line = LineObj.getLineObj();
  321 + // 刷行左边树
  322 + PublicFunctions.resjtreeDate(Line.id,stationRouteDirections);
  323 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
  324 + GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,function(data) {
  325 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  326 + PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections);
328 327 });
329   - });
330   - },
  328 + });
  329 + });
  330 + },
331 331  
332   - /** @param direction_ :方向 */
333   - editLinePlan : function(direction_) {
334   - var sel = PublicFunctions.getCurrSelNode(direction_);
335   - if(sel.length==0 || sel[0].original.chaildredType !='section'){
336   - if(direction_=='0') {
337   - layer.msg('请先选中要编辑的上行路段!');
338   - }else if(direction_=='1') {
339   - layer.msg('请先选中要编辑的下行路段!');
340   - }
341   - return;
  332 + /** @param direction_ :方向 */
  333 + editLinePlan : function(direction_) {
  334 + var sel = PublicFunctions.getCurrSelNode(direction_);
  335 + if(sel.length==0 || sel[0].original.chaildredType !='section'){
  336 + if(direction_=='0') {
  337 + layer.msg('请先选中要编辑的上行路段!');
  338 + }else if(direction_=='1') {
  339 + layer.msg('请先选中要编辑的下行路段!');
  340 + }
  341 + return;
  342 + }
  343 + $('#downLine').addClass('btn disabled');
  344 + $('.btn-circle').addClass('disabled');
  345 + $('#upLine').addClass('btn disabled');
  346 + var editSectionV = sel[0].original;
  347 + EditSectionObj.setEitdSection(editSectionV);
  348 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  349 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
  350 + WorldsBMap.editPolyUpline();
  351 + },
  352 +
  353 + setFormValue : function(editStationParmas) {
  354 + // 站点ID
  355 + $('#stationIdInput').val(editStationParmas.stationId);
  356 + // 站点路由ID
  357 + $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
  358 + // 站点路由线路Id
  359 + $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
  360 + // 线路编码
  361 + $('#lineCodeInput').val(editStationParmas.stationRouteLIneCode);
  362 + // 百度坐标点图形集合
  363 + $('#bPolygonGridInput').val(editStationParmas.stationBPolygonGrid);
  364 + // 获取站点名称元素设值
  365 + $('#zdmcInput').val(editStationParmas.stationStationName);
  366 + // 获取站点路由名称元素设值
  367 + $('#stationNameInput').val(editStationParmas.stationStationName);
  368 + // 获取站点编码元素设值
  369 + $('#stationCodInput').val(editStationParmas.stationCode);
  370 + // 获取站点类型元素设值
  371 + // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
  372 + // 获取站点方向元素设值
  373 + $('#stationdirSelect').val(editStationParmas.stationRoutedirections);
  374 + // 获取站点道路编码元素设值
  375 + $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
  376 + // 百度地图经纬度坐标中心点
  377 + $('#bJwpointsInput').val(editStationParmas.stationJwpoints);
  378 + if(editStationParmas.stationShapesType=='r') {
  379 + // 获取图形类型元素,并添加值
  380 + $('#shapesTypeSelect').val('圆形');
  381 + }else if(editStationParmas.stationShapesType=='d'){
  382 + $('#radiusGroup').hide();
  383 + $('#shapesTypeSelect').val('多边形');
  384 + }
  385 + // 获取半径元素,并添加值
  386 + $('#radiusInput').val(editStationParmas.stationRadius);
  387 + // 是否撤销
  388 + $('#destroySelect').val(editStationParmas.stationDestroy);
  389 + // 到站时间
  390 + $('#toTimeInput').val(editStationParmas.stationRouteToTime);
  391 + // 到站距离
  392 + $('#distancesInput').val(editStationParmas.stationRouteDistances);
  393 + // 线路版本号
  394 + $('#versionsInput').val(editStationParmas.stationRouteVersions);
  395 + // 描述/说明
  396 + $('#descriptionsTextarea').val(editStationParmas.sttationDescriptions);
  397 + },
  398 +
  399 + setSectionFormValue : function(Section) {
  400 + $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);
  401 + // 路段ID
  402 + $('#sectionIdInput').val(Section.sectionId);
  403 + // 路段路由ID
  404 + $('#sectionRouteIdInput').val(Section.sectionrouteId);
  405 + // 线路ID
  406 + $('#sectionRouteLineInput').val(Section.sectionrouteLine);
  407 + // 线路编码
  408 + $('#lineCodeInput').val(Section.sectionrouteLineCode);
  409 + // 折线坐标集合
  410 + $('#bsectionVectorInput').val(Section.sectionBsectionVector);
  411 + // 路段名称
  412 + $('#sectionNameInput').val(Section.sectionName);
  413 + // 路段编码
  414 + $('#sectionCodeInput').val(Section.sectionCode);
  415 + // 路段序号
  416 + $('#sectionrouteCodeSelect').val(Section.sectionrouteCode);
  417 + // 路段方向
  418 + $('#directionsSection').val(Section.sectionrouteDirections);
  419 + // 道路编码
  420 + $('#roadCodingCodInput').val(Section.sectionRoadCoding);
  421 + // 道路限速
  422 + $('#speedLimitInput').val(Section.sectionSpeedLimet);
  423 + // 路段长度
  424 + $('#sectionDistanceInput').val(Section.sectionDistance);
  425 + // 时长
  426 + $('#sectionTimeInput').val(Section.sectionTime);
  427 + // 版本号
  428 + $('#versionsInput').val(Section.versions);
  429 + },
  430 +
  431 + //lineId,data,direction
  432 + treeSectionClick: function(lineId,data,direction){
  433 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  434 + WorldsBMap.clearMarkAndOverlays();
  435 + // 编辑路段数据
  436 + for(var d= 0; d<data.length;d++){
  437 + // 地图折线坐标点集合
  438 + var polylineArray = [];
  439 + // 获取路段折线坐标字符串
  440 + var sectionBsectionVectorStr = data[d].sectionBsectionVector;
  441 + if(sectionBsectionVectorStr==null) {
  442 + continue;
342 443 }
343   - $('#downLine').addClass('btn disabled');
344   - $('.btn-circle').addClass('disabled');
345   - $('#upLine').addClass('btn disabled');
346   - var editSectionV = sel[0].original;
347   - EditSectionObj.setEitdSection(editSectionV);
348   - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
349   - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
350   - WorldsBMap.editPolyUpline();
351   - },
352   -
353   - setFormValue : function(editStationParmas) {
354   - // 站点ID
355   - $('#stationIdInput').val(editStationParmas.stationId);
356   - // 站点路由ID
357   - $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
358   - // 站点路由线路Id
359   - $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
360   - // 线路编码
361   - $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
362   - // 百度坐标点图形集合
363   - $('#bPolygonGridInput').val(editStationParmas.stationBPolygonGrid);
364   - // 获取站点名称元素设值
365   - $('#zdmcInput').val(editStationParmas.stationStationName);
366   - // 获取站点路由名称元素设值
367   - $('#stationNameInput').val(editStationParmas.stationRouteStationName);
368   - // 获取站点编码元素设值
369   - $('#stationCodInput').val(editStationParmas.stationStationCod);
370   - // 获取站点类型元素设值
371   - // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
372   - // 获取站点方向元素设值
373   - $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
374   - // 获取站点道路编码元素设值
375   - $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
376   - // 百度地图经纬度坐标中心点
377   - $('#bJwpointsInput').val(editStationParmas.stationBJwpoints);
378   - if(editStationParmas.stationShapesType=='r') {
379   - // 获取图形类型元素,并添加值
380   - $('#shapesTypeSelect').val('圆形');
381   - }else if(editStationParmas.stationShapesType=='d'){
382   - $('#radiusGroup').hide();
383   - $('#shapesTypeSelect').val('多边形');
  444 + // 切割段折线坐标字符串
  445 + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
  446 + // 分割折线坐标字符串
  447 + var lineArray = tempStr.split(',');
  448 + for(var i = 0;i<lineArray.length;i++) {
  449 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
384 450 }
385   - // 获取半径元素,并添加值
386   - $('#radiusInput').val(editStationParmas.stationRadius);
387   - // 是否撤销
388   - $('#destroySelect').val(editStationParmas.stationDestroy);
389   - // 到站时间
390   - $('#toTimeInput').val(editStationParmas.stationRouteToTime);
391   - // 到站距离
392   - $('#distancesInput').val(editStationParmas.stationRouteDistances);
393   - // 线路版本号
394   - $('#versionsInput').val(editStationParmas.stationRouteVersions);
395   - // 描述/说明
396   - $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
397   - },
398   -
399   - setSectionFormValue : function(Section) {
400   - $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);
401   - // 路段ID
402   - $('#sectionIdInput').val(Section.sectionId);
403   - // 路段路由ID
404   - $('#sectionRouteIdInput').val(Section.sectionrouteId);
405   - // 线路ID
406   - $('#sectionRouteLineInput').val(Section.sectionrouteLine);
407   - // 线路编码
408   - $('#lineCodeInput').val(Section.sectionrouteLineCode);
409   - // 折线坐标集合
410   - $('#bsectionVectorInput').val(Section.sectionBsectionVector);
411   - // 路段名称
412   - $('#sectionNameInput').val(Section.sectionName);
413   - // 路段编码
414   - $('#sectionCodeInput').val(Section.sectionCode);
415   - // 路段序号
416   - $('#sectionrouteCodeSelect').val(Section.sectionrouteCode);
417   - // 路段方向
418   - $('#directionsSection').val(Section.sectionrouteDirections);
419   - // 道路编码
420   - $('#roadCodingCodInput').val(Section.sectionRoadCoding);
421   - // 道路限速
422   - $('#speedLimitInput').val(Section.sectionSpeedLimet);
423   - // 路段长度
424   - $('#sectionDistanceInput').val(Section.sectionDistance);
425   - // 时长
426   - $('#sectionTimeInput').val(Section.sectionTime);
427   - // 版本号
428   - $('#versionsInput').val(Section.versions);
429   - // 是否撤销
430   - $('#destroySelect').val(Section.destroy);
431   - // 描述/说明
432   - $('#descriptionsTextarea').val(Section.descriptions);
433   - },
434   -
435   - //lineId,data,direction
436   - treeSectionClick: function(lineId,data,direction){
437   - /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  451 + var index = parseInt(polylineArray.length/2);
  452 + var center = polylineArray[index];
  453 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
  454 + WorldsBMap.drawingUpline(polylineArray,center);
  455 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  456 + WorldsBMap.drawingUpStationPoint(data[d], d+1);
  457 + }
  458 + },
  459 +
  460 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  461 + linePanlThree : function(lineId,data,direction) {
  462 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  463 + GetAjaxData.getStationRoutePoint(lineId,direction,function(resultdata) {
438 464 WorldsBMap.clearMarkAndOverlays();
439   - // 编辑路段数据
440   - for(var d= 0; d<data.length;d++){
441   - // 地图折线坐标点集合
442   - var polylineArray = [];
443   - // 获取路段折线坐标字符串
444   - var sectionBsectionVectorStr = data[d].sectionBsectionVector;
445   - if(sectionBsectionVectorStr==null) {
446   - continue;
447   - }
448   - // 切割段折线坐标字符串
449   - var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
450   - // 分割折线坐标字符串
451   - var lineArray = tempStr.split(',');
452   - for(var i = 0;i<lineArray.length;i++) {
453   - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  465 + var polyline_center;
  466 + // 如果站点路由数据不为空
  467 + if(resultdata.length>0) {
  468 + var ceter_index = Math.round(resultdata.length / 2);
  469 + var ceterPointsStr = resultdata[ceter_index].stationJwpoints;
  470 + var ceterPointsArray = ceterPointsStr.split(' ');
  471 + polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);
  472 + // 遍历站点路由数据
  473 + for(var s = 0 ; s<resultdata.length;s++) {
  474 + WorldsBMap.drawingUpStationPoint(resultdata[s], s+1);
454 475 }
455   - var index = parseInt(polylineArray.length/2);
456   - var center = polylineArray[index];
457   - /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
458   - WorldsBMap.drawingUpline(polylineArray,center);
459   - /** 在地图上画点 @param:<point_center:中心坐标点> */
460   - WorldsBMap.drawingUpStationPoint(center,data[d].name,d+1);
  476 +
461 477 }
462   - },
463   -
464   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
465   - linePanlThree : function(lineId,data,direction) {
466   - /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
467   - GetAjaxData.getStationRoutePoint(lineId,direction,function(resultdata) {
468   - WorldsBMap.clearMarkAndOverlays();
469   - var polyline_center;
470   - // 如果站点路由数据不为空
471   - if(resultdata.length>0) {
472   - var ceter_index = Math.round(resultdata.length / 2);
473   - var ceterPointsStr = resultdata[ceter_index].bJwpoints;
474   - var ceterPointsArray = ceterPointsStr.split(' ');
475   - polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);
476   - // 遍历站点路由数据
477   - for(var s = 0 ; s<resultdata.length;s++) {
478   - // 中心点坐标字符串
479   - var bJwpointsStr = resultdata[s].bJwpoints;
480   - var stationName = resultdata[s].stationName;
481   - // 起个中心点坐标字符串
482   - var bJwpointsArray = bJwpointsStr.split(' ');
483   - // 设置中心点
484   - var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
485   - /** 在地图上画点 @param:<point_center:中心坐标点> */
486   - WorldsBMap.drawingUpStationPoint(point_center,stationName,s+1);
487   - }
488   -
489   - }
490   - // 路段数据长度
491   - var dataLen = data.length;
492   - // 如果大于零
493   - if(dataLen>0) {
494   - // 编辑路段数据
495   - for(var d= 0; d<dataLen;d++){
496   - // 地图折线坐标点集合
497   - var polylineArray = [];
498   - // 获取路段折线坐标字符串
499   - var sectionBsectionVectorStr = data[d].sectionBsectionVector;
500   - if(sectionBsectionVectorStr==null)
501   - continue;
502   - // 切割段折线坐标字符串
503   - var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
504   - // 分割折线坐标字符串
505   - var lineArray = tempStr.split(',');
506   - for(var i = 0;i<lineArray.length;i++) {
507   - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
508   - }
509   - /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
510   - /*WorldsBMap.drawingUpline(polylineArray,polyline_center,data[d]);*/
511   - WorldsBMap.drawingUpline01(polylineArray,polyline_center,data[d]);
512   - }
  478 + // 路段数据长度
  479 + var dataLen = data.length;
  480 + // 如果大于零
  481 + if(dataLen>0) {
  482 + WorldsBMap.drawingUpline01(polyline_center,data);
  483 + }
  484 + });
  485 + },
  486 + /** 加载树 @param:<lineId:线路ID;diraction:方向(0:上行;1:下行)> */
  487 + TreeUpOrDown : function(lineId,diraction) {
  488 + /** 获取树结果数据 @param:<lineId:线路ID;diraction:方向;callback:回调函数> */
  489 + GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
  490 + // 获取返回数据长度
  491 + var len = treeDateJson[0].children[0].children.length;
  492 + // 上行
  493 + if(diraction == 0) {
  494 + /** 初始化上行树 @param:<treeDateJson:树数据结构> */
  495 + StationTreeData.upInit(treeDateJson);
  496 + if(len>0) {
  497 + $('#upToolsMobal').hide();
  498 + $('#uptreeMobal').show();
  499 + }else {
  500 + $('#upToolsMobal').show();
  501 + $('#uptreeMobal').hide();
513 502 }
514   - });
515   - },
516   - /** 加载树 @param:<lineId:线路ID;diraction:方向(0:上行;1:下行)> */
517   - TreeUpOrDown : function(lineId,diraction) {
518   - /** 获取树结果数据 @param:<lineId:线路ID;diraction:方向;callback:回调函数> */
519   - GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
520   - // 获取返回数据长度
521   - var len = treeDateJson[0].children[0].children.length;
522   - // 上行
523   - if(diraction == 0) {
524   - /** 初始化上行树 @param:<treeDateJson:树数据结构> */
525   - StationTreeData.upInit(treeDateJson);
526   - if(len>0) {
527   - $('#upToolsMobal').hide();
528   - $('#uptreeMobal').show();
529   - }else {
530   - $('#upToolsMobal').show();
531   - $('#uptreeMobal').hide();
532   - }
533   - // 下行
534   - }else if(diraction ==1) {
535   - /** 出事画下行树 @param:<treeDateJson:树数据结构> */
536   - StationTreeData.downInit(treeDateJson);
537   - if(len>0) {
538   - $('#downToolsMobal').hide();
539   - $('#DowntreeMobal').show();
540   - }else {
541   - $('#downToolsMobal').show();
542   - $('#DowntreeMobal').hide();
543   - }
  503 + // 下行
  504 + }else if(diraction ==1) {
  505 + /** 出事画下行树 @param:<treeDateJson:树数据结构> */
  506 + StationTreeData.downInit(treeDateJson);
  507 + if(len>0) {
  508 + $('#downToolsMobal').hide();
  509 + $('#DowntreeMobal').show();
  510 + }else {
  511 + $('#downToolsMobal').show();
  512 + $('#DowntreeMobal').hide();
544 513 }
545   - });
546   - },
547   - isHaveStationName : function(data) {
548   - if(data.length>0) {
549   - layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
550   - layer.close(index);
551   - });
552   - return false;
553   - }else {
554   - return true;
555 514 }
556   - },
557   - editAChangeCssRemoveDisabled : function() {
558   - $('#downLine').removeClass('btn disabled');
559   - $('.btn-circle').removeClass('disabled');
560   - $('#upLine').removeClass('btn disabled');
561   - },
562   - // 方向代码转名称.
563   - dirdmToName : function(value){
564   - var srStr = '';
565   - if(value=='0')
566   - srStr = '上行';
567   - else if(value=='1')
568   - srStr = '下行';
569   - return srStr;
570   - },
  515 + });
  516 + },
  517 + isHaveStationName : function(data) {
  518 + if(data.length>0) {
  519 + layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  520 + layer.close(index);
  521 + });
  522 + return false;
  523 + }else {
  524 + return true;
  525 + }
  526 + },
  527 + // 地图处于编辑状态
  528 + editMapStatus : function () {
  529 + WorldsBMap.setMap_status(1);
  530 + $('.protlet-box-layer').show();
  531 + },
  532 + // 地图处于编辑状态
  533 + editMapStatusRemove : function () {
  534 + WorldsBMap.setMap_status(0);
  535 + $('.protlet-box-layer').hide();
  536 + },
  537 + // 选项鎖死解除
  538 + editAChangeCssRemoveDisabled : function() {
  539 + $('#downLine').removeClass('btn disabled');
  540 + $('.btn-circle').removeClass('disabled');
  541 + $('#upLine').removeClass('btn disabled');
  542 + },
  543 + // 方向代码转名称.
  544 + dirdmToName : function(value){
  545 + var srStr = '';
  546 + if(value=='0')
  547 + srStr = '上行';
  548 + else if(value=='1')
  549 + srStr = '下行';
  550 + return srStr;
  551 + },
571 552 }
572 553 return PubFun ;
573 554 }();
574 555 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
1 1 /**
2 2 * 百度地图
3   - *
  3 + *
4 4 * - - - - - -》init:地图初始化
5   - *
  5 + *
6 6 * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据
7   - *
  7 + *
8 8 * - - - - - -》getDistanceAndDuration:获取距离与时间
9   - *
  9 + *
10 10 * - - - - - -》pointsPolygon:地图画多边行
11   - *
  11 + *
12 12 * - - - - - -》pointsCircle:画圆
13   - *
  13 + *
14 14 * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标
15   - *
  15 + *
16 16 * - - - - - -》drawingUpline:在地图上画出上行线路走向
17   - *
  17 + *
18 18 * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)
19   - *
  19 + *
20 20 * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)
21   - *
  21 + *
22 22 * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)
23 23 */
24 24  
25 25 window.WorldsBMap = function () {
26   -
27   - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 */
28   - var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false;
29   -
30   - var Bmap = {
31   -
32   - init : function() {
33   -
34   - // 设置中心点,
35   - var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
36   -
37   - // 百度API Key
38   - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
39   -
40   - // 初始化百度地图
41   - mapBValue = new BMap.Map("bmap_basic");
42   -
43   - //中心点和缩放级别
44   - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
45   -
46   - //启用地图拖拽事件,默认启用(可不写)
47   - mapBValue.enableDragging();
48   -
49   - //启用地图滚轮放大缩小
50   - mapBValue.enableScrollWheelZoom();
51   -
52   - //禁用鼠标双击放大
53   - mapBValue.disableDoubleClickZoom();
54   -
55   - //启用键盘上下左右键移动地图
56   - mapBValue.enableKeyboard();
57   -
58   - return mapBValue;
59   - },
60   -
61   - /** 获取地图对象 @return 地图对象map */
62   - getmapBValue : function() {
63   -
64   - return mapBValue;
65   -
66   - },
67   -
68   - getPolygon : function(){
69   -
70   - return polygon;
71   - },
72   -
73   - getPolyUpline : function() {
74   -
75   - return polyUpline;
76   - },
77   -
78   - getCircle : function() {
79   -
80   - return circle;
81   - },
82   -
83   - getIsEditStatus : function() {
84   - return iseditStatus;
85   - },
86   -
87   - setIsEditStatus : function(v) {
88   - iseditStatus = v ;
89   - },
90   -
91   - initDrawingManager: function(map,styleOptions) {
92   -
93   - },
94   -
95   - getDrawingManagerObj : function() {
96   -
97   - return drawingManagerInitV;
98   - },
99   -
100   - // 从百度地图抓去站点与路段数据
101   - lineInfoPanl : function(lineNameValue,i,cb) {
102   -
103   - /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */
104   - WorldsBMap.getBmapStationNames(lineNameValue,i,function(BusLine){
105   -
106   - return cb && cb(BusLine);
107   -
108   - });
109   -
110   - },
111   -
112   - /** 获取距离与时间 @param <points:坐标点集合> */
113   - getDistanceAndDuration : function(points,callback){
114   -
115   - // 获取长度
116   - var len = points.length;
117   -
118   - (function(){
119   -
120   - if (!arguments.callee.count) {
121   -
122   - arguments.callee.count = 0;
123   -
124   - }
125   -
126   - arguments.callee.count++;
127   -
128   - var index = parseInt(arguments.callee.count) - 1;
129   -
130   - if (index >= len-1) {
131   -
132   - callback && callback(points);
133   -
134   - return;
135   - }
136   -
137   - // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。)
138   - var f = arguments.callee;
139   -
140   - // 起点坐标 <坐标格式:40.056878,116.30815>
141   - var origin = points[index].potion.lat + ',' + points[index].potion.lng;
142   -
143   - // 终点坐标 <坐标格式:40.056878,116.30815>
144   - var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng;
145   -
146   - var region = '上海';
147   -
148   - var origin_region = '上海';
149   -
150   - var destination_region = '上海';
151   -
152   - var output = 'json';
153   -
154   - var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk';
155   -
156   - /**
157   - * origin:起点名称或经纬度;
158   - *
159   - * destination:终点名称或经纬度;
160   - *
161   - * origin_region:起始点所在城市,驾车导航时必填。
162   - *
163   - * destination_region:终点所在城市,驾车导航时必填。
164   - *
165   - * output :表示输出类型,可设置为xml或json,默认为xml。
166   - *
167   - **/
168   - var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My};
169   -
170   - /** @description :未认证开发者默认配额为:2000次/天。 */
171   - $.ajax({
172   -
173   - // 百度地图根据坐标获取两点之间的时间与距离
174   - url: 'http://api.map.baidu.com/direction/v1?mode=transit',
175   -
176   - data: paramsB,
177   -
178   - dataType: 'jsonp',
179   -
180   - success: function(r){
181   -
182   - if(r) {
183   -
184   - if(r.message=='ok') {
185   -
186   - if(r.result.taxi==null) {
187   -
188   - // 获取距离(单位:米)
189   - points[index+1].distance = 0;
190   -
191   - // 获取时间(单位:秒)
192   - points[index+1].duration = 0;
193   -
194   - }else {
195   -
196   - // 获取距离(单位:米)
197   - points[index+1].distance = r.result.taxi.distance;
198   -
199   - // 获取时间(单位:秒)
200   - points[index+1].duration = r.result.taxi.duration;
201   -
202   - }
203   -
204   -
205   - }
206   -
207   - }
208   -
209   - f();
210   - }
211   - });
212   -
213   - })();
214   -
215   - },
216   -
217   - // 地图画多边形
218   - pointsPolygon : function(objStation) {
219   -
220   - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
221   - mapBValue.setZoom(15);
222   -
223   - // 如果不为空
224   - if(objStation) {
225   - // 获取中心点坐标字符串
226   - var testpointStr = objStation.stationBJwpoints;
227   - // 按空格切割中心点坐标字符串
228   - var BJwpointsPolygon = testpointStr.split(' ');
229   - // 中心点坐标
230   - var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]);
231   - // 获取多边形坐标字符串
232   - var stationBPolygonGrid = objStation.stationBPolygonGrid;
233   - // 截取多边形坐标字符串
234   - var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2);
235   - // 按逗号切割
236   - var pointPolygonArray = stationBPolygonGridStr.split(',');
237   - // 多边形坐标集合
238   - var polygonP = [];
239   - for(var v = 0;v<pointPolygonArray.length;v++) {
240   - polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1]));
241   - }
242   -
243   - // 画多边形
244   - polygon = new BMap.Polygon(polygonP, {
245   - // 线条显色
246   - strokeColor : "blue",
247   - // 边线的宽度,以像素为单位。
248   - strokeWeight : 2,
249   - // 边线透明度,取值范围0 - 1。
250   - strokeOpacity : 0.5
251   - });
252   -
253   - // 增加地图覆盖物多边形
254   - mapBValue.addOverlay(polygon);
255   -
256   - // 信息窗口属性
257   - var opts_polygon = {
258   - // 信息窗口宽度
259   - width : 200,
260   - // 信息窗口高度
261   - height : 300,
262   - // 信息窗位置偏移值。
263   - // offset: new BMap.Size(500,20),
264   - //标题
265   - // title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>',
266   - //设置不允许信窗发送短息
267   - enableMessage : false,
268   - //是否开启点击地图关闭信息窗口
269   - enableCloseOnClick : false
270   - };
271   -
272   - var markTypeStr = '';
273   - if(objStation.stationRouteStationMark=='B') {
274   - markTypeStr='起点站';
275   - }else if(objStation.stationRouteStationMark=='Z') {
276   - markTypeStr ='中途站';
277   - }else if(objStation.stationRouteStationMark=='E') {
278   - markTypeStr='终点站';
279   - }
280   - var point = objStation.stationBJwpoints.split(" ")
281   - var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' +
282   - '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' +
283   - '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
284   - '<span class="help-block" >站点类型:' + markTypeStr + '</span>' +
285   - '<span class="help-block" >经度:&nbsp&nbsp' + point[0] + '</span>' +
286   - '<span class="help-block" >纬度:&nbsp&nbsp' + point[1] + '</span>' +
287   - '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + '&nbsp;分钟</span>' +
288   - '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + '&nbsp;公里</span>' +
289   - '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' +
290   - '<span class="help-block" >版本号:&nbsp&nbsp' + objStation.stationRouteVersions + '</span>' +
291   - '<div style="">' +
292   - '<button style="float:left; background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn " ' +
293   - 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button>' +
294   - '<button style="float:right; background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn " ' +
295   - 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button>' +
296   - '</div>';
297   -
298   - // 创建信息窗口
299   - var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon);
300   - // 自定义标注物图片
301   - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
302   - // 创建点
303   - marker = new BMap.Marker(pointPolygon,{icon : icon_target});
304   - // 把标注添物加到地图上
305   - mapBValue.addOverlay(marker);
306   - // 是否在平移过程中禁止动画。(自1.2新增)
307   - var PanOptions_ ={noAnimation :true};
308   - // 将地图的中心点更改为给定的点。
309   - mapBValue.panTo(pointPolygon,PanOptions_);
310   - // 将地图在水平位置上移动x像素,垂直位置上移动y像素。
311   - mapBValue.panBy(10,-150,PanOptions_);
312   - //开启信息窗口
313   - mapBValue.openInfoWindow(infoWindow_target,pointPolygon);
314   - }
315   -
316   - },
317   -
318   - editPolyUpline : function() {
319   - // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)
320   - polyUpline.disableMassClear();
321   - WorldsBMap.clearMarkAndOverlays();
322   - // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)
323   - polyUpline.enableMassClear();
324   - // 开启线路编辑
325   - polyUpline.enableEditing();
326   - // 添加双击折线保存事件
327   - polyUpline.addEventListener('dblclick',function(e) {
328   - // 关闭
329   - layer.closeAll();
330   - polyUpline.disableEditing();
331   - // 获取折线坐标集合
332   - var editPloyLineArray = polyUpline.getPath();
333   - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
334   - polyUpline= '';
335   - // 加载修改路段弹出层mobal页面
336   - $.get('editsection.html', function(m){
337   - $(pjaxContainer).append(m);
338   - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]);
339   - });
340   - });
341   - },
342   -
343   - // 画圆
344   - pointsCircle : function(objStation) {
345   -
346   - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
347   - mapBValue.setZoom(16);
348   -
349   - if(objStation) {
350   -
351   - // 清除地图覆盖物
352   - mapBValue.clearOverlays();
353   -
354   - // 获取中心坐标点字符串分割
355   - var BJwpoints = objStation.stationBJwpoints.split(' ');
356   -
357   - // 中心坐标点
358   - var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
359   -
360   - //创建圆
361   - circle = new BMap.Circle(point,objStation.stationRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});
362   -
363   - // 允许覆盖物在map.clearOverlays方法中被清除
364   - circle.enableMassClear();
365   -
366   - // 百度地图添加覆盖物圆
367   - mapBValue.addOverlay(circle);
368   -
369   - // 信息窗口参数属性
370   - var opts = {
371   - // 信息窗口宽度
372   - width : 200,
373   - // 信息窗口高度
374   - height : 330,
375   - // 信息窗位置偏移值。
376   - // offset: new BMap.Size(500,120),
377   - //标题
378   - // title : '<h4 style="color:#ff8355">'+objStation.stationStationName+'站详情</h4>',
379   - //设置不允许信窗发送短息
380   - enableMessage : false,
381   - //是否开启点击地图关闭信息窗口
382   - enableCloseOnClick : false,
383   - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
384   - enableAutoPan:false
385   - };
386   -
387   - var markTypeStr = '';
388   - if(objStation.stationRouteStationMark=='B') {
389   - markTypeStr='起点站';
390   - }else if(objStation.stationRouteStationMark=='Z') {
391   - markTypeStr ='中途站';
392   - }else if(objStation.stationRouteStationMark=='E') {
393   - markTypeStr='终点站';
394   - }
395   - var point1 = objStation.stationBJwpoints.split(" ");
396   - var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' +
397   - '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' +
398   - '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
399   - '<span class="help-block" >站点类型:' + markTypeStr + '</span>' +
400   - '<span class="help-block" >经度:&nbsp&nbsp' + point1[0] + '</span>' +
401   - '<span class="help-block" >纬度:&nbsp&nbsp' + point1[1] + '</span>' +
402   - '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + '&nbsp;分钟</span>' +
403   - '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + '&nbsp;公里</span>' +
404   - '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' +
405   - '<span class="help-block" >半径&nbsp&nbsp:' + objStation.stationRadius + '</span>' +
406   - '<span class="help-block" >版本号&nbsp&nbsp:' + objStation.stationRouteVersions + '</span>' +
407   - '<div style="">' +
408   - '<button style="float:left; background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn " ' +
409   - 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button>' +
410   - '<button style="float:right; background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn " ' +
411   - 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button>' +
412   - '</div>';
413   -
414   - // 创建信息窗口
415   - var infoWindow_target = new BMap.InfoWindow(htm, opts);
416   - // 自定义标注物图片
417   - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
418   -
419   - // 创建点
420   - marker = new BMap.Marker(point,{icon : icon_target});
421   -
422   - // 把标注添物加到地图上
423   - mapBValue.addOverlay(marker);
424   -
425   - setTimeout(function(){
426   - //开启信息窗口
427   - marker.openInfoWindow(infoWindow_target,point);
428   -
429   - },100);
430   -
431   - // 是否在平移过程中禁止动画。(自1.2新增)
432   - var PanOptions_ ={noAnimation :true};
433   -
434   - // 将地图的中心点更改为给定的点。
435   - mapBValue.panTo(point,PanOptions_);
436   -
437   - mapBValue.panBy(10,-200,PanOptions_);
438   -
439   - // 添加标志物监听事件
440   - marker.addEventListener("click",function() {
441   -
442   - //开启信息窗口
443   - marker.openInfoWindow(infoWindow_target,point);
444   -
445   - });
446   -
447   - }
448   -
449   - },
450   -
451   - // 根据地理名称获取百度经纬度坐标
452   - localSearchFromAdreesToPoint: function(Address,callback) {
453   -
454   - // 创建一个搜索类实例
455   - var localSearch = new BMap.LocalSearch(mapBValue);
456   -
457   - // 检索完成后的回调函数。
458   - localSearch.setSearchCompleteCallback(function (searchResult) {
459   -
460   - var resultPoints = '';
461   -
462   - if(searchResult) {
463   -
464   - // 返回索引指定的结果。索引0表示第1条结果
465   - var poi = searchResult.getPoi(0);
466   -
467   - if(poi) {
468   -
469   - //获取经度和纬度
470   - resultPoints = poi.point.lng + ' ' + poi.point.lat;
471   -
472   - callback && callback(resultPoints);
473   -
474   - }else {
475   -
476   - callback && callback(false);
477   -
478   - }
479   -
480   - }else {
481   -
482   - callback && callback(false);
483   - }
484   -
485   - });
486   -
487   - // 根据检索词发起检索。
488   - localSearch.search(Address);
489   -
490   - },
491   -
492   - // 编辑图形
493   - editShapes : function(editStationName,stationShapesTypeV,mindex) {
494   - // 关闭信息窗口
495   - marker.closeInfoWindow();
496   -
497   - // 清除marker
498   - mapBValue.removeOverlay(marker);
499   -
500   - // 编辑圆
501   - if(stationShapesTypeV =='r') {
502   -
503   - // 开启编辑功能
504   - circle.enableEditing();
505   -
506   - // 编辑圆监听事件
507   - circle.addEventListener('dblclick',function() {
508   -
509   - // 关闭提示弹出层
510   - layer.close(mindex);
511   -
512   - // 返回圆形的半径,单位为米。
513   - var newRadius = circle.getRadius();
514   -
515   - // 返回圆形的中心点坐标。
516   - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat;
517   -
518   - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}];
519   -
520   - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
521   - EditStationObj.setEitdStationBJwpoints(newCenter);
522   -
523   - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
524   - EditStationObj.setEitdStationShapesType('r');
525   -
526   - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
527   - EditStationObj.setEitdStationRadius(Math.round(newRadius));
528   -
529   - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
530   - EditStationObj.setEitdBPolygonGrid('');
531   -
532   - // 加载编辑页面
533   - $.get('edit.html', function(m){
534   -
535   - $(pjaxContainer).append(m);
536   -
537   - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]);
538   -
539   - });
540   -
541   - });
542   -
543   - // 编辑多变行
544   - }else if(stationShapesTypeV =='d') {
545   -
546   - // 开启编辑功能(自 1.1 新增)
547   - polygon.enableEditing();
548   -
549   - // 添加多变行编辑事件
550   - polygon.addEventListener('dblclick',function(e) {
551   -
552   - // 获取编辑的多边形对象
553   - var edit_pointE = polygon;
554   -
555   - var edit_bPloygonGrid = "";
556   -
557   - var editPolyGonLen_ = edit_pointE.getPath().length;
558   -
559   - for(var k =0;k<editPolyGonLen_;k++) {
560   -
561   - if(k==0) {
562   -
563   - edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
564   -
565   - }else {
566   -
567   - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
568   -
569   - }
570   -
571   - }
572   -
573   - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat;
574   -
575   - // 多边形中心点
576   - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
577   -
578   - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
579   - EditStationObj.setEitdStationBJwpoints(centre_points);
580   -
581   - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
582   - EditStationObj.setEitdStationShapesType('d');
583   -
584   - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
585   - EditStationObj.setEitdStationRadius('');
586   -
587   - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
588   - EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid);
589   -
590   - $.get('edit.html', function(m){
591   -
592   - $(pjaxContainer).append(m);
593   -
594   - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]);
595   -
596   - });
597   -
598   - });
599   -
600   - }
601   -
602   - },
603   -
604   - // 在地图上画出上行线路走向
605   - drawingUpline : function (polylineArray,polyline_center,data) {
606   - /*WorldsBMap.clearMarkAndOverlays();*/
607   - polyUpline = '';
608   - // 创建线路走向
609   - polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
610   - // polyUpline.data = data;
611   - // 把折线添加到地图上
612   - mapBValue.addOverlay(polyUpline);
613   - /*var ceter_index = Math.round(resultdata.length / 2);
614   -
615   - var ceterPointsStr = resultdata[ceter_index].bJwpoints;
616   -
617   - var ceterPointsArray = ceterPointsStr.split(' ');
618   -
619   - var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*/
620   - var PanOptions_ ={noAnimation :true};
621   - mapBValue.reset();
622   - mapBValue.panTo(polyline_center,PanOptions_);
623   - mapBValue.panBy(500,-510,PanOptions_);
624   - mapBValue.setZoom(14);
625   -
626   - // 信息窗口属性
627   - var opts_polygon = {
  26 +
  27 + /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆; road_win_show_p:信息窗口打开状态的路段,map_status:地图编辑状态,drawingManager:绘画工具*/
  28 + var mapBValue = '',polygon = '', polyUpline = '', circle = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', sectionArray = [], stationArray = new Map(),map_status = 0,
  29 + drawingManager;
  30 + var styleOptions = {
  31 + strokeColor:"blue", //边线颜色。
  32 + fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。
  33 + strokeWeight: 6, //边线的宽度,以像素为单位。
  34 + strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。
  35 + fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
  36 + strokeStyle: 'solid' //边线的样式,solid或dashed。
  37 + }
  38 +
  39 + var Bmap = {
  40 +
  41 + init: function () {
  42 + // 设置中心点,
  43 + var CENTER_POINT = {lng: 121.528733, lat: 31.237425};
  44 + // 百度API Key
  45 + var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
  46 + // 初始化百度地图
  47 + mapBValue = new BMap.Map("bmap_basic");
  48 + //中心点和缩放级别
  49 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15);
  50 + //启用地图拖拽事件,默认启用(可不写)
  51 + mapBValue.enableDragging();
  52 + //启用地图滚轮放大缩小
  53 + mapBValue.enableScrollWheelZoom();
  54 + //禁用鼠标双击放大
  55 + mapBValue.disableDoubleClickZoom();
  56 + //启用键盘上下左右键移动地图
  57 + mapBValue.enableKeyboard();
  58 + return mapBValue;
  59 + },
  60 +
  61 + /** 获取地图对象 @return 地图对象map */
  62 + getmapBValue: function () {
  63 + return mapBValue;
  64 + },
  65 + getPolygon: function () {
  66 + return polygon;
  67 + },
  68 + getPolyUpline: function () {
  69 + return polyUpline;
  70 + },
  71 + getCircle: function () {
  72 + return circle;
  73 + },
  74 + getIsEditStatus: function () {
  75 + return iseditStatus;
  76 + },
  77 + setMap_status : function (i) {
  78 + map_status = i;
  79 + },
  80 + setIsEditStatus: function (v) {
  81 + iseditStatus = v;
  82 + },
  83 + /*initDrawingManager: function (map, styleOptions) {
  84 + },*/
  85 + getDrawingManagerObj: function () {
  86 + return drawingManagerInitV;
  87 + },
  88 +
  89 + // 从百度地图抓去站点与路段数据
  90 + lineInfoPanl: function (lineNameValue, i, cb) {
  91 +
  92 + /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */
  93 + WorldsBMap.getBmapStationNames(lineNameValue, i, function (BusLine) {
  94 +
  95 + return cb && cb(BusLine);
  96 +
  97 + });
  98 +
  99 + },
  100 +
  101 + /** 获取距离与时间 @param <points:坐标点集合> */
  102 + getDistanceAndDuration: function (points, callback) {
  103 +
  104 + // 获取长度
  105 + var len = points.length;
  106 +
  107 + (function () {
  108 +
  109 + if (!arguments.callee.count) {
  110 +
  111 + arguments.callee.count = 0;
  112 +
  113 + }
  114 +
  115 + arguments.callee.count++;
  116 +
  117 + var index = parseInt(arguments.callee.count) - 1;
  118 +
  119 + if (index >= len - 1) {
  120 +
  121 + callback && callback(points);
  122 +
  123 + return;
  124 + }
  125 +
  126 + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。)
  127 + var f = arguments.callee;
  128 +
  129 + // 起点坐标 <坐标格式:40.056878,116.30815>
  130 + var origin = points[index].potion.lat + ',' + points[index].potion.lng;
  131 +
  132 + // 终点坐标 <坐标格式:40.056878,116.30815>
  133 + var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng;
  134 +
  135 + var region = '上海';
  136 +
  137 + var origin_region = '上海';
  138 +
  139 + var destination_region = '上海';
  140 +
  141 + var output = 'json';
  142 +
  143 + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk';
  144 +
  145 + /**
  146 + * origin:起点名称或经纬度;
  147 + *
  148 + * destination:终点名称或经纬度;
  149 + *
  150 + * origin_region:起始点所在城市,驾车导航时必填。
  151 + *
  152 + * destination_region:终点所在城市,驾车导航时必填。
  153 + *
  154 + * output :表示输出类型,可设置为xml或json,默认为xml。
  155 + *
  156 + **/
  157 + var paramsB = {
  158 + origin: origin,
  159 + destination: destination,
  160 + region: region,
  161 + origin_region: origin_region,
  162 + destination_region: destination_region,
  163 + output: output,
  164 + ak: ak_My
  165 + };
  166 +
  167 + /** @description :未认证开发者默认配额为:2000次/天。 */
  168 + $.ajax({
  169 +
  170 + // 百度地图根据坐标获取两点之间的时间与距离
  171 + url: 'http://api.map.baidu.com/direction/v1?mode=transit',
  172 +
  173 + data: paramsB,
  174 +
  175 + dataType: 'jsonp',
  176 +
  177 + success: function (r) {
  178 +
  179 + if (r) {
  180 +
  181 + if (r.message == 'ok') {
  182 +
  183 + if (r.result.taxi == null) {
  184 +
  185 + // 获取距离(单位:米)
  186 + points[index + 1].distance = 0;
  187 +
  188 + // 获取时间(单位:秒)
  189 + points[index + 1].duration = 0;
  190 +
  191 + } else {
  192 +
  193 + // 获取距离(单位:米)
  194 + points[index + 1].distance = r.result.taxi.distance;
  195 +
  196 + // 获取时间(单位:秒)
  197 + points[index + 1].duration = r.result.taxi.duration;
  198 +
  199 + }
  200 +
  201 +
  202 + }
  203 +
  204 + }
  205 +
  206 + f();
  207 + }
  208 + });
  209 +
  210 + })();
  211 +
  212 + },
  213 + // 打开站点信息窗口
  214 + openStationInfoWin : function (objStation) {
  215 + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
  216 + mapBValue.setZoom(25);
  217 + if (objStation) {
  218 + // 站点形状
  219 + var shapes = objStation.stationShapesType;
  220 + // 获取中心坐标点字符串分割
  221 + var BJwpoints = objStation.stationJwpoints.split(' ');
  222 +
  223 + // 中心坐标点
  224 + var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
  225 + var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11;
  226 + // 信息窗口参数属性
  227 + var opts = {
628 228 // 信息窗口宽度
629   - width : 200,
  229 + width: (width < 200 ? 200 : width),
630 230 // 信息窗口高度
631   - height : 300,
  231 + height: shapes=="r" ?330:300,
632 232 // 信息窗位置偏移值。
633   - // offset: new BMap.Size(500,20),
634   - //标题
635   - // title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>',
  233 + offset: new BMap.Size(10,-20),
636 234 //设置不允许信窗发送短息
637   - enableMessage : false,
  235 + enableMessage: false,
638 236 //是否开启点击地图关闭信息窗口
639   - enableCloseOnClick : false
  237 + enableCloseOnClick: false,
  238 + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
  239 + enableAutoPan: false
640 240 };
641 241  
642   - // var markTypeStr = '';
643   - // if(objStation.stationRouteStationMark=='B') {
644   - // markTypeStr='起点站';
645   - // }else if(objStation.stationRouteStationMark=='Z') {
646   - // markTypeStr ='中途站';
647   - // }else if(objStation.stationRouteStationMark=='E') {
648   - // markTypeStr='终点站';
649   - // }
650   - // var point = objStation.stationBJwpoints.split(" ")
651   - // var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' +
652   - // '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' +
653   - // '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
654   - // '<span class="help-block" >站点类型:' + markTypeStr + '</span>' +
655   - // '<span class="help-block" >经度:&nbsp&nbsp' + point[0] + '</span>' +
656   - // '<span class="help-block" >纬度:&nbsp&nbsp' + point[1] + '</span>' +
657   - // '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + '&nbsp;分钟</span>' +
658   - // '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + '&nbsp;公里</span>' +
659   - // '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' +
660   - // '<span class="help-block" >版本号:&nbsp&nbsp' + objStation.stationRouteVersions + '</span>' +
661   - // '<div style="display: flex">' +
662   - // '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' +
663   - // 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button></span>' +
664   - // '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' +
665   - // 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button></span>' +
666   - // '</div>';
667   - //
668   - // // 创建信息窗口
669   - // var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon);
670   - // // 自定义标注物图片
671   - // var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
672   - // // 创建点
673   - // marker = new BMap.Marker(pointPolygon,{icon : icon_target});
674   - // // 把标注添物加到地图上
675   - // mapBValue.addOverlay(marker);
676   - // // 是否在平移过程中禁止动画。(自1.2新增)
677   - // var PanOptions_ ={noAnimation :true};
678   - // // 将地图的中心点更改为给定的点。
679   - // mapBValue.panTo(pointPolygon,PanOptions_);
680   - // // 将地图在水平位置上移动x像素,垂直位置上移动y像素。
681   - // mapBValue.panBy(10,-150,PanOptions_);
682   - // //开启信息窗口
683   - // mapBValue.openInfoWindow(infoWindow_target,pointPolygon);
684   - },
685   -
686   -
687   - // 在地图上画出上行线路走向
688   - drawingUpline01 : function (polylineArray,polyline_center,data) {
689   - var polyUpline01 = 'polyline' + '_' + data.sectionrouteId;
690   - // 创建线路走向
691   - polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
692   - polyUpline01.data = data;
693   - // 把折线添加到地图上
694   - mapBValue.addOverlay(polyUpline01);
695   - polyUpline01.addEventListener('click',function(e) {
696   - if(WorldsBMap.getIsEditStatus()) {
697   - layer.msg('请先保存正在编辑的路段信息...');
698   - return false;
699   - }
700   - polyUpline01.enableEditing();
701   - WorldsBMap.setIsEditStatus(true);
702   - });
703   - // 添加双击折线保存事件
704   - polyUpline01.addEventListener('dblclick',function(e) {
705   - WorldsBMap.setIsEditStatus(false);
706   - // 关闭
707   - layer.closeAll();
708   - polyUpline01.disableEditing();
709   - EditSectionObj.setEitdSection(polyUpline01.data);
710   - // 获取折线坐标集合
711   - var editPloyLineArray = polyUpline01.getPath();
712   - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
713   - // polyUpline= '';
714   - // 加载修改路段弹出层mobal页面
715   - $.get('editsection.html', function(m){
716   - $(pjaxContainer).append(m);
717   - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]);
718   - });
719   - });
720   - var PanOptions_ ={noAnimation :true};
721   - mapBValue.reset();
722   - mapBValue.panTo(polyline_center,PanOptions_);
723   - mapBValue.panBy(500,-510,PanOptions_);
724   - mapBValue.setZoom(14);
725   - },
726   -
727   - /** 在地图上画点 @param:<point_center:中心坐标点> */
728   - drawingUpStationPoint : function(point_center,stationName,s) {
729   -
730   - // 自定义标注物图片
731   - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10));
732   -
733   - var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
734   - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
735   - + '</div>'
736   - + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>';
737   -
738   -
739   - var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{
740   - "anchor" : new BMap.Size(-10,8),
741   - "enableDragging" : true});
742   -
743   -
744   - myRichMarker1.disableDragging();
745   - mapBValue.addOverlay(myRichMarker1);
746   -
747   -
748   - // 创建标注物
749   - marker = new BMap.Marker(point_center,{icon : icon_target});
750   -
751   - // 允许覆盖物在map.clearOverlays方法中被清除。
752   - marker.enableMassClear();
753   -
754   - mapBValue.addOverlay(marker);
755   - },
756   -
757   - // 站点名称获取百度坐标(手动规划)
758   - stationsNameToPoints : function(arra,callback) {
759   - // 获取长度
760   - var len = arra.length;
761   - var stationList = [];
762   - (function(){
763   - if (!arguments.callee.count) {
764   - arguments.callee.count = 0;
765   - }
766   - arguments.callee.count++;
767   - var index = parseInt(arguments.callee.count) - 1;
768   - if (index >= len) {
769   - callback && callback(stationList);
770   - return ;
771   - }
772   - var f = arguments.callee;
773   - if(arra[index].name!=''){
774   - var localSearch = new BMap.LocalSearch(mapBValue);
775   - localSearch.search(arra[index].name);
776   - localSearch.setSearchCompleteCallback(function (searchResult) {
777   - var poi = searchResult.getPoi(0);
778   - if(poi) {
779   - stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:poi.point.lng,lat:poi.point.lat}});
780   - }else {
781   - stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:arra[index].wgs.x,lat:arra[index].wgs.y}});
782   - }
783   - f();
784   - });
785   - }else {
786   - f();
787   - }
788   - })();
789   - },
790   -
791   - // 根据坐标点获取两点之间的时间与距离(手动规划)
792   - getDistanceAndTotime : function(stationList,cb) {
793   -
794   - stationList[0].distance = '';
795   -
796   - stationList[0].duration = '';
797   -
798   - // var sectionList = [];
799   -
800   - // 获取长度
801   - var len = stationList.length;
802   -
803   - (function(){
804   -
805   - if (!arguments.callee.count) {
806   -
807   - arguments.callee.count = 0;
808   -
809   - }
810   -
811   - arguments.callee.count++;
812   -
813   - var index = parseInt(arguments.callee.count) - 1;
814   -
815   - if (index >= len-1) {
816   -
817   - // cb && cb(stationList,sectionList);
818   - cb && cb(stationList);
819   - return;
820   - }
821   -
822   - var f = arguments.callee;
823   -
824   - var poiOne = new BMap.Point(stationList[index].potion.lng,stationList[index].potion.lat);
825   -
826   - var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat);
827   -
828   - var transit = new BMap.TransitRoute(mapBValue, {renderOptions: {map: mapBValue},onSearchComplete: searchComplete});
829   -
830   - transit.search(poiOne,poiTwo);
831   -
832   - function searchComplete(results){
833   -
834   - var plan = results.getPlan(0);
835   -
836   - if (transit.getStatus() != BMAP_STATUS_SUCCESS){
837   -
838   - stationList[index+1].distance = '';
839   -
840   - stationList[index+1].duration = '';
841   -
842   - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''});
843   -
844   - }else {
845   -
846   - stationList[index+1].distance = plan.getDistance(true);
847   -
848   - stationList[index+1].duration = plan.getDuration(true);
849   -
850   - // var line = plan.getRoute(0);
851   -
852   - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()});
853   -
854   - }
855   -
856   - f();
857   - }
858   -
859   - })();
860   -
861   - },
862   -
863   - // 根据坐标点获取两点之间的折线路段(手动规划)
864   - getSectionListPlonly : function(stationsPoint,cb) {
865   -
866   - var len = stationsPoint.length;
867   -
868   - var sectionList = [];
869   -
870   - (function(){
871   -
872   - if (!arguments.callee.count) {
873   -
874   - arguments.callee.count = 0;
875   -
876   - }
877   -
878   - arguments.callee.count++;
879   -
880   - var index = parseInt(arguments.callee.count) - 1;
881   -
882   - if (index >= len-1 ) {
883   -
884   - cb && cb(sectionList);
885   - return;
886   - }
887   -
888   - var f = arguments.callee;
889   -
890   - var poiOne = new BMap.Point(stationsPoint[index].potion.lng,stationsPoint[index].potion.lat);
891   -
892   - var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat);
893   -
894   - /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/
895   -
896   - var transit = new BMap.DrivingRoute(mapBValue, {renderOptions: {map: mapBValue},onPolylinesSet: searchPolylinesSet});
897   -
898   - function searchPolylinesSet(results){
899   -
900   - if (transit.getStatus() != BMAP_STATUS_SUCCESS){
901   -
902   -
903   - }else {
904   -
905   - var sectionArrayList = [];
906   - for (i = 0; i < results.length; i++){
907   -
908   - // console.log(results[i].getPolyline().getPath());
909   - sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
910   -
911   - }
912   -
913   - var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name;
914   -
915   - sectionList.push({sectionName:sectionName,points:sectionArrayList});
916   -
917   - }
918   -
919   - f();
920   - }
921   -
922   - transit.search(poiOne,poiTwo);
923   -
924   - })();
925   -
926   - },
927   -
928   - localtionPoint : function(stationNameV) {
929   -
930   - WorldsBMap.localSearchFromAdreesToPoint(stationNameV,function(Points) {
931   -
932   - if(Points) {
933   -
934   - var BJwpointsArray = Points.split(' ');
935   -
936   - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]);
937   -
938   - var marker_stargt2 = new BMap.Marker(stationNameChangePoint);
939   -
940   - var PanOptions ={noAnimation :true};
941   -
942   - mapBValue.panTo(stationNameChangePoint,PanOptions);
943   -
944   - mapBValue.panBy(0,-100);
945   -
946   - // 将标注添加到地图中
947   - mapBValue.addOverlay(marker_stargt2);
948   -
949   - //跳动的动画
950   - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);
951   -
952   - }
953   -
954   - });
955   -
956   - },
957   -
958   - /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/
959   - getBmapStationNames : function(lineNameValue,i,callback) {
960   -
961   - var busline = new BMap.BusLineSearch(mapBValue,{
962   -
963   - // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
964   - onGetBusListComplete:function(BusListResult) {
965   -
966   - // 如果不为空
967   - if(BusListResult){
968   -
969   - //获取第一个公交列表显示到map上
970   - var fstLine = BusListResult.getBusListItem(i);
971   -
972   - /*if(fstLine==undefined){
973   -
974   - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
975   -
976   - layer.closeAll();
977   -
978   - if(i==0){
979   -
980   - $('#upToolsMobal').show();
981   -
982   - }else if(i==1){
983   -
984   - $('#downToolsMobal').show();
985   -
986   - }
987   -
988   - return;
989   - });
990   -
991   - }*/
992   -
993   - if(fstLine==undefined){
994   -
995   -
996   - callback && callback(null);
997   -
998   - }
999   -
1000   - busline.getBusLine(fstLine);
1001   -
1002   - }
1003   -
1004   - },
1005   -
1006   - //设置公交线路查询后的回调函数.参数:rs: BusLine类型
1007   - onGetBusLineComplete: function(BusLine){
1008   -
1009   - // 如果不为空
1010   - if(BusLine){
1011   -
1012   - callback && callback(BusLine);
1013   -
1014   - }
1015   -
1016   - }
1017   -
1018   - });
1019   -
1020   - busline.getBusList(lineNameValue);
1021   -
1022   - },
1023   - editStation : function(dir) {
1024   - // $.get("/stationroute/findStationRouteInfo",{"id":stationRouteId},function (route) {
1025   - $.get('edit_select.html', function(m){
  242 + var markTypeStr = '';
  243 + if (objStation.stationRouteStationMark == 'B') {
  244 + markTypeStr = '起点站';
  245 + } else if (objStation.stationRouteStationMark == 'Z') {
  246 + markTypeStr = '中途站';
  247 + } else if (objStation.stationRouteStationMark == 'E') {
  248 + markTypeStr = '终点站';
  249 + }
  250 + var htm = '<span style="color: #ff8355;font-size: 20px; overflow: hidden; white-space: nowrap; text-overflow:ellipsis;display: -webkit-box; -webkit-box-orient: vertical;">' + objStation.stationRouteName + '</span>' +
  251 + '<span class="help-block" >站点编码:' + objStation.stationCode + '</span>' +
  252 + '<span class="help-block" >站点序号:' + objStation.stationRouteCode + '</span>' +
  253 + '<span class="help-block" >站点类型:' + markTypeStr + '</span>' +
  254 + '<span class="help-block" >经度:&nbsp&nbsp' + BJwpoints[0] + '</span>' +
  255 + '<span class="help-block" >纬度:&nbsp&nbsp' + BJwpoints[1] + '</span>' +
  256 + '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + '&nbsp;分钟</span>' +
  257 + '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + '&nbsp;公里</span>' +
  258 + '<span class="help-block" >缓冲区形状:' + (shapes == "r" ? "圆形" : "多边形") + '</span>' +
  259 + (shapes=="r" ? ("<span class='help-block' >半径&nbsp&nbsp:" + objStation.stationRadius + "</span>") : " ")+
  260 + '<span class="help-block" >版本号&nbsp&nbsp:' + objStation.stationRouteVersions + '</span>' +
  261 + '<div>' +
  262 + '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editStation(' + objStation.stationRouteId+','+objStation.stationRoutedirections + ')">修改</button>' +
  263 + '<button class="info_win_btn" onclick="WorldsBMap.destroyStation('+ objStation.stationRouteId + ','+objStation.stationRouteLine+','+objStation.stationRoutedirections+')">撤销</button>' +
  264 + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad(' + objStation.stationRouteId + ')">添加站点间路段</button>' +
  265 + '</div>';
  266 +
  267 + // 创建信息窗口
  268 + var infoWindow_target = new BMap.InfoWindow(htm, opts);
  269 + setTimeout(function () {
  270 + //开启信息窗口
  271 + mapBValue.openInfoWindow(infoWindow_target, point);
  272 + }, 100);
  273 + // 是否在平移过程中禁止动画。(自1.2新增)
  274 + var PanOptions_ = {noAnimation: true};
  275 + // 将地图的中心点更改为给定的点。
  276 + mapBValue.panTo(point, PanOptions_);
  277 + // mapBValue.panBy(10, -150, PanOptions_);
  278 + }
  279 + },
  280 +
  281 + editPolyUpline: function () {
  282 + // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)
  283 + polyUpline.disableMassClear();
  284 + WorldsBMap.clearMarkAndOverlays();
  285 + // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)
  286 + polyUpline.enableMassClear();
  287 + // 开启线路编辑
  288 + polyUpline.enableEditing();
  289 + // 添加双击折线保存事件
  290 + polyUpline.addEventListener('dblclick', function (e) {
  291 + // 关闭
  292 + layer.closeAll();
  293 + polyUpline.disableEditing();
  294 + // 获取折线坐标集合
  295 + var editPloyLineArray = polyUpline.getPath();
  296 + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
  297 + polyUpline = '';
  298 + // 加载修改路段弹出层mobal页面
  299 + $.get('editsection.html', function (m) {
  300 + $(pjaxContainer).append(m);
  301 + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap, GetAjaxData, EditSectionObj, PublicFunctions]);
  302 + });
  303 + });
  304 + },
  305 +
  306 + // 根据地理名称获取百度经纬度坐标
  307 + localSearchFromAdreesToPoint: function (Address, callback) {
  308 +
  309 + // 创建一个搜索类实例
  310 + var localSearch = new BMap.LocalSearch(mapBValue);
  311 +
  312 + // 检索完成后的回调函数。
  313 + localSearch.setSearchCompleteCallback(function (searchResult) {
  314 +
  315 + var resultPoints = '';
  316 +
  317 + if (searchResult) {
  318 +
  319 + // 返回索引指定的结果。索引0表示第1条结果
  320 + var poi = searchResult.getPoi(0);
  321 +
  322 + if (poi) {
  323 +
  324 + //获取经度和纬度
  325 + resultPoints = poi.point.lng + ' ' + poi.point.lat;
  326 +
  327 + callback && callback(resultPoints);
  328 +
  329 + } else {
  330 +
  331 + callback && callback(false);
  332 +
  333 + }
  334 +
  335 + } else {
  336 +
  337 + callback && callback(false);
  338 + }
  339 +
  340 + });
  341 +
  342 + // 根据检索词发起检索。
  343 + localSearch.search(Address);
  344 +
  345 + },
  346 +
  347 + // 编辑图形
  348 + editShapes: function (obj) {
  349 + // 关闭信息窗口
  350 + mapBValue.closeInfoWindow();
  351 +
  352 + // 清除marker
  353 + // mapBValue.removeOverlay(marker);
  354 + var station = obj.getEitdStation();
  355 + var stationShapesTypeV = station.stationShapesType;
  356 + // 编辑圆
  357 + if (stationShapesTypeV == 'r') {
  358 +
  359 + // 获取中心坐标点字符串分割
  360 + var BJwpoints = station.stationJwpoints.split(' ');
  361 + // 中心坐标点
  362 + var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
  363 + //创建圆
  364 + circle = new BMap.Circle(point, station.stationRadius, {
  365 + strokeColor: "red",
  366 + strokeWeight: 2,
  367 + strokeOpacity: 0.7
  368 + });
  369 + // 允许覆盖物在map.clearOverlays方法中被清除
  370 + circle.enableMassClear();
  371 + // 百度地图添加覆盖物圆
  372 + mapBValue.addOverlay(circle);
  373 + // 开启编辑功能
  374 + circle.enableEditing();
  375 + // 编辑圆监听事件
  376 + circle.addEventListener('dblclick', function () {
  377 + // 返回圆形的半径,单位为米。
  378 + var newRadius = circle.getRadius();
  379 + // 返回圆形的中心点坐标。
  380 + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat;
  381 + var centre_New = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}];
  382 + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  383 + EditStationObj.setEitdStationJwpoints(newCenter);
  384 + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  385 + EditStationObj.setEitdStationShapesType('r');
  386 + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  387 + EditStationObj.setEitdStationRadius(Math.round(newRadius));
  388 + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  389 + EditStationObj.setEitdBPolygonGrid('');
  390 + // 加载编辑页面
  391 + $.get('edit.html', function (m) {
1026 392 $(pjaxContainer).append(m);
1027   - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,dir]);
  393 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]);
1028 394 });
1029   - // });
1030   - },
1031   - addBetweenStationRoad : function (stationRouteId) {
1032   - $.get("/stationroute/findStationRouteInfo",{"id":stationRouteId},function (route) {
1033   - var stationRouteBegin = route[0];
1034   - // 查询下一个站点
1035   - $.get("/stationroute/findDownStationRoute",{"lineId":stationRouteBegin.stationRouteLine, "direction":stationRouteBegin.stationRoutedirections, "stationRouteCode":stationRouteBegin.stationRouteCode},function (stationRoute) {
1036   - var stationRouteFinish = stationRoute[0];
1037   -
1038   - if(stationRouteFinish){
1039   - var pointBegin = stationRouteBegin.stationJwpoints.split(" ");
1040   - var pointFinish = stationRouteFinish.stationJwpoints.split(" ")
1041   - console.log(pointFinish);
1042   - var sectionList = [];
1043   - // 两个站点的坐标
1044   - var poiOne = new BMap.Point(pointBegin[0],pointBegin[1]);
1045   - var poiTwo = new BMap.Point(pointFinish[0],pointFinish[1]);
1046   - // 路径规划保存按钮
1047   - var label = new BMap.Label("保存路段", {
1048   - offset: new BMap.Size(13, -53)
  395 + });
  396 +
  397 + // 编辑多变行
  398 + } else if (stationShapesTypeV == 'd') {
  399 + // 获取中心点坐标字符串
  400 + var testpointStr = station.stationJwpoints;
  401 + // 按空格切割中心点坐标字符串
  402 + var BJwpointsPolygon = testpointStr.split(' ');
  403 + // 中心点坐标
  404 + var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]);
  405 + // 获取多边形坐标字符串
  406 + var stationBPolygonGrid = station.stationBPolyonGrid;
  407 + // 截取多边形坐标字符串
  408 + var stationBPolygonGridStr = stationBPolygonGrid.substring(9, stationBPolygonGrid.length - 2);
  409 + // 按逗号切割
  410 + var pointPolygonArray = stationBPolygonGridStr.split(',');
  411 + // 多边形坐标集合
  412 + var polygonP = [];
  413 + for (var v = 0; v < pointPolygonArray.length; v++) {
  414 + polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0], pointPolygonArray[v].split(" ")[1]));
  415 + }
  416 +
  417 + // 画多边形
  418 + polygon = new BMap.Polygon(polygonP, {
  419 + // 线条显色
  420 + strokeColor: "red",
  421 + // 边线的宽度,以像素为单位。
  422 + strokeWeight: 2,
  423 + // 边线透明度,取值范围0 - 1。
  424 + strokeOpacity: 0.7
  425 + });
  426 +
  427 + // 增加地图覆盖物多边形
  428 + mapBValue.addOverlay(polygon);
  429 +
  430 + // 开启编辑功能(自 1.1 新增)
  431 + polygon.enableEditing();
  432 +
  433 + // 添加多变行编辑事件
  434 + polygon.addEventListener('dblclick', function (e) {
  435 +
  436 + // 获取编辑的多边形对象
  437 + var edit_pointE = polygon;
  438 +
  439 + var edit_bPloygonGrid = "";
  440 +
  441 + var editPolyGonLen_ = edit_pointE.getPath().length;
  442 +
  443 + for (var k = 0; k < editPolyGonLen_; k++) {
  444 +
  445 + if (k == 0) {
  446 +
  447 + edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
  448 +
  449 + } else {
  450 +
  451 + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
  452 +
  453 + }
  454 +
  455 + }
  456 +
  457 + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat;
  458 +
  459 + // 多边形中心点
  460 + var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
  461 +
  462 + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  463 + EditStationObj.setEitdStationJwpoints(centre_points);
  464 +
  465 + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  466 + EditStationObj.setEitdStationShapesType('d');
  467 +
  468 + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  469 + EditStationObj.setEitdStationRadius('');
  470 +
  471 + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  472 + EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid);
  473 +
  474 + $.get('edit.html', function (m) {
  475 +
  476 + $(pjaxContainer).append(m);
  477 +
  478 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]);
  479 +
  480 + });
  481 +
  482 + });
  483 +
  484 + }
  485 +
  486 + },
  487 +
  488 + // 在地图上画出上行线路走向
  489 + /*drawingUpline: function (polylineArray, polyline_center, data) {
  490 + /!*WorldsBMap.clearMarkAndOverlays();*!/
  491 + polyUpline = '';
  492 + // 创建线路走向
  493 + polyUpline = new BMap.Polyline(polylineArray, {strokeColor: "red", strokeWeight: 6, strokeOpacity: 0.7});
  494 + // polyUpline.data = data;
  495 + // 把折线添加到地图上
  496 + mapBValue.addOverlay(polyUpline);
  497 + /!*var ceter_index = Math.round(resultdata.length / 2);
  498 +
  499 + var ceterPointsStr = resultdata[ceter_index].bJwpoints;
  500 +
  501 + var ceterPointsArray = ceterPointsStr.split(' ');
  502 +
  503 + var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*!/
  504 + var PanOptions_ = {noAnimation: true};
  505 + mapBValue.reset();
  506 + mapBValue.panTo(polyline_center, PanOptions_);
  507 + mapBValue.panBy(500, -510, PanOptions_);
  508 + mapBValue.setZoom(14);
  509 + },*/
  510 +
  511 +
  512 + // 画路段走向
  513 + drawingUpline01: function (polyline_center, datas) {
  514 + if (polyline_center && datas) {
  515 + // 编辑路段数据
  516 + sectionArray = [];
  517 + for (var d = 0; d < datas.length; d++) {
  518 + var data = datas[d];
  519 + // 地图折线坐标点集合
  520 + var polylineArray = [];
  521 + // 获取路段折线坐标字符串
  522 + var sectionBsectionVectorStr = data.sectionBsectionVector;
  523 + if (sectionBsectionVectorStr == null)
  524 + continue;
  525 + // 切割段折线坐标字符串
  526 + var tempStr = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1);
  527 + // 分割折线坐标字符串
  528 + var lineArray = tempStr.split(',');
  529 + for (var i = 0; i < lineArray.length; i++) {
  530 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  531 + }
  532 + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId;
  533 + // 创建线路走向
  534 + polyUpline01 = new BMap.Polyline(polylineArray, {
  535 + strokeColor: "red",
  536 + strokeWeight: 6,
  537 + strokeOpacity: 0.7
  538 + });
  539 + polyUpline01.data = data;
  540 + polyUpline01.ct_source = '1';
  541 + // 把折线添加到地图上
  542 + mapBValue.addOverlay(polyUpline01);
  543 + // 聚焦事件
  544 + polyUpline01.addEventListener('mousemove', function (e) {
  545 + if (this != editPolyline)
  546 + this.setStrokeColor("#20bd26");
  547 + });
  548 + // 失去焦点
  549 + polyUpline01.addEventListener('mouseout', function (e) {
  550 + if (this != editPolyline && this != road_win_show_p)
  551 + this.setStrokeColor("red");
  552 + });
  553 + // 添加单击事件
  554 + polyUpline01.addEventListener('onclick', function (e) {
  555 + // 打开信息窗口
  556 + if (map_status != 1)
  557 + WorldsBMap.openSectionInfoWin(this);
  558 + });
  559 + sectionArray.push(polyUpline01);
  560 + }
  561 + mapBValue.setCenter(polyline_center);
  562 + mapBValue.setZoom(15);
  563 + // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)
  564 + // polyUpline01.disableMassClear();
  565 + }
  566 + },
  567 +
  568 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  569 + drawingUpStationPoint: function (station, s) {
  570 + // 中心点坐标字符串
  571 + var bJwpointsStr = station.stationJwpoints;
  572 + var stationName = station.stationRouteName;
  573 + // 起个中心点坐标字符串
  574 + var bJwpointsArray = bJwpointsStr.split(' ');
  575 + // 设置中心点
  576 + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
  577 + // 自定义标注物图片
  578 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png', new BMap.Size(10, 10));
  579 +
  580 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  581 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  582 + + '</div>'
  583 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">' + s + '</span>' + stationName + '</label>';
  584 +
  585 + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center, {
  586 + "title": stationName,
  587 + "anchor": new BMap.Size(-10, 8),
  588 + "enableDragging": true
  589 + });
  590 + myRichMarker1.disableDragging();
  591 + myRichMarker1.ct_source = '1';
  592 + mapBValue.addOverlay(myRichMarker1);
  593 + myRichMarker1.addEventListener('click', function () {
  594 + if(map_status != 1)
  595 + WorldsBMap.openStationInfoWin(station);
  596 + });
  597 + stationArray[station.stationRouteId] = station;
  598 + },
  599 +
  600 + // 站点名称获取百度坐标(手动规划)
  601 + stationsNameToPoints: function (arra, callback) {
  602 + // 获取长度
  603 + var len = arra.length;
  604 + var stationList = [];
  605 + (function () {
  606 + if (!arguments.callee.count) {
  607 + arguments.callee.count = 0;
  608 + }
  609 + arguments.callee.count++;
  610 + var index = parseInt(arguments.callee.count) - 1;
  611 + if (index >= len) {
  612 + callback && callback(stationList);
  613 + return;
  614 + }
  615 + var f = arguments.callee;
  616 + if (arra[index].name != '') {
  617 + var localSearch = new BMap.LocalSearch(mapBValue);
  618 + localSearch.search(arra[index].name);
  619 + localSearch.setSearchCompleteCallback(function (searchResult) {
  620 + var poi = searchResult.getPoi(0);
  621 + if (poi) {
  622 + stationList.push({
  623 + name: arra[index].name.replace('公交车站', ''),
  624 + wgs: arra[index].wgs,
  625 + potion: {lng: poi.point.lng, lat: poi.point.lat}
  626 + });
  627 + } else {
  628 + stationList.push({
  629 + name: arra[index].name.replace('公交车站', ''),
  630 + wgs: arra[index].wgs,
  631 + potion: {lng: arra[index].wgs.x, lat: arra[index].wgs.y}
1049 632 });
1050   - label.setStyle({
1051   - color: '#fff',
1052   - background:"url(/pages/base/stationroute/css/img/bg.png)",
1053   - border: '0px solid',
1054   - textAlign: "center",
1055   - height: "28px",
1056   - lineHeight: "26px",
1057   - width: "80px",
1058   - maxWidth: "none"
  633 + }
  634 + f();
  635 + });
  636 + } else {
  637 + f();
  638 + }
  639 + })();
  640 + },
  641 +
  642 + // 根据坐标点获取两点之间的时间与距离(手动规划)
  643 + getDistanceAndTotime: function (stationList, cb) {
  644 + stationList[0].distance = '';
  645 + stationList[0].duration = '';
  646 + // var sectionList = [];
  647 + // 获取长度
  648 + var len = stationList.length;
  649 + (function () {
  650 + if (!arguments.callee.count) {
  651 + arguments.callee.count = 0;
  652 + }
  653 + arguments.callee.count++;
  654 + var index = parseInt(arguments.callee.count) - 1;
  655 + if (index >= len - 1) {
  656 + // cb && cb(stationList,sectionList);
  657 + cb && cb(stationList);
  658 + return;
  659 + }
  660 + var f = arguments.callee;
  661 + var poiOne = new BMap.Point(stationList[index].potion.lng, stationList[index].potion.lat);
  662 + var poiTwo = new BMap.Point(stationList[index + 1].potion.lng, stationList[index + 1].potion.lat);
  663 + var transit = new BMap.TransitRoute(mapBValue, {
  664 + renderOptions: {map: mapBValue},
  665 + onSearchComplete: searchComplete
  666 + });
  667 +
  668 + transit.search(poiOne, poiTwo);
  669 + function searchComplete(results) {
  670 + var plan = results.getPlan(0);
  671 + if (transit.getStatus() != BMAP_STATUS_SUCCESS) {
  672 + stationList[index + 1].distance = '';
  673 + stationList[index + 1].duration = '';
  674 + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''});
  675 + } else {
  676 + stationList[index + 1].distance = plan.getDistance(true);
  677 + stationList[index + 1].duration = plan.getDuration(true);
  678 + // var line = plan.getRoute(0);
  679 + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()});
  680 + }
  681 + f();
  682 + }
  683 + })();
  684 + },
  685 +
  686 + // 根据坐标点获取两点之间的折线路段(手动规划)
  687 + getSectionListPlonly: function (stationsPoint, cb) {
  688 + var len = stationsPoint.length;
  689 + var sectionList = [];
  690 + (function () {
  691 + if (!arguments.callee.count) {
  692 + arguments.callee.count = 0;
  693 + }
  694 + arguments.callee.count++;
  695 + var index = parseInt(arguments.callee.count) - 1;
  696 + if (index >= len - 1) {
  697 + cb && cb(sectionList);
  698 + return;
  699 + }
  700 + var f = arguments.callee;
  701 + var poiOne = new BMap.Point(stationsPoint[index].potion.lng, stationsPoint[index].potion.lat);
  702 + var poiTwo = new BMap.Point(stationsPoint[index + 1].potion.lng, stationsPoint[index + 1].potion.lat);
  703 + /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/
  704 + var transit = new BMap.DrivingRoute(mapBValue, {
  705 + renderOptions: {map: mapBValue},
  706 + onPolylinesSet: searchPolylinesSet
  707 + });
  708 + function searchPolylinesSet(results) {
  709 + if (transit.getStatus() != BMAP_STATUS_SUCCESS) {
  710 + } else {
  711 + var sectionArrayList = [];
  712 + for (i = 0; i < results.length; i++) {
  713 + // console.log(results[i].getPolyline().getPath());
  714 + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
  715 + }
  716 + var sectionName = stationsPoint[index].name + '至' + stationsPoint[index + 1].name;
  717 + sectionList.push({sectionName: sectionName, points: sectionArrayList});
  718 + }
  719 + f();
  720 + }
  721 + transit.search(poiOne, poiTwo);
  722 + })();
  723 + },
  724 +
  725 + localtionPoint: function (stationNameV) {
  726 + // 关闭信息窗口
  727 + mapBValue.closeInfoWindow();
  728 +
  729 + WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) {
  730 +
  731 + if (Points) {
  732 +
  733 + var BJwpointsArray = Points.split(' ');
  734 +
  735 + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]);
  736 +
  737 + var marker_stargt2 = new BMap.Marker(stationNameChangePoint);
  738 +
  739 + var PanOptions = {noAnimation: true};
  740 +
  741 + mapBValue.panTo(stationNameChangePoint, PanOptions);
  742 +
  743 + mapBValue.panBy(0, -100);
  744 +
  745 + // 将标注添加到地图中
  746 + mapBValue.addOverlay(marker_stargt2);
  747 +
  748 + //跳动的动画
  749 + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);
  750 +
  751 + }
  752 +
  753 + });
  754 +
  755 + },
  756 +
  757 + /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/
  758 + getBmapStationNames: function (lineNameValue, i, callback) {
  759 +
  760 + var busline = new BMap.BusLineSearch(mapBValue, {
  761 +
  762 + // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
  763 + onGetBusListComplete: function (BusListResult) {
  764 +
  765 + // 如果不为空
  766 + if (BusListResult) {
  767 +
  768 + //获取第一个公交列表显示到map上
  769 + var fstLine = BusListResult.getBusListItem(i);
  770 +
  771 + /*if(fstLine==undefined){
  772 +
  773 + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  774 +
  775 + layer.closeAll();
  776 +
  777 + if(i==0){
  778 +
  779 + $('#upToolsMobal').show();
  780 +
  781 + }else if(i==1){
  782 +
  783 + $('#downToolsMobal').show();
  784 +
  785 + }
  786 +
  787 + return;
1059 788 });
1060   - label.addEventListener('click', function () {
1061   - var params = {};
1062   - params.lineId = stationRouteBegin.stationRouteLine;
1063   - params.lineCode = stationRouteBegin.stationRouteLIneCode;
1064   - params.directions = stationRouteBegin.stationRoutedirections;
1065   - params.stationRouteBegin = stationRouteBegin.stationRouteName;
1066   - params.stationRouteFinish = stationRouteFinish.stationRouteName;
  789 +
  790 + }*/
  791 +
  792 + if (fstLine == undefined) {
  793 +
  794 +
  795 + callback && callback(null);
  796 +
  797 + }
  798 +
  799 + busline.getBusLine(fstLine);
  800 +
  801 + }
  802 +
  803 + },
  804 +
  805 + //设置公交线路查询后的回调函数.参数:rs: BusLine类型
  806 + onGetBusLineComplete: function (BusLine) {
  807 +
  808 + // 如果不为空
  809 + if (BusLine) {
  810 +
  811 + callback && callback(BusLine);
  812 +
  813 + }
  814 +
  815 + }
  816 +
  817 + });
  818 +
  819 + busline.getBusList(lineNameValue);
  820 +
  821 + },
  822 + // 修改站点
  823 + editStation: function (stationRouteId) {
  824 + // $.get("/stationroute/findStationRouteInfo",{"id":stationRouteId},function (route) {
  825 + $.get('edit_select.html', function (m) {
  826 + $(pjaxContainer).append(m);
  827 + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap, DrawingManagerObj, GetAjaxData, EditStationObj, LineObj, PublicFunctions, stationArray[stationRouteId]]);
  828 + });
  829 + // });
  830 + },
  831 + addBetweenStationRoad: function (stationRouteId) {
  832 + // 关闭信息窗口
  833 + mapBValue.closeInfoWindow();
  834 + $.get("/stationroute/findStationRouteInfo", {"id": stationRouteId}, function (route) {
  835 + var stationRouteBegin = route[0];
  836 + // 查询下一个站点
  837 + $.get("/stationroute/findDownStationRoute", {
  838 + "lineId": stationRouteBegin.stationRouteLine,
  839 + "direction": stationRouteBegin.stationRoutedirections,
  840 + "stationRouteCode": stationRouteBegin.stationRouteCode
  841 + }, function (stationRoute) {
  842 + var stationRouteFinish = stationRoute[0];
  843 +
  844 + if (stationRouteFinish) {
  845 + var pointBegin = stationRouteBegin.stationJwpoints.split(" ");
  846 + var pointFinish = stationRouteFinish.stationJwpoints.split(" ")
  847 + var sectionList = [];
  848 + // 两个站点的坐标
  849 + var poiOne = new BMap.Point(pointBegin[0], pointBegin[1]);
  850 + var poiTwo = new BMap.Point(pointFinish[0], pointFinish[1]);
  851 + // 路径规划保存按钮
  852 + var label = new BMap.Label("保存路段", {
  853 + offset: new BMap.Size(13, -53)
  854 + });
  855 + label.setStyle({
  856 + color: '#fff',
  857 + background: "url(/pages/base/stationroute/css/img/bg.png)",
  858 + border: '0px solid',
  859 + textAlign: "center",
  860 + height: "28px",
  861 + lineHeight: "26px",
  862 + width: "80px",
  863 + maxWidth: "none"
  864 + });
  865 + label.addEventListener('click', function () {
  866 + var params = {};
  867 + params.lineId = stationRouteBegin.stationRouteLine;
  868 + params.lineCode = stationRouteBegin.stationRouteLIneCode;
  869 + params.directions = stationRouteBegin.stationRoutedirections;
  870 + params.stationRouteBegin = stationRouteBegin.stationRouteName;
  871 + params.stationRouteFinish = stationRouteFinish.stationRouteName;
  872 + layer.confirm('确定保存', {
  873 + btn : [ '路段调整好了','继续调整','退出'], icon: 3, title:'提示'
  874 + ,btn3: function(index, layero){
  875 + PublicFunctions.resjtreeDate(params.lineId,params.directions);
  876 + PublicFunctions.editAChangeCssRemoveDisabled();
  877 + GetAjaxData.getSectionRouteInfo(params.lineId,params.directions,function(data) {
  878 + PublicFunctions.linePanlThree(params.lineId,data,params.directions);
  879 + });
  880 + PublicFunctions.editMapStatusRemove();
  881 + }
  882 + }, function(index, layero){
  883 + layer.close(index);
1067 884 params.route = $("#routePlanning").val();
1068   - $.get('doublename_road.html', function(m){
  885 + $.get('doublename_road.html', function (m) {
1069 886 $(pjaxContainer).append(m);
1070   - $('#doublename_road_mobal').trigger('doubleNameRoadMobal_show', [params,WorldsBMap,GetAjaxData,PublicFunctions]);
  887 + $('#doublename_road_mobal').trigger('doubleNameRoadMobal_show', [params, WorldsBMap, GetAjaxData, PublicFunctions]);
1071 888 });
  889 + PublicFunctions.editMapStatusRemove();
1072 890 });
1073   - // 路径规划
1074   - var transit = new BMap.DrivingRoute(mapBValue, {renderOptions: {map: mapBValue,enableDragging : true},onPolylinesSet: searchPolylinesSet});
1075   - function searchPolylinesSet(results){
1076   - if (transit.getStatus() == BMAP_STATUS_SUCCESS){
1077   - var sectionArrayList = [];
1078   - for (i = 0; i < results.length; i++){
1079   - sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
1080   - }
1081   - sectionList = sectionArrayList;//JSON.stringify()
1082   - $("#routePlanning").val(JSON.stringify(sectionArrayList));
1083   - var pointMap = new Map();
1084   - pointMap = sectionArrayList[sectionArrayList.length-1];
1085   - var pointLabel = new BMap.Point(pointMap.lng,pointMap.lat);
1086   - label.enableMassClear();
1087   - label.setPosition(pointLabel);
1088   - mapBValue.addOverlay(label);
  891 + });
  892 + // 路径规划
  893 + var transit = new BMap.DrivingRoute(mapBValue, {
  894 + renderOptions: {
  895 + map: mapBValue,
  896 + enableDragging: true
  897 + },
  898 + onPolylinesSet: searchPolylinesSet
  899 + });
  900 +
  901 + function searchPolylinesSet(results) {
  902 + if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
  903 + var sectionArrayList = [];
  904 + for (i = 0; i < results.length; i++) {
  905 + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
1089 906 }
  907 + sectionList = sectionArrayList;//JSON.stringify()
  908 + $("#routePlanning").val(JSON.stringify(sectionArrayList));
  909 + var pointMap = new Map();
  910 + pointMap = sectionArrayList[sectionArrayList.length - 1];
  911 + var pointLabel = new BMap.Point(pointMap.lng, pointMap.lat);
  912 + label.enableMassClear();
  913 + label.setPosition(pointLabel);
  914 + mapBValue.addOverlay(label);
1090 915 }
1091   - transit.search(poiOne,poiTwo);
1092   - transit.disableAutoViewport();
1093   - } else {
1094   - layer.msg("您选择的站点后没有站点了,不能生成站点间路段!")
1095   - }
  916 + }
  917 + transit.search(poiOne, poiTwo);
  918 + transit.disableAutoViewport();
  919 + // 地图编辑状态
  920 + PublicFunctions.editMapStatus();
  921 + } else {
  922 + layer.msg("您选择的站点后没有站点了,不能生成站点间路段!")
  923 + }
1096 924  
  925 + });
  926 + });
  927 +
  928 + },
  929 + // 定位路段
  930 + focusSection: function(sectionRoudId) {
  931 + for (var i = 0, p; p = sectionArray[i++];) {
  932 + if (p.data.sectionrouteId == sectionRoudId) {
  933 + WorldsBMap.openSectionInfoWin(p);
  934 + break;
  935 + }
  936 + }
  937 + },
  938 + // 编辑路段
  939 + editSection : function(sectionRoudId) {
  940 + layer.confirm('进入编辑状态', {
  941 + btn : [ '确定','返回' ], icon: 3, title:'提示'
  942 + }, function() {
  943 + PublicFunctions.editMapStatus();
  944 + layer.msg('双击保存路段');
  945 + var p;
  946 + for (var i = 0; p = sectionArray[i++];) {
  947 + if (p.data.sectionrouteId == sectionRoudId) {
  948 + mapBValue.closeInfoWindow();//关闭infoWindow
  949 + p.enableEditing();
  950 + p.setStrokeColor('blue');
  951 + editPolyline = p;
  952 + break;
  953 + }
  954 + }
  955 + p.addEventListener('dblclick', function () {
  956 + /** 设置修改路段集合对象为空 */
  957 + editPolyline = '';
  958 + PublicFunctions.editMapStatusRemove();
  959 + $.get('editsection.html', function(m){
  960 + $('body').append(m);
  961 + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,p,PublicFunctions]);
  962 + });
  963 + });
  964 + });
  965 + },
  966 + // 添加在路段之后
  967 + addSection : function(stecion) {
  968 + PublicFunctions.editMapStatus();
  969 + // 把数据填充到模版中
  970 + var addSectionHTML = template('add_draw_polyline-temp');
  971 + $('body .mian-portlet-body').append(addSectionHTML);
  972 + //暂停和开始绘制
  973 + $('.draw_polyline_switch>a').on('click', function () {
  974 + var t = $(this).text();
  975 + if(t=='暂停绘制'){
  976 + WorldsBMap.exitDrawStatus();
  977 + $(this).text('开始绘制');
  978 + }
  979 + else{
  980 + WorldsBMap.openDrawStatus();
  981 + $(this).text('暂停绘制');
  982 + }
  983 + });
  984 + // 开启绘制事件
  985 + WorldsBMap.showAddSectionPanel(stecion);
  986 +
  987 + //取消
  988 + $('#addSectionCancelBtn').on('click', function () {
  989 + $('.main_left_panel_m_layer').hide();
  990 + $(this).parents('.buffer_edit_body').parent().remove();
  991 + WorldsBMap.exitDrawStatus();
  992 + PublicFunctions.editMapStatusRemove();
  993 + });
  994 +
  995 + //确定
  996 + $('#addSectionSbmintBtn').on('click', function () {
  997 + var btn = this;
  998 + $('#addSectionSbmintBtn').addClass("disabled");
  999 + var sectionName = $('#sectionNameInput').val();
  1000 + var bsectionVector = $('#bsectionVectorInput').val();
  1001 + var params = {};
  1002 + if(sectionName && bsectionVector) {
  1003 + WorldsBMap.exitDrawStatus();
  1004 + GetAjaxData.getSectionCode(function(sectionCode) {
  1005 + var lineId = stecion.lineId;
  1006 + var dir = stecion.dir;
  1007 + params.lineId = lineId;
  1008 + params.lineCode = stecion.lineCode;
  1009 + params.sectionCode = sectionCode;// 设值路段编码.
  1010 + params.sectionName = sectionName;
  1011 + params.roadCoding = '';
  1012 + params.dbType = 'b';
  1013 + params.bsectionVector = bsectionVector;
  1014 + params.sectionrouteCode = 1;
  1015 + params.sectionTime = 0;
  1016 + params.sectionDistance = 60;
  1017 + params.speedLimit = 0;
  1018 + params.versions = stecion.versions;
  1019 + params.destroy = 0;
  1020 + params.directions = dir;
  1021 + params.descriptions = '';
  1022 + GetAjaxData.sectionSave(params, function (result) {
  1023 + if(result.status =="SUCCESS"){
  1024 + $('.main_left_panel_m_layer').hide();
  1025 + $(btn).parents('.buffer_edit_body').parent().remove();
  1026 + PublicFunctions.editMapStatusRemove();
  1027 + PublicFunctions.resjtreeDate(lineId,dir);
  1028 + PublicFunctions.editAChangeCssRemoveDisabled();
  1029 + GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {
  1030 + PublicFunctions.linePanlThree(lineId,data,dir);
  1031 + });
  1032 + layer.msg("添加成功!");
  1033 + } else if(result.status =="ERROR") {
  1034 + layer.msg("添加失败!");
  1035 + }
  1036 + });
  1037 + });
  1038 + } else if(!sectionName){
  1039 + layer.msg('请填写路段名字!');
  1040 + } else if(!bsectionVector){
  1041 + layer.msg('请先绘制路段!');
  1042 + }
  1043 + setTimeout(function () {
  1044 + $("#addSectionSbmintBtn").removeClass("disabled");
  1045 + },1000);
  1046 + });
  1047 + },
  1048 + // 添加第一个路段
  1049 + addSectionAfter : function(sectionRoudId) {
  1050 + //order = after before;
  1051 + var beforeSection;
  1052 + // 关闭信息窗口
  1053 + mapBValue.closeInfoWindow();
  1054 + PublicFunctions.editMapStatus();
  1055 + // 把数据填充到模版中
  1056 + var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRoudId});
  1057 + $('body .mian-portlet-body').append(addSectionHTML);
  1058 + //暂停和开始绘制
  1059 + $('.draw_polyline_switch>a').on('click', function () {
  1060 + var t = $(this).text();
  1061 + if(t=='暂停绘制'){
  1062 + WorldsBMap.exitDrawStatus();
  1063 + $(this).text('开始绘制');
  1064 + }
  1065 + else{
  1066 + WorldsBMap.openDrawStatus();
  1067 + $(this).text('暂停绘制');
  1068 + }
  1069 + });
  1070 +
  1071 + //取消
  1072 + $('#addSectionCancelBtn').on('click', function () {
  1073 + $('.main_left_panel_m_layer').hide();
  1074 + $(this).parents('.buffer_edit_body').parent().remove();
  1075 + WorldsBMap.exitDrawStatus();
  1076 + PublicFunctions.editMapStatusRemove();
  1077 + });
  1078 + GetAjaxData.getSectionRouteInfoById(sectionRoudId, function(data){
  1079 + WorldsBMap.showAddSectionPanel(data[0]);
  1080 + beforeSection = data[0];
  1081 + });
  1082 +
  1083 + //确定
  1084 + $('#addSectionSbmintBtn').on('click', function () {
  1085 + var btn = this;
  1086 + $('#addSectionSbmintBtn').addClass("disabled");
  1087 + var sectionName = $('#sectionNameInput').val();
  1088 + var bsectionVector = $('#bsectionVectorInput').val();
  1089 + var params = {};
  1090 + if(sectionName && bsectionVector) {
  1091 + WorldsBMap.exitDrawStatus();
  1092 + GetAjaxData.getSectionCode(function(sectionCode) {
  1093 + var lineId = beforeSection.sectionRouteLine
  1094 + var dir = beforeSection.sectionRouteDirections
  1095 + params.lineId = lineId;
  1096 + params.lineCode = beforeSection.sectionRouteLineCode;
  1097 + params.sectionCode = sectionCode;// 设值路段编码.
  1098 + params.sectionName = sectionName;
  1099 + params.roadCoding = '';
  1100 + params.dbType = 'b';
  1101 + params.bsectionVector = bsectionVector;
  1102 + params.sectionrouteCode = beforeSection.sectionRouteCode+"_0";
  1103 + params.sectionTime = 0;
  1104 + params.sectionDistance = 60;
  1105 + params.speedLimit = 0;
  1106 + params.versions = beforeSection.sectionVersion;
  1107 + params.destroy = 0;
  1108 + params.directions = dir;
  1109 + params.descriptions = '';
  1110 + GetAjaxData.sectionSave(params, function (result) {
  1111 + if(result.status =="SUCCESS"){
  1112 + $('.main_left_panel_m_layer').hide();
  1113 + $(btn).parents('.buffer_edit_body').parent().remove();
  1114 + PublicFunctions.editMapStatusRemove();
  1115 + PublicFunctions.resjtreeDate(lineId,dir);
  1116 + PublicFunctions.editAChangeCssRemoveDisabled();
  1117 + GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {
  1118 + PublicFunctions.linePanlThree(lineId,data,dir);
  1119 + });
  1120 + layer.msg("添加成功!");
  1121 + } else if(result.status =="ERROR") {
  1122 + layer.msg("添加失败!");
  1123 + }
  1124 + });
  1125 + });
  1126 + } else if(!sectionName){
  1127 + layer.msg('请填写路段名字!');
  1128 + } else if(!bsectionVector)
  1129 + layer.msg('请先绘制路段!');
  1130 + setTimeout(function () {
  1131 + $("#addSectionSbmintBtn").removeClass("disabled");
  1132 + },1000);
  1133 + });
  1134 + },
  1135 + // 撤销站点
  1136 + destroyStation : function(stationRouteId,lineId,dir) {
  1137 + layer.confirm('你确定要撤销此站点吗?', {
  1138 + btn : [ '撤销','返回' ], icon: 3, title:'提示'
  1139 + }, function(){
  1140 + $.post('/stationroute/stationRouteIsDestroy',{'stationRouteId':stationRouteId,destroy:'1'},function(resuntDate) {
  1141 + if (resuntDate.status == 'SUCCESS') {
  1142 + // 弹出添加成功提示消息
  1143 + layer.msg('撤销成功!');
  1144 + } else {
  1145 + // 弹出添加失败提示消息
  1146 + layer.msg('撤销失败!');
  1147 + }
  1148 + // 刷新左边树
  1149 + PublicFunctions.resjtreeDate(lineId,dir);
  1150 + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
  1151 + GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {
  1152 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
  1153 + PublicFunctions.linePanlThree(lineId,data,dir);
  1154 + });
  1155 + });
  1156 + });
  1157 + },
  1158 + // 撤销路段
  1159 + destroySection : function(sectionRoudId,lineId,dir) {
  1160 + layer.confirm('你确定要撤销此路段吗?', {
  1161 + btn : [ '撤销','返回' ], icon: 3, title:'提示'
  1162 + }, function(){
  1163 + $.post('/sectionroute/destroy',{'id': sectionRoudId},function(resuntDate) {
  1164 + if (resuntDate.status == 'SUCCESS') {
  1165 + // 弹出添加成功提示消息
  1166 + layer.msg('撤销成功!');
  1167 + } else {
  1168 + // 弹出添加失败提示消息
  1169 + layer.msg('撤销失败!');
  1170 + }
  1171 + // 刷新左边树
  1172 + PublicFunctions.resjtreeDate(lineId,dir);
  1173 + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
  1174 + GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {
  1175 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
  1176 + PublicFunctions.linePanlThree(lineId,data,dir);
1097 1177 });
1098 1178 });
  1179 + });
  1180 + },
  1181 + // 打开路段信息窗口
  1182 + openSectionInfoWin : function(p) {
  1183 + var section = p.data;
  1184 + var width = WorldsBMap.strGetLength(section.sectionName) * 10;
  1185 + // 信息窗口参数属性
  1186 + var opts = {
  1187 + // 信息窗口宽度
  1188 + width: (width < 200 ? 200 : width),
  1189 + // 信息窗口高度
  1190 + height: 150,
  1191 + //设置不允许信窗发送短息
  1192 + enableMessage: false,
  1193 + //是否开启点击地图关闭信息窗口
  1194 + enableCloseOnClick: false,
  1195 + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
  1196 + enableAutoPan: false
  1197 + };
  1198 + var htm = '<span style="color: #ff8355;font-size: 18px;">' + section.sectionName + '</span>' +
  1199 + '<span class="help-block" >路段编码:' + section.sectionCode + '</span>' +
  1200 + '<span class="help-block" >路段序号:' + section.sectionrouteCode + '</span>' +
  1201 + '<span class="help-block" >版本号&nbsp&nbsp:' + section.versions + '</span>' +
  1202 + '<div >' +
  1203 + '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection(' + section.sectionrouteId + ')">修改</button>' +
  1204 + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection('+ section.sectionrouteId + ','+section.sectionrouteLine+','+section.sectionrouteDirections+')">撤销</button>' +
  1205 + '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter('+section.sectionrouteId+')">添加路段(之后)</button>' +
  1206 + '</div>';
  1207 +
  1208 + // 创建信息窗口
  1209 + var infoWindow_target = new BMap.InfoWindow(htm, opts);
  1210 + // 切割段折线坐标字符串
  1211 + var sectionStr = section.sectionBsectionVector.substring(11, section.sectionBsectionVector.length - 1);
  1212 + // 分割折线坐标字符串
  1213 + var lineArray = sectionStr.split(',');
  1214 + var sectionArray = [];
  1215 + for (var i = 0; i < lineArray.length; i++) {
  1216 + sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  1217 + }
  1218 + // 计算中间点
  1219 + var index = parseInt(sectionArray.length / 2);
  1220 + var centerPoint = sectionArray[index];
  1221 + //close event
  1222 + infoWindow_target.addEventListener('close', function (e) {
  1223 + p.setStrokeColor("red");
  1224 + road_win_show_p = null;
  1225 + });
  1226 + //open event
  1227 + infoWindow_target.addEventListener('open', function (e) {
  1228 + p.setStrokeColor("#20bd26");
  1229 + road_win_show_p = p;
  1230 + });
  1231 + //开启信息窗口
  1232 + mapBValue.openInfoWindow(infoWindow_target, centerPoint);
  1233 + mapBValue.setZoom(18);
  1234 + mapBValue.setCenter(centerPoint);
  1235 + },
  1236 + /**
  1237 + * 绘制新增路段
  1238 + * @param section
  1239 + */
  1240 + showAddSectionPanel : function (section) {
  1241 + var point;
  1242 + if(section){
  1243 + var sectionBsectionVectorStr = section.sectionBsectionVector;
  1244 + var line = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1),
  1245 + points = line.split(','),
  1246 + pointStr = points[points.length-1].split(' ');
  1247 +
  1248 + point = new BMap.Point(pointStr[0], pointStr[1]);
  1249 + }
  1250 +
  1251 + mapBValue.centerAndZoom(point, 18);
  1252 +
  1253 + //开启鼠标绘制
  1254 + drawingManager = new BMapLib.DrawingManager(mapBValue, {
  1255 + polylineOptions: styleOptions
  1256 + });
  1257 +
  1258 + drawingManager.open();
  1259 + //drawingManager.enableCalculate();
  1260 + drawingManager.setDrawingMode('polyline');
  1261 +
  1262 + //绘制完成
  1263 + drawingManager.addEventListener('polylinecomplete', function (e) {
  1264 + console.log('eee', e, e.getPath());
  1265 + drawingManager.close();
  1266 +
  1267 + var polyline = new BMap.Polyline(e.getPath(), {strokeWeight: 7, strokeColor: 'blue', strokeOpacity: 0.7});
  1268 +
  1269 + mapBValue.removeOverlay(e);
  1270 + mapBValue.addOverlay(polyline);
  1271 + polyline.enableEditing();
  1272 +
  1273 + editPolyline = polyline;
  1274 + var sectionData = e.getPath();// 获取折线坐标集合
  1275 + $('#bsectionVectorInput').val(JSON.stringify(sectionData));
  1276 + });
  1277 + },
  1278 + exitDrawStatus : function () {
  1279 + if (drawingManager) {
  1280 + $('#bsectionVectorInput').val("");
  1281 + WorldsBMap.clearOtherOverlay();
  1282 + drawingManager.close();
  1283 + }
  1284 + },
  1285 + openDrawStatus : function () {
  1286 + if (drawingManager) {
  1287 + $('#bsectionVectorInput').val("");
  1288 + WorldsBMap.clearOtherOverlay();
  1289 + drawingManager.open();
  1290 + }
  1291 + },
  1292 + /** 清楚无需要的覆盖物(非站点/路段数据源)*/
  1293 + clearOtherOverlay : function () {
  1294 + var all = mapBValue.getOverlays();
  1295 + for (var i = 0, obj; obj = all[i++];) {
  1296 + if (obj.ct_source && obj.ct_source == '1')
  1297 + continue;
  1298 + mapBValue.removeOverlay(obj);
  1299 + }
  1300 + },
  1301 + clearMarkAndOverlays: function () {
  1302 + // 清楚地图覆盖物
  1303 + mapBValue.clearOverlays();
  1304 + mapBValue.removeOverlay();
  1305 + },
  1306 + clearMark: function () {
  1307 + // 清楚地图覆盖物
  1308 + mapBValue.removeOverlay();
  1309 + },
  1310 + strGetLength: function (str) {
  1311 + return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度
  1312 + }
  1313 + }
  1314 +
  1315 + return Bmap;
1099 1316  
1100   - },
1101   -
1102   - clearMarkAndOverlays : function() {
1103   -
1104   - // 清楚地图覆盖物
1105   - mapBValue.clearOverlays();
1106   -
1107   - mapBValue.removeOverlay();
1108   -
1109   - }
1110   -
1111   - }
1112   -
1113   - return Bmap;
1114   -
1115 1317 }();
1116 1318 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
... ... @@ -80,5 +80,7 @@ $(function(){
80 80 });
81 81  
82 82 }
83   -
  83 + $('.green-seagreen dropdown-toggle').click(function(){
  84 + $('.dropdown-menu').css("display", "block");
  85 + });
84 86 });
85 87 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
... ... @@ -22,44 +22,7 @@ var StationTreeData = function(){
22 22 EditSectionObj.setEitdSection({});
23 23  
24 24 }
25   -
26   - function upIsEidtStauts(shapesTypeT,chaildredType,data) {
27   -
28   - // 关闭弹出层
29   - layer.closeAll();
30   -
31   - // 选中的是站点
32   - if(chaildredType =='station') {
33   -
34   - // 如果是圆
35   - if(shapesTypeT =='r') {
36   -
37   - // 百度地图画圆
38   - WorldsBMap.pointsCircle(data);
39   -
40   - // 如果是多边形
41   - }else if(shapesTypeT == 'd') {
42   -
43   - // 百度地图画多边形
44   - WorldsBMap.pointsPolygon(data);
45   -
46   - }
47   -
48   - // 选中的是路段
49   - }else if(chaildredType =='section'){
50   - // 路段矢量坐标点
51   - var polylineArray = [data];
52   - // 路段方向
53   - var dire_ = data.sectionrouteDirections;
54   - // 线路ID
55   - var Line = LineObj.getLineObj();
56   - /*// 百度地图画路段
57   - PublicFunctions.linePanlThree(Line.id,polylineArray,dire_);*/
58   - // 百度地图画路段
59   - PublicFunctions.treeSectionClick(Line.id,polylineArray,dire_);
60   - }
61   - }
62   -
  25 +
63 26 function TreeOnclickEvent(treeOjb) {
64 27 if(treeOjb==null)
65 28 return;
... ... @@ -70,64 +33,15 @@ var StationTreeData = function(){
70 33 }
71 34 // 获取数据
72 35 var stationData = treeOjb[0].original;
73   - // 站点范围类型
74   - var shapesType_ = stationData.stationShapesType;
75   - // 选中的节点类型
76   - var chaildredType_ = stationData.chaildredType;
77   - // 选中的其它节点
78   - if(chaildredType_ ==null){
79   - return;
80   - }
81   - var edtsta = EditStationObj.getEitdStation();
82   - var edtste = EditSectionObj.getEitdSection();
83   - if(!$.isEmptyObject(edtsta)){
84   - var stationName = edtsta.stationStationName;
85   - var txType = edtsta.stationShapesType;
86   - // 是否继续弹出层
87   - layer.confirm('您正处于站点【'+stationName+'】的编辑状态!是否退出!', {
88   - btn : [ '确认并退出', '返回并继续' ]
89   - }, function(index) {
90   - DrawingManagerObj.closeDrawingManager();
91   - PublicFunctions.editAChangeCssRemoveDisabled();
92   - // 关闭弹出层
93   - layer.close(index);
94   - WorldsBMap.clearMarkAndOverlays();
95   - if(txType=='r'){
96   - WorldsBMap.pointsCircle(edtsta);
97   - }else if(txType=='d') {
98   - // 百度地图画多边形
99   - WorldsBMap.pointsPolygon(edtsta);
100   - }
101   - parmasObj();
102   - },function(){
103   - // 关闭弹出层
104   - layer.closeAll();
105   - return false;
106   - });
107   -
108   - }else if(!$.isEmptyObject(edtste)) {
109   - var sectionName = edtste.sectionName;
110   - // 是否继续弹出层
111   - layer.confirm('您正处于路段【'+sectionName+'】的编辑状态!是否退出!', {
112   - btn : [ '确认并退出', '返回并继续' ]
113   - }, function(index) {
114   - // 关闭弹出层
115   - layer.close(index);
116   - PublicFunctions.editAChangeCssRemoveDisabled();
117   - var polylineArray_ = [edtste];
118   - WorldsBMap.clearMarkAndOverlays();
119   - // 百度地图画路段
120   - PublicFunctions.treeSectionClick(Line.id,polylineArray,dire_);
121   - parmasObj();
122   -
123   - },function(){
124   - // 关闭弹出层
125   - layer.closeAll();
126   - return false;
127   - });
128   - }else {
129   - WorldsBMap.clearMarkAndOverlays();
130   - upIsEidtStauts(shapesType_,chaildredType_,stationData);
  36 + // 选中的节点类型
  37 + var chaildredType_ = stationData.chaildredType;
  38 +
  39 + if(chaildredType_ == "section") {
  40 + WorldsBMap.focusSection(stationData.sectionrouteId);
  41 + } else if(chaildredType_ == "station") {
  42 + WorldsBMap.openStationInfoWin(stationData);
  43 + } else if(chaildredType_ == "addSection") {
  44 + WorldsBMap.addSection(stationData);
131 45 }
132 46 }
133 47 var stationTree = {
... ... @@ -251,7 +165,11 @@ var StationTreeData = function(){
251 165 tree.settings.core.data = treeDateJson;
252 166 // 刷新上行树
253 167 tree.refresh();
254   - },
  168 + // 展开树
  169 + setTimeout(function () {
  170 + tree.open_all();
  171 + },500);
  172 + },
255 173 dwonreloadeTree : function (treeDateJson) {
256 174 // 获取下行树
257 175 var tree = $.jstree.reference('#station_Down_tree');
... ... @@ -259,6 +177,10 @@ var StationTreeData = function(){
259 177 tree.settings.core.data = treeDateJson;
260 178 // 刷行下行树
261 179 tree.refresh();
  180 + // 展开树
  181 + setTimeout(function () {
  182 + tree.open_all();
  183 + },500);
262 184 }
263 185 }
264 186  
... ...
src/main/resources/static/pages/base/stationroute/list.html
1 1 <link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" />
2   -<div class="portlet-body">
  2 +<link rel="stylesheet" href="/assets/plugins/layer-v2.4/layer/skin/layer.css">
  3 +
  4 +<div class="mian-portlet-body">
3 5 <!-- 地图 -->
4 6 <div id="bmap_basic" class="bmaps"></div>
  7 + <!-- 搜索框 -->
  8 +
  9 + <div class="search_panel">
  10 + <div class="search_input_panel">
  11 + <input class="search_input" type="text" placeholder="输入位置搜索" id="searchInput">
  12 + <span class="fa fa-close fa-lg clear hide" aria-hidden="true"></span >
  13 + </div>
  14 + <div class="search_button_panel">
  15 + <button class="fa fa-search fa-lg search_button" >
  16 + </button >
  17 + </div>
  18 + </div>
  19 +
  20 + <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;z-index: 199;"></div>
5 21 <!-- 路径规划路段 -->
6 22 <input class="hand" id="routePlanning" />
7 23 <div class="portlet box protlet-box">
  24 + <div class="protlet-box-layer"></div>
8 25 <!-- 左边标题栏 -->
9   - <div class="portlet-title" style="background-color:#12527f;">
  26 + <div class="portlet-title">
10 27 <div class="caption">
11 28 <!-- 途径站点 -->
12 29 </div>
13   - <div class="tools">
  30 + <!--<div class="tools">
14 31 <a href="javascript:;" class="collapse" data-original-title="" title=""> </a>
15   - </div>
  32 + </div>-->
16 33 </div>
17 34 <!-- 左边栏 -->
18 35 <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;">
... ... @@ -23,212 +40,220 @@
23 40 <li class="active">
24 41 <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a>
25 42 </li>
26   - <li class="">
27   - <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a>
28   - </li>
29   - </ul>
30   - </div>
31   - <div class="col-md-9 col-sm-9 col-xs-9">
32   - <div class="tab-content">
33   - <!-- 左边栏上行 -->
34   - <div class="tab-pane active in" id="stationUp" data-direction="0">
35   - <div class="portlet-body" id="uptreeMobal" style="display: none">
36   - <div class="table-toolbar">
37   - <div class="row">
38   - <div class="col-md-6" style="float: right;">
39   - <div class="btn-group" style="float: right;">
40   - <div class="actions module_tools">
41   - <div class="btn-group">
42   - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具
43   - <i class="fa fa-angle-down"></i>
44   - </a> -->
45   - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
46   - <i class="fa fa-share"></i>
47   - <span>上行操作</span>
48   - <i class="fa fa-angle-down"></i>
49   - </a>
50   - <ul class="dropdown-menu pull-right" style="min-width:100px">
51   - <li>
52   - <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a>
53   - </li>
54   - <li class="divider"> </li>
55   - <!--<li>
56   - <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a>
57   - </li>-->
58   - <li class="divider"> </li>
59   - <li>
60   - <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a>
61   - </li>
62   - <li class="divider"> </li>
63   - <li>
64   - <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a>
65   - </li>
66   - <li class="divider"> </li>
67   - <li>
68   - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a>
69   - </li>
70   - <li class="divider"> </li>
71   - <li>
72   - <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a>
73   - </li>
74   - <li class="divider"> </li>
75   - <li>
76   - <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a>
77   - </li>
78   - <li class="divider"> </li>
79   - <!-- <li>
80   - <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a>
81   - </li> -->
82   - <!-- <li>
83   - <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a>
84   - </li> -->
85   - </ul>
86   - </div>
87   - </div>
88   - </div>
89   - </div>
90   - </div>
91   - </div>
92   - <!-- 树 -->
93   - <div class="portlet-body" >
  43 + <li class="">
  44 + <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a>
  45 + </li>
  46 + </ul>
  47 + </div>
  48 + <div class="col-md-9 col-sm-9 col-xs-9">
  49 + <div class="tab-content">
  50 + <!-- 左边栏上行 -->
  51 + <div class="tab-pane active in" id="stationUp" data-direction="0">
  52 + <div class="portlet-body" id="uptreeMobal" style="display: none">
  53 + <div class="table-toolbar">
  54 + <div class="row">
  55 + <div class="col-md-6" style="float: right;">
  56 + <div class="btn-group" style="float: right;">
  57 + <div class="actions module_tools">
  58 + <div class="btn-group">
  59 + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具
  60 + <i class="fa fa-angle-down"></i>
  61 + </a> -->
  62 + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
  63 + <i class="fa fa-share"></i>
  64 + <span>上行操作</span>
  65 + <i class="fa fa-angle-down"></i>
  66 + </a>
  67 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  68 + <li>
  69 + <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a>
  70 + </li>
  71 + <li class="divider"> </li>
  72 + <!--<li>
  73 + <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a>
  74 + </li>
  75 + <li class="divider"> </li>
  76 + <li>
  77 + <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a>
  78 + </li>
  79 + <li class="divider"> </li>
  80 + <li>
  81 + <a href="javascript:;" id="addUpSection"><i class="fa fa-plus"></i> 添加路段</a>
  82 + </li>
  83 + <li class="divider"> </li>-->
  84 + <li>
  85 + <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a>
  86 + </li>
  87 + <li class="divider"> </li>
  88 + <li>
  89 + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a>
  90 + </li>
  91 + <li class="divider"> </li>
  92 + <li>
  93 + <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a>
  94 + </li>
  95 + <li class="divider"> </li>
  96 + <li>
  97 + <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a>
  98 + </li>
  99 + <!-- <li class="divider"> </li>
  100 + <!-- <li>
  101 + <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a>
  102 + </li> -->
  103 + <!-- <li>
  104 + <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a>
  105 + </li> -->
  106 + </ul>
  107 + </div>
  108 + </div>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + </div>
  113 + <!-- 树 -->
  114 + <div class="portlet-body" >
94 115 <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div>
95 116 </div>
96   - </div>
97   - <!-- 无上行站点添加方式 -->
98   - <div id="upToolsMobal" class="portlet-body" style="display:none">
99   - <div class="row">
100   - <div class="col-md-6" style="float: right;">
101   - <div class="btn-group" style="float: right;">
102   - <div class="actions">
103   - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
104   - <i class="fa fa-share"></i>
105   - <span>上行规划选择</span>
106   - <i class="fa fa-angle-down"></i>
107   - </a>
108   - <ul class="dropdown-menu pull-right" style="min-width:100px">
109   - <li>
110   - <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a>
111   - </li>
112   - <li class="divider"> </li>
113   - <li>
114   - <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
115   - </li>
116   - </ul>
117   - </div>
118   - </div>
119   - </div>
120   - </div>
121   - <div class="row" style="margin-top: 10px;">
122   - <div class="col-md-12">
123   - <!-- 提示 -->
  117 + </div>
  118 + <!-- 无上行站点添加方式 -->
  119 + <div id="upToolsMobal" class="portlet-body" style="display:none">
  120 + <div class="row">
  121 + <div class="col-md-6" style="float: right;">
  122 + <div class="btn-group" style="float: right;">
  123 + <div class="actions">
  124 + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
  125 + <i class="fa fa-share"></i>
  126 + <span>上行规划选择</span>
  127 + <i class="fa fa-angle-down"></i>
  128 + </a>
  129 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  130 + <li>
  131 + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a>
  132 + </li>
  133 + <li class="divider"> </li>
  134 + <li>
  135 + <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
  136 + </li>
  137 + </ul>
  138 + </div>
  139 + </div>
  140 + </div>
  141 + </div>
  142 + <div class="row" style="margin-top: 10px;">
  143 + <div class="col-md-12">
  144 + <!-- 提示 -->
124 145 <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;">
125   - <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点.
126   - </div>
127   - </div>
128   - </div>
129   - </div>
130   -
131   - </div>
132   -
133   - <!-- 下行 -->
134   - <div class="tab-pane fade" id="stationDown" data-direction="1">
135   - <div class="portlet-body" id="DowntreeMobal" style="display: none">
136   - <div class="table-toolbar">
137   - <div class="row">
138   - <div class="col-md-6" style="float: right;">
139   - <div class="btn-group" style="float: right;">
140   - <div class="actions module_tools">
141   - <div class="btn-group">
142   - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具
143   - <i class="fa fa-angle-down"></i>
144   - </a> -->
145   - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
146   - <i class="fa fa-share"></i>
147   - <span>下行操作</span>
148   - <i class="fa fa-angle-down"></i>
149   - </a>
150   - <ul class="dropdown-menu pull-right" style="min-width:100px">
151   - <li>
152   - <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a>
153   - </li>
154   - <li class="divider"> </li>
155   - <!--<li>
156   - <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a>
157   - </li>-->
158   - <li class="divider"> </li>
159   - <li>
160   - <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a>
161   - </li>
162   - <li class="divider"> </li>
163   - <li>
164   - <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a>
165   - </li>
166   - <li class="divider"> </li>
167   - <li>
168   - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a>
169   - </li>
170   - <li class="divider"> </li>
171   - <li>
172   - <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a>
173   - </li>
174   - <li class="divider"> </li>
175   - <li>
176   - <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a>
177   - </li>
178   - <!-- <li>
179   - <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a>
180   - </li> -->
181   - </ul>
182   - </div>
183   - </div>
184   - </div>
185   - </div>
186   - </div>
187   - </div>
188   - <!-- 树 -->
189   - <div class="portlet-body">
  146 + <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点.
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </div>
  151 +
  152 + </div>
  153 +
  154 + <!-- 下行 -->
  155 + <div class="tab-pane fade" id="stationDown" data-direction="1">
  156 + <div class="portlet-body" id="DowntreeMobal" style="display: none">
  157 + <div class="table-toolbar">
  158 + <div class="row">
  159 + <div class="col-md-6" style="float: right;">
  160 + <div class="btn-group" style="float: right;">
  161 + <div class="actions module_tools">
  162 + <div class="btn-group">
  163 + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具
  164 + <i class="fa fa-angle-down"></i>
  165 + </a> -->
  166 + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
  167 + <i class="fa fa-share"></i>
  168 + <span>下行操作</span>
  169 + <i class="fa fa-angle-down"></i>
  170 + </a>
  171 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  172 + <li>
  173 + <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a>
  174 + </li>
  175 + <li class="divider"> </li>
  176 + <!--<li>
  177 + <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a>
  178 + </li>
  179 + <li class="divider"> </li>
  180 + <li>
  181 + <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a>
  182 + </li>
  183 + <li class="divider"> </li>
  184 + <li>
  185 + <a href="javascript:;" id="addDownSection"><i class="fa fa-plus"></i> 添加路段</a>
  186 + </li>
  187 + <li class="divider"> </li>-->
  188 + <li>
  189 + <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a>
  190 + </li>
  191 + <li class="divider"> </li>
  192 + <li>
  193 + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a>
  194 + </li>
  195 + <li class="divider"> </li>
  196 + <li>
  197 + <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a>
  198 + </li>
  199 + <li class="divider"> </li>
  200 + <li>
  201 + <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a>
  202 + </li>
  203 + <!-- <li>
  204 + <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a>
  205 + </li> -->
  206 + </ul>
  207 + </div>
  208 + </div>
  209 + </div>
  210 + </div>
  211 + </div>
  212 + </div>
  213 + <!-- 树 -->
  214 + <div class="portlet-body">
190 215 <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div>
191 216 </div>
192   - </div>
193   - <!-- 无上行站点添加方式 -->
194   - <div id="downToolsMobal" class="portlet-body" style="display:none">
195   - <div class="row">
196   - <div class="col-md-6" style="float: right;">
197   - <div class="btn-group" style="float: right;">
198   - <div class="actions">
199   - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
200   - <i class="fa fa-share"></i>
201   - <span>下行规划选择</span>
202   - <i class="fa fa-angle-down"></i>
203   - </a>
204   - <ul class="dropdown-menu pull-right" style="min-width:100px">
205   - <li>
206   - <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a>
207   - </li>
208   - <li class="divider"> </li>
209   - <li>
210   - <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
211   - </li>
212   - </ul>
213   - </div>
214   - </div>
215   - </div>
216   - </div>
217   - <div class="row" style="margin-top: 10px;">
218   - <div class="col-md-12">
219   - <!-- 提示 -->
220   - <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;">
221   - <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点.
222   - </div>
223   - </div>
224   - </div>
225   - </div>
226   - </div>
227   - </div>
228   - </div>
229   - </div>
  217 + </div>
  218 + <!-- 无上行站点添加方式 -->
  219 + <div id="downToolsMobal" class="portlet-body" style="display:none">
  220 + <div class="row">
  221 + <div class="col-md-6" style="float: right;">
  222 + <div class="btn-group" style="float: right;">
  223 + <div class="actions">
  224 + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false">
  225 + <i class="fa fa-share"></i>
  226 + <span>下行规划选择</span>
  227 + <i class="fa fa-angle-down"></i>
  228 + </a>
  229 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  230 + <li>
  231 + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a>
  232 + </li>
  233 + <li class="divider"> </li>
  234 + <li>
  235 + <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
  236 + </li>
  237 + </ul>
  238 + </div>
  239 + </div>
  240 + </div>
  241 + </div>
  242 + <div class="row" style="margin-top: 10px;">
  243 + <div class="col-md-12">
  244 + <!-- 提示 -->
  245 + <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;">
  246 + <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点.
  247 + </div>
  248 + </div>
  249 + </div>
  250 + </div>
  251 + </div>
  252 + </div>
  253 + </div>
  254 + </div>
  255 + </div>
230 256 </div>
231   - </div>
232 257 </div>
233 258 <!-- 线路类 -->
234 259 <script src="/pages/base/stationroute/js/line.js"></script>
... ... @@ -253,4 +278,111 @@
253 278 <!-- reload事件 -->
254 279 <script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script>
255 280 <!-- 事件监听 -->
256   -<script src="/pages/base/stationroute/js/stationroute-list-events.js"></script>
257 281 \ No newline at end of file
  282 +<script src="/pages/base/stationroute/js/stationroute-list-events.js"></script>
  283 +
  284 +<script id="add_draw_polyline-temp" type="text/html">
  285 + <div class="add_road_search_point_wrap ">
  286 + <div class="buffer_edit_body" >
  287 + <div class="_title">绘制路段</div>
  288 + <div class="form-horizontal" id="add_station_form">
  289 + <input type="hidden" value="{{id}}" name="id">
  290 + <input type="hidden" id="bsectionVectorInput"> <!--路段-->
  291 +
  292 + <div class="form-group">
  293 + <div class="col-md-12">
  294 + <input type="text" class="input-medium" name="sectionName" id="sectionNameInput" placeholder="路段名">
  295 + </div>
  296 + </div>
  297 +
  298 + <div class="form-group">
  299 + <div class="col-md-5">
  300 + <span class="draw_polyline_switch"><a>暂停绘制</a></span>
  301 + </div>
  302 + <div class="col-md-6 btns">
  303 + <button class="sbmint-btn btn-sm" id="addSectionSbmintBtn">确定</button>
  304 + <button class="cancel-btn btn-sm" id="addSectionCancelBtn">取消</button>
  305 + </div>
  306 + </div>
  307 + </div>
  308 + </div>
  309 + </div>
  310 +</script>
  311 +
  312 +<script type="text/javascript">
  313 + setTimeout(function () {
  314 + // 百度地图API功能
  315 + function G(id) {
  316 + return document.getElementById(id);
  317 + }
  318 +
  319 + var myMap = WorldsBMap.getmapBValue();
  320 +
  321 + var ac = new BMap.Autocomplete( //建立一个自动完成的对象
  322 + {"input" : "searchInput"
  323 + ,"location" : myMap
  324 + });
  325 +
  326 + ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件
  327 + var str = "";
  328 + var _value = e.fromitem.value;
  329 + var value = "";
  330 + if (e.fromitem.index > -1) {
  331 + value = _value.province + _value.city + _value.district + _value.street + _value.business;
  332 + }
  333 + str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
  334 +
  335 + value = "";
  336 + if (e.toitem.index > -1) {
  337 + _value = e.toitem.value;
  338 + value = _value.province + _value.city + _value.district + _value.street + _value.business;
  339 + }
  340 + str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
  341 + G("searchResultPanel").innerHTML = str;
  342 + });
  343 +
  344 + var myValue;
  345 + ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件
  346 + var _value = e.item.value;
  347 + myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
  348 + G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
  349 +
  350 + setPlace();
  351 + });
  352 +
  353 + function setPlace(){
  354 + // myMap.clearOverlays(); //清除地图上所有覆盖物
  355 + WorldsBMap.clearOtherOverlay();
  356 + function myFun(){
  357 + var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point;
  358 + if(pp) {
  359 + myMap.centerAndZoom(pp, 20);
  360 + myMap.addOverlay(new BMap.Marker(pp)); //添加标注
  361 + } else {
  362 + layer.msg('找不到您输入的位置!')
  363 + }
  364 + }
  365 + var local = new BMap.LocalSearch(myMap, { //智能搜索
  366 + onSearchComplete: myFun
  367 + });
  368 + local.search(myValue);
  369 + }
  370 + $("#searchInput").on('input propertychange change', function () {
  371 + if($("#searchInput").val() != null && $("#searchInput").val() != "")
  372 + $('.search_panel .clear').removeClass('hide');
  373 + else {
  374 + WorldsBMap.clearOtherOverlay();
  375 + $('.search_panel .clear').addClass('hide');
  376 + }
  377 + });
  378 +
  379 + $('.search_panel .clear').on('click',function () {
  380 + WorldsBMap.clearOtherOverlay();
  381 + $("#searchInput").val('');
  382 + $("#searchInput").change();
  383 + });
  384 + $('.search_panel .search_button').on('click',function () {
  385 + myValue = $("#searchInput").val();
  386 + setPlace();
  387 + });
  388 + },1000);
  389 +</script>
258 390 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/station_tabledate.html
... ... @@ -56,8 +56,8 @@
56 56 </div>
57 57 </div>
58 58 <div class="modal-footer">
59   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
60 59 <button type="button" class="btn btn-primary" id="stationTabledatenextButton">确定</button>
  60 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
61 61 </div>
62 62 </div>
63 63 </div>
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
1   -/**
2   - * 内部行车计划对象。
3   - * @constructor
4   - */
5   -var InternalScheduleObj = function(paramObj, lpArray, factory) {
6   - // 参数对象
7   - var _paramObj = paramObj;
8   - // 外部的路牌数组
9   - var _lpArray = lpArray;
10   - // 工厂对象
11   - var _factory = factory;
12   -
13   - //------------------ 初始化方法1,以及计算关联的内部变量 -----------------//
14   - var _qIsUp; // 每一圈是上行开始还是下行开始
15   - var _qCount = 0; // 总的圈数
16   - var _internalLpArray = []; // 内部对象数组
17   - var _aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时)
18   - {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0},
19   - {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0},
20   - {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0},
21   - {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0},
22   - {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0},
23   - {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0},
24   - {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0},
25   - {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0}
26   - ];
27   -
28   - var _fnInitFun1 = function() { // 初始化方法1
29   - console.log("//---------------- 行车计划,初始化方法1 start ----------------//");
30   -
31   - //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
32   -
33   - // 确定_qIsUp,哪个方向的首班车晚就用哪个
34   - _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(
35   - _paramObj.getDownFirstDTimeObj()) ? false : true;
36   - // 上标线开始时间,就是方向的首班车时间
37   - var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
38   - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
39   - var et;
40   - var et_IsUp;
41   - if (_paramObj.getUpLastDtimeObj().isBefore(
42   - _paramObj.getDownLastDTimeObj())) {
43   - et = _paramObj.getDownLastDTimeObj();
44   - et_IsUp = false;
45   - } else {
46   - et = _paramObj.getUpLastDtimeObj();
47   - et_IsUp = true;
48   - }
49   -
50   - //------------------------ 2、计算总共有多少圈 ------------------------//
51   -
52   - // 以开始时间,结束时间,构造上标线用连班班次发车时间
53   - var bcFcsjArrays = []; // 班次发车时间对象数组
54   - var bcArsjArrays = []; // 班次到达时间对象数组
55   - var isUp = _qIsUp; // 方向
56   - var bcCount = 1; // 班次数
57   -
58   - var _kssj = st; // 开始时间
59   - var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时
60   - var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间
61   - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); // 停站时间
62   -
63   - do {
64   - bcFcsjArrays.push(_kssj);
65   - bcArsjArrays.push(_arrsj);
66   -
67   - _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime);
68   - _bcsj = paramObj.calcuTravelTime(_kssj, isUp);
69   - _arrsj = paramObj.addMinute(_kssj, _bcsj);
70   - _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
71   -
72   - bcCount ++;
73   - isUp = !isUp;
74   - } while(_kssj.isBefore(et));
75   - bcCount--; // 因为先做do,所以总的班次要减1
76   - //if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
77   - // // 如果最后一个班次的到达时间超过结束时间,也要去除
78   - // bcFcsjArrays.splice(bcCount - 1, 1);
79   - // bcArsjArrays.splice(bcCount - 1, 1);
80   - // bcCount--;
81   - //}
82   - var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
83   - var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
84   -
85   - // 利用连班数组计算圈数
86   - _qCount = 1; // 前面加1圈,补中标线的班次
87   - _qCount += _qCount_p1;
88   - _qCount += _qCount_p2;
89   -
90   - // 计算最后是不是还要补一圈
91   - if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
92   - if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
93   - // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
94   - // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
95   - if (!_qIsUp == et_IsUp) {
96   - // 一致不用加圈数
97   - } else {
98   - // 不一致需要加圈补最后一个结束时间班次
99   - _qCount ++;
100   - }
101   - } else {
102   - // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
103   - // 不需要在补圈数了
104   - }
105   - }
106   -
107   - //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
108   -
109   - // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中
110   - var i;
111   - for (i = 0; i < _lpArray.length; i++) {
112   - _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp));
113   - }
114   - // 初始化上标线,从第1圈开始
115   - _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory);
116   -
117   - // 以上标线为基础,计算各种班型工时对应的圈数、班次数
118   - var aBcArray = _internalLpArray[0].getBcArray();
119   - aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识
120   -
121   - if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算
122   - aBcArray.splice(aBcArray.length - 1, 1);
123   - }
124   -
125   - // 午饭吃饭时间
126   - var iLTime = _paramObj.fnGetLunchTime();
127   - // 晚饭吃饭时间
128   - var iDTime = _paramObj.fnGetDinnerTime();
129   - // 出场时间
130   - var iOutTime = _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime();
131   - // 进场时间
132   - var iInTime = _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime();
133   - // 例保时间
134   - var iBTime = _paramObj.getLbTime();
135   -
136   - var sum = 0; // 总班次时间
137   - for (i = 0; i < aBcArray.length; i++) {
138   - sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime();
139   - }
140   - sum += iLTime; // 加午饭时间
141   - sum += iDTime; // 加晚饭时间
142   - for (i = 0; i < _aBxDesc.length; i++) {
143   - _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间
144   -
145   - // 计算5休2的班次数(双进出场,4个例保)
146   - if (i == 6) {
147   - _aBxDesc[i].fQCount =
148   - (_aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) /
149   - _aBxDesc[i].fAverTime;
150   - _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
151   - } else { // 进出场,2个例保
152   - _aBxDesc[i].fQCount =
153   - (_aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) /
154   - _aBxDesc[i].fAverTime;
155   - _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
156   - }
157   - }
158   -
159   -
160   - // 在第一个班次之前再添加一个模拟班次,用于中标线的作用
161   - // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除
162   - var iFirstStopTime =
163   - _paramObj.fnCalcuFixedStopNumber(
164   - _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10),
165   - _qIsUp
166   - );
167   - var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime();
168   - var oFlagBc = _factory.createBcObj( // 标记班次
169   - _internalLpArray[0],
170   - "normal",
171   - !_qIsUp,
172   - 1,
173   - _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)),
174   - _paramObj
175   - );
176   - oFlagBc.fnSetDelFlag(true); // 标记了删除记号
177   -
178   - _internalLpArray[0].setBc(0, 1, oFlagBc);
179   -
180   - // 在最后一圈也补上一个或者2个模拟班次,暂时标记,最后需要删除
181   - var aMaxBcIndex = _internalLpArray[0].getMaxBcObjPosition();
182   - if (aMaxBcIndex[0] == _qCount - 1) { // 可能加半圈
183   - oFlagBc = _factory.createBcObj( // 标记班次
184   - _internalLpArray[0],
185   - "normal",
186   - !_qIsUp,
187   - 1,
188   - _paramObj.addMinute(
189   - _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(),
190   - _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()),
191   - _paramObj
192   - );
193   - oFlagBc.fnSetDelFlag(true); // 标记了删除记号
194   - _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc);
195   -
196   - } else { // 加完整的一圈
197   - oFlagBc = _factory.createBcObj( // 标记班次
198   - _internalLpArray[0],
199   - "normal",
200   - _qIsUp,
201   - 1,
202   - _paramObj.addMinute(
203   - _internalLpArray[0].getBc(_qCount - 2, 1).getArrTimeObj(),
204   - _internalLpArray[0].getBc(_qCount - 2, 1).getStopTime()),
205   - _paramObj
206   - );
207   - oFlagBc.fnSetDelFlag(true); // 标记了删除记号
208   - _internalLpArray[0].setBc(_qCount - 1, 0, oFlagBc);
209   -
210   - oFlagBc = _factory.createBcObj( // 标记班次
211   - _internalLpArray[0],
212   - "normal",
213   - !_qIsUp,
214   - 1,
215   - _paramObj.addMinute(
216   - _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(),
217   - _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()),
218   - _paramObj
219   - );
220   - oFlagBc.fnSetDelFlag(true); // 标记了删除记号
221   - _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc);
222   -
223   - }
224   -
225   - console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +
226   - "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm"));
227   - console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") +
228   - "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm"));
229   - console.log("总共计算的圈数:" + _qCount);
230   - console.log("圈的方向isUP:" + _qIsUp);
231   - console.log("班型描述(以下):");
232   - console.log(_aBxDesc);
233   - console.log("所有路牌间隔描述(以下):");
234   - for (i = 0; i < _internalLpArray.length; i++) {
235   - console.log(_internalLpArray[i]._$_aVerticalIntervalTime);
236   - }
237   - console.log("//---------------- 行车计划,初始化方法1 end ----------------//");
238   -
239   - };
240   -
241   - //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//
242   - var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出
243   - var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
244   - var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出
245   - var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
246   -
247   - var _fnInitFun2 = function() { // 初始化方法2
248   - console.log("//---------------- 行车计划,初始化方法2 start ----------------//");
249   -
250   - //------------------------ 1、计算车辆总数 ------------------------//
251   - // 是用高峰上行周转时间除以高峰平均间隔得到的
252   - // 这样算还算合理,车辆不多不少,待以后有新的算法再修正
253   - var iClCount = _paramObj.calcuClzx();
254   -
255   - //------------------------ 2、计算所有路牌的发车在各个圈中的间隔 --------------------//
256   - var i;
257   - var j;
258   - var iBindex = 1;
259   - var iZzsj;
260   - var oLp;
261   - var iC1;
262   - var iC2;
263   -
264   - for (i = 0; i < _qCount - 1; i++) {
265   - while (iBindex <= 1) {
266   - // 每圈每个方向的周转时间不一致,以上标线为主
267   - oLp = _internalLpArray[0];
268   - iZzsj = oLp.getBc(i + 1, iBindex).getFcTimeObj().diff(
269   - oLp.getBc(i, iBindex).getFcTimeObj(), "m"
270   - );
271   -
272   - iC1 = Math.floor(iZzsj / iClCount);
273   - iC2 = iZzsj % iClCount;
274   -
275   - for (j = 0; j < iClCount - iC2; j++) {
276   - oLp = _internalLpArray[j];
277   - oLp.fnSetVerticalIntervalTime(i, iBindex, iC1);
278   - }
279   -
280   - for (j = 0; j < iC2; j++) {
281   - oLp = _internalLpArray[iClCount - iC2 + j];
282   - oLp.fnSetVerticalIntervalTime(i, iBindex, iC1 + 1);
283   - }
284   -
285   - iBindex ++;
286   -
287   - }
288   - iBindex = 0;
289   - }
290   - // 最后一圈没有下一圈的参照,周转时间没发获取,由于都是低谷,所以使用倒数第二圈的间隔最为最后一圈的间隔
291   - for (i = 0; i < _internalLpArray.length; i++) {
292   - oLp = _internalLpArray[i];
293   - oLp.fnSetVerticalIntervalTime(_qCount - 1, 0, oLp.fnGetVerticalIntervalTime(_qCount - 2, 0));
294   - oLp.fnSetVerticalIntervalTime(_qCount - 1, 1, oLp.fnGetVerticalIntervalTime(_qCount - 2, 1));
295   - }
296   -
297   - //------------------------ 3、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
298   -
299   - // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次
300   - // 以这个班次为早高峰起点,全部出车策略
301   - var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
302   - _paramObj.getMPeakStartTimeObj(), true, true);
303   - var qIndex = qbcIndexArray[0]; // 第几圈
304   - var bIndex = qbcIndexArray[1]; // 第几个班次
305   -
306   - for (i = 1; i < _internalLpArray.length; i++) {
307   - _fnGenerateBcAndSetBc(i, qIndex, bIndex);
308   - }
309   -
310   - _approximate_zgfQIndex = qIndex;
311   - _approximate_zgfBIndex = bIndex;
312   -
313   - //------------------------ 4、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
314   -
315   - // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次
316   - // 以这个班次为早高峰起点,全部出车策略
317   - qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
318   - _paramObj.getEPeakStartTimeObj(), true, true);
319   - qIndex = qbcIndexArray[0]; // 第几圈
320   - bIndex = qbcIndexArray[1]; // 第几个班次
321   -
322   - for (i = 1; i < _internalLpArray.length; i++) {
323   - _fnGenerateBcAndSetBc(i, qIndex, bIndex);
324   - }
325   -
326   - _approximate_wgfQIndex = qIndex;
327   - _approximate_wgfBIndex = bIndex;
328   -
329   - console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟");
330   - console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟");
331   - console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出");
332   - console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出");
333   - console.log("//---------------- 行车计划,初始化方法2 end ----------------//");
334   - };
335   -
336   - //----------------------- 初始化方法3,计算连班分班的路牌分布 ----------------//
337   - var _iBx_lb_lpcount; // 连班路牌数
338   - var _iBx_5_2_fb_lpcount; // 5休2分班路牌数
339   - var _iBx_other_fb_lpcount; // 其他分班路牌数
340   -
341   - var _fnInitFun3 = function() { // 初始化方法3
342   - console.log("//---------------- 行车计划,初始化方法3 start ----------------//");
343   -
344   - //--------------------- 1、计算分班连班班型车辆分布数 --------------------//
345   - // 总共车辆数(高峰最大车辆数)
346   - var iCls = _paramObj.calcuClzx();
347   - // 低谷最少配车(连班车数量)
348   - var iDgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx());
349   - // 加班车路牌数(做5休2的路牌数)
350   - var i_5_2_lpes = _paramObj.getJBLpes();
351   -
352   - // 做些简单的验证
353   - if (iCls < iDgminpc) {
354   - alert("总配车数小于低谷最小配车");
355   - throw "总配车数小于低谷最小配车";
356   - }
357   - if (iDgminpc < 2) {
358   - alert("连班路牌小于2,办不到啊");
359   - throw "连班路牌小于2,办不到啊";
360   - }
361   - if (iCls - iDgminpc < i_5_2_lpes) {
362   - alert("总分班路牌数小于加班路牌数");
363   - throw "总分班路牌数小于加班路牌数";
364   - }
365   -
366   - //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20
367   - //while(_paramObj.calcuPeakZzsj() / iDgminpc > 20) {
368   - // iDgminpc ++;
369   - //}
370   - _iBx_lb_lpcount = iDgminpc;
371   -
372   - _iBx_5_2_fb_lpcount = i_5_2_lpes;
373   - _iBx_other_fb_lpcount = iCls - _iBx_lb_lpcount - i_5_2_lpes;
374   -
375   - //------------------------ 2、利用间隔法计算连班路牌分布 --------------------//
376   - var i;
377   - var j;
378   - var iC1 = Math.floor(_internalLpArray.length / _iBx_lb_lpcount);
379   - var iC2 = _internalLpArray.length % _iBx_lb_lpcount;
380   - var iLpIndex;
381   -
382   - for (i = 0; i < _iBx_lb_lpcount - iC2; i++) {
383   - iLpIndex = i * iC1;
384   - _internalLpArray[iLpIndex].setBxLb(true);
385   - _internalLpArray[iLpIndex].setBxDesc("连班");
386   - }
387   - for (j = 0; j < iC2; j++) {
388   - iLpIndex = i * iC1 + j * (iC1 + 1);
389   - _internalLpArray[iLpIndex].setBxLb(true);
390   - _internalLpArray[iLpIndex].setBxDesc("连班");
391   - }
392   -
393   - //------------------------ 3、利用间隔法计算分班班型路牌分布 --------------------//
394   - // 获取分班路牌索引
395   - var aNotLbIndexes = [];
396   - for (i = 0; i < _internalLpArray.length; i++) {
397   - if (!_internalLpArray[i].isBxLb()) {
398   - aNotLbIndexes.push(i);
399   - }
400   - }
401   - // 先5休2分班
402   - iC1 = Math.floor(aNotLbIndexes.length / _iBx_5_2_fb_lpcount);
403   - iC2 = aNotLbIndexes.length % _iBx_5_2_fb_lpcount;
404   -
405   - for (i = 0; i < _iBx_5_2_fb_lpcount - iC2; i++) {
406   - iLpIndex = aNotLbIndexes[i * iC1];
407   - _internalLpArray[iLpIndex].setBxLb(false);
408   - _internalLpArray[iLpIndex].setBxFb(true);
409   - _internalLpArray[iLpIndex].setBxFb5_2(true);
410   - _internalLpArray[iLpIndex].setBxDesc("5休2分班");
411   - }
412   - for (i = 0; i < iC2; i++) {
413   - iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)];
414   - _internalLpArray[iLpIndex].setBxLb(false);
415   - _internalLpArray[iLpIndex].setBxFb(true);
416   - _internalLpArray[iLpIndex].setBxFb5_2(true);
417   - _internalLpArray[iLpIndex].setBxDesc("5休2分班");
418   - }
419   - // 其他分班
420   - for (i = 0; i < aNotLbIndexes.length; i++) {
421   - iLpIndex = aNotLbIndexes[i];
422   - if (!_internalLpArray[iLpIndex].isBxFb5_2()) {
423   - _internalLpArray[iLpIndex].setBxLb(false);
424   - _internalLpArray[iLpIndex].setBxFb(true);
425   - _internalLpArray[iLpIndex].setBxFb5_2(false);
426   - _internalLpArray[iLpIndex].setBxDesc("其他分班");
427   - }
428   - }
429   -
430   - console.log("高峰周转时间:" + _paramObj.calcuPeakZzsj());
431   - console.log("连班路牌数:" + _iBx_lb_lpcount);
432   - console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount);
433   - console.log("其他分班路牌数:" + _iBx_other_fb_lpcount);
434   - var aLbIndexes = [];
435   - for (i = 0; i < _internalLpArray.length; i++) {
436   - if (_internalLpArray[i].isBxLb()) {
437   - aLbIndexes.push(i);
438   - }
439   - }
440   - console.log("连班路牌indexes=" + aLbIndexes);
441   - var a_5_2_fbIndexes = [];
442   - for (i = 0; i < _internalLpArray.length; i++) {
443   - if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) {
444   - a_5_2_fbIndexes.push(i);
445   - }
446   - }
447   - console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes);
448   - var a_other_fbIndexes = [];
449   - for (i = 0; i < _internalLpArray.length; i++) {
450   - if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) {
451   - a_other_fbIndexes.push(i);
452   - }
453   - }
454   - console.log("其他分班路牌indexes=" + a_other_fbIndexes);
455   -
456   - console.log("//---------------- 行车计划,初始化方法3 end ----------------//");
457   - };
458   -
459   - //----------------------- 初始化方法4,计算中标线位置 -------------------------//
460   - var _iZbx_lpIndex; // 中标线对应第几个路牌
461   -
462   - var _fnInitFun4 = function() { // 初始化方法4
463   - console.log("//---------------- 行车计划,初始化方法4 start ----------------//");
464   -
465   - //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------//
466   - // 构造中标线
467   - // 中标线开始时间,就是方向的首班车时间
468   - var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
469   - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
470   - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
471   - var oEt;
472   - if (_paramObj.getUpLastDtimeObj().isBefore(
473   - _paramObj.getDownLastDTimeObj())) {
474   - oEt = _paramObj.getDownLastDTimeObj();
475   - } else {
476   - oEt = _paramObj.getUpLastDtimeObj();
477   - }
478   -
479   - var oTempLp = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp);
480   - oTempLp.initDataFromTimeToTime(
481   - oSt,
482   - oEt,
483   - !_qIsUp,
484   - 0,
485   - _paramObj,
486   - _factory
487   - );
488   -
489   - //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------//
490   - // 找出中标线对应的早高峰的班次对象
491   - var oZb_gf_bc = oTempLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
492   - //alert(oZb_gf_bc.getFcTimeObj().format("HH:mm"));
493   -
494   - // 把所有连班路牌高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
495   - // 中标线和上标线一样在连班路牌上
496   - var aTempq = [];
497   - var oTempq;
498   - var oTempb;
499   - var i;
500   - var oLp;
501   -
502   - var aLbIndexes = []; // 连班的路牌索引
503   - for (i = 0; i < _internalLpArray.length; i++) {
504   - if (_internalLpArray[i].isBxLb()) {
505   - aLbIndexes.push(i);
506   - }
507   - }
508   -
509   - for (i = 0; i < aLbIndexes.length; i++) {
510   - oLp = _internalLpArray[aLbIndexes[i]];
511   -
512   - oTempb = oLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
513   - if (oTempb.isUp() == _qIsUp) {
514   - oTempq = new InternalGroupObj(oLp, _qIsUp, oTempb, undefined);
515   - } else {
516   - oTempq = new InternalGroupObj(oLp, _qIsUp, undefined, oTempb);
517   - }
518   - aTempq.push(oTempq);
519   -
520   - }
521   -
522   - var aTtindex = oTempLp.fnGetQBcIndexWithFcTimeFromGroupArray( // 找出最接近中标线的路牌索引
523   - oZb_gf_bc.getFcTimeObj(),
524   - aTempq,
525   - true,
526   - true
527   - );
528   -
529   - _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌
530   -
531   - oTempLp.getMinBcObj().fnSetIsFirstBc(true); // 设置首班班次标识
532   -
533   - if (_iZbx_lpIndex == 0) { // 如果中标线和上标线一致
534   - var oFirstBcIndexes = oTempLp.getMinBcObjPosition();
535   - var oFirstBc = oTempLp.getMinBcObj();
536   - oFirstBc.setLp(_internalLpArray[_iZbx_lpIndex]);
537   - oFirstBc.fnSetDelFlag(false);
538   - _internalLpArray[_iZbx_lpIndex].setBc(oFirstBcIndexes[0], oFirstBcIndexes[1], oFirstBc);
539   - } else {
540   - oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象
541   - oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔
542   - oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb());
543   - oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb());
544   - oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2());
545   -
546   - // 修正除了第一个班次外,其余其他班次
547   - var iBcindex = 0;
548   - for (i = 1; i < _qCount; i++) {
549   - while (iBcindex <= 1) {
550   - if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次
551   - oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex));
552   - }
553   - iBcindex ++;
554   - }
555   - iBcindex = 0;
556   - }
557   -
558   - _internalLpArray[_iZbx_lpIndex] = oTempLp;
559   - }
560   -
561   - console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌");
562   -
563   - console.log("//---------------- 行车计划,初始化方法4 end ----------------//");
564   - };
565   -
566   - //-------------------- 重要的内部方法 -----------------------//
567   - /**
568   - * 核心方法,利用路牌间隔纵向生成班次。
569   - * @param iLpindex 路牌索引
570   - * @param iQindex 圈索引
571   - * @param iBcindex 班次索引
572   - * @returns object InternalBcObj,失败 false
573   - */
574   - var _fnGenerateBc = function(iLpindex, iQindex, iBcindex) {
575   - // 以上标线为起始点,使用路牌在不同圈,班次索引的发车间隔,计算班次
576   - // 注意,发车间隔是指下一个班次应该距离当前班次间隔,是从下往上的
577   -
578   - // 1、参数验证
579   - if (iLpindex == 0) { // 上标线的班次不需要生成
580   - return false;
581   - }
582   -
583   - // 2、计算间隔
584   - var i;
585   - var oLp;
586   - var iTime = 0;
587   - for (i = 0; i < iLpindex; i++) {
588   - oLp = _internalLpArray[i];
589   - iTime += oLp.fnGetVerticalIntervalTime(iQindex, iBcindex);
590   - }
591   -
592   - // 3、生成班次
593   - var _oKsbc = _internalLpArray[0].getBc(iQindex, iBcindex);
594   - if (!_oKsbc) {
595   - return false;
596   - }
597   - var _oKssj = _paramObj.addMinute(_oKsbc.getFcTimeObj(), iTime);
598   - var _oBc = _factory.createBcObj(
599   - _internalLpArray[iLpindex],
600   - "normal", _oKsbc.isUp(),
601   - 1, _oKssj, _paramObj);
602   -
603   - return _oBc;
604   -
605   - };
606   -
607   - /**
608   - * 核心方法,在指定位置生成班次并添加到路牌指定位置中。
609   - * @param lpIndex 第几个路牌
610   - * @param qIndex 第几圈
611   - * @param bcIndex 第几个班次
612   - */
613   - var _fnGenerateBcAndSetBc = function(lpIndex, qIndex, bcIndex) {
614   - var _bcObj = _fnGenerateBc(lpIndex, qIndex, bcIndex);
615   - if (_bcObj) {
616   - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
617   - }
618   - };
619   -
620   - /**
621   - * 获取班次列表。
622   - * @param oIsUp 是否上行
623   - * @param oStartTime 开始时间对象
624   - * @returns [(InternalBcObj)]
625   - */
626   - var _fnGetBcList2 = function(oIsUp, oStartTime) {
627   - var i;
628   - var j;
629   - var oLp;
630   - var oBc;
631   - var aBc = [];
632   -
633   - for (j = 0; j < _qCount; j++) {
634   - for (i = 0; i < _internalLpArray.length; i++) {
635   - oLp = _internalLpArray[i];
636   - oBc = oLp.getBc(
637   - j,
638   - _qIsUp == oIsUp ? 0 : 1
639   - );
640   - if (oBc && oBc.getFcTimeObj().isAfter(oStartTime)) {
641   - aBc.push(oBc);
642   - }
643   - }
644   - }
645   -
646   - var aBcFcTime = [];
647   - for (i = 0; i < aBc.length; i++) {
648   - oBc = aBc[i];
649   - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
650   - }
651   - console.log((oIsUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
652   -
653   - return aBc;
654   - };
655   -
656   - /**
657   - * 获取班次列表。
658   - * @param isUp boolean 是否上行
659   - * @returns [(InternalBcObj)]
660   - */
661   - var _fnGetBcList = function(isUp) {
662   - var i;
663   - var j;
664   - var oLp;
665   - var oBc;
666   - var aBc = [];
667   -
668   - for (j = 0; j < _qCount; j++) {
669   - for (i = 0; i < _internalLpArray.length; i++) {
670   - oLp = _internalLpArray[i];
671   - oBc = oLp.getBc(
672   - j,
673   - _qIsUp == isUp ? 0 : 1
674   - );
675   - if (oBc) {
676   - aBc.push(oBc);
677   - }
678   - }
679   - }
680   -
681   - var aBcFcTime = [];
682   - for (i = 0; i < aBc.length; i++) {
683   - oBc = aBc[i];
684   - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
685   - }
686   - console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
687   -
688   - return aBc;
689   - };
690   -
691   - /**
692   - * 查找离指定时间最近的前面的班次索引信息
693   - * @param timeObj 查找时间
694   - * @param isUp 是否上行
695   - * @returns [{路牌index},{圈index},{班次index}]
696   - */
697   - var _fnFindUpClosedBcIndexWithTime = function(timeObj, isUp) {
698   -
699   - var _lpObj;
700   - var _groupObj;
701   - var _bcObj;
702   - var _i;
703   - var _j;
704   - var timediff; // 时间差取绝对值
705   -
706   - var _lpIndex;
707   - var _up_qIndex;
708   - var _up_bIndex;
709   -
710   - for (_i = 0; _i < _qCount; _i++) {
711   - for (_j = 0; _j < _internalLpArray.length; _j++) {
712   - _lpObj = _internalLpArray[_j];
713   - _groupObj = _lpObj.getGroup(_i);
714   - _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
715   - if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
716   - _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
717   - }
718   - if (_bcObj) {
719   - if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) {
720   - if (!timediff) {
721   - timediff = timeObj.diff(_bcObj.getFcTimeObj());
722   - _lpIndex = _j;
723   - _up_qIndex = _i;
724   - _up_bIndex = isUp == _qIsUp ? 0 : 1;
725   - } else {
726   - if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) {
727   - timediff = timeObj.diff(_bcObj.getFcTimeObj());
728   - _lpIndex = _j;
729   - _up_qIndex = _i;
730   - _up_bIndex = isUp == _qIsUp ? 0 : 1;
731   - }
732   - }
733   - }
734   - }
735   - }
736   - }
737   -
738   - if (_lpIndex == undefined) {
739   - return false;
740   - }
741   -
742   - var bcindex = [];
743   - bcindex.push(_lpIndex);
744   - bcindex.push(_up_qIndex);
745   - bcindex.push(_up_bIndex);
746   -
747   - return bcindex;
748   - };
749   -
750   - /**
751   - * 查找离指定时间最近的后面的班次索引信息
752   - * @param timeObj 查找时间
753   - * @param isUp 是否上行
754   - * @returns [{路牌index},{圈index},{班次index}]
755   - */
756   - var _fnFindDownClosedBcIndexWithTime = function(timeObj, isUp) {
757   - var _lpObj;
758   - var _groupObj;
759   - var _bcObj;
760   - var _i;
761   - var _j;
762   - var timediff; // 时间差取绝对值
763   -
764   - var _lpIndex;
765   - var _down_qIndex;
766   - var _down_bIndex;
767   -
768   - var flag;
769   -
770   - for (_i = 0; _i < _qCount; _i++) {
771   - for (_j = 0; _j < _internalLpArray.length; _j++) {
772   - _lpObj = _internalLpArray[_j];
773   - _groupObj = _lpObj.getGroup(_i);
774   - // TODO:bug
775   - _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
776   - if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
777   - _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
778   - }
779   - if (_bcObj) {
780   - //console.log("timeobj -> bcobj diff flag " +
781   - // timeObj.format("HH:mm") + "->" +
782   - // _bcObj.getFcTimeObj().format("HH:mm") +
783   - // timeObj.diff(_bcObj.getFcTimeObj()) +
784   - // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0)
785   - //);
786   -
787   - flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0;
788   -
789   - if (flag) {
790   - if (!timediff) {
791   - timediff = timeObj.diff(_bcObj.getFcTimeObj());
792   - _lpIndex = _j;
793   - _down_qIndex = _i;
794   - _down_bIndex = isUp == _qIsUp ? 0 : 1;
795   - } else {
796   - if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) {
797   - timediff = timeObj.diff(_bcObj.getFcTimeObj());
798   - _lpIndex = _j;
799   - _down_qIndex = _i;
800   - _down_bIndex = isUp == _qIsUp ? 0 : 1;
801   - }
802   - }
803   - }
804   - }
805   - }
806   - }
807   -
808   - if (_lpIndex == undefined) {
809   - return false;
810   - }
811   -
812   - var bcindex = [];
813   - bcindex.push(_lpIndex);
814   - bcindex.push(_down_qIndex);
815   - bcindex.push(_down_bIndex);
816   -
817   - return bcindex;
818   - };
819   -
820   - /**
821   - * 获取班次索引。
822   - * @param oBc 班次对象
823   - * @returns [{路牌索引},{圈索引},{班次索引}]
824   - */
825   - var _fnGetBcIndex = function(oBc) {
826   - // 路牌索引
827   - var i;
828   - var iLpIndex;
829   - for (i = 0; i < _internalLpArray.length; i++) {
830   - if (_internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
831   - iLpIndex = i;
832   - break;
833   - }
834   - }
835   - // 圈索引
836   - var j;
837   - var iGroupIndex;
838   - var bFlag = false;
839   - for (i = 0; i < _internalLpArray.length; i++) {
840   - if (bFlag) {
841   - break;
842   - }
843   - for (j = 0; j < _qCount; j++) {
844   - if (_internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
845   - iGroupIndex = j;
846   - bFlag = true;
847   - break;
848   - }
849   - }
850   - }
851   - // 班次索引
852   - var iBcIndex = _qIsUp == oBc.isUp() ? 0 : 1;
853   -
854   - if (iLpIndex == undefined) {
855   - return null;
856   - } else {
857   - return [].concat(iLpIndex, iGroupIndex, iBcIndex);
858   - }
859   -
860   - };
861   -
862   - return {
863   - //------------- 布局初始化方法 ------------//
864   - /**
865   - * 初始化数据,使用标线初始化
866   - */
867   - fnInitDataWithBxLayout: function() {
868   - // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中
869   - _fnInitFun1();
870   - // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次,计算路牌在各个圈中的间隔
871   - _fnInitFun2();
872   - // 初始化布局3,计算连班分班路牌分布
873   - _fnInitFun3();
874   - // 初始化布局4,计算中标线位置
875   - _fnInitFun4();
876   -
877   - },
878   -
879   - /**
880   - * 调整高峰班次,
881   - * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间
882   - * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后
883   - * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的)
884   - * @param isZgf 是否早高峰
885   - * @param isUp 是否上行
886   - */
887   - fnAdjustGfbc : function(isZgf, isUp) {
888   - var oStartTime; // 开始时间
889   - var oEndTime; // 结束时间
890   - var aStartBcIndex; // 开始班次索引
891   - var aEndBcIndex; // 结束班次索引
892   -
893   - oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj();
894   - oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj();
895   -
896   - aStartBcIndex = _fnFindUpClosedBcIndexWithTime(oStartTime, isUp);
897   - aEndBcIndex = _fnFindDownClosedBcIndexWithTime(oEndTime, isUp);
898   -
899   - var iLpIndex;
900   - var iQIndex;
901   - var iBcIndex;
902   - var iQInternelCount; // 高峰时间段中间包含的圈数
903   - var i;
904   - var j;
905   -
906   - var oLp;
907   -
908   - if (aStartBcIndex && aEndBcIndex) {
909   - iLpIndex = aStartBcIndex[0];
910   - iQIndex = aStartBcIndex[1];
911   - iBcIndex = aStartBcIndex[2];
912   -
913   - // 处理头
914   - // 删除头部多余班次
915   - for (j = 0; j < iLpIndex; j++) {
916   - oLp = _internalLpArray[j];
917   - if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) {
918   - oLp.removeBc(iQIndex, iBcIndex);
919   - }
920   - }
921   -
922   - for (j = iLpIndex; j < _internalLpArray.length; j++) {
923   - oLp = _internalLpArray[j];
924   - if (!oLp.getBc(iQIndex, iBcIndex)) {
925   - _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex);
926   - }
927   - }
928   -
929   - // 处理中间
930   - iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1;
931   - for (i = 1; i <= iQInternelCount; i++) {
932   - oLp = _internalLpArray[iQIndex + i];
933   -
934   - if (!oLp.getBc(iQIndex + i, iBcIndex)) {
935   - _fnGenerateBcAndSetBc(i, iQIndex + i, iBcIndex);
936   - }
937   - }
938   -
939   - // 处理尾部
940   - iLpIndex = aEndBcIndex[0];
941   - iQIndex = aEndBcIndex[1];
942   - iBcIndex = aEndBcIndex[2];
943   -
944   - // 删除尾部多余的班次
945   - for (j = iLpIndex; j < _internalLpArray.length; j++) {
946   - oLp = _internalLpArray[j];
947   - if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) {
948   - oLp.removeBc(iQIndex, iBcIndex);
949   - }
950   - }
951   -
952   - if (aStartBcIndex[1] != aEndBcIndex[1]) { // 指定时间范围跨圈
953   - for (j = 0; j < iLpIndex; j++) {
954   - oLp = _internalLpArray[j];
955   - if (!oLp.getBc(iQIndex, iBcIndex)) {
956   - _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex);
957   - }
958   - }
959   - } else {
960   - // 不跨圈,不用处理,处理头的时候已经加了
961   - }
962   -
963   - }
964   -
965   - },
966   -
967   - /**
968   - * 按照营运时间要求补充班次,
969   - * 早高峰7:45分以前出场运营,
970   - * 晚高峰16:10分以前出场运营
971   - */
972   - fnCalcuLpBc_yy: function() {
973   - // 补班次的时候,针对的是分班班型
974   - var i;
975   - var _oLp;
976   - var _oBc;
977   - var _aMinBcIndex;
978   - var _aMaxBcIndex;
979   -
980   - var _qIndex;
981   - var _bIndex;
982   -
983   - var _zgfCDate = _paramObj.toTimeObj("7:45");
984   - var _wgfCDate = _paramObj.toTimeObj("16:10");
985   - var _ccsj;
986   -
987   - for (i = 0; i < _internalLpArray.length; i++) {
988   - _oLp = _internalLpArray[i];
989   - if (_oLp.isBxFb()) { // 分班路牌
990   - // 早高峰部分
991   - _aMinBcIndex = _oLp.getMinBcObjPosition();
992   - _qIndex = _aMinBcIndex[0];
993   - _bIndex = _aMinBcIndex[1];
994   - _oBc = _oLp.getBc(_qIndex, _bIndex);
995   - if (_qIsUp) {
996   - _ccsj = _bIndex == 0 ?
997   - _paramObj.getUpOutTime() :
998   - _paramObj.getDownOutTime();
999   - } else {
1000   - _ccsj = _bIndex == 0 ?
1001   - _paramObj.getDownOutTime() :
1002   - _paramObj.getUpOutTime();
1003   - }
1004   - if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) {
1005   - _fnGenerateBcAndSetBc(
1006   - i,
1007   - _bIndex == 0 ? _qIndex - 1 : _qIndex,
1008   - _bIndex == 0 ? 1 : 0
1009   - )
1010   - }
1011   -
1012   - // 晚高峰部分
1013   - _aMaxBcIndex = _oLp.getMaxBcObjPosition();
1014   - _qIndex = _aMaxBcIndex[0];
1015   - _bIndex = _aMaxBcIndex[1];
1016   - _oBc = _oLp.getBc(
1017   - _bIndex == 0 ? _qIndex - 1 : _qIndex,
1018   - _bIndex == 0 ? 1 : 0
1019   - );
1020   - if (!_oBc) { // 前一个班次不存在,再判定加不加
1021   - _oBc = _oLp.getBc(_qIndex, _bIndex);
1022   - if (_qIsUp) {
1023   - _ccsj = _bIndex == 0 ?
1024   - _paramObj.getUpOutTime() :
1025   - _paramObj.getDownOutTime();
1026   - } else {
1027   - _ccsj = _bIndex == 0 ?
1028   - _paramObj.getDownOutTime() :
1029   - _paramObj.getUpOutTime();
1030   - }
1031   - if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) {
1032   - _fnGenerateBcAndSetBc(
1033   - i,
1034   - _bIndex == 0 ? _qIndex - 1 : _qIndex,
1035   - _bIndex == 0 ? 1 : 0
1036   - )
1037   - }
1038   - }
1039   - }
1040   - }
1041   - },
1042   -
1043   - /**
1044   - * 补充做5休2的班型班次。
1045   - * 1、确认5_2班型大致多少圈(小数点过.7进位)
1046   - * 2、获取当前5_2两端车次链的信息,每段的班次数目,还差几个班次没加
1047   - * 3、如果前面的车次链班次少,则从前面的车次链开始加
1048   - * 4、如果车次链班次数一样,从从后面的车次链开始加
1049   - * 5、加班次时都是往车次链前方加
1050   - * 6、如果前面车次链不能再加班次了,从后面车次链加
1051   - */
1052   - fnCalcuLpBx_5_2: function() {
1053   - // 计算做5休2班型所需的班次数
1054   - var iBxBcount = _aBxDesc[6].fBcCount;
1055   - if (iBxBcount - Math.floor(iBxBcount) > 0.7) {
1056   - iBxBcount = Math.floor(iBxBcount) + 1;
1057   - } else {
1058   - iBxBcount = Math.floor(iBxBcount);
1059   - }
1060   -
1061   - var i;
1062   - var j;
1063   - var oLp;
1064   - var iAddBcCount;
1065   - var oBcChain1;
1066   - var oBcChain2;
1067   - var iQindex;
1068   - var iBindex;
1069   -
1070   - for (i = 0; i < _internalLpArray.length; i++) {
1071   - oLp = _internalLpArray[i];
1072   - if (oLp.isBxFb5_2()) {
1073   - iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数
1074   - for (j = 1; j <= iAddBcCount; j++) {
1075   - oBcChain1 = oLp.fnGetBcChainInfo(0);
1076   - oBcChain2 = oLp.fnGetBcChainInfo(1);
1077   -
1078   - if (oBcChain1.bcount < oBcChain2.bcount) {
1079   - iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q;
1080   - iBindex = oBcChain1.s_b == 0 ? 1 : 0;
1081   - // 往车次链往前不能加,就往后加
1082   - if (_fnGenerateBc(i, iQindex, iBindex)) {
1083   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1084   - } else {
1085   - iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1;
1086   - iBindex = oBcChain1.e_b == 0 ? 1 : 0;
1087   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1088   - }
1089   -
1090   - } else if (oBcChain1.bcount > oBcChain2.bcount) {
1091   - iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q;
1092   - iBindex = oBcChain2.s_b == 0 ? 1 : 0;
1093   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1094   - } else {
1095   - iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q;
1096   - iBindex = oBcChain2.s_b == 0 ? 1 : 0;
1097   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1098   - }
1099   - }
1100   - }
1101   - }
1102   -
1103   - },
1104   -
1105   - /**
1106   - * 补其他分班班型班次。
1107   - * 从车次链的后面开始加
1108   - */
1109   - fnCalcuLpBx_other: function() {
1110   - // TODO:根据上标线的首班时间确定班型,小于05:59的做一休一,否则做二休一
1111   - var oSt = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
1112   - var iBxIndex = 4;
1113   - if (oSt.isBefore(_paramObj.toTimeObj("05:59"))) {
1114   - iBxIndex = 5;
1115   - }
1116   - // 计算做5休2班型所需的班次数
1117   - var iQBcount = _aBxDesc[iBxIndex].fQCount;
1118   - var iBxBcount = Math.round(iQBcount) * 2;
1119   -
1120   - var i;
1121   - var j;
1122   - var oLp;
1123   - var iAddBcCount;
1124   - var oBcChain1;
1125   - var oBcChain2;
1126   - var iQindex;
1127   - var iBindex;
1128   -
1129   - for (i = 0; i < _internalLpArray.length; i++) {
1130   - oLp = _internalLpArray[i];
1131   - if (oLp.isBxFb() && !oLp.isBxFb5_2()) {
1132   - iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数
1133   - for (j = 1; j <= iAddBcCount; j++) {
1134   - oBcChain1 = oLp.fnGetBcChainInfo(0);
1135   - oBcChain2 = oLp.fnGetBcChainInfo(1);
1136   -
1137   - if (oBcChain1.bcount < oBcChain2.bcount) {
1138   - iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1;
1139   - iBindex = oBcChain1.e_b == 0 ? 1 : 0;
1140   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1141   - } else if (oBcChain1.bcount > oBcChain2.bcount) {
1142   - iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1;
1143   - iBindex = oBcChain2.e_b == 0 ? 1 : 0;
1144   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1145   - } else {
1146   - iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1;
1147   - iBindex = oBcChain2.e_b == 0 ? 1 : 0;
1148   - _fnGenerateBcAndSetBc(i, iQindex, iBindex);
1149   - }
1150   - }
1151   - }
1152   - }
1153   -
1154   - },
1155   -
1156   - /**
1157   - * 补充连班路牌班次。
1158   - * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢
1159   - * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢
1160   - */
1161   - fnCalcuLpBx_lb: function() {
1162   - // 补充连班的班次,参照上标线,中标线补充不足的班次
1163   -
1164   - var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引
1165   - var i;
1166   - for (i = 0; i < _internalLpArray.length; i++) {
1167   - if (_internalLpArray[i].isBxLb() && i != 0 && i != _iZbx_lpIndex) {
1168   - aLbLpindexes.push(i);
1169   - }
1170   - }
1171   -
1172   - var oEndsj = // 结束时间
1173   - _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ?
1174   - _paramObj.getDownLastDTimeObj() :
1175   - _paramObj.getUpLastDtimeObj();
1176   -
1177   - var oLp;
1178   - var aMinbcPos;
1179   - var oBc;
1180   - var j;
1181   - var iTempBcIndex;
1182   -
1183   - // 1、从最小班次开始,往后补充班次
1184   - for (i = 0; i < aLbLpindexes.length; i++) {
1185   - oLp = _internalLpArray[aLbLpindexes[i]];
1186   -
1187   - // 最小班次索引
1188   - aMinbcPos = oLp.getMinBcObjPosition();
1189   - // 使用纵向分隔补充班次,从最小班次向后补
1190   - iTempBcIndex = aMinbcPos[1] == 0 ? 1 : 0;
1191   - j = iTempBcIndex == 0 ? aMinbcPos[0] + 1 : aMinbcPos[0];
1192   -
1193   - while (j < _qCount) {
1194   - while (iTempBcIndex <= 1) {
1195   - oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex);
1196   - if (oBc &&
1197   - oBc.getFcTimeObj().isBefore(oEndsj) ) {
1198   - oLp.setBc(j, iTempBcIndex, oBc);
1199   - }
1200   - iTempBcIndex++;
1201   - }
1202   - iTempBcIndex = 0;
1203   - j++;
1204   - }
1205   -
1206   - }
1207   -
1208   - // 2、上标线中标线之间的路牌,从最小的班次往前补充班次
1209   -
1210   - // 还要补充缺失的班次,差上标线几个班次要往前补上
1211   - var iBccount;
1212   - var iQindex;
1213   - var iBindex;
1214   - // 补上标线到中标线之间的连班路牌的班次
1215   - for (i = 0; i < aLbLpindexes.length; i++) {
1216   - if (aLbLpindexes[i] > 0 && aLbLpindexes[i] < _iZbx_lpIndex) {
1217   - oLp = _internalLpArray[aLbLpindexes[i]];
1218   - aMinbcPos = oLp.getMinBcObjPosition();
1219   - iQindex = aMinbcPos[0];
1220   - iBindex = aMinbcPos[1];
1221   - iBccount = (iQindex - 1) * 2 + iBindex; // 距离上标线起始站点差几个班次
1222   - for (j = 0; j < iBccount; j++) {
1223   - if (iBindex == 0) {
1224   - iQindex --;
1225   - iBindex = 1;
1226   - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
1227   - } else if (iBindex == 1) {
1228   - iBindex --;
1229   - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
1230   - }
1231   - }
1232   -
1233   - }
1234   -
1235   - }
1236   -
1237   - // 3、中标线之后的路牌,从最小的班次往前补充班次
1238   -
1239   - // 补中标线以下的连班路牌的班次
1240   - for (i = 0; i < aLbLpindexes.length; i++) {
1241   - if (aLbLpindexes[i] > _iZbx_lpIndex) {
1242   - oLp = _internalLpArray[aLbLpindexes[i]];
1243   - aMinbcPos = oLp.getMinBcObjPosition();
1244   - iQindex = aMinbcPos[0];
1245   - iBindex = aMinbcPos[1];
1246   - iBccount = (iQindex - 0) * 2 + iBindex - 1; // 距离上标线起始站点差几个班次
1247   - for (j = 0; j < iBccount; j++) {
1248   - if (iBindex == 0) {
1249   - iQindex --;
1250   - iBindex = 1;
1251   - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
1252   - } else if (iBindex == 1) {
1253   - iBindex --;
1254   - _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
1255   - }
1256   - }
1257   - }
1258   - }
1259   -
1260   - },
1261   -
1262   - /**
1263   - * 计算末班车。
1264   - * 1、将上下行拉成上下行两个班次列表(包括标记班次)
1265   - * 2、分别找出离末班车发车时间最近的班次,并替换时间
1266   - * 3、删除之后的班次
1267   - */
1268   - fnCalcuLastBc: function() {
1269   - var i;
1270   - var iTimeDiff;
1271   - var iTempTime;
1272   - var aBc;
1273   - var oLastBcTime;
1274   - var oLastBcIsUp;
1275   - var iModifyIndex;
1276   -
1277   - // 查找末班车早的末班车时间和方向
1278   - if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
1279   - oLastBcTime = _paramObj.getUpLastDtimeObj();
1280   - oLastBcIsUp = true;
1281   - } else {
1282   - oLastBcTime = _paramObj.getDownLastDTimeObj();
1283   - oLastBcIsUp = false;
1284   - }
1285   -
1286   - // 确定早的末班车时间
1287   - aBc = _fnGetBcList(oLastBcIsUp);
1288   - for (i = 0; i < aBc.length; i++) {
1289   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
1290   - if (iTimeDiff == undefined) {
1291   - iTimeDiff = iTempTime;
1292   - iModifyIndex = i;
1293   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
1294   - iTimeDiff = iTempTime;
1295   - iModifyIndex = i;
1296   - }
1297   - }
1298   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
1299   - aBc[iModifyIndex].fnSetDelFlag(false);
1300   - aBc[iModifyIndex].fnSetIsLastBc(true);
1301   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
1302   - _qIsUp == oLastBcIsUp ?
1303   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
1304   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
1305   - }
1306   -
1307   - // 查找末班车晚的末班车时间和方向
1308   - if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
1309   - oLastBcTime = _paramObj.getDownLastDTimeObj();
1310   - oLastBcIsUp = false;
1311   - } else {
1312   - oLastBcTime = _paramObj.getUpLastDtimeObj();
1313   - oLastBcIsUp = true;
1314   - }
1315   - // 确定晚的末班车时间
1316   - aBc = _fnGetBcList(oLastBcIsUp);
1317   - var oBc;
1318   - var aBcIndex;
1319   - var iLpIndex;
1320   - var iQIndex;
1321   - var iBcIndex;
1322   -
1323   - iTimeDiff = undefined;
1324   - for (i = 0; i < aBc.length; i++) {
1325   - oBc = aBc[i];
1326   - aBcIndex = _fnGetBcIndex(oBc);
1327   -
1328   - iLpIndex = aBcIndex[0];
1329   - iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
1330   - iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
1331   -
1332   - if (!_internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
1333   - continue;
1334   - }
1335   -
1336   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
1337   - if (iTimeDiff == undefined) {
1338   - iTimeDiff = iTempTime;
1339   - iModifyIndex = i;
1340   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
1341   - iTimeDiff = iTempTime;
1342   - iModifyIndex = i;
1343   - }
1344   - }
1345   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
1346   - aBc[iModifyIndex].fnSetDelFlag(false);
1347   - aBc[iModifyIndex].fnSetIsLastBc(true);
1348   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
1349   - _qIsUp == oLastBcIsUp ?
1350   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
1351   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
1352   - }
1353   -
1354   - },
1355   -
1356   - /**
1357   - * 添加吃饭班次。
1358   - */
1359   - fnCalcuEatBc: function() {
1360   - // 吃午饭时间范围,10:15 到 12:15
1361   - // 吃晚饭时间范围,18:00 到 19:00
1362   -
1363   - if (!_paramObj.fnIsEat()) {
1364   - return;
1365   - }
1366   -
1367   - // 午饭index
1368   - var aLEIndex;
1369   - // 晚饭index
1370   - var aDEIndex;
1371   -
1372   - // 所有吃饭都默认在一个方向,两个方向暂时不考虑
1373   - if (_paramObj.fnIsUpEat()) {
1374   - aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false);
1375   - aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), true, false);
1376   - } else {
1377   - aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), false, true);
1378   - aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), false, true);
1379   - }
1380   -
1381   - // 午饭第几圈,第几个班次
1382   - var iLEQIndex = aLEIndex[0];
1383   - var iLEBIndex = aLEIndex[1];
1384   - // 晚饭第几圈,第几个班次
1385   - var iDEQIndex = aDEIndex[0];
1386   - var iDEBIndex = aDEIndex[1];
1387   -
1388   - // 注意,本模型只有连班才有吃饭
1389   -
1390   - var i;
1391   - var oLp;
1392   - var aLbIndex = []; // 连班班型的路牌索引
1393   - for (i = 0; i < _internalLpArray.length; i++) {
1394   - oLp = _internalLpArray[i];
1395   - if (oLp.isBxLb()) {
1396   - aLbIndex.push(i);
1397   - }
1398   - }
1399   -
1400   - var iLTime;
1401   - var iDtime;
1402   - var j;
1403   - for (i = 0; i < aLbIndex.length; i++) {
1404   - oLp = _internalLpArray[aLbIndex[i]];
1405   -
1406   - // 午饭
1407   - iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj);
1408   - // 晚饭
1409   - iDtime = oLp.fnAddEatBc(iDEQIndex, iDEBIndex, _factory, _paramObj);
1410   -
1411   - if (i == aLbIndex.length - 1) {
1412   - for (j = aLbIndex[i]; j < _internalLpArray.length; j++) {
1413   - oLp = _internalLpArray[j];
1414   - if (oLp.isBxFb()) { // 5休2班型不调整
1415   - // 修正午饭之后路牌班次的发车时间
1416   - oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime);
1417   - oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime);
1418   - }
1419   - }
1420   - } else {
1421   - for (j = aLbIndex[i]; j < aLbIndex[i + 1]; j++) {
1422   - oLp = _internalLpArray[j];
1423   - if (oLp.isBxFb()) {
1424   - // 修正午饭之后路牌班次的发车时间
1425   - oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime);
1426   - oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime);
1427   - }
1428   - }
1429   - }
1430   - }
1431   -
1432   - },
1433   -
1434   - /**
1435   - * 补每个路牌的其他班次(进出场,例保班次)。
1436   - */
1437   - fnCalcuOtherBc_: function() {
1438   - var i;
1439   - var _lpObj;
1440   - var _minBcIndex;
1441   - var _maxBcIndex;
1442   - var _minBc;
1443   - var _maxBc;
1444   - var _otherbc = [];
1445   - var _oFbbc;
1446   -
1447   - for (i = 0; i < _internalLpArray.length; i++) {
1448   - _lpObj = _internalLpArray[i];
1449   - _minBcIndex = _lpObj.getMinBcObjPosition();
1450   - _maxBcIndex = _lpObj.getMaxBcObjPosition();
1451   - _minBc = _lpObj.getBc(_minBcIndex[0], _minBcIndex[1]);
1452   - _maxBc = _lpObj.getBc(_maxBcIndex[0], _maxBcIndex[1]);
1453   -
1454   - _otherbc = [];
1455   - _otherbc.push(_factory.createBcObj(
1456   - _lpObj, "bd", true, 1,
1457   - _minBc.getFcTimeObj(),
1458   - _paramObj
1459   - ));
1460   - _otherbc.push(_factory.createBcObj(
1461   - _lpObj, "out", true, 1,
1462   - _minBc.getFcTimeObj(),
1463   - _paramObj
1464   - ));
1465   -
1466   - _maxBc.setArrTimeObj(_paramObj.addMinute(_maxBc.getFcTimeObj(), _maxBc.getBcTime()));
1467   - _maxBc.setStopTime(0);
1468   - _otherbc.push(_factory.createBcObj(
1469   - _lpObj, "in", true, 1,
1470   - _maxBc.getArrTimeObj(),
1471   - _paramObj
1472   - ));
1473   - _otherbc.push(_factory.createBcObj(
1474   - _lpObj, "lc", true, 1,
1475   - _maxBc.getArrTimeObj(),
1476   - _paramObj
1477   - ));
1478   -
1479   - // 5休2分班出场例保班次
1480   - if (_lpObj.isBxFb5_2()) {
1481   - _oFbbc = _lpObj.getBc(
1482   - _lpObj.fnGetBcChainInfo(1)["s_q"],
1483   - _lpObj.fnGetBcChainInfo(1)["s_b"]
1484   - );
1485   -
1486   - _otherbc.push(_factory.createBcObj(
1487   - _lpObj, "bd", true, 1,
1488   - _oFbbc.getFcTimeObj(),
1489   - _paramObj
1490   - ));
1491   - _otherbc.push(_factory.createBcObj(
1492   - _lpObj, "out", true, 1,
1493   - _oFbbc.getFcTimeObj(),
1494   - _paramObj
1495   - ));
1496   - }
1497   -
1498   - _lpObj.addOtherBcArray(_otherbc);
1499   - }
1500   -
1501   - },
1502   -
1503   - /**
1504   - * 补每个路牌的其他班次(进出场,例保班次)
1505   - * 所有的车次链前后都加进出场、报道班次
1506   - */
1507   - fnCalcuOtherBc: function() {
1508   - var i;
1509   - var j;
1510   - var iBcChainCount;
1511   - var oLp;
1512   - var aOtherBc;
1513   - var oStartBc;
1514   - var oEndBc;
1515   -
1516   - for (i = 0; i < _internalLpArray.length; i++) {
1517   - aOtherBc = [];
1518   - oLp = _internalLpArray[i];
1519   - iBcChainCount = oLp.fnGetBcChainCount();
1520   -
1521   - if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
1522   - // 头部要添加出场,例保班次
1523   - oStartBc = oLp.getBc(
1524   - oLp.fnGetBcChainInfo(0)["s_q"],
1525   - oLp.fnGetBcChainInfo(0)["s_b"]
1526   - );
1527   - aOtherBc.push(_factory.createBcObj(
1528   - oLp, "bd", true, 1,
1529   - oStartBc.getFcTimeObj(),
1530   - _paramObj
1531   - ));
1532   - aOtherBc.push(_factory.createBcObj(
1533   - oLp, "out", true, 1,
1534   - oStartBc.getFcTimeObj(),
1535   - _paramObj
1536   - ));
1537   -
1538   - // 尾部需添加进场,例保班次
1539   - oEndBc = oLp.getBc(
1540   - oLp.fnGetBcChainInfo(0)["e_q"],
1541   - oLp.fnGetBcChainInfo(0)["e_b"]
1542   - );
1543   - aOtherBc.push(_factory.createBcObj(
1544   - oLp, "in", true, 1,
1545   - oEndBc.getArrTimeObj(),
1546   - _paramObj
1547   - ));
1548   - aOtherBc.push(_factory.createBcObj(
1549   - oLp, "lc", true, 1,
1550   - oEndBc.getArrTimeObj(),
1551   - _paramObj
1552   - ));
1553   - } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
1554   - // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
1555   - oStartBc = oLp.getBc(
1556   - oLp.fnGetBcChainInfo(0)["s_q"],
1557   - oLp.fnGetBcChainInfo(0)["s_b"]
1558   - );
1559   - aOtherBc.push(_factory.createBcObj(
1560   - oLp, "bd", true, 1,
1561   - oStartBc.getFcTimeObj(),
1562   - _paramObj
1563   - ));
1564   - aOtherBc.push(_factory.createBcObj(
1565   - oLp, "out", true, 1,
1566   - oStartBc.getFcTimeObj(),
1567   - _paramObj
1568   - ));
1569   -
1570   - oEndBc = oLp.getBc(
1571   - oLp.fnGetBcChainInfo(0)["e_q"],
1572   - oLp.fnGetBcChainInfo(0)["e_b"]
1573   - );
1574   - aOtherBc.push(_factory.createBcObj(
1575   - oLp, "in", true, 1,
1576   - oEndBc.getArrTimeObj(),
1577   - _paramObj
1578   - ));
1579   -
1580   - // 第二个车次链开头只有出场班次,车次链结尾有进场,报到班次
1581   - oStartBc = oLp.getBc(
1582   - oLp.fnGetBcChainInfo(1)["s_q"],
1583   - oLp.fnGetBcChainInfo(1)["s_b"]
1584   - );
1585   - aOtherBc.push(_factory.createBcObj(
1586   - oLp, "out", true, 1,
1587   - oStartBc.getFcTimeObj(),
1588   - _paramObj
1589   - ));
1590   -
1591   - oEndBc = oLp.getBc(
1592   - oLp.fnGetBcChainInfo(1)["e_q"],
1593   - oLp.fnGetBcChainInfo(1)["e_b"]
1594   - );
1595   - aOtherBc.push(_factory.createBcObj(
1596   - oLp, "in", true, 1,
1597   - oEndBc.getArrTimeObj(),
1598   - _paramObj
1599   - ));
1600   - aOtherBc.push(_factory.createBcObj(
1601   - oLp, "lc", true, 1,
1602   - oEndBc.getArrTimeObj(),
1603   - _paramObj
1604   - ));
1605   -
1606   -
1607   - } else {
1608   - // 2个车次链以上,暂时没有此班型
1609   - }
1610   -
1611   - oLp.addOtherBcArray(aOtherBc);
1612   - }
1613   - },
1614   -
1615   - /**
1616   - * 祛除上标线开头的删除标记的班次。
1617   - */
1618   - fnRemoveDelFirstFlagBc: function() {
1619   - var oLp = _internalLpArray[0];
1620   - var aMinBcIndex = oLp.getMinBcObjPosition();
1621   - if (oLp.getBc(aMinBcIndex[0], aMinBcIndex[1]).fnIsDelFlag()) {
1622   - oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]);
1623   - }
1624   - },
1625   - /**
1626   - * 祛除上标线结尾的删除标记的班次。
1627   - */
1628   - fnRemoveDelLastFlagBc: function() {
1629   - var oLp = _internalLpArray[0];
1630   - var aMaxBcIndex = oLp.getMaxBcObjPosition();
1631   - if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) {
1632   - oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]);
1633   - }
1634   - },
1635   -
1636   - /**
1637   - * 调整路牌班次间隔(核准周转时间,停站时间)。
1638   - * @param iFre int 迭代次数
1639   - */
1640   - fnAdjustLpBcInterval: function(iFre) {
1641   - if (iFre > 0) {
1642   - for (var i = 0; i < _internalLpArray.length; i++) {
1643   - _internalLpArray[i].fnAdjustBcInterval(
1644   - this.fnCalcuAverPeakStopTime(),
1645   - this.fnCalcuAverTroughStopTime(),
1646   - _paramObj);
1647   - }
1648   -
1649   - this.fnAdjustLpBcInterval(iFre - 1);
1650   - }
1651   - },
1652   -
1653   - /**
1654   - * 调整班次间隔。
1655   - * @param bIsUp 是否上行
1656   - * @param oStartTime 开始时间对象
1657   - * @param iFre 迭代次数
1658   - */
1659   - fnAdjustBcInterval2_: function(bIsUp, oStartTime, iFre) {
1660   - if (iFre > 0) {
1661   - var aBc = _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
1662   - aBc.sort(function(o1, o2) {
1663   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1664   - return -1;
1665   - } else {
1666   - return 1;
1667   - }
1668   - });
1669   - var i;
1670   - var j;
1671   -
1672   - var iBcCountOfGroup = 3; // 3个班次取一次计算
1673   - var aBcOfGroup; // 3个班次列表
1674   - var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
1675   -
1676   - for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
1677   - aBcOfGroup = [];
1678   - aBcIntervalOfGroup = [];
1679   - for (j = i; j < i + iBcCountOfGroup; j++) {
1680   - aBcOfGroup.push(aBc[j]);
1681   - }
1682   -
1683   - for (j = 0; j < aBcOfGroup.length; j++) {
1684   - if (j < aBcOfGroup.length - 1) {
1685   - aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
1686   - aBcOfGroup[j].getFcTimeObj(), "m"));
1687   - }
1688   - }
1689   -
1690   - if (aBcIntervalOfGroup[0] < 19) {
1691   - aBcOfGroup[1].addMinuteToFcsj(1);
1692   - } else if (aBcIntervalOfGroup[0] > 20) {
1693   - aBcOfGroup[1].addMinuteToFcsj(-1);
1694   - } else {
1695   - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
1696   - //continue;
1697   - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
1698   - aBcOfGroup[1].addMinuteToFcsj(-1);
1699   - } else {
1700   - aBcOfGroup[1].addMinuteToFcsj(1);
1701   - }
1702   - }
1703   -
1704   - }
1705   -
1706   - this.fnAdjustBcInterval2(bIsUp, oStartTime, iFre - 1);
1707   - }
1708   - },
1709   -
1710   - /**
1711   - * 调整班次间隔。
1712   - * @param boolean isUp 是否上行
1713   - * @param oStartTime 开始时间对象
1714   - * @param fre int 迭代次数
1715   - */
1716   - fnAdjustBcInterval: function(isUp, oStartTime, fre) {
1717   - if (fre > 0) {
1718   - var aBc = !oStartTime ? _fnGetBcList(isUp) : _fnGetBcList2(isUp, oStartTime); // 指定方向的班次列表
1719   -
1720   - aBc.sort(function(o1, o2) {
1721   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1722   - return -1;
1723   - } else {
1724   - return 1;
1725   - }
1726   - });
1727   -
1728   - var i;
1729   - var j;
1730   -
1731   - var iBcCountOfGroup = 3; // 3个班次取一次计算
1732   - var aBcOfGroup; // 3个班次列表
1733   - var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
1734   - var oBcFcTime; // 班次发车时间
1735   -
1736   - for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
1737   - aBcOfGroup = [];
1738   - aBcIntervalOfGroup = [];
1739   - for (j = i; j < i + iBcCountOfGroup; j++) {
1740   - aBcOfGroup.push(aBc[j]);
1741   - }
1742   -
1743   - for (j = 0; j < aBcOfGroup.length; j++) {
1744   - if (j < aBcOfGroup.length - 1) {
1745   - aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
1746   - aBcOfGroup[j].getFcTimeObj(), "m"));
1747   - }
1748   - }
1749   -
1750   - // 判定规则
1751   - oBcFcTime = aBcOfGroup[1].getFcTimeObj();
1752   -
1753   - // 第一个班次发车时间不动,根据间隔,调整中间一个班次
1754   - // 如果3个班次2个间隔时间差1分钟,不调整
1755   - // 如果第一个间隔大,调整第二个班次往前1分钟
1756   - // 如果第二个间隔大,调整第二个班次往后1分钟
1757   -
1758   - if (_paramObj.isTroughBc(oBcFcTime) &&
1759   - aBcIntervalOfGroup[0] > _paramObj.getTroughMaxFcjx()) {
1760   - aBcOfGroup[1].addMinuteToFcsj(-1);
1761   - }
1762   -
1763   - //else if (_paramObj.isMPeakBc(oBcFcTime) &&
1764   - // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) {
1765   - // aBcOfGroup[1].addMinuteToFcsj(1);
1766   - //} else if (_paramObj.isMPeakBc(oBcFcTime) &&
1767   - // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) {
1768   - // aBcOfGroup[1].addMinuteToFcsj(-1);
1769   - //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
1770   - // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) {
1771   - // aBcOfGroup[1].addMinuteToFcsj(1);
1772   - //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
1773   - // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) {
1774   - // aBcOfGroup[1].addMinuteToFcsj(-1);
1775   - //}
1776   -
1777   -
1778   - else {
1779   - if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
1780   - //continue;
1781   - } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
1782   - aBcOfGroup[1].addMinuteToFcsj(-1);
1783   - } else {
1784   - aBcOfGroup[1].addMinuteToFcsj(1);
1785   - }
1786   - }
1787   -
1788   - //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
1789   - // //continue;
1790   - //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
1791   - // aBcOfGroup[1].addMinuteToFcsj(-1);
1792   - //} else {
1793   - // aBcOfGroup[1].addMinuteToFcsj(1);
1794   - //}
1795   -
1796   -
1797   - }
1798   -
1799   - this.fnAdjustBcInterval(isUp, oStartTime, fre - 1);
1800   - }
1801   -
1802   - },
1803   -
1804   - /**
1805   - * 调整班次间隔(平均间隔)。
1806   - * @param bIsUp 是否上行
1807   - * @param oStartTime 开始时间对象
1808   - */
1809   - fnAdjustBcInterval2_avg: function(bIsUp, oStartTime) {
1810   - var aBc = !oStartTime ? _fnGetBcList(bIsUp) : _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
1811   - aBc.sort(function(o1, o2) {
1812   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1813   - return -1;
1814   - } else {
1815   - return 1;
1816   - }
1817   - });
1818   -
1819   - var j;
1820   - var iCount = aBc.length - 1;
1821   - var iC1 = Math.floor(aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") / iCount);
1822   - var iC2 = aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") % iCount;
1823   - var iTempTime;
1824   -
1825   - for (j = 0; j < iCount - iC2; j++) {
1826   - iTempTime = aBc[j + 1].getFcTimeObj().diff(aBc[j].getFcTimeObj(), "m");
1827   - aBc[j + 1].addMinuteToFcsj(iC1 - iTempTime);
1828   - }
1829   - for (j = 0; j < iC2; j++) {
1830   - iTempTime = aBc[iCount - iC2 + j + 1].getFcTimeObj().diff(aBc[iCount - iC2 + j].getFcTimeObj(), "m");
1831   - aBc[iCount - iC2 + j + 1].addMinuteToFcsj(iC1 + 1 - iTempTime);
1832   - }
1833   -
1834   - },
1835   -
1836   - /**
1837   - * 计算高峰平均停站时间。
1838   - */
1839   - fnCalcuAverPeakStopTime: function() {
1840   - var i;
1841   - var j;
1842   - var aBc;
1843   - var iBcCount = 0;
1844   - var iSum = 0;
1845   - for (i = 0; i < _internalLpArray.length; i++) {
1846   - aBc = _internalLpArray[i].getBcArray();
1847   -
1848   - for (j = 0; j < aBc.length; j++) {
1849   - if (!_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
1850   - iBcCount ++;
1851   - iSum += aBc[j].getStopTime();
1852   - }
1853   - }
1854   - }
1855   -
1856   - return Math.floor(iSum / iBcCount);
1857   - },
1858   -
1859   - /**
1860   - * 计算低谷平均停站时间。
1861   - */
1862   - fnCalcuAverTroughStopTime: function() {
1863   - var i;
1864   - var j;
1865   - var aBc;
1866   - var iBcCount = 0;
1867   - var iSum = 0;
1868   - for (i = 0; i < _internalLpArray.length; i++) {
1869   - aBc = _internalLpArray[i].getBcArray();
1870   - for (j = 0; j < aBc.length; j++) {
1871   - if (_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
1872   - iBcCount ++;
1873   - iSum += aBc[j].getStopTime();
1874   - }
1875   - }
1876   - }
1877   -
1878   - return Math.floor(iSum / iBcCount);
1879   - },
1880   -
1881   - //------------- 其他方法 -------------//
1882   - /**
1883   - * 返回内部路牌数据列表。
1884   - * @returns {Array}
1885   - */
1886   - fnGetLpArray: function() {
1887   - return _internalLpArray;
1888   - },
1889   -
1890   - /**
1891   - * 内部数据转化成显示用的班次数组。
1892   - */
1893   - fnToGanttBcArray: function() {
1894   - var aAllBc = [];
1895   - var aLpBc = [];
1896   - var aEatBc = [];
1897   - var oLp;
1898   - var i;
1899   - var j;
1900   -
1901   - for (i = 0; i < _internalLpArray.length; i++) {
1902   - oLp = _internalLpArray[i];
1903   - aLpBc = [];
1904   - aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
1905   -
1906   - aEatBc = [];
1907   - // 根据班次的吃饭时间添加吃饭班次
1908   - for (j = 0; j < aLpBc.length; j++) {
1909   - if (aLpBc[j].fnGetEatTime() > 0) {
1910   - aEatBc.push(_factory.createBcObj(
1911   - oLp,
1912   - "cf",
1913   - !aLpBc[j].isUp(), // 和上一个班次方向相反
1914   - 1,
1915   - _paramObj.addMinute(aLpBc[j].getArrTimeObj(), aLpBc[j].getStopTime()), // 使用上一个班次的到达时间作为开始时间
1916   - _paramObj
1917   - ));
1918   - }
1919   - }
1920   - aLpBc = aLpBc.concat(aEatBc);
1921   -
1922   - // 按照发车时间排序
1923   - aLpBc.sort(function(o1, o2) {
1924   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1925   - return -1;
1926   - } else {
1927   - return 1;
1928   - }
1929   - });
1930   -
1931   - // 重新赋值fcno
1932   - for (j = 0; j < aLpBc.length; j++) {
1933   - aLpBc[j].fnSetFcno(j + 1);
1934   - }
1935   -
1936   - aAllBc = aAllBc.concat(aLpBc);
1937   - }
1938   -
1939   - var aGanttBc = [];
1940   - for (i = 0; i < aAllBc.length; i++) {
1941   - aGanttBc.push(aAllBc[i].toGanttBcObj());
1942   - }
1943   -
1944   - return aGanttBc;
1945   - }
1946   -
1947   - };
1948   -
  1 +/**
  2 + * 内部行车计划对象。
  3 + * @constructor
  4 + */
  5 +var InternalScheduleObj = function(paramObj, lpArray, factory) {
  6 + // 参数对象
  7 + var _paramObj = paramObj;
  8 + // 外部的路牌数组
  9 + var _lpArray = lpArray;
  10 + // 工厂对象
  11 + var _factory = factory;
  12 +
  13 + //------------------ 初始化方法1,以及计算关联的内部变量 -----------------//
  14 + var _qIsUp; // 每一圈是上行开始还是下行开始
  15 + var _qCount = 0; // 总的圈数
  16 + var _internalLpArray = []; // 内部对象数组
  17 + var _aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时)
  18 + {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0},
  19 + {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0},
  20 + {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0},
  21 + {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0},
  22 + {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0},
  23 + {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0},
  24 + {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0},
  25 + {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0}
  26 + ];
  27 +
  28 + var _fnInitFun1 = function() { // 初始化方法1
  29 + console.log("//---------------- 行车计划,初始化方法1 start ----------------//");
  30 +
  31 + //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
  32 +
  33 + // 确定_qIsUp,哪个方向的首班车晚就用哪个
  34 + _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(
  35 + _paramObj.getDownFirstDTimeObj()) ? false : true;
  36 + // 上标线开始时间,就是方向的首班车时间
  37 + var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  38 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  39 + var et;
  40 + var et_IsUp;
  41 + if (_paramObj.getUpLastDtimeObj().isBefore(
  42 + _paramObj.getDownLastDTimeObj())) {
  43 + et = _paramObj.getDownLastDTimeObj();
  44 + et_IsUp = false;
  45 + } else {
  46 + et = _paramObj.getUpLastDtimeObj();
  47 + et_IsUp = true;
  48 + }
  49 +
  50 + //------------------------ 2、计算总共有多少圈 ------------------------//
  51 +
  52 + // 以开始时间,结束时间,构造上标线用连班班次发车时间
  53 + var bcFcsjArrays = []; // 班次发车时间对象数组
  54 + var bcArsjArrays = []; // 班次到达时间对象数组
  55 + var isUp = _qIsUp; // 方向
  56 + var bcCount = 1; // 班次数
  57 +
  58 + var _kssj = st; // 开始时间
  59 + var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时
  60 + var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间
  61 + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); // 停站时间
  62 +
  63 + do {
  64 + bcFcsjArrays.push(_kssj);
  65 + bcArsjArrays.push(_arrsj);
  66 +
  67 + _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime);
  68 + _bcsj = paramObj.calcuTravelTime(_kssj, isUp);
  69 + _arrsj = paramObj.addMinute(_kssj, _bcsj);
  70 + _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
  71 +
  72 + bcCount ++;
  73 + isUp = !isUp;
  74 + } while(_kssj.isBefore(et));
  75 + bcCount--; // 因为先做do,所以总的班次要减1
  76 + //if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
  77 + // // 如果最后一个班次的到达时间超过结束时间,也要去除
  78 + // bcFcsjArrays.splice(bcCount - 1, 1);
  79 + // bcArsjArrays.splice(bcCount - 1, 1);
  80 + // bcCount--;
  81 + //}
  82 + var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
  83 + var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
  84 +
  85 + // 利用连班数组计算圈数
  86 + _qCount = 1; // 前面加1圈,补中标线的班次
  87 + _qCount += _qCount_p1;
  88 + _qCount += _qCount_p2;
  89 +
  90 + // 计算最后是不是还要补一圈
  91 + if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
  92 + if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
  93 + // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
  94 + // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
  95 + if (!_qIsUp == et_IsUp) {
  96 + // 一致不用加圈数
  97 + } else {
  98 + // 不一致需要加圈补最后一个结束时间班次
  99 + _qCount ++;
  100 + }
  101 + } else {
  102 + // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
  103 + // 不需要在补圈数了
  104 + }
  105 + }
  106 +
  107 + //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
  108 +
  109 + // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中
  110 + var i;
  111 + for (i = 0; i < _lpArray.length; i++) {
  112 + _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp));
  113 + }
  114 + // 初始化上标线,从第1圈开始
  115 + _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory);
  116 +
  117 + // 以上标线为基础,计算各种班型工时对应的圈数、班次数
  118 + var aBcArray = _internalLpArray[0].getBcArray();
  119 + aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识
  120 +
  121 + if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算
  122 + aBcArray.splice(aBcArray.length - 1, 1);
  123 + }
  124 +
  125 + // 午饭吃饭时间
  126 + var iLTime = _paramObj.fnGetLunchTime();
  127 + // 晚饭吃饭时间
  128 + var iDTime = _paramObj.fnGetDinnerTime();
  129 + // 出场时间
  130 + var iOutTime = _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime();
  131 + // 进场时间
  132 + var iInTime = _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime();
  133 + // 例保时间
  134 + var iBTime = _paramObj.getLbTime();
  135 +
  136 + var sum = 0; // 总班次时间
  137 + for (i = 0; i < aBcArray.length; i++) {
  138 + sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime();
  139 + }
  140 + sum += iLTime; // 加午饭时间
  141 + sum += iDTime; // 加晚饭时间
  142 + for (i = 0; i < _aBxDesc.length; i++) {
  143 + _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间
  144 +
  145 + // 计算5休2的班次数(双进出场,4个例保)
  146 + if (i == 6) {
  147 + _aBxDesc[i].fQCount =
  148 + (_aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) /
  149 + _aBxDesc[i].fAverTime;
  150 + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
  151 + } else { // 进出场,2个例保
  152 + _aBxDesc[i].fQCount =
  153 + (_aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) /
  154 + _aBxDesc[i].fAverTime;
  155 + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
  156 + }
  157 + }
  158 +
  159 +
  160 + // 在第一个班次之前再添加一个模拟班次,用于中标线的作用
  161 + // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除
  162 + var iFirstStopTime =
  163 + _paramObj.fnCalcuFixedStopNumber(
  164 + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10),
  165 + _qIsUp
  166 + );
  167 + var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime();
  168 + var oFlagBc = _factory.createBcObj( // 标记班次
  169 + _internalLpArray[0],
  170 + "normal",
  171 + !_qIsUp,
  172 + 1,
  173 + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)),
  174 + _paramObj
  175 + );
  176 + oFlagBc.fnSetDelFlag(true); // 标记了删除记号
  177 +
  178 + _internalLpArray[0].setBc(0, 1, oFlagBc);
  179 +
  180 + // 在最后一圈也补上一个或者2个模拟班次,暂时标记,最后需要删除
  181 + var aMaxBcIndex = _internalLpArray[0].getMaxBcObjPosition();
  182 + if (aMaxBcIndex[0] == _qCount - 1) { // 可能加半圈
  183 + oFlagBc = _factory.createBcObj( // 标记班次
  184 + _internalLpArray[0],
  185 + "normal",
  186 + !_qIsUp,
  187 + 1,
  188 + _paramObj.addMinute(
  189 + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(),
  190 + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()),
  191 + _paramObj
  192 + );
  193 + oFlagBc.fnSetDelFlag(true); // 标记了删除记号
  194 + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc);
  195 +
  196 + } else { // 加完整的一圈
  197 + oFlagBc = _factory.createBcObj( // 标记班次
  198 + _internalLpArray[0],
  199 + "normal",
  200 + _qIsUp,
  201 + 1,
  202 + _paramObj.addMinute(
  203 + _internalLpArray[0].getBc(_qCount - 2, 1).getArrTimeObj(),
  204 + _internalLpArray[0].getBc(_qCount - 2, 1).getStopTime()),
  205 + _paramObj
  206 + );
  207 + oFlagBc.fnSetDelFlag(true); // 标记了删除记号
  208 + _internalLpArray[0].setBc(_qCount - 1, 0, oFlagBc);
  209 +
  210 + oFlagBc = _factory.createBcObj( // 标记班次
  211 + _internalLpArray[0],
  212 + "normal",
  213 + !_qIsUp,
  214 + 1,
  215 + _paramObj.addMinute(
  216 + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(),
  217 + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()),
  218 + _paramObj
  219 + );
  220 + oFlagBc.fnSetDelFlag(true); // 标记了删除记号
  221 + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc);
  222 +
  223 + }
  224 +
  225 + console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +
  226 + "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm"));
  227 + console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") +
  228 + "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm"));
  229 + console.log("总共计算的圈数:" + _qCount);
  230 + console.log("圈的方向isUP:" + _qIsUp);
  231 + console.log("班型描述(以下):");
  232 + console.log(_aBxDesc);
  233 + console.log("所有路牌间隔描述(以下):");
  234 + for (i = 0; i < _internalLpArray.length; i++) {
  235 + console.log(_internalLpArray[i]._$_aVerticalIntervalTime);
  236 + }
  237 + console.log("//---------------- 行车计划,初始化方法1 end ----------------//");
  238 +
  239 + };
  240 +
  241 + //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//
  242 + var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出
  243 + var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
  244 + var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出
  245 + var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
  246 +
  247 + var _fnInitFun2 = function() { // 初始化方法2
  248 + console.log("//---------------- 行车计划,初始化方法2 start ----------------//");
  249 +
  250 + //------------------------ 1、计算车辆总数 ------------------------//
  251 + // 是用高峰上行周转时间除以高峰平均间隔得到的
  252 + // 这样算还算合理,车辆不多不少,待以后有新的算法再修正
  253 + var iClCount = _paramObj.calcuClzx();
  254 +
  255 + //------------------------ 2、计算所有路牌的发车在各个圈中的间隔 --------------------//
  256 + var i;
  257 + var j;
  258 + var iBindex = 1;
  259 + var iZzsj;
  260 + var oLp;
  261 + var iC1;
  262 + var iC2;
  263 +
  264 + for (i = 0; i < _qCount - 1; i++) {
  265 + while (iBindex <= 1) {
  266 + // 每圈每个方向的周转时间不一致,以上标线为主
  267 + oLp = _internalLpArray[0];
  268 + iZzsj = oLp.getBc(i + 1, iBindex).getFcTimeObj().diff(
  269 + oLp.getBc(i, iBindex).getFcTimeObj(), "m"
  270 + );
  271 +
  272 + iC1 = Math.floor(iZzsj / iClCount);
  273 + iC2 = iZzsj % iClCount;
  274 +
  275 + for (j = 0; j < iClCount - iC2; j++) {
  276 + oLp = _internalLpArray[j];
  277 + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1);
  278 + }
  279 +
  280 + for (j = 0; j < iC2; j++) {
  281 + oLp = _internalLpArray[iClCount - iC2 + j];
  282 + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1 + 1);
  283 + }
  284 +
  285 + iBindex ++;
  286 +
  287 + }
  288 + iBindex = 0;
  289 + }
  290 + // 最后一圈没有下一圈的参照,周转时间没发获取,由于都是低谷,所以使用倒数第二圈的间隔最为最后一圈的间隔
  291 + for (i = 0; i < _internalLpArray.length; i++) {
  292 + oLp = _internalLpArray[i];
  293 + oLp.fnSetVerticalIntervalTime(_qCount - 1, 0, oLp.fnGetVerticalIntervalTime(_qCount - 2, 0));
  294 + oLp.fnSetVerticalIntervalTime(_qCount - 1, 1, oLp.fnGetVerticalIntervalTime(_qCount - 2, 1));
  295 + }
  296 +
  297 + //------------------------ 3、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
  298 +
  299 + // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次
  300 + // 以这个班次为早高峰起点,全部出车策略
  301 + var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  302 + _paramObj.getMPeakStartTimeObj(), true, true);
  303 + var qIndex = qbcIndexArray[0]; // 第几圈
  304 + var bIndex = qbcIndexArray[1]; // 第几个班次
  305 +
  306 + for (i = 1; i < _internalLpArray.length; i++) {
  307 + _fnGenerateBcAndSetBc(i, qIndex, bIndex);
  308 + }
  309 +
  310 + _approximate_zgfQIndex = qIndex;
  311 + _approximate_zgfBIndex = bIndex;
  312 +
  313 + //------------------------ 4、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
  314 +
  315 + // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次
  316 + // 以这个班次为早高峰起点,全部出车策略
  317 + qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  318 + _paramObj.getEPeakStartTimeObj(), true, true);
  319 + qIndex = qbcIndexArray[0]; // 第几圈
  320 + bIndex = qbcIndexArray[1]; // 第几个班次
  321 +
  322 + for (i = 1; i < _internalLpArray.length; i++) {
  323 + _fnGenerateBcAndSetBc(i, qIndex, bIndex);
  324 + }
  325 +
  326 + _approximate_wgfQIndex = qIndex;
  327 + _approximate_wgfBIndex = bIndex;
  328 +
  329 + console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟");
  330 + console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟");
  331 + console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出");
  332 + console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出");
  333 + console.log("//---------------- 行车计划,初始化方法2 end ----------------//");
  334 + };
  335 +
  336 + //----------------------- 初始化方法3,计算连班分班的路牌分布 ----------------//
  337 + var _iBx_lb_lpcount; // 连班路牌数
  338 + var _iBx_5_2_fb_lpcount; // 5休2分班路牌数
  339 + var _iBx_other_fb_lpcount; // 其他分班路牌数
  340 +
  341 + var _fnInitFun3 = function() { // 初始化方法3
  342 + console.log("//---------------- 行车计划,初始化方法3 start ----------------//");
  343 +
  344 + //--------------------- 1、计算分班连班班型车辆分布数 --------------------//
  345 + // 总共车辆数(高峰最大车辆数)
  346 + var iCls = _paramObj.calcuClzx();
  347 + // 低谷最少配车(连班车数量)
  348 + var iDgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx());
  349 + // 加班车路牌数(做5休2的路牌数)
  350 + var i_5_2_lpes = _paramObj.getJBLpes();
  351 +
  352 + // 做些简单的验证
  353 + if (iCls < iDgminpc) {
  354 + alert("总配车数小于低谷最小配车");
  355 + throw "总配车数小于低谷最小配车";
  356 + }
  357 + if (iDgminpc < 2) {
  358 + alert("连班路牌小于2,办不到啊");
  359 + throw "连班路牌小于2,办不到啊";
  360 + }
  361 + if (iCls - iDgminpc < i_5_2_lpes) {
  362 + alert("总分班路牌数小于加班路牌数");
  363 + throw "总分班路牌数小于加班路牌数";
  364 + }
  365 +
  366 + //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20
  367 + //while(_paramObj.calcuPeakZzsj() / iDgminpc > 20) {
  368 + // iDgminpc ++;
  369 + //}
  370 + _iBx_lb_lpcount = iDgminpc;
  371 +
  372 + _iBx_5_2_fb_lpcount = i_5_2_lpes;
  373 + _iBx_other_fb_lpcount = iCls - _iBx_lb_lpcount - i_5_2_lpes;
  374 +
  375 + //------------------------ 2、利用间隔法计算连班路牌分布 --------------------//
  376 + var i;
  377 + var j;
  378 + var iC1 = Math.floor(_internalLpArray.length / _iBx_lb_lpcount);
  379 + var iC2 = _internalLpArray.length % _iBx_lb_lpcount;
  380 + var iLpIndex;
  381 +
  382 + for (i = 0; i < _iBx_lb_lpcount - iC2; i++) {
  383 + iLpIndex = i * iC1;
  384 + _internalLpArray[iLpIndex].setBxLb(true);
  385 + _internalLpArray[iLpIndex].setBxDesc("连班");
  386 + }
  387 + for (j = 0; j < iC2; j++) {
  388 + iLpIndex = i * iC1 + j * (iC1 + 1);
  389 + _internalLpArray[iLpIndex].setBxLb(true);
  390 + _internalLpArray[iLpIndex].setBxDesc("连班");
  391 + }
  392 +
  393 + //------------------------ 3、利用间隔法计算分班班型路牌分布 --------------------//
  394 + // 获取分班路牌索引
  395 + var aNotLbIndexes = [];
  396 + for (i = 0; i < _internalLpArray.length; i++) {
  397 + if (!_internalLpArray[i].isBxLb()) {
  398 + aNotLbIndexes.push(i);
  399 + }
  400 + }
  401 + // 先5休2分班
  402 + iC1 = Math.floor(aNotLbIndexes.length / _iBx_5_2_fb_lpcount);
  403 + iC2 = aNotLbIndexes.length % _iBx_5_2_fb_lpcount;
  404 +
  405 + for (i = 0; i < _iBx_5_2_fb_lpcount - iC2; i++) {
  406 + iLpIndex = aNotLbIndexes[i * iC1];
  407 + _internalLpArray[iLpIndex].setBxLb(false);
  408 + _internalLpArray[iLpIndex].setBxFb(true);
  409 + _internalLpArray[iLpIndex].setBxFb5_2(true);
  410 + _internalLpArray[iLpIndex].setBxDesc("5休2分班");
  411 + }
  412 + for (i = 0; i < iC2; i++) {
  413 + iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)];
  414 + _internalLpArray[iLpIndex].setBxLb(false);
  415 + _internalLpArray[iLpIndex].setBxFb(true);
  416 + _internalLpArray[iLpIndex].setBxFb5_2(true);
  417 + _internalLpArray[iLpIndex].setBxDesc("5休2分班");
  418 + }
  419 + // 其他分班
  420 + for (i = 0; i < aNotLbIndexes.length; i++) {
  421 + iLpIndex = aNotLbIndexes[i];
  422 + if (!_internalLpArray[iLpIndex].isBxFb5_2()) {
  423 + _internalLpArray[iLpIndex].setBxLb(false);
  424 + _internalLpArray[iLpIndex].setBxFb(true);
  425 + _internalLpArray[iLpIndex].setBxFb5_2(false);
  426 + _internalLpArray[iLpIndex].setBxDesc("其他分班");
  427 + }
  428 + }
  429 +
  430 + console.log("高峰周转时间:" + _paramObj.calcuPeakZzsj());
  431 + console.log("连班路牌数:" + _iBx_lb_lpcount);
  432 + console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount);
  433 + console.log("其他分班路牌数:" + _iBx_other_fb_lpcount);
  434 + var aLbIndexes = [];
  435 + for (i = 0; i < _internalLpArray.length; i++) {
  436 + if (_internalLpArray[i].isBxLb()) {
  437 + aLbIndexes.push(i);
  438 + }
  439 + }
  440 + console.log("连班路牌indexes=" + aLbIndexes);
  441 + var a_5_2_fbIndexes = [];
  442 + for (i = 0; i < _internalLpArray.length; i++) {
  443 + if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) {
  444 + a_5_2_fbIndexes.push(i);
  445 + }
  446 + }
  447 + console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes);
  448 + var a_other_fbIndexes = [];
  449 + for (i = 0; i < _internalLpArray.length; i++) {
  450 + if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) {
  451 + a_other_fbIndexes.push(i);
  452 + }
  453 + }
  454 + console.log("其他分班路牌indexes=" + a_other_fbIndexes);
  455 +
  456 + console.log("//---------------- 行车计划,初始化方法3 end ----------------//");
  457 + };
  458 +
  459 + //----------------------- 初始化方法4,计算中标线位置 -------------------------//
  460 + var _iZbx_lpIndex; // 中标线对应第几个路牌
  461 +
  462 + var _fnInitFun4 = function() { // 初始化方法4
  463 + console.log("//---------------- 行车计划,初始化方法4 start ----------------//");
  464 +
  465 + //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------//
  466 + // 构造中标线
  467 + // 中标线开始时间,就是方向的首班车时间
  468 + var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  469 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  470 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  471 + var oEt;
  472 + if (_paramObj.getUpLastDtimeObj().isBefore(
  473 + _paramObj.getDownLastDTimeObj())) {
  474 + oEt = _paramObj.getDownLastDTimeObj();
  475 + } else {
  476 + oEt = _paramObj.getUpLastDtimeObj();
  477 + }
  478 +
  479 + var oTempLp = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp);
  480 + oTempLp.initDataFromTimeToTime(
  481 + oSt,
  482 + oEt,
  483 + !_qIsUp,
  484 + 0,
  485 + _paramObj,
  486 + _factory
  487 + );
  488 +
  489 + //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------//
  490 + // 找出中标线对应的早高峰的班次对象
  491 + var oZb_gf_bc = oTempLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
  492 + //alert(oZb_gf_bc.getFcTimeObj().format("HH:mm"));
  493 +
  494 + // 把所有连班路牌高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
  495 + // 中标线和上标线一样在连班路牌上
  496 + var aTempq = [];
  497 + var oTempq;
  498 + var oTempb;
  499 + var i;
  500 + var oLp;
  501 +
  502 + var aLbIndexes = []; // 连班的路牌索引
  503 + for (i = 0; i < _internalLpArray.length; i++) {
  504 + if (_internalLpArray[i].isBxLb()) {
  505 + aLbIndexes.push(i);
  506 + }
  507 + }
  508 +
  509 + for (i = 0; i < aLbIndexes.length; i++) {
  510 + oLp = _internalLpArray[aLbIndexes[i]];
  511 +
  512 + oTempb = oLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
  513 + if (oTempb.isUp() == _qIsUp) {
  514 + oTempq = new InternalGroupObj(oLp, _qIsUp, oTempb, undefined);
  515 + } else {
  516 + oTempq = new InternalGroupObj(oLp, _qIsUp, undefined, oTempb);
  517 + }
  518 + aTempq.push(oTempq);
  519 +
  520 + }
  521 +
  522 + var aTtindex = oTempLp.fnGetQBcIndexWithFcTimeFromGroupArray( // 找出最接近中标线的路牌索引
  523 + oZb_gf_bc.getFcTimeObj(),
  524 + aTempq,
  525 + true,
  526 + true
  527 + );
  528 +
  529 + _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌
  530 +
  531 + oTempLp.getMinBcObj().fnSetIsFirstBc(true); // 设置首班班次标识
  532 +
  533 + if (_iZbx_lpIndex == 0) { // 如果中标线和上标线一致
  534 + var oFirstBcIndexes = oTempLp.getMinBcObjPosition();
  535 + var oFirstBc = oTempLp.getMinBcObj();
  536 + oFirstBc.setLp(_internalLpArray[_iZbx_lpIndex]);
  537 + oFirstBc.fnSetDelFlag(false);
  538 + _internalLpArray[_iZbx_lpIndex].setBc(oFirstBcIndexes[0], oFirstBcIndexes[1], oFirstBc);
  539 + } else {
  540 + oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象
  541 + oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔
  542 + oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb());
  543 + oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb());
  544 + oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2());
  545 +
  546 + // 修正除了第一个班次外,其余其他班次
  547 + var iBcindex = 0;
  548 + for (i = 1; i < _qCount; i++) {
  549 + while (iBcindex <= 1) {
  550 + if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次
  551 + oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex));
  552 + }
  553 + iBcindex ++;
  554 + }
  555 + iBcindex = 0;
  556 + }
  557 +
  558 + _internalLpArray[_iZbx_lpIndex] = oTempLp;
  559 + }
  560 +
  561 + console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌");
  562 +
  563 + console.log("//---------------- 行车计划,初始化方法4 end ----------------//");
  564 + };
  565 +
  566 + //-------------------- 重要的内部方法 -----------------------//
  567 + /**
  568 + * 核心方法,利用路牌间隔纵向生成班次。
  569 + * @param iLpindex 路牌索引
  570 + * @param iQindex 圈索引
  571 + * @param iBcindex 班次索引
  572 + * @returns object InternalBcObj,失败 false
  573 + */
  574 + var _fnGenerateBc = function(iLpindex, iQindex, iBcindex) {
  575 + // 以上标线为起始点,使用路牌在不同圈,班次索引的发车间隔,计算班次
  576 + // 注意,发车间隔是指下一个班次应该距离当前班次间隔,是从下往上的
  577 +
  578 + // 1、参数验证
  579 + if (iLpindex == 0) { // 上标线的班次不需要生成
  580 + return false;
  581 + }
  582 +
  583 + // 2、计算间隔
  584 + var i;
  585 + var oLp;
  586 + var iTime = 0;
  587 + for (i = 0; i < iLpindex; i++) {
  588 + oLp = _internalLpArray[i];
  589 + iTime += oLp.fnGetVerticalIntervalTime(iQindex, iBcindex);
  590 + }
  591 +
  592 + // 3、生成班次
  593 + var _oKsbc = _internalLpArray[0].getBc(iQindex, iBcindex);
  594 + if (!_oKsbc) {
  595 + return false;
  596 + }
  597 + var _oKssj = _paramObj.addMinute(_oKsbc.getFcTimeObj(), iTime);
  598 + var _oBc = _factory.createBcObj(
  599 + _internalLpArray[iLpindex],
  600 + "normal", _oKsbc.isUp(),
  601 + 1, _oKssj, _paramObj);
  602 +
  603 + return _oBc;
  604 +
  605 + };
  606 +
  607 + /**
  608 + * 核心方法,在指定位置生成班次并添加到路牌指定位置中。
  609 + * @param lpIndex 第几个路牌
  610 + * @param qIndex 第几圈
  611 + * @param bcIndex 第几个班次
  612 + */
  613 + var _fnGenerateBcAndSetBc = function(lpIndex, qIndex, bcIndex) {
  614 + var _bcObj = _fnGenerateBc(lpIndex, qIndex, bcIndex);
  615 + if (_bcObj) {
  616 + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
  617 + }
  618 + };
  619 +
  620 + /**
  621 + * 获取班次列表。
  622 + * @param oIsUp 是否上行
  623 + * @param oStartTime 开始时间对象
  624 + * @returns [(InternalBcObj)]
  625 + */
  626 + var _fnGetBcList2 = function(oIsUp, oStartTime) {
  627 + var i;
  628 + var j;
  629 + var oLp;
  630 + var oBc;
  631 + var aBc = [];
  632 +
  633 + for (j = 0; j < _qCount; j++) {
  634 + for (i = 0; i < _internalLpArray.length; i++) {
  635 + oLp = _internalLpArray[i];
  636 + oBc = oLp.getBc(
  637 + j,
  638 + _qIsUp == oIsUp ? 0 : 1
  639 + );
  640 + if (oBc && oBc.getFcTimeObj().isAfter(oStartTime)) {
  641 + aBc.push(oBc);
  642 + }
  643 + }
  644 + }
  645 +
  646 + var aBcFcTime = [];
  647 + for (i = 0; i < aBc.length; i++) {
  648 + oBc = aBc[i];
  649 + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
  650 + }
  651 + console.log((oIsUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
  652 +
  653 + return aBc;
  654 + };
  655 +
  656 + /**
  657 + * 获取班次列表。
  658 + * @param isUp boolean 是否上行
  659 + * @returns [(InternalBcObj)]
  660 + */
  661 + var _fnGetBcList = function(isUp) {
  662 + var i;
  663 + var j;
  664 + var oLp;
  665 + var oBc;
  666 + var aBc = [];
  667 +
  668 + for (j = 0; j < _qCount; j++) {
  669 + for (i = 0; i < _internalLpArray.length; i++) {
  670 + oLp = _internalLpArray[i];
  671 + oBc = oLp.getBc(
  672 + j,
  673 + _qIsUp == isUp ? 0 : 1
  674 + );
  675 + if (oBc) {
  676 + aBc.push(oBc);
  677 + }
  678 + }
  679 + }
  680 +
  681 + var aBcFcTime = [];
  682 + for (i = 0; i < aBc.length; i++) {
  683 + oBc = aBc[i];
  684 + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
  685 + }
  686 + console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
  687 +
  688 + return aBc;
  689 + };
  690 +
  691 + /**
  692 + * 查找离指定时间最近的前面的班次索引信息
  693 + * @param timeObj 查找时间
  694 + * @param isUp 是否上行
  695 + * @returns [{路牌index},{圈index},{班次index}]
  696 + */
  697 + var _fnFindUpClosedBcIndexWithTime = function(timeObj, isUp) {
  698 +
  699 + var _lpObj;
  700 + var _groupObj;
  701 + var _bcObj;
  702 + var _i;
  703 + var _j;
  704 + var timediff; // 时间差取绝对值
  705 +
  706 + var _lpIndex;
  707 + var _up_qIndex;
  708 + var _up_bIndex;
  709 +
  710 + for (_i = 0; _i < _qCount; _i++) {
  711 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  712 + _lpObj = _internalLpArray[_j];
  713 + _groupObj = _lpObj.getGroup(_i);
  714 + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
  715 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  716 + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  717 + }
  718 + if (_bcObj) {
  719 + if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) {
  720 + if (!timediff) {
  721 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  722 + _lpIndex = _j;
  723 + _up_qIndex = _i;
  724 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  725 + } else {
  726 + if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) {
  727 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  728 + _lpIndex = _j;
  729 + _up_qIndex = _i;
  730 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  731 + }
  732 + }
  733 + }
  734 + }
  735 + }
  736 + }
  737 +
  738 + if (_lpIndex == undefined) {
  739 + return false;
  740 + }
  741 +
  742 + var bcindex = [];
  743 + bcindex.push(_lpIndex);
  744 + bcindex.push(_up_qIndex);
  745 + bcindex.push(_up_bIndex);
  746 +
  747 + return bcindex;
  748 + };
  749 +
  750 + /**
  751 + * 查找离指定时间最近的后面的班次索引信息
  752 + * @param timeObj 查找时间
  753 + * @param isUp 是否上行
  754 + * @returns [{路牌index},{圈index},{班次index}]
  755 + */
  756 + var _fnFindDownClosedBcIndexWithTime = function(timeObj, isUp) {
  757 + var _lpObj;
  758 + var _groupObj;
  759 + var _bcObj;
  760 + var _i;
  761 + var _j;
  762 + var timediff; // 时间差取绝对值
  763 +
  764 + var _lpIndex;
  765 + var _down_qIndex;
  766 + var _down_bIndex;
  767 +
  768 + var flag;
  769 +
  770 + for (_i = 0; _i < _qCount; _i++) {
  771 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  772 + _lpObj = _internalLpArray[_j];
  773 + _groupObj = _lpObj.getGroup(_i);
  774 + // TODO:bug
  775 + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
  776 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  777 + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  778 + }
  779 + if (_bcObj) {
  780 + //console.log("timeobj -> bcobj diff flag " +
  781 + // timeObj.format("HH:mm") + "->" +
  782 + // _bcObj.getFcTimeObj().format("HH:mm") +
  783 + // timeObj.diff(_bcObj.getFcTimeObj()) +
  784 + // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0)
  785 + //);
  786 +
  787 + flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0;
  788 +
  789 + if (flag) {
  790 + if (!timediff) {
  791 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  792 + _lpIndex = _j;
  793 + _down_qIndex = _i;
  794 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  795 + } else {
  796 + if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) {
  797 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  798 + _lpIndex = _j;
  799 + _down_qIndex = _i;
  800 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  801 + }
  802 + }
  803 + }
  804 + }
  805 + }
  806 + }
  807 +
  808 + if (_lpIndex == undefined) {
  809 + return false;
  810 + }
  811 +
  812 + var bcindex = [];
  813 + bcindex.push(_lpIndex);
  814 + bcindex.push(_down_qIndex);
  815 + bcindex.push(_down_bIndex);
  816 +
  817 + return bcindex;
  818 + };
  819 +
  820 + /**
  821 + * 获取班次索引。
  822 + * @param oBc 班次对象
  823 + * @returns [{路牌索引},{圈索引},{班次索引}]
  824 + */
  825 + var _fnGetBcIndex = function(oBc) {
  826 + // 路牌索引
  827 + var i;
  828 + var iLpIndex;
  829 + for (i = 0; i < _internalLpArray.length; i++) {
  830 + if (_internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
  831 + iLpIndex = i;
  832 + break;
  833 + }
  834 + }
  835 + // 圈索引
  836 + var j;
  837 + var iGroupIndex;
  838 + var bFlag = false;
  839 + for (i = 0; i < _internalLpArray.length; i++) {
  840 + if (bFlag) {
  841 + break;
  842 + }
  843 + for (j = 0; j < _qCount; j++) {
  844 + if (_internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
  845 + iGroupIndex = j;
  846 + bFlag = true;
  847 + break;
  848 + }
  849 + }
  850 + }
  851 + // 班次索引
  852 + var iBcIndex = _qIsUp == oBc.isUp() ? 0 : 1;
  853 +
  854 + if (iLpIndex == undefined) {
  855 + return null;
  856 + } else {
  857 + return [].concat(iLpIndex, iGroupIndex, iBcIndex);
  858 + }
  859 +
  860 + };
  861 +
  862 + return {
  863 + //------------- 布局初始化方法 ------------//
  864 + /**
  865 + * 初始化数据,使用标线初始化
  866 + */
  867 + fnInitDataWithBxLayout: function() {
  868 + // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中
  869 + _fnInitFun1();
  870 + // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次,计算路牌在各个圈中的间隔
  871 + _fnInitFun2();
  872 + // 初始化布局3,计算连班分班路牌分布
  873 + _fnInitFun3();
  874 + // 初始化布局4,计算中标线位置
  875 + _fnInitFun4();
  876 +
  877 + },
  878 +
  879 + /**
  880 + * 调整高峰班次,
  881 + * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间
  882 + * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后
  883 + * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的)
  884 + * @param isZgf 是否早高峰
  885 + * @param isUp 是否上行
  886 + */
  887 + fnAdjustGfbc : function(isZgf, isUp) {
  888 + var oStartTime; // 开始时间
  889 + var oEndTime; // 结束时间
  890 + var aStartBcIndex; // 开始班次索引
  891 + var aEndBcIndex; // 结束班次索引
  892 +
  893 + oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj();
  894 + oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj();
  895 +
  896 + aStartBcIndex = _fnFindUpClosedBcIndexWithTime(oStartTime, isUp);
  897 + aEndBcIndex = _fnFindDownClosedBcIndexWithTime(oEndTime, isUp);
  898 +
  899 + var iLpIndex;
  900 + var iQIndex;
  901 + var iBcIndex;
  902 + var iQInternelCount; // 高峰时间段中间包含的圈数
  903 + var i;
  904 + var j;
  905 +
  906 + var oLp;
  907 +
  908 + if (aStartBcIndex && aEndBcIndex) {
  909 + iLpIndex = aStartBcIndex[0];
  910 + iQIndex = aStartBcIndex[1];
  911 + iBcIndex = aStartBcIndex[2];
  912 +
  913 + // 处理头
  914 + // 删除头部多余班次
  915 + for (j = 0; j < iLpIndex; j++) {
  916 + oLp = _internalLpArray[j];
  917 + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) {
  918 + oLp.removeBc(iQIndex, iBcIndex);
  919 + }
  920 + }
  921 +
  922 + for (j = iLpIndex; j < _internalLpArray.length; j++) {
  923 + oLp = _internalLpArray[j];
  924 + if (!oLp.getBc(iQIndex, iBcIndex)) {
  925 + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex);
  926 + }
  927 + }
  928 +
  929 + // 处理中间
  930 + iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1;
  931 + for (i = 1; i <= iQInternelCount; i++) {
  932 + oLp = _internalLpArray[iQIndex + i];
  933 +
  934 + if (!oLp.getBc(iQIndex + i, iBcIndex)) {
  935 + _fnGenerateBcAndSetBc(i, iQIndex + i, iBcIndex);
  936 + }
  937 + }
  938 +
  939 + // 处理尾部
  940 + iLpIndex = aEndBcIndex[0];
  941 + iQIndex = aEndBcIndex[1];
  942 + iBcIndex = aEndBcIndex[2];
  943 +
  944 + // 删除尾部多余的班次
  945 + for (j = iLpIndex; j < _internalLpArray.length; j++) {
  946 + oLp = _internalLpArray[j];
  947 + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) {
  948 + oLp.removeBc(iQIndex, iBcIndex);
  949 + }
  950 + }
  951 +
  952 + if (aStartBcIndex[1] != aEndBcIndex[1]) { // 指定时间范围跨圈
  953 + for (j = 0; j < iLpIndex; j++) {
  954 + oLp = _internalLpArray[j];
  955 + if (!oLp.getBc(iQIndex, iBcIndex)) {
  956 + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex);
  957 + }
  958 + }
  959 + } else {
  960 + // 不跨圈,不用处理,处理头的时候已经加了
  961 + }
  962 +
  963 + }
  964 +
  965 + },
  966 +
  967 + /**
  968 + * 按照营运时间要求补充班次,
  969 + * 早高峰7:45分以前出场运营,
  970 + * 晚高峰16:10分以前出场运营
  971 + */
  972 + fnCalcuLpBc_yy: function() {
  973 + // 补班次的时候,针对的是分班班型
  974 + var i;
  975 + var _oLp;
  976 + var _oBc;
  977 + var _aMinBcIndex;
  978 + var _aMaxBcIndex;
  979 +
  980 + var _qIndex;
  981 + var _bIndex;
  982 +
  983 + var _zgfCDate = _paramObj.toTimeObj("7:45");
  984 + var _wgfCDate = _paramObj.toTimeObj("16:10");
  985 + var _ccsj;
  986 +
  987 + for (i = 0; i < _internalLpArray.length; i++) {
  988 + _oLp = _internalLpArray[i];
  989 + if (_oLp.isBxFb()) { // 分班路牌
  990 + // 早高峰部分
  991 + _aMinBcIndex = _oLp.getMinBcObjPosition();
  992 + _qIndex = _aMinBcIndex[0];
  993 + _bIndex = _aMinBcIndex[1];
  994 + _oBc = _oLp.getBc(_qIndex, _bIndex);
  995 + if (_qIsUp) {
  996 + _ccsj = _bIndex == 0 ?
  997 + _paramObj.getUpOutTime() :
  998 + _paramObj.getDownOutTime();
  999 + } else {
  1000 + _ccsj = _bIndex == 0 ?
  1001 + _paramObj.getDownOutTime() :
  1002 + _paramObj.getUpOutTime();
  1003 + }
  1004 + if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) {
  1005 + _fnGenerateBcAndSetBc(
  1006 + i,
  1007 + _bIndex == 0 ? _qIndex - 1 : _qIndex,
  1008 + _bIndex == 0 ? 1 : 0
  1009 + )
  1010 + }
  1011 +
  1012 + // 晚高峰部分
  1013 + _aMaxBcIndex = _oLp.getMaxBcObjPosition();
  1014 + _qIndex = _aMaxBcIndex[0];
  1015 + _bIndex = _aMaxBcIndex[1];
  1016 + _oBc = _oLp.getBc(
  1017 + _bIndex == 0 ? _qIndex - 1 : _qIndex,
  1018 + _bIndex == 0 ? 1 : 0
  1019 + );
  1020 + if (!_oBc) { // 前一个班次不存在,再判定加不加
  1021 + _oBc = _oLp.getBc(_qIndex, _bIndex);
  1022 + if (_qIsUp) {
  1023 + _ccsj = _bIndex == 0 ?
  1024 + _paramObj.getUpOutTime() :
  1025 + _paramObj.getDownOutTime();
  1026 + } else {
  1027 + _ccsj = _bIndex == 0 ?
  1028 + _paramObj.getDownOutTime() :
  1029 + _paramObj.getUpOutTime();
  1030 + }
  1031 + if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) {
  1032 + _fnGenerateBcAndSetBc(
  1033 + i,
  1034 + _bIndex == 0 ? _qIndex - 1 : _qIndex,
  1035 + _bIndex == 0 ? 1 : 0
  1036 + )
  1037 + }
  1038 + }
  1039 + }
  1040 + }
  1041 + },
  1042 +
  1043 + /**
  1044 + * 补充做5休2的班型班次。
  1045 + * 1、确认5_2班型大致多少圈(小数点过.7进位)
  1046 + * 2、获取当前5_2两端车次链的信息,每段的班次数目,还差几个班次没加
  1047 + * 3、如果前面的车次链班次少,则从前面的车次链开始加
  1048 + * 4、如果车次链班次数一样,从从后面的车次链开始加
  1049 + * 5、加班次时都是往车次链前方加
  1050 + * 6、如果前面车次链不能再加班次了,从后面车次链加
  1051 + */
  1052 + fnCalcuLpBx_5_2: function() {
  1053 + // 计算做5休2班型所需的班次数
  1054 + var iBxBcount = _aBxDesc[6].fBcCount;
  1055 + if (iBxBcount - Math.floor(iBxBcount) > 0.7) {
  1056 + iBxBcount = Math.floor(iBxBcount) + 1;
  1057 + } else {
  1058 + iBxBcount = Math.floor(iBxBcount);
  1059 + }
  1060 +
  1061 + var i;
  1062 + var j;
  1063 + var oLp;
  1064 + var iAddBcCount;
  1065 + var oBcChain1;
  1066 + var oBcChain2;
  1067 + var iQindex;
  1068 + var iBindex;
  1069 +
  1070 + for (i = 0; i < _internalLpArray.length; i++) {
  1071 + oLp = _internalLpArray[i];
  1072 + if (oLp.isBxFb5_2()) {
  1073 + iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数
  1074 + for (j = 1; j <= iAddBcCount; j++) {
  1075 + oBcChain1 = oLp.fnGetBcChainInfo(0);
  1076 + oBcChain2 = oLp.fnGetBcChainInfo(1);
  1077 +
  1078 + if (oBcChain1.bcount < oBcChain2.bcount) {
  1079 + iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q;
  1080 + iBindex = oBcChain1.s_b == 0 ? 1 : 0;
  1081 + // 往车次链往前不能加,就往后加
  1082 + if (_fnGenerateBc(i, iQindex, iBindex)) {
  1083 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1084 + } else {
  1085 + iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1;
  1086 + iBindex = oBcChain1.e_b == 0 ? 1 : 0;
  1087 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1088 + }
  1089 +
  1090 + } else if (oBcChain1.bcount > oBcChain2.bcount) {
  1091 + iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q;
  1092 + iBindex = oBcChain2.s_b == 0 ? 1 : 0;
  1093 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1094 + } else {
  1095 + iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q;
  1096 + iBindex = oBcChain2.s_b == 0 ? 1 : 0;
  1097 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1098 + }
  1099 + }
  1100 + }
  1101 + }
  1102 +
  1103 + },
  1104 +
  1105 + /**
  1106 + * 补其他分班班型班次。
  1107 + * 从车次链的后面开始加
  1108 + */
  1109 + fnCalcuLpBx_other: function() {
  1110 + // TODO:根据上标线的首班时间确定班型,小于05:59的做一休一,否则做二休一
  1111 + var oSt = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  1112 + var iBxIndex = 4;
  1113 + if (oSt.isBefore(_paramObj.toTimeObj("05:59"))) {
  1114 + iBxIndex = 5;
  1115 + }
  1116 + // 计算做5休2班型所需的班次数
  1117 + var iQBcount = _aBxDesc[iBxIndex].fQCount;
  1118 + var iBxBcount = Math.round(iQBcount) * 2;
  1119 +
  1120 + var i;
  1121 + var j;
  1122 + var oLp;
  1123 + var iAddBcCount;
  1124 + var oBcChain1;
  1125 + var oBcChain2;
  1126 + var iQindex;
  1127 + var iBindex;
  1128 +
  1129 + for (i = 0; i < _internalLpArray.length; i++) {
  1130 + oLp = _internalLpArray[i];
  1131 + if (oLp.isBxFb() && !oLp.isBxFb5_2()) {
  1132 + iAddBcCount = iBxBcount - oLp.getBcArray().length; // 需要添加的班次数
  1133 + for (j = 1; j <= iAddBcCount; j++) {
  1134 + oBcChain1 = oLp.fnGetBcChainInfo(0);
  1135 + oBcChain2 = oLp.fnGetBcChainInfo(1);
  1136 +
  1137 + if (oBcChain1.bcount < oBcChain2.bcount) {
  1138 + iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1;
  1139 + iBindex = oBcChain1.e_b == 0 ? 1 : 0;
  1140 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1141 + } else if (oBcChain1.bcount > oBcChain2.bcount) {
  1142 + iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1;
  1143 + iBindex = oBcChain2.e_b == 0 ? 1 : 0;
  1144 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1145 + } else {
  1146 + iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1;
  1147 + iBindex = oBcChain2.e_b == 0 ? 1 : 0;
  1148 + _fnGenerateBcAndSetBc(i, iQindex, iBindex);
  1149 + }
  1150 + }
  1151 + }
  1152 + }
  1153 +
  1154 + },
  1155 +
  1156 + /**
  1157 + * 补充连班路牌班次。
  1158 + * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢
  1159 + * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢
  1160 + */
  1161 + fnCalcuLpBx_lb: function() {
  1162 + // 补充连班的班次,参照上标线,中标线补充不足的班次
  1163 +
  1164 + var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引
  1165 + var i;
  1166 + for (i = 0; i < _internalLpArray.length; i++) {
  1167 + if (_internalLpArray[i].isBxLb() && i != 0 && i != _iZbx_lpIndex) {
  1168 + aLbLpindexes.push(i);
  1169 + }
  1170 + }
  1171 +
  1172 + var oEndsj = // 结束时间
  1173 + _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ?
  1174 + _paramObj.getDownLastDTimeObj() :
  1175 + _paramObj.getUpLastDtimeObj();
  1176 +
  1177 + var oLp;
  1178 + var aMinbcPos;
  1179 + var oBc;
  1180 + var j;
  1181 + var iTempBcIndex;
  1182 +
  1183 + // 1、从最小班次开始,往后补充班次
  1184 + for (i = 0; i < aLbLpindexes.length; i++) {
  1185 + oLp = _internalLpArray[aLbLpindexes[i]];
  1186 +
  1187 + // 最小班次索引
  1188 + aMinbcPos = oLp.getMinBcObjPosition();
  1189 + // 使用纵向分隔补充班次,从最小班次向后补
  1190 + iTempBcIndex = aMinbcPos[1] == 0 ? 1 : 0;
  1191 + j = iTempBcIndex == 0 ? aMinbcPos[0] + 1 : aMinbcPos[0];
  1192 +
  1193 + while (j < _qCount) {
  1194 + while (iTempBcIndex <= 1) {
  1195 + oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex);
  1196 + if (oBc &&
  1197 + oBc.getFcTimeObj().isBefore(oEndsj) ) {
  1198 + oLp.setBc(j, iTempBcIndex, oBc);
  1199 + }
  1200 + iTempBcIndex++;
  1201 + }
  1202 + iTempBcIndex = 0;
  1203 + j++;
  1204 + }
  1205 +
  1206 + }
  1207 +
  1208 + // 2、上标线中标线之间的路牌,从最小的班次往前补充班次
  1209 +
  1210 + // 还要补充缺失的班次,差上标线几个班次要往前补上
  1211 + var iBccount;
  1212 + var iQindex;
  1213 + var iBindex;
  1214 + // 补上标线到中标线之间的连班路牌的班次
  1215 + for (i = 0; i < aLbLpindexes.length; i++) {
  1216 + if (aLbLpindexes[i] > 0 && aLbLpindexes[i] < _iZbx_lpIndex) {
  1217 + oLp = _internalLpArray[aLbLpindexes[i]];
  1218 + aMinbcPos = oLp.getMinBcObjPosition();
  1219 + iQindex = aMinbcPos[0];
  1220 + iBindex = aMinbcPos[1];
  1221 + iBccount = (iQindex - 1) * 2 + iBindex; // 距离上标线起始站点差几个班次
  1222 + for (j = 0; j < iBccount; j++) {
  1223 + if (iBindex == 0) {
  1224 + iQindex --;
  1225 + iBindex = 1;
  1226 + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
  1227 + } else if (iBindex == 1) {
  1228 + iBindex --;
  1229 + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
  1230 + }
  1231 + }
  1232 +
  1233 + }
  1234 +
  1235 + }
  1236 +
  1237 + // 3、中标线之后的路牌,从最小的班次往前补充班次
  1238 +
  1239 + // 补中标线以下的连班路牌的班次
  1240 + for (i = 0; i < aLbLpindexes.length; i++) {
  1241 + if (aLbLpindexes[i] > _iZbx_lpIndex) {
  1242 + oLp = _internalLpArray[aLbLpindexes[i]];
  1243 + aMinbcPos = oLp.getMinBcObjPosition();
  1244 + iQindex = aMinbcPos[0];
  1245 + iBindex = aMinbcPos[1];
  1246 + iBccount = (iQindex - 0) * 2 + iBindex - 1; // 距离上标线起始站点差几个班次
  1247 + for (j = 0; j < iBccount; j++) {
  1248 + if (iBindex == 0) {
  1249 + iQindex --;
  1250 + iBindex = 1;
  1251 + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
  1252 + } else if (iBindex == 1) {
  1253 + iBindex --;
  1254 + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex);
  1255 + }
  1256 + }
  1257 + }
  1258 + }
  1259 +
  1260 + },
  1261 +
  1262 + /**
  1263 + * 计算末班车。
  1264 + * 1、将上下行拉成上下行两个班次列表(包括标记班次)
  1265 + * 2、分别找出离末班车发车时间最近的班次,并替换时间
  1266 + * 3、删除之后的班次
  1267 + */
  1268 + fnCalcuLastBc: function() {
  1269 + var i;
  1270 + var iTimeDiff;
  1271 + var iTempTime;
  1272 + var aBc;
  1273 + var oLastBcTime;
  1274 + var oLastBcIsUp;
  1275 + var iModifyIndex;
  1276 +
  1277 + // 查找末班车早的末班车时间和方向
  1278 + if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
  1279 + oLastBcTime = _paramObj.getUpLastDtimeObj();
  1280 + oLastBcIsUp = true;
  1281 + } else {
  1282 + oLastBcTime = _paramObj.getDownLastDTimeObj();
  1283 + oLastBcIsUp = false;
  1284 + }
  1285 +
  1286 + // 确定早的末班车时间
  1287 + aBc = _fnGetBcList(oLastBcIsUp);
  1288 + for (i = 0; i < aBc.length; i++) {
  1289 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1290 + if (iTimeDiff == undefined) {
  1291 + iTimeDiff = iTempTime;
  1292 + iModifyIndex = i;
  1293 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1294 + iTimeDiff = iTempTime;
  1295 + iModifyIndex = i;
  1296 + }
  1297 + }
  1298 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1299 + aBc[iModifyIndex].fnSetDelFlag(false);
  1300 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1301 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1302 + _qIsUp == oLastBcIsUp ?
  1303 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1304 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
  1305 + }
  1306 +
  1307 + // 查找末班车晚的末班车时间和方向
  1308 + if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
  1309 + oLastBcTime = _paramObj.getDownLastDTimeObj();
  1310 + oLastBcIsUp = false;
  1311 + } else {
  1312 + oLastBcTime = _paramObj.getUpLastDtimeObj();
  1313 + oLastBcIsUp = true;
  1314 + }
  1315 + // 确定晚的末班车时间
  1316 + aBc = _fnGetBcList(oLastBcIsUp);
  1317 + var oBc;
  1318 + var aBcIndex;
  1319 + var iLpIndex;
  1320 + var iQIndex;
  1321 + var iBcIndex;
  1322 +
  1323 + iTimeDiff = undefined;
  1324 + for (i = 0; i < aBc.length; i++) {
  1325 + oBc = aBc[i];
  1326 + aBcIndex = _fnGetBcIndex(oBc);
  1327 +
  1328 + iLpIndex = aBcIndex[0];
  1329 + iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
  1330 + iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
  1331 +
  1332 + if (!_internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
  1333 + continue;
  1334 + }
  1335 +
  1336 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1337 + if (iTimeDiff == undefined) {
  1338 + iTimeDiff = iTempTime;
  1339 + iModifyIndex = i;
  1340 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1341 + iTimeDiff = iTempTime;
  1342 + iModifyIndex = i;
  1343 + }
  1344 + }
  1345 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1346 + aBc[iModifyIndex].fnSetDelFlag(false);
  1347 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1348 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1349 + _qIsUp == oLastBcIsUp ?
  1350 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1351 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
  1352 + }
  1353 +
  1354 + },
  1355 +
  1356 + /**
  1357 + * 添加吃饭班次。
  1358 + */
  1359 + fnCalcuEatBc: function() {
  1360 + // 吃午饭时间范围,10:15 到 12:15
  1361 + // 吃晚饭时间范围,18:00 到 19:00
  1362 +
  1363 + if (!_paramObj.fnIsEat()) {
  1364 + return;
  1365 + }
  1366 +
  1367 + // 午饭index
  1368 + var aLEIndex;
  1369 + // 晚饭index
  1370 + var aDEIndex;
  1371 +
  1372 + // 所有吃饭都默认在一个方向,两个方向暂时不考虑
  1373 + if (_paramObj.fnIsUpEat()) {
  1374 + aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), true, false);
  1375 + aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), true, false);
  1376 + } else {
  1377 + aLEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("10:15"), false, true);
  1378 + aDEIndex = _internalLpArray[0].getQBcIndexWithFcTime(_paramObj.toTimeObj("18:00"), false, true);
  1379 + }
  1380 +
  1381 + // 午饭第几圈,第几个班次
  1382 + var iLEQIndex = aLEIndex[0];
  1383 + var iLEBIndex = aLEIndex[1];
  1384 + // 晚饭第几圈,第几个班次
  1385 + var iDEQIndex = aDEIndex[0];
  1386 + var iDEBIndex = aDEIndex[1];
  1387 +
  1388 + // 注意,本模型只有连班才有吃饭
  1389 +
  1390 + var i;
  1391 + var oLp;
  1392 + var aLbIndex = []; // 连班班型的路牌索引
  1393 + for (i = 0; i < _internalLpArray.length; i++) {
  1394 + oLp = _internalLpArray[i];
  1395 + if (oLp.isBxLb()) {
  1396 + aLbIndex.push(i);
  1397 + }
  1398 + }
  1399 +
  1400 + var iLTime;
  1401 + var iDtime;
  1402 + var j;
  1403 + for (i = 0; i < aLbIndex.length; i++) {
  1404 + oLp = _internalLpArray[aLbIndex[i]];
  1405 +
  1406 + // 午饭
  1407 + iLTime = oLp.fnAddEatBc(iLEQIndex, iLEBIndex, _factory, _paramObj);
  1408 + // 晚饭
  1409 + iDtime = oLp.fnAddEatBc(iDEQIndex, iDEBIndex, _factory, _paramObj);
  1410 +
  1411 + if (i == aLbIndex.length - 1) {
  1412 + for (j = aLbIndex[i]; j < _internalLpArray.length; j++) {
  1413 + oLp = _internalLpArray[j];
  1414 + if (oLp.isBxFb()) { // 5休2班型不调整
  1415 + // 修正午饭之后路牌班次的发车时间
  1416 + oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime);
  1417 + oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime);
  1418 + }
  1419 + }
  1420 + } else {
  1421 + for (j = aLbIndex[i]; j < aLbIndex[i + 1]; j++) {
  1422 + oLp = _internalLpArray[j];
  1423 + if (oLp.isBxFb()) {
  1424 + // 修正午饭之后路牌班次的发车时间
  1425 + oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime);
  1426 + oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime);
  1427 + }
  1428 + }
  1429 + }
  1430 + }
  1431 +
  1432 + },
  1433 +
  1434 + /**
  1435 + * 补每个路牌的其他班次(进出场,例保班次)。
  1436 + */
  1437 + fnCalcuOtherBc_: function() {
  1438 + var i;
  1439 + var _lpObj;
  1440 + var _minBcIndex;
  1441 + var _maxBcIndex;
  1442 + var _minBc;
  1443 + var _maxBc;
  1444 + var _otherbc = [];
  1445 + var _oFbbc;
  1446 +
  1447 + for (i = 0; i < _internalLpArray.length; i++) {
  1448 + _lpObj = _internalLpArray[i];
  1449 + _minBcIndex = _lpObj.getMinBcObjPosition();
  1450 + _maxBcIndex = _lpObj.getMaxBcObjPosition();
  1451 + _minBc = _lpObj.getBc(_minBcIndex[0], _minBcIndex[1]);
  1452 + _maxBc = _lpObj.getBc(_maxBcIndex[0], _maxBcIndex[1]);
  1453 +
  1454 + _otherbc = [];
  1455 + _otherbc.push(_factory.createBcObj(
  1456 + _lpObj, "bd", true, 1,
  1457 + _minBc.getFcTimeObj(),
  1458 + _paramObj
  1459 + ));
  1460 + _otherbc.push(_factory.createBcObj(
  1461 + _lpObj, "out", true, 1,
  1462 + _minBc.getFcTimeObj(),
  1463 + _paramObj
  1464 + ));
  1465 +
  1466 + _maxBc.setArrTimeObj(_paramObj.addMinute(_maxBc.getFcTimeObj(), _maxBc.getBcTime()));
  1467 + _maxBc.setStopTime(0);
  1468 + _otherbc.push(_factory.createBcObj(
  1469 + _lpObj, "in", true, 1,
  1470 + _maxBc.getArrTimeObj(),
  1471 + _paramObj
  1472 + ));
  1473 + _otherbc.push(_factory.createBcObj(
  1474 + _lpObj, "lc", true, 1,
  1475 + _maxBc.getArrTimeObj(),
  1476 + _paramObj
  1477 + ));
  1478 +
  1479 + // 5休2分班出场例保班次
  1480 + if (_lpObj.isBxFb5_2()) {
  1481 + _oFbbc = _lpObj.getBc(
  1482 + _lpObj.fnGetBcChainInfo(1)["s_q"],
  1483 + _lpObj.fnGetBcChainInfo(1)["s_b"]
  1484 + );
  1485 +
  1486 + _otherbc.push(_factory.createBcObj(
  1487 + _lpObj, "bd", true, 1,
  1488 + _oFbbc.getFcTimeObj(),
  1489 + _paramObj
  1490 + ));
  1491 + _otherbc.push(_factory.createBcObj(
  1492 + _lpObj, "out", true, 1,
  1493 + _oFbbc.getFcTimeObj(),
  1494 + _paramObj
  1495 + ));
  1496 + }
  1497 +
  1498 + _lpObj.addOtherBcArray(_otherbc);
  1499 + }
  1500 +
  1501 + },
  1502 +
  1503 + /**
  1504 + * 补每个路牌的其他班次(进出场,例保班次)
  1505 + * 所有的车次链前后都加进出场、报道班次
  1506 + */
  1507 + fnCalcuOtherBc: function() {
  1508 + var i;
  1509 + var j;
  1510 + var iBcChainCount;
  1511 + var oLp;
  1512 + var aOtherBc;
  1513 + var oStartBc;
  1514 + var oEndBc;
  1515 +
  1516 + for (i = 0; i < _internalLpArray.length; i++) {
  1517 + aOtherBc = [];
  1518 + oLp = _internalLpArray[i];
  1519 + iBcChainCount = oLp.fnGetBcChainCount();
  1520 +
  1521 + if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
  1522 + // 头部要添加出场,例保班次
  1523 + oStartBc = oLp.getBc(
  1524 + oLp.fnGetBcChainInfo(0)["s_q"],
  1525 + oLp.fnGetBcChainInfo(0)["s_b"]
  1526 + );
  1527 + aOtherBc.push(_factory.createBcObj(
  1528 + oLp, "bd", true, 1,
  1529 + oStartBc.getFcTimeObj(),
  1530 + _paramObj
  1531 + ));
  1532 + aOtherBc.push(_factory.createBcObj(
  1533 + oLp, "out", true, 1,
  1534 + oStartBc.getFcTimeObj(),
  1535 + _paramObj
  1536 + ));
  1537 +
  1538 + // 尾部需添加进场,例保班次
  1539 + oEndBc = oLp.getBc(
  1540 + oLp.fnGetBcChainInfo(0)["e_q"],
  1541 + oLp.fnGetBcChainInfo(0)["e_b"]
  1542 + );
  1543 + aOtherBc.push(_factory.createBcObj(
  1544 + oLp, "in", true, 1,
  1545 + oEndBc.getArrTimeObj(),
  1546 + _paramObj
  1547 + ));
  1548 + aOtherBc.push(_factory.createBcObj(
  1549 + oLp, "lc", true, 1,
  1550 + oEndBc.getArrTimeObj(),
  1551 + _paramObj
  1552 + ));
  1553 + } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
  1554 + // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
  1555 + oStartBc = oLp.getBc(
  1556 + oLp.fnGetBcChainInfo(0)["s_q"],
  1557 + oLp.fnGetBcChainInfo(0)["s_b"]
  1558 + );
  1559 + aOtherBc.push(_factory.createBcObj(
  1560 + oLp, "bd", true, 1,
  1561 + oStartBc.getFcTimeObj(),
  1562 + _paramObj
  1563 + ));
  1564 + aOtherBc.push(_factory.createBcObj(
  1565 + oLp, "out", true, 1,
  1566 + oStartBc.getFcTimeObj(),
  1567 + _paramObj
  1568 + ));
  1569 +
  1570 + oEndBc = oLp.getBc(
  1571 + oLp.fnGetBcChainInfo(0)["e_q"],
  1572 + oLp.fnGetBcChainInfo(0)["e_b"]
  1573 + );
  1574 + aOtherBc.push(_factory.createBcObj(
  1575 + oLp, "in", true, 1,
  1576 + oEndBc.getArrTimeObj(),
  1577 + _paramObj
  1578 + ));
  1579 +
  1580 + // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次
  1581 + oStartBc = oLp.getBc(
  1582 + oLp.fnGetBcChainInfo(1)["s_q"],
  1583 + oLp.fnGetBcChainInfo(1)["s_b"]
  1584 + );
  1585 + aOtherBc.push(_factory.createBcObj(
  1586 + oLp, "bd", true, 1,
  1587 + oStartBc.getFcTimeObj(),
  1588 + _paramObj
  1589 + ));
  1590 + aOtherBc.push(_factory.createBcObj(
  1591 + oLp, "out", true, 1,
  1592 + oStartBc.getFcTimeObj(),
  1593 + _paramObj
  1594 + ));
  1595 +
  1596 + oEndBc = oLp.getBc(
  1597 + oLp.fnGetBcChainInfo(1)["e_q"],
  1598 + oLp.fnGetBcChainInfo(1)["e_b"]
  1599 + );
  1600 + aOtherBc.push(_factory.createBcObj(
  1601 + oLp, "in", true, 1,
  1602 + oEndBc.getArrTimeObj(),
  1603 + _paramObj
  1604 + ));
  1605 + aOtherBc.push(_factory.createBcObj(
  1606 + oLp, "lc", true, 1,
  1607 + oEndBc.getArrTimeObj(),
  1608 + _paramObj
  1609 + ));
  1610 +
  1611 +
  1612 + } else {
  1613 + // 2个车次链以上,暂时没有此班型
  1614 + }
  1615 +
  1616 + oLp.addOtherBcArray(aOtherBc);
  1617 + }
  1618 + },
  1619 +
  1620 + /**
  1621 + * 祛除上标线开头的删除标记的班次。
  1622 + */
  1623 + fnRemoveDelFirstFlagBc: function() {
  1624 + var oLp = _internalLpArray[0];
  1625 + var aMinBcIndex = oLp.getMinBcObjPosition();
  1626 + if (oLp.getBc(aMinBcIndex[0], aMinBcIndex[1]).fnIsDelFlag()) {
  1627 + oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]);
  1628 + }
  1629 + },
  1630 + /**
  1631 + * 祛除上标线结尾的删除标记的班次。
  1632 + */
  1633 + fnRemoveDelLastFlagBc: function() {
  1634 + var oLp = _internalLpArray[0];
  1635 + var aMaxBcIndex = oLp.getMaxBcObjPosition();
  1636 + if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) {
  1637 + oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]);
  1638 + }
  1639 + },
  1640 +
  1641 + /**
  1642 + * 调整路牌班次间隔(核准周转时间,停站时间)。
  1643 + * @param iFre int 迭代次数
  1644 + */
  1645 + fnAdjustLpBcInterval: function(iFre) {
  1646 + if (iFre > 0) {
  1647 + for (var i = 0; i < _internalLpArray.length; i++) {
  1648 + _internalLpArray[i].fnAdjustBcInterval(
  1649 + this.fnCalcuAverPeakStopTime(),
  1650 + this.fnCalcuAverTroughStopTime(),
  1651 + _paramObj);
  1652 + }
  1653 +
  1654 + this.fnAdjustLpBcInterval(iFre - 1);
  1655 + }
  1656 + },
  1657 +
  1658 + /**
  1659 + * 调整班次间隔。
  1660 + * @param bIsUp 是否上行
  1661 + * @param oStartTime 开始时间对象
  1662 + * @param iFre 迭代次数
  1663 + */
  1664 + fnAdjustBcInterval2_: function(bIsUp, oStartTime, iFre) {
  1665 + if (iFre > 0) {
  1666 + var aBc = _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
  1667 + aBc.sort(function(o1, o2) {
  1668 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1669 + return -1;
  1670 + } else {
  1671 + return 1;
  1672 + }
  1673 + });
  1674 + var i;
  1675 + var j;
  1676 +
  1677 + var iBcCountOfGroup = 3; // 3个班次取一次计算
  1678 + var aBcOfGroup; // 3个班次列表
  1679 + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
  1680 +
  1681 + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
  1682 + aBcOfGroup = [];
  1683 + aBcIntervalOfGroup = [];
  1684 + for (j = i; j < i + iBcCountOfGroup; j++) {
  1685 + aBcOfGroup.push(aBc[j]);
  1686 + }
  1687 +
  1688 + for (j = 0; j < aBcOfGroup.length; j++) {
  1689 + if (j < aBcOfGroup.length - 1) {
  1690 + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
  1691 + aBcOfGroup[j].getFcTimeObj(), "m"));
  1692 + }
  1693 + }
  1694 +
  1695 + if (aBcIntervalOfGroup[0] < 19) {
  1696 + aBcOfGroup[1].addMinuteToFcsj(1);
  1697 + } else if (aBcIntervalOfGroup[0] > 20) {
  1698 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1699 + } else {
  1700 + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1701 + //continue;
  1702 + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1703 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1704 + } else {
  1705 + aBcOfGroup[1].addMinuteToFcsj(1);
  1706 + }
  1707 + }
  1708 +
  1709 + }
  1710 +
  1711 + this.fnAdjustBcInterval2(bIsUp, oStartTime, iFre - 1);
  1712 + }
  1713 + },
  1714 +
  1715 + /**
  1716 + * 调整班次间隔。
  1717 + * @param boolean isUp 是否上行
  1718 + * @param oStartTime 开始时间对象
  1719 + * @param fre int 迭代次数
  1720 + */
  1721 + fnAdjustBcInterval: function(isUp, oStartTime, fre) {
  1722 + if (fre > 0) {
  1723 + var aBc = !oStartTime ? _fnGetBcList(isUp) : _fnGetBcList2(isUp, oStartTime); // 指定方向的班次列表
  1724 +
  1725 + aBc.sort(function(o1, o2) {
  1726 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1727 + return -1;
  1728 + } else {
  1729 + return 1;
  1730 + }
  1731 + });
  1732 +
  1733 + var i;
  1734 + var j;
  1735 +
  1736 + var iBcCountOfGroup = 3; // 3个班次取一次计算
  1737 + var aBcOfGroup; // 3个班次列表
  1738 + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
  1739 + var oBcFcTime; // 班次发车时间
  1740 +
  1741 + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
  1742 + aBcOfGroup = [];
  1743 + aBcIntervalOfGroup = [];
  1744 + for (j = i; j < i + iBcCountOfGroup; j++) {
  1745 + aBcOfGroup.push(aBc[j]);
  1746 + }
  1747 +
  1748 + for (j = 0; j < aBcOfGroup.length; j++) {
  1749 + if (j < aBcOfGroup.length - 1) {
  1750 + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
  1751 + aBcOfGroup[j].getFcTimeObj(), "m"));
  1752 + }
  1753 + }
  1754 +
  1755 + // 判定规则
  1756 + oBcFcTime = aBcOfGroup[1].getFcTimeObj();
  1757 +
  1758 + // 第一个班次发车时间不动,根据间隔,调整中间一个班次
  1759 + // 如果3个班次2个间隔时间差1分钟,不调整
  1760 + // 如果第一个间隔大,调整第二个班次往前1分钟
  1761 + // 如果第二个间隔大,调整第二个班次往后1分钟
  1762 +
  1763 + if (_paramObj.isTroughBc(oBcFcTime) &&
  1764 + aBcIntervalOfGroup[0] > _paramObj.getTroughMaxFcjx()) {
  1765 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1766 + }
  1767 +
  1768 + //else if (_paramObj.isMPeakBc(oBcFcTime) &&
  1769 + // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) {
  1770 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1771 + //} else if (_paramObj.isMPeakBc(oBcFcTime) &&
  1772 + // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) {
  1773 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1774 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  1775 + // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) {
  1776 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1777 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  1778 + // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) {
  1779 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1780 + //}
  1781 +
  1782 +
  1783 + else {
  1784 + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1785 + //continue;
  1786 + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1787 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1788 + } else {
  1789 + aBcOfGroup[1].addMinuteToFcsj(1);
  1790 + }
  1791 + }
  1792 +
  1793 + //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1794 + // //continue;
  1795 + //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1796 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1797 + //} else {
  1798 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1799 + //}
  1800 +
  1801 +
  1802 + }
  1803 +
  1804 + this.fnAdjustBcInterval(isUp, oStartTime, fre - 1);
  1805 + }
  1806 +
  1807 + },
  1808 +
  1809 + /**
  1810 + * 调整班次间隔(平均间隔)。
  1811 + * @param bIsUp 是否上行
  1812 + * @param oStartTime 开始时间对象
  1813 + */
  1814 + fnAdjustBcInterval2_avg: function(bIsUp, oStartTime) {
  1815 + var aBc = !oStartTime ? _fnGetBcList(bIsUp) : _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
  1816 + aBc.sort(function(o1, o2) {
  1817 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1818 + return -1;
  1819 + } else {
  1820 + return 1;
  1821 + }
  1822 + });
  1823 +
  1824 + var j;
  1825 + var iCount = aBc.length - 1;
  1826 + var iC1 = Math.floor(aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") / iCount);
  1827 + var iC2 = aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") % iCount;
  1828 + var iTempTime;
  1829 +
  1830 + for (j = 0; j < iCount - iC2; j++) {
  1831 + iTempTime = aBc[j + 1].getFcTimeObj().diff(aBc[j].getFcTimeObj(), "m");
  1832 + aBc[j + 1].addMinuteToFcsj(iC1 - iTempTime);
  1833 + }
  1834 + for (j = 0; j < iC2; j++) {
  1835 + iTempTime = aBc[iCount - iC2 + j + 1].getFcTimeObj().diff(aBc[iCount - iC2 + j].getFcTimeObj(), "m");
  1836 + aBc[iCount - iC2 + j + 1].addMinuteToFcsj(iC1 + 1 - iTempTime);
  1837 + }
  1838 +
  1839 + },
  1840 +
  1841 + /**
  1842 + * 计算高峰平均停站时间。
  1843 + */
  1844 + fnCalcuAverPeakStopTime: function() {
  1845 + var i;
  1846 + var j;
  1847 + var aBc;
  1848 + var iBcCount = 0;
  1849 + var iSum = 0;
  1850 + for (i = 0; i < _internalLpArray.length; i++) {
  1851 + aBc = _internalLpArray[i].getBcArray();
  1852 +
  1853 + for (j = 0; j < aBc.length; j++) {
  1854 + if (!_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
  1855 + iBcCount ++;
  1856 + iSum += aBc[j].getStopTime();
  1857 + }
  1858 + }
  1859 + }
  1860 +
  1861 + return Math.floor(iSum / iBcCount);
  1862 + },
  1863 +
  1864 + /**
  1865 + * 计算低谷平均停站时间。
  1866 + */
  1867 + fnCalcuAverTroughStopTime: function() {
  1868 + var i;
  1869 + var j;
  1870 + var aBc;
  1871 + var iBcCount = 0;
  1872 + var iSum = 0;
  1873 + for (i = 0; i < _internalLpArray.length; i++) {
  1874 + aBc = _internalLpArray[i].getBcArray();
  1875 + for (j = 0; j < aBc.length; j++) {
  1876 + if (_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
  1877 + iBcCount ++;
  1878 + iSum += aBc[j].getStopTime();
  1879 + }
  1880 + }
  1881 + }
  1882 +
  1883 + return Math.floor(iSum / iBcCount);
  1884 + },
  1885 +
  1886 + //------------- 其他方法 -------------//
  1887 + /**
  1888 + * 返回内部路牌数据列表。
  1889 + * @returns {Array}
  1890 + */
  1891 + fnGetLpArray: function() {
  1892 + return _internalLpArray;
  1893 + },
  1894 +
  1895 + /**
  1896 + * 内部数据转化成显示用的班次数组。
  1897 + */
  1898 + fnToGanttBcArray: function() {
  1899 + var aAllBc = [];
  1900 + var aLpBc = [];
  1901 + var aEatBc = [];
  1902 + var oLp;
  1903 + var i;
  1904 + var j;
  1905 +
  1906 + for (i = 0; i < _internalLpArray.length; i++) {
  1907 + oLp = _internalLpArray[i];
  1908 + aLpBc = [];
  1909 + aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
  1910 +
  1911 + aEatBc = [];
  1912 + // 根据班次的吃饭时间添加吃饭班次
  1913 + for (j = 0; j < aLpBc.length; j++) {
  1914 + if (aLpBc[j].fnGetEatTime() > 0) {
  1915 + aEatBc.push(_factory.createBcObj(
  1916 + oLp,
  1917 + "cf",
  1918 + !aLpBc[j].isUp(), // 和上一个班次方向相反
  1919 + 1,
  1920 + _paramObj.addMinute(aLpBc[j].getArrTimeObj(), aLpBc[j].getStopTime()), // 使用上一个班次的到达时间作为开始时间
  1921 + _paramObj
  1922 + ));
  1923 + }
  1924 + }
  1925 + aLpBc = aLpBc.concat(aEatBc);
  1926 +
  1927 + // 按照发车时间排序
  1928 + aLpBc.sort(function(o1, o2) {
  1929 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1930 + return -1;
  1931 + } else {
  1932 + return 1;
  1933 + }
  1934 + });
  1935 +
  1936 + // 重新赋值fcno
  1937 + for (j = 0; j < aLpBc.length; j++) {
  1938 + aLpBc[j].fnSetFcno(j + 1);
  1939 + }
  1940 +
  1941 + aAllBc = aAllBc.concat(aLpBc);
  1942 + }
  1943 +
  1944 + var aGanttBc = [];
  1945 + for (i = 0; i < aAllBc.length; i++) {
  1946 + aGanttBc.push(aAllBc[i].toGanttBcObj());
  1947 + }
  1948 +
  1949 + return aGanttBc;
  1950 + }
  1951 +
  1952 + };
  1953 +
1949 1954 };
1950 1955 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
1   -/**
2   - * 主类。
3   - */
4   -var Main_v2 = function() {
5   -
6   - // 内部工厂类
7   - var _factoryFun = function() {
8   - return {
9   - // 创建参数
10   - createParameterObj: function(formMap, dataMap) {
11   - var paramObj = ParameterObj();
12   - paramObj.wrap(formMap, dataMap);
13   - return paramObj;
14   - },
15   - // 创建班次对象
16   - createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
17   - var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);
18   - var _fcsj = fcTimeObj;
19   - var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp);
20   - var _arrsj = paramObj.addMinute(_fcsj, _bcsj);
21   - //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
22   - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, undefined);
23   - var _tccid = paramObj.getTTinfoId();
24   - var _ttinfoid = paramObj.getTTinfoId();
25   - var _xl = paramObj.getXlId();
26   - var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
27   - var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
28   -
29   - if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间
30   - if (isUp) { // 上行
31   - _fcsj = paramObj.addMinute(
32   - _fcsj,
33   - -(paramObj.getUpOutTime() + paramObj.getLbTime()));
34   - _bcsj = paramObj.getLbTime();
35   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
36   - _stoptime = 0;
37   - } else { // 下行
38   - _fcsj = paramObj.addMinute(
39   - _fcsj,
40   - -(paramObj.getDownOutTime() + paramObj.getLbTime()));
41   - _bcsj = paramObj.getLbTime();
42   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
43   - _stoptime = 0;
44   - }
45   - } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间
46   - if (isUp) { // 上行
47   - _fcsj = paramObj.addMinute(
48   - _fcsj,
49   - paramObj.getUpInTime());
50   - _bcsj = paramObj.getLbTime();
51   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
52   - _stoptime = 0;
53   - } else { // 下行
54   - _fcsj = paramObj.addMinute(
55   - _fcsj,
56   - paramObj.getDownInTime());
57   - _bcsj = paramObj.getLbTime();
58   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
59   - _stoptime = 0;
60   - }
61   - } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间
62   - if (isUp) { // 上行
63   - _fcsj = paramObj.addMinute(
64   - _fcsj,
65   - -paramObj.getUpOutTime());
66   - _bcsj = paramObj.getUpOutTime();
67   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
68   - _stoptime = 0;
69   - } else { // 下行
70   - _fcsj = paramObj.addMinute(
71   - _fcsj,
72   - -paramObj.getDownOutTime());
73   - _bcsj = paramObj.getDownOutTime();
74   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
75   - _stoptime = 0;
76   - }
77   - } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间
78   - if (isUp) { // 上行
79   - _bcsj = paramObj.getUpInTime();
80   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
81   - _stoptime = 0;
82   - } else { // 下行
83   - _bcsj = paramObj.getDownInTime();
84   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
85   - _stoptime = 0;
86   - }
87   - } else if (bcType == "cf") { // 吃饭班次
88   - // 以13:00为分界,之前的为午饭,之后的为晚饭
89   - if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) {
90   - _bcsj = paramObj.fnGetLunchTime();
91   - } else {
92   - _bcsj = paramObj.fnGetDinnerTime();
93   - }
94   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
95   - _stoptime = 0;
96   - }
97   -
98   - var bcParamObj = {};
99   - bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等)
100   - bcParamObj.isUp = isUp; // boolean是否上下行
101   - bcParamObj.fcno = fcno; // 发车顺序号
102   - bcParamObj.fcTimeObj = _fcsj; // 发车时间对象
103   - bcParamObj.bclc = _bclc; // 班次里程
104   - bcParamObj.bcsj = _bcsj; // 班次历时
105   - bcParamObj.arrtime = _arrsj; // 到达时间对象
106   - bcParamObj.stoptime = _stoptime; // 停站时间
107   - bcParamObj.tccid = _tccid; // 停车场id
108   - bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
109   - bcParamObj.xl = _xl; // 线路id
110   - bcParamObj.qdzid = _qdz; // 起点站id
111   - bcParamObj.zdzid = _zdz; // 终点站id
112   -
113   - return new InternalBcObj(lpObj, bcParamObj);
114   - }
115   - };
116   - };
117   - var _factory = _factoryFun();
118   -
119   - // 所有的时间使用moment.js计算
120   -
121   - var _paramObj; // 参数对象
122   -
123   - var _bxDesc = [ // 班型描述
124   - {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0},
125   - {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0},
126   - {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0},
127   - {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0},
128   - {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0},
129   - {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0},
130   - {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0},
131   - {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0}
132   - ];
133   -
134   - var _funCalcuExportData_lpObjList = function(aInternalLpObj) {
135   - // 构造路牌对象
136   - var aLpObj = [];
137   - var i;
138   - var j;
139   - var z;
140   - var oInternalLp;
141   - var oInternalBc;
142   - var oInternalBc_temp;
143   - var oLp;
144   - var iZbc;
145   - var iZgs;
146   - for (i = 0; i < aInternalLpObj.length; i++) {
147   - oInternalLp = aInternalLpObj[i];
148   - iZbc = 0;
149   - iZgs = 0;
150   - oLp = {
151   - "lpname": oInternalLp.getLpName(), // 路牌名字
152   - "isUp": oInternalLp.isUp(), // 每圈的第一个班次是否上行
153   - "bcObjList": [], // 班次列表
154   - "groupCount": oInternalLp.fnGetGroupCount(), // 总圈数
155   - "zgs": 0, // 总工时
156   - "zbc": 0, // 总班次
157   - "stationRouteId1": 0, // 第一个班次起点站路由id
158   - "stationRouteId2": 0 // 第二个班次起点站路由id
159   - };
160   -
161   - // 将报到班次,进出场班次加到班次的时间上
162   - var iBcChainCount;
163   - var oStartBc;
164   - var oEndBc;
165   - var oTempBc;
166   - var aFcsj = [];
167   -
168   - iBcChainCount = oInternalLp.fnGetBcChainCount();
169   - if (iBcChainCount == 1) { // 单一车次链,连班班型
170   - oStartBc = oInternalLp.getBc(
171   - oInternalLp.fnGetBcChainInfo(0)["s_q"],
172   - oInternalLp.fnGetBcChainInfo(0)["s_b"]
173   - );
174   - oTempBc = _factory.createBcObj(
175   - oLp, "bd", true, 1,
176   - oStartBc.getFcTimeObj(),
177   - _paramObj
178   - );
179   - aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
180   - oTempBc = _factory.createBcObj(
181   - oLp, "out", true, 1,
182   - oStartBc.getFcTimeObj(),
183   - _paramObj
184   - );
185   - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
186   - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
187   - oStartBc._$_fcsj_desc = aFcsj.join("");
188   -
189   - oLp.bcObjList.push({ // 出场班次
190   - "bcsj": oTempBc.getBcTime(), // 班次时间
191   - "ssj": oTempBc.getStopTime(), // 停站时间
192   - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
193   -
194   - "tccid": oTempBc._$_tccid, // 停车场id
195   - "qdzid": oTempBc._$_qdzid, // 起点站id
196   - "zdzid": oTempBc._$_zdzid, // 终点站id
197   -
198   - "isUp": oTempBc._$_isUp, // 是否上行
199   -
200   - "bcType": oTempBc._$_bcType, // 班次类型
201   - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
202   -
203   - "groupNo": -1, // 第几圈
204   - "groupBcNo": -1 // 圈里第几个班次
205   -
206   - });
207   -
208   - aFcsj = [];
209   -
210   - oEndBc = oInternalLp.getBc(
211   - oInternalLp.fnGetBcChainInfo(0)["e_q"],
212   - oInternalLp.fnGetBcChainInfo(0)["e_b"]
213   - );
214   - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
215   - oTempBc = _factory.createBcObj(
216   - oLp, "in", true, 1,
217   - oEndBc.getArrTimeObj(),
218   - _paramObj
219   - );
220   - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
221   -
222   - oLp.bcObjList.push({ // 进场班次
223   - "bcsj": oTempBc.getBcTime(), // 班次时间
224   - "ssj": oTempBc.getStopTime(), // 停站时间
225   - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
226   -
227   - "tccid": oTempBc._$_tccid, // 停车场id
228   - "qdzid": oTempBc._$_qdzid, // 起点站id
229   - "zdzid": oTempBc._$_zdzid, // 终点站id
230   -
231   - "isUp": oTempBc._$_isUp, // 是否上行
232   -
233   - "bcType": oTempBc._$_bcType, // 班次类型
234   - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
235   -
236   - "groupNo": -2, // 第几圈
237   - "groupBcNo": -2 // 圈里第几个班次
238   -
239   - });
240   -
241   - oTempBc = _factory.createBcObj(
242   - oLp, "lc", true, 1,
243   - oEndBc.getArrTimeObj(),
244   - _paramObj
245   - );
246   - aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
247   - oEndBc._$_fcsj_desc = aFcsj.join("");
248   -
249   - } else if (iBcChainCount == 2) { // 两个车次链,分班班型
250   - oStartBc = oInternalLp.getBc(
251   - oInternalLp.fnGetBcChainInfo(0)["s_q"],
252   - oInternalLp.fnGetBcChainInfo(0)["s_b"]
253   - );
254   - oTempBc = _factory.createBcObj(
255   - oLp, "bd", true, 1,
256   - oStartBc.getFcTimeObj(),
257   - _paramObj
258   - );
259   - aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
260   - oTempBc = _factory.createBcObj(
261   - oLp, "out", true, 1,
262   - oStartBc.getFcTimeObj(),
263   - _paramObj
264   - );
265   - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
266   - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
267   - oStartBc._$_fcsj_desc = aFcsj.join("");
268   -
269   - oLp.bcObjList.push({ // 出场班次
270   - "bcsj": oTempBc.getBcTime(), // 班次时间
271   - "ssj": oTempBc.getStopTime(), // 停站时间
272   - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
273   -
274   - "tccid": oTempBc._$_tccid, // 停车场id
275   - "qdzid": oTempBc._$_qdzid, // 起点站id
276   - "zdzid": oTempBc._$_zdzid, // 终点站id
277   -
278   - "isUp": oTempBc._$_isUp, // 是否上行
279   -
280   - "bcType": oTempBc._$_bcType, // 班次类型
281   - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
282   -
283   - "groupNo": -1, // 第几圈
284   - "groupBcNo": -1 // 圈里第几个班次
285   -
286   - });
287   -
288   - aFcsj = [];
289   -
290   - oEndBc = oInternalLp.getBc(
291   - oInternalLp.fnGetBcChainInfo(0)["e_q"],
292   - oInternalLp.fnGetBcChainInfo(0)["e_b"]
293   - );
294   - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
295   - oTempBc = _factory.createBcObj(
296   - oLp, "in", true, 1,
297   - oEndBc.getArrTimeObj(),
298   - _paramObj
299   - );
300   - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
301   - oTempBc = _factory.createBcObj(
302   - oLp, "lc", true, 1,
303   - oEndBc.getArrTimeObj(),
304   - _paramObj
305   - );
306   - oEndBc._$_fcsj_desc = aFcsj.join("");
307   -
308   - aFcsj = [];
309   -
310   - oStartBc = oInternalLp.getBc(
311   - oInternalLp.fnGetBcChainInfo(1)["s_q"],
312   - oInternalLp.fnGetBcChainInfo(1)["s_b"]
313   - );
314   - oTempBc = _factory.createBcObj(
315   - oLp, "out", true, 1,
316   - oStartBc.getFcTimeObj(),
317   - _paramObj
318   - );
319   - aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
320   - aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
321   - oStartBc._$_fcsj_desc = aFcsj.join("");
322   -
323   - aFcsj = [];
324   -
325   - oEndBc = oInternalLp.getBc(
326   - oInternalLp.fnGetBcChainInfo(1)["e_q"],
327   - oInternalLp.fnGetBcChainInfo(1)["e_b"]
328   - );
329   - aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
330   - oTempBc = _factory.createBcObj(
331   - oLp, "in", true, 1,
332   - oEndBc.getArrTimeObj(),
333   - _paramObj
334   - );
335   - aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
336   -
337   - oLp.bcObjList.push({ // 进场班次
338   - "bcsj": oTempBc.getBcTime(), // 班次时间
339   - "ssj": oTempBc.getStopTime(), // 停站时间
340   - "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
341   -
342   - "tccid": oTempBc._$_tccid, // 停车场id
343   - "qdzid": oTempBc._$_qdzid, // 起点站id
344   - "zdzid": oTempBc._$_zdzid, // 终点站id
345   -
346   - "isUp": oTempBc._$_isUp, // 是否上行
347   -
348   - "bcType": oTempBc._$_bcType, // 班次类型
349   - "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
350   -
351   - "groupNo": -2, // 第几圈
352   - "groupBcNo": -2 // 圈里第几个班次
353   -
354   - });
355   -
356   - oTempBc = _factory.createBcObj(
357   - oLp, "lc", true, 1,
358   - oEndBc.getArrTimeObj(),
359   - _paramObj
360   - );
361   - aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
362   - oEndBc._$_fcsj_desc = aFcsj.join("");
363   -
364   - }
365   -
366   - for (j = 0; j < oInternalLp.fnGetGroupCount(); j++) {
367   - for (z = 0; z < 2; z++) {
368   - oInternalBc = oInternalLp.getBc(j, z);
369   - if (oInternalBc) {
370   - if (oInternalBc.fnGetEatTime() > 0) {
371   - // 吃饭班次是下一个班次开始吃,和本班次方向相反
372   - oInternalBc_temp = oInternalLp.getBc(
373   - z == 1 ? j + 1 : j,
374   - z == 1 ? 0 : 1);
375   -
376   - oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")";
377   - }
378   -
379   - oLp.bcObjList.push({
380   - "bcsj": oInternalBc.getBcTime(), // 班次时间
381   - "ssj": oInternalBc.getStopTime(), // 停站时间
382   - "eatsj": oInternalBc.fnGetEatTime(), // 吃饭时间
383   -
384   - "tccid": oInternalBc._$_tccid, // 停车场id
385   - "qdzid": oInternalBc._$_qdzid, // 起点站id
386   - "zdzid": oInternalBc._$_zdzid, // 终点站id
387   -
388   - "isUp": oInternalBc._$_isUp, // 是否上行
389   -
390   - "bcType": oInternalBc._$_bcType, // 班次类型
391   - "fcsj": oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
392   - "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"),
393   -
394   - "groupNo": j, // 第几圈
395   - "groupBcNo": z // 圈里第几个班次
396   -
397   - });
398   -
399   - iZgs = iZgs +
400   - oInternalBc.getBcTime() + // 班次时间
401   - oInternalBc.getStopTime() + // 停站时间
402   - oInternalBc.fnGetEatTime(); // 吃饭时间
403   - iZbc = iZbc + 1;
404   -
405   - // 设置圈站点路由id
406   - if (oInternalBc.isUp() == oInternalLp.isUp()) { // 第一个班次
407   - if (oLp.stationRouteId1 == 0) {
408   - oLp.stationRouteId1 = oInternalBc._$_qdzid;
409   - }
410   - } else { // 第二个班次
411   - if (oLp.stationRouteId2 == 0) {
412   - oLp.stationRouteId2 = oInternalBc._$_qdzid;
413   - }
414   - }
415   -
416   - }
417   - }
418   -
419   - }
420   -
421   - for (z = 0; z < oInternalLp.getOtherBcArray().length; z++) {
422   - oInternalBc = oInternalLp.getOtherBcArray()[z];
423   - iZgs = iZgs +
424   - oInternalBc.getBcTime() + // 班次时间
425   - oInternalBc.getStopTime(); // 停站时间
426   - if (oInternalBc._$_bcType != "bd" &&
427   - oInternalBc._$_bcType != "lc" &&
428   - oInternalBc._$_bcType != "cf") {
429   - iZbc = iZbc + 1;
430   - }
431   - }
432   -
433   - oLp.zgs = iZgs;
434   - oLp.zbc = iZbc;
435   - aLpObj.push(oLp);
436   - }
437   -
438   - return aLpObj;
439   - };
440   -
441   - var _funCalcuExportData_statInfoList = function(aInternalLpObj) {
442   - var countBc = 0, // 总班次
443   - serviceBc = 0, // 营运班次
444   - jcbc = 0, // 进场总班次.
445   - ccbc = 0, // 出场总班次.
446   - cfbc = 0, // 吃饭总班次.
447   - zwlbbc = 0, // 早晚例保总班次.
448   - countGs = 0.0, // 总工时
449   - servicesj = 0, // 营运班次总时间
450   - jcsj = 0.0, // 进场总时间.
451   - ccsj = 0.0, // 出场总时间.
452   - cfsj = 0.0, // 吃饭总时间.
453   - zwlbsj = 0.0, // 早晚例保总时间.
454   - ksBc = 0, // 空驶班次
455   - serviceLc = 0.0, // 营运里程
456   - ksLc = 0.0, // 空驶里程
457   - avgTzjx = 0.0, // 平均停站间隙
458   - gfServiceBc = 0, // 高峰营运班次
459   - dgServiceBc = 0, // 低谷营运班次
460   - gfAvgTzjx = 0.0, // 高峰平均停站间隙
461   - dgAvgTzjx = 0.0; // 低谷平均停站间隙
462   -
463   - var aAllBc = [];
464   - var oLp;
465   - var oBc;
466   - var i;
467   - var j;
468   -
469   - for (i = 0; i < aInternalLpObj.length; i++) {
470   - oLp = aInternalLpObj[i];
471   - for (j = 0; j < oLp.getBcArray().length; j++) {
472   - aAllBc.push(oLp.getBcArray()[j]);
473   - }
474   - for (j = 0; j < oLp.getOtherBcArray().length; j++) {
475   - aAllBc.push(oLp.getOtherBcArray()[j]);
476   - }
477   - }
478   -
479   - for (i = 0; i < aAllBc.length; i++) {
480   - oBc = aAllBc[i];
481   -
482   - if (oBc.getBcTime() > 0) {
483   - countBc = countBc + 1;
484   - countGs = countGs + oBc.getStopTime() + oBc.getBcTime();
485   - if (_paramObj.isTroughBc(oBc.getFcTimeObj())) {
486   - if (oBc._$_bcType == "normal") {
487   - dgServiceBc = dgServiceBc + 1;
488   - dgAvgTzjx = dgAvgTzjx + oBc.getStopTime();
489   - }
490   - } else {
491   - if (oBc._$_bcType == "normal") {
492   - gfServiceBc = gfServiceBc + 1;
493   - gfAvgTzjx = gfAvgTzjx + oBc.getStopTime();
494   - }
495   - }
496   -
497   - if (oBc._$_bcType == "normal") {
498   - serviceBc = serviceBc + 1;
499   - serviceLc = serviceLc + oBc._$_bclc;
500   - servicesj = servicesj + oBc.getBcTime();
501   - avgTzjx = avgTzjx + oBc.getStopTime();
502   -
503   - if (oBc.fnGetEatTime() > 0) {
504   - cfbc = cfbc + 1;
505   - cfsj = cfsj + oBc.fnGetEatTime();
506   - }
507   - } else if (oBc._$_bcType == "in") {
508   - jcbc = jcbc + 1;
509   - jcsj = jcsj + oBc.getBcTime();
510   - } else if (oBc._$_bcType == "out") {
511   - ccbc = ccbc + 1;
512   - ccsj = ccsj + oBc.getBcTime();
513   - } else if (oBc._$_bcType == "bd") {
514   - zwlbbc = zwlbbc + 1;
515   - zwlbsj = zwlbsj + oBc.getBcTime();
516   - } else if (oBc._$_bcType == "lc") {
517   - zwlbbc = zwlbbc + 1;
518   - zwlbsj = zwlbsj + oBc.getBcTime();
519   - }
520   - }
521   - }
522   -
523   - dgAvgTzjx = dgAvgTzjx / dgServiceBc;
524   - gfAvgTzjx = gfAvgTzjx / gfServiceBc;
525   - avgTzjx = avgTzjx / dgServiceBc;
526   -
527   - return [
528   - {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc},
529   - {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc},
530   - {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc},
531   - {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc},
532   - {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc},
533   - {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc},
534   - {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60},
535   - {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60},
536   - {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60},
537   - {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60},
538   - {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60},
539   - {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60},
540   - {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc},
541   - {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc},
542   - {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc},
543   - {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx},
544   - {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc},
545   - {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc},
546   - {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx},
547   - {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx},
548   - {'statItem': '综合评估', 'statValue': 3}
549   - ];
550   -
551   - };
552   -
553   - return {
554   - /**
555   - * 工厂对象,创建不同的对象。
556   - * @returns {{createParameterObj, createBcObj}}
557   - */
558   - getFactory: function() {
559   - return _factory;
560   - },
561   -
562   - /**
563   - * 使用发车间隔策略生成时刻表。
564   - * @param paramObj 参数对象
565   - * @param lpArray 路牌数组
566   - * @constructor
567   - */
568   - BXPplaceClassesTime03 : function(paramObj, lpArray) {
569   - // 参数对象
570   - _paramObj = paramObj;
571   -
572   - // 1、初始化行车计划
573   - var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);
574   - schedule.fnInitDataWithBxLayout();
575   - // 2、将连班路牌的班次补足
576   - schedule.fnCalcuLpBx_lb();
577   -
578   - // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除
579   - schedule.fnAdjustGfbc(true, true); // 修正上行早高峰
580   - schedule.fnAdjustGfbc(true, false); // 修正下行早高峰
581   - schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰
582   - schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰
583   -
584   - // 6、补吃饭班次
585   - schedule.fnCalcuEatBc();
586   -
587   - // 4、按照车辆投入运营要求补充班次
588   - schedule.fnCalcuLpBc_yy();
589   -
590   - // 5、根据班型补充所有的不足班次
591   - schedule.fnCalcuLpBx_5_2();
592   - schedule.fnCalcuLpBx_other();
593   -
594   - // 7、祛除上标线开头有删除标记的班次
595   - schedule.fnRemoveDelFirstFlagBc();
596   -
597   - // TODO:8、调整路牌班次间隔
598   - schedule.fnAdjustLpBcInterval(1);
599   -
600   - // TODO:9、调整纵向班次间隔
601   - schedule.fnAdjustBcInterval(true, false, 10);
602   - schedule.fnAdjustBcInterval(false, false, 10);
603   -
604   - // 10、确定末班车
605   - schedule.fnCalcuLastBc();
606   -
607   - // 11、祛除上标线结尾有删除标记的班次
608   - schedule.fnRemoveDelLastFlagBc();
609   -
610   - // TODO:12、平均化指定时间后的班次列表间隔
611   - schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50"));
612   - schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50"));
613   -
614   - // 10、补进出场例保班次
615   - schedule.fnCalcuOtherBc();
616   -
617   - //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
618   - // TODO:班型再议
619   - return {
620   - 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
621   - 'aInternalLpObj': schedule.fnGetLpArray()
622   - };
623   -
624   - },
625   - /**
626   - * 导出时刻表配置。
627   - * @param aInternalLpObj 内部路牌对象列表
628   - */
629   - exportDataConfig: function(aInternalLpObj) {
630   - $('.exportAdd').on('click',function() {
631   - var aInfos = {
632   - "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表
633   - "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表
634   - };
635   -
636   - console.log(aInfos);
637   -
638   - $(".exportAdd").addClass("disabled");
639   - $(".exportAdd").html("<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>" + " 正在导出...");
640   -
641   - // 提交
642   - $.ajax({
643   - type: 'POST',
644   - url: "/tidc/exportDTDFile",
645   - dataType: 'binary',
646   - contentType: "application/json",
647   - data: JSON.stringify(aInfos),
648   - success: function(data){
649   - Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
650   -
651   - $(".exportAdd").removeClass("disabled");
652   - $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据");
653   - },
654   - error: function(xhr, type){
655   - alert('错误:TODO');
656   -
657   - $(".exportAdd").removeClass("disabled");
658   - $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据");
659   - }
660   - });
661   -
662   - });
663   - },
664   -
665   - downloadFile: function (data, mimeType, fileName) {
666   - var success = false;
667   - var blob = new Blob([data], { type: mimeType });
668   - try {
669   - if (navigator.msSaveBlob)
670   - navigator.msSaveBlob(blob, fileName);
671   - else {
672   - // Try using other saveBlob implementations, if available
673   - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
674   - if (saveBlob === undefined) throw "Not supported";
675   - saveBlob(blob, fileName);
676   - }
677   - success = true;
678   - } catch (ex) {
679   - console.log("saveBlob method failed with the following exception:");
680   - console.log(ex);
681   - }
682   -
683   - if (!success) {
684   - // Get the blob url creator
685   - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
686   - if (urlCreator) {
687   - // Try to use a download link
688   - var link = document.createElement('a');
689   - if ('download' in link) {
690   - // Try to simulate a click
691   - try {
692   - // Prepare a blob URL
693   - var url = urlCreator.createObjectURL(blob);
694   - link.setAttribute('href', url);
695   -
696   - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
697   - link.setAttribute("download", fileName);
698   -
699   - // Simulate clicking the download link
700   - var event = document.createEvent('MouseEvents');
701   - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
702   - link.dispatchEvent(event);
703   - success = true;
704   -
705   - } catch (ex) {
706   - console.log("Download link method with simulated click failed with the following exception:");
707   - console.log(ex);
708   - }
709   - }
710   -
711   - if (!success) {
712   - // Fallback to window.location method
713   - try {
714   - // Prepare a blob URL
715   - // Use application/octet-stream when using window.location to force download
716   - var url = urlCreator.createObjectURL(blob);
717   - window.location = url;
718   - console.log("Download link method with window.location succeeded");
719   - success = true;
720   - } catch (ex) {
721   - console.log("Download link method with window.location failed with the following exception:");
722   - console.log(ex);
723   - }
724   - }
725   - }
726   - }
727   -
728   - if (!success) {
729   - // Fallback to window.open method
730   - console.log("No methods worked for saving the arraybuffer, using last resort window.open");
731   - window.open("", '_blank', '');
732   - }
733   - }
734   -
735   - };
736   -
737   -}();
  1 +/**
  2 + * 主类。
  3 + */
  4 +var Main_v2 = function() {
  5 +
  6 + // 内部工厂类
  7 + var _factoryFun = function() {
  8 + return {
  9 + // 创建参数
  10 + createParameterObj: function(formMap, dataMap) {
  11 + var paramObj = ParameterObj();
  12 + paramObj.wrap(formMap, dataMap);
  13 + return paramObj;
  14 + },
  15 + // 创建班次对象
  16 + createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
  17 + var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);
  18 + var _fcsj = fcTimeObj;
  19 + var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp);
  20 + var _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  21 + //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
  22 + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, undefined);
  23 + var _tccid = paramObj.getTTinfoId();
  24 + var _ttinfoid = paramObj.getTTinfoId();
  25 + var _xl = paramObj.getXlId();
  26 + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  27 + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  28 +
  29 + if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间
  30 + if (isUp) { // 上行
  31 + _fcsj = paramObj.addMinute(
  32 + _fcsj,
  33 + -(paramObj.getUpOutTime() + paramObj.getLbTime()));
  34 + _bcsj = paramObj.getLbTime();
  35 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  36 + _stoptime = 0;
  37 + } else { // 下行
  38 + _fcsj = paramObj.addMinute(
  39 + _fcsj,
  40 + -(paramObj.getDownOutTime() + paramObj.getLbTime()));
  41 + _bcsj = paramObj.getLbTime();
  42 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  43 + _stoptime = 0;
  44 + }
  45 + } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间
  46 + if (isUp) { // 上行
  47 + _fcsj = paramObj.addMinute(
  48 + _fcsj,
  49 + paramObj.getUpInTime());
  50 + _bcsj = paramObj.getLbTime();
  51 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  52 + _stoptime = 0;
  53 + } else { // 下行
  54 + _fcsj = paramObj.addMinute(
  55 + _fcsj,
  56 + paramObj.getDownInTime());
  57 + _bcsj = paramObj.getLbTime();
  58 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  59 + _stoptime = 0;
  60 + }
  61 + } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间
  62 + if (isUp) { // 上行
  63 + _fcsj = paramObj.addMinute(
  64 + _fcsj,
  65 + -paramObj.getUpOutTime());
  66 + _bcsj = paramObj.getUpOutTime();
  67 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  68 + _stoptime = 0;
  69 + } else { // 下行
  70 + _fcsj = paramObj.addMinute(
  71 + _fcsj,
  72 + -paramObj.getDownOutTime());
  73 + _bcsj = paramObj.getDownOutTime();
  74 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  75 + _stoptime = 0;
  76 + }
  77 + } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间
  78 + if (isUp) { // 上行
  79 + _bcsj = paramObj.getUpInTime();
  80 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  81 + _stoptime = 0;
  82 + } else { // 下行
  83 + _bcsj = paramObj.getDownInTime();
  84 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  85 + _stoptime = 0;
  86 + }
  87 + } else if (bcType == "cf") { // 吃饭班次
  88 + // 以13:00为分界,之前的为午饭,之后的为晚饭
  89 + if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) {
  90 + _bcsj = paramObj.fnGetLunchTime();
  91 + } else {
  92 + _bcsj = paramObj.fnGetDinnerTime();
  93 + }
  94 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  95 + _stoptime = 0;
  96 + }
  97 +
  98 + var bcParamObj = {};
  99 + bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等)
  100 + bcParamObj.isUp = isUp; // boolean是否上下行
  101 + bcParamObj.fcno = fcno; // 发车顺序号
  102 + bcParamObj.fcTimeObj = _fcsj; // 发车时间对象
  103 + bcParamObj.bclc = _bclc; // 班次里程
  104 + bcParamObj.bcsj = _bcsj; // 班次历时
  105 + bcParamObj.arrtime = _arrsj; // 到达时间对象
  106 + bcParamObj.stoptime = _stoptime; // 停站时间
  107 + bcParamObj.tccid = _tccid; // 停车场id
  108 + bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
  109 + bcParamObj.xl = _xl; // 线路id
  110 + bcParamObj.qdzid = _qdz; // 起点站id
  111 + bcParamObj.zdzid = _zdz; // 终点站id
  112 +
  113 + return new InternalBcObj(lpObj, bcParamObj);
  114 + }
  115 + };
  116 + };
  117 + var _factory = _factoryFun();
  118 +
  119 + // 所有的时间使用moment.js计算
  120 +
  121 + var _paramObj; // 参数对象
  122 +
  123 + var _bxDesc = [ // 班型描述
  124 + {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0},
  125 + {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0},
  126 + {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0},
  127 + {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0},
  128 + {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0},
  129 + {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0},
  130 + {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0},
  131 + {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0}
  132 + ];
  133 +
  134 + var _funCalcuExportData_lpObjList = function(aInternalLpObj) {
  135 + // 构造路牌对象
  136 + var aLpObj = [];
  137 + var i;
  138 + var j;
  139 + var z;
  140 + var oInternalLp;
  141 + var oInternalBc;
  142 + var oInternalBc_temp;
  143 + var oLp;
  144 + var iZlc;
  145 + var iYylc;
  146 + var iKslc;
  147 + var iZbc;
  148 + var iZgs;
  149 + var iYygs;
  150 + var iYybc;
  151 + for (i = 0; i < aInternalLpObj.length; i++) {
  152 + oInternalLp = aInternalLpObj[i];
  153 + iZlc = 0;
  154 + iYylc = 0;
  155 + iKslc = 0;
  156 + iZgs = 0;
  157 + iZbc = 0;
  158 + iYygs = 0;
  159 + iYybc = 0;
  160 + oLp = {
  161 + "lpname": oInternalLp.getLpName(), // 路牌名字
  162 + "isUp": oInternalLp.isUp(), // 每圈的第一个班次是否上行
  163 + "bcObjList": [], // 班次列表
  164 + "groupCount": oInternalLp.fnGetGroupCount(), // 总圈数
  165 + "zlc": 0, // 总里程
  166 + "yylc": 0, // 营运里程
  167 + "kslc": 0, // 空驶里程
  168 + "zgs": 0, // 总工时
  169 + "zbc": 0, // 总班次
  170 + "yygs": 0, // 营运工时
  171 + "yybc": 0, // 营运班次
  172 + "stationRouteId1": 0, // 第一个班次起点站路由id
  173 + "stationRouteId2": 0 // 第二个班次起点站路由id
  174 + };
  175 +
  176 + // 将报到班次,进出场班次加到班次的时间上
  177 + var iBcChainCount;
  178 + var oStartBc;
  179 + var oEndBc;
  180 + var oTempBc;
  181 + var aFcsj = [];
  182 +
  183 + iBcChainCount = oInternalLp.fnGetBcChainCount();
  184 + if (iBcChainCount == 1) { // 单一车次链,连班班型
  185 + oStartBc = oInternalLp.getBc(
  186 + oInternalLp.fnGetBcChainInfo(0)["s_q"],
  187 + oInternalLp.fnGetBcChainInfo(0)["s_b"]
  188 + );
  189 + oTempBc = _factory.createBcObj(
  190 + oLp, "bd", true, 1,
  191 + oStartBc.getFcTimeObj(),
  192 + _paramObj
  193 + );
  194 + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  195 + oLp.bcObjList.push({ // 报到班次
  196 + "bcsj": oTempBc.getBcTime(), // 班次时间
  197 + "ssj": oTempBc.getStopTime(), // 停站时间
  198 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  199 +
  200 + "tccid": oTempBc._$_tccid, // 停车场id
  201 + "qdzid": oTempBc._$_qdzid, // 起点站id
  202 + "zdzid": oTempBc._$_zdzid, // 终点站id
  203 +
  204 + "isUp": oTempBc._$_isUp, // 是否上行
  205 +
  206 + "bcType": oTempBc._$_bcType, // 班次类型
  207 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  208 +
  209 + "groupNo": -1, // 第几圈
  210 + "groupBcNo": -1 // 圈里第几个班次
  211 +
  212 + });
  213 +
  214 + oTempBc = _factory.createBcObj(
  215 + oLp, "out", true, 1,
  216 + oStartBc.getFcTimeObj(),
  217 + _paramObj
  218 + );
  219 + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  220 + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
  221 + oStartBc._$_fcsj_desc = aFcsj.join("");
  222 +
  223 + oLp.bcObjList.push({ // 出场班次
  224 + "bcsj": oTempBc.getBcTime(), // 班次时间
  225 + "ssj": oTempBc.getStopTime(), // 停站时间
  226 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  227 +
  228 + "tccid": oTempBc._$_tccid, // 停车场id
  229 + "qdzid": oTempBc._$_qdzid, // 起点站id
  230 + "zdzid": oTempBc._$_zdzid, // 终点站id
  231 +
  232 + "isUp": oTempBc._$_isUp, // 是否上行
  233 +
  234 + "bcType": oTempBc._$_bcType, // 班次类型
  235 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  236 +
  237 + "groupNo": -1, // 第几圈
  238 + "groupBcNo": -2 // 圈里第几个班次
  239 +
  240 + });
  241 +
  242 + aFcsj = [];
  243 +
  244 + oEndBc = oInternalLp.getBc(
  245 + oInternalLp.fnGetBcChainInfo(0)["e_q"],
  246 + oInternalLp.fnGetBcChainInfo(0)["e_b"]
  247 + );
  248 + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
  249 + oTempBc = _factory.createBcObj(
  250 + oLp, "in", true, 1,
  251 + oEndBc.getArrTimeObj(),
  252 + _paramObj
  253 + );
  254 + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  255 +
  256 + oLp.bcObjList.push({ // 进场班次
  257 + "bcsj": oTempBc.getBcTime(), // 班次时间
  258 + "ssj": oTempBc.getStopTime(), // 停站时间
  259 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  260 +
  261 + "tccid": oTempBc._$_tccid, // 停车场id
  262 + "qdzid": oTempBc._$_qdzid, // 起点站id
  263 + "zdzid": oTempBc._$_zdzid, // 终点站id
  264 +
  265 + "isUp": oTempBc._$_isUp, // 是否上行
  266 +
  267 + "bcType": oTempBc._$_bcType, // 班次类型
  268 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  269 +
  270 + "groupNo": -2, // 第几圈
  271 + "groupBcNo": -3 // 圈里第几个班次
  272 +
  273 + });
  274 +
  275 + oTempBc = _factory.createBcObj(
  276 + oLp, "lc", true, 1,
  277 + oEndBc.getArrTimeObj(),
  278 + _paramObj
  279 + );
  280 + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  281 + oLp.bcObjList.push({ // 离场班次
  282 + "bcsj": oTempBc.getBcTime(), // 班次时间
  283 + "ssj": oTempBc.getStopTime(), // 停站时间
  284 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  285 +
  286 + "tccid": oTempBc._$_tccid, // 停车场id
  287 + "qdzid": oTempBc._$_qdzid, // 起点站id
  288 + "zdzid": oTempBc._$_zdzid, // 终点站id
  289 +
  290 + "isUp": oTempBc._$_isUp, // 是否上行
  291 +
  292 + "bcType": oTempBc._$_bcType, // 班次类型
  293 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  294 +
  295 + "groupNo": -2, // 第几圈
  296 + "groupBcNo": -4 // 圈里第几个班次
  297 +
  298 + });
  299 +
  300 + oEndBc._$_fcsj_desc = aFcsj.join("");
  301 +
  302 + } else if (iBcChainCount == 2) { // 两个车次链,分班班型
  303 + oStartBc = oInternalLp.getBc(
  304 + oInternalLp.fnGetBcChainInfo(0)["s_q"],
  305 + oInternalLp.fnGetBcChainInfo(0)["s_b"]
  306 + );
  307 + oTempBc = _factory.createBcObj(
  308 + oLp, "bd", true, 1,
  309 + oStartBc.getFcTimeObj(),
  310 + _paramObj
  311 + );
  312 + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  313 + oLp.bcObjList.push({ // 报到班次
  314 + "bcsj": oTempBc.getBcTime(), // 班次时间
  315 + "ssj": oTempBc.getStopTime(), // 停站时间
  316 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  317 +
  318 + "tccid": oTempBc._$_tccid, // 停车场id
  319 + "qdzid": oTempBc._$_qdzid, // 起点站id
  320 + "zdzid": oTempBc._$_zdzid, // 终点站id
  321 +
  322 + "isUp": oTempBc._$_isUp, // 是否上行
  323 +
  324 + "bcType": oTempBc._$_bcType, // 班次类型
  325 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  326 +
  327 + "groupNo": -1, // 第几圈
  328 + "groupBcNo": -1 // 圈里第几个班次
  329 +
  330 + });
  331 +
  332 + oTempBc = _factory.createBcObj(
  333 + oLp, "out", true, 1,
  334 + oStartBc.getFcTimeObj(),
  335 + _paramObj
  336 + );
  337 + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  338 + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
  339 + oStartBc._$_fcsj_desc = aFcsj.join("");
  340 +
  341 + oLp.bcObjList.push({ // 出场班次
  342 + "bcsj": oTempBc.getBcTime(), // 班次时间
  343 + "ssj": oTempBc.getStopTime(), // 停站时间
  344 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  345 +
  346 + "tccid": oTempBc._$_tccid, // 停车场id
  347 + "qdzid": oTempBc._$_qdzid, // 起点站id
  348 + "zdzid": oTempBc._$_zdzid, // 终点站id
  349 +
  350 + "isUp": oTempBc._$_isUp, // 是否上行
  351 +
  352 + "bcType": oTempBc._$_bcType, // 班次类型
  353 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  354 +
  355 + "groupNo": -1, // 第几圈
  356 + "groupBcNo": -2 // 圈里第几个班次
  357 +
  358 + });
  359 +
  360 + aFcsj = [];
  361 +
  362 + oEndBc = oInternalLp.getBc(
  363 + oInternalLp.fnGetBcChainInfo(0)["e_q"],
  364 + oInternalLp.fnGetBcChainInfo(0)["e_b"]
  365 + );
  366 + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
  367 + oTempBc = _factory.createBcObj(
  368 + oLp, "in", true, 1,
  369 + oEndBc.getArrTimeObj(),
  370 + _paramObj
  371 + );
  372 + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  373 + oLp.bcObjList.push({ // 进场班次
  374 + "bcsj": oTempBc.getBcTime(), // 班次时间
  375 + "ssj": oTempBc.getStopTime(), // 停站时间
  376 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  377 +
  378 + "tccid": oTempBc._$_tccid, // 停车场id
  379 + "qdzid": oTempBc._$_qdzid, // 起点站id
  380 + "zdzid": oTempBc._$_zdzid, // 终点站id
  381 +
  382 + "isUp": oTempBc._$_isUp, // 是否上行
  383 +
  384 + "bcType": oTempBc._$_bcType, // 班次类型
  385 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  386 +
  387 + "groupNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ?
  388 + oInternalLp.fnGetBcChainInfo(0)["e_q"] :
  389 + oInternalLp.fnGetBcChainInfo(0)["e_q"] + 1, // 第几圈
  390 + "groupBcNo": oInternalLp.fnGetBcChainInfo(0)["e_b"] == 0 ? 1 : 0 // 圈里第几个班次
  391 +
  392 + });
  393 + oEndBc._$_fcsj_desc = aFcsj.join("");
  394 +
  395 + aFcsj = [];
  396 +
  397 + oStartBc = oInternalLp.getBc(
  398 + oInternalLp.fnGetBcChainInfo(1)["s_q"],
  399 + oInternalLp.fnGetBcChainInfo(1)["s_b"]
  400 + );
  401 + oTempBc = _factory.createBcObj(
  402 + oLp, "bd", true, 1,
  403 + oStartBc.getFcTimeObj(),
  404 + _paramObj
  405 + );
  406 + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  407 + oLp.bcObjList.push({ // 报到班次
  408 + "bcsj": oTempBc.getBcTime(), // 班次时间
  409 + "ssj": oTempBc.getStopTime(), // 停站时间
  410 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  411 +
  412 + "tccid": oTempBc._$_tccid, // 停车场id
  413 + "qdzid": oTempBc._$_qdzid, // 起点站id
  414 + "zdzid": oTempBc._$_zdzid, // 终点站id
  415 +
  416 + "isUp": oTempBc._$_isUp, // 是否上行
  417 +
  418 + "bcType": oTempBc._$_bcType, // 班次类型
  419 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  420 +
  421 + "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1, // 第几圈
  422 + "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] // 圈里第几个班次
  423 +
  424 + });
  425 +
  426 + oTempBc = _factory.createBcObj(
  427 + oLp, "out", true, 1,
  428 + oStartBc.getFcTimeObj(),
  429 + _paramObj
  430 + );
  431 + oLp.bcObjList.push({ // 出场班次
  432 + "bcsj": oTempBc.getBcTime(), // 班次时间
  433 + "ssj": oTempBc.getStopTime(), // 停站时间
  434 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  435 +
  436 + "tccid": oTempBc._$_tccid, // 停车场id
  437 + "qdzid": oTempBc._$_qdzid, // 起点站id
  438 + "zdzid": oTempBc._$_zdzid, // 终点站id
  439 +
  440 + "isUp": oTempBc._$_isUp, // 是否上行
  441 +
  442 + "bcType": oTempBc._$_bcType, // 班次类型
  443 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  444 +
  445 + "groupNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ?
  446 + oInternalLp.fnGetBcChainInfo(1)["s_q"] - 1 :
  447 + oInternalLp.fnGetBcChainInfo(1)["s_q"], // 第几圈
  448 + "groupBcNo": oInternalLp.fnGetBcChainInfo(1)["s_b"] == 0 ? 1 : 0 // 圈里第几个班次
  449 +
  450 + });
  451 + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  452 + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")");
  453 + oStartBc._$_fcsj_desc = aFcsj.join("");
  454 +
  455 + aFcsj = [];
  456 +
  457 + oEndBc = oInternalLp.getBc(
  458 + oInternalLp.fnGetBcChainInfo(1)["e_q"],
  459 + oInternalLp.fnGetBcChainInfo(1)["e_b"]
  460 + );
  461 + aFcsj.push("(" + oEndBc.getFcTimeObj().format("HH:mm") + ")");
  462 + oTempBc = _factory.createBcObj(
  463 + oLp, "in", true, 1,
  464 + oEndBc.getArrTimeObj(),
  465 + _paramObj
  466 + );
  467 + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  468 +
  469 + oLp.bcObjList.push({ // 进场班次
  470 + "bcsj": oTempBc.getBcTime(), // 班次时间
  471 + "ssj": oTempBc.getStopTime(), // 停站时间
  472 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  473 +
  474 + "tccid": oTempBc._$_tccid, // 停车场id
  475 + "qdzid": oTempBc._$_qdzid, // 起点站id
  476 + "zdzid": oTempBc._$_zdzid, // 终点站id
  477 +
  478 + "isUp": oTempBc._$_isUp, // 是否上行
  479 +
  480 + "bcType": oTempBc._$_bcType, // 班次类型
  481 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  482 +
  483 + "groupNo": -2, // 第几圈
  484 + "groupBcNo": -3 // 圈里第几个班次
  485 +
  486 + });
  487 +
  488 + oTempBc = _factory.createBcObj(
  489 + oLp, "lc", true, 1,
  490 + oEndBc.getArrTimeObj(),
  491 + _paramObj
  492 + );
  493 +
  494 + oLp.bcObjList.push({ // 离场班次
  495 + "bcsj": oTempBc.getBcTime(), // 班次时间
  496 + "ssj": oTempBc.getStopTime(), // 停站时间
  497 + "eatsj": oTempBc.fnGetEatTime(), // 吃饭时间
  498 +
  499 + "tccid": oTempBc._$_tccid, // 停车场id
  500 + "qdzid": oTempBc._$_qdzid, // 起点站id
  501 + "zdzid": oTempBc._$_zdzid, // 终点站id
  502 +
  503 + "isUp": oTempBc._$_isUp, // 是否上行
  504 +
  505 + "bcType": oTempBc._$_bcType, // 班次类型
  506 + "fcsj": oTempBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  507 +
  508 + "groupNo": -2, // 第几圈
  509 + "groupBcNo": -4 // 圈里第几个班次
  510 +
  511 + });
  512 +
  513 + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")");
  514 + oEndBc._$_fcsj_desc = aFcsj.join("");
  515 +
  516 + }
  517 +
  518 + for (j = 0; j < oInternalLp.fnGetGroupCount(); j++) {
  519 + for (z = 0; z < 2; z++) {
  520 + oInternalBc = oInternalLp.getBc(j, z);
  521 + if (oInternalBc) {
  522 + if (oInternalBc.fnGetEatTime() > 0) {
  523 + // 吃饭班次是下一个班次开始吃,和本班次方向相反
  524 + oInternalBc_temp = oInternalLp.getBc(
  525 + z == 1 ? j + 1 : j,
  526 + z == 1 ? 0 : 1);
  527 +
  528 + oInternalBc_temp._$_fcsj_desc = "(吃" + oInternalBc_temp.getFcTimeObj().format("HH:mm") + ")";
  529 + }
  530 +
  531 + oLp.bcObjList.push({
  532 + "bcsj": oInternalBc.getBcTime(), // 班次时间
  533 + "ssj": oInternalBc.getStopTime(), // 停站时间
  534 + "eatsj": oInternalBc.fnGetEatTime(), // 吃饭时间
  535 +
  536 + "tccid": oInternalBc._$_tccid, // 停车场id
  537 + "qdzid": oInternalBc._$_qdzid, // 起点站id
  538 + "zdzid": oInternalBc._$_zdzid, // 终点站id
  539 +
  540 + "isUp": oInternalBc._$_isUp, // 是否上行
  541 +
  542 + "bcType": oInternalBc._$_bcType, // 班次类型
  543 + "fcsj": oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述
  544 + "fcsjDesc" : oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"),
  545 +
  546 + "groupNo": j, // 第几圈
  547 + "groupBcNo": z // 圈里第几个班次
  548 +
  549 + });
  550 +
  551 + // iZlc = 0;
  552 + // iYylc = 0;
  553 + // iKslc = 0;
  554 + // iZgs = 0;
  555 + // iZbc = 0;
  556 + // iYygs = 0;
  557 + // iYybc = 0;
  558 +
  559 + iZlc = iZlc +
  560 + oInternalBc._$_bclc; // 里程
  561 + iYylc = iYylc +
  562 + oInternalBc._$_bclc; // 里程
  563 + iYygs = iYygs +
  564 + oInternalBc.getBcTime() + // 班次时间
  565 + oInternalBc.getStopTime() + // 停站时间
  566 + oInternalBc.fnGetEatTime(); // 吃饭时间
  567 + iYybc = iYybc + 1;
  568 +
  569 + iZgs = iZgs +
  570 + oInternalBc.getBcTime() + // 班次时间
  571 + oInternalBc.getStopTime() + // 停站时间
  572 + oInternalBc.fnGetEatTime(); // 吃饭时间
  573 + iZbc = iZbc + 1;
  574 +
  575 + // 设置圈站点路由id
  576 + if (oInternalBc.isUp() == oInternalLp.isUp()) { // 第一个班次
  577 + if (oLp.stationRouteId1 == 0) {
  578 + oLp.stationRouteId1 = oInternalBc._$_qdzid;
  579 + }
  580 + } else { // 第二个班次
  581 + if (oLp.stationRouteId2 == 0) {
  582 + oLp.stationRouteId2 = oInternalBc._$_qdzid;
  583 + }
  584 + }
  585 +
  586 + }
  587 + }
  588 +
  589 + }
  590 +
  591 + for (z = 0; z < oInternalLp.getOtherBcArray().length; z++) {
  592 + oInternalBc = oInternalLp.getOtherBcArray()[z];
  593 + iKslc = iKslc +
  594 + oInternalBc._$_bclc; // 里程
  595 + iZlc = iZlc +
  596 + oInternalBc._$_bclc; // 里程
  597 + iZgs = iZgs +
  598 + oInternalBc.getBcTime() + // 班次时间
  599 + oInternalBc.getStopTime(); // 停站时间
  600 + if (oInternalBc._$_bcType != "bd" &&
  601 + oInternalBc._$_bcType != "lc" &&
  602 + oInternalBc._$_bcType != "cf") {
  603 + iZbc = iZbc + 1;
  604 + }
  605 + }
  606 +
  607 + oLp.zlc = iZlc;
  608 + oLp.yylc = iYylc;
  609 + oLp.kslc = iKslc;
  610 + oLp.zgs = iZgs;
  611 + oLp.zbc = iZbc;
  612 + oLp.yygs = iYygs;
  613 + oLp.yybc = iYybc;
  614 + aLpObj.push(oLp);
  615 + }
  616 +
  617 + return aLpObj;
  618 + };
  619 +
  620 + var _funCalcuExportData_statInfoList = function(aInternalLpObj) {
  621 + var countBc = 0, // 总班次
  622 + serviceBc = 0, // 营运班次
  623 + jcbc = 0, // 进场总班次.
  624 + ccbc = 0, // 出场总班次.
  625 + cfbc = 0, // 吃饭总班次.
  626 + zwlbbc = 0, // 早晚例保总班次.
  627 + countGs = 0.0, // 总工时
  628 + servicesj = 0, // 营运班次总时间
  629 + jcsj = 0.0, // 进场总时间.
  630 + ccsj = 0.0, // 出场总时间.
  631 + cfsj = 0.0, // 吃饭总时间.
  632 + zwlbsj = 0.0, // 早晚例保总时间.
  633 + ksBc = 0, // 空驶班次
  634 + serviceLc = 0.0, // 营运里程
  635 + ksLc = 0.0, // 空驶里程
  636 + avgTzjx = 0.0, // 平均停站间隙
  637 + gfServiceBc = 0, // 高峰营运班次
  638 + dgServiceBc = 0, // 低谷营运班次
  639 + gfAvgTzjx = 0.0, // 高峰平均停站间隙
  640 + dgAvgTzjx = 0.0; // 低谷平均停站间隙
  641 +
  642 + var aAllBc = [];
  643 + var oLp;
  644 + var oBc;
  645 + var i;
  646 + var j;
  647 +
  648 + for (i = 0; i < aInternalLpObj.length; i++) {
  649 + oLp = aInternalLpObj[i];
  650 + for (j = 0; j < oLp.getBcArray().length; j++) {
  651 + aAllBc.push(oLp.getBcArray()[j]);
  652 + }
  653 + for (j = 0; j < oLp.getOtherBcArray().length; j++) {
  654 + aAllBc.push(oLp.getOtherBcArray()[j]);
  655 + }
  656 + }
  657 +
  658 + for (i = 0; i < aAllBc.length; i++) {
  659 + oBc = aAllBc[i];
  660 +
  661 + if (oBc.getBcTime() > 0) {
  662 + countBc = countBc + 1;
  663 + countGs = countGs + oBc.getStopTime() + oBc.getBcTime();
  664 + if (_paramObj.isTroughBc(oBc.getFcTimeObj())) {
  665 + if (oBc._$_bcType == "normal") {
  666 + dgServiceBc = dgServiceBc + 1;
  667 + dgAvgTzjx = dgAvgTzjx + oBc.getStopTime();
  668 + }
  669 + } else {
  670 + if (oBc._$_bcType == "normal") {
  671 + gfServiceBc = gfServiceBc + 1;
  672 + gfAvgTzjx = gfAvgTzjx + oBc.getStopTime();
  673 + }
  674 + }
  675 +
  676 + if (oBc._$_bcType == "normal") {
  677 + serviceBc = serviceBc + 1;
  678 + serviceLc = serviceLc + oBc._$_bclc;
  679 + servicesj = servicesj + oBc.getBcTime();
  680 + avgTzjx = avgTzjx + oBc.getStopTime();
  681 +
  682 + if (oBc.fnGetEatTime() > 0) {
  683 + cfbc = cfbc + 1;
  684 + cfsj = cfsj + oBc.fnGetEatTime();
  685 + }
  686 + } else if (oBc._$_bcType == "in") {
  687 + jcbc = jcbc + 1;
  688 + jcsj = jcsj + oBc.getBcTime();
  689 + } else if (oBc._$_bcType == "out") {
  690 + ccbc = ccbc + 1;
  691 + ccsj = ccsj + oBc.getBcTime();
  692 + } else if (oBc._$_bcType == "bd") {
  693 + zwlbbc = zwlbbc + 1;
  694 + zwlbsj = zwlbsj + oBc.getBcTime();
  695 + } else if (oBc._$_bcType == "lc") {
  696 + zwlbbc = zwlbbc + 1;
  697 + zwlbsj = zwlbsj + oBc.getBcTime();
  698 + }
  699 + }
  700 + }
  701 +
  702 + dgAvgTzjx = dgAvgTzjx / dgServiceBc;
  703 + gfAvgTzjx = gfAvgTzjx / gfServiceBc;
  704 + avgTzjx = avgTzjx / dgServiceBc;
  705 +
  706 + return [
  707 + {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc},
  708 + {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc},
  709 + {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc},
  710 + {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc},
  711 + {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc},
  712 + {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc},
  713 + {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60},
  714 + {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60},
  715 + {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60},
  716 + {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60},
  717 + {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60},
  718 + {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60},
  719 + {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc},
  720 + {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc},
  721 + {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc},
  722 + {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx},
  723 + {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc},
  724 + {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc},
  725 + {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx},
  726 + {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx},
  727 + {'statItem': '综合评估', 'statValue': 3}
  728 + ];
  729 +
  730 + };
  731 +
  732 + return {
  733 + /**
  734 + * 工厂对象,创建不同的对象。
  735 + * @returns {{createParameterObj, createBcObj}}
  736 + */
  737 + getFactory: function() {
  738 + return _factory;
  739 + },
  740 +
  741 + /**
  742 + * 使用发车间隔策略生成时刻表。
  743 + * @param paramObj 参数对象
  744 + * @param lpArray 路牌数组
  745 + * @constructor
  746 + */
  747 + BXPplaceClassesTime03 : function(paramObj, lpArray) {
  748 + // 参数对象
  749 + _paramObj = paramObj;
  750 +
  751 + // 1、初始化行车计划
  752 + var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);
  753 + schedule.fnInitDataWithBxLayout();
  754 + // 2、将连班路牌的班次补足
  755 + schedule.fnCalcuLpBx_lb();
  756 +
  757 + // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除
  758 + schedule.fnAdjustGfbc(true, true); // 修正上行早高峰
  759 + schedule.fnAdjustGfbc(true, false); // 修正下行早高峰
  760 + schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰
  761 + schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰
  762 +
  763 + // 6、补吃饭班次
  764 + schedule.fnCalcuEatBc();
  765 +
  766 + // 4、按照车辆投入运营要求补充班次
  767 + schedule.fnCalcuLpBc_yy();
  768 +
  769 + // 5、根据班型补充所有的不足班次
  770 + schedule.fnCalcuLpBx_5_2();
  771 + schedule.fnCalcuLpBx_other();
  772 +
  773 + // 7、祛除上标线开头有删除标记的班次
  774 + schedule.fnRemoveDelFirstFlagBc();
  775 +
  776 + // TODO:8、调整路牌班次间隔
  777 + schedule.fnAdjustLpBcInterval(1);
  778 +
  779 + // TODO:9、调整纵向班次间隔
  780 + schedule.fnAdjustBcInterval(true, false, 10);
  781 + schedule.fnAdjustBcInterval(false, false, 10);
  782 +
  783 + // 10、确定末班车
  784 + schedule.fnCalcuLastBc();
  785 +
  786 + // 11、祛除上标线结尾有删除标记的班次
  787 + schedule.fnRemoveDelLastFlagBc();
  788 +
  789 + // TODO:12、平均化指定时间后的班次列表间隔
  790 + schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50"));
  791 + schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50"));
  792 +
  793 + // 10、补进出场例保班次
  794 + schedule.fnCalcuOtherBc();
  795 +
  796 + //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
  797 + // TODO:班型再议
  798 + return {
  799 + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
  800 + 'aInternalLpObj': schedule.fnGetLpArray()
  801 + };
  802 +
  803 + },
  804 + /**
  805 + * 导出时刻表配置。
  806 + * @param aInternalLpObj 内部路牌对象列表
  807 + */
  808 + exportDataConfig: function(aInternalLpObj) {
  809 + $('.exportAdd').on('click',function() {
  810 + var aInfos = {
  811 + "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表
  812 + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表
  813 + };
  814 +
  815 + console.log(aInfos);
  816 +
  817 + $(".exportAdd").addClass("disabled");
  818 + $(".exportAdd").html("<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>" + " 正在导出...");
  819 +
  820 + // 提交
  821 + $.ajax({
  822 + type: 'POST',
  823 + url: "/tidc/exportDTDFile",
  824 + dataType: 'binary',
  825 + contentType: "application/json",
  826 + data: JSON.stringify(aInfos),
  827 + success: function(data){
  828 + Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
  829 +
  830 + $(".exportAdd").removeClass("disabled");
  831 + $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据");
  832 + },
  833 + error: function(xhr, type){
  834 + alert('错误:TODO');
  835 +
  836 + $(".exportAdd").removeClass("disabled");
  837 + $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据");
  838 + }
  839 + });
  840 +
  841 + });
  842 + },
  843 +
  844 + downloadFile: function (data, mimeType, fileName) {
  845 + var success = false;
  846 + var blob = new Blob([data], { type: mimeType });
  847 + try {
  848 + if (navigator.msSaveBlob)
  849 + navigator.msSaveBlob(blob, fileName);
  850 + else {
  851 + // Try using other saveBlob implementations, if available
  852 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  853 + if (saveBlob === undefined) throw "Not supported";
  854 + saveBlob(blob, fileName);
  855 + }
  856 + success = true;
  857 + } catch (ex) {
  858 + console.log("saveBlob method failed with the following exception:");
  859 + console.log(ex);
  860 + }
  861 +
  862 + if (!success) {
  863 + // Get the blob url creator
  864 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  865 + if (urlCreator) {
  866 + // Try to use a download link
  867 + var link = document.createElement('a');
  868 + if ('download' in link) {
  869 + // Try to simulate a click
  870 + try {
  871 + // Prepare a blob URL
  872 + var url = urlCreator.createObjectURL(blob);
  873 + link.setAttribute('href', url);
  874 +
  875 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  876 + link.setAttribute("download", fileName);
  877 +
  878 + // Simulate clicking the download link
  879 + var event = document.createEvent('MouseEvents');
  880 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  881 + link.dispatchEvent(event);
  882 + success = true;
  883 +
  884 + } catch (ex) {
  885 + console.log("Download link method with simulated click failed with the following exception:");
  886 + console.log(ex);
  887 + }
  888 + }
  889 +
  890 + if (!success) {
  891 + // Fallback to window.location method
  892 + try {
  893 + // Prepare a blob URL
  894 + // Use application/octet-stream when using window.location to force download
  895 + var url = urlCreator.createObjectURL(blob);
  896 + window.location = url;
  897 + console.log("Download link method with window.location succeeded");
  898 + success = true;
  899 + } catch (ex) {
  900 + console.log("Download link method with window.location failed with the following exception:");
  901 + console.log(ex);
  902 + }
  903 + }
  904 + }
  905 + }
  906 +
  907 + if (!success) {
  908 + // Fallback to window.open method
  909 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  910 + window.open("", '_blank', '');
  911 + }
  912 + }
  913 +
  914 + };
  915 +
  916 +}();
... ...
src/main/resources/static/pages/base/timesmodel/tepms/fcjx_temp.html
... ... @@ -86,6 +86,95 @@
86 86  
87 87 <div class="form-group">
88 88 <div class="col-md-6">
  89 + <label class="control-label col-md-5">上行进场时间  :
  90 + </label>
  91 + <div class="col-md-5">
  92 + <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"
  93 + placeholder="请输入上行进场时间">
  94 + </div>
  95 + </div>
  96 + <div class="col-md-6">
  97 + <label class="control-label col-md-5">上行出场时间  :
  98 + </label>
  99 + <div class="col-md-5">
  100 + <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"
  101 + placeholder="请输入上行出场时间">
  102 + </div>
  103 + </div>
  104 + </div>
  105 +
  106 + <div class="form-group">
  107 + <div class="col-md-6">
  108 + <label class="control-label col-md-5">下行进场时间  :
  109 + </label>
  110 + <div class="col-md-5">
  111 + <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"
  112 + placeholder="请输入下行进场时间">
  113 + </div>
  114 + </div>
  115 + <div class="col-md-6">
  116 + <label class="control-label col-md-5">下行出场时间  :
  117 + </label>
  118 + <div class="col-md-5">
  119 + <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"
  120 + placeholder="请输入下行出场时间">
  121 + </div>
  122 + </div>
  123 + </div>
  124 +
  125 + <div class="form-group">
  126 + <div class="col-md-6">
  127 + <label class="control-label col-md-5">早高峰上行时间 :</label>
  128 + <div class="col-md-5">
  129 + <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id"
  130 + placeholder="请输入早高峰上行时间">
  131 + </div>
  132 + </div>
  133 + <div class="col-md-6">
  134 + <label class="control-label col-md-5">早高峰下行时间 :</label>
  135 + <div class="col-md-5">
  136 + <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id"
  137 + placeholder="请输入早高峰下行时间">
  138 + </div>
  139 + </div>
  140 + </div>
  141 +
  142 + <div class="form-group">
  143 + <div class="col-md-6">
  144 + <label class="control-label col-md-5">晚高峰上行时间 :</label>
  145 + <div class="col-md-5">
  146 + <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"
  147 + placeholder="请输入晚高峰上行时间">
  148 + </div>
  149 + </div>
  150 + <div class="col-md-6">
  151 + <label class="control-label col-md-5">晚高峰下行时间 :</label>
  152 + <div class="col-md-5">
  153 + <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"
  154 + placeholder="请输入晚高峰下行时间">
  155 + </div>
  156 + </div>
  157 + </div>
  158 +
  159 + <div class="form-group">
  160 + <div class="col-md-6">
  161 + <label class="control-label col-md-5">低谷上行时间  :</label>
  162 + <div class="col-md-5">
  163 + <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"
  164 + placeholder="请输入低谷上行时间">
  165 + </div>
  166 + </div>
  167 + <div class="col-md-6">
  168 + <label class="control-label col-md-5">低谷下行时间  :</label>
  169 + <div class="col-md-5">
  170 + <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"
  171 + placeholder="请输入低谷下行时间">
  172 + </div>
  173 + </div>
  174 + </div>
  175 +
  176 + <div class="form-group">
  177 + <div class="col-md-6">
89 178 <label class="control-label col-md-5">
90 179 <span class="required"> * </span> 线路规划类型  :
91 180 </label>
... ... @@ -126,6 +215,7 @@
126 215 </div>
127 216 </div>
128 217  
  218 +
129 219 <div class="form-group">
130 220 <div class="col-md-6">
131 221 <label class="control-label col-md-5">工作餐午餐时间 :</label>
... ... @@ -244,18 +334,18 @@
244 334 <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/>
245 335 <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/>
246 336 <!-- 早高峰/晚高峰上下行行驶时间 -->
247   - <input type="hidden" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id" />
248   - <input type="hidden" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id" />
249   - <input type="hidden" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"/>
250   - <input type="hidden" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"/>
  337 + <!--<input type="hidden" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id" />-->
  338 + <!--<input type="hidden" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id" />-->
  339 + <!--<input type="hidden" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"/>-->
  340 + <!--<input type="hidden" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"/>-->
251 341 <!-- 低谷上下行行驶时间 -->
252   - <input type="hidden" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"/>
253   - <input type="hidden" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"/>
  342 + <!--<input type="hidden" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"/>-->
  343 + <!--<input type="hidden" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"/>-->
254 344 <!-- 上下行进场出场时间 -->
255   - <input type="hidden" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"/>
256   - <input type="hidden" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"/>
257   - <input type="hidden" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"/>
258   - <input type="hidden" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"/>
  345 + <!--<input type="hidden" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"/>-->
  346 + <!--<input type="hidden" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"/>-->
  347 + <!--<input type="hidden" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"/>-->
  348 + <!--<input type="hidden" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"/>-->
259 349  
260 350 <!-- 隐藏字段-里程 -->
261 351 <!-- 上下行行驶里程 -->
... ... @@ -366,6 +456,89 @@
366 456 <div class="form-group">
367 457 <div class="col-md-6">
368 458 <label class="control-label col-md-5">
  459 + <span class="required"> * </span> 上行进场时间 :
  460 + </label>
  461 + <div class="col-md-5">
  462 + <p class="form-control-static" data-display="upInTimer"> </p>
  463 + </div>
  464 + </div>
  465 + <div class="col-md-6">
  466 + <label class="control-label col-md-5">
  467 + <span class="required"> * </span> 上行出场时间 :
  468 + </label>
  469 + <div class="col-md-5">
  470 + <p class="form-control-static" data-display="upOutTimer"> </p>
  471 + </div>
  472 + </div>
  473 + </div>
  474 +
  475 + <div class="form-group">
  476 + <div class="col-md-6">
  477 + <label class="control-label col-md-5">
  478 + <span class="required"> * </span> 下行进场时间 :
  479 + </label>
  480 + <div class="col-md-5">
  481 + <p class="form-control-static" data-display="downInTimer"> </p>
  482 + </div>
  483 + </div>
  484 + <div class="col-md-6">
  485 + <label class="control-label col-md-5">
  486 + <span class="required"> * </span> 下行出场时间 :
  487 + </label>
  488 + <div class="col-md-5">
  489 + <p class="form-control-static" data-display="downOutTimer"> </p>
  490 + </div>
  491 + </div>
  492 + </div>
  493 +
  494 + <div class="form-group">
  495 + <div class="col-md-6">
  496 + <label class="control-label col-md-5"> 早高峰上行时间 : </label>
  497 + <div class="col-md-6">
  498 + <p class="form-control-static" data-display="earlyUpTime"> </p>
  499 + </div>
  500 + </div>
  501 + <div class="col-md-6">
  502 + <label class="control-label col-md-5"> 早高峰下行时间 : </label>
  503 + <div class="col-md-4">
  504 + <p class="form-control-static" data-display="earlyDownTime"> </p>
  505 + </div>
  506 + </div>
  507 + </div>
  508 +
  509 + <div class="form-group">
  510 + <div class="col-md-6">
  511 + <label class="control-label col-md-5"> 晚高峰上行时间 : </label>
  512 + <div class="col-md-4">
  513 + <p class="form-control-static" data-display="lateUpTime"> </p>
  514 + </div>
  515 + </div>
  516 + <div class="col-md-6">
  517 + <label class="control-label col-md-5"> 晚高峰下行时间 :</label>
  518 + <div class="col-md-4">
  519 + <p class="form-control-static" data-display="lateDownTime"> </p>
  520 + </div>
  521 + </div>
  522 + </div>
  523 +
  524 + <div class="form-group">
  525 + <div class="col-md-6">
  526 + <label class="control-label col-md-5">低谷上行时间  : </label>
  527 + <div class="col-md-4">
  528 + <p class="form-control-static" data-display="troughUpTime"> </p>
  529 + </div>
  530 + </div>
  531 + <div class="col-md-6">
  532 + <label class="control-label col-md-5"> 低谷下行时间  : </label>
  533 + <div class="col-md-4">
  534 + <p class="form-control-static" data-display="troughDownTime"> </p>
  535 + </div>
  536 + </div>
  537 + </div>
  538 +
  539 + <div class="form-group">
  540 + <div class="col-md-6">
  541 + <label class="control-label col-md-5">
369 542 <span class="required"> * </span> 线路规划类型  :
370 543 </label>
371 544 <div class="col-md-4">
... ...
src/main/resources/static/pages/electricity/list/list.html
... ... @@ -588,12 +588,13 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
588 588  
589 589 function jsyUpdate(){
590 590 var params=getParamsList();
  591 + var id = $(this).data('id');
591 592 $get('/ylb/checkDate',params,function(status){
592 593 if(status=='2'){
593 594 layer.msg('只能操作三天内数据.');
594 595 }else{
595   - var id = $(this).data('id');
596 596 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val();
  597 + console.log(id+"修改驾驶员:"+jsy);
597 598 $get('/dlb/updateJsy',{id:id,jsy:jsy}, function(result){
598 599 layer.msg('修改成功.');
599 600 page = 0;
... ...
src/main/resources/static/pages/forms/mould/firstAndLastBus_delay.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/firstAndLastBus_map.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/onTime2.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/sheetList2.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/busInterval.html
... ... @@ -305,6 +305,7 @@
305 305 params['company'] = company;
306 306 params['subCompany'] = subCompany;
307 307 params['type'] = "query";
  308 + var i = layer.load(2);
308 309 // $(".hidden").removeClass("hidden");
309 310 $get('/busInterval/interval', params, function(result){
310 311 // 把数据填充到模版中
... ... @@ -316,6 +317,7 @@
316 317 _w_table_rowspan("#forms tbody", 3);
317 318 _w_table_rowspan("#forms tbody", 4);
318 319 _w_table_rowspan("#forms tbody", 5);
  320 + layer.close(i);
319 321  
320 322 });
321 323 }
... ... @@ -341,10 +343,12 @@
341 343 params['company'] = company;
342 344 params['subCompany'] = subCompany;
343 345 params['type'] = "export";
  346 + var i = layer.load(2);
344 347 $get('/busInterval/interval', params, function(result){
345 348 window.open("/downloadFile/download?fileName=班次间隔统计表"
346 349 +moment(startDate).format("YYYYMMDD")+"-"
347 350 +moment(endDate).format("YYYYMMDD"));
  351 + layer.close(i);
348 352 });
349 353 });
350 354  
... ... @@ -399,8 +403,8 @@
399 403 params['line'] = " ";
400 404 if(statu == 1)
401 405 params['line'] = line;
402   - params['startDate'] = startDate;
403   - params['endDate'] = endDate;
  406 + params['startDate'] = $("#startDate").val();
  407 + params['endDate'] = $("#endDate").val();
404 408 $get('/pcpc/getModel', params, function(result){
405 409 treeData = createTreeData(result);
406 410 var options = '<option value="">请选择...</option>';
... ... @@ -410,6 +414,23 @@
410 414 $('#model').html(options)/* .select2() */;
411 415 flag = 0;
412 416 });
  417 +// if(statu == 0)
  418 +// var options = '<option value="">请选择...</option>';
  419 +// $('#model').html(options)/* .select2() */;
  420 +// flag = 0;
  421 +// if(statu == 1){
  422 +// params['xl.lineCode_eq'] = line;
  423 +// $get('/tic_ec', params, function(result){
  424 +// treeData = createTreeData(result.data.content);
  425 +// var options = '<option value="">请选择...</option>';
  426 +// $.each(treeData, function(i, g){
  427 +// if(!g.isCancel)
  428 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  429 +// });
  430 +// $('#model').html(options)/* .select2() */;
  431 +// flag = 0;
  432 +// });
  433 +// }
413 434 }
414 435  
415 436 /**
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_delay.html
... ... @@ -230,7 +230,7 @@
230 230 // 把渲染好的模版html文本追加到表格中
231 231 $('#forms tbody').html(tbodyHtml);
232 232  
233   - if(result.length == 0)
  233 + if(list.length == 0)
234 234 $("#export").attr('disabled',"true");
235 235 else
236 236 $("#export").removeAttr("disabled");
... ... @@ -240,13 +240,32 @@
240 240 }
241 241  
242 242 $("#export").on("click",function(){
243   - $("#forms").table2excel({
244   - exclue: ".noExl",
245   - name: "Excel Document Name.xlsx",
246   - filename: "首末班误点班次",
247   - exclude_img: true,
248   - exclude_links: true,
249   - exclude_inputs: true
  243 +// $("#forms").table2excel({
  244 +// exclue: ".noExl",
  245 +// name: "Excel Document Name.xlsx",
  246 +// filename: "首末班误点班次",
  247 +// exclude_img: true,
  248 +// exclude_links: true,
  249 +// exclude_inputs: true
  250 +// });
  251 + var i = layer.load(2);
  252 + var params = {};
  253 + company = $("#company").val();
  254 + subCompany = $("#subCompany").val();
  255 + line = $("#line").val();
  256 + startDate = $("#startDate").val();
  257 + endDate = $("#endDate").val();
  258 + if(line == " ")
  259 + line = "";
  260 + params['company'] = company;
  261 + params['subCompany'] = subCompany;
  262 + params['line'] = line;
  263 + params['startDate'] = startDate;
  264 + params['endDate'] = endDate;
  265 + params['type'] = "delay_export";
  266 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  267 + window.open("/downloadFile/download?fileName=首末班误点班次");
  268 + layer.close(i);
250 269 });
251 270 });
252 271  
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -239,11 +239,13 @@
239 239 });
240 240  
241 241 var list;
  242 + var tempLine;
242 243 $("#forms tbody").on("click","a",function(){
243 244 var index = $(this).parent().parent().index();
244 245 if(index < list.length - 1){
245 246 $.each(list, function(i, g){
246 247 if(index == i){
  248 + tempLine = g.xlbm;
247 249 var tbodyHtml = template('list_maps',{list:g.map});
248 250 $('#map tbody').html(tbodyHtml);
249 251 $("#sumMap tr").addClass("hidden");
... ... @@ -304,11 +306,13 @@
304 306 $("#sumMap tr").addClass("hidden");
305 307 $("#exportMap").addClass("hidden");
306 308 $("#exportSumMap").addClass("hidden");
  309 + var i = layer.load(2);
307 310 $get('/pcpc/firstAndLastBus_sum', params, function(result){
308 311 // 把数据填充到模版中
309 312 var tbodyHtml = template('list_firstAndLastBus_sum',{list:result});
310 313 // 把渲染好的模版html文本追加到表格中
311 314 $('#forms tbody').html(tbodyHtml);
  315 + layer.close(i);
312 316  
313 317 list = result;
314 318  
... ... @@ -327,30 +331,56 @@
327 331 params['startDate'] = startDate;
328 332 params['endDate'] = endDate;
329 333 params['type'] = "export";
  334 + var i = layer.load(2);
330 335 $get('/pcpc/firstAndLastBus_sum', params, function(result){
331 336 window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(startDate).format("YYYYMMDD")+(startDate==endDate?"":("-"+moment(endDate).format("YYYYMMDD"))));
  337 + layer.close(i);
332 338 });
333 339 });
334 340  
335 341 $("#exportMap").on("click",function(){
336   - $("#map").table2excel({
337   - exclue: ".noExl",
338   - name: "Excel Document Name.xlsx",
339   - filename: "线路首末班",
340   - exclude_img: true,
341   - exclude_links: true,
342   - exclude_inputs: true
  342 +// $("#map").table2excel({
  343 +// exclue: ".noExl",
  344 +// name: "Excel Document Name.xlsx",
  345 +// filename: "线路首末班",
  346 +// exclude_img: true,
  347 +// exclude_links: true,
  348 +// exclude_inputs: true
  349 +// });
  350 + var i = layer.load(2);
  351 + var params = {};
  352 + params['company'] = company;
  353 + params['subCompany'] = subCompany;
  354 + params['line'] = tempLine;
  355 + params['startDate'] = startDate;
  356 + params['endDate'] = endDate;
  357 + params['type'] = "exportMap";
  358 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  359 + window.open("/downloadFile/download?fileName=线路首末班明细");
  360 + layer.close(i);
343 361 });
344 362 });
345 363  
346 364 $("#exportSumMap").on("click",function(){
347   - $("#sumMap").table2excel({
348   - exclue: ".noExl",
349   - name: "Excel Document Name.xlsx",
350   - filename: "首末班误点班次",
351   - exclude_img: true,
352   - exclude_links: true,
353   - exclude_inputs: true
  365 +// $("#sumMap").table2excel({
  366 +// exclue: ".noExl",
  367 +// name: "Excel Document Name.xlsx",
  368 +// filename: "首末班误点班次",
  369 +// exclude_img: true,
  370 +// exclude_links: true,
  371 +// exclude_inputs: true
  372 +// });
  373 + var i = layer.load(2);
  374 + var params = {};
  375 + params['company'] = company;
  376 + params['subCompany'] = subCompany;
  377 + params['line'] = line;
  378 + params['startDate'] = startDate;
  379 + params['endDate'] = endDate;
  380 + params['type'] = "delay_export";
  381 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  382 + window.open("/downloadFile/download?fileName=首末班误点班次");
  383 + layer.close(i);
354 384 });
355 385 });
356 386  
... ...
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
... ... @@ -388,11 +388,14 @@
388 388 params['company'] = company;
389 389 params['subCompany'] = subCompany;
390 390 params['type'] = "query";
  391 + var i = layer.load(2);
391 392 $("#forms .hidden").removeClass("hidden");
392 393 $get('/busInterval/lineTimeAnaliy', params, function(result){
393 394 console.log(result);
394 395 // 把数据填充到模版中
395 396 var tbodyHtml = template('list_lineTimeAnaly',{list:result});
  397 + layer.close(i);
  398 +
396 399 // 把渲染好的模版html文本追加到表格中
397 400 $('#forms tbody').html(tbodyHtml);
398 401 $("#works_hidden").addClass("hidden");
... ... @@ -482,6 +485,17 @@
482 485 $('#model').html(options)/* .select2() */;
483 486 flag = 0;
484 487 });
  488 +// params['xl.lineCode_eq'] = line;
  489 +// $get('/tic_ec', params, function(result){
  490 +// treeData = createTreeData(result.data.content);
  491 +// var options = '<option value="">请选择...</option>';
  492 +// $.each(treeData, function(i, g){
  493 +// if(!g.isCancel)
  494 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  495 +// });
  496 +// $('#model').html(options)/* .select2() */;
  497 +// flag = 0;
  498 +// });
485 499 }
486 500  
487 501 /**
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
... ... @@ -252,11 +252,13 @@
252 252 params['subCompany'] = subCompany;
253 253 params['type'] = "query";
254 254 $(".hidden").removeClass("hidden");
  255 + var i = layer.load(2);
255 256 $get('/pcpc/scheduleAnaly', params, function(result){
256 257 // 把数据填充到模版中
257 258 var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList});
258 259 // 把渲染好的模版html文本追加到表格中
259 260 $('#forms tbody').html(tbodyHtml);
  261 + layer.close(i);
260 262  
261 263 if(result.dataList.length == 0)
262 264 $("#export").attr('disabled',"true");
... ... @@ -286,8 +288,10 @@
286 288 params['subCompany'] = subCompany;
287 289 params['bcType'] = bcType;
288 290 params['type'] = "export";
  291 + var i = layer.load(2);
289 292 $get('/pcpc/scheduleAnaly', params, function(result){
290 293 window.open("/downloadFile/download?fileName=时刻表分析"+moment(startDate).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  294 + layer.close(i);
291 295 });
292 296 });
293 297  
... ... @@ -314,6 +318,7 @@
314 318 params['line'] = line;
315 319 params['startDate'] = startDate;
316 320 params['endDate'] = endDate;
  321 + $('#model').html('<option value="">载入中...</option>');
317 322 $get('/pcpc/getModel', params, function(result){
318 323 treeData = createTreeData(result);
319 324 var options = '<option value="">请选择...</option>';
... ... @@ -325,6 +330,17 @@
325 330 $('#model').html(options)/* .select2() */;
326 331 flag = 0;
327 332 });
  333 +// params['xl.lineCode_eq'] = line;
  334 +// $get('/tic_ec', params, function(result){
  335 +// treeData = createTreeData(result.data.content);
  336 +// var options = '<option value="">请选择...</option>';
  337 +// $.each(treeData, function(i, g){
  338 +// if(!g.isCancel)
  339 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  340 +// });
  341 +// $('#model').html(options)/* .select2() */;
  342 +// flag = 0;
  343 +// });
328 344 }
329 345  
330 346 /**
... ...
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
... ... @@ -121,14 +121,6 @@
121 121 if (!$('body').hasClass('page-sidebar-closed'))
122 122 $('.menu-toggler.sidebar-toggler').click();
123 123  
124   - $("#startDate").datetimepicker({
125   - format : 'YYYY-MM-DD',
126   - locale : 'zh-cn'
127   - });
128   - $("#endDate").datetimepicker({
129   - format : 'YYYY-MM-DD',
130   - locale : 'zh-cn'
131   - });
132 124  
133 125 $("#times1").datetimepicker({
134 126 format : 'HH:mm',
... ... @@ -140,6 +132,7 @@
140 132 });
141 133  
142 134 var d = new Date();
  135 + d.setTime(d.getTime() - 1*1000*60*60*24);
143 136 var year = d.getFullYear();
144 137 var month = d.getMonth() + 1;
145 138 var day = d.getDate();
... ... @@ -147,8 +140,19 @@
147 140 month = "0" + month;
148 141 if(day < 10)
149 142 day = "0" + day;
150   - $("#startDate").val(year + "-" + month + "-" + day);
151   - $("#endDate").val(year + "-" + month + "-" + day);
  143 + var dateTime = year + "-" + month + "-" + day;
  144 + $("#startDate").datetimepicker({
  145 + format : 'YYYY-MM-DD',
  146 + locale : 'zh-cn',
  147 + maxDate : dateTime
  148 + });
  149 + $("#endDate").datetimepicker({
  150 + format : 'YYYY-MM-DD',
  151 + locale : 'zh-cn',
  152 + maxDate : dateTime
  153 + });
  154 + $("#startDate").val(dateTime);
  155 + $("#endDate").val(dateTime);
152 156  
153 157 $("#times1").val("05:00");
154 158 $("#times2").val("23:00");
... ... @@ -329,6 +333,7 @@
329 333 params['subCompany'] = subCompany;
330 334 params['type'] = "query";
331 335 // $(".hidden").removeClass("hidden");
  336 + var i = layer.load(2);
332 337 $get('/busInterval/timeAndSpeed', params, function(result){
333 338 // 把数据填充到模版中
334 339 var tbodyHtml = template('list_timeAndSpeed', {list:result});
... ... @@ -336,6 +341,7 @@
336 341 $('#forms').html(tbodyHtml);
337 342 list = result;
338 343 $("#works_hidden").addClass("hidden");
  344 + layer.close(i);
339 345  
340 346 _w_table_rowspan("#forms", 1);
341 347 _w_table_rowspan("#forms", 2);
... ... @@ -388,10 +394,12 @@
388 394 params['company'] = company;
389 395 params['subCompany'] = subCompany;
390 396 params['type'] = "export";
  397 + var i = layer.load(2);
391 398 $get('/busInterval/timeAndSpeed', params, function(result){
392 399 window.open("/downloadFile/download?fileName=行驶时间及车速统计表"
393 400 +moment(startDate).format("YYYYMMDD")+"-"
394 401 +moment(endDate).format("YYYYMMDD"));
  402 + layer.close(i);
395 403 });
396 404 });
397 405  
... ... @@ -451,8 +459,8 @@
451 459 params['line'] = " ";
452 460 if(statu == 1)
453 461 params['line'] = line;
454   - params['startDate'] = startDate;
455   - params['endDate'] = endDate;
  462 + params['startDate'] = $("#startDate").val();
  463 + params['endDate'] = $("#endDate").val();
456 464 $get('/pcpc/getModel', params, function(result){
457 465 treeData = createTreeData(result);
458 466 var options = '<option value="">请选择...</option>';
... ... @@ -462,6 +470,23 @@
462 470 $('#model').html(options);
463 471 flag = 0;
464 472 });
  473 +// if(statu == 0)
  474 +// var options = '<option value="">请选择...</option>';
  475 +// $('#model').html(options)/* .select2() */;
  476 +// flag = 0;
  477 +// if(statu == 1){
  478 +// params['xl.lineCode_eq'] = line;
  479 +// $get('/tic_ec', params, function(result){
  480 +// treeData = createTreeData(result.data.content);
  481 +// var options = '<option value="">请选择...</option>';
  482 +// $.each(treeData, function(i, g){
  483 +// if(!g.isCancel)
  484 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  485 +// });
  486 +// $('#model').html(options)/* .select2() */;
  487 +// flag = 0;
  488 +// });
  489 +// }
465 490 }
466 491  
467 492 function updateLp(ttId){
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -375,10 +375,18 @@
375 375 var zdsjActual = (obj.zdsjActual).split(":");
376 376 var zdsj = (obj.zdsj).split(":");
377 377 if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
378   - obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  378 + if(zdsjActual[0]*60+Number(zdsjActual[1]) - zdsj[0]*60+Number(zdsj[1]) > 1000){
  379 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) + 1440;
  380 + } else {
  381 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  382 + }
379 383 }
380 384 else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
381   - obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  385 + if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) > 1000){
  386 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])) + 1440;
  387 + } else {
  388 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  389 + }
382 390 }
383 391 }
384 392 });
... ...
src/main/resources/static/pages/home.html
... ... @@ -59,7 +59,7 @@
59 59 }
60 60 </style>
61 61 <div class="system_change_log">
62   - <h2 style="text-indent: 35px;margin: 10px 0 5px;">2018-??-?? 更新说明 Changelog</h2>
  62 + <h2 style="text-indent: 35px;margin: 10px 0 5px;">2018-02-06 更新说明 Changelog</h2>
63 63 <ul >
64 64 <li class="sub_title"><h6>基础信息</h6></li>
65 65 <li><span class="label s_c_add">新增</span>1、新增站点间双路段生成功能。</li>
... ...
src/main/resources/static/pages/mforms/singledatas/singledatas.html
... ... @@ -225,20 +225,20 @@
225 225 var gsdmSing = $("#gsdmSing").val();
226 226 var fgsdmSing = $("#fgsdmSing").val();
227 227 var tjtype=$("#tjtype").val();
228   - if(tjtype=='jsy'){
  228 +// if(tjtype=='jsy'){
229 229 $get('/mcy_export/singledataExport',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export'},function(result){
230 230 window.open("/downloadFile/download?fileName=路单数据"+moment(startDate).format("YYYYMMDD"));
231 231 });
232   - }else{
233   - $("#forms").table2excel({
234   - // 不被导出的表格行的CSS class类
235   - exclude: ".noExl",
236   - // 导出的Excel文档的名称,(没看到作用)
237   - name: "Excel Document Name.xlsx",
238   - // Excel文件的名称
239   - filename: "路单数据"+startDate
240   - });
241   - }
  232 +// }else{
  233 +// $("#forms").table2excel({
  234 +// // 不被导出的表格行的CSS class类
  235 +// exclude: ".noExl",
  236 +// // 导出的Excel文档的名称,(没看到作用)
  237 +// name: "Excel Document Name.xlsx",
  238 +// // Excel文件的名称
  239 +// filename: "路单数据"+startDate
  240 +// });
  241 +// }
242 242  
243 243 });
244 244 });
... ... @@ -275,7 +275,7 @@
275 275 <td>{{i+1}}</td>
276 276 <td>{{obj.rQ}}</td>
277 277 <td>{{obj.gS}}</td>
278   - <td>{{obj.xL}}</td>
  278 + <td>{{obj.xlmc}}</td>
279 279 <td>{{obj.clzbh}}</td>
280 280 <td></td>
281 281 <td></td>
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -764,10 +764,10 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
764 764 function jsyUpdate(){
765 765 var params=getParamsList();
766 766 $get('/ylb/checkDate',params,function(status){
  767 + var id = $(this).data('id');
767 768 if(status=='2'){
768 769 layer.msg('只能操作三天内数据.');
769 770 }else{
770   - var id = $(this).data('id');
771 771 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#ll_oil_list').val();
772 772 $get('/ylb/updateJsy',{id:id,jsy:jsy}, function(result){
773 773 layer.msg('修改成功.');
... ...
src/main/resources/static/pages/punctual/list.html
... ... @@ -75,22 +75,31 @@
75 75 });
76 76 });
77 77 $("#exportList").on('click',function(){
78   - $("#forms_2").table2excel({
79   - // 不被导出的表格行的CSS class类
80   - exclude: ".noExl",
81   - // 导出的Excel文档的名称,(没看到作用)
82   - name: "Excel Document Name.xlsx",
83   - // Excel文件的名称
84   - filename: "发车到站准点率"
  78 +// $("#forms_2").table2excel({
  79 +// // 不被导出的表格行的CSS class类
  80 +// exclude: ".noExl",
  81 +// // 导出的Excel文档的名称,(没看到作用)
  82 +// name: "Excel Document Name.xlsx",
  83 +// // Excel文件的名称
  84 +// filename: "发车到站准点率"
  85 +// });
  86 + var date = no.split("_")[0];
  87 + var endDate = date;
  88 + var line = no.split("_")[1];
  89 + var fgs=$('#fgsdm').val();
  90 + var gs=$('#gsdm').val();
  91 + $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:2,type:"export"},function(result){
  92 + window.open("/downloadFile/download?fileName=发车到站准点率详细"+moment(date).format("YYYYMMDD"));
85 93 });
86   - });
  94 +
  95 + });
87 96  
88 97 });
89 98 </script>
90 99 <script type="text/html" id="onTime_2">
91 100 {{each list as obj i}}
92 101 <tr>
93   - <td>{{i+1}}</td>
  102 + <td>{{obj.no}}</td>
94 103 <td>{{obj.zd}}</td>
95 104 <td>{{obj.clzbh}}</td>
96 105 <td>{{obj.jsy}}</td>
... ...
src/main/resources/static/pages/punctual/onTime.html
... ... @@ -98,7 +98,7 @@
98 98 </table>
99 99 </div>
100 100  
101   - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  101 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px" id="forms_1_div">
102 102 <input class="btn btn-default hidden" type="button" id="export_1" value="导出"/>
103 103 <table class="table table-bordered table-hover table-checkable" id="forms_1">
104 104 <thead>
... ... @@ -269,19 +269,27 @@
269 269 $('#forms_h tbody').html(template('onTime_h',{list:result}));
270 270 $('.btn-onTime').on('click', showSheetList);
271 271 layer.close(i);
  272 +
  273 + $("#forms_1_div").addClass("hidden");
  274 + if(result.length == 0)
  275 + $("#export").attr('disabled',"true");
  276 + else
  277 + $("#export").removeAttr("disabled");
272 278 });
273 279 });
  280 + var line1;
274 281 function showSheetList(){
275   - var line = $(this).data('id');
  282 + line1 = $(this).data('id');
276 283 var date = $("#date").val();
277 284 var endDate = $("#endDate").val();
278 285 var fgs=$('#fgsdm').val();
279 286 var gs=$('#gsdm').val();
280 287 var i = layer.load(2);
281   - $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1},function(result){
  288 + $get('/busInterval/onTime',{line:line1,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1},function(result){
282 289 var onTime = template('onTime_1',{list:result});
283 290 $('#forms_1 tbody').html(onTime);
284 291 $('#forms_1_h tbody').html(template('onTime_1_h',{list:result}));
  292 + $("#forms_1_div").removeClass("hidden");
285 293 $("#forms_1 .hidden").removeClass("hidden");
286 294 $('.btn-onTime_1').on('click', openSheetList);
287 295 $("#export_1").removeClass("hidden");
... ... @@ -312,30 +320,47 @@
312 320 });
313 321 }
314 322 $("#export").on("click",function(){
  323 +// $("#forms_h").table2excel({
  324 +// // 不被导出的表格行的CSS class类
  325 +// exclude: ".noExl",
  326 +// // 导出的Excel文档的名称,(没看到作用)
  327 +// name: "Excel Document Name.xlsx",
  328 +// // Excel文件的名称
  329 +// filename: date+"-"+endDate+"发车到站准点率"
  330 +// });
  331 + var line = $("#line").val();
315 332 var date = $("#date").val();
316 333 var endDate = $("#endDate").val();
317   - $("#forms_h").table2excel({
318   - // 不被导出的表格行的CSS class类
319   - exclude: ".noExl",
320   - // 导出的Excel文档的名称,(没看到作用)
321   - name: "Excel Document Name.xlsx",
322   - // Excel文件的名称
323   - filename: date+"-"+endDate+"发车到站准点率"
  334 + var fgs=$('#fgsdm').val();
  335 + var gs=$('#gsdm').val();
  336 + var i = layer.load(2);
  337 + $get('/busInterval/onTime',{line:line,startDate:date,endDate:endDate,gs:gs,fgs:fgs,type:"export"},function(result){
  338 + window.open("/downloadFile/download?fileName=发车到站准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  339 + layer.close(i);
324 340 });
325 341 })
326 342  
327 343 $("#export_1").on("click",function(){
  344 +// var date = $("#date").val();
  345 +// var endDate = $("#endDate").val();
  346 +// $("#forms_1_h").table2excel({
  347 +// // 不被导出的表格行的CSS class类
  348 +// exclude: ".noExl",
  349 +// // 导出的Excel文档的名称,(没看到作用)
  350 +// name: "Excel Document Name.xlsx",
  351 +// // Excel文件的名称
  352 +// filename: date+"-"+endDate+"发车到站准点率"
  353 +// });
328 354 var date = $("#date").val();
329 355 var endDate = $("#endDate").val();
330   - $("#forms_1_h").table2excel({
331   - // 不被导出的表格行的CSS class类
332   - exclude: ".noExl",
333   - // 导出的Excel文档的名称,(没看到作用)
334   - name: "Excel Document Name.xlsx",
335   - // Excel文件的名称
336   - filename: date+"-"+endDate+"发车到站准点率"
  356 + var fgs=$('#fgsdm').val();
  357 + var gs=$('#gsdm').val();
  358 + var i = layer.load(2);
  359 + $get('/busInterval/onTime',{line:line1,startDate:date,endDate:endDate,gs:gs,fgs:fgs,flag:1,type:"export"},function(result){
  360 + window.open("/downloadFile/download?fileName=发车到站准点率明细");
  361 + layer.close(i);
337 362 });
338   - })
  363 + });
339 364  
340 365 });
341 366 </script>
... ...
src/main/resources/static/pages/report/inoutstation.html
... ... @@ -389,6 +389,14 @@
389 389 var id=params[0].split("\\")[0];
390 390 var fcsj = $('.in_carpark_fcsj[data-id='+id+']', '#forms').html();
391 391 var ddsj= $('.in_carpark_zdsj[data-id='+id+']', '#forms').html();
  392 + var d1 = new Date(fcsj+":00");
  393 + var d2 = new Date(ddsj+":00");
  394 + console.log(parseInt(d1 - d2) / 1000 / 60);//两个时间相差的分钟数
  395 + if(parseInt(d1 - d2)>0){
  396 + d2.setDate(d2.getDate()+1);//设置天数 -1 天
  397 + ddsj = d2.getFullYear() + '-' + (d2.getMonth() + 1) + '-' + d2.getDate() + ' ' + d2.getHours() + ':' + d2.getMinutes();
  398 + }
  399 +
392 400 if(!(typeof(fcsj)=='undefined'|| typeof(ddsj)=='undefined')){
393 401 $get('/report/queryListZdxx',{clzbh:nbbm,date:rq,line:line,fcsj:fcsj,ddsj:ddsj},function(result){
394 402 var xlmc="线路: "+$("#select2-line-container").html();
... ... @@ -396,8 +404,8 @@
396 404 var rqmc="日期: "+rq;
397 405 var bcmc="班次: "+fcsj+"-"+ddsj;
398 406 $("#dlzmx").html("到离站详细 "+xlmc+" "+clmc+" "+rqmc+" "+bcmc);
399   - $("#fcsj_xx").val(fcsj);
400   - $("#ddsj_xx").val(ddsj);
  407 + $("#fcsj_xx").val(fcsj);
  408 + $("#ddsj_xx").val(ddsj);
401 409 var ludan_ll_1 = template('ludan_ll_1',{list:result});
402 410 // 把渲染好的模版html文本追加到表格中
403 411 $('#forms1 .ludan_ll_1').html(ludan_ll_1);
... ... @@ -419,7 +427,7 @@
419 427 layer.msg("请选择时间");
420 428 }else if(zdlx=="" || zdlx==null){
421 429 layer.msg("请选择方向");
422   - }else if(zd=="" || zd==null){
  430 + }else if(zd=="" || zd==null||zd==" "){
423 431 layer.msg("请选择站点");
424 432 }else{
425 433 var xlmc="线路: "+$("#select2-line-container").html();
... ... @@ -557,8 +565,8 @@
557 565 整点
558 566 {{/if}}
559 567 )
560   - <span class="in_carpark_fcsj" data-id="{{i+1}}" style="display:none">{{obj.fcsjActual}}</span>
561   - <span class="in_carpark_zdsj" data-id="{{i+1}}" style="display:none">{{obj.zdsjActual}}</span>
  568 + <span class="in_carpark_fcsj" data-id="{{i+1}}" style="display:none">{{obj.realExecDate}} {{obj.fcsjActual}}</span>
  569 + <span class="in_carpark_zdsj" data-id="{{i+1}}" style="display:none">{{obj.realExecDate}} {{obj.zdsjActual}}</span>
562 570 </a>
563 571 {{/if}}
564 572 </td>
... ...
src/main/resources/static/pages/report/sheet/list.html
... ... @@ -56,25 +56,30 @@
56 56 if (!$('body').hasClass('page-sidebar-closed'))
57 57 $('.menu-toggler.sidebar-toggler').click();
58 58 var no="";
59   - $("#sheetList").on('init', function (e, id) {
60   - no=id;
61   - $get('/sheet/sheetList',{id:id},function(result){
  59 + var date = "";
  60 + $("#sheetList").on('init', function (e, id) {
  61 + no=id.split(",")[0];
  62 + var dates = id.split(",")[1].split("-");
  63 + date = dates[0] + dates[1] + dates[2];
  64 + $get('/sheet/sheetList',{id:no},function(result){
62 65 var sheetList_2 = template('sheetList_2',{list:result});
63 66 $('#forms_2 tbody').html(sheetList_2);
64 67 });
65   - })
66   - $("#exportList").on('click',function(){
67   - $("#forms_2").table2excel({
68   - // 不被导出的表格行的CSS class类
69   - exclude: ".noExl",
70   - // 导出的Excel文档的名称,(没看到作用)
71   - name: "Excel Document Name.xlsx",
72   - // Excel文件的名称
73   - filename: "班次准点率"
74   - });
75   -// $get('/sheet/exportList',params,function(result){
76   -// window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD"));
  68 + })
  69 + $("#exportList").on('click',function(){
  70 +// $("#forms_2").table2excel({
  71 +// // 不被导出的表格行的CSS class类
  72 +// exclude: ".noExl",
  73 +// // 导出的Excel文档的名称,(没看到作用)
  74 +// name: "Excel Document Name.xlsx",
  75 +// // Excel文件的名称
  76 +// filename: "班次准点率"
77 77 // });
  78 + var i = layer.load(2);
  79 + $get('/sheet/exportList',{id:no},function(result){
  80 + window.open("/downloadFile/download?fileName=发车准点率"+date);
  81 + layer.close(i);
  82 + });
78 83 });
79 84  
80 85  
... ...
src/main/resources/static/pages/report/sheet/sheetList.html
... ... @@ -31,7 +31,7 @@
31 31 <span class="item-label" style="width: 80px;">公司: </span>
32 32 <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
33 33 </div>
34   - <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv">
  34 + <div style="display: inline-block; margin-left: 38px;" id="fgsdmDiv">
35 35 <span class="item-label" style="width: 80px;">分公司: </span>
36 36 <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
37 37 </div>
... ... @@ -51,6 +51,7 @@
51 51 </div>
52 52  
53 53 <div class="form-group">
  54 + <input type="hidden" id="id"/>
54 55 <input class="btn btn-default" type="button" id="query" value="查询"/>
55 56 <input class="btn btn-default" type="button" id="export" value="导出"/>
56 57 </div>
... ... @@ -244,9 +245,9 @@
244 245 $("#fgsdm").attr("disabled", true);
245 246 }
246 247 });
  248 +
  249 + $("#export").attr('disabled',"true");
247 250  
248   -
249   -
250 251 //查询
251 252 $("#query").on('click',function(){
252 253 var line = $("#line").val();
... ... @@ -263,14 +264,19 @@
263 264 $('#forms_h tbody').html(sheetList_h);
264 265 $('.btn-sheetList').on('click', showSheetList);
265 266 layer.close(i);
  267 + if(result.length == 0)
  268 + $("#export").attr('disabled',"true");
  269 + else
  270 + $("#export").removeAttr("disabled");
266 271 });
267   -// $post('/sheet/saveListSheet',function(result){
  272 +// $post('/sheet/saveListSheet',function(result){
268 273 // });
269 274 });
270 275 function showSheetList(){
271 276 var id = $(this).data('id');
272 277 var date = $("#date").val();
273 278 var endDate = $("#endDate").val();
  279 + $("#id").val(id);
274 280 $get('/sheet/listSheet',{id:id,date:date,endDate:endDate},function(result){
275 281 var sheetList = template('sheetList_1',{list:result});
276 282 var sheetList_h = template('sheetList_1_h',{list:result});
... ... @@ -285,6 +291,7 @@
285 291 }
286 292 function openSheetList(){
287 293 var id = $(this).data('id');
  294 + id += ","+$(this).data('date');
288 295 $.get('/pages/report/sheet/list.html', function (content) {
289 296 layer.open({
290 297 type: 1,
... ... @@ -300,29 +307,43 @@
300 307 });
301 308 }
302 309 $("#export").on("click",function(){
  310 + var line = $("#line").val();
303 311 var date = $("#date").val();
304 312 var endDate = $("#endDate").val();
305   - $("#forms_h").table2excel({
306   - // 不被导出的表格行的CSS class类
307   - exclude: ".noExl",
308   - // 导出的Excel文档的名称,(没看到作用)
309   - name: "Excel Document Name.xlsx",
310   - // Excel文件的名称
311   - filename: date+"-"+endDate+"班次准点率"
  313 + var fgs=$('#fgsdm').val();
  314 + var gs=$('#gsdm').val();
  315 + var i = layer.load(2);
  316 + $get('/sheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,type:"export"},function(result){
  317 + window.open("/downloadFile/download?fileName=发车准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  318 + layer.close(i);
312 319 });
313   - })
  320 +// $("#forms_h").table2excel({
  321 +// // 不被导出的表格行的CSS class类
  322 +// exclude: ".noExl",
  323 +// // 导出的Excel文档的名称,(没看到作用)
  324 +// name: "Excel Document Name.xlsx",
  325 +// // Excel文件的名称
  326 +// filename: date+"-"+endDate+"班次准点率"
  327 +// });
  328 + });
314 329  
315 330 $("#export_1").on("click",function(){
  331 + var id = $("#id").val();
316 332 var date = $("#date").val();
317 333 var endDate = $("#endDate").val();
318   - $("#forms_1_h").table2excel({
319   - // 不被导出的表格行的CSS class类
320   - exclude: ".noExl",
321   - // 导出的Excel文档的名称,(没看到作用)
322   - name: "Excel Document Name.xlsx",
323   - // Excel文件的名称
324   - filename: date+"-"+endDate+"班次准点率"
  334 + var i = layer.load(2);
  335 + $get('/sheet/listSheet',{id:id,date:date,endDate:endDate,type:"export"},function(result){
  336 + window.open("/downloadFile/download?fileName=发车准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  337 + layer.close(i);
325 338 });
  339 +// $("#forms_1_h").table2excel({
  340 +// // 不被导出的表格行的CSS class类
  341 +// exclude: ".noExl",
  342 +// // 导出的Excel文档的名称,(没看到作用)
  343 +// name: "Excel Document Name.xlsx",
  344 +// // Excel文件的名称
  345 +// filename: date+"-"+endDate+"班次准点率"
  346 +// });
326 347 })
327 348  
328 349 });
... ... @@ -379,7 +400,7 @@
379 400 <td>{{obj.zdlv}}</td>
380 401 <td>
381 402 <button type="button" class="btn btn-sm blue btn-sheetList_1"
382   - data-id="{{obj.id}}">详细</button>
  403 + data-id="{{obj.id}}" data-date="{{obj.date}}">详细</button>
383 404 </td>
384 405 </tr>
385 406 {{/each}}
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
... ... @@ -396,14 +396,30 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
396 396 // 本地动态数据直接显示,暂时不优化
397 397 var ldata = DataStore.getData(type);
398 398 for (var i = 0; i < ldata.length; i++) {
399   - scope[ctrlAs].$$data_real.push(ldata[i]);
  399 + // 闭包绑定返回最终查询的值
  400 + var calcu_str = scope[ctrlAs].$$internal_match_str(ldata[i]);
  401 + if (calcu_str) {
  402 + // 全拼
  403 + if (!ldata[i]["$fullChars"]) {
  404 + ldata[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  405 + }
  406 + // 简拼
  407 + if (!ldata[i]["$camelChars"]) {
  408 + ldata[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  409 + }
  410 + // 原值
  411 + if (!ldata[i]["$calcu_str"]) {
  412 + ldata[i]["$calcu_str"] = calcu_str;
  413 + }
400 414  
  415 + scope[ctrlAs].$$data_real.push(ldata[i]);
  416 + }
401 417 }
402 418  
403 419 // 重新创建内部ui-select显示用数据,默认取10条记录显示
404 420 scope[ctrlAs].$$data = [];
405 421 for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
406   - if (scope[ctrlAs].$$data.length < 10) {
  422 + if (scope[ctrlAs].$$data.length < 50) {
407 423 scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
408 424 } else {
409 425 break;
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoEdit2.js
... ... @@ -43,6 +43,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
43 43 var old_max_fcno = 0; // 最大发车顺序号
44 44 var old_firstJCBCFcno = 0; // 第一个进场班次发车顺序号
45 45 var old_half_bcs = 0; // 一般的班次数量
  46 + var old_ddreason = {}; // key:{调度原因}, value:所在list下标数组
  47 + var old_dddesc = {}; // key:{调度描述}, value:所在list下标数组
46 48  
47 49 // 内部变量,变更的车辆,变更的人员
48 50 var new_cl1 = undefined; // 新的车辆1(车辆id_车辆自编号)
... ... @@ -51,7 +53,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
51 53 var new_j2 = undefined; // 新的驾驶员2(驾驶员id_姓名_工号)
52 54 var new_s1 = undefined; // 新的售票员1(售票员id_姓名_工号)
53 55 var new_s2 = undefined; // 新的售票员2(售票员id_姓名_工号)
54   -
  56 + var new_ddreason = undefined; // 调度原因
  57 + var new_dddesc = undefined; // 调度描述
55 58  
56 59 // 表单值,被赋值的次数
57 60 var form_data_assign_count = {
... ... @@ -72,6 +75,42 @@ angular.module(&#39;ScheduleApp&#39;).directive(
72 75 post: function(scope, element, attr) {
73 76  
74 77 /**
  78 + * 刷新调度原因数据。
  79 + */
  80 + scope[ctrlAs].$$internal_refresh_dsdata_ddreason = function() {
  81 + if (new_ddreason) {
  82 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  83 + obj.modifyReason = new_ddreason;
  84 + });
  85 + } else {
  86 + // 清空,不使用旧的
  87 + angular.forEach(old_ddreason, function(value, key) {
  88 + angular.forEach(value, function(i) {
  89 + scope[ctrlAs].ds[i].modifyReason = undefined;
  90 + });
  91 + });
  92 + }
  93 + };
  94 +
  95 + /**
  96 + * 刷新调度描述数据。
  97 + */
  98 + scope[ctrlAs].$$internal_refresh_dsdata_dddesc = function() {
  99 + if (new_dddesc) {
  100 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  101 + obj.modifyRemark = new_dddesc;
  102 + });
  103 + } else {
  104 + // 清空,不使用旧的
  105 + angular.forEach(old_dddesc, function(value, key) {
  106 + angular.forEach(value, function(i) {
  107 + scope[ctrlAs].ds[i].modifyRemark = undefined;
  108 + });
  109 + });
  110 + }
  111 + };
  112 +
  113 + /**
75 114 * 刷新车辆数据。
76 115 */
77 116 scope[ctrlAs].$$internal_refresh_dsdata_cl = function() {
... ... @@ -274,6 +313,34 @@ angular.module(&#39;ScheduleApp&#39;).directive(
274 313 }
275 314 };
276 315  
  316 + //-------------- 监控调度原因的变化 ----------------//
  317 + scope.$watch(
  318 + function() {
  319 + return scope[ctrlAs].fd.ddr;
  320 + },
  321 + function(newValue, oldValue) {
  322 + if (newValue || newValue == 0) {
  323 + new_ddreason = newValue;
  324 + }
  325 + scope[ctrlAs].$$internal_refresh_dsdata_ddreason();
  326 + },
  327 + true
  328 + );
  329 +
  330 + //-------------- 监控调度描述的变化 ----------------//
  331 + scope.$watch(
  332 + function() {
  333 + return scope[ctrlAs].fd.ddrdesc;
  334 + },
  335 + function(newValue, oldValue) {
  336 + if (newValue || newValue == 0) {
  337 + new_dddesc = newValue;
  338 + }
  339 + scope[ctrlAs].$$internal_refresh_dsdata_dddesc();
  340 + },
  341 + true
  342 + );
  343 +
277 344  
278 345 //-------------- 监控表单车辆1的变化 ----------------//
279 346 scope.$watch(
... ... @@ -421,6 +488,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
421 488  
422 489 var cl_ids = []; // 车辆ids数组(有顺序)
423 490 var j_s_ids = []; // 驾驶员ids,售票员ids,[{j:id,s:id},...](有顺序)
  491 + var addreason = []; // 营运调度的原因
  492 + var adddesc = []; // 营运导读的备注
424 493 var isRepeat = false;
425 494 var i = 0;
426 495  
... ... @@ -439,6 +508,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(
439 508 old_s[k3] = [];
440 509 }
441 510  
  511 + var dd4 = obj.modifyReason == null || obj.modifyReason == undefined ? undefined :
  512 + obj.modifyReason;
  513 + var dd5 = obj.modifyRemark == null || obj.modifyRemark == undefined ? undefined :
  514 + obj.modifyRemark;
  515 +
  516 + if (!old_ddreason[dd4] && dd4) {
  517 + old_ddreason[dd4] = [];
  518 + }
  519 + if (!old_dddesc[dd5] && dd5) {
  520 + old_dddesc[dd5] = [];
  521 + }
  522 +
442 523 // 闭包
443 524 (function(i) {
444 525 old_cl[k1].push(i);
... ... @@ -448,6 +529,12 @@ angular.module(&#39;ScheduleApp&#39;).directive(
448 529 if (k3) {
449 530 old_s[k3].push(i);
450 531 }
  532 + if (dd4) {
  533 + old_ddreason[dd4].push(i);
  534 + }
  535 + if (dd5) {
  536 + old_dddesc[dd5].push(i);
  537 + }
451 538 })(index);
452 539  
453 540 // 判断是否分班
... ... @@ -493,6 +580,35 @@ angular.module(&#39;ScheduleApp&#39;).directive(
493 580 });
494 581 }
495 582 }
  583 +
  584 + // 调度原因处理
  585 + isRepeat = false;
  586 + if (obj.modifyReason || obj.modifyReason == 0) {
  587 + for (i = 0; i < addreason.length; i++) {
  588 + if (addreason[i] == obj.modifyReason) {
  589 + isRepeat = true;
  590 + break;
  591 + }
  592 + }
  593 + if (!isRepeat) {
  594 + addreason.push(obj.modifyReason);
  595 + }
  596 + }
  597 +
  598 + // 调整备注处理
  599 + isRepeat = false;
  600 + if (obj.modifyRemark && obj.modifyRemark != "") {
  601 + for (i = 0; i < adddesc.length; i++) {
  602 + if (adddesc[i] == obj.modifyRemark) {
  603 + isRepeat = true;
  604 + break;
  605 + }
  606 + }
  607 + if (!isRepeat) {
  608 + adddesc.push(obj.modifyRemark);
  609 + }
  610 + }
  611 +
496 612 });
497 613  
498 614 old_max_fcno = newValue[newValue.length - 1].fcno;
... ... @@ -518,6 +634,20 @@ angular.module(&#39;ScheduleApp&#39;).directive(
518 634 scope[ctrlAs].fd["s" + (i + 1)].id = j_s_ids[i].s;
519 635 }
520 636 }
  637 + for (i = 0; i < addreason.length; i++) { // 调度原因更新
  638 + if (i > 1) { // 有多个,只更新第一个
  639 + break;
  640 + } else {
  641 + scope[ctrlAs].fd.ddr = addreason[i];
  642 + }
  643 + }
  644 + for (i = 0; i < adddesc.length; i++) {
  645 + if (i > 1) { // 有多个,只更新第一个
  646 + break;
  647 + } else {
  648 + scope[ctrlAs].fd.ddrdesc = adddesc[i];
  649 + }
  650 + }
521 651 }
522 652 }
523 653 );
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -1816,14 +1816,30 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1816 1816 // 本地动态数据直接显示,暂时不优化
1817 1817 var ldata = DataStore.getData(type);
1818 1818 for (var i = 0; i < ldata.length; i++) {
1819   - scope[ctrlAs].$$data_real.push(ldata[i]);
  1819 + // 闭包绑定返回最终查询的值
  1820 + var calcu_str = scope[ctrlAs].$$internal_match_str(ldata[i]);
  1821 + if (calcu_str) {
  1822 + // 全拼
  1823 + if (!ldata[i]["$fullChars"]) {
  1824 + ldata[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  1825 + }
  1826 + // 简拼
  1827 + if (!ldata[i]["$camelChars"]) {
  1828 + ldata[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  1829 + }
  1830 + // 原值
  1831 + if (!ldata[i]["$calcu_str"]) {
  1832 + ldata[i]["$calcu_str"] = calcu_str;
  1833 + }
1820 1834  
  1835 + scope[ctrlAs].$$data_real.push(ldata[i]);
  1836 + }
1821 1837 }
1822 1838  
1823 1839 // 重新创建内部ui-select显示用数据,默认取10条记录显示
1824 1840 scope[ctrlAs].$$data = [];
1825 1841 for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1826   - if (scope[ctrlAs].$$data.length < 10) {
  1842 + if (scope[ctrlAs].$$data.length < 50) {
1827 1843 scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
1828 1844 } else {
1829 1845 break;
... ... @@ -5151,6 +5167,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5151 5167 var old_max_fcno = 0; // 最大发车顺序号
5152 5168 var old_firstJCBCFcno = 0; // 第一个进场班次发车顺序号
5153 5169 var old_half_bcs = 0; // 一般的班次数量
  5170 + var old_ddreason = {}; // key:{调度原因}, value:所在list下标数组
  5171 + var old_dddesc = {}; // key:{调度描述}, value:所在list下标数组
5154 5172  
5155 5173 // 内部变量,变更的车辆,变更的人员
5156 5174 var new_cl1 = undefined; // 新的车辆1(车辆id_车辆自编号)
... ... @@ -5159,7 +5177,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5159 5177 var new_j2 = undefined; // 新的驾驶员2(驾驶员id_姓名_工号)
5160 5178 var new_s1 = undefined; // 新的售票员1(售票员id_姓名_工号)
5161 5179 var new_s2 = undefined; // 新的售票员2(售票员id_姓名_工号)
5162   -
  5180 + var new_ddreason = undefined; // 调度原因
  5181 + var new_dddesc = undefined; // 调度描述
5163 5182  
5164 5183 // 表单值,被赋值的次数
5165 5184 var form_data_assign_count = {
... ... @@ -5180,6 +5199,42 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5180 5199 post: function(scope, element, attr) {
5181 5200  
5182 5201 /**
  5202 + * 刷新调度原因数据。
  5203 + */
  5204 + scope[ctrlAs].$$internal_refresh_dsdata_ddreason = function() {
  5205 + if (new_ddreason) {
  5206 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  5207 + obj.modifyReason = new_ddreason;
  5208 + });
  5209 + } else {
  5210 + // 清空,不使用旧的
  5211 + angular.forEach(old_ddreason, function(value, key) {
  5212 + angular.forEach(value, function(i) {
  5213 + scope[ctrlAs].ds[i].modifyReason = undefined;
  5214 + });
  5215 + });
  5216 + }
  5217 + };
  5218 +
  5219 + /**
  5220 + * 刷新调度描述数据。
  5221 + */
  5222 + scope[ctrlAs].$$internal_refresh_dsdata_dddesc = function() {
  5223 + if (new_dddesc) {
  5224 + angular.forEach(scope[ctrlAs].ds, function(obj) {
  5225 + obj.modifyRemark = new_dddesc;
  5226 + });
  5227 + } else {
  5228 + // 清空,不使用旧的
  5229 + angular.forEach(old_dddesc, function(value, key) {
  5230 + angular.forEach(value, function(i) {
  5231 + scope[ctrlAs].ds[i].modifyRemark = undefined;
  5232 + });
  5233 + });
  5234 + }
  5235 + };
  5236 +
  5237 + /**
5183 5238 * 刷新车辆数据。
5184 5239 */
5185 5240 scope[ctrlAs].$$internal_refresh_dsdata_cl = function() {
... ... @@ -5382,6 +5437,34 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5382 5437 }
5383 5438 };
5384 5439  
  5440 + //-------------- 监控调度原因的变化 ----------------//
  5441 + scope.$watch(
  5442 + function() {
  5443 + return scope[ctrlAs].fd.ddr;
  5444 + },
  5445 + function(newValue, oldValue) {
  5446 + if (newValue || newValue == 0) {
  5447 + new_ddreason = newValue;
  5448 + }
  5449 + scope[ctrlAs].$$internal_refresh_dsdata_ddreason();
  5450 + },
  5451 + true
  5452 + );
  5453 +
  5454 + //-------------- 监控调度描述的变化 ----------------//
  5455 + scope.$watch(
  5456 + function() {
  5457 + return scope[ctrlAs].fd.ddrdesc;
  5458 + },
  5459 + function(newValue, oldValue) {
  5460 + if (newValue || newValue == 0) {
  5461 + new_dddesc = newValue;
  5462 + }
  5463 + scope[ctrlAs].$$internal_refresh_dsdata_dddesc();
  5464 + },
  5465 + true
  5466 + );
  5467 +
5385 5468  
5386 5469 //-------------- 监控表单车辆1的变化 ----------------//
5387 5470 scope.$watch(
... ... @@ -5529,6 +5612,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5529 5612  
5530 5613 var cl_ids = []; // 车辆ids数组(有顺序)
5531 5614 var j_s_ids = []; // 驾驶员ids,售票员ids,[{j:id,s:id},...](有顺序)
  5615 + var addreason = []; // 营运调度的原因
  5616 + var adddesc = []; // 营运导读的备注
5532 5617 var isRepeat = false;
5533 5618 var i = 0;
5534 5619  
... ... @@ -5547,6 +5632,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5547 5632 old_s[k3] = [];
5548 5633 }
5549 5634  
  5635 + var dd4 = obj.modifyReason == null || obj.modifyReason == undefined ? undefined :
  5636 + obj.modifyReason;
  5637 + var dd5 = obj.modifyRemark == null || obj.modifyRemark == undefined ? undefined :
  5638 + obj.modifyRemark;
  5639 +
  5640 + if (!old_ddreason[dd4] && dd4) {
  5641 + old_ddreason[dd4] = [];
  5642 + }
  5643 + if (!old_dddesc[dd5] && dd5) {
  5644 + old_dddesc[dd5] = [];
  5645 + }
  5646 +
5550 5647 // 闭包
5551 5648 (function(i) {
5552 5649 old_cl[k1].push(i);
... ... @@ -5556,6 +5653,12 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5556 5653 if (k3) {
5557 5654 old_s[k3].push(i);
5558 5655 }
  5656 + if (dd4) {
  5657 + old_ddreason[dd4].push(i);
  5658 + }
  5659 + if (dd5) {
  5660 + old_dddesc[dd5].push(i);
  5661 + }
5559 5662 })(index);
5560 5663  
5561 5664 // 判断是否分班
... ... @@ -5601,6 +5704,35 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5601 5704 });
5602 5705 }
5603 5706 }
  5707 +
  5708 + // 调度原因处理
  5709 + isRepeat = false;
  5710 + if (obj.modifyReason || obj.modifyReason == 0) {
  5711 + for (i = 0; i < addreason.length; i++) {
  5712 + if (addreason[i] == obj.modifyReason) {
  5713 + isRepeat = true;
  5714 + break;
  5715 + }
  5716 + }
  5717 + if (!isRepeat) {
  5718 + addreason.push(obj.modifyReason);
  5719 + }
  5720 + }
  5721 +
  5722 + // 调整备注处理
  5723 + isRepeat = false;
  5724 + if (obj.modifyRemark && obj.modifyRemark != "") {
  5725 + for (i = 0; i < adddesc.length; i++) {
  5726 + if (adddesc[i] == obj.modifyRemark) {
  5727 + isRepeat = true;
  5728 + break;
  5729 + }
  5730 + }
  5731 + if (!isRepeat) {
  5732 + adddesc.push(obj.modifyRemark);
  5733 + }
  5734 + }
  5735 +
5604 5736 });
5605 5737  
5606 5738 old_max_fcno = newValue[newValue.length - 1].fcno;
... ... @@ -5626,6 +5758,20 @@ angular.module(&#39;ScheduleApp&#39;).directive(
5626 5758 scope[ctrlAs].fd["s" + (i + 1)].id = j_s_ids[i].s;
5627 5759 }
5628 5760 }
  5761 + for (i = 0; i < addreason.length; i++) { // 调度原因更新
  5762 + if (i > 1) { // 有多个,只更新第一个
  5763 + break;
  5764 + } else {
  5765 + scope[ctrlAs].fd.ddr = addreason[i];
  5766 + }
  5767 + }
  5768 + for (i = 0; i < adddesc.length; i++) {
  5769 + if (i > 1) { // 有多个,只更新第一个
  5770 + break;
  5771 + } else {
  5772 + scope[ctrlAs].fd.ddrdesc = adddesc[i];
  5773 + }
  5774 + }
5629 5775 }
5630 5776 }
5631 5777 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/edit.html
... ... @@ -19,7 +19,7 @@
19 19 <i class="fa fa-circle"></i>
20 20 </li>
21 21 <li>
22   - <a href="javascript:" ng-click="ctrl.toPlanInfoListPage()">排班计划管理</a>
  22 + <a href="javascript:" ng-click="ctrl.toPlanInfoListPage()">{{ctrl.schedulePlanInfoForSave.xlName}}排班计划</a>
23 23 <i class="fa fa-circle"></i>
24 24 </li>
25 25 <li>
... ... @@ -30,15 +30,22 @@
30 30 <div class="portlet light bordered">
31 31 <div class="portlet-title">
32 32 <div class="caption">
33   - <i class="icon-equalizer font-red-sunglo"></i>
34   - <span class="caption-subject font-red-sunglo bold uppercase">
  33 + <div>
  34 + <i class="icon-equalizer font-red-sunglo"></i>
  35 + <span class="caption-subject font-red-sunglo bold uppercase">
35 36 {{ctrl.schedulePlanInfoForSave.xlName}}
36 37 {{ctrl.schedulePlanInfoForSave.ttInfoName}}
37 38 {{"路牌" + ctrl.schedulePlanInfoForSave.lpName}}
38   - <span ng-bind="ctrl.schedulePlanInfoForSave.scheduleDate | date: 'yyyy-MM-dd ' "></span>
39   - <span>计划班次信息</span>
40   - </span>
  39 + <span ng-bind="ctrl.schedulePlanInfoForSave.scheduleDate | date: 'yyyy-MM-dd ' "></span>
  40 + <span>计划班次信息</span>
  41 + </span>
  42 + </div>
  43 + <div style="padding-top: 10px;">
  44 + <i class="icon-equalizer font-red-sunglo"></i>
  45 + <span class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title_tip"></span>
  46 + </div>
41 47 </div>
  48 +
42 49 </div>
43 50  
44 51 <div class="portlet-body form">
... ... @@ -109,7 +116,7 @@
109 116 cmaps="{'qdzCode' : 'zcode', 'qdzName': 'zname'}"
110 117 dcname="qdzCode"
111 118 icname="zcode"
112   - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.schedulePlanInfoForSave.xl, 'xldir': ctrl.schedulePlanInfoForSave.xlDir}, atype:'zd_tcc' } | json }}"
  119 + dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.schedulePlanInfoForSave.xl, 'xldir': ctrl.schedulePlanInfoForSave.xlDir, 'lineversion': ctrl.lineversion}, atype:'zd_tcc' } | json }}"
113 120 iterobjname="item"
114 121 iterobjexp="item.aname"
115 122 searchph="请输拼音..."
... ... @@ -130,7 +137,7 @@
130 137 cmaps="{'zdzCode' : 'zcode', 'zdzName': 'zname'}"
131 138 dcname="zdzCode"
132 139 icname="zcode"
133   - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.schedulePlanInfoForSave.xl, 'xldir': ctrl.schedulePlanInfoForSave.xlDir}, atype:'zd_tcc' } | json }}"
  140 + dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.schedulePlanInfoForSave.xl, 'xldir': ctrl.schedulePlanInfoForSave.xlDir, 'lineversion': ctrl.lineversion}, atype:'zd_tcc' } | json }}"
134 141 iterobjname="item"
135 142 iterobjexp="item.aname"
136 143 searchph="请输拼音..."
... ... @@ -208,8 +215,6 @@
208 215 </div>
209 216 </div>
210 217  
211   -
212   -
213 218 </div>
214 219  
215 220 <div class="form-actions">
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/list_info.html
... ... @@ -73,7 +73,8 @@
73 73 </tr>
74 74 </thead>
75 75 <tbody>
76   - <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX">
  76 + <tr ng-repeat="info in ctrl.page()['content']"
  77 + ng-class="{odd: true, gradeX: true, info: ctrl.isModify(info), 'row-active': ctrl.isModify(info)}">>
77 78 <td>
78 79 <div>
79 80 <a href="#">
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/module.js
... ... @@ -3,7 +3,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(
3 3 'SchedulePlanInfoManageService',
4 4 [
5 5 'SchedulePlanInfoManageService_g',
6   - function(service) {
  6 + 'TTInfoManageService_g',
  7 + '$q',
  8 + function(service, service2, $q) {
7 9 /** 当前的查询条件信息 */
8 10 var currentSearchCondition = {};
9 11  
... ... @@ -53,7 +55,29 @@ angular.module(&#39;ScheduleApp&#39;).factory(
53 55 uiFromRecord: 0,
54 56 uiToRecord: 0
55 57 };
  58 + },
  59 + lineversiondesc: function(xlid, tid) {
  60 + var deferred = $q.defer();
  61 +
  62 + service2.rest.get({id: tid}, function(rs) {
  63 + // alert("rsrsrs");
  64 + service2.versiondesc.do(
  65 + {lineId: xlid, version: rs.lineVersion}, function(result) {
  66 + // alert("线路版本(" + result.desc + ")");
  67 + deferred.resolve({
  68 + lineversion: rs.lineVersion,
  69 + desc: "线路版本(" + result.desc + ")"
  70 + });
  71 + }, function() {
  72 + deferred.reject();
  73 + });
  74 + }, function() {
  75 + deferred.reject();
  76 + });
  77 +
  78 + return deferred.promise;
56 79 }
  80 +
57 81 };
58 82  
59 83 }
... ... @@ -169,6 +193,15 @@ angular.module(&#39;ScheduleApp&#39;).controller(
169 193 true
170 194 );
171 195  
  196 + // 判定是否被修改过
  197 + self.isModify = function(spinfo) {
  198 + if (spinfo.modifyCount > 0) {
  199 + return true;
  200 + } else {
  201 + return false;
  202 + }
  203 + }
  204 +
172 205 }
173 206 ]
174 207 );
... ... @@ -197,11 +230,22 @@ angular.module(&quot;ScheduleApp&quot;).controller(
197 230 $state.go("schedulePlanInfoManage", $stateParams);
198 231 };
199 232  
  233 + // 线路版本描述
  234 + self.title_tip = "版本加载中...";
  235 +
200 236 // 获取数据
201 237 SchedulePlanInfo.get({id: spinfoid}, function(value) {
202 238 self.schedulePlanInfoForSave = value;
  239 + // 线路版本
  240 + self.lineversion = 1;
  241 +
  242 + service.lineversiondesc(value.xl, value.ttInfo).then(
  243 + function(rs) {
  244 + self.title_tip = rs.desc;
  245 + self.lineversion = rs.lineversion;
  246 + }
  247 + );
203 248  
204   - // TODO
205 249 });
206 250  
207 251 // 提交方法
... ... @@ -216,7 +260,6 @@ angular.module(&quot;ScheduleApp&quot;).controller(
216 260 self.toPlanInfoListPage();
217 261 };
218 262  
219   -
220 263 }
221 264 ]
222 265 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
... ... @@ -134,10 +134,10 @@
134 134 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
135 135 <a ui-sref="schedulePlanInfoManage({spid : info.id, xlid: info.xl.id, xlname : info.xl.name, ttname : info.ttInfoNames, stime : info.scheduleFromTime, etime : info.scheduleToTime})"
136 136 class="btn btn-info btn-sm"> 明细 </a>
137   - <a sweetalert
138   - sweet-options="{title: '是否删除排班计划?',text: '线路:' + info.xl.name + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + '</br>请谨慎删除!', html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}"
139   - sweet-on-confirm="ctrl.deletePlan(info.id)"
140   - class="btn btn-danger btn-sm">删除</a>
  137 + <!--<a sweetalert-->
  138 + <!--sweet-options="{title: '是否删除排班计划?',text: '线路:' + info.xl.name + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + '</br>请谨慎删除!', html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}"-->
  139 + <!--sweet-on-confirm="ctrl.deletePlan(info.id)"-->
  140 + <!--class="btn btn-danger btn-sm">删除</a>-->
141 141 </td>
142 142 </tr>
143 143 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html
... ... @@ -46,10 +46,10 @@
46 46 <div class="form-body">
47 47 <div class="form-group">
48 48 <div class="col-md-5">
49   - <div class="form-group">
50   - <label class="col-md-5 control-label">营运状态:</label>
  49 + <div class="form-group has-success has-feedback">
  50 + <label class="col-md-5 control-label">营运状态*:</label>
51 51 <div class="col-md-7">
52   - <sa-Select5 name="cl2"
  52 + <sa-Select5 name="ddr"
53 53 model="ctrl.formData"
54 54 cmaps="{'ddr': 'code'}"
55 55 dcname="ddr"
... ... @@ -59,9 +59,14 @@
59 59 iterobjexp="item.name"
60 60 searchph="请输拼音..."
61 61 searchexp="this.name"
  62 + required
62 63 >
63 64 </sa-Select5>
64 65 </div>
  66 + <!-- 隐藏块,显示验证信息 -->
  67 + <div class="alert alert-danger well-sm" ng-show="myForm.ddr.$error.required">
  68 + 调度原因必须选择
  69 + </div>
65 70 </div>
66 71 <div class="form-group has-success has-feedback">
67 72 <label class="col-md-5 control-label">车辆1*:</label>
... ... @@ -215,6 +220,22 @@
215 220 </sa-Select5>
216 221 </div>
217 222 </div>
  223 +
  224 + <div class="form-group">
  225 + <label class="col-md-5 control-label">备注:</label>
  226 + <div class="col-md-7">
  227 + <textarea name="ddrdesc"
  228 + class="form-control"
  229 + placeholder="营运调度备注(100字以内)"
  230 + ng-model="ctrl.formData.ddrdesc"
  231 + ng-maxlength="100" >
  232 + </textarea>
  233 + </div>
  234 + <!-- 隐藏块,显示验证信息 -->
  235 + <div class="alert alert-danger well-sm" ng-show="myForm.ddrdesc.$error.maxlength">
  236 + 最大100个字
  237 + </div>
  238 + </div>
218 239 </div>
219 240  
220 241 <div class="col-md-7">
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/list.html
... ... @@ -18,6 +18,7 @@
18 18 <tr role="row" class="heading">
19 19 <th style="width: 70px;">序号</th>
20 20 <th style="width: 80px;">操作</th>
  21 + <th style="width: 170px;">操作人/操作时间</th>
21 22 <th style="width: 180px;">线路</th>
22 23 <th style="width: 180px">日期</th>
23 24 <th style="width: 50px">路牌</th>
... ... @@ -26,13 +27,12 @@
26 27 <th style="width: 80px;">进场时间</th>
27 28 <th style="width: 150px;">驾驶员</th>
28 29 <th style="width: 150px;">售票员</th>
29   - <th>时刻表</th>
30   - <th style="width: 150px;">修改时间</th>
31   - <th style="width: 100px;">修改人</th>
  30 + <th>关联时刻表</th>
32 31 </tr>
33 32 <tr role="row" class="filter">
34 33 <td></td>
35 34 <td></td>
  35 + <td></td>
36 36 <td>
37 37 <sa-Select5 name="xl"
38 38 model="ctrl.searchCondition()"
... ... @@ -68,12 +68,11 @@
68 68 <td></td>
69 69 <td></td>
70 70 <td></td>
71   - <td></td>
72   - <td></td>
73 71 </tr>
74 72 </thead>
75 73 <tbody>
76   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  74 + <tr ng-repeat="info in ctrl.pageInfo.infos"
  75 + ng-class="{odd: true, gradeX: true, info: ctrl.isModify(info), 'row-active': ctrl.isModify(info)}" >
77 76 <td>
78 77 <div>
79 78 <a href="#">
... ... @@ -86,13 +85,47 @@
86 85 <a ui-sref="schedulePlanInfoExtFormManage_edit({xlId: info.xlId, xlName: info.xlName, sd: info.scheduleDate, lpId: info.lpId, lpName: info.lpName})" class="btn btn-info btn-sm" > 修改 </a>
87 86 </td>
88 87 <td>
  88 + <div>
  89 + <a href="#">
  90 + <i class="fa fa-user"></i>
  91 + <span ng-bind="info.updateByName"></span>
  92 + </a>
  93 + </div>
  94 + <div>
  95 + <a href="#"
  96 + tooltip-animation="false"
  97 + tooltip-placement="top"
  98 + uib-tooltip="创建时间:{{info.createDate | date: 'yyyy-MM-dd HH:mm:ss' }}"
  99 + tooltip-class="headClass">
  100 + 创建日期
  101 + <span ng-bind="(info.createDate | date: 'yyyy-MM-dd')"></span>
  102 + </a>
  103 + </div>
  104 + <div>
  105 + <a href="#"
  106 + tooltip-animation="false"
  107 + tooltip-placement="top"
  108 + uib-tooltip="修改时间:{{info.updateDate | date: 'yyyy-MM-dd HH:mm:ss' }}"
  109 + tooltip-class="headClass">
  110 + 修改日期
  111 + <span ng-bind="(info.updateDate | date: 'yyyy-MM-dd')"></span>
  112 + </a>
  113 + </div>
  114 +
  115 + </td>
  116 + <td>
89 117 <span ng-bind="info.xlName"></span>
90 118 </td>
91 119 <td>
92 120 <span ng-bind="info.scheduleDate | date: 'yyyy-MM-dd'"></span>
93 121 </td>
94 122 <td>
95   - <span ng-bind="info.lpName"></span>
  123 + <div>
  124 + <i class="fa fa-map-signs" aria-hidden="true"></i>
  125 + </div>
  126 + <div>
  127 + <span ng-bind="info.lpName"></span>
  128 + </div>
96 129 </td>
97 130 <td>
98 131 <div ng-repeat="clzbh in info.clZbhs">
... ... @@ -157,12 +190,6 @@
157 190 <td>
158 191 <span ng-bind="info.ttInfoName"></span>
159 192 </td>
160   - <td>
161   - <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
162   - </td>
163   - <td>
164   - <span ng-bind="info.updateByName"></span>
165   - </td>
166 193  
167 194 </tr>
168 195 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js
... ... @@ -210,6 +210,15 @@ angular.module(&#39;ScheduleApp&#39;).controller(
210 210 true
211 211 );
212 212  
  213 + // 判定是否被修改过
  214 + self.isModify = function(info) {
  215 + if (info.m_count > 0) {
  216 + return true;
  217 + } else {
  218 + return false;
  219 + }
  220 + };
  221 +
213 222  
214 223  
215 224 ///**
... ... @@ -265,6 +274,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
265 274 self.formData.s3 = {}; // 售票员3
266 275  
267 276 self.formData.ddr = "0"; // 调度原因,默认0-营运
  277 + self.formData.ddrdesc = ""; // 调度原因描述
268 278  
269 279 self.planInfos = undefined; // 排班明细
270 280  
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
... ... @@ -19,7 +19,7 @@
19 19 <i class="fa fa-circle"></i>
20 20 </li>
21 21 <li>
22   - <a ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})"><span ng-bind="ctrl.title1"></span></a>
  22 + <a ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid: ctrl.ttid, xlname: ctrl.xlname, ttname: ctrl.ttname, lineversion: ctrl.lineversion})"><span ng-bind="ctrl.title1"></span></a>
23 23 <i class="fa fa-circle"></i>
24 24 </li>
25 25 <li>
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
... ... @@ -19,7 +19,7 @@
19 19 <i class="fa fa-circle"></i>
20 20 </li>
21 21 <li>
22   - <a ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})"><span ng-bind="ctrl.title1"></span></a>
  22 + <a ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid: ctrl.ttid, xlname: ctrl.xlname, ttname: ctrl.ttname, lineversion: ctrl.lineversion})"><span ng-bind="ctrl.title1"></span></a>
23 23 <i class="fa fa-circle"></i>
24 24 </li>
25 25 <li>
... ...
src/main/resources/static/real_control_v2/alone_page/map/alone_wrap.html
... ... @@ -110,6 +110,7 @@
110 110 <!-- jquery.serializejson JSON序列化插件 -->
111 111 <script src="/assets/plugins/jquery.serializejson.js" merge="uikit_js"></script>
112 112  
  113 +<script src="/assets/plugins/pinyin.js" merge="plugins"></script>
113 114 </body>
114 115 <script>
115 116 gb_data_gps.fixedTimeRefresh();
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -553,7 +553,7 @@ dl.relevance-active.intimity dd:nth-child(n+2) {
553 553 dl.relevance-active.intimity dd:nth-child(n+2) a {
554 554 color: white !important;
555 555 }
556   -/*
  556 +
557 557 dl.relevance-active dd.tl-qrlb,
558 558 dl.relevance-active.intimity dd.tl-qrlb{
559 559 background: linear-gradient(to right, #a9a911, #808000, #8baabf) !important;
... ... @@ -595,7 +595,7 @@ dl.relevance-active.intimity dd.tl-xxrd {
595 595 dl.relevance-active dd.tl-xxfc,
596 596 dl.relevance-active.intimity dd.tl-xxfc {
597 597 background: linear-gradient(to right, #8baabf, rgb(43, 185, 185), rgb(0,255,255)) !important;
598   -}*/
  598 +}
599 599  
600 600 dl.relevance-active.intimity dd span.fcsj-diff {
601 601 color: #616060;
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -275,8 +275,10 @@
275 275 //检查子任务营运里程
276 276 $('#childTaskTitle .child-task-status', modal).remove();
277 277 //var i = 0;
278   - if (sch.cTasks.length == 0)
  278 + if (sch.cTasks.length == 0){
  279 + $('.uk-panel-box-secondary', modal).removeClass('c_task_mileage_abnormal');
279 280 return;
  281 + }
280 282 var sum = 0, calcs = ' ';
281 283 $.each(sch.cTasks, function () {
282 284 if (this.mileageType == 'service') {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sftz.html
... ... @@ -54,7 +54,7 @@
54 54 <div class="uk-form-row ct-stacked">
55 55 <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label>
56 56 <div class="uk-form-controls">
57   - <textarea id="form-s-t" cols="30" rows="5" name="remarks" required data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。必填"></textarea>
  57 + <textarea id="form-s-t" cols="30" rows="5" name="remarks" required data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。必填">{{remarks}}</textarea>
58 58 </div>
59 59 </div>
60 60 </div>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
... ... @@ -36,6 +36,7 @@
36 36 <div class="uk-autocomplete uk-form " >
37 37 <select name="abnormalStatus">
38 38 <option value="">全部</option>
  39 + <option value="timeError">时间戳异常</option>
39 40 <option value="outBounds">越界</option>
40 41 <option value="overspeed">超速</option>
41 42 <option value="offline">离线</option>
... ... @@ -58,11 +59,11 @@
58 59 <th style="width: 14%;">站点</th>
59 60 <th style="width: 11%;">车辆</th>
60 61 <th style="width: 11%;">设备号</th>
61   - <th style="width: 9%;">走向/营运</th>
  62 + <th style="width: 12%;">走向/营运</th>
62 63 <th style="width: 9%;">程序版本</th>
63 64 <th>最后GPS时间</th>
64   - <th style="width: 9%;">状态</th>
65   - <th style="width: 8%;">来源</th>
  65 + <th style="width: 8%;">状态</th>
  66 + <th style="width: 6%;">源</th>
66 67 </tr>
67 68 </thead>
68 69 <tbody>
... ... @@ -81,7 +82,11 @@
81 82 <td>{{gps.stationName}}</td>
82 83 <td>{{gps.nbbm}}</td>
83 84 <td>{{gps.deviceId}}</td>
84   - <td>{{gps.upDown}}/{{gps.state}}</td>
  85 + <td>{{gps.upDown}}/{{gps.state}}
  86 + {{if gps.origStateStr!=null}}
  87 + (<span style="color: #fe6262;">{{gps.origStateStr}}</span>)
  88 + {{/if}}
  89 + </td>
85 90 <td>{{gps.version}}</td>
86 91 <td>{{gps.timeStr}}</td>
87 92 <td>
... ... @@ -95,18 +100,14 @@
95 100 <span class="sm-red">GPS (0,0)</span>
96 101 {{else if gps.abnormalStatus=='offline'}}
97 102 <span>离线</span>
  103 + {{else if gps.abnormalStatus=='timeError'}}
  104 + <span class="sm-red" title="设备时间戳异常,尝试以服务器时间修正">time_ex</span>
98 105 {{else}}
99 106 ...
100 107 {{/if}}
101 108 </td>
102 109 <td>
103   - {{if gps.source==1}}
104   - <span style="color: #1e1ef5;" title="已切换至新网关">网关</span>
105   - {{else if gps.source==0}}
106   - <span style="color: #8e8e8e;" title="转接的数据,无法下发指令">转发</span>
107   - {{else}}
108   - <span class="sm-grey">未知</span>
109   - {{/if}}
  110 + <span class="sm-grey">{{gps.source}}</span>
110 111 </td>
111 112 </tr>
112 113 {{/each}}
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -476,10 +476,12 @@ var gb_schedule_table = (function () {
476 476  
477 477 if (nextSch) {
478 478 $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity');
479   - if (nextSch.xlDir == sch.xlDir)
480   - return;
  479 + /*if (nextSch.xlDir == sch.xlDir)
  480 + return;*/
481 481 //滚动到下一个班次
482   - scroToDl(nextSch);
  482 + if(nextSch.xlDir != sch.xlDir)
  483 + scroToDl(nextSch);
  484 +
483 485 }
484 486  
485 487 //如果有打开轨迹回放
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/left.html
... ... @@ -209,6 +209,7 @@
209 209 var code2Name = gb_data_basic.lineCode2NameAll();
210 210 $.each(rs.list, function () {
211 211 this.lineName = code2Name[this.lineId];
  212 + this.nbbm = data.nbbm;
212 213 });
213 214 //排序
214 215 rs.list.sort(function (a, b) {
... ...