Commit 26d356d2863ef7972c4469e5012986f9629f3fc6

Authored by lizhuojun
2 parents dd087e20 46649faa

线调更新

Showing 109 changed files with 13751 additions and 10097 deletions
README.md
1   -公交调度系统BS版 0.1
2   -======
3   -----------
4   -## 目录
5   ----------
6   - * [字典表](#字典表)
7   - * [动态jpa查询实现](#动态jpa查询实现)
8   - * [车载 gps 相关数据](#gps)
9   - * [实时gps数据接口 http](#实时gps接口)
10   - * [进出站数据表结构](#进站数据)
11   - * [异常警报表结构](#异常警报)
12   - * [大间隔](#大间隔)
13   - * [超速](#超速)
14   - * [越界](#越界)
15   - * [越站](#越站)
16   - * [聚集](#聚集)
17   - * [掉线](#掉线)
18   - * [调度消息下发接口HTTP](#调度消息下发接口)
19   - * [调度消息上传接口HTTP](#调度消息上传接口)
20   - * [车辆历史GPS数据](#车辆历史GPS)
21   -
22   -----------
23   -
24   -## 字典表
25   -----------
26   -字典操作全部由前端负责,主要有2种。
27   -
28   -1、转换字典代码。
29   - 当pjax的`pjax:success`事件被触发(片段加载完成)
30   - 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换
31   -``` html
32   ---dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码
33   -<span class="nt-dictionary" data-group="ScheduleType">out</span>
34   ---to
35   -<span>出场</span>
36   -
37   -<!- dom标签为input时,如下 data-code为要转换的代码 -->
38   -<input class="nt-dictionary" data-group="ScheduleType" data-code="out">
39   ---to
40   -<input value="出场">
41   -
42   -<!- dom标签为select时 如下 data-code为要选中的项 -->
43   -<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>
44   ---to
45   -<select>
46   - <option value="normal">正常班次</option>
47   - <option value="out" selected>出场</option>
48   - <option value="in">进场</option>
49   - <option value="oil">加油</option>
50   - <option value="temp">临加</option>
51   - <option value="region">区间</option>
52   - <option value="venting">放空</option>
53   - <option value="major">放大站</option>
54   -</select>
55   -```
56   -*原标签的class 除nt-dictionary 外,其余均会被保留*
57   -
58   -2、dictionary.js提供如下方法自行使用
59   -| 方法名 | 参数|返回|
60   -| ---- | ---- | ---- | ---- |
61   -| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |
62   -| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|
63   -| transformCode (转换字典代码)| (group, code) | 上行 |
64   -
65   -## 动态jpa查询实现
66   -----------
67   -*参考调度系统枚举com.bsth.entity.search.SearchOperator*
68   -
69   -
70   -## gps
71   -----------
72   -### 实时gps接口
73   -
74   -所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)
75   -根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)
76   -
77   -<span style="color: red">Response</span>:
78   -```json
79   -{
80   - "data":[
81   - {
82   - "companyCode":5,
83   - "lineId":10329,
84   - "deviceId":"05B01901",
85   - "carparkNo":"00000000",
86   - "stopNo":"7C890002",
87   - "lon":121.549866,
88   - "lat":31.238798,
89   - "timestamp":1397104499000,
90   - "speed":42.0,
91   - "direction":245.9,
92   - "state":0,
93   - "upDown":0
94   - }]
95   -}
96   -```
97   -
98   -| -- | --|--|
99   -| ---- | ---- | ---- |
100   -| companyCode | int | 公司代码 |
101   -| lineId | int | 线路编码 |
102   -| deviceId | String | 设备编号 |
103   -| carparkNo | String | 停车场编码 |
104   -| stopNo | String | 站点编码 |
105   -| lon | float | 经度 |
106   -| lat | float | 纬度 |
107   -| timestamp | long | 时间戳 |
108   -| speed | float | 速度|
109   -| direction | float | 方向(角度) |
110   -| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |
111   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|
112   -
113   -
114   -### 进站数据
115   -----------
116   -表名:
117   -
118   -| .. | .. | .. |
119   -| ---- | ---- | ---- |
120   -| id | int | 主键 |
121   -| deviceId | String | 设备号 |
122   -| lineId | int | 线路编码 |
123   -| stopNo | long | 站点编码 |
124   -| timestamp | long | 时间戳 |
125   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
126   -| createDate | Date | 创建时间 |
127   -
128   -
129   -### 异常警报
130   -----------
131   -
132   -### 大间隔
133   -----------
134   -表名:
135   -
136   -| .. | .. | .. |
137   -| ---- | ---- | ---- |
138   -| id | int | 主键 |
139   -| line | int | 线路编码 |
140   -| station | String | 站点编码 |
141   -| cVehicle | String | 当前车辆编码 |
142   -| lastVehicle | String | 上一个车辆编码 |
143   -| interval | long | 间隔时间(秒) |
144   -| timestamp | long | 时间戳 |
145   -| createDate | Date | 创建时间 |
146   -
147   -### 超速
148   -----------
149   -表名:
150   -
151   -| .. | .. | .. |
152   -| ---- | ---- | ---- |
153   -| id | int | 主键 |
154   -| vehicle | String | 车辆编码 |
155   -| line | int | 线路编码 |
156   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
157   -| lon | float | 经度 |
158   -| lat | float | 纬度|
159   -| speed | float | 速度 |
160   -| timestamp | long | 时间戳 |
161   -| createDate | Date | 时间 |
162   -
163   -### 越界
164   -----------
165   -表名:
166   -
167   -| .. | .. | .. |
168   -| ---- | ---- | ---- |
169   -| id | int | 主键 |
170   -| vehicle | String | 车辆编码 |
171   -| line | int | 线路编码 |
172   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
173   -| lon | float | 经度 |
174   -| lat | float | 纬度|
175   -| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|
176   -| timestamp | long | 时间戳 |
177   -| createDate | Date | 时间 |
178   -
179   -
180   -### 越站
181   -----------
182   -表名:
183   -
184   -| .. | .. | .. |
185   -| ---- | ---- | ---- |
186   -| id | int | 主键 |
187   -| line | int | 线路编码 |
188   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
189   -| station | String | 站点编码 |
190   -| vehicle | String | 车辆编码 |
191   -| inData | Date | 进站时间 |
192   -| outDate | Date | 出站时间 |
193   -
194   -
195   -### 聚集
196   -----------
197   -表名:
198   -
199   -| .. | .. | .. |
200   -| ---- | ---- | ---- |
201   -| id | int | 主键 |
202   -| line | int | 线路编码 |
203   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
204   -| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |
205   -| vehicles | String | 车辆编码(多个用 , 号分隔) |
206   -| timestamp | long | 时间戳 |
207   -| createDate | Date | 时间 |
208   -
209   -
210   -### 掉线
211   -----------
212   -表名:
213   -
214   -| .. | .. | .. |
215   -| ---- | ---- | ---- |
216   -| id | int | 主键 |
217   -| line | int | 线路编码 |
218   -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
219   -| vehicle | String | 车辆编码 |
220   -| lon | float | 经度 |
221   -| lat | float | 纬度|
222   -| timestamp | long | 时间戳 |
223   -| createDate | Date | 时间 |
224   -
225   -
226   -### 调度消息下发接口
227   -----------
228   -[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)
229   -
230   -<span style="color: red">Request</span>:
231   -```json
232   -{
233   - "deviceId":12345,
234   - "timestamp":44324,
235   - "operCode":0x60,
236   - "data":{
237   - "companyCode":22,
238   - "deviceId":"029L2222",
239   - "timestamp":134326,
240   - "instructType":00,
241   - "dispatchInstruct":0x00,
242   - "msgId":12345,
243   - "alarmTime":201606012000,
244   - "serviceState":00000000,
245   - "txtContent":"你好"
246   - }
247   -}
248   -```
249   -| .. | .. | .. |
250   -| ---- | ---- | ---- |
251   -| deviceId | string | 设备编号 |
252   -| timestamp | long | 时间戳(ms) |
253   -| operCode | short | 一级协议 |
254   -| data.companyCode | short | 公司代码 |
255   -| data.deviceId | string | 设备编号 |
256   -| data.timestamp | long | 时间戳 |
257   -| data.instructType | short | 保留 默认0 |
258   -| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|
259   -| data.msgId | long | 同上 |
260   -| data.alarmTime | long | 闹钟 MMddhhmm|
261   -| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|
262   -| data.txtContent | string | 下发的消息文本 |
263   -```json
264   -{
265   - "deviceId":12345,
266   - "timestamp":44324,
267   - "operCode":0x64,
268   - "data":{
269   - "cityCode":22,
270   - "deviceId":"029L2222",
271   - "lineId":"134326"
272   - }
273   -}
274   -```
275   -| .. | .. | .. |
276   -| ---- | ---- | ---- |
277   -| deviceId | string | 设备编号 |
278   -| timestamp | long | 时间戳(ms) |
279   -| operCode | short | 一级协议 |
280   -| data.cityCode | short | 城市区号 |
281   -| data.deviceId | string | 设备编号 |
282   -| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |
283   -
284   -```json
285   -{
286   - "deviceId":12345,
287   - "timestamp":44324,
288   - "operCode":0xC0,
289   - "data":{
290   - "operCode":0x86,
291   - "requestAck":0x06
292   - }
293   -}
294   -```
295   -| .. | .. | .. |
296   -| ---- | ---- | ---- |
297   -| deviceId | string | 设备编号 |
298   -| timestamp | long | 时间戳(ms) |
299   -| operCode | short | 一级协议 |
300   -| data.operCode | short | 二级协议 |
301   -| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|
302   -
303   -```json
304   -{
305   - "deviceId":12345,
306   - "timestamp":44324,
307   - "operCode":0xC0,
308   - "data":{
309   - "operCode":0xa3,
310   - "deviceId":12345,
311   - "ipAddress":222.66.0.204,
312   - "port":8899,
313   - "reportMode":0,
314   - "interval":0,
315   - "distance":0,
316   - "speedingThreshold":0,
317   - "alarmThreshold":0,
318   - "posIpAddress":0,
319   - "posPort":0,
320   - "delay":0,
321   - "speedThreshold1":0,
322   - "speedThreshold2":0,
323   - "contrast":0,
324   - "brightness":0,
325   - "saturation":0
326   - }
327   -}
328   -```
329   -| .. | .. | .. |
330   -| ---- | ---- | ---- |
331   -| deviceId | string | 设备编号 |
332   -| timestamp | long | 时间戳(ms) |
333   -| operCode | short | 一级协议 |
334   -| data.operCode | short | 二级协议 |
335   -| data.deviceId | string | 设备编号|
336   -| data.ipAddress | string | 网关IP地址|
337   -| data.port | string | 网关端口|
338   -| data.reportMode | short | 定时定距上报模式|
339   -| data.interval | int | 定时上报时间间隔|
340   -| data.distance | string | 定距上报距离间隔|
341   -| data.speedingThreshold | short | 非线路状态超速阀门|
342   -| data.alarmThreshold | short | 预警阀门|
343   -| data.posIpAddress | string | pos机IP地址|
344   -| data.posPort | string | pos机端口|
345   -| data.delay | int | 延迟机关时间|
346   -| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45|
347   -| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35|
348   -| data.deviceId | short | 对比度|
349   -| data.deviceId | short | 亮度|
350   -| data.deviceId | short | 饱和度|
351   -
352   -```json
353   -{
354   - "deviceId":12345,
355   - "timestamp":44324,
356   - "operCode":0xC0,
357   - "data":{
358   - "operCode":0xa4
359   - }
360   -}
361   -```
362   -| .. | .. | .. |
363   -| ---- | ---- | ---- |
364   -| deviceId | string | 设备编号 |
365   -| timestamp | long | 时间戳(ms) |
366   -| operCode | short | 一级协议 |
367   -| data.operCode | short | 二级协议 |
368   -
369   -```json
370   -{
371   - "deviceId":12345,
372   - "timestamp":44324,
373   - "operCode":0xC0,
374   - "data":{
375   - "operCode":0xa5
376   - "programVersion":2
377   - }
378   -}
379   -```
380   -| .. | .. | .. |
381   -| ---- | ---- | ---- |
382   -| deviceId | string | 设备编号 |
383   -| timestamp | long | 时间戳(ms) |
384   -| operCode | short | 一级协议 |
385   -| data.operCode | short | 二级协议 |
386   -| data.programVersion | short | 程序版本 |
387   -
388   -<span style="color: red">Response</span>:
389   -```json
390   -{
391   - "errCode":0
392   -}
393   -```
394   -
395   -### 调度消息上传接口
396   -----------
397   -上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)
398   -<span style="color: red">Request</span>:
399   -```json
400   -{
401   - "deviceId":12345,
402   - "timestamp":44324,
403   - "status":0,
404   - "operCode":0x80,
405   - "data":{
406   - "operCode":0x26,
407   - "requestCode":22
408   - }
409   -}
410   -```
411   -| .. | .. | .. |
412   -| ---- | ---- | ---- |
413   -| deviceId | string | 设备编号 |
414   -| timestamp | long | 时间戳(ms) |
415   -| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |
416   -| operCode | short | 一级协议 消息确认将无数据 |
417   -| data.operCode | short | 二级协议 |
418   -| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |
419   -<span style="color: red">Response</span>:
420   -```json
421   -{
422   - "errCode":0
423   -}
424   -```
425   -
426   -### 车辆历史GPS
427   -----------
428   -表名:BSTH_C_GPS_INFO
429   -
430   -| .. | .. | .. |
431   -| ---- | ---- | ---- |
432   -| cityCode | int | 城市代码 |
433   -| industryCode | int | 行业代码 |
434   -| companyCode | int | 企业代码 |
435   -| lineId | int | 线路编号 |
436   -| deviceId | string | 设备编号 |
437   -| driverNo | int | 驾驶员工号 |
438   -| carparkSerialNo | int | 停车场序列号 |
439   -| carparkNo | string | 停车场编号 |
440   -| stopSerialNo | int | 站点序列号 |
441   -| stopNo | string | 停车场编号 |
442   -| lon | float | 经度 |
443   -| lat | float | 维度 |
444   -| ts | long | 时间戳 |
445   -| speedSensor | float | 发动机速度 |
446   -| speedGps | float | gps速度 |
447   -| direction | float | 角度0-359 |
448   -| inTemp | int | 车内温度 |
449   -| serviceState | long | 设备状态字 |
450   -<<<<<<< HEAD
451   -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
452   -=======
453   -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
454   -
455   ->>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50
  1 +公交调度系统BS版 0.1
  2 +======
  3 +----------
  4 +## 目录
  5 +---------
  6 + * [字典表](#字典表)
  7 + * [动态jpa查询实现](#动态jpa查询实现)
  8 + * [车载 gps 相关数据](#gps)
  9 + * [实时gps数据接口 http](#实时gps接口)
  10 + * [进出站数据表结构](#进站数据)
  11 + * [异常警报表结构](#异常警报)
  12 + * [大间隔](#大间隔)
  13 + * [超速](#超速)
  14 + * [越界](#越界)
  15 + * [越站](#越站)
  16 + * [聚集](#聚集)
  17 + * [掉线](#掉线)
  18 + * [调度消息下发接口HTTP](#调度消息下发接口)
  19 + * [调度消息上传接口HTTP](#调度消息上传接口)
  20 + * [车辆历史GPS数据](#车辆历史GPS)
  21 +
  22 +----------
  23 +
  24 +## 字典表
  25 +----------
  26 +字典操作全部由前端负责,主要有2种。
  27 +
  28 +1、转换字典代码。
  29 + 当pjax的`pjax:success`事件被触发(片段加载完成)
  30 + 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换
  31 +``` html
  32 +--dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码
  33 +<span class="nt-dictionary" data-group="ScheduleType">out</span>
  34 +--to
  35 +<span>出场</span>
  36 +
  37 +<!- dom标签为input时,如下 data-code为要转换的代码 -->
  38 +<input class="nt-dictionary" data-group="ScheduleType" data-code="out">
  39 +--to
  40 +<input value="出场">
  41 +
  42 +<!- dom标签为select时 如下 data-code为要选中的项 -->
  43 +<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>
  44 +--to
  45 +<select>
  46 + <option value="normal">正常班次</option>
  47 + <option value="out" selected>出场</option>
  48 + <option value="in">进场</option>
  49 + <option value="oil">加油</option>
  50 + <option value="temp">临加</option>
  51 + <option value="region">区间</option>
  52 + <option value="venting">放空</option>
  53 + <option value="major">放大站</option>
  54 +</select>
  55 +```
  56 +*原标签的class 除nt-dictionary 外,其余均会被保留*
  57 +
  58 +2、dictionary.js提供如下方法自行使用
  59 +| 方法名 | 参数|返回|
  60 +| ---- | ---- | ---- | ---- |
  61 +| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |
  62 +| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|
  63 +| transformCode (转换字典代码)| (group, code) | 上行 |
  64 +
  65 +## 动态jpa查询实现
  66 +----------
  67 +*参考调度系统枚举com.bsth.entity.search.SearchOperator*
  68 +
  69 +
  70 +## gps
  71 +----------
  72 +### 实时gps接口
  73 +
  74 +所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)
  75 +根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)
  76 +
  77 +<span style="color: red">Response</span>:
  78 +```json
  79 +{
  80 + "data":[
  81 + {
  82 + "companyCode":5,
  83 + "lineId":10329,
  84 + "deviceId":"05B01901",
  85 + "carparkNo":"00000000",
  86 + "stopNo":"7C890002",
  87 + "lon":121.549866,
  88 + "lat":31.238798,
  89 + "timestamp":1397104499000,
  90 + "speed":42.0,
  91 + "direction":245.9,
  92 + "state":0,
  93 + "upDown":0
  94 + }]
  95 +}
  96 +```
  97 +
  98 +| -- | --|--|
  99 +| ---- | ---- | ---- |
  100 +| companyCode | int | 公司代码 |
  101 +| lineId | int | 线路编码 |
  102 +| deviceId | String | 设备编号 |
  103 +| carparkNo | String | 停车场编码 |
  104 +| stopNo | String | 站点编码 |
  105 +| lon | float | 经度 |
  106 +| lat | float | 纬度 |
  107 +| timestamp | long | 时间戳 |
  108 +| speed | float | 速度|
  109 +| direction | float | 方向(角度) |
  110 +| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |
  111 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|
  112 +
  113 +
  114 +### 进站数据
  115 +----------
  116 +表名:
  117 +
  118 +| .. | .. | .. |
  119 +| ---- | ---- | ---- |
  120 +| id | int | 主键 |
  121 +| deviceId | String | 设备号 |
  122 +| lineId | int | 线路编码 |
  123 +| stopNo | long | 站点编码 |
  124 +| timestamp | long | 时间戳 |
  125 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  126 +| createDate | Date | 创建时间 |
  127 +
  128 +
  129 +### 异常警报
  130 +----------
  131 +
  132 +### 大间隔
  133 +----------
  134 +表名:
  135 +
  136 +| .. | .. | .. |
  137 +| ---- | ---- | ---- |
  138 +| id | int | 主键 |
  139 +| line | int | 线路编码 |
  140 +| station | String | 站点编码 |
  141 +| cVehicle | String | 当前车辆编码 |
  142 +| lastVehicle | String | 上一个车辆编码 |
  143 +| interval | long | 间隔时间(秒) |
  144 +| timestamp | long | 时间戳 |
  145 +| createDate | Date | 创建时间 |
  146 +
  147 +### 超速
  148 +----------
  149 +表名:
  150 +
  151 +| .. | .. | .. |
  152 +| ---- | ---- | ---- |
  153 +| id | int | 主键 |
  154 +| vehicle | String | 车辆编码 |
  155 +| line | int | 线路编码 |
  156 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  157 +| lon | float | 经度 |
  158 +| lat | float | 纬度|
  159 +| speed | float | 速度 |
  160 +| timestamp | long | 时间戳 |
  161 +| createDate | Date | 时间 |
  162 +
  163 +### 越界
  164 +----------
  165 +表名:
  166 +
  167 +| .. | .. | .. |
  168 +| ---- | ---- | ---- |
  169 +| id | int | 主键 |
  170 +| vehicle | String | 车辆编码 |
  171 +| line | int | 线路编码 |
  172 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  173 +| lon | float | 经度 |
  174 +| lat | float | 纬度|
  175 +| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|
  176 +| timestamp | long | 时间戳 |
  177 +| createDate | Date | 时间 |
  178 +
  179 +
  180 +### 越站
  181 +----------
  182 +表名:
  183 +
  184 +| .. | .. | .. |
  185 +| ---- | ---- | ---- |
  186 +| id | int | 主键 |
  187 +| line | int | 线路编码 |
  188 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  189 +| station | String | 站点编码 |
  190 +| vehicle | String | 车辆编码 |
  191 +| inData | Date | 进站时间 |
  192 +| outDate | Date | 出站时间 |
  193 +
  194 +
  195 +### 聚集
  196 +----------
  197 +表名:
  198 +
  199 +| .. | .. | .. |
  200 +| ---- | ---- | ---- |
  201 +| id | int | 主键 |
  202 +| line | int | 线路编码 |
  203 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  204 +| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |
  205 +| vehicles | String | 车辆编码(多个用 , 号分隔) |
  206 +| timestamp | long | 时间戳 |
  207 +| createDate | Date | 时间 |
  208 +
  209 +
  210 +### 掉线
  211 +----------
  212 +表名:
  213 +
  214 +| .. | .. | .. |
  215 +| ---- | ---- | ---- |
  216 +| id | int | 主键 |
  217 +| line | int | 线路编码 |
  218 +| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |
  219 +| vehicle | String | 车辆编码 |
  220 +| lon | float | 经度 |
  221 +| lat | float | 纬度|
  222 +| timestamp | long | 时间戳 |
  223 +| createDate | Date | 时间 |
  224 +
  225 +
  226 +### 调度消息下发接口
  227 +----------
  228 +[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)
  229 +
  230 +<span style="color: red">Request</span>:
  231 +```json
  232 +{
  233 + "deviceId":12345,
  234 + "timestamp":44324,
  235 + "operCode":0x60,
  236 + "data":{
  237 + "companyCode":22,
  238 + "deviceId":"029L2222",
  239 + "timestamp":134326,
  240 + "instructType":00,
  241 + "dispatchInstruct":0x00,
  242 + "msgId":12345,
  243 + "alarmTime":201606012000,
  244 + "serviceState":00000000,
  245 + "txtContent":"你好"
  246 + }
  247 +}
  248 +```
  249 +| .. | .. | .. |
  250 +| ---- | ---- | ---- |
  251 +| deviceId | string | 设备编号 |
  252 +| timestamp | long | 时间戳(ms) |
  253 +| operCode | short | 一级协议 |
  254 +| data.companyCode | short | 公司代码 |
  255 +| data.deviceId | string | 设备编号 |
  256 +| data.timestamp | long | 时间戳 |
  257 +| data.instructType | short | 保留 默认0 |
  258 +| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|
  259 +| data.msgId | long | 同上 |
  260 +| data.alarmTime | long | 闹钟 MMddhhmm|
  261 +| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|
  262 +| data.txtContent | string | 下发的消息文本 |
  263 +```json
  264 +{
  265 + "deviceId":12345,
  266 + "timestamp":44324,
  267 + "operCode":0x64,
  268 + "data":{
  269 + "cityCode":22,
  270 + "deviceId":"029L2222",
  271 + "lineId":"134326"
  272 + }
  273 +}
  274 +```
  275 +| .. | .. | .. |
  276 +| ---- | ---- | ---- |
  277 +| deviceId | string | 设备编号 |
  278 +| timestamp | long | 时间戳(ms) |
  279 +| operCode | short | 一级协议 |
  280 +| data.cityCode | short | 城市区号 |
  281 +| data.deviceId | string | 设备编号 |
  282 +| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |
  283 +
  284 +```json
  285 +{
  286 + "deviceId":12345,
  287 + "timestamp":44324,
  288 + "operCode":0xC0,
  289 + "data":{
  290 + "operCode":0x86,
  291 + "requestAck":0x06
  292 + }
  293 +}
  294 +```
  295 +| .. | .. | .. |
  296 +| ---- | ---- | ---- |
  297 +| deviceId | string | 设备编号 |
  298 +| timestamp | long | 时间戳(ms) |
  299 +| operCode | short | 一级协议 |
  300 +| data.operCode | short | 二级协议 |
  301 +| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|
  302 +
  303 +```json
  304 +{
  305 + "deviceId":12345,
  306 + "timestamp":44324,
  307 + "operCode":0xC0,
  308 + "data":{
  309 + "operCode":0xa3,
  310 + "deviceId":12345,
  311 + "ipAddress":222.66.0.204,
  312 + "port":8899,
  313 + "reportMode":0,
  314 + "interval":0,
  315 + "distance":0,
  316 + "speedingThreshold":0,
  317 + "alarmThreshold":0,
  318 + "posIpAddress":0,
  319 + "posPort":0,
  320 + "delay":0,
  321 + "speedThreshold1":0,
  322 + "speedThreshold2":0,
  323 + "contrast":0,
  324 + "brightness":0,
  325 + "saturation":0
  326 + }
  327 +}
  328 +```
  329 +| .. | .. | .. |
  330 +| ---- | ---- | ---- |
  331 +| deviceId | string | 设备编号 |
  332 +| timestamp | long | 时间戳(ms) |
  333 +| operCode | short | 一级协议 |
  334 +| data.operCode | short | 二级协议 |
  335 +| data.deviceId | string | 设备编号|
  336 +| data.ipAddress | string | 网关IP地址|
  337 +| data.port | string | 网关端口|
  338 +| data.reportMode | short | 定时定距上报模式|
  339 +| data.interval | int | 定时上报时间间隔|
  340 +| data.distance | string | 定距上报距离间隔|
  341 +| data.speedingThreshold | short | 非线路状态超速阀门|
  342 +| data.alarmThreshold | short | 预警阀门|
  343 +| data.posIpAddress | string | pos机IP地址|
  344 +| data.posPort | string | pos机端口|
  345 +| data.delay | int | 延迟机关时间|
  346 +| data.deviceId | short | 中门视频切换到码表界面速度阀门 默认45|
  347 +| data.deviceId | short | 码表界面切换到中门视频速度阀门 默认35|
  348 +| data.deviceId | short | 对比度|
  349 +| data.deviceId | short | 亮度|
  350 +| data.deviceId | short | 饱和度|
  351 +
  352 +```json
  353 +{
  354 + "deviceId":12345,
  355 + "timestamp":44324,
  356 + "operCode":0xC0,
  357 + "data":{
  358 + "operCode":0xa4
  359 + }
  360 +}
  361 +```
  362 +| .. | .. | .. |
  363 +| ---- | ---- | ---- |
  364 +| deviceId | string | 设备编号 |
  365 +| timestamp | long | 时间戳(ms) |
  366 +| operCode | short | 一级协议 |
  367 +| data.operCode | short | 二级协议 |
  368 +
  369 +```json
  370 +{
  371 + "deviceId":12345,
  372 + "timestamp":44324,
  373 + "operCode":0xC0,
  374 + "data":{
  375 + "operCode":0xa5
  376 + "programVersion":2
  377 + }
  378 +}
  379 +```
  380 +| .. | .. | .. |
  381 +| ---- | ---- | ---- |
  382 +| deviceId | string | 设备编号 |
  383 +| timestamp | long | 时间戳(ms) |
  384 +| operCode | short | 一级协议 |
  385 +| data.operCode | short | 二级协议 |
  386 +| data.programVersion | short | 程序版本 |
  387 +
  388 +<span style="color: red">Response</span>:
  389 +```json
  390 +{
  391 + "errCode":0
  392 +}
  393 +```
  394 +
  395 +### 调度消息上传接口
  396 +----------
  397 +上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)
  398 +<span style="color: red">Request</span>:
  399 +```json
  400 +{
  401 + "deviceId":12345,
  402 + "timestamp":44324,
  403 + "status":0,
  404 + "operCode":0x80,
  405 + "data":{
  406 + "operCode":0x26,
  407 + "requestCode":22
  408 + }
  409 +}
  410 +```
  411 +| .. | .. | .. |
  412 +| ---- | ---- | ---- |
  413 +| deviceId | string | 设备编号 |
  414 +| timestamp | long | 时间戳(ms) |
  415 +| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |
  416 +| operCode | short | 一级协议 消息确认将无数据 |
  417 +| data.operCode | short | 二级协议 |
  418 +| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |
  419 +<span style="color: red">Response</span>:
  420 +```json
  421 +{
  422 + "errCode":0
  423 +}
  424 +```
  425 +
  426 +### 车辆历史GPS
  427 +----------
  428 +表名:BSTH_C_GPS_INFO
  429 +
  430 +| .. | .. | .. |
  431 +| ---- | ---- | ---- |
  432 +| cityCode | int | 城市代码 |
  433 +| industryCode | int | 行业代码 |
  434 +| companyCode | int | 企业代码 |
  435 +| lineId | int | 线路编号 |
  436 +| deviceId | string | 设备编号 |
  437 +| driverNo | int | 驾驶员工号 |
  438 +| carparkSerialNo | int | 停车场序列号 |
  439 +| carparkNo | string | 停车场编号 |
  440 +| stopSerialNo | int | 站点序列号 |
  441 +| stopNo | string | 停车场编号 |
  442 +| lon | float | 经度 |
  443 +| lat | float | 维度 |
  444 +| ts | long | 时间戳 |
  445 +| speedSensor | float | 发动机速度 |
  446 +| speedGps | float | gps速度 |
  447 +| direction | float | 角度0-359 |
  448 +| inTemp | int | 车内温度 |
  449 +| serviceState | long | 设备状态字 |
  450 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
  451 +
... ...
src/main/java/com/bsth/controller/LineVersionsController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.util.List;
4   -import java.util.Map;
5   -
  3 +import com.bsth.entity.LineVersions;
  4 +import com.bsth.repository.LineRepository;
  5 +import com.bsth.service.LineVersionsService;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.web.bind.annotation.RequestMapping;
8 8 import org.springframework.web.bind.annotation.RequestMethod;
9 9 import org.springframework.web.bind.annotation.RequestParam;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
12   -import com.bsth.entity.LineVersions;
13   -import com.bsth.repository.LineRepository;
14   -import com.bsth.service.LineVersionsService;
  12 +import java.util.List;
  13 +import java.util.Map;
15 14  
16 15 /**
17 16 *
... ... @@ -75,7 +74,11 @@ public class LineVersionsController extends BaseController&lt;LineVersions, Integer
75 74 public Map<String, Object> add(@RequestParam Map<String, Object> map) {
76 75 return service.add(map);
77 76 }
78   -
  77 + @RequestMapping(value = "delete", method = RequestMethod.POST)
  78 + public Map<String, Object> delete(@RequestParam (defaultValue = "id") int id) {
  79 + return service.delete(id);
  80 + }
  81 +
79 82 /**
80 83 * 根据线路id获取当前版本号
81 84 *
... ...
src/main/java/com/bsth/controller/calc/CalcExportController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.common.ResponseCode;
  17 +import com.bsth.entity.calc.CalcWaybill;
  18 +import com.bsth.entity.mcy_forms.Waybillday;
  19 +import com.bsth.service.calc.CalcMixService;
  20 +import com.bsth.service.calc.CalcWaybillService;
  21 +import com.bsth.util.ReportUtils;
  22 +
  23 +@RestController
  24 +@RequestMapping("calc_export")
  25 +public class CalcExportController {
  26 +
  27 + @Autowired
  28 + CalcWaybillService service;
  29 +
  30 + @Autowired
  31 + CalcMixService clacMixService;
  32 +
  33 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET)
  34 + public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) {
  35 +
  36 + String line="";
  37 + if(map.get("line")!=null){
  38 + line=map.get("line").toString().trim();
  39 + }
  40 + String lineName="";
  41 + if(map.get("lineName")!=null){
  42 + lineName=map.get("lineName").toString().trim();
  43 + }
  44 + String startDate="";
  45 + if(map.get("startDate")!=null){
  46 + startDate=map.get("startDate").toString().trim();
  47 + }
  48 + String endDate="";
  49 + if(map.get("endDate")!=null){
  50 + endDate=map.get("endDate").toString().trim();
  51 + }
  52 + String cont="";
  53 + if(map.get("cont")!=null){
  54 + cont=map.get("cont").toString().trim();
  55 + }
  56 + String empnames="";
  57 + if(map.get("empnames")!=null){
  58 + empnames=map.get("empnames").toString().trim();
  59 + }
  60 + String gsdmManth="";
  61 + if(map.get("gsdmManth")!=null){
  62 + gsdmManth=map.get("gsdmManth").toString().trim();
  63 + }
  64 + String fgsdmManth="";
  65 + if(map.get("fgsdmManth")!=null){
  66 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  67 + }
  68 +
  69 + Map<String, Object> resMap = new HashMap<String, Object>();
  70 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  71 + List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  72 +
  73 + Map<String, Object> temp = new HashMap<String, Object>();
  74 + temp.put("i", "序号");
  75 + temp.put("jName", empnames);
  76 + temp.put("jhyybc", "计划营运班次");
  77 + temp.put("jhfyybc", "计划空驶班次");
  78 + temp.put("sjyybc", "实际营运班次");
  79 + temp.put("sjfyybc", "实际空驶班次");
  80 + temp.put("lbbc", "烂班班次");
  81 + temp.put("ljbc", "临加班次");
  82 + temp.put("jhzlc", "计划总里程");
  83 + temp.put("jhyylc", "计划营运里程");
  84 + temp.put("jhfyylc", "计划空驶里程");
  85 + temp.put("sjzlc", "实际总里程");
  86 + temp.put("sjyylc", "实际营运里程");
  87 + temp.put("sjfyylc", "实际空驶里程");
  88 + temp.put("lblc", "烂班里程");
  89 + temp.put("ljyylc", "临加营运里程");
  90 + temp.put("ljfyylc", "临加空驶里程");
  91 + resList.add(temp);
  92 + for(int i = 0; i < list.size(); i++){
  93 + temp = list.get(i);
  94 + temp.put("i", i+1);
  95 + resList.add(temp);
  96 + }
  97 +
  98 + String date = startDate.replaceAll("-", "");
  99 + if(!startDate.equals(endDate)){
  100 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  101 + }
  102 +
  103 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  104 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  105 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  106 + Map<String,Object> mm = new HashMap<String, Object>();
  107 + ReportUtils ee = new ReportUtils();
  108 +
  109 + try {
  110 + listI.add(resList.iterator());
  111 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  112 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls",
  113 + path+"export/"+date+"-"+lineName+"-人车班次公里统计.xls");
  114 + resMap.put("status", ResponseCode.SUCCESS);
  115 + } catch (Exception e) {
  116 + e.printStackTrace();
  117 + resMap.put("status", ResponseCode.ERROR);
  118 + }
  119 + return resMap;
  120 + }
  121 +
  122 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  123 + public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) {
  124 +
  125 + String line="";
  126 + if(map.get("line")!=null){
  127 + line=map.get("line").toString().trim();
  128 + }
  129 + String lineName="";
  130 + if(map.get("lineName")!=null){
  131 + lineName=map.get("lineName").toString().trim();
  132 + }
  133 + String startDate="";
  134 + if(map.get("startDate")!=null){
  135 + startDate=map.get("startDate").toString().trim();
  136 + }
  137 + String endDate="";
  138 + if(map.get("endDate")!=null){
  139 + endDate=map.get("endDate").toString().trim();
  140 + }
  141 + String tjtype="";
  142 + if(map.get("tjtype")!=null){
  143 + tjtype=map.get("tjtype").toString().trim();
  144 + }
  145 + String cont="";
  146 + if(map.get("cont")!=null){
  147 + cont=map.get("cont").toString().trim();
  148 + }
  149 + String gsdmSing="";
  150 + if(map.get("gsdmSing")!=null){
  151 + gsdmSing=map.get("gsdmSing").toString().trim();
  152 + }
  153 + String fgsdmSing="";
  154 + if(map.get("fgsdmSing")!=null){
  155 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  156 + }
  157 +
  158 + Map<String, Object> resMap = new HashMap<String, Object>();
  159 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  160 + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  161 +
  162 + Map<String, Object> temp = new HashMap<String, Object>();
  163 + temp.put("i", "序号");
  164 + temp.put("gS", "所属公司");
  165 + temp.put("xlName", "线路");
  166 + temp.put("jName", tjtype);
  167 + temp.put("jhzlc", "计划公里");
  168 + temp.put("sjzlc", "行驶里程(包括空放)");
  169 + temp.put("sjfyylc", "空驶里程");
  170 + temp.put("hyl", "耗油量");
  171 + temp.put("jzl", "加注量");
  172 + temp.put("sh", "非营业用油");
  173 +
  174 + resList.add(temp);
  175 + for(int i = 0; i < list.size(); i++){
  176 + temp = list.get(i);
  177 + temp.put("i", i+1);
  178 + if(temp.get("xlName") == null){
  179 + temp.put("xlName", "");
  180 + }
  181 + resList.add(temp);
  182 + }
  183 +
  184 + String date = startDate.replaceAll("-", "");
  185 + if(!startDate.equals(endDate)){
  186 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  187 + }
  188 +
  189 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  190 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  191 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  192 + Map<String,Object> mm = new HashMap<String, Object>();
  193 + ReportUtils ee = new ReportUtils();
  194 +
  195 + try {
  196 + listI.add(resList.iterator());
  197 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  198 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls",
  199 + path+"export/"+date+"-"+lineName+"-路单数据(统计).xls");
  200 + resMap.put("status", ResponseCode.SUCCESS);
  201 + } catch (Exception e) {
  202 + e.printStackTrace();
  203 + resMap.put("status", ResponseCode.ERROR);
  204 + }
  205 + return resMap;
  206 + }
  207 +
  208 +}
... ...
src/main/java/com/bsth/controller/calc/CalcMixController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.calc.CalcMixService;
  13 +
  14 +@RestController
  15 +@RequestMapping("calc_mix")
  16 +public class CalcMixController {
  17 +
  18 + @Autowired
  19 + CalcMixService service;
  20 +
  21 + @RequestMapping(value="/calcjsyspy")
  22 + public List<Map<String, Object>> calcjsyspy(@RequestParam Map<String, Object> map){
  23 + String line="";
  24 + if(map.get("line")!=null){
  25 + line=map.get("line").toString().trim();
  26 + }
  27 + String startDate="";
  28 + if(map.get("startDate")!=null){
  29 + startDate=map.get("startDate").toString().trim();
  30 + }
  31 + String endDate="";
  32 + if(map.get("endDate")!=null){
  33 + endDate=map.get("endDate").toString().trim();
  34 + }
  35 + String empnames="";
  36 + if(map.get("empnames")!=null){
  37 + empnames=map.get("empnames").toString().trim();
  38 + }
  39 + String cont="";
  40 + if(map.get("cont")!=null){
  41 + cont=map.get("cont").toString().trim();
  42 + }
  43 + String gsdmManth="";
  44 + if(map.get("gsdmManth")!=null){
  45 + gsdmManth=map.get("gsdmManth").toString().trim();
  46 + }
  47 + String fgsdmManth="";
  48 + if(map.get("fgsdmManth")!=null){
  49 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  50 + }
  51 + return service.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  52 + }
  53 +
  54 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  55 + public List<Map<String, Object>> singledatatj(@RequestParam Map<String, Object> map) {
  56 + String line="";
  57 + if(map.get("line")!=null){
  58 + line=map.get("line").toString().trim();
  59 + }
  60 + String startDate="";
  61 + if(map.get("startDate")!=null){
  62 + startDate=map.get("startDate").toString().trim();
  63 + }
  64 + String endDate="";
  65 + if(map.get("endDate")!=null){
  66 + endDate=map.get("endDate").toString().trim();
  67 + }
  68 + String tjtype="";
  69 + if(map.get("tjtype")!=null){
  70 + tjtype=map.get("tjtype").toString().trim();
  71 + }
  72 + String cont="";
  73 + if(map.get("cont")!=null){
  74 + cont=map.get("cont").toString().trim();
  75 + }
  76 + String gsdmSing="";
  77 + if(map.get("gsdmSing")!=null){
  78 + gsdmSing=map.get("gsdmSing").toString().trim();
  79 + }
  80 + String fgsdmSing="";
  81 + if(map.get("fgsdmSing")!=null){
  82 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  83 + }
  84 + return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  85 + }
  86 +
  87 +}
... ...
src/main/java/com/bsth/controller/oil/DlbController.java
... ... @@ -152,7 +152,11 @@ public class DlbController extends BaseController&lt;Dlb, Integer&gt;{
152 152 m.put("rq", y.getRq());
153 153 m.put("gsname",y.getGsname() );
154 154 m.put("fgsname", y.getFgsname());
155   - m.put("xlname", y.getXlname());
  155 + if(y.getLinename()==null){
  156 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  157 + }else{
  158 + m.put("xlname", y.getLinename());
  159 + }
156 160 m.put("nbbm", y.getNbbm());
157 161 m.put("jsy", y.getJsy());
158 162 m.put("name", y.getName());
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -255,7 +255,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
255 255 m.put("rq", sdfMonth.format(y.getRq()));
256 256 m.put("gsname",y.getGsname() );
257 257 m.put("fgsname", y.getFgsname());
258   - m.put("xlname", y.getXlname()==null?"":y.getXlname());
  258 + if(y.getLinename()==null){
  259 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  260 + }else{
  261 + m.put("xlname", y.getLinename());
  262 + }
259 263 m.put("nbbm", y.getNbbm());
260 264 m.put("jsy", y.getJsy());
261 265 m.put("name", y.getName());
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.alibaba.fastjson.JSONArray;
4   -import com.bsth.common.ResponseCode;
5   -import com.bsth.controller.BaseController;
6   -import com.bsth.controller.realcontrol.dto.ChangePersonCar;
7   -import com.bsth.controller.realcontrol.dto.DfsjChange;
8   -import com.bsth.data.BasicData;
9   -import com.bsth.data.schedule.DayOfSchedule;
10   -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
11   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
12   -import com.bsth.entity.schedule.SchedulePlanInfo;
13   -import com.bsth.service.realcontrol.ScheduleRealInfoService;
14   -import org.apache.commons.lang3.StringEscapeUtils;
15   -import org.joda.time.format.DateTimeFormat;
16   -import org.joda.time.format.DateTimeFormatter;
17   -import org.springframework.beans.factory.annotation.Autowired;
18   -import org.springframework.web.bind.annotation.*;
19   -
20   -import java.util.*;
21   -
22   -@RestController
23   -@RequestMapping("/realSchedule")
24   -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
25   -
26   - @Autowired
27   - ScheduleRealInfoService scheduleRealInfoService;
28   -
29   - @Autowired
30   - DayOfSchedule dayOfSchedule;
31   -
32   - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
33   - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
34   - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
35   - }
36   -
37   - @RequestMapping(value = "/lines")
38   - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
39   - return scheduleRealInfoService.findByLines(lines);
40   - }
41   -
42   - @RequestMapping(value = "/car")
43   - public List<ScheduleRealInfo> findByCar(String nbbm){
44   - return dayOfSchedule.findByNbbm(nbbm);
45   - }
46   -
47   - /**
48   - *
49   - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
50   - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
51   - */
52   - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
53   - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
54   - @RequestParam String dfsj,String bcType,
55   - @RequestParam(defaultValue = "") String opType) {
56   - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
57   - }
58   -
59   - /**
60   - *
61   - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
62   - */
63   - @RequestMapping(value = "/destroy", method = RequestMethod.POST)
64   - public Map<String, Object> destroy(@RequestParam String idsStr
65   - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
66   - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
67   - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
68   - }
69   -
70   - /**
71   - *
72   - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
73   - */
74   - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
75   - public Map<String, String> carDeviceMapp() {
76   - return BasicData.deviceId2NbbmMap.inverse();
77   - }
78   -
79   - /**
80   - *
81   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
82   - * lineId @throws
83   - */
84   - @RequestMapping(value = "/driver", method = RequestMethod.GET)
85   - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
86   - return scheduleRealInfoService.findDriverByLine(lineCode);
87   - }
88   -
89   - /**
90   - *
91   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
92   - * lineId @throws
93   - */
94   - @RequestMapping(value = "/conductor", method = RequestMethod.GET)
95   - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
96   - return scheduleRealInfoService.findConductorByLine(lineCode);
97   - }
98   -
99   - /**
100   - *
101   - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
102   - * lineId @throws
103   - */
104   - @RequestMapping(value = "/cars", method = RequestMethod.GET)
105   - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
106   - return scheduleRealInfoService.findCarByLine(lineCode);
107   - }
108   -
109   - /**
110   - *
111   - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
112   - */
113   - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
114   - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
115   - return scheduleRealInfoService.sreachVehic(nbbm);
116   - }
117   - /**
118   - *
119   - * @Title: realOutAdjust
120   - * @Description: TODO(实发调整)
121   - * @param @param id 班次ID
122   - * @param @param fcsjActual 实际发车时间 HH:mm
123   - * @param @param remarks 备注
124   - * @throws
125   - */
126   - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
127   - public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,
128   - @RequestParam String remarks) {
129   - return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);
130   - }
131   -
132   - /**
133   - *
134   - * @Title: revokeDestroy
135   - * @Description: TODO(撤销烂班)
136   - * @param @param id
137   - * @throws
138   - */
139   - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
140   - public Map<String, Object> revokeDestroy(@RequestParam Long id){
141   - return scheduleRealInfoService.revokeDestroy(id);
142   - }
143   -
144   - /**
145   - *
146   - * @Title: revokeRealOutgo
147   - * @Description: TODO(撤销实发)
148   - * @param @param id
149   - * @throws
150   - */
151   - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
152   - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
153   - return scheduleRealInfoService.revokeRealOutgo(id);
154   - }
155   -
156   - /**
157   - * 撤销执行
158   - * @param id
159   - * @return
160   - */
161   - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
162   - public Map<String, Object> revokeRealArrive(@RequestParam Long id){
163   - return scheduleRealInfoService.revokeRealArrive(id);
164   - }
165   -
166   - /**
167   - *
168   - * @Title: spaceAdjust
169   - * @Description: TODO(间隔调整)
170   - * @param @param ids 要调整的班次数组ID
171   - * @param @param space 间隔
172   - * @throws
173   - */
174   - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
175   - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
176   - return scheduleRealInfoService.spaceAdjust(ids, space);
177   - }
178   -
179   - /**
180   - *
181   - * @Title: schInfoFineTune
182   - * @Description: TODO(发车信息微调)
183   - * @param @param map
184   - * @throws
185   - */
186   - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
187   - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
188   - return scheduleRealInfoService.schInfoFineTune(map);
189   - }
190   -
191   - /**
192   - *
193   - * @Title: outgoAdjustAll
194   - * @Description: TODO(批量待发调整)
195   - * @param @param list
196   - * @throws
197   - */
198   - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
199   - public Map<String, Object> outgoAdjustAll(@RequestParam String params){
200   - //反转义
201   - params = StringEscapeUtils.unescapeHtml4(params);
202   - return scheduleRealInfoService.outgoAdjustAll(params);
203   - }
204   -
205   - /**
206   - *
207   - * @Title: findByLineAndUpDown
208   - * @Description: TODO(根据线路和走向获取班次)
209   - * @param @param line
210   - * @param @param upDown
211   - */
212   - @RequestMapping(value = "/findByLineAndUpDown")
213   - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
214   - return dayOfSchedule.findByLineAndUpDown(line, upDown);
215   - }
216   -
217   - /**
218   - *
219   - * @Title: findRouteByLine
220   - * @Description: TODO(获取线路的站点,路段路由)
221   - * @param @param lineCode
222   - * @throws
223   - */
224   - @RequestMapping(value = "/findRouteByLine")
225   - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
226   - return scheduleRealInfoService.findRouteByLine(lineCode);
227   - }
228   -
229   - /**
230   - *
231   - * @Title: removeChildTask
232   - * @Description: TODO(删除子任务)
233   - * @param @param taskId 子任务ID
234   - * @throws
235   - */
236   - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
237   - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
238   - return scheduleRealInfoService.removeChildTask(taskId);
239   - }
240   -
241   - /**
242   - *
243   - * @Title: findByLineCode
244   - * @Description: TODO(根据线路获取班次信息)
245   - * @param @param lineCode
246   - */
247   - @RequestMapping(value = "/lineCode/{lineCode}")
248   - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
249   - return dayOfSchedule.findByLineCode(lineCode);
250   - }
251   -
252   - @RequestMapping(value = "/queryUserInfo")
253   - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
254   - @RequestParam String date,@RequestParam String state) {
255   - return scheduleRealInfoService.queryUserInfo(line, date,state);
256   - }
257   -
258   - @RequestMapping(value = "/queryUserInfoPx")
259   - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
260   - @RequestParam String date,@RequestParam String state,@RequestParam String type) {
261   - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
262   - }
263   -
264   - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
265   - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
266   - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
267   - return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
268   - }
269   -
270   - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
271   - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
272   - ,@RequestParam String date,@RequestParam String line) {
273   - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
274   - }
275   -
276   -
277   - @RequestMapping(value = "/dailyInfo")
278   - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
279   - return scheduleRealInfoService.dailyInfo(line, date, type);
280   - }
281   -
282   - @RequestMapping(value = "/historyMessage")
283   - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
284   - @RequestParam String code, @RequestParam String type) {
285   - return scheduleRealInfoService.historyMessage(line, date, code, type);
286   - }
287   -
288   - @RequestMapping(value="/findLine")
289   - public List<Map<String,String>> findLine(@RequestParam String line){
290   - return scheduleRealInfoService.findLine(line);
291   - }
292   -
293   - @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
294   - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
295   - ,@RequestParam String date,@RequestParam String line){
296   - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
297   - }
298   -
299   - /**
300   - * 路单公里统计 (闵行审计专用)
301   - * @param jGh
302   - * @param clZbh
303   - * @param lpName
304   - * @param date
305   - * @param line
306   - * @return
307   - */
308   - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
309   - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
310   - ,@RequestParam String date,@RequestParam String line){
311   - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
312   - }
313   -
314   - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
315   - public Map<String,Object> findKMBCQp(@RequestParam String clZbh
316   - ,@RequestParam String date,@RequestParam String line){
317   - return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
318   - }
319   -
320   - @RequestMapping(value="/findLpName")
321   - public List<Map<String,String>> findLpName(@RequestParam String lpName){
322   - return scheduleRealInfoService.findLpName(lpName);
323   - }
324   -
325   - @RequestMapping(value = "/account")
326   - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
327   - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
328   - return scheduleRealInfoService.account(line, date, code, xlName, type);
329   - }
330   -
331   - @RequestMapping(value = "/accountPx")
332   - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
333   - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
334   - return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
335   - }
336   -
337   - @RequestMapping(value = "/correctForm")
338   - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
339   - @RequestParam String endDate,
340   - @RequestParam String lpName, @RequestParam String code,
341   - @RequestParam String type,@RequestParam String changType) {
342   - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
343   - }
344   - /**
345   - * @Title queryListWaybill
346   - * @Description 查询行车路单列表
347   - * @param jName 驾驶员名字
348   - * @param clZbh 车辆自编号(内部编号)
349   - * @param lpName 路牌
350   - * @return
351   - */
352   - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
353   - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
354   - ,@RequestParam String date,@RequestParam String line){
355   - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
356   - }
357   -
358   - /**
359   - * @Title queryListWaybill
360   - * @Description 查询行车路单列表(闵行审计专用路单)
361   - * @param jName 驾驶员名字
362   - * @param clZbh 车辆自编号(内部编号)
363   - * @param lpName 路牌
364   - * @return
365   - */
366   - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
367   - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
368   - ,@RequestParam String date,@RequestParam String line){
369   - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
370   - }
371   -
372   - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
373   - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
374   - @RequestParam String date,@RequestParam String line){
375   - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
376   - }
377   -
378   - @RequestMapping(value="/statisticsDaily")
379   - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
380   - @RequestParam String xlName, @RequestParam String type){
381   - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
382   - }
383   -
384   - @RequestMapping(value="/statisticsDaily_mh_2")
385   - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
386   - @RequestParam String xlName, @RequestParam String type){
387   - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
388   - }
389   -
390   - @RequestMapping(value="/statisticsDailyTj")
391   - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
392   - String gsdm="";
393   - if(map.get("gsdm")!=null){
394   - gsdm=map.get("gsdm").toString();
395   - }
396   - String fgsdm="";
397   - if(map.get("fgsdm")!=null){
398   - fgsdm=map.get("fgsdm").toString();
399   - }
400   - String line="";
401   - if(map.get("line")!=null){
402   - line=map.get("line").toString();
403   - }
404   - String date="";
405   - if(map.get("date")!=null){
406   - date=map.get("date").toString();
407   - }
408   - String date2="";
409   - if(map.get("date2")!=null){
410   - date2=map.get("date2").toString();
411   - }
412   - String xlName="";
413   - if(map.get("xlName")!=null){
414   - xlName=map.get("xlName").toString();
415   - }
416   - String type="";
417   - if(map.get("type")!=null){
418   - type=map.get("type").toString();
419   - }
420   - String nature="0";
421   - if(map.get("nature")!=null){
422   - nature=map.get("nature").toString();
423   - }
424   - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
425   - }
426   -
427   - /*
428   - * 公里修正报表
429   - */
430   - @RequestMapping(value="/mileageReportTj")
431   - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
432   - String gsdm="";
433   - if(map.get("gsdm")!=null){
434   - gsdm=map.get("gsdm").toString();
435   - }
436   - String fgsdm="";
437   - if(map.get("fgsdm")!=null){
438   - fgsdm=map.get("fgsdm").toString();
439   - }
440   - String line="";
441   - if(map.get("line")!=null){
442   - line=map.get("line").toString();
443   - }
444   - String date="";
445   - if(map.get("date")!=null){
446   - date=map.get("date").toString();
447   - }
448   - String date2="";
449   - if(map.get("date2")!=null){
450   - date2=map.get("date2").toString();
451   - }
452   - String xlName="";
453   - if(map.get("xlName")!=null){
454   - xlName=map.get("xlName").toString();
455   - }
456   - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
457   - }
458   -
459   - /*
460   - * 班次修正报表
461   - */
462   - @RequestMapping(value="/scheduleCorrectionReport")
463   - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
464   - String gsdm="";
465   - if(map.get("gsdm")!=null){
466   - gsdm=map.get("gsdm").toString();
467   - }
468   - String fgsdm="";
469   - if(map.get("fgsdm")!=null){
470   - fgsdm=map.get("fgsdm").toString();
471   - }
472   - String line="";
473   - if(map.get("line")!=null){
474   - line=map.get("line").toString();
475   - }
476   - String date="";
477   - if(map.get("date")!=null){
478   - date=map.get("date").toString();
479   - }
480   - String date2="";
481   - if(map.get("date2")!=null){
482   - date2=map.get("date2").toString();
483   - }
484   - String xlName="";
485   - if(map.get("xlName")!=null){
486   - xlName=map.get("xlName").toString();
487   - }
488   - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
489   - }
490   -
491   - @RequestMapping(value="/MapById",method = RequestMethod.GET)
492   - public Map<String, Object> MapById(@RequestParam("id") Long id){
493   - return scheduleRealInfoService.MapById(id);
494   - }
495   -
496   - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
497   - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
498   - return scheduleRealInfoService.MapByIdQp(id);
499   - }
500   -
501   - /**
502   - * @Title: scheduleDaily
503   - * @Description: TODO(调度日报表)
504   - * @param line 线路
505   - * @param date 时间
506   - * @return
507   - */
508   - @RequestMapping(value="/scheduleDaily")
509   - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
510   - return scheduleRealInfoService.scheduleDaily(line,date);
511   - }
512   -
513   - @RequestMapping(value="/realScheduleList")
514   - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
515   - return scheduleRealInfoService.realScheduleList(line,date);
516   - }
517   -
518   - @RequestMapping(value="/realScheduleList_zrw")
519   - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
520   - return scheduleRealInfoService.realScheduleList_zrw(line,date);
521   - }
522   -
523   - @RequestMapping(value="/realScheduleList_mh_2")
524   - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
525   - return scheduleRealInfoService.realScheduleList_mh_2(line,date);
526   - }
527   -
528   - @RequestMapping(value="/realScheduleListQp")
529   - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
530   - return scheduleRealInfoService.realScheduleListQp(line,date);
531   - }
532   -
533   - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
534   - public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
535   - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
536   - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
537   - return scheduleRealInfoService.multi_tzrc(cpcs, null);
538   - }
539   -
540   - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
541   - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
542   - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
543   - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
544   - return scheduleRealInfoService.multi_dftz(dfsjcs);
545   - }
546   -
547   - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
548   - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
549   - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
550   - }
551   -
552   - @RequestMapping(value="/history", method=RequestMethod.POST)
553   - public Map<String,Object> historySave(ScheduleRealInfo sch){
554   - return scheduleRealInfoService.historySave(sch);
555   - }
556   -
557   -
558   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
559   - private final static long ONE_DAY = 1000 * 60 * 60 * 24;
560   - /**
561   - * 获取可编辑的历史班次日期
562   - * @return
563   - */
564   - @RequestMapping("dateArray")
565   - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
566   - List<String> rs = new ArrayList<>();
567   -
568   - long t = System.currentTimeMillis();
569   - if(c != 1)
570   - t -= (ONE_DAY + (1000 * 60 * 60 * 6));
571   - for(int i = 0; i < 3; i ++){
572   - rs.add(fmtyyyyMMdd.print(t));
573   - t -= ONE_DAY;
574   - }
575   - return rs;
576   - }
577   -
578   - @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
579   - public Map<String, Object> svgAttr(@RequestParam String jsonStr){
580   - return scheduleRealInfoService.svgAttr(jsonStr);
581   - }
582   -
583   - @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
584   - public Map<String, Object> findSvgAttr(@RequestParam String idx){
585   - return scheduleRealInfoService.findSvgAttr(idx);
586   - }
587   -
588   - @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
589   - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
590   - return scheduleRealInfoService.addRemarks(id, remarks);
591   - }
592   -
593   - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
594   - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
595   - return scheduleRealInfoService.scheduleDailyQp(line,date);
596   - }
597   -
598   - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
599   - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
600   - return scheduleRealInfoService.scheduleDailyExport(map);
601   - }
602   -
603   - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
604   - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
605   - return scheduleRealInfoService.exportWaybillMore(map);
606   - }
607   -
608   - /**
609   - * 获取当日计划排班 , 从计划表抓取数据
610   - * @return
611   - */
612   - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
613   - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
614   - return scheduleRealInfoService.currentSchedulePlan(lineCode);
615   - }
616   -
617   - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
618   - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
619   - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
620   - }
621   -
622   - /**
623   - * 删除当日实际排班
624   - * @return
625   - */
626   - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
627   - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
628   - return dayOfSchedule.deleteRealSchedule(lineCode);
629   - }
630   -
631   - /**
632   - * 从计划表重新加载当日排班
633   - * @param lineCode
634   - * @return
635   - */
636   - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
637   - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
638   - Map<String, Object> rs = new HashMap<>();
639   - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
640   - if(list != null && list.size() > 0){
641   - rs.put("status", ResponseCode.ERROR);
642   - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
643   - return rs;
644   - }
645   -
646   - int code = dayOfSchedule.reloadSch(lineCode);
647   -
648   - //重新按公司编码索引数据
649   - dayOfSchedule.groupByGsbm();
650   - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
651   - return rs;
652   - }
653   -
654   - /**
655   - * 误点调整
656   - * @param idx
657   - * @param minute
658   - * @return
659   - */
660   - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
661   - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
662   - return scheduleRealInfoService.lateAdjust(idx, minute);
663   - }
664   -
665   - /**
666   - * 获取所有应发未到的班次
667   - * @param idx
668   - * @return
669   - */
670   - @RequestMapping(value = "allLate2")
671   - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
672   - return scheduleRealInfoService.allLate2(idx);
673   - }
674   -
675   - /**
676   - * 添加一个临加到历史库
677   - * @param sch
678   - * @return
679   - */
680   - @RequestMapping(value = "history/add", method = RequestMethod.POST)
681   - public Map<String, Object> addToHistory(ScheduleRealInfo sch){
682   - return scheduleRealInfoService.addToHistory(sch);
683   - }
684   -
685   - /**
686   - * 从历史库里删除临加班次
687   - * @param sch
688   - * @return
689   - */
690   - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
691   - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
692   - return scheduleRealInfoService.deleteToHistory(id);
693   - }
694   - @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
695   - public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
696   - Map<String, Object> map =new HashMap<>();
697   - map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
698   - return map;
699   - }
700   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.IOException;
  5 +import java.io.InputStream;
  6 +import java.io.OutputStream;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.URL;
  9 +import java.util.ArrayList;
  10 +import java.util.Collection;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.apache.commons.io.IOUtils;
  16 +import org.apache.commons.lang3.StringEscapeUtils;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.web.bind.annotation.PathVariable;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.RequestMethod;
  23 +import org.springframework.web.bind.annotation.RequestParam;
  24 +import org.springframework.web.bind.annotation.RestController;
  25 +
  26 +import com.alibaba.fastjson.JSONArray;
  27 +import com.bsth.common.ResponseCode;
  28 +import com.bsth.controller.BaseController;
  29 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  30 +import com.bsth.controller.realcontrol.dto.DfsjChange;
  31 +import com.bsth.data.BasicData;
  32 +import com.bsth.data.schedule.DayOfSchedule;
  33 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
  34 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  35 +import com.bsth.entity.schedule.SchedulePlanInfo;
  36 +import com.bsth.entity.sys.SysUser;
  37 +import com.bsth.security.util.SecurityUtils;
  38 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  39 +import com.bsth.util.ConfigUtil;
  40 +import com.fasterxml.jackson.databind.ObjectMapper;
  41 +
  42 +@RestController
  43 +@RequestMapping("/realSchedule")
  44 +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
  45 +
  46 + @Autowired
  47 + ScheduleRealInfoService scheduleRealInfoService;
  48 +
  49 + @Autowired
  50 + DayOfSchedule dayOfSchedule;
  51 +
  52 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  53 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  54 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  55 + }
  56 +
  57 + @RequestMapping(value = "/lines")
  58 + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
  59 + return scheduleRealInfoService.findByLines(lines);
  60 + }
  61 +
  62 + @RequestMapping(value = "/car")
  63 + public List<ScheduleRealInfo> findByCar(String nbbm){
  64 + return dayOfSchedule.findByNbbm(nbbm);
  65 + }
  66 +
  67 + /**
  68 + *
  69 + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
  70 + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
  71 + */
  72 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  73 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
  74 + @RequestParam String dfsj,String bcType,
  75 + @RequestParam(defaultValue = "") String opType) {
  76 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
  77 + }
  78 +
  79 + /**
  80 + *
  81 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
  82 + */
  83 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  84 + public Map<String, Object> destroy(@RequestParam String idsStr
  85 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  86 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  87 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
  88 + }
  89 +
  90 + /**
  91 + *
  92 + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
  93 + */
  94 + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
  95 + public Map<String, String> carDeviceMapp() {
  96 + return BasicData.deviceId2NbbmMap.inverse();
  97 + }
  98 +
  99 + /**
  100 + *
  101 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
  102 + * lineId @throws
  103 + */
  104 + @RequestMapping(value = "/driver", method = RequestMethod.GET)
  105 + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
  106 + return scheduleRealInfoService.findDriverByLine(lineCode);
  107 + }
  108 +
  109 + /**
  110 + *
  111 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
  112 + * lineId @throws
  113 + */
  114 + @RequestMapping(value = "/conductor", method = RequestMethod.GET)
  115 + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
  116 + return scheduleRealInfoService.findConductorByLine(lineCode);
  117 + }
  118 +
  119 + /**
  120 + *
  121 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
  122 + * lineId @throws
  123 + */
  124 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  125 + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
  126 + return scheduleRealInfoService.findCarByLine(lineCode);
  127 + }
  128 +
  129 + /**
  130 + *
  131 + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
  132 + */
  133 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  134 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
  135 + return scheduleRealInfoService.sreachVehic(nbbm);
  136 + }
  137 + /**
  138 + *
  139 + * @Title: realOutAdjust
  140 + * @Description: TODO(实发调整)
  141 + * @param @param id 班次ID
  142 + * @param @param fcsjActual 实际发车时间 HH:mm
  143 + * @param @param remarks 备注
  144 + * @throws
  145 + */
  146 + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
  147 + public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,
  148 + @RequestParam String remarks) {
  149 + return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);
  150 + }
  151 +
  152 + /**
  153 + *
  154 + * @Title: revokeDestroy
  155 + * @Description: TODO(撤销烂班)
  156 + * @param @param id
  157 + * @throws
  158 + */
  159 + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
  160 + public Map<String, Object> revokeDestroy(@RequestParam Long id){
  161 + return scheduleRealInfoService.revokeDestroy(id);
  162 + }
  163 +
  164 + /**
  165 + *
  166 + * @Title: revokeRealOutgo
  167 + * @Description: TODO(撤销实发)
  168 + * @param @param id
  169 + * @throws
  170 + */
  171 + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
  172 + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
  173 + return scheduleRealInfoService.revokeRealOutgo(id);
  174 + }
  175 +
  176 + /**
  177 + * 撤销执行
  178 + * @param id
  179 + * @return
  180 + */
  181 + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
  182 + public Map<String, Object> revokeRealArrive(@RequestParam Long id){
  183 + return scheduleRealInfoService.revokeRealArrive(id);
  184 + }
  185 +
  186 + /**
  187 + *
  188 + * @Title: spaceAdjust
  189 + * @Description: TODO(间隔调整)
  190 + * @param @param ids 要调整的班次数组ID
  191 + * @param @param space 间隔
  192 + * @throws
  193 + */
  194 + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
  195 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
  196 + return scheduleRealInfoService.spaceAdjust(ids, space);
  197 + }
  198 +
  199 + /**
  200 + *
  201 + * @Title: schInfoFineTune
  202 + * @Description: TODO(发车信息微调)
  203 + * @param @param map
  204 + * @throws
  205 + */
  206 + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
  207 + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
  208 + return scheduleRealInfoService.schInfoFineTune(map);
  209 + }
  210 +
  211 + /**
  212 + *
  213 + * @Title: outgoAdjustAll
  214 + * @Description: TODO(批量待发调整)
  215 + * @param @param list
  216 + * @throws
  217 + */
  218 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  219 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  220 + //反转义
  221 + params = StringEscapeUtils.unescapeHtml4(params);
  222 + return scheduleRealInfoService.outgoAdjustAll(params);
  223 + }
  224 +
  225 + /**
  226 + *
  227 + * @Title: findByLineAndUpDown
  228 + * @Description: TODO(根据线路和走向获取班次)
  229 + * @param @param line
  230 + * @param @param upDown
  231 + */
  232 + @RequestMapping(value = "/findByLineAndUpDown")
  233 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
  234 + return dayOfSchedule.findByLineAndUpDown(line, upDown);
  235 + }
  236 +
  237 + /**
  238 + *
  239 + * @Title: findRouteByLine
  240 + * @Description: TODO(获取线路的站点,路段路由)
  241 + * @param @param lineCode
  242 + * @throws
  243 + */
  244 + @RequestMapping(value = "/findRouteByLine")
  245 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  246 + return scheduleRealInfoService.findRouteByLine(lineCode);
  247 + }
  248 +
  249 + /**
  250 + *
  251 + * @Title: removeChildTask
  252 + * @Description: TODO(删除子任务)
  253 + * @param @param taskId 子任务ID
  254 + * @throws
  255 + */
  256 + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
  257 + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
  258 + return scheduleRealInfoService.removeChildTask(taskId);
  259 + }
  260 +
  261 + /**
  262 + *
  263 + * @Title: findByLineCode
  264 + * @Description: TODO(根据线路获取班次信息)
  265 + * @param @param lineCode
  266 + */
  267 + @RequestMapping(value = "/lineCode/{lineCode}")
  268 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  269 + return dayOfSchedule.findByLineCode(lineCode);
  270 + }
  271 +
  272 + @RequestMapping(value = "/queryUserInfo")
  273 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  274 + @RequestParam String date,@RequestParam String state) {
  275 + return scheduleRealInfoService.queryUserInfo(line, date,state);
  276 + }
  277 +
  278 + @RequestMapping(value = "/queryUserInfoPx")
  279 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  280 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  281 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  282 + }
  283 +
  284 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
  285 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
  286 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  287 + return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
  288 + }
  289 +
  290 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
  291 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  292 + ,@RequestParam String date,@RequestParam String line) {
  293 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
  294 + }
  295 +
  296 +
  297 + @RequestMapping(value = "/dailyInfo")
  298 + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
  299 + return scheduleRealInfoService.dailyInfo(line, date, type);
  300 + }
  301 +
  302 + @RequestMapping(value = "/historyMessage")
  303 + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
  304 + @RequestParam String code, @RequestParam String type) {
  305 + return scheduleRealInfoService.historyMessage(line, date, code, type);
  306 + }
  307 +
  308 + @RequestMapping(value="/findLine")
  309 + public List<Map<String,String>> findLine(@RequestParam String line){
  310 + return scheduleRealInfoService.findLine(line);
  311 + }
  312 +
  313 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
  314 + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  315 + ,@RequestParam String date,@RequestParam String line){
  316 + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
  317 + }
  318 +
  319 + /**
  320 + * 路单公里统计 (闵行审计专用)
  321 + * @param jGh
  322 + * @param clZbh
  323 + * @param lpName
  324 + * @param date
  325 + * @param line
  326 + * @return
  327 + */
  328 + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
  329 + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  330 + ,@RequestParam String date,@RequestParam String line){
  331 + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
  332 + }
  333 +
  334 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
  335 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  336 + ,@RequestParam String date,@RequestParam String line){
  337 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
  338 + }
  339 +
  340 + @RequestMapping(value="/findLpName")
  341 + public List<Map<String,String>> findLpName(@RequestParam String lpName){
  342 + return scheduleRealInfoService.findLpName(lpName);
  343 + }
  344 +
  345 + @RequestMapping(value = "/account")
  346 + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
  347 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  348 + return scheduleRealInfoService.account(line, date, code, xlName, type);
  349 + }
  350 +
  351 + @RequestMapping(value = "/accountPx")
  352 + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
  353 + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
  354 + return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
  355 + }
  356 +
  357 + @RequestMapping(value = "/correctForm")
  358 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  359 + @RequestParam String endDate,
  360 + @RequestParam String lpName, @RequestParam String code,
  361 + @RequestParam String type,@RequestParam String changType) {
  362 + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
  363 + }
  364 + /**
  365 + * @Title queryListWaybill
  366 + * @Description 查询行车路单列表
  367 + * @param jName 驾驶员名字
  368 + * @param clZbh 车辆自编号(内部编号)
  369 + * @param lpName 路牌
  370 + * @return
  371 + */
  372 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
  373 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  374 + ,@RequestParam String date,@RequestParam String line){
  375 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
  376 + }
  377 +
  378 + /**
  379 + * @Title queryListWaybill
  380 + * @Description 查询行车路单列表(闵行审计专用路单)
  381 + * @param jName 驾驶员名字
  382 + * @param clZbh 车辆自编号(内部编号)
  383 + * @param lpName 路牌
  384 + * @return
  385 + */
  386 + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
  387 + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  388 + ,@RequestParam String date,@RequestParam String line){
  389 + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
  390 + }
  391 +
  392 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
  393 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  394 + @RequestParam String date,@RequestParam String line){
  395 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
  396 + }
  397 +
  398 + @RequestMapping(value="/statisticsDaily")
  399 + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
  400 + @RequestParam String xlName, @RequestParam String type){
  401 + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
  402 + }
  403 +
  404 + @RequestMapping(value="/statisticsDaily_mh_2")
  405 + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
  406 + @RequestParam String xlName, @RequestParam String type){
  407 + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
  408 + }
  409 +
  410 + @RequestMapping(value="/statisticsDailyTj")
  411 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
  412 + String gsdm="";
  413 + if(map.get("gsdm")!=null){
  414 + gsdm=map.get("gsdm").toString();
  415 + }
  416 + String fgsdm="";
  417 + if(map.get("fgsdm")!=null){
  418 + fgsdm=map.get("fgsdm").toString();
  419 + }
  420 + String line="";
  421 + if(map.get("line")!=null){
  422 + line=map.get("line").toString();
  423 + }
  424 + String date="";
  425 + if(map.get("date")!=null){
  426 + date=map.get("date").toString();
  427 + }
  428 + String date2="";
  429 + if(map.get("date2")!=null){
  430 + date2=map.get("date2").toString();
  431 + }
  432 + String xlName="";
  433 + if(map.get("xlName")!=null){
  434 + xlName=map.get("xlName").toString();
  435 + }
  436 + String type="";
  437 + if(map.get("type")!=null){
  438 + type=map.get("type").toString();
  439 + }
  440 + String nature="0";
  441 + if(map.get("nature")!=null){
  442 + nature=map.get("nature").toString();
  443 + }
  444 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
  445 + }
  446 +
  447 + /*
  448 + * 公里修正报表
  449 + */
  450 + @RequestMapping(value="/mileageReportTj")
  451 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  452 + String gsdm="";
  453 + if(map.get("gsdm")!=null){
  454 + gsdm=map.get("gsdm").toString();
  455 + }
  456 + String fgsdm="";
  457 + if(map.get("fgsdm")!=null){
  458 + fgsdm=map.get("fgsdm").toString();
  459 + }
  460 + String line="";
  461 + if(map.get("line")!=null){
  462 + line=map.get("line").toString();
  463 + }
  464 + String date="";
  465 + if(map.get("date")!=null){
  466 + date=map.get("date").toString();
  467 + }
  468 + String date2="";
  469 + if(map.get("date2")!=null){
  470 + date2=map.get("date2").toString();
  471 + }
  472 + String xlName="";
  473 + if(map.get("xlName")!=null){
  474 + xlName=map.get("xlName").toString();
  475 + }
  476 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  477 + }
  478 +
  479 + /*
  480 + * 班次修正报表
  481 + */
  482 + @RequestMapping(value="/scheduleCorrectionReport")
  483 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  484 + String gsdm="";
  485 + if(map.get("gsdm")!=null){
  486 + gsdm=map.get("gsdm").toString();
  487 + }
  488 + String fgsdm="";
  489 + if(map.get("fgsdm")!=null){
  490 + fgsdm=map.get("fgsdm").toString();
  491 + }
  492 + String line="";
  493 + if(map.get("line")!=null){
  494 + line=map.get("line").toString();
  495 + }
  496 + String date="";
  497 + if(map.get("date")!=null){
  498 + date=map.get("date").toString();
  499 + }
  500 + String date2="";
  501 + if(map.get("date2")!=null){
  502 + date2=map.get("date2").toString();
  503 + }
  504 + String xlName="";
  505 + if(map.get("xlName")!=null){
  506 + xlName=map.get("xlName").toString();
  507 + }
  508 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  509 + }
  510 +
  511 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  512 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  513 + return scheduleRealInfoService.MapById(id);
  514 + }
  515 +
  516 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  517 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  518 + return scheduleRealInfoService.MapByIdQp(id);
  519 + }
  520 +
  521 + /**
  522 + * @Title: scheduleDaily
  523 + * @Description: TODO(调度日报表)
  524 + * @param line 线路
  525 + * @param date 时间
  526 + * @return
  527 + */
  528 + @RequestMapping(value="/scheduleDaily")
  529 + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
  530 + return scheduleRealInfoService.scheduleDaily(line,date);
  531 + }
  532 +
  533 + @RequestMapping(value="/realScheduleList")
  534 + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
  535 + return scheduleRealInfoService.realScheduleList(line,date);
  536 + }
  537 +
  538 + @RequestMapping(value="/realScheduleList_zrw")
  539 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  540 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  541 + }
  542 +
  543 + @RequestMapping(value="/realScheduleList_mh_2")
  544 + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
  545 + return scheduleRealInfoService.realScheduleList_mh_2(line,date);
  546 + }
  547 +
  548 + @RequestMapping(value="/realScheduleListQp")
  549 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  550 + return scheduleRealInfoService.realScheduleListQp(line,date);
  551 + }
  552 +
  553 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  554 + public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  555 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  556 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  557 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
  558 + }
  559 +
  560 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  561 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  562 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  563 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  564 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  565 + }
  566 +
  567 + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
  568 + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
  569 + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
  570 + }
  571 +
  572 + @RequestMapping(value="/history", method=RequestMethod.POST)
  573 + public Map<String,Object> historySave(ScheduleRealInfo sch){
  574 + return scheduleRealInfoService.historySave(sch);
  575 + }
  576 +
  577 +
  578 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  579 + private final static long ONE_DAY = 1000 * 60 * 60 * 24;
  580 + /**
  581 + * 获取可编辑的历史班次日期
  582 + * @return
  583 + */
  584 + @RequestMapping("dateArray")
  585 + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
  586 + List<String> rs = new ArrayList<>();
  587 +
  588 + long t = System.currentTimeMillis();
  589 + if(c != 1)
  590 + t -= (ONE_DAY + (1000 * 60 * 60 * 6));
  591 + for(int i = 0; i < 3; i ++){
  592 + rs.add(fmtyyyyMMdd.print(t));
  593 + t -= ONE_DAY;
  594 + }
  595 + return rs;
  596 + }
  597 +
  598 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  599 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  600 + return scheduleRealInfoService.svgAttr(jsonStr);
  601 + }
  602 +
  603 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  604 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  605 + return scheduleRealInfoService.findSvgAttr(idx);
  606 + }
  607 +
  608 + @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
  609 + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
  610 + return scheduleRealInfoService.addRemarks(id, remarks);
  611 + }
  612 +
  613 + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
  614 + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
  615 + return scheduleRealInfoService.scheduleDailyQp(line,date);
  616 + }
  617 +
  618 + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
  619 + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
  620 + return scheduleRealInfoService.scheduleDailyExport(map);
  621 + }
  622 +
  623 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  624 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  625 + return scheduleRealInfoService.exportWaybillMore(map);
  626 + }
  627 +
  628 + /**
  629 + * 获取当日计划排班 , 从计划表抓取数据
  630 + * @return
  631 + */
  632 + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
  633 + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
  634 + return scheduleRealInfoService.currentSchedulePlan(lineCode);
  635 + }
  636 +
  637 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  638 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  639 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
  640 + }
  641 +
  642 + /**
  643 + * 删除当日实际排班
  644 + * @return
  645 + */
  646 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  647 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  648 + return dayOfSchedule.deleteRealSchedule(lineCode);
  649 + }
  650 +
  651 + /**
  652 + * 从计划表重新加载当日排班
  653 + * @param lineCode
  654 + * @return
  655 + */
  656 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  657 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  658 + Map<String, Object> rs = new HashMap<>();
  659 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  660 + if(list != null && list.size() > 0){
  661 + rs.put("status", ResponseCode.ERROR);
  662 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  663 + return rs;
  664 + }
  665 +
  666 + int code = dayOfSchedule.reloadSch(lineCode);
  667 +
  668 + //重新按公司编码索引数据
  669 + dayOfSchedule.groupByGsbm();
  670 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  671 + return rs;
  672 + }
  673 +
  674 + /**
  675 + * 误点调整
  676 + * @param idx
  677 + * @param minute
  678 + * @return
  679 + */
  680 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  681 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  682 + return scheduleRealInfoService.lateAdjust(idx, minute);
  683 + }
  684 +
  685 + /**
  686 + * 获取所有应发未到的班次
  687 + * @param idx
  688 + * @return
  689 + */
  690 + @RequestMapping(value = "allLate2")
  691 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  692 + return scheduleRealInfoService.allLate2(idx);
  693 + }
  694 +
  695 + /**
  696 + * 添加一个临加到历史库
  697 + * @param sch
  698 + * @return
  699 + */
  700 + @RequestMapping(value = "history/add", method = RequestMethod.POST)
  701 + public Map<String, Object> addToHistory(ScheduleRealInfo sch){
  702 + return scheduleRealInfoService.addToHistory(sch);
  703 + }
  704 +
  705 + /**
  706 + * 从历史库里删除临加班次
  707 + * @param sch
  708 + * @return
  709 + */
  710 + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
  711 + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
  712 + return scheduleRealInfoService.deleteToHistory(id);
  713 + }
  714 +
  715 + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
  716 + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
  717 + Map<String, Object> map =new HashMap<>();
  718 + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
  719 + return map;
  720 + }
  721 +
  722 + /**
  723 + * 从历史库里删除临加班次
  724 + * @param sch
  725 + * @return
  726 + */
  727 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  728 + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
  729 + SysUser user = SecurityUtils.getCurrentUser();
  730 + String uname = user.getUserName();
  731 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
  732 + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
  733 + // 分公司保存格式 分公司编码_公司编码
  734 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
  735 + String[] arr = val.split("_");
  736 + if (!"22".equals(arr[1])) {
  737 + Map<String, Object> res = new HashMap<String, Object>();
  738 + res.put("status", ResponseCode.ERROR);
  739 + res.put("msg", "除金高公司外暂未开通此功能");
  740 +
  741 + return res;
  742 + }
  743 + url.append("&fgs=").append(arr[0]);
  744 +
  745 + return request(url.toString());
  746 + }
  747 +
  748 + @SuppressWarnings("unchecked")
  749 + private static Map<String, Object> request(String url) {
  750 + Map<String, Object> res = new HashMap<String, Object>();
  751 + res.put("status", ResponseCode.SUCCESS);
  752 + InputStream in = null;
  753 + HttpURLConnection con = null;
  754 + try {
  755 + con = (HttpURLConnection)new URL(url).openConnection();
  756 + con.setRequestMethod("POST");
  757 + con.setRequestProperty("keep-alive", "true");
  758 + con.setRequestProperty("accept", "application/json");
  759 + con.setRequestProperty("content-type", "application/json");
  760 + con.setDoInput(true);
  761 + con.setReadTimeout(2500);
  762 + con.setConnectTimeout(2500);
  763 +
  764 + con.connect();
  765 + if (con.getResponseCode() == 200) {
  766 + in = con.getInputStream();
  767 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  768 + IOUtils.copy(in, bout); bout.close();
  769 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  770 + if (!"报修成功".equals(response.get("msg"))) {
  771 + res.put("status", ResponseCode.ERROR);
  772 + res.putAll(response);
  773 + }
  774 + }
  775 + } catch (IOException e) {
  776 + // TODO Auto-generated catch block
  777 + res.put("status", ResponseCode.ERROR);
  778 + res.put("msg", "调用上报接口异常");
  779 + } finally {
  780 + try {
  781 + if (in != null) in.close();
  782 + if (con != null) con.disconnect();
  783 + } catch (IOException e) {
  784 + // TODO Auto-generated catch block
  785 + e.printStackTrace();
  786 + }
  787 + }
  788 +
  789 + return res;
  790 + }
  791 +}
... ...
src/main/java/com/bsth/controller/report/CalcSheetController.java
... ... @@ -42,4 +42,11 @@ public class CalcSheetController extends BaseController&lt;CalcSheet, Integer&gt;{
42 42 List<Map<String, Object>> list=calcSheetService.calcTurnoutrate(map);
43 43 return list;
44 44 }
  45 +
  46 +
  47 + @RequestMapping(value = "/calcTurnoutrateZgf",method = RequestMethod.GET)
  48 + public List<Map<String, Object>> calcTurnoutrateZgf(@RequestParam Map<String, Object> map){
  49 + List<Map<String, Object>> list=calcSheetService.calcTurnoutrateZgf(map);
  50 + return list;
  51 + }
45 52 }
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
19 19 import com.bsth.data.BasicData;
20 20 import com.bsth.entity.StationRoute;
21 21 import com.bsth.entity.excep.ArrivalInfo;
  22 +import com.bsth.entity.mcy_forms.Singledata;
22 23 import com.bsth.entity.realcontrol.ScheduleRealInfo;
23 24 import com.bsth.service.report.ReportService;
24 25 import com.bsth.util.ReportUtils;
... ... @@ -357,10 +358,17 @@ public class ReportController {
357 358  
358 359 return lMap;
359 360 }
360   -
361   -
362 361 @RequestMapping(value="/online")
363 362 public Map<String, Object> online(@RequestParam Map<String, Object> map){
364 363 return service.online(map);
365 364 }
  365 +
  366 +
  367 +
  368 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  369 + public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) {
  370 +
  371 + return service.singledatatj(map);
  372 + }
  373 +
366 374 }
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -55,6 +55,7 @@ public class BasicData {
55 55 //线路编码和名称对照
56 56 public static Map<String, String> lineCode2NameMap;
57 57  
  58 + public static Map<String, String> lineCodeAllNameMap;
58 59 //停车场
59 60 public static List<String> parkCodeList;
60 61  
... ... @@ -315,6 +316,14 @@ public class BasicData {
315 316 lineId2ShangHaiCodeMap = id2SHcode;
316 317 lineCode2ShangHaiCodeMap = code2SHcode;
317 318 stationName2YgcNumber = tempStationName2YgcNumber;
  319 +
  320 + Map<String, String> code2nameAll = new HashMap<>();
  321 + Iterator<Line> iteratorAll = lineRepository.findAll().iterator();
  322 + while (iteratorAll.hasNext()) {
  323 + line = iteratorAll.next();
  324 + code2nameAll.put(line.getLineCode(), line.getName());
  325 + }
  326 + lineCodeAllNameMap=code2nameAll;
318 327 }
319 328  
320 329 /**
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
... ... @@ -121,7 +121,7 @@ public class InStationProcess {
121 121 private void inEndStation(ScheduleRealInfo sch, GpsEntity gps) {
122 122 String nbbm = sch.getClZbh();
123 123 //校验进站前置约束
124   - if (!validInPremise(gps))
  124 + if (!validInPremise(gps) && isNormalSch(sch))
125 125 return;
126 126  
127 127 //实达时间不覆盖
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
... ... @@ -74,7 +74,7 @@ public class OutStationProcess {
74 74 * @param gps
75 75 */
76 76 private void outStation(GpsEntity gps, GpsEntity prev) {
77   - logger.info("站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
  77 + logger.info("站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
78 78 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
79 79  
80 80 //起点发车
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
... ... @@ -44,7 +44,7 @@ public class CalcOilThread extends Thread{
44 44 dlbService.obtainDsq();
45 45 logger.info("计算路单里程加注量结束!");
46 46 logger.info("开始计算班次准点率....");
47   - sheetService.saveSheetList("");
  47 + //sheetService.saveSheetList("");
48 48 logger.info("计算班次准点率结束!");
49 49  
50 50 logger.info("开始保存重新统计数据....");
... ...
src/main/java/com/bsth/entity/mcy_forms/Shifday.java
... ... @@ -35,6 +35,8 @@ public class Shifday {
35 35 private String sjbc;//实际班次
36 36  
37 37 private String jgh;
  38 +
  39 + private String sgh;
38 40  
39 41 private String zbh;
40 42  
... ... @@ -56,6 +58,14 @@ public class Shifday {
56 58 this.jgh = jgh;
57 59 }
58 60  
  61 + public String getSgh() {
  62 + return sgh;
  63 + }
  64 +
  65 + public void setSgh(String sgh) {
  66 + this.sgh = sgh;
  67 + }
  68 +
59 69 public String getZbh() {
60 70 return zbh;
61 71 }
... ...
src/main/java/com/bsth/entity/oil/Dlb.java
... ... @@ -22,6 +22,7 @@ public class Dlb {
22 22 @DateTimeFormat(pattern="yyyy-MM-dd")
23 23 private Date rq;
24 24 private String xlbm;
  25 + private String linename;
25 26 private String ssgsdm;
26 27 private String fgsdm;
27 28 private String nbbm;
... ... @@ -102,6 +103,14 @@ public class Dlb {
102 103 this.xlbm = xlbm;
103 104 }
104 105  
  106 + public String getLinename() {
  107 + return linename;
  108 + }
  109 +
  110 + public void setLinename(String linename) {
  111 + this.linename = linename;
  112 + }
  113 +
105 114 public String getSsgsdm() {
106 115 return ssgsdm;
107 116 }
... ... @@ -348,7 +357,7 @@ public class Dlb {
348 357 }
349 358  
350 359 public String getXlname() {
351   - return BasicData.lineCode2NameMap.get(this.xlbm);
  360 + return BasicData.lineCodeAllNameMap.get(this.xlbm);
352 361 }
353 362  
354 363 public void setXlname(String xlname) {
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
... ... @@ -22,6 +22,7 @@ public class Ylb {
22 22 @DateTimeFormat(pattern="yyyy-MM-dd")
23 23 private Date rq;
24 24 private String xlbm;
  25 + private String linename;
25 26 private String ssgsdm;
26 27 private String fgsdm;
27 28 private String nbbm;
... ... @@ -95,6 +96,15 @@ public class Ylb {
95 96 public void setXlbm(String xlbm) {
96 97 this.xlbm = xlbm;
97 98 }
  99 +
  100 + public String getLinename() {
  101 + return linename;
  102 + }
  103 +
  104 + public void setLinename(String linename) {
  105 + this.linename = linename;
  106 + }
  107 +
98 108 public String getSsgsdm() {
99 109 return ssgsdm;
100 110 }
... ... @@ -292,7 +302,7 @@ public class Ylb {
292 302 }
293 303  
294 304 public String getXlname() {
295   - return BasicData.lineCode2NameMap.get(this.xlbm);
  305 + return BasicData.lineCodeAllNameMap.get(this.xlbm);
296 306 }
297 307  
298 308 public void setXlname(String xlname) {
... ...
src/main/java/com/bsth/entity/sheet/CalcSheet.java
... ... @@ -49,6 +49,8 @@ public class CalcSheet {
49 49 private String sjbcs;
50 50 /*临加班次数*/
51 51 private String ljbcs;
  52 + /*计划发车早高峰*/
  53 + private String jhcczgf;
52 54 /*公司名字*/
53 55 @Transient
54 56 private String gsname;
... ... @@ -173,6 +175,12 @@ public class CalcSheet {
173 175 }
174 176  
175 177  
  178 + public String getJhcczgf() {
  179 + return jhcczgf;
  180 + }
  181 + public void setJhcczgf(String jhcczgf) {
  182 + this.jhcczgf = jhcczgf;
  183 + }
176 184 public String getFgsname() {
177 185 return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
178 186 }
... ...
src/main/java/com/bsth/filter/AccessLogFilter.java
... ... @@ -58,9 +58,11 @@ public class AccessLogFilter extends BaseFilter {
58 58 s.append(getBlock(params));
59 59 s.append(getBlock(headers));
60 60 s.append(getBlock(request.getHeader("Referer")));
61   -
62   - logger.info(s.toString());
  61 +
  62 + long now = System.currentTimeMillis();
63 63 chain.doFilter(request, response);
  64 + s.append("<cost time:").append(System.currentTimeMillis() - now).append(">");
  65 + logger.info(s.toString());
64 66 }
65 67  
66 68 private static String getParams(HttpServletRequest request) {
... ...
src/main/java/com/bsth/repository/LineRepository.java
... ... @@ -51,6 +51,8 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
51 51 @Query("SELECT L FROM Line L where L.destroy=0 and L.remove !=1")
52 52 List<Line> findAllService();
53 53  
  54 + @Query("SELECT L FROM Line L")
  55 + List<Line> findAll();
54 56  
55 57 @Modifying
56 58 @Query(value = "UPDATE Line l set l.name=?1 , l.company=?2, l.brancheCompany=?3, "
... ...
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
... ... @@ -58,4 +58,15 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
58 58 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
59 59 List<ScheduleRealInfo> findAllScheduleByDate(String schDate);
60 60  
  61 +
  62 + //按照时间段统计,公司下线路 (驾驶员)
  63 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(jGh,'/',jName) like %?6% order by c.xl")
  64 + List<CalcWaybill> scheduleByJsy(String line,String date,String date2,String gsdm,String fgsdm,String jsy);
  65 + //按照时间段统计,公司下线路 (售票员)
  66 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(sGh,'/',sName) like %?6% order by c.xl")
  67 + List<CalcWaybill> scheduleBySpy(String line,String date,String date2,String gsdm,String fgsdm,String spy);
  68 + //按照时间段统计,公司下线路 (车辆自编号)
  69 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and cl like %?6% order by c.xl")
  70 + List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
  71 +
61 72 }
... ...
src/main/java/com/bsth/repository/oil/CwjyRepository.java
... ... @@ -22,8 +22,8 @@ public interface CwjyRepository extends BaseRepository&lt;Cwjy, Integer&gt;{
22 22 */
23 23 @Query(value="SELECT a.gsdm as gsdm,a.nbbm as nbbm,b.jsy as jsy,b.jzl as jzl ,b.stationid as stationid,"
24 24 + "b.nylx as nylx,b.yj as yj,b.bz as bz,c.jsy as ldgh FROM bsth_c_cwjy a "+
25   - " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days(?1) and jylx=1) b " +
26   - " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy from bsth_c_ylb where to_days(rq)= to_days(?1 ) group by nbbm "+
  25 + " left join ( select * from bsth_c_ylxxb b where b.yyrq=?1 and jylx=1) b " +
  26 + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy from bsth_c_ylb where rq= ?1 group by nbbm "+
27 27 " ) c on a.nbbm=c.nbbm where a.nbbm like %?2% ",nativeQuery=true)
28 28 List<Object[]> obtainCwjycl(String rq,String nbbm);
29 29  
... ...
src/main/java/com/bsth/repository/oil/DlbRepository.java
1 1 package com.bsth.repository.oil;
2 2  
  3 +import java.util.Date;
3 4 import java.util.List;
4 5  
5 6 import org.springframework.data.jpa.repository.Modifying;
... ... @@ -28,19 +29,27 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
28 29 * @param rq
29 30 * @return
30 31 */
31   - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  32 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and ssgsdm like %?2% "
32 33 + " and fgsdm like %?3%"
33 34 + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true)
34 35 List<Dlb> obtainDl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px);
35 36  
36 37 @Query(value="select s from Dlb s "
37   - + " where to_days(?1)=to_days(s.rq) "
  38 + + " where to_days(s.rq)=to_days(?1) "
38 39 + " and s.ssgsdm like %?2% "
39 40 + " and s.fgsdm like %?3%"
40 41 + " and s.xlbm like %?4% "
41 42 + " and s.nbbm in ?5 order by nbbm,jcsx")
42 43 List<Dlb> listDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
43 44  
  45 + @Query(value="select s from Dlb s "
  46 + + " where s.rq=?1 "
  47 + + " and s.ssgsdm like %?2% "
  48 + + " and s.fgsdm like %?3%"
  49 + + " and s.xlbm like %?4% "
  50 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  51 + List<Dlb> listDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  52 +
44 53  
45 54 /**
46 55 *
... ... @@ -49,14 +58,14 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
49 58 * @param xlbm
50 59 * @return
51 60 */
52   - @Query(value="select nbbm,count(nbbm) from bsth_c_dlb where to_days(?1)=to_days(rq) and "
  61 + @Query(value="select nbbm,count(nbbm) from bsth_c_dlb where rq=?1 and "
53 62 + " ssgsdm like %?2% "
54 63 + " and fgsdm like %?3%"
55 64 + " and xlbm like %?4% and nbbm like %?5% "
56 65 + " group by nbbm,rq,ssgsdm,fgsdm",nativeQuery=true)
57 66 List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
58 67  
59   - @Query(value="select nbbm,sum(cdl*100) as cdl ,sum(zlc*100) as zlc from bsth_c_dlb where to_days(?1)=to_days(rq) and "
  68 + @Query(value="select nbbm,sum(cdl*100) as cdl ,sum(zlc*100) as zlc from bsth_c_dlb where rq= ?1 and "
60 69 + " ssgsdm like %?2% "
61 70 + " and fgsdm like %?3%"
62 71 + " and xlbm like %?4% and nbbm like %?5% "
... ... @@ -66,15 +75,24 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
66 75  
67 76  
68 77 @Query(value="select cdl,hd,sh from Dlb s "
69   - + " where to_days(?1)=to_days(s.rq) "
  78 + + " where to_days(s.rq)=to_days(?1) "
70 79 + " and s.ssgsdm like %?2% "
71 80 + " and s.fgsdm like %?3%"
72 81 + " and s.xlbm like %?4% "
73 82 + " and s.nbbm in ?5 ")
74 83 List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
75 84  
  85 + @Query(value="select cdl,hd,sh from Dlb s "
  86 + + " where s.rq=?1"
  87 + + " and s.ssgsdm like %?2% "
  88 + + " and s.fgsdm like %?3%"
  89 + + " and s.xlbm like %?4% "
  90 + + " and s.nbbm in ?5 ")
  91 + List<Object[]> sumDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  92 +
  93 +
76 94 @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb "
77   - + " where to_days(?1)=to_days(rq) "
  95 + + " where rq=?1 "
78 96 + " and ssgsdm like %?2% "
79 97 + " and fgsdm like %?3%"
80 98 + " and xlbm like %?4% "
... ... @@ -93,10 +111,10 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
93 111 " WHERE id = ?1", nativeQuery=true)
94 112 public void dlbUpdate(Integer id,double czcd,double jzcd,double hd, double sh,String shyy,int yhlx);
95 113  
96   - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
  114 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
97 115 List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm);
98 116  
99   - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true)
  117 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and xlbm=?2",nativeQuery=true)
100 118 List<Dlb> queryDlbByRqXlbm(String rq, String xlbm);
101 119  
102 120 }
... ...
src/main/java/com/bsth/repository/oil/LsylbRepository.java
... ... @@ -22,7 +22,7 @@ public interface LsylbRepository extends BaseRepository&lt;Lsylb, Integer&gt;{
22 22 * @param xlbm
23 23 * @return
24 24 */
25   - @Query(value="select nbbm,count(nbbm) from bsth_ls_ylb where to_days(?1)=to_days(rq) and "
  25 + @Query(value="select nbbm,count(nbbm) from bsth_ls_ylb where rq=?1 and "
26 26 + " ssgsdm like %?2% "
27 27 + " and fgsdm like %?3%"
28 28 + " and xlbm like %?4% and nbbm like %?5% and nylx= ?6 "
... ... @@ -30,7 +30,7 @@ public interface LsylbRepository extends BaseRepository&lt;Lsylb, Integer&gt;{
30 30 List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int nylx);
31 31  
32 32 @Query(value="select s from Lsylb s "
33   - + " where to_days(?1)=to_days(s.rq) "
  33 + + " where to_days(s.rq)=to_days(?1) "
34 34 + " and s.ssgsdm =?2 "
35 35 + " and s.fgsdm =?3 "
36 36 + " and s.xlbm like %?4% "
... ... @@ -38,7 +38,7 @@ public interface LsylbRepository extends BaseRepository&lt;Lsylb, Integer&gt;{
38 38 + " and s.nbbm in ?6 order by nbbm,jhsj")
39 39 List<Lsylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,int nylx,List<String> listNbbm);
40 40  
41   - @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_ls_ylb where to_days(?1)=to_days(rq) and "
  41 + @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_ls_ylb where rq=?1 and "
42 42 + " ssgsdm like %?2% "
43 43 + " and fgsdm like %?3%"
44 44 + " and xlbm like %?4% and nbbm like %?5% and nylx =?6 "
... ... @@ -47,7 +47,7 @@ public interface LsylbRepository extends BaseRepository&lt;Lsylb, Integer&gt;{
47 47  
48 48  
49 49 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_ls_ylb "
50   - + " where to_days(?1)=to_days(rq) "
  50 + + " where rq=?1 "
51 51 + " and ssgsdm like %?2% "
52 52 + " and fgsdm like %?3%"
53 53 + " and xlbm like %?4% "
... ... @@ -57,7 +57,7 @@ public interface LsylbRepository extends BaseRepository&lt;Lsylb, Integer&gt;{
57 57  
58 58  
59 59 @Query(value="select jzl,yh,sh from Lsylb s "
60   - + " where to_days(?1)=to_days(s.rq) "
  60 + + " where to_days(s.rq)=to_days(?1) "
61 61 + " and s.ssgsdm like %?2% "
62 62 + " and s.fgsdm like %?3%"
63 63 + " and s.xlbm like %?4% "
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -33,7 +33,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
33 33 @Query(value="select y.* from (select max(d.id) as id ,d.nbbm from ("
34 34 + " select b.rq,b.nbbm,max(b.jcsx) as jcsx from ("
35 35 + " select max(t.rq) as rq ,t.nbbm from bsth_c_ylb t "
36   - + " where to_days(t.rq)< to_days(?1) "
  36 + + " where t.rq< ?1 "
37 37 + " and t.ssgsdm like %?2% and t.fgsdm like %?3% "
38 38 + " and t.xlbm like %?4% and t.nbbm like %?5% group by nbbm ) a "
39 39 + " left join bsth_c_ylb b on a.rq=b.rq and a.nbbm=b.nbbm "
... ... @@ -63,29 +63,29 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
63 63 * @param rq
64 64 * @return
65 65 */
66   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  66 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and ssgsdm like %?2% "
67 67 + " and fgsdm like %?3%"
68 68 + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
69 69 List<Ylb> obtainYl(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
70 70  
71   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  71 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and ssgsdm like %?2% "
72 72 + " and fgsdm like %?3%"
73 73 + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
74 74 List<Ylb> obtainYlEq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
75 75  
76   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  76 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and ssgsdm like %?2% "
77 77 + " and fgsdm like %?3%"
78 78 + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
79 79 List<Ylb> obtainYl_eq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
80 80  
81 81  
82   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
  82 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
83 83 List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm);
84 84  
85   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true)
  85 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and xlbm=?2",nativeQuery=true)
86 86 List<Ylb> queryYlbByRqXlbm(String rq,String xlbm);
87 87  
88   - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true)
  88 + @Query(value="SELECT * FROM bsth_c_ylb where rq=?1 and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true)
89 89 List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px);
90 90 /**
91 91 * 查询当天总的加注量和总里程
... ... @@ -102,7 +102,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
102 102 * @param xlbm
103 103 * @return
104 104 */
105   - @Query(value="select nbbm,count(nbbm) from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  105 + @Query(value="select nbbm,count(nbbm) from bsth_c_ylb where rq=?1 and "
106 106 + " ssgsdm like %?2% "
107 107 + " and fgsdm like %?3%"
108 108 + " and xlbm like %?4% and nbbm like %?5% "
... ... @@ -117,7 +117,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
117 117 * @param xlbm
118 118 * @return
119 119 */
120   - @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  120 + @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_c_ylb where rq=?1 and "
121 121 + " ssgsdm like %?2% "
122 122 + " and fgsdm like %?3%"
123 123 + " and xlbm like %?4% and nbbm like %?5% "
... ... @@ -126,15 +126,24 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
126 126  
127 127  
128 128 @Query(value="select jzl,yh,sh from Ylb s "
129   - + " where to_days(?1)=to_days(s.rq) "
  129 + + " where to_days(s.rq)=to_days(?1) "
130 130 + " and s.ssgsdm like %?2% "
131 131 + " and s.fgsdm like %?3%"
132 132 + " and s.xlbm like %?4% "
133 133 + " and s.nbbm in ?5 ")
134 134 List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
135 135  
  136 + @Query(value="select jzl,yh,sh from Ylb s "
  137 + + " where s.rq=?1 "
  138 + + " and s.ssgsdm like %?2% "
  139 + + " and s.fgsdm like %?3%"
  140 + + " and s.xlbm like %?4% "
  141 + + " and s.nbbm in ?5 ")
  142 + List<Object[]> sumYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  143 +
  144 +
136 145 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
137   - + " where to_days(?1)=to_days(rq) "
  146 + + " where rq=?1 "
138 147 + " and ssgsdm like %?2% "
139 148 + " and fgsdm like %?3%"
140 149 + " and xlbm like %?4% "
... ... @@ -144,13 +153,21 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
144 153  
145 154  
146 155 @Query(value="select s from Ylb s "
147   - + " where to_days(?1)=to_days(s.rq) "
  156 + + " where to_days(s.rq)=to_days(?1) "
148 157 + " and s.ssgsdm =?2 "
149 158 + " and s.fgsdm =?3 "
150 159 + " and s.xlbm like %?4% "
151 160 + " and s.nbbm in ?5 order by nbbm,jcsx")
152 161 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
153 162  
  163 + @Query(value="select s from Ylb s "
  164 + + " where s.rq=?1 "
  165 + + " and s.ssgsdm =?2 "
  166 + + " and s.fgsdm =?3 "
  167 + + " and s.xlbm like %?4% "
  168 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  169 + List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  170 +
154 171  
155 172 @Transactional
156 173 @Modifying
... ...
src/main/java/com/bsth/service/calc/CalcMixService.java 0 → 100644
  1 +package com.bsth.service.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +/**
  7 + * Created by 19/02/28.
  8 + */
  9 +public interface CalcMixService {
  10 +
  11 + List<Map<String, Object>> calcjsyspy(String line, String startDate, String endDate, String cont, String empnames, String gsdmManth, String fgsdmManth);
  12 +
  13 + List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing);
  14 +
  15 +}
... ...
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java 0 → 100644
  1 +package com.bsth.service.calc.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.util.ArrayList;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import com.bsth.data.BasicData;
  11 +import com.bsth.entity.calc.CalcWaybill;
  12 +import com.bsth.entity.mcy_forms.Singledata;
  13 +import com.bsth.repository.calc.CalcWaybillRepository;
  14 +import com.bsth.service.calc.CalcMixService;
  15 +import com.bsth.util.Arith;
  16 +
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.jdbc.core.JdbcTemplate;
  21 +import org.springframework.jdbc.core.RowMapper;
  22 +import org.springframework.stereotype.Service;
  23 +
  24 +/**
  25 + * Created by 19/02/28.
  26 + */
  27 +@Service
  28 +public class CalcMixServiceImpl implements CalcMixService {
  29 +
  30 + @Autowired
  31 + private CalcWaybillRepository calcRepository;
  32 +
  33 + @Autowired
  34 + JdbcTemplate jdbcTemplate;
  35 +
  36 +
  37 + Logger logger = LoggerFactory.getLogger(this.getClass());
  38 +
  39 +
  40 + @Override
  41 + public List<Map<String, Object>> calcjsyspy(String line, String date, String date2,
  42 + String empnames, String cont, String gsdm, String fgsdm) {
  43 +
  44 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  45 + List<CalcWaybill> list = null;
  46 +
  47 + int flag = 0;
  48 + if("驾驶员".equals(empnames)){
  49 + flag = 1;
  50 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  51 + } else if("售票员".equals(empnames)){
  52 + flag = 2;
  53 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  54 + } else if("车辆自编号".equals(empnames)){
  55 + flag = 3;
  56 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  57 + }
  58 +
  59 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  60 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  61 +
  62 + CalcWaybill zjCalc = this.initCalcWaybill();
  63 + zjCalc.setjName("合计");
  64 + for(CalcWaybill c : list){
  65 + String key = "";
  66 + if(flag == 1){
  67 + if(c.getjGh() != null && c.getjName() != null)
  68 + key = c.getjGh() + "/" + c.getjName();
  69 + } else if(flag == 2){
  70 + if(c.getsGh() != null && c.getsName() != null)
  71 + key = c.getsGh() + "/" + c.getsName();
  72 + } else if(flag == 3){
  73 + if(c.getCl() != null)
  74 + key = c.getCl();
  75 + }
  76 +
  77 + if(key.trim().length() == 0 || "/".equals(key))
  78 + continue;
  79 +
  80 + CalcWaybill calc = null;
  81 + if(calcMap.containsKey(key)){
  82 + calc = calcMap.get(key);
  83 + } else {
  84 + calc = this.initCalcWaybill();
  85 + calc.setjName(key);
  86 + calcList.add(calc);
  87 + calcMap.put(key, calc);
  88 + }
  89 +
  90 + this.summation(calc, c);
  91 +
  92 + this.summation(zjCalc, c);
  93 +
  94 + }
  95 + calcList.add(zjCalc);
  96 + calcMap.put("合计", zjCalc);
  97 +
  98 + for(CalcWaybill c : calcList){
  99 + Map<String, Object> m = new HashMap<String, Object>();
  100 + m.put("jName", c.getjName());
  101 + m.put("jhyybc", c.getJhyybc());
  102 + m.put("jhfyybc", c.getJhfyybc());
  103 + m.put("sjyybc", c.getSjyybc());
  104 + m.put("sjfyybc", c.getSjfyybc());
  105 + m.put("lbbc", c.getLbbc());
  106 + m.put("ljbc", c.getLjbc());
  107 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  108 + m.put("jhyylc", c.getJhyylc());
  109 + m.put("jhfyylc", c.getJhfyylc());
  110 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  111 + m.put("sjyylc", c.getSjyylc());
  112 + m.put("sjfyylc", c.getSjfyylc());
  113 + m.put("lblc", c.getLblc());
  114 + m.put("ljyylc", c.getLjyylc());
  115 + m.put("ljfyylc", c.getLjfyylc());
  116 + resList.add(m);
  117 + }
  118 +
  119 + return resList;
  120 + }
  121 +
  122 + public CalcWaybill initCalcWaybill(){
  123 + CalcWaybill calc = new CalcWaybill();
  124 + calc.setJhyybc(0);
  125 + calc.setJhyylc(0d);
  126 + calc.setJhfyybc(0);
  127 + calc.setJhfyylc(0d);
  128 + calc.setSjyybc(0);
  129 + calc.setSjyylc(0d);
  130 + calc.setSjfyybc(0);
  131 + calc.setSjfyylc(0d);
  132 + calc.setLbbc(0);
  133 + calc.setLblc(0d);
  134 + calc.setLjbc(0);
  135 + calc.setLjyylc(0d);
  136 + calc.setLjfyylc(0d);
  137 + return calc;
  138 + }
  139 +
  140 + public CalcWaybill summation(CalcWaybill c1, CalcWaybill c2){
  141 + c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc());
  142 + c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc()));
  143 + c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc());
  144 + c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc()));
  145 + c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc());
  146 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc()));
  147 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc()));
  148 + c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc());
  149 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc()));
  150 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc()));
  151 + c1.setLbbc(c1.getLbbc() + c2.getLbbc());
  152 + c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc()));
  153 + c1.setLjbc(c1.getLjbc() + c2.getLjbc());
  154 + c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc()));
  155 + c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc()));
  156 + return c1;
  157 + }
  158 +
  159 + @Override
  160 + public List<Map<String, Object>> singledatatj(String line,
  161 + String date, String date2,
  162 + String tjtype, String cont,
  163 + String gsdm, String fgsdm) {
  164 +
  165 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  166 + List<CalcWaybill> list = null;
  167 +
  168 + int flag = 0;
  169 + if("驾驶员".equals(tjtype)){
  170 + flag = 1;
  171 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  172 + } else if("售票员".equals(tjtype)){
  173 + flag = 2;
  174 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  175 + } else if("车辆自编号".equals(tjtype)){
  176 + flag = 3;
  177 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  178 + }
  179 +
  180 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  181 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  182 +
  183 + CalcWaybill zjCalc = this.initCalcWaybill();
  184 + zjCalc.setjName("合计");
  185 + for(CalcWaybill c : list){
  186 + String key = "";
  187 + if(flag == 1){
  188 + if(c.getjGh() != null && c.getjName() != null)
  189 + key += c.getjGh() + "/" + c.getjName();
  190 + } else if(flag == 2){
  191 + if(c.getsGh() != null && c.getsName() != null)
  192 + key += c.getsGh() + "/" + c.getsName();
  193 + } else if(flag == 3){
  194 + if(c.getCl() != null)
  195 + key += c.getCl();
  196 + }
  197 +
  198 + if(key.trim().length() == 0 || "/".equals(key))
  199 + continue;
  200 +
  201 + String jName = key;
  202 + key = c.getXl() + "/" + key;
  203 +
  204 + CalcWaybill calc = null;
  205 + if(calcMap.containsKey(key)){
  206 + calc = calcMap.get(key);
  207 + } else {
  208 + calc = this.initCalcWaybill();
  209 + calc.setXlName(c.getXlName());
  210 + calc.setXl(c.getXl());
  211 + calc.setjName(jName);
  212 + calcList.add(calc);
  213 + calcMap.put(key, calc);
  214 + }
  215 +
  216 + this.summation(calc, c);
  217 +
  218 + this.summation(zjCalc, c);
  219 +
  220 + }
  221 + calcList.add(zjCalc);
  222 + calcMap.put("合计", zjCalc);
  223 +
  224 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  225 + for(CalcWaybill c : calcList){
  226 + Map<String, Object> m = new HashMap<String, Object>();
  227 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  228 + m.put("xl", c.getXl());
  229 + m.put("xlName", c.getXlName());
  230 + m.put("jName", c.getjName());
  231 + m.put("jhyybc", c.getJhyybc());
  232 + m.put("jhfyybc", c.getJhfyybc());
  233 + m.put("sjyybc", c.getSjyybc());
  234 + m.put("sjfyybc", c.getSjfyybc());
  235 + m.put("lbbc", c.getLbbc());
  236 + m.put("ljbc", c.getLjbc());
  237 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  238 + m.put("jhyylc", c.getJhyylc());
  239 + m.put("jhfyylc", c.getJhfyylc());
  240 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  241 + m.put("sjyylc", c.getSjyylc());
  242 + m.put("sjfyylc", c.getSjfyylc());
  243 + m.put("lblc", c.getLblc());
  244 + m.put("ljyylc", c.getLjyylc());
  245 + m.put("ljfyylc", c.getLjfyylc());
  246 + if(flag != 2){
  247 + m.put("hyl", 0);
  248 + m.put("jzl", 0);
  249 + m.put("sh", 0);
  250 + }
  251 + resList.add(m);
  252 + keyMap.put(c.getXl() + "/" + c.getjName(), m);
  253 + }
  254 +
  255 + String linesql="";
  256 + if(!line.equals("")){
  257 + linesql +=" and xlbm ='"+line+"' ";
  258 + }
  259 + if(!gsdm.equals("")){
  260 + linesql +=" and ssgsdm ='"+gsdm+"' ";
  261 + }
  262 + if(!fgsdm.equals("")){
  263 + linesql +=" and fgsdm ='"+fgsdm+"' ";
  264 + }
  265 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
  266 + + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'"
  267 + + linesql
  268 + + " union"
  269 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
  270 + + " WHERE rq >= '"+date2+"' and rq <= '"+date2+"'"
  271 + + linesql;
  272 + List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
  273 + @Override
  274 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  275 + Singledata sin = new Singledata();
  276 + sin.setxL(arg0.getString("xlbm"));
  277 + sin.setJsy(arg0.getString("jsy"));
  278 + sin.setClzbh(arg0.getString("nbbm"));
  279 + sin.setJzl(arg0.getString("jzl"));
  280 + sin.setHyl(arg0.getString("yh"));
  281 + sin.setUnyyyl(arg0.getString("sh"));
  282 + sin.setgS(arg0.getString("fgsdm"));
  283 + return sin;
  284 + }
  285 + });
  286 +
  287 + if(flag != 2){
  288 + Map<String, Object> last = resList.get(resList.size()-1);
  289 + last.put("hyl", 0);
  290 + last.put("jzl", 0);
  291 + last.put("sh", 0);
  292 +
  293 + //统计油,电表中手动添加的或者有加注没里程的数据
  294 + for (int i = 0; i < listNy.size(); i++) {
  295 + Singledata sin_=listNy.get(i);
  296 + String xl=sin_.getxL();
  297 + String str = "";
  298 + if(flag == 1){
  299 + str = sin_.getJsy() + "/" + BasicData.allPerson.get(gsdm+"-"+sin_.getJsy());
  300 + } else {
  301 + str = sin_.getClzbh();
  302 + }
  303 +// boolean fages=true;
  304 + if(keyMap.containsKey(xl + "/" + str)){
  305 + Map<String, Object> m = keyMap.get(xl + "/" + str);
  306 + m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0));
  307 + m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0));
  308 + m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0));
  309 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  310 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  311 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  312 + } else {
  313 + Map<String, Object> m = new HashMap<String, Object>();
  314 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  315 + m.put("xl", xl);
  316 + m.put("xlName", BasicData.lineCodeAllNameMap.get(xl));
  317 + m.put("jName", str);
  318 + m.put("jhzlc", 0);
  319 + m.put("sjzlc", 0);
  320 + m.put("sjfyylc", 0);
  321 + m.put("hyl", sin_.getHyl()!=null?sin_.getHyl():0);
  322 + m.put("jzl", sin_.getJzl()!=null?sin_.getJzl():0);
  323 + m.put("sh", sin_.getUnyyyl()!=null?sin_.getUnyyyl():0);
  324 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  325 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  326 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  327 +
  328 + keyMap.put(xl + "/" + str, m);
  329 + }
  330 + }
  331 + resList.remove(last);
  332 + resList.add(last);
  333 + }
  334 +
  335 + return resList;
  336 + }
  337 +
  338 +}
... ...
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
... ... @@ -181,12 +181,12 @@ public class CalcToolServiceImpl implements CalcToolService {
181 181 if(i != l){
182 182 CalcWaybill c1 = listCal.get(i);
183 183 CalcWaybill c2 = listCal.get(l);
184   -
185   - c1.setSjyylc(c1.getSjyylc() + c2.getSjyylc());
186   - c1.setSjfyylc(c1.getSjfyylc() + c2.getSjfyylc());
187   - c1.setLjyylc(c1.getLjyylc() + c2.getLjyylc());
188   - c1.setLjfyylc(c1.getLjfyylc() + c2.getLjfyylc());
189   -
  184 +//
  185 +// c1.setSjyylc(c1.getSjyylc() + c2.getSjyylc());
  186 +// c1.setSjfyylc(c1.getSjfyylc() + c2.getSjfyylc());
  187 +// c1.setLjyylc(c1.getLjyylc() + c2.getLjyylc());
  188 +// c1.setLjfyylc(c1.getLjfyylc() + c2.getLjfyylc());
  189 +//
190 190 listCal.remove(l);
191 191 } else {
192 192 break;
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -596,7 +596,7 @@ public class FormsServiceImpl implements FormsService {
596 596 @Override
597 597 public List<Shifday> shifday(Map<String, Object> map) {
598 598  
599   - String line="";
  599 + String line="";
600 600 String date="";
601 601 String gsdmShif="";
602 602 String fgsdmShif="";
... ... @@ -624,18 +624,17 @@ public class FormsServiceImpl implements FormsService {
624 624 if(!type.equals("") && !statue.equals("")){
625 625 sql_ +=" order by "+statue+" "+type;
626 626 }
627   - String sql ="select t.* from (select r.schedule_date,r.j_name,"
628   - + "IFNULL(r.s_name,'')as s_name,"
629   - + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name "
630   - + "FROM bsth_c_s_sp_info_real r where 1=1 "
631   - + " and r.schedule_date_str='"+date + "' "
  627 + String sql ="select t.* from (select r.schedule_date,"
  628 + + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh,"
  629 + + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name"
  630 + + " FROM bsth_c_s_sp_info_real r where 1=1 "
  631 + + " and r.schedule_date_str='"+date + "' "
632 632 + " and r.xl_bm = '"+line+"' "
633 633 + " and r.gs_bm like '%"+gsdmShif+"%' "
634   - + " and r.fgs_bm like '%"+fgsdmShif+"%' ) t"
635   - + " GROUP BY t.schedule_date,t.j_name,t.s_name, "
636   - + "t.cl_zbh,t.xl_bm,t.j_gh,t.gs_bm,t.fgs_bm,t.lp_name "
637   - + sql_;
638   -
  634 + + " and r.fgs_bm like '%"+fgsdmShif+"%' "+sql_+") t"
  635 + + " GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name,"
  636 + + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm ";
  637 +
639 638  
640 639 List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() {
641 640  
... ... @@ -643,15 +642,16 @@ public class FormsServiceImpl implements FormsService {
643 642 public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException {
644 643 Shifday shifday = new Shifday();
645 644 shifday.setRq(arg0.getString("schedule_date"));
646   - shifday.setjName(arg0.getString("j_name").toString());
647   - shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString());
  645 +// shifday.setjName(arg0.getString("j_name").toString());
  646 +// shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString());
648 647 shifday.setCarPlate(arg0.getString("cl_zbh").toString());
649 648 shifday.setJgh(arg0.getString("j_gh"));
  649 + shifday.setSgh(arg0.getString("s_gh") == null ? "" : arg0.getString("s_gh").toString());
650 650 shifday.setLpName(arg0.getString("lp_name")== null ? "" : arg0.getString("lp_name").toString());
651 651 return shifday;
652 652 }
653   -
654 653 });
  654 +
655 655 List<ScheduleRealInfo> sList;
656 656 List<ScheduleRealInfo> list_s;
657 657 List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString());
... ... @@ -661,8 +661,9 @@ public class FormsServiceImpl implements FormsService {
661 661 Shifday d=list.get(i);
662 662 for (int j = 0; j < lists.size(); j++) {
663 663 ScheduleRealInfo s=lists.get(j);
664   - if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh())
665   - &&d.getLpName().equals(s.getLpName())){
  664 + if(d.getJgh().equals(s.getjGh()) && d.getSgh().equals(s.getsGh())
  665 + && d.getCarPlate().equals(s.getClZbh())
  666 + && d.getLpName().equals(s.getLpName())){
666 667 sList.add(s);
667 668 Set<ChildTaskPlan> cts = s.getcTasks();
668 669 if(cts != null && cts.size() > 0){
... ... @@ -674,7 +675,10 @@ public class FormsServiceImpl implements FormsService {
674 675 }
675 676 }
676 677 }
677   -
  678 + if(sList.size()>0){
  679 + d.setjName(sList.get(0).getjName());
  680 + d.setsName(sList.get(0).getsName() == null ? "":sList.get(0).getsName());
  681 + }
678 682 double ksgl=culateMileageService.culateKsgl(list_s);
679 683 double jccgl=culateMileageService.culateJccgl(list_s);
680 684 double zksgl=Arith.add(ksgl, jccgl);
... ... @@ -893,7 +897,9 @@ public class FormsServiceImpl implements FormsService {
893 897 if(fgsdm.length() != 0){
894 898 sql += " and r.fgs_bm ='"+fgsdm+"'";
895 899 }
896   - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh";
  900 + sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh,r.j_name " +
  901 + "order by r.xl_bm,r.cl_zbh";
  902 +
897 903  
898 904 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
899 905 @Override
... ... @@ -924,7 +930,7 @@ public class FormsServiceImpl implements FormsService {
924 930 + " WHERE rq = '"+startDate+"'"
925 931 + linesql
926 932 + " union"
927   - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
  933 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
928 934 + " WHERE rq = '"+startDate+"'"
929 935 + linesql;
930 936 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
... ... @@ -968,7 +974,7 @@ public class FormsServiceImpl implements FormsService {
968 974 s.setsName("");
969 975 s.setgS(BasicData.businessFgsCodeNameMap.get(sin_.getgS()+"_"+gsdm));
970 976 s.setxL(line);
971   - s.setXlmc(BasicData.lineCode2NameMap.get(line));
  977 + s.setXlmc(BasicData.lineCodeAllNameMap.get(line));
972 978 s.setJzl(sin_.getJzl());
973 979 s.setHyl(sin_.getHyl());
974 980 s.setUnyyyl(sin_.getUnyyyl());
... ... @@ -1724,7 +1730,7 @@ public class FormsServiceImpl implements FormsService {
1724 1730 startDate = map.get("startDate").toString();
1725 1731  
1726 1732 String sql="select r.s_gh,r.s_name, "
1727   - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  1733 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm,xl_name"
1728 1734 + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'";
1729 1735 if(!xlbm.equals("")){
1730 1736 sql += " and r.xl_bm = '"+xlbm+"'";
... ... @@ -1736,7 +1742,7 @@ public class FormsServiceImpl implements FormsService {
1736 1742 sql += " and r.fgs_bm='"+fgsdm+"'";
1737 1743 }
1738 1744 sql += " group by r.s_gh,r.s_name,"
1739   - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  1745 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh";
1740 1746  
1741 1747 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1742 1748 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -1750,6 +1756,7 @@ public class FormsServiceImpl implements FormsService {
1750 1756 sin.setjName(arg0.getString("j_name"));
1751 1757 sin.setSgh(arg0.getString("s_gh"));
1752 1758 sin.setsName(arg0.getString("s_name"));
  1759 + sin.setXlmc(arg0.getString("xl_name"));
1753 1760 sin.setgS(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs_bm")+"_"+arg0.getString("gs_bm")));
1754 1761  
1755 1762 return sin;
... ... @@ -1767,7 +1774,7 @@ public class FormsServiceImpl implements FormsService {
1767 1774 String clzbh=sin.getClzbh();
1768 1775 String xl=sin.getxL();
1769 1776 String spy=sin.getSgh();
1770   - sin.setxL(BasicData.lineCode2NameMap.get(xl));
  1777 + sin.setxL(sin.getXlmc());
1771 1778 for (int j = 0; j < listReal.size(); j++) {
1772 1779 ScheduleRealInfo s=listReal.get(j);
1773 1780 if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
... ... @@ -1912,7 +1919,12 @@ public class FormsServiceImpl implements FormsService {
1912 1919 sin.setEmptMileage(String.valueOf(zksgl));
1913 1920 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1914 1921 sin.setxL(y.getXlbm());
1915   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
  1922 + if(y.getLinename()==null){
  1923 + sin.setXlmc(y.getXlname());
  1924 + }else{
  1925 + sin.setXlmc(y.getLinename());
  1926 + }
  1927 +
1916 1928 sin.setClzbh(clzbh);
1917 1929 sin.setJsy(jsy);
1918 1930 sin.setrQ(startDate);
... ... @@ -1994,8 +2006,11 @@ public class FormsServiceImpl implements FormsService {
1994 2006 sin.setEmptMileage(String.valueOf(zksgl));
1995 2007 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1996 2008 sin.setxL(y.getXlbm());
1997   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
1998   - sin.setClzbh(clzbh);
  2009 + if(y.getLinename()==null){
  2010 + sin.setXlmc(y.getXlname());
  2011 + }else{
  2012 + sin.setXlmc(y.getLinename());
  2013 + } sin.setClzbh(clzbh);
1999 2014 sin.setJsy(jsy);
2000 2015 sin.setrQ(startDate);
2001 2016 if(newList.size()>0){
... ... @@ -2019,7 +2034,7 @@ public class FormsServiceImpl implements FormsService {
2019 2034 list.addAll(listD);
2020 2035 }else{
2021 2036 String sql="select r.s_gh,r.s_name, "
2022   - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  2037 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name"
2023 2038 + " from bsth_c_s_sp_info_real r where "
2024 2039 + " r.schedule_date_str = '"+startDate+"'"
2025 2040 + " and r.s_gh !='' and r.s_gh is not null ";
... ... @@ -2033,7 +2048,7 @@ public class FormsServiceImpl implements FormsService {
2033 2048 sql += " and r.fgs_bm='"+fgsdm+"'";
2034 2049 }
2035 2050 sql += " group by r.s_gh,r.s_name,"
2036   - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  2051 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name order by r.xl_bm,r.cl_zbh";
2037 2052  
2038 2053 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
2039 2054 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -2045,6 +2060,7 @@ public class FormsServiceImpl implements FormsService {
2045 2060 sin.setClzbh(arg0.getString("cl_zbh"));
2046 2061 sin.setSgh(arg0.getString("s_gh"));
2047 2062 sin.setsName(arg0.getString("s_name"));
  2063 + sin.setXlmc(arg0.getString("xl_name"));
2048 2064 return sin;
2049 2065 }
2050 2066 });
... ... @@ -2054,6 +2070,7 @@ public class FormsServiceImpl implements FormsService {
2054 2070 String jsy=sin.getSgh();
2055 2071 String line=sin.getxL();
2056 2072 String clzbh=sin.getClzbh();
  2073 + String xl_name=sin.getXlmc();
2057 2074 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
2058 2075 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
2059 2076  
... ... @@ -2086,7 +2103,7 @@ public class FormsServiceImpl implements FormsService {
2086 2103  
2087 2104 sin.setEmptMileage(String.valueOf(zksgl));
2088 2105 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
2089   - sin.setXlmc(BasicData.lineCode2NameMap.get(line));
  2106 + sin.setXlmc(xl_name);
2090 2107 sin.setClzbh(clzbh);
2091 2108 sin.setJsy("");
2092 2109 sin.setjName("");
... ... @@ -2192,8 +2209,11 @@ public class FormsServiceImpl implements FormsService {
2192 2209 sin.setEmptMileage(String.valueOf(zksgl));
2193 2210 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
2194 2211 sin.setxL(y.getXlbm());
2195   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
2196   - sin.setClzbh(clzbh);
  2212 + if(y.getLinename()==null){
  2213 + sin.setXlmc(y.getXlname());
  2214 + }else{
  2215 + sin.setXlmc(y.getLinename());
  2216 + } sin.setClzbh(clzbh);
2197 2217 sin.setJsy(jsy);
2198 2218 sin.setrQ(startDate);
2199 2219 if(newList.size()>0){
... ... @@ -2274,7 +2294,11 @@ public class FormsServiceImpl implements FormsService {
2274 2294 sin.setEmptMileage(String.valueOf(zksgl));
2275 2295 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
2276 2296 sin.setxL(y.getXlbm());
2277   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
  2297 + if(y.getLinename()==null){
  2298 + sin.setXlmc(y.getXlname());
  2299 + }else{
  2300 + sin.setXlmc(y.getLinename());
  2301 + }
2278 2302 sin.setClzbh(clzbh);
2279 2303 sin.setJsy(jsy);
2280 2304 sin.setrQ(startDate);
... ... @@ -2299,7 +2323,7 @@ public class FormsServiceImpl implements FormsService {
2299 2323 list.addAll(listD);
2300 2324 }else{
2301 2325 String sql="select r.s_gh,r.s_name, "
2302   - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  2326 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name"
2303 2327 + " from bsth_c_s_sp_info_real r where "
2304 2328 + " r.schedule_date_str = '"+startDate+"'"
2305 2329 + " and r.s_gh !='' and r.s_gh is not null ";
... ... @@ -2313,7 +2337,7 @@ public class FormsServiceImpl implements FormsService {
2313 2337 sql += " and r.fgs_bm='"+fgsdm+"'";
2314 2338 }
2315 2339 sql += " group by r.s_gh,r.s_name,"
2316   - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  2340 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh";
2317 2341  
2318 2342 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
2319 2343 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -2325,6 +2349,7 @@ public class FormsServiceImpl implements FormsService {
2325 2349 sin.setClzbh(arg0.getString("cl_zbh"));
2326 2350 sin.setSgh(arg0.getString("s_gh"));
2327 2351 sin.setsName(arg0.getString("s_name"));
  2352 + sin.setXlmc(arg0.getString("xl_name"));
2328 2353 return sin;
2329 2354 }
2330 2355 });
... ... @@ -2334,6 +2359,7 @@ public class FormsServiceImpl implements FormsService {
2334 2359 String jsy=sin.getSgh();
2335 2360 String line=sin.getxL();
2336 2361 String clzbh=sin.getClzbh();
  2362 + String xl_name=sin.getXlmc();
2337 2363 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
2338 2364 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
2339 2365  
... ... @@ -2367,7 +2393,7 @@ public class FormsServiceImpl implements FormsService {
2367 2393  
2368 2394 sin.setEmptMileage(String.valueOf(zksgl));
2369 2395 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
2370   - sin.setXlmc(BasicData.lineCode2NameMap.get(line));
  2396 + sin.setXlmc(xl_name);
2371 2397 sin.setClzbh(clzbh);
2372 2398 sin.setJsy("");
2373 2399 sin.setjName("");
... ...
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
... ... @@ -376,7 +376,7 @@ public class GeoDataServiceImpl implements GeoDataService {
376 376 lVersion.setLineCode(lineCode);
377 377  
378 378 //如果有待启用的版本,设置为历史版本
379   - jdbcTemplate.update("update bsth_c_line_versions set `status`=0, start_date=null,end_date=null where line_code='"+lineCode+"' and `status`=2");
  379 + jdbcTemplate.update("update bsth_c_line_versions set `status`=2, start_date=null,end_date=null where line_code='"+lineCode+"' and `status`=0");
380 380  
381 381 //入库线路版本
382 382 jdbcTemplate.update("insert into bsth_c_line_versions(name, line, line_code, versions, start_date, create_date, update_date, remark,status, isupdate) " +
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -400,7 +400,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
400 400 sql += " and cl.line_code = '"+line+"'";
401 401 if(ttId.length() != 0)
402 402 sql += " and td.ttinfo = '"+ttId+"'";
403   - sql += " group by td.lp";
  403 + sql += " group by td.lp, lp.lp_name";
404 404  
405 405 list = jdbcTemplate.query(sql,
406 406 new RowMapper<Map<String, Object>>(){
... ... @@ -505,7 +505,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
505 505 }
506 506  
507 507 String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName()
508   - + "/" + schedule.getFgsName() + "/" + schedule.getFgsBm();
  508 + + "/" + schedule.getFgsBm();
509 509 if(!keyMap.containsKey(key))
510 510 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
511 511 keyMap.get(key).add(schedule);
... ... @@ -618,8 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
618 618 tempMap.put("line", split[1]);
619 619 tempMap.put("qdz", split[2]);
620 620 tempMap.put("company", companyName);
621   - tempMap.put("subCompany", split[3]);
622   - tempMap.put("fgsbm", split[4]);
  621 + tempMap.put("subCompany", subCompanyName);
  622 + tempMap.put("fgsbm", split[3]);
623 623 long jhInterval = 0l;
624 624 long sjInterval = 0l;
625 625 for(Long i : fcsjs)
... ... @@ -677,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
677 677 }else if(statu.equals("0")){
678 678 List<Long> longList = new ArrayList<Long>();
679 679 for(String key : keyList){
680   - long xlBm = Long.valueOf(key.split("/")[4]) * 1000000l + Long.valueOf(key.split("/")[0]);
  680 + long xlBm = Long.valueOf(key.split("/")[3]) * 1000000l + Long.valueOf(key.split("/")[0]);
681 681 if(!longList.contains(xlBm))
682 682 longList.add(xlBm);
683 683 Collections.sort(longList);
... ... @@ -685,7 +685,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
685 685 for(long xlBm : longList){
686 686 for(String key : keyList){
687 687 String[] split = key.split("/");
688   - long kl = Long.valueOf(split[4]) * 1000000l + Long.valueOf(split[0]);
  688 + long kl = Long.valueOf(split[3]) * 1000000l + Long.valueOf(split[0]);
689 689 if(kl == xlBm){
690 690 Map<String, Object> tempMap = new HashMap<String, Object>();
691 691 List<Long> fcsjs = new ArrayList<Long>();
... ... @@ -712,8 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
712 712 tempMap.put("line", split[1]);
713 713 tempMap.put("qdz", split[2]);
714 714 tempMap.put("company", companyName);
715   - tempMap.put("subCompany", split[3]);
716   - tempMap.put("fgsbm", split[4]);
  715 + tempMap.put("subCompany", subCompanyName);
  716 + tempMap.put("fgsbm", split[3]);
717 717 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
718 718 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
719 719 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3   -import java.sql.PreparedStatement;
4   -import java.sql.SQLException;
5   -import java.text.ParseException;
6   -import java.text.SimpleDateFormat;
7   -import java.util.Date;
8   -import java.util.HashMap;
9   -import java.util.List;
10   -import java.util.Map;
11   -
12   -import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.jdbc.core.BatchPreparedStatementSetter;
14   -import org.springframework.jdbc.core.JdbcTemplate;
15   -import org.springframework.stereotype.Service;
16   -import org.springframework.transaction.annotation.Transactional;
17   -
18 3 import com.alibaba.fastjson.JSON;
19 4 import com.alibaba.fastjson.JSONArray;
20 5 import com.bsth.common.ResponseCode;
... ... @@ -31,6 +16,20 @@ import com.bsth.repository.LsStationRouteRepository;
31 16 import com.bsth.service.LineVersionsService;
32 17 import com.bsth.service.SectionRouteService;
33 18 import com.bsth.service.StationRouteService;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  21 +import org.springframework.jdbc.core.JdbcTemplate;
  22 +import org.springframework.stereotype.Service;
  23 +import org.springframework.transaction.annotation.Transactional;
  24 +
  25 +import java.sql.PreparedStatement;
  26 +import java.sql.SQLException;
  27 +import java.text.ParseException;
  28 +import java.text.SimpleDateFormat;
  29 +import java.util.Date;
  30 +import java.util.HashMap;
  31 +import java.util.List;
  32 +import java.util.Map;
34 33  
35 34 /**
36 35 *
... ... @@ -97,8 +96,10 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
97 96 int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
98 97 new java.sql.Date(endDate.getTime()),versions,status,remark);
99 98 LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions);
100   - upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));
101   - repository.save(upLineVersions);
  99 + if(upLineVersions != null){
  100 + upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));
  101 + repository.save(upLineVersions);
  102 + }
102 103 if (statu==1) {
103 104 resultMap.put("status", ResponseCode.SUCCESS);
104 105 } else {
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3 3 import com.bsth.common.ResponseCode;
4   -import com.bsth.entity.*;
  4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.LsStationRoute;
  6 +import com.bsth.entity.Station;
  7 +import com.bsth.entity.StationRoute;
  8 +import com.bsth.entity.StationRouteCache;
5 9 import com.bsth.entity.search.CustomerSpecs;
6   -import com.bsth.repository.*;
  10 +import com.bsth.repository.LineRepository;
  11 +import com.bsth.repository.LsStationRouteRepository;
  12 +import com.bsth.repository.SectionRouteRepository;
  13 +import com.bsth.repository.StationRepository;
  14 +import com.bsth.repository.StationRouteCacheRepository;
  15 +import com.bsth.repository.StationRouteRepository;
7 16 import com.bsth.service.StationRouteService;
8 17 import com.bsth.util.ExcelUtil;
9 18 import com.bsth.util.FTPClientUtils;
10   -import com.bsth.util.PackTarGZUtils;
11 19 import com.bsth.util.Geo.GeoUtils;
12 20 import com.bsth.util.Geo.Point;
  21 +import com.bsth.util.PackTarGZUtils;
13 22 import com.bsth.util.db.DBUtils_MS;
14 23 import com.google.common.base.Splitter;
15 24 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -18,13 +27,17 @@ import org.springframework.data.domain.Sort.Direction;
18 27 import org.springframework.stereotype.Service;
19 28 import org.springframework.transaction.annotation.Transactional;
20 29  
  30 +import javax.servlet.http.HttpServletResponse;
21 31 import java.io.ByteArrayInputStream;
22 32 import java.io.File;
23 33 import java.io.InputStream;
24 34 import java.text.DecimalFormat;
25   -import java.util.*;
26   -
27   -import javax.servlet.http.HttpServletResponse;
  35 +import java.util.ArrayList;
  36 +import java.util.HashMap;
  37 +import java.util.Iterator;
  38 +import java.util.List;
  39 +import java.util.Map;
  40 +import java.util.Properties;
28 41  
29 42 /**
30 43 *
... ... @@ -93,7 +106,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
93 106 public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) {
94 107 Map<String, Object> resultMap = new HashMap<String, Object>();
95 108 try {
96   - // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  109 + // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
97 110 Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象
98 111 /* 添加表头*/
99 112 List<String> title = new ArrayList<String>();
... ... @@ -113,10 +126,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
113 126 if(strtionList == null){
114 127 logger.info("没有数据导,出用户信息失败!");
115 128 } else {
116   -
  129 +
117 130 for (int i = 0; i < strtionList.size(); i++) {
118 131 StationRoute station = strtionList.get(i);
119   -
  132 +
120 133 List<String> varList = new ArrayList<String>();
121 134 varList.add(station.getLine().getId().toString());
122 135 varList.add(station.getDirections().toString());
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -1372,8 +1372,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1372 1372 // 匹配到了用数据库中的点替换
1373 1373 if (GeoUtils.isPointInCircle(point, circle)) {
1374 1374 map.put("name", s.getStationName().toString());
1375   - map.put("potion_lng", points[0]);
1376   - map.put("potion_lat", points[1]);
  1375 + // 匹配到站点后用这个站点的名字,但是使用gps点作为中心点
  1376 +// map.put("potion_lng", points[0]);
  1377 +// map.put("potion_lat", points[1]);
  1378 + map.put("potion_lng", lon);
  1379 + map.put("potion_lat", lat);
1377 1380 map.put("isHave", "true");
1378 1381 map.put("id", s.getId());
1379 1382 isMatch = true;
... ...
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
... ... @@ -328,7 +328,7 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
328 328 }
329 329  
330 330 String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE "
331   - + " to_days(rq) = to_days('"+rq+"') AND ssgsdm = '"+gsdm+"' AND "
  331 + + " rq = '"+rq+"' AND ssgsdm = '"+gsdm+"' AND "
332 332 + " fgsdm = '"+fgsdm+"' GROUP BY nbbm";
333 333  
334 334 List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb,
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -197,6 +197,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
197 197 t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
198 198 t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
199 199 t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  200 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
200 201 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
201 202 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
202 203 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
... ... @@ -464,6 +465,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
464 465 t.setZlc(map.get("totalKilometers") == null ? 0.0
465 466 : Double.parseDouble(map.get("totalKilometers").toString()));
466 467 t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  468 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
467 469 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
468 470 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
469 471 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
... ... @@ -660,82 +662,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
660 662 @Override
661 663 public List<Dlb> listDlb(Map<String, Object> map) {
662 664 // TODO Auto-generated method stub
663   - List<Dlb> listDlb=new ArrayList<Dlb>();
664   - List<String> stringList=new ArrayList<String>();
665   - String rq=map.get("rq").toString();
666   - String gsbm=map.get("ssgsdm_like").toString();
667   - String fgsbm=map.get("fgsdm_like").toString();
668   - String xlbm=map.get("xlbm_like").toString().trim();
669   - String nbbm=map.get("nbbm_eq").toString();
670   - String sxtj=map.get("sxtj").toString();
671   -
672   - if(nbbm.trim()!=""){
673   - stringList.add(nbbm);
674   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
675   - }else{
676   - //全部
677   - if(sxtj.equals("0")){
678   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
679   - for (int i = 0; i < objectLists.size(); i++) {
680   - String clbm=objectLists.get(i)[0].toString();
681   - stringList.add(clbm);
682   - }
683   - if(stringList.size()>0){
684   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
685   - }
686   - }else{
687   - List<Object[]> objectLists;
688   - if(sxtj.equals("3")){
689   - //有加油没里程
690   - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  665 + List<Dlb> listDlb = new ArrayList<Dlb>();
  666 + List<String> stringList = new ArrayList<String>();
  667 + String rq = map.get("rq").toString();
  668 + String gsbm = map.get("ssgsdm_like").toString();
  669 + String fgsbm = map.get("fgsdm_like").toString();
  670 + String xlbm = map.get("xlbm_like").toString().trim();
  671 + String nbbm = map.get("nbbm_eq").toString();
  672 + String sxtj = map.get("sxtj").toString();
  673 + String type = map.get("type").toString();
  674 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  675 + try {
  676 + if (nbbm.trim() != "") {
  677 + stringList.add(nbbm);
  678 + if (type.equals("1"))
  679 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  680 + else
  681 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  682 +
  683 + } else {
  684 + // 全部
  685 + if (sxtj.equals("0")) {
  686 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
691 687 for (int i = 0; i < objectLists.size(); i++) {
692   - String clbm=objectLists.get(i)[0].toString();
693   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
694   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
695   - if(jzl>0 && zlc<=0){
696   - stringList.add(clbm);
697   - }
698   -
  688 + String clbm = objectLists.get(i)[0].toString();
  689 + stringList.add(clbm);
699 690 }
700   -
701   - }else if(sxtj.equals("4")){
702   - //有里程没加油
703   - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
704   - for (int i = 0; i < objectLists.size(); i++) {
705   - String clbm=objectLists.get(i)[0].toString();
706   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
707   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
708   - if(zlc>0 && jzl<=0){
709   - stringList.add(clbm);
710   - }
711   -
  691 + if (stringList.size() > 0) {
  692 + if (type.equals("1"))
  693 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  694 + else
  695 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
712 696 }
713   - }else{
714   - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
715   - for (int i = 0; i < objectLists.size(); i++) {
716   - String clbm=objectLists.get(i)[0].toString();
717   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
718   - //一车一单
719   - if(sxtj.equals("1")){
720   - if(cs==1){
  697 + } else {
  698 + List<Object[]> objectLists;
  699 + if (sxtj.equals("3")) {
  700 + // 有加油没里程
  701 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  702 + for (int i = 0; i < objectLists.size(); i++) {
  703 + String clbm = objectLists.get(i)[0].toString();
  704 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  705 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  706 + if (jzl > 0 && zlc <= 0) {
721 707 stringList.add(clbm);
722 708 }
723   - }
724   - //一车多单
725   - if(sxtj.equals("2")){
726   - if(cs>1){
  709 +
  710 + }
  711 +
  712 + } else if (sxtj.equals("4")) {
  713 + // 有里程没加油
  714 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  715 + for (int i = 0; i < objectLists.size(); i++) {
  716 + String clbm = objectLists.get(i)[0].toString();
  717 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  718 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  719 + if (zlc > 0 && jzl <= 0) {
727 720 stringList.add(clbm);
728 721 }
  722 +
  723 + }
  724 + } else {
  725 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  726 + for (int i = 0; i < objectLists.size(); i++) {
  727 + String clbm = objectLists.get(i)[0].toString();
  728 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  729 + // 一车一单
  730 + if (sxtj.equals("1")) {
  731 + if (cs == 1) {
  732 + stringList.add(clbm);
  733 + }
  734 + }
  735 + // 一车多单
  736 + if (sxtj.equals("2")) {
  737 + if (cs > 1) {
  738 + stringList.add(clbm);
  739 + }
  740 + }
729 741 }
730 742 }
731   - }
732   -
733   - if(stringList.size()>0){
734   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  743 +
  744 + if (stringList.size() > 0) {
  745 + if (type.equals("1"))
  746 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  747 + else
  748 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  749 + }
735 750 }
736 751 }
  752 + } catch (ParseException e) {
  753 + // TODO Auto-generated catch block
  754 + e.printStackTrace();
737 755 }
738   -
739 756 return listDlb;
740 757 }
741 758  
... ... @@ -749,86 +766,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
749 766 String xlbm = map.get("xlbm_like").toString().trim();
750 767 String nbbm = map.get("nbbm_eq").toString();
751 768 String sxtj = map.get("sxtj").toString();
752   - if (nbbm.trim() != "") {
753   - stringList.add(nbbm);
754   - } else {
755   - if (!sxtj.equals("0")) {
756   - List<Object[]> objectLists;
757   - if (sxtj.equals("3")) {
758   - // 有加油没里程
759   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
760   - for (int i = 0; i < objectLists.size(); i++) {
761   - String clbm = objectLists.get(i)[0].toString();
762   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
763   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
764   - if (jzl > 0 && zlc <= 0) {
765   - stringList.add(clbm);
766   - }
767   -
768   - }
  769 + String type = map.get("type").toString();
  770 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  771 + List<Object[]> sumYlbList = new ArrayList<Object[]>();
  772 + try {
  773 + if (nbbm.trim() != "") {
  774 + stringList.add(nbbm);
  775 + } else {
  776 + if (!sxtj.equals("0")) {
  777 + List<Object[]> objectLists;
  778 + if (sxtj.equals("3")) {
  779 + // 有加油没里程
  780 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  781 + for (int i = 0; i < objectLists.size(); i++) {
  782 + String clbm = objectLists.get(i)[0].toString();
  783 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  784 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  785 + if (jzl > 0 && zlc <= 0) {
  786 + stringList.add(clbm);
  787 + }
769 788  
770   - } else if (sxtj.equals("4")) {
771   - // 有里程没加油
772   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
773   - for (int i = 0; i < objectLists.size(); i++) {
774   - String clbm = objectLists.get(i)[0].toString();
775   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
776   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
777   - if (zlc > 0 && jzl <= 0) {
778   - stringList.add(clbm);
779 789 }
780 790  
781   - }
782   - } else {
783   - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
784   - for (int i = 0; i < objectLists.size(); i++) {
785   - String clbm = objectLists.get(i)[0].toString();
786   - int cs = Integer.parseInt(objectLists.get(i)[1].toString());
787   - // 一车一单
788   -
789   - if (sxtj.equals("1")) {
790   - if (cs == 1) {
  791 + } else if (sxtj.equals("4")) {
  792 + // 有里程没加油
  793 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  794 + for (int i = 0; i < objectLists.size(); i++) {
  795 + String clbm = objectLists.get(i)[0].toString();
  796 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  797 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  798 + if (zlc > 0 && jzl <= 0) {
791 799 stringList.add(clbm);
792 800 }
  801 +
793 802 }
794   - // 一车多单
795   - if (sxtj.equals("2")) {
796   - if (cs > 1) {
797   - stringList.add(clbm);
  803 + } else {
  804 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  805 + for (int i = 0; i < objectLists.size(); i++) {
  806 + String clbm = objectLists.get(i)[0].toString();
  807 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  808 + // 一车一单
  809 +
  810 + if (sxtj.equals("1")) {
  811 + if (cs == 1) {
  812 + stringList.add(clbm);
  813 + }
  814 + }
  815 + // 一车多单
  816 + if (sxtj.equals("2")) {
  817 + if (cs > 1) {
  818 + stringList.add(clbm);
  819 + }
798 820 }
799 821 }
800 822 }
801 823 }
802 824 }
803   - }
804   - List<Object[]> sumYlbList = new ArrayList<Object[]>();
805 825 if (sxtj.equals("0")) {
806 826 sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
807 827 } else {
808 828 if (stringList.size() > 0) {
809   -
  829 +
810 830 // String strings[]=new String[stringList.size()];
811 831 // for(int i=0;i<stringList.size();i++){
812 832 // strings[i]=stringList.get(i);
813 833 // }
814   - sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
815   - }
816   -// else {
817   -// sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
818   -// }
819   - }
820   - Double jzl = 0.0, yh = 0.0, sh = 0.0;
821   - for (int i = 0; i < sumYlbList.size(); i++) {
822   - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
823   - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
824   - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  834 + if (type.equals("1"))
  835 + sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
  836 + else
  837 + sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  838 +
  839 + }
  840 + // else {
  841 + // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  842 + // }
825 843 }
826   -
827   - Map<String, Object> sumMap = new HashMap<String, Object>();
828   - sumMap.put("jzl", jzl);
829   - sumMap.put("yh", yh);
830   - sumMap.put("sh", sh);
831   - return sumMap;
  844 + } catch (ParseException e) {
  845 + // TODO Auto-generated catch block
  846 + e.printStackTrace();
  847 + }
  848 + Double jzl = 0.0, yh = 0.0, sh = 0.0;
  849 + for (int i = 0; i < sumYlbList.size(); i++) {
  850 + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
  851 + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
  852 + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  853 + }
  854 +
  855 + Map<String, Object> sumMap = new HashMap<String, Object>();
  856 + sumMap.put("jzl", jzl);
  857 + sumMap.put("yh", yh);
  858 + sumMap.put("sh", sh);
  859 + return sumMap;
832 860 }
833 861  
834 862  
... ... @@ -884,7 +912,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
884 912 String px) {
885 913 // TODO Auto-generated method stub
886 914 String sql="SELECT * FROM bsth_c_dlb "
887   - + " where to_days('"+rq+"')=to_days(rq) and ssgsdm like '%"+gsdm+"%' "
  915 + + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' "
888 916 + " and fgsdm like '%"+fgsdm+"%'";
889 917 if(xlbm.equals("")){
890 918 sql+= " and xlbm like '%"+xlbm+"%' ";
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -194,6 +194,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
194 194 t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
195 195 t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString()));
196 196 t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  197 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
197 198 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
198 199 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
199 200 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
... ... @@ -492,6 +493,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
492 493 t.setZlc(map.get("totalKilometers") == null ? 0.0
493 494 : Double.parseDouble(map.get("totalKilometers").toString()));
494 495 t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  496 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
495 497 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
496 498 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
497 499 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
... ... @@ -1106,6 +1108,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1106 1108 String xlbm=map.get("xlbm_like").toString().trim();
1107 1109 String nbbm=map.get("nbbm_eq").toString();
1108 1110 String sxtj=map.get("sxtj").toString();
  1111 + String type=map.get("type").toString();
  1112 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1113 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  1114 + try {
1109 1115 if(nbbm.trim()!=""){
1110 1116 stringList.add(nbbm);
1111 1117 }else{
... ... @@ -1158,7 +1164,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1158 1164 }
1159 1165 }
1160 1166 }
1161   - List<Object[]> sumYlbList=new ArrayList<Object[]>();
1162 1167 if(sxtj.equals("0")){
1163 1168 sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
1164 1169 }else{
... ... @@ -1168,14 +1173,20 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1168 1173 // for(int i=0;i<stringList.size();i++){
1169 1174 // strings[i]=stringList.get(i);
1170 1175 // }
1171   - sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1176 + if (type.equals("1"))
  1177 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1178 + else
  1179 + sumYlbList=repository.sumYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1172 1180 }
1173 1181 // else{
1174 1182 // sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
1175 1183 // }
1176 1184  
1177 1185 }
1178   -
  1186 + } catch (ParseException e) {
  1187 + // TODO Auto-generated catch block
  1188 + e.printStackTrace();
  1189 + }
1179 1190 Double jzl=0.0,yh=0.0,sh=0.0;
1180 1191 for (int i = 0; i < sumYlbList.size(); i++) {
1181 1192 jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
... ... @@ -1187,6 +1198,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1187 1198 sumMap.put("jzl", jzl);
1188 1199 sumMap.put("yh", yh);
1189 1200 sumMap.put("sh", sh);
  1201 +
1190 1202 // String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
1191 1203 // + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
1192 1204 // + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
... ... @@ -1204,96 +1216,118 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1204 1216 @Override
1205 1217 public List<Ylb> listYlb(Map<String, Object> map) {
1206 1218 // TODO Auto-generated method stub
1207   - List<Ylb> listYlb=new ArrayList<Ylb>();
1208   - List<String> stringList=new ArrayList<String>();
1209   - String rq=map.get("rq").toString();
1210   - String gsbm=map.get("ssgsdm_like").toString();
1211   - String fgsbm=map.get("fgsdm_like").toString();
1212   - String xlbm=map.get("xlbm_like").toString().trim();
1213   - String nbbm=map.get("nbbm_eq").toString();
1214   - String sxtj=map.get("sxtj").toString();
1215   - if(nbbm.trim()!=""){
1216   - stringList.add(nbbm);
1217   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1218   - if(objectLists.size()>0){
1219   - int cs=Integer.parseInt(objectLists.get(0)[1].toString());
1220   - if(sxtj.equals("1")){
1221   - if(cs==1){
1222   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1223   - }
1224   - }else if(sxtj.equals("2")){
1225   - if(cs>1){
1226   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1219 + List<Ylb> listYlb = new ArrayList<Ylb>();
  1220 + try {
  1221 + List<String> stringList = new ArrayList<String>();
  1222 + String rq = map.get("rq").toString();
  1223 + String gsbm = map.get("ssgsdm_like").toString();
  1224 + String fgsbm = map.get("fgsdm_like").toString();
  1225 + String xlbm = map.get("xlbm_like").toString().trim();
  1226 + String nbbm = map.get("nbbm_eq").toString();
  1227 + String sxtj = map.get("sxtj").toString();
  1228 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1229 + String type = map.get("type").toString();
  1230 + if (nbbm.trim() != "") {
  1231 + stringList.add(nbbm);
  1232 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1233 + if (objectLists.size() > 0) {
  1234 + int cs = Integer.parseInt(objectLists.get(0)[1].toString());
  1235 + if (sxtj.equals("1")) {
  1236 + if (cs == 1) {
  1237 + if (type.equals("1"))
  1238 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1239 + else
  1240 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1241 +
  1242 + }
  1243 + } else if (sxtj.equals("2")) {
  1244 + if (cs > 1) {
  1245 + if (type.equals("1"))
  1246 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1247 + else
  1248 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1249 + }
  1250 + } else {
  1251 + if (type.equals("1"))
  1252 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1253 + else
  1254 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1227 1255 }
1228   - }else{
1229   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1230   - }
1231   - }
1232   -
1233   - }else{
1234   - //全部
1235   - if(sxtj.equals("0")){
1236   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1237   - for (int i = 0; i < objectLists.size(); i++) {
1238   - String clbm=objectLists.get(i)[0].toString();
1239   - stringList.add(clbm);
1240   - }
1241   - if(stringList.size()>0){
1242   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1243 1256 }
1244   - }else{
1245   - List<Object[]> objectLists;
1246   - if(sxtj.equals("3")){
1247   - //有加油没里程
1248   - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1257 +
  1258 + } else {
  1259 + // 全部
  1260 + if (sxtj.equals("0")) {
  1261 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
1249 1262 for (int i = 0; i < objectLists.size(); i++) {
1250   - String clbm=objectLists.get(i)[0].toString();
1251   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
1252   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
1253   - if(jzl>0 && zlc<=0){
1254   - stringList.add(clbm);
1255   - }
1256   -
  1263 + String clbm = objectLists.get(i)[0].toString();
  1264 + stringList.add(clbm);
1257 1265 }
1258   -
1259   - }else if(sxtj.equals("4")){
1260   - //有里程没加油
1261   - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
1262   - for (int i = 0; i < objectLists.size(); i++) {
1263   - String clbm=objectLists.get(i)[0].toString();
1264   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
1265   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
1266   - if(zlc>0 && jzl<=0){
1267   - stringList.add(clbm);
1268   - }
1269   -
  1266 + if (stringList.size() > 0) {
  1267 + if (type.equals("1"))
  1268 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1269 + else
  1270 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1270 1271 }
1271   - }else{
1272   - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1273   - for (int i = 0; i < objectLists.size(); i++) {
1274   - String clbm=objectLists.get(i)[0].toString();
1275   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
1276   - //一车一单
1277   - if(sxtj.equals("1")){
1278   - if(cs==1){
  1272 + } else {
  1273 + List<Object[]> objectLists;
  1274 + if (sxtj.equals("3")) {
  1275 + // 有加油没里程
  1276 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1277 + for (int i = 0; i < objectLists.size(); i++) {
  1278 + String clbm = objectLists.get(i)[0].toString();
  1279 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1280 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1281 + if (jzl > 0 && zlc <= 0) {
1279 1282 stringList.add(clbm);
1280 1283 }
1281   - }
1282   - //一车多单
1283   - if(sxtj.equals("2")){
1284   - if(cs>1){
  1284 +
  1285 + }
  1286 +
  1287 + } else if (sxtj.equals("4")) {
  1288 + // 有里程没加油
  1289 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1290 + for (int i = 0; i < objectLists.size(); i++) {
  1291 + String clbm = objectLists.get(i)[0].toString();
  1292 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1293 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1294 + if (zlc > 0 && jzl <= 0) {
1285 1295 stringList.add(clbm);
1286 1296 }
  1297 +
  1298 + }
  1299 + } else {
  1300 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1301 + for (int i = 0; i < objectLists.size(); i++) {
  1302 + String clbm = objectLists.get(i)[0].toString();
  1303 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  1304 + // 一车一单
  1305 + if (sxtj.equals("1")) {
  1306 + if (cs == 1) {
  1307 + stringList.add(clbm);
  1308 + }
  1309 + }
  1310 + // 一车多单
  1311 + if (sxtj.equals("2")) {
  1312 + if (cs > 1) {
  1313 + stringList.add(clbm);
  1314 + }
  1315 + }
1287 1316 }
1288 1317 }
1289   - }
1290   -
1291   - if(stringList.size()>0){
1292   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1318 +
  1319 + if (stringList.size() > 0) {
  1320 + if (type.equals("1"))
  1321 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1322 + else
  1323 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1324 + }
1293 1325 }
1294 1326 }
  1327 + } catch (ParseException e) {
  1328 + // TODO Auto-generated catch block
  1329 + e.printStackTrace();
1295 1330 }
1296   -
1297 1331 return listYlb;
1298 1332 }
1299 1333  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -611,111 +611,119 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
611 611 * 临加班次
612 612 */
613 613 @Override
614   - public Map<String, Object> save(ScheduleRealInfo t) {
  614 + public Map<String, Object> save(ScheduleRealInfo sch) {
615 615 Map<String, Object> rs = new HashMap<>();
616 616 try {
617   - if (!carExist(t.getGsBm(), t.getClZbh())) {
618   - rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!");
619   - rs.put("status", ResponseCode.ERROR);
620   - return rs;
  617 + String clZbh = sch.getClZbh();
  618 + if (StringUtils.isNotEmpty(clZbh)) {
  619 + //检测
  620 + if (!carExist(sch.getGsBm(), clZbh)) {
  621 + rs.put("status", ResponseCode.ERROR);
  622 + rs.put("msg", "车辆 " + clZbh + " 不存在!");
  623 + return rs;
  624 + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) {
  625 + rs.put("status", ResponseCode.ERROR);
  626 + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆");
  627 + return rs;
  628 + }
621 629 }
622 630  
623 631 SysUser user = SecurityUtils.getCurrentUser();
624   - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
  632 + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm());
625 633  
626 634 SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
627 635  
628   - if (StringUtils.isEmpty(t.getjGh())) {
  636 + if (StringUtils.isEmpty(sch.getjGh())) {
629 637 rs.put("status", ResponseCode.ERROR);
630 638 rs.put("msg", "驾驶员工号不能为空!");
631 639 return rs;
632 640 }
633 641 //截取驾驶员工号
634   - if (t.getjGh().indexOf("-") != -1) {
635   - t.setjGh(t.getjGh().split("-")[1]);
  642 + if (sch.getjGh().indexOf("-") != -1) {
  643 + sch.setjGh(sch.getjGh().split("-")[1]);
636 644 }
637 645 //检查驾驶员工号
638   - String jName = getPersonName(t.getGsBm(), t.getjGh());
  646 + String jName = getPersonName(sch.getGsBm(), sch.getjGh());
639 647 if (StringUtils.isEmpty(jName)) {
640   - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员");
  648 + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员");
641 649 rs.put("status", ResponseCode.ERROR);
642 650 return rs;
643   - } else if (StringUtils.isEmpty(t.getjName())) {
644   - t.setjName(jName);//补上驾驶员名称
  651 + } else if (StringUtils.isEmpty(sch.getjName())) {
  652 + sch.setjName(jName);//补上驾驶员名称
645 653 }
646 654  
647 655 //有售票员
648   - if (StringUtils.isNotEmpty(t.getsGh())) {
649   - String sName = getPersonName(t.getGsBm(), t.getsGh());
  656 + if (StringUtils.isNotEmpty(sch.getsGh())) {
  657 + String sName = getPersonName(sch.getGsBm(), sch.getsGh());
650 658 if (StringUtils.isEmpty(sName)) {
651   - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员");
  659 + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员");
652 660 rs.put("status", ResponseCode.ERROR);
653 661 return rs;
654   - } else if (StringUtils.isEmpty(t.getsName())) {
655   - t.setsName(sName);//补上售票员名称
  662 + } else if (StringUtils.isEmpty(sch.getsName())) {
  663 + sch.setsName(sName);//补上售票员名称
656 664 }
657 665 } else {
658   - t.setsGh("");
659   - t.setsName("");
  666 + sch.setsGh("");
  667 + sch.setsName("");
660 668 }
661 669  
662 670 //公司 和 分公司名称
663   - t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm()));
664   - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm() + "_" + t.getGsBm()));
665   - t.setCreateDate(new Date());
666   - t.setScheduleDateStr(schDate);
667   - t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
668   - t.setRealExecDate(schDate);
669   -
670   - t.setCreateBy(user);
671   - t.setSflj(true);
672   - t.setLate(false);
673   - t.setDfsj(t.getFcsj());
674   - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
675   - t.setJhlcOrig(t.getJhlc());
676   - t.setCreateDate(new Date());
677   - t.setUpdateDate(new Date());
678   - t.setSpId(-1L);
  671 + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm()));
  672 + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm()));
  673 + sch.setCreateDate(new Date());
  674 + sch.setScheduleDateStr(schDate);
  675 + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate));
  676 + sch.setRealExecDate(schDate);
  677 +
  678 + sch.setCreateBy(user);
  679 + sch.setSflj(true);
  680 + sch.setLate(false);
  681 + sch.setDfsj(sch.getFcsj());
  682 + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime());
  683 + sch.setJhlcOrig(sch.getJhlc());
  684 + sch.setCreateDate(new Date());
  685 + sch.setUpdateDate(new Date());
  686 + sch.setSpId(-1L);
679 687 //起终点名称
680   - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
681   - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
682   - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix));
  688 + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  689 + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix));
  690 + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix));
683 691  
684 692 //计算班次实际执行时间
685   - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t);
  693 + schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch);
686 694  
687 695 //处理计达跨24点
688   - LineConfig conf = lineConfigData.get(t.getXlBm());
689   - if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) {
690   - t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24));
  696 + LineConfig conf = lineConfigData.get(sch.getXlBm());
  697 + if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) {
  698 + sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24));
691 699 }
692 700  
693 701 //班次历时
694   - t.setBcsj((int) ((t.getZdsjT() - t.getDfsjT()) / 1000 / 60));
695   - if (t.getZdsjT() < t.getFcsjT()) {
  702 + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60));
  703 + if (sch.getZdsjT() < sch.getFcsjT()) {
696 704 rs.put("status", ResponseCode.ERROR);
697 705 rs.put("msg", "起终点时间异常!");
698 706 return rs;
699 707 }
700 708  
701   - t.setId(dayOfSchedule.getId());
  709 + sch.setId(dayOfSchedule.getId());
702 710 //实时入库
703   - super.save(t);
  711 + super.save(sch);
704 712  
705 713 // 加入缓存
706   - dayOfSchedule.put(t);
  714 + dayOfSchedule.put(sch);
707 715  
708 716 //更新起点应到时间
709   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t);
  717 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch);
710 718  
711 719 //重新计算车辆当前执行班次
712   - dayOfSchedule.reCalcExecPlan(t.getClZbh());
  720 + dayOfSchedule.reCalcExecPlan(sch.getClZbh());
713 721  
714 722 //记录站到场历时数据
715   - Station2ParkBuffer.put(t);
  723 + Station2ParkBuffer.put(sch);
716 724  
717 725 rs.put("ts", ts);
718   - rs.put("t", t);
  726 + rs.put("t", sch);
719 727 } catch (Exception e) {
720 728 logger.error("", e);
721 729 rs.put("status", ResponseCode.ERROR);
... ... @@ -3257,6 +3265,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3257 3265 * 对计划发车时间相同的班次进行排序 out最前 in最后
3258 3266 */
3259 3267 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3268 + SimpleDateFormat sdfnyr =new SimpleDateFormat("yyyy-MM-dd");
3260 3269 String minfcsj = "02:00";
3261 3270 List<Line> lineList = lineRepository.findLineByCode(line);
3262 3271 if (lineList.size() > 0) {
... ... @@ -3285,9 +3294,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3285 3294 Calendar calendar = new GregorianCalendar();
3286 3295 calendar.setTime(s.getScheduleDate());
3287 3296 calendar.add(calendar.DATE, 1);
3288   - s.setScheduleDate(calendar.getTime());
  3297 + Date date_sch= calendar.getTime();
3289 3298 try {
3290   - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime();
  3299 + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime();
3291 3300 } catch (ParseException e) {
3292 3301 // TODO Auto-generated catch block
3293 3302 e.printStackTrace();
... ... @@ -3299,15 +3308,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3299 3308 } catch (ParseException e) {
3300 3309 // TODO Auto-generated catch block
3301 3310 e.printStackTrace();
3302   - }
3303   - ;
  3311 + };
3304 3312 }
3305 3313 s.setFcsjT(fscjT);
3306 3314 }
3307 3315 List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>();
3308 3316 listInfo2.addAll(listInfo);
3309 3317 Collections.sort(listInfo, new compareLpFcsjType());
3310   - System.out.println(listInfo);
3311 3318 Collections.sort(listInfo2,new compareDirLpFcsjType());
3312 3319 for (int i = 0; i < listInfo.size(); i++) {
3313 3320 ScheduleRealInfo t = listInfo.get(i);
... ... @@ -3446,6 +3453,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3446 3453 * 对计划发车时间相同的班次进行排序 out最前 in最后
3447 3454 */
3448 3455 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3456 + SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd");
  3457 +
3449 3458 String minfcsj = "02:00";
3450 3459 List<Line> lineList = lineRepository.findLineByCode(line);
3451 3460 if (lineList.size() > 0) {
... ... @@ -3474,9 +3483,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3474 3483 Calendar calendar = new GregorianCalendar();
3475 3484 calendar.setTime(s.getScheduleDate());
3476 3485 calendar.add(calendar.DATE, 1);
3477   - s.setScheduleDate(calendar.getTime());
  3486 + Date date_sch=calendar.getTime();
3478 3487 try {
3479   - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime();
  3488 + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime();
3480 3489 } catch (ParseException e) {
3481 3490 // TODO Auto-generated catch block
3482 3491 e.printStackTrace();
... ... @@ -3765,6 +3774,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3765 3774 boolean fage = true;
3766 3775 String company = "";
3767 3776 String bCompany = "";
  3777 + String lineName="";
3768 3778 List<ScheduleRealInfo> listS = new ArrayList<ScheduleRealInfo>();
3769 3779 for (ScheduleRealInfo scheduleRealInfo : lists) {
3770 3780 if (scheduleRealInfo.getjGh().equals(jName)
... ... @@ -3775,6 +3785,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3775 3785 //根据线路代码获取公司
3776 3786 company = scheduleRealInfo.getGsBm();
3777 3787 bCompany = scheduleRealInfo.getFgsBm();
  3788 + lineName = scheduleRealInfo.getXlName();
3778 3789 fage = false;
3779 3790 }
3780 3791 Set<ChildTaskPlan> cts = scheduleRealInfo.getcTasks();
... ... @@ -3789,6 +3800,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3789 3800 }
3790 3801 yesterdayDataList.get(x).put("company", company);
3791 3802 yesterdayDataList.get(x).put("bCompany", bCompany);
  3803 + yesterdayDataList.get(x).put("lineName", lineName);
3792 3804 Double ljgl = culateMieageService.culateLjgl(listS);
3793 3805 Double sjgl = culateMieageService.culateSjgl(listS);
3794 3806 Double ksgl = culateMieageService.culateKsgl(listS);
... ... @@ -4964,6 +4976,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4964 4976 String state = map.get("state").toString();
4965 4977 String type = map.get("type").toString();
4966 4978 String genre =map.get("genre").toString();
  4979 + String df="";
  4980 + if(map.get("df")!=null){
  4981 + df=map.get("df").toString();
  4982 + }
  4983 +
4967 4984 List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
4968 4985 List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
4969 4986 List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
... ... @@ -5096,9 +5113,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5096 5113 Long zdsj_ = Long.parseLong(zdsj_s[0]) * 60 + Long.parseLong(zdsj_s[1]);
5097 5114 Long zdsjActual_ = Long.parseLong(zdsjActual_s[0]) * 60 + Long.parseLong(zdsjActual_s[1]);
5098 5115 if ((zdsj_ - zdsjActual_) > 0) {
5099   - zdsjk = String.valueOf(zdsj_ - zdsjActual_);
  5116 + if(zdsj_ - zdsjActual_>1200){
  5117 + zdsjm=String.valueOf(1440-(zdsj_-zdsjActual_));
  5118 + }else{
  5119 + zdsjk = String.valueOf(zdsj_ - zdsjActual_);
  5120 + }
5100 5121 } else {
5101   - zdsjm = String.valueOf(zdsjActual_ - zdsj_);
  5122 + if(zdsjActual_ - zdsj_>1200){
  5123 + zdsjk =String.valueOf(1440-(zdsjActual_ - zdsj_));
  5124 + }else{
  5125 + zdsjm = String.valueOf(zdsjActual_ - zdsj_);
  5126 + }
5102 5127 }
5103 5128 }
5104 5129 tempMap.put("zdsjk" + x, zdsjk);
... ... @@ -5117,17 +5142,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5117 5142 tempMap.put("fcsjActual" + x, fcsjActuralstr);
5118 5143 String fcsjk = "";
5119 5144 String fcsjm = "";
  5145 + String dfsjk ="";
  5146 + String dfsjm="";
5120 5147 if (!fcsjActural.equals("")) {
5121   - String[] zdsj_s = schedule.getFcsj().split(":");
  5148 + String[] fcsj_s = schedule.getFcsj().split(":");
5122 5149 String[] fcsjActural_s = fcsjActural.split(":");
5123   - Long zdsj_ = Long.parseLong(zdsj_s[0]) * 60 + Long.parseLong(zdsj_s[1]);
  5150 + Long fcsj_ = Long.parseLong(fcsj_s[0]) * 60 + Long.parseLong(fcsj_s[1]);
5124 5151 Long fcsjActural_ = Long.parseLong(fcsjActural_s[0]) * 60 + Long.parseLong(fcsjActural_s[1]);
5125   - if ((zdsj_ - fcsjActural_) > 0) {
5126   - fcsjk = String.valueOf(zdsj_ - fcsjActural_);
  5152 + if ((fcsj_ - fcsjActural_) > 0) {
  5153 + if(fcsj_ - fcsjActural_>1200){
  5154 + fcsjm=String.valueOf(1440-(fcsj_ - fcsjActural_));
  5155 + }else{
  5156 + fcsjk = String.valueOf(fcsj_ - fcsjActural_);
  5157 + }
  5158 + } else {
  5159 + if(fcsjActural_ - fcsj_>1200){
  5160 + fcsjk =String.valueOf(1440-(fcsjActural_ - fcsj_));
  5161 + }
  5162 + else{
  5163 + fcsjm = String.valueOf(fcsjActural_ - fcsj_);
  5164 + }
  5165 + }
  5166 + String[] dfsj_s =schedule.getDfsj().split(":");
  5167 + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]);
  5168 + if ((dfsj_ - fcsjActural_) > 0) {
  5169 + if(dfsj_ - fcsjActural_>1200){
  5170 + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_));
  5171 + }else{
  5172 + dfsjk = String.valueOf(dfsj_ - fcsjActural_);
  5173 + }
5127 5174 } else {
5128   - fcsjm = String.valueOf(fcsjActural_ - zdsj_);
  5175 + if(fcsjActural_ - dfsj_>1200){
  5176 + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_));
  5177 + }else{
  5178 + dfsjm = String.valueOf(fcsjActural_ - dfsj_);
  5179 + }
5129 5180 }
5130 5181 }
  5182 + if(df.equals("df")){
  5183 + tempMap.put("dfsj"+x,schedule.getDfsj());
  5184 + tempMap.put("dfsjk" + x, dfsjk);
  5185 + tempMap.put("dfsjm" + x, dfsjm.equals("0")?"":dfsjm);
  5186 + }
5131 5187 tempMap.put("fcsjk" + x, fcsjk);
5132 5188 tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm);
5133 5189 tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : "");
... ... @@ -5146,6 +5202,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5146 5202 tempMap.put("fcsjActual1", "");
5147 5203 tempMap.put("fcsjk1", "");
5148 5204 tempMap.put("fcsjm1", "");
  5205 + if(df.equals("df")){
  5206 + tempMap.put("dfsj1","");
  5207 + tempMap.put("dfsjk1" , "");
  5208 + tempMap.put("dfsjm1" , "");
  5209 + }
5149 5210 tempMap.put("remarks1", "");
5150 5211 }
5151 5212 if (tempMap.get("lpName2") == null) {
... ... @@ -5159,6 +5220,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5159 5220 tempMap.put("fcsjActual2", "");
5160 5221 tempMap.put("fcsjk2", "");
5161 5222 tempMap.put("fcsjm2", "");
  5223 + if(df.equals("df")){
  5224 + tempMap.put("dfsj2","");
  5225 + tempMap.put("dfsjk2" , "");
  5226 + tempMap.put("dfsjm2" , "");
  5227 + }
5162 5228 tempMap.put("remarks2", "");
5163 5229 }
5164 5230 dataList3.add(tempMap);
... ... @@ -5205,6 +5271,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5205 5271 sdfSimple = new SimpleDateFormat("yyyyMM");
5206 5272 sourcePath = path + "mould/scheduleDaily_m.xls";
5207 5273 }
  5274 + if(df.equals("df")){
  5275 + sourcePath =path + "mould/scheduleDaily_df.xls";
  5276 + }
5208 5277 ee.excelReplace(listI, new Object[]{nMap}, sourcePath,
5209 5278 path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + lineName + "调度日报.xls");
5210 5279 } catch (Exception e) {
... ...
src/main/java/com/bsth/service/report/CalcSheetService.java
... ... @@ -12,4 +12,5 @@ public interface CalcSheetService extends BaseService&lt;CalcSheet, Integer&gt;{
12 12 public List<CalcSheet> calcListSheet(Map<String, Object> map);
13 13 public List<Sheet> calcSheet(Map<String, Object> map);
14 14 public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map);
  15 + public List<Map<String, Object>> calcTurnoutrateZgf(Map<String, Object> map);
15 16 }
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -5,6 +5,7 @@ import java.util.Map;
5 5  
6 6 import com.bsth.entity.StationRoute;
7 7 import com.bsth.entity.excep.ArrivalInfo;
  8 +import com.bsth.entity.mcy_forms.Singledata;
8 9 import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 10  
10 11  
... ... @@ -56,4 +57,6 @@ public interface ReportService {
56 57 List<Map<String, Object>> countDjg(Map<String, Object> map);
57 58  
58 59 Map<String, Object> online(Map<String, Object> map);
  60 +
  61 + List<Singledata> singledatatj(Map<String, Object> map);
59 62 }
... ...
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
... ... @@ -774,6 +774,91 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
774 774 }
775 775 return fage;
776 776 }
  777 +
  778 + @Override
  779 + public List<Map<String,Object>> calcTurnoutrateZgf(Map<String, Object> map){
  780 + final DecimalFormat df = new DecimalFormat("0.00");
  781 + String line="";
  782 + if(map.get("line")!=null){
  783 + line =map.get("line").toString().trim();
  784 + }
  785 + String gs="";
  786 + if(map.get("gsdmTurn")!=null){
  787 + gs=map.get("gsdmTurn").toString().trim();
  788 + }
  789 + String fgs="";
  790 + if(map.get("fgsdmTurn")!=null){
  791 + fgs=map.get("fgsdmTurn").toString().trim();
  792 + }
  793 +// String nature="0";
  794 +// if(map.get("nature")!=null){
  795 +// nature=map.get("nature").toString();
  796 +// }
  797 +// Map<String, Boolean> lineMap=lineService.lineNature();
  798 +
  799 + String startDate=map.get("startDate").toString();
  800 + String endDate=map.get("endDate").toString();
  801 + String date=startDate+"-"+endDate;
  802 + if(startDate.equals(endDate)){
  803 + date=startDate;
  804 + }else{
  805 + date=startDate+"-"+endDate;
  806 + }
  807 + String type=map.get("type").toString();
  808 + final String dates=date;
  809 + String sql_="";
  810 + if(line.equals("")){
  811 + sql_= " and gsdm ='"+gs+"' and fgsdm like '%"+fgs+"%'";
  812 + }else{
  813 + sql_=" and xl='"+line+"'";
  814 + }
  815 + String sql=" select gsdm,fgsdm,xl,xl_name,sum(jhcc) as jhcc,sum(sjcc) as sjcc,"
  816 + + " sum(jhcczgf) as jhcczgf, sum(sjcczgf) as sjcczgf "
  817 + + " from bsth_c_calc_sheet where date >='"+startDate+"' and date <='"+endDate+"'"
  818 + + sql_
  819 + + " group by gsdm,fgsdm,xl,xl_name";
  820 + List<Map<String, Object>> lists=jdbcTemplate.query(sql,
  821 + new RowMapper<Map<String, Object>>(){
  822 + @Override
  823 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  824 + Map<String, Object> s=new HashMap<String,Object>();
  825 + s.put("rq",dates);
  826 + s.put("gsdm", rs.getString("gsdm"));
  827 + s.put("fgsdm", rs.getString("fgsdm"));
  828 + s.put("gsName", BasicData.businessCodeNameMap.get(rs.getString("gsdm")));
  829 + s.put("fgsName", BasicData.businessFgsCodeNameMap.get(rs.getString("fgsdm")+"_"+rs.getString("gsdm")));
  830 + s.put("xl", rs.getString("xl"));
  831 + s.put("xlName", rs.getString("xl_name"));
  832 + s.put("jhcc", rs.getInt("jhcc"));
  833 + s.put("sjcc", rs.getInt("sjcc"));
  834 + s.put("sjcczgf", rs.getInt("sjcczgf"));
  835 + s.put("jhcczgf", rs.getInt("jhcczgf"));
  836 + if(rs.getInt("jhcc")>0){
  837 + s.put("ccl",df.format((float)rs.getInt("sjcc")/rs.getInt("jhcc")*100)+"%");
  838 + }else{
  839 + s.put("ccl", "0.00%");
  840 + }
  841 + if(rs.getInt("jhcczgf")>0){
  842 + s.put("cclzgf", df.format((float)rs.getInt("sjcczgf")/rs.getInt("jhcczgf")*100)+"%");
  843 + }else{
  844 + s.put("cclzgf","0.00%");
  845 + }
  846 + s.put("sm", "");
  847 + return s;
  848 + }
  849 + });
  850 + if (type.equals("export")) {
  851 + String lineName=map.get("lineName").toString();
  852 + ReportUtils ee = new ReportUtils();
  853 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  854 + listI.add(lists.iterator());
  855 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  856 + ee.excelReplace(listI, new Object[] { map }, path + "mould/calcTurnoutrateZgf.xls", path + "export/"
  857 + + dates + "-" + lineName + "-营运线路出车率统计表.xls");
  858 + }
  859 + return lists;
  860 + }
  861 +
777 862 @Override
778 863 public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map) {
779 864 final DecimalFormat df = new DecimalFormat("0.00");
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
... ... @@ -1647,22 +1647,47 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1647 1647 }
1648 1648 }else{
1649 1649 Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
1650   - if(!childTaskPlans.isEmpty()){
1651   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1652   - while (it.hasNext()) {
1653   - ChildTaskPlan childTaskPlan = it.next();
1654   - if(childTaskPlan.getCcId()==null){
1655   - if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
1656   - if (!childTaskPlan.isDestroy()) {
1657   - Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1658   - ljks=Arith.add(ljks,jhgl);
1659   - }
  1650 + if(isInOut(t)){
  1651 + if(childTaskPlans.isEmpty()){
  1652 + double jhlc=t.getJhlc()==null?0:t.getJhlc();
  1653 + double jhlcOrig=t.getJhlcOrig()==null?0:t.getJhlcOrig();
  1654 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  1655 + if(zjlc>0){
  1656 + ljks=Arith.add(zjlc, ljks);
  1657 + }
  1658 + }else{
  1659 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1660 + while (it.hasNext()) {
  1661 + ChildTaskPlan childTaskPlan = it.next();
  1662 + if(childTaskPlan.getCcId()==null){
  1663 + if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
  1664 + if (!childTaskPlan.isDestroy()) {
  1665 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1666 + ljks=Arith.add(ljks,jhgl);
  1667 + }
  1668 + }
1660 1669 }
1661   - }
1662   - }
  1670 + }
  1671 + }
  1672 +
  1673 + }else{
  1674 + if(!childTaskPlans.isEmpty()){
  1675 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1676 + while (it.hasNext()) {
  1677 + ChildTaskPlan childTaskPlan = it.next();
  1678 + if(childTaskPlan.getCcId()==null){
  1679 + if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
  1680 + if (!childTaskPlan.isDestroy()) {
  1681 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1682 + ljks=Arith.add(ljks,jhgl);
  1683 + }
  1684 + }
  1685 + }
  1686 + }
  1687 + }
1663 1688 }
1664   -
1665 1689 }
  1690 +
1666 1691 }
1667 1692 return ljks;
1668 1693 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.bsth.entity.Personnel;
6 6 import com.bsth.entity.StationRoute;
7 7 import com.bsth.entity.excep.ArrivalInfo;
8 8 import com.bsth.entity.mcy_forms.Daily;
  9 +import com.bsth.entity.mcy_forms.Singledata;
9 10 import com.bsth.entity.oil.Dlb;
10 11 import com.bsth.entity.oil.Ylb;
11 12 import com.bsth.entity.realcontrol.ChildTaskPlan;
... ... @@ -52,6 +53,9 @@ public class ReportServiceImpl implements ReportService{
52 53  
53 54 private Logger logger = LoggerFactory.getLogger(this.getClass());
54 55  
  56 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  57 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  58 +
55 59 @Autowired
56 60 JdbcTemplate jdbcTemplate;
57 61  
... ... @@ -65,7 +69,10 @@ public class ReportServiceImpl implements ReportService{
65 69 LineRepository lineRepository;
66 70 @Autowired
67 71 StationRouteRepository stationRouteRepository;
68   -
  72 + @Autowired
  73 + CulateMileageService culateMileageService;
  74 +
  75 +
69 76 @Override
70 77 public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) {
71 78 // TODO Auto-generated method stub
... ... @@ -3549,6 +3556,393 @@ public class ReportServiceImpl implements ReportService{
3549 3556 }
3550 3557 return list;
3551 3558 }
  3559 + @Override
  3560 + public List<Singledata> singledatatj(Map<String, Object> map) {
  3561 + String sfyy="";
  3562 + if(map.get("sfyy")!=null){
  3563 + sfyy=map.get("sfyy").toString();
  3564 + }
  3565 + String gsdm="";
  3566 + if(map.get("gsdmSing")!=null){
  3567 + gsdm=map.get("gsdmSing").toString();
  3568 + }
  3569 + String fgsdm="";
  3570 + if(map.get("fgsdmSing")!=null){
  3571 + fgsdm=map.get("fgsdmSing").toString();
  3572 + }
  3573 + String type="";
  3574 + if(map.get("type")!=null){
  3575 + type=map.get("type").toString();
  3576 + }
  3577 + String tjtype=map.get("tjtype").toString();
  3578 + String xlbm=map.get("line").toString().trim();
  3579 + String startDate = map.get("startDate").toString();
  3580 + String endDate = map.get("endDate").toString();
  3581 +
  3582 + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();
  3583 + if(xlbm.equals("")){
  3584 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj(xlbm, startDate, endDate, gsdm, fgsdm);
  3585 + }else{
  3586 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineTj2(xlbm, startDate, endDate);
  3587 + }
  3588 + List<Singledata> list=new ArrayList<Singledata>();
  3589 + List<Singledata> list_=new ArrayList<Singledata>();
  3590 + if(tjtype.equals("jsy")){
  3591 + //油统计
  3592 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.fgs_bm"
  3593 + + " from bsth_c_s_sp_info_real r where "
  3594 + + " r.schedule_date_str >= '"+startDate+"'"
  3595 + + " and r.schedule_date_str<='"+endDate+"'";
  3596 + if(xlbm.length() != 0){
  3597 + sql += " and r.xl_bm = '"+xlbm+"'";
  3598 + }
  3599 + if(gsdm.length() != 0){
  3600 + sql += " and r.gs_bm ='"+gsdm+"'";
  3601 + }
  3602 + if(fgsdm.length() != 0){
  3603 + sql += " and r.fgs_bm ='"+fgsdm+"'";
  3604 + }
  3605 + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh";
  3606 +
  3607 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  3608 + @Override
  3609 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  3610 + Singledata sin = new Singledata();
  3611 + sin.setxL(arg0.getString("xl_bm"));
  3612 + sin.setJsy(arg0.getString("j_gh"));
  3613 + sin.setClzbh(arg0.getString("cl_zbh"));
  3614 + sin.setgS(arg0.getString("fgs_bm"));
  3615 + return sin;
  3616 + }
  3617 + });
  3618 +
  3619 +
  3620 + String linesql="";
  3621 + if(!xlbm.equals("")){
  3622 + linesql +=" and xlbm ='"+xlbm+"' ";
  3623 + }
  3624 + if(!gsdm.equals("")){
  3625 + linesql +=" and ssgsdm ='"+gsdm+"' ";
  3626 + }
  3627 + if(!fgsdm.equals("")){
  3628 + linesql +=" and fgsdm ='"+fgsdm+"' ";
  3629 + }
  3630 + /*String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
  3631 + + " WHERE rq >= '"+startDate+"' and rq <='"+endDate+"'"
  3632 + + linesql
  3633 + + " union"
  3634 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
  3635 + + " WHERE rq = '"+startDate+"' and rq <='"+endDate+"'"
  3636 + + linesql;*/
  3637 +
  3638 + String nysql="SELECT 'yh' as type,xlbm,nbbm,jsy,sum(jzl*1000)/1000 as jzl,"
  3639 + + " sum(yh*1000)/1000 as yh,"
  3640 + + " sum(sh*1000)/1000 as sh FROM "
  3641 + + "bsth_c_ylb where rq>='"+startDate+"' "
  3642 + + " and rq <='"+endDate+"' " +linesql
  3643 + + " group by xlbm ,nbbm,jsy "
  3644 + + " union SELECT 'dh' as type,xlbm,nbbm,jsy, "
  3645 + + " sum(cdl*1000)/1000 as jzl,sum(hd*1000)/1000 as yh,"
  3646 + + " sum(sh * 1000) / 1000 AS sh"
  3647 + + " FROM bsth_c_dlb where rq>='"+startDate+"' "
  3648 + + " and rq <='"+endDate+"'" +linesql
  3649 + + " group by xlbm ,nbbm,jsy" ;
  3650 +
  3651 + List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
  3652 + @Override
  3653 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  3654 + Singledata sin = new Singledata();
  3655 + sin.setxL(arg0.getString("xlbm"));
  3656 + sin.setJsy(arg0.getString("jsy"));
  3657 + sin.setClzbh(arg0.getString("nbbm"));
  3658 + sin.setJzl(arg0.getString("jzl"));
  3659 + sin.setHyl(arg0.getString("yh"));
  3660 + sin.setUnyyyl(arg0.getString("sh"));
  3661 + return sin;
  3662 + }
  3663 + });
  3664 + //统计油,电表中手动添加的或者有加注没里程的数据
  3665 + for (int i = 0; i < listNy.size(); i++) {
  3666 + Singledata sin_=listNy.get(i);
  3667 + String jsy=sin_.getJsy();
  3668 + String line=sin_.getxL();
  3669 + String clzbh=sin_.getClzbh();
  3670 + boolean fages=true;
  3671 + for (int j = 0; j < list.size(); j++) {
  3672 + Singledata sin=list.get(j);
  3673 + String jsy_=sin.getJsy();
  3674 + String line_=sin.getxL();
  3675 + String clzbh_=sin.getClzbh();
  3676 + if(jsy.equals(jsy_)
  3677 + &&line.equals(line_)
  3678 + &&clzbh.equals(clzbh_)){
  3679 + fages=false;
  3680 + }
  3681 + }
  3682 + if(fages){
  3683 + Singledata s=new Singledata();
  3684 + s.setJsy(jsy);
  3685 + s.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  3686 + s.setClzbh(clzbh);
  3687 + s.setSgh("");
  3688 + s.setsName("");
  3689 + s.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3690 + s.setxL(line);
  3691 + s.setXlmc(BasicData.lineCodeAllNameMap.get(line));
  3692 + s.setJzl(sin_.getJzl());
  3693 + s.setHyl(sin_.getHyl());
  3694 + s.setUnyyyl(sin_.getUnyyyl());
  3695 + s.setJhlc("0.0");
  3696 + s.setEmptMileage("0.0");
  3697 + s.setJhjl("0.0");
  3698 + if(startDate.equals(endDate))
  3699 + s.setrQ(startDate);
  3700 + else
  3701 + s.setrQ(startDate+"-"+endDate);
  3702 +
  3703 + list_.add(s);
  3704 + }
  3705 + }
  3706 + for (int i= 0; i < list.size(); i++) {
  3707 + Singledata sin=list.get(i);
  3708 + String jsy=sin.getJsy();
  3709 + String line=sin.getxL();
  3710 + String clzbh=sin.getClzbh();
  3711 + double jzl=0.0;
  3712 + double yh=0.0;
  3713 + double sh=0.0;
  3714 + for (int j = 0; j < listNy.size(); j++) {
  3715 + Singledata y=listNy.get(j);
  3716 + if(y.getJsy().equals(jsy)
  3717 + &&y.getClzbh().equals(clzbh)
  3718 + &&y.getxL().equals(line)){
  3719 + jzl=Arith.add(jzl, y.getJzl());
  3720 + yh=Arith.add(yh, y.getHyl());
  3721 + sh=Arith.add(sh, y.getUnyyyl());
  3722 + }
  3723 + }
  3724 + sin.setHyl(String.valueOf(yh));
  3725 + sin.setJzl(String.valueOf(jzl));
  3726 + sin.setUnyyyl(String.valueOf(sh));
  3727 +
  3728 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  3729 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  3730 + for (int j = 0; j < listReal.size(); j++) {
  3731 + ScheduleRealInfo s=listReal.get(j);
  3732 + if(s.getjGh().equals(jsy)
  3733 + && s.getClZbh().equals(clzbh)
  3734 + &&s.getXlBm().equals(line)){
  3735 + newList.add(s);
  3736 + Set<ChildTaskPlan> cts = s.getcTasks();
  3737 + if(cts != null && cts.size() > 0){
  3738 + newList_.add(s);
  3739 + }else{
  3740 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  3741 + newList_.add(s);
  3742 + }
  3743 + }
  3744 + }
  3745 + }
  3746 + double jhgl=culateMileageService.culateJhgl(newList);
  3747 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  3748 + double yygl=culateMileageService.culateSjgl(newList_);
  3749 + double ljgl=culateMileageService.culateLjgl(newList_);
  3750 + double ksgl=culateMileageService.culateKsgl(newList_);
  3751 + double jcgl=culateMileageService.culateJccgl(newList_);
  3752 +
  3753 + double zyygl=Arith.add(yygl, ljgl);
  3754 + double zksgl=Arith.add(ksgl, jcgl);
  3755 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  3756 + sin.setEmptMileage(String.valueOf(zksgl));
  3757 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  3758 + if(newList.size()>0){
  3759 + sin.setXlmc(newList.get(0).getXlName());
  3760 + sin.setjName(newList.get(0).getjName());
  3761 + }else{
  3762 + sin.setXlmc(BasicData.lineCodeAllNameMap.get(line));
  3763 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  3764 +
  3765 + }
  3766 + if(startDate.equals(endDate))
  3767 + sin.setrQ(startDate);
  3768 + else
  3769 + sin.setrQ(startDate+"-"+endDate);
  3770 +// sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  3771 + sin.setSgh("");
  3772 + sin.setsName("");
  3773 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3774 + list_.add(sin);
  3775 +
  3776 + }
  3777 + }else{
  3778 + String sql="select r.s_gh,r.s_name, "
  3779 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  3780 + + " from bsth_c_s_sp_info_real r where "
  3781 + + " r.schedule_date_str >= '"+startDate+"'"
  3782 + + " schedule_date_str <='"+endDate+"'"
  3783 + + " and r.s_gh !='' and r.s_gh is not null ";
  3784 + if(!xlbm.equals("")){
  3785 + sql += " and r.xl_bm = '"+xlbm+"'";
  3786 + }
  3787 + if(!gsdm.equals("")){
  3788 + sql += " and r.gs_bm = '"+gsdm+"'";
  3789 + }
  3790 + if(!fgsdm.equals("")){
  3791 + sql += " and r.fgs_bm = '"+fgsdm+"'";
  3792 + }
  3793 + sql += " group by r.s_gh,r.s_name,"
  3794 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  3795 +
  3796 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  3797 + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  3798 + @Override
  3799 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  3800 + Singledata sin = new Singledata();
  3801 +// sin.setrQ(startDate);
  3802 + sin.setxL(arg0.getString("xl_bm"));
  3803 + sin.setClzbh(arg0.getString("cl_zbh"));
  3804 + sin.setSgh(arg0.getString("s_gh"));
  3805 + sin.setsName(arg0.getString("s_name"));
  3806 + sin.setgS(arg0.getString("fgs_bm"));
  3807 + return sin;
  3808 + }
  3809 + });
  3810 +
  3811 + String spy="";
  3812 + if(map.get("map")!=null){
  3813 + spy=map.get("spy").toString();
  3814 + }
  3815 + for (int i = 0; i < list.size(); i++) {
  3816 + Singledata sin=list.get(i);
  3817 + sin.setrQ(startDate+"-"+endDate);
  3818 + String jsy=sin.getSgh();
  3819 + String line=sin.getxL();
  3820 + String clzbh=sin.getClzbh();
  3821 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  3822 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  3823 +
  3824 + for (int j = 0; j < listReal.size(); j++) {
  3825 + ScheduleRealInfo s=listReal.get(j);
  3826 + if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh)
  3827 + &&s.getXlBm().equals(line)){
  3828 + newList.add(s);
  3829 + Set<ChildTaskPlan> cts = s.getcTasks();
  3830 + if(cts != null && cts.size() > 0){
  3831 + newList_.add(s);
  3832 + }else{
  3833 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  3834 + newList_.add(s);
  3835 + }
  3836 + }
  3837 + }
  3838 + }
  3839 + double jhgl=culateMileageService.culateJhgl(newList);;
  3840 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  3841 + double yygl=0.0;
  3842 + double ljgl=0.0;
  3843 + double zksgl=0.0;
  3844 + if(spy.equals("zrw")){
  3845 + yygl=culateMileageService.culateSjgl_spy(newList_);
  3846 + ljgl=culateMileageService.culateLjgl_spy(newList_);
  3847 + zksgl=culateMileageService.culateSjfyylc_spy(newList_);
  3848 + }else{
  3849 + yygl=culateMileageService.culateSjgl(newList_);
  3850 + ljgl=culateMileageService.culateLjgl(newList_);
  3851 + double ksgl=culateMileageService.culateKsgl(newList_);
  3852 + double jcgl=culateMileageService.culateJccgl(newList_);
  3853 + zksgl=Arith.add(ksgl, jcgl);
  3854 + }
  3855 + double zyygl=Arith.add(yygl, ljgl);
  3856 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  3857 + sin.setEmptMileage(String.valueOf(zksgl));
  3858 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  3859 + if(newList.size()>0)
  3860 + sin.setXlmc(newList.get(0).getXlName());
  3861 + else
  3862 + sin.setXlmc(BasicData.lineCodeAllNameMap.get(line));
  3863 + sin.setClzbh(clzbh);
  3864 + sin.setJsy("");
  3865 + sin.setjName("");
  3866 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3867 + sin.setHyl("");
  3868 + sin.setJzl("");
  3869 + sin.setUnyyyl("");
  3870 + list_.add(sin);
  3871 + }
  3872 + }
  3873 +
  3874 + /*Map<String, Boolean> lineNature = lineService.lineNature();
  3875 + List<Singledata> resList = new ArrayList<Singledata>();
  3876 + for(Singledata s : list_){
  3877 + String xlBm = s.getxL();
  3878 + if(sfyy.length() != 0){
  3879 + if(sfyy.equals("0")){
  3880 + resList.add(s);
  3881 + } else if(sfyy.equals("1")){
  3882 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm)){
  3883 + resList.add(s);
  3884 + }
  3885 + } else {
  3886 + if(lineNature.containsKey(xlBm) && !lineNature.get(xlBm)){
  3887 + resList.add(s);
  3888 + }
  3889 + }
  3890 + } else {
  3891 + resList.add(s);
  3892 + }
  3893 + }*/
  3894 +
  3895 +
  3896 + if (type.equals("export")) {
  3897 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3898 + ReportUtils ee = new ReportUtils();
  3899 +
  3900 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  3901 + int i = 1;
  3902 + for (Singledata l : list_) {
  3903 + Map<String, Object> m = new HashMap<String, Object>();
  3904 + m.put("i", i);
  3905 + m.put("rQ", l.getrQ());
  3906 + m.put("gS", l.getgS());
  3907 + m.put("xL", l.getXlmc());
  3908 + m.put("clzbh", l.getClzbh());
  3909 + m.put("jsy", l.getJsy());
  3910 + m.put("jName", l.getjName());
  3911 + m.put("sgh", l.getSgh());
  3912 + m.put("sName", l.getsName());
  3913 + m.put("jhlc", l.getJhlc());
  3914 + m.put("emptMileage", l.getEmptMileage());
  3915 + m.put("hyl", l.getHyl());
  3916 + m.put("jzl", l.getJzl());
  3917 + m.put("unyyyl", l.getUnyyyl());
  3918 + m.put("jhjl", l.getJhjl());
  3919 + resList.add(m);
  3920 +
  3921 + i++;
  3922 + }
  3923 +
  3924 + listI.add(resList.iterator());
  3925 + try {
  3926 + String exportDate="";
  3927 + if(startDate.equals(endDate)){
  3928 + exportDate =sdfSimple.format(sdfMonth.parse(startDate)) ;
  3929 + }else{
  3930 + exportDate =sdfSimple.format(sdfMonth.parse(startDate))+"-"+sdfSimple.format(sdfMonth.parse(endDate)) ;
  3931 + }
  3932 + String lineName = "";
  3933 + if(map.containsKey("lineName"))
  3934 + lineName = map.get("lineName").toString();
  3935 +
  3936 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3937 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  3938 + path + "export/" +exportDate
  3939 + + "-" + lineName + "-路单统计.xls");
  3940 + } catch (ParseException e) {
  3941 + e.printStackTrace();
  3942 + }
  3943 + }
  3944 + return list_;
  3945 + }
3552 3946  
3553 3947  
3554 3948 }
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
... ... @@ -385,9 +385,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
385 385 // zgfEnd = sdf.parse(date + "08:30").getTime();
386 386 // wgfBegin = sdf.parse(date + "16:00").getTime();
387 387 // wgfEnd = sdf.parse(date + "18:00").getTime();
388   - zgfBegin = 6l * 60l + 30l;
  388 + zgfBegin = 6l * 60l + 31l;
389 389 zgfEnd = 8l * 60l + 30l;
390   - wgfBegin = 16l * 60l + 0l;
  390 + wgfBegin = 16l * 60l + 1l;
391 391 wgfEnd = 18l * 60l + 0l;
392 392 } catch (Exception e) {
393 393 // TODO Auto-generated catch block
... ... @@ -414,15 +414,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
414 414 subCompanyName = schedule.getFgsName();
415 415  
416 416 //早晚高峰时段执行率
417   - if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){
418   - jhzgf++;
419   - if(schedule.getFcsjActual() != null)
  417 + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out") && !schedule.getBcType().equals("ldks")){
  418 + if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){
  419 + jhzgf++;
  420 + }
  421 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  422 + && schedule.getFcsjActualTime() >= zgfBegin
  423 + && schedule.getFcsjActualTime() <= zgfEnd){
420 424 sjzgf++;
421   - }
422   - if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){
423   - jhwgf++;
424   - if(schedule.getFcsjActual() != null)
  425 + }
  426 + if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){
  427 + jhwgf++;
  428 + }
  429 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  430 + && schedule.getFcsjActualTime() >= wgfBegin
  431 + && schedule.getFcsjActualTime() <= wgfEnd){
425 432 sjwgf++;
  433 + }
426 434 }
427 435  
428 436 //班次数和出场数
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/CalcuParam.java
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
2   -
3   -import org.joda.time.DateTime;
4   -
5   -/**
6   - * 计算用参数。
7   - */
8   -public class CalcuParam {
9   - /** 线路Id */
10   - private Integer xlId;
11   -
12   - /** 计划开始计算日期 */
13   - private DateTime fromDate;
14   - /** 计划结束计算日期 */
15   - private DateTime toDate;
16   -
17   - public Integer getXlId() {
18   - return xlId;
19   - }
20   -
21   - public void setXlId(Integer xlId) {
22   - this.xlId = xlId;
23   - }
24   -
25   - public DateTime getFromDate() {
26   - return fromDate;
27   - }
28   -
29   - public void setFromDate(DateTime fromDate) {
30   - this.fromDate = fromDate;
31   - }
32   -
33   - public DateTime getToDate() {
34   - return toDate;
35   - }
36   -
37   - public void setToDate(DateTime toDate) {
38   - this.toDate = toDate;
39   - }
40   -}
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 计算用参数。
  7 + */
  8 +public class CalcuParam {
  9 + /** 线路Id */
  10 + private Integer xlId;
  11 +
  12 + /** 计划开始计算日期 */
  13 + private DateTime fromDate;
  14 + /** 计划结束计算日期 */
  15 + private DateTime toDate;
  16 +
  17 + public Integer getXlId() {
  18 + return xlId;
  19 + }
  20 +
  21 + public void setXlId(Integer xlId) {
  22 + this.xlId = xlId;
  23 + }
  24 +
  25 + public DateTime getFromDate() {
  26 + return fromDate;
  27 + }
  28 +
  29 + public void setFromDate(DateTime fromDate) {
  30 + this.fromDate = fromDate;
  31 + }
  32 +
  33 + public DateTime getToDate() {
  34 + return toDate;
  35 + }
  36 +
  37 + public void setToDate(DateTime toDate) {
  38 + this.toDate = toDate;
  39 + }
  40 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ErrorInfoFunction.java
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
2   -
3   -
4   -import com.bsth.entity.schedule.EmployeeConfigInfo;
5   -import com.bsth.entity.schedule.GuideboardInfo;
6   -import org.apache.commons.lang3.StringUtils;
7   -import org.apache.commons.lang3.math.NumberUtils;
8   -import org.kie.api.runtime.rule.AccumulateFunction;
9   -
10   -import java.io.*;
11   -import java.util.HashMap;
12   -import java.util.Map;
13   -
14   -/**
15   - * 查找错误函数。
16   - */
17   -public class ErrorInfoFunction implements AccumulateFunction {
18   - @Override
19   - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
20   -
21   - }
22   -
23   - @Override
24   - public void writeExternal(ObjectOutput out) throws IOException {
25   -
26   - }
27   -
28   - protected static class ErrorInfoContext implements Externalizable {
29   - /** 错误数量 */
30   - public Integer errorCount = 0;
31   - /** 错误Map,Map<规则id,errorInfo> */
32   - public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>();
33   -
34   - public ErrorInfoContext() {
35   -
36   - }
37   -
38   - @Override
39   - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
40   - errorCount = in.readInt();
41   - errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject();
42   -
43   - }
44   -
45   - @Override
46   - public void writeExternal(ObjectOutput out) throws IOException {
47   - out.writeInt(errorCount);
48   - out.writeObject(errorInfoMap);
49   - }
50   -
51   - }
52   -
53   - @Override
54   - public Serializable createContext() {
55   - return new ErrorInfoContext();
56   - }
57   -
58   - @Override
59   - public void init(Serializable serializable) throws Exception {
60   - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
61   - errorInfoContext.errorCount = 0;
62   - errorInfoContext.errorInfoMap = new HashMap<>();
63   - }
64   -
65   - @Override
66   - public void accumulate(Serializable serializable, Object o) {
67   - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
68   - WrapInput wrapInput = (WrapInput) o;
69   -
70   - ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo();
71   - errorInfo.setRuleId(wrapInput.getRuleId());
72   - errorInfo.setClZbh(wrapInput.getClZbh());
73   - errorInfo.setQyrq(wrapInput.getQyrq());
74   -
75   - // 1、车辆配置验证
76   - if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空
77   - if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上
78   - errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!");
79   - }
80   - } else {
81   - errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!");
82   - }
83   -
84   - // 2、路牌id,路牌名字,路牌起始索引验证
85   - if (StringUtils.isNotEmpty(wrapInput.getLpIds()) &&
86   - StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空
87   - String[] lpIds = wrapInput.getLpIds().split(",");
88   - String[] lpNames = wrapInput.getLpNames().split(",");
89   - if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致
90   - for (int i = 0; i < lpIds.length; i++) {
91   - if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字
92   - errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!");
93   - break;
94   - }
95   -
96   - GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i]));
97   - if (lpInfo == null) { // 路牌不在当前线路上
98   - errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!");
99   - } else {
100   - if (StringUtils.isEmpty(lpNames[i]) ||
101   - !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应
102   - errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!");
103   - break;
104   - }
105   - }
106   - }
107   -
108   - if (wrapInput.getLpStartIndex() < 1 ||
109   - wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出
110   - errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!");
111   - }
112   - } else {
113   - errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!");
114   - }
115   - } else {
116   - errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!");
117   - }
118   -
119   - // 3、人员配置,搭班编码,人员起始索引验证
120   - if (StringUtils.isNotEmpty(wrapInput.getEcIds()) &&
121   - StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空
122   - String[] ecIds = wrapInput.getEcIds().split(",");
123   - String[] ecDbbms = wrapInput.getEcDbbms().split(",");
124   - if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致
125   - for (int i = 0; i < ecIds.length; i++) {
126   - if (ecIds[i].contains("-")) { // 分班标识
127   - String[] fb_ecIds = ecIds[i].split("-");
128   - String[] fb_ecDbbms = ecDbbms[i].split("-");
129   - if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班
130   - errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!");
131   - break;
132   - } else {
133   - EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0]));
134   - EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1]));
135   - if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路
136   - errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!");
137   - break;
138   - } else {
139   - if (StringUtils.isEmpty(fb_ecDbbms[0]) ||
140   - StringUtils.isEmpty(fb_ecDbbms[1]) ||
141   - !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) ||
142   - !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应
143   - errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!");
144   - break;
145   - }
146   - }
147   - }
148   -
149   - } else {
150   - if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字
151   - errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!");
152   - break;
153   - }
154   -
155   - EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i]));
156   - if (ecInfo == null) { // 人员配置不在当前线路
157   - errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!");
158   - break;
159   - } else {
160   - if (StringUtils.isEmpty(ecDbbms[i]) ||
161   - !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应
162   - errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!");
163   - break;
164   - }
165   - }
166   - }
167   - }
168   -
169   - if (wrapInput.getEcStartIndex() < 1 ||
170   - wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出
171   - errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!");
172   - }
173   - } else {
174   - errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!");
175   - }
176   - }
177   -
178   - if (errorInfo.getErrorDescList().size() > 0) {
179   - errorInfoContext.errorCount ++;
180   - errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo);
181   - }
182   -
183   - }
184   -
185   - @Override
186   - public void reverse(Serializable serializable, Object o) throws Exception {
187   - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
188   - WrapInput wrapInput = (WrapInput) o;
189   -
190   - if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) {
191   - errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId());
192   - errorInfoContext.errorCount --;
193   - }
194   - }
195   -
196   - @Override
197   - public Object getResult(Serializable serializable) throws Exception {
198   - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
199   - return errorInfoContext.errorInfoMap;
200   - }
201   -
202   - @Override
203   - public boolean supportsReverse() {
204   - return true;
205   - }
206   -
207   - @Override
208   - public Class<?> getResultType() {
209   - return Map.class;
210   - }
211   -
212   -}
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.apache.commons.lang3.math.NumberUtils;
  8 +import org.kie.api.runtime.rule.AccumulateFunction;
  9 +
  10 +import java.io.*;
  11 +import java.util.HashMap;
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * 查找错误函数。
  16 + */
  17 +public class ErrorInfoFunction implements AccumulateFunction {
  18 + @Override
  19 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  20 +
  21 + }
  22 +
  23 + @Override
  24 + public void writeExternal(ObjectOutput out) throws IOException {
  25 +
  26 + }
  27 +
  28 + protected static class ErrorInfoContext implements Externalizable {
  29 + /** 错误数量 */
  30 + public Integer errorCount = 0;
  31 + /** 错误Map,Map<规则id,errorInfo> */
  32 + public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>();
  33 +
  34 + public ErrorInfoContext() {
  35 +
  36 + }
  37 +
  38 + @Override
  39 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  40 + errorCount = in.readInt();
  41 + errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject();
  42 +
  43 + }
  44 +
  45 + @Override
  46 + public void writeExternal(ObjectOutput out) throws IOException {
  47 + out.writeInt(errorCount);
  48 + out.writeObject(errorInfoMap);
  49 + }
  50 +
  51 + }
  52 +
  53 + @Override
  54 + public Serializable createContext() {
  55 + return new ErrorInfoContext();
  56 + }
  57 +
  58 + @Override
  59 + public void init(Serializable serializable) throws Exception {
  60 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  61 + errorInfoContext.errorCount = 0;
  62 + errorInfoContext.errorInfoMap = new HashMap<>();
  63 + }
  64 +
  65 + @Override
  66 + public void accumulate(Serializable serializable, Object o) {
  67 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  68 + WrapInput wrapInput = (WrapInput) o;
  69 +
  70 + ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo();
  71 + errorInfo.setRuleId(wrapInput.getRuleId());
  72 + errorInfo.setClZbh(wrapInput.getClZbh());
  73 + errorInfo.setQyrq(wrapInput.getQyrq());
  74 +
  75 + // 1、车辆配置验证
  76 + if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空
  77 + if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上
  78 + errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!");
  79 + }
  80 + } else {
  81 + errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!");
  82 + }
  83 +
  84 + // 2、路牌id,路牌名字,路牌起始索引验证
  85 + if (StringUtils.isNotEmpty(wrapInput.getLpIds()) &&
  86 + StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空
  87 + String[] lpIds = wrapInput.getLpIds().split(",");
  88 + String[] lpNames = wrapInput.getLpNames().split(",");
  89 + if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致
  90 + for (int i = 0; i < lpIds.length; i++) {
  91 + if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字
  92 + errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!");
  93 + break;
  94 + }
  95 +
  96 + GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i]));
  97 + if (lpInfo == null) { // 路牌不在当前线路上
  98 + errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!");
  99 + } else {
  100 + if (StringUtils.isEmpty(lpNames[i]) ||
  101 + !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应
  102 + errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!");
  103 + break;
  104 + }
  105 + }
  106 + }
  107 +
  108 + if (wrapInput.getLpStartIndex() < 1 ||
  109 + wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出
  110 + errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!");
  111 + }
  112 + } else {
  113 + errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!");
  114 + }
  115 + } else {
  116 + errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!");
  117 + }
  118 +
  119 + // 3、人员配置,搭班编码,人员起始索引验证
  120 + if (StringUtils.isNotEmpty(wrapInput.getEcIds()) &&
  121 + StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空
  122 + String[] ecIds = wrapInput.getEcIds().split(",");
  123 + String[] ecDbbms = wrapInput.getEcDbbms().split(",");
  124 + if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致
  125 + for (int i = 0; i < ecIds.length; i++) {
  126 + if (ecIds[i].contains("-")) { // 分班标识
  127 + String[] fb_ecIds = ecIds[i].split("-");
  128 + String[] fb_ecDbbms = ecDbbms[i].split("-");
  129 + if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班
  130 + errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!");
  131 + break;
  132 + } else {
  133 + EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0]));
  134 + EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1]));
  135 + if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路
  136 + errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!");
  137 + break;
  138 + } else {
  139 + if (StringUtils.isEmpty(fb_ecDbbms[0]) ||
  140 + StringUtils.isEmpty(fb_ecDbbms[1]) ||
  141 + !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) ||
  142 + !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应
  143 + errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!");
  144 + break;
  145 + }
  146 + }
  147 + }
  148 +
  149 + } else {
  150 + if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字
  151 + errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!");
  152 + break;
  153 + }
  154 +
  155 + EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i]));
  156 + if (ecInfo == null) { // 人员配置不在当前线路
  157 + errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!");
  158 + break;
  159 + } else {
  160 + if (StringUtils.isEmpty(ecDbbms[i]) ||
  161 + !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应
  162 + errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!");
  163 + break;
  164 + }
  165 + }
  166 + }
  167 + }
  168 +
  169 + if (wrapInput.getEcStartIndex() < 1 ||
  170 + wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出
  171 + errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!");
  172 + }
  173 + } else {
  174 + errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!");
  175 + }
  176 + }
  177 +
  178 + if (errorInfo.getErrorDescList().size() > 0) {
  179 + errorInfoContext.errorCount ++;
  180 + errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo);
  181 + }
  182 +
  183 + }
  184 +
  185 + @Override
  186 + public void reverse(Serializable serializable, Object o) throws Exception {
  187 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  188 + WrapInput wrapInput = (WrapInput) o;
  189 +
  190 + if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) {
  191 + errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId());
  192 + errorInfoContext.errorCount --;
  193 + }
  194 + }
  195 +
  196 + @Override
  197 + public Object getResult(Serializable serializable) throws Exception {
  198 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  199 + return errorInfoContext.errorInfoMap;
  200 + }
  201 +
  202 + @Override
  203 + public boolean supportsReverse() {
  204 + return true;
  205 + }
  206 +
  207 + @Override
  208 + public Class<?> getResultType() {
  209 + return Map.class;
  210 + }
  211 +
  212 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ValidateRuleResult.java
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
2   -
3   -import java.util.ArrayList;
4   -import java.util.Date;
5   -import java.util.List;
6   -
7   -/**
8   - * 输出结果值。
9   - */
10   -public class ValidateRuleResult {
11   - /** 线路id */
12   - private Integer xlId;
13   - /** 规则总数量 */
14   - private Integer count;
15   - /** 启用的规则数量 */
16   - private Integer qyCount;
17   - /** 启用规则中的错误数量 */
18   - private Integer qyErrorCount;
19   - /** 错误列表 */
20   - private List<ErrorInfo> errorInfos = new ArrayList<>();
21   -
22   - public Integer getXlId() {
23   - return xlId;
24   - }
25   -
26   - public void setXlId(Integer xlId) {
27   - this.xlId = xlId;
28   - }
29   -
30   - public Integer getCount() {
31   - return count;
32   - }
33   -
34   - public void setCount(Integer count) {
35   - this.count = count;
36   - }
37   -
38   - public Integer getQyCount() {
39   - return qyCount;
40   - }
41   -
42   - public void setQyCount(Integer qyCount) {
43   - this.qyCount = qyCount;
44   - }
45   -
46   - public Integer getQyErrorCount() {
47   - return qyErrorCount;
48   - }
49   -
50   - public void setQyErrorCount(Integer qyErrorCount) {
51   - this.qyErrorCount = qyErrorCount;
52   - }
53   -
54   - public List<ErrorInfo> getErrorInfos() {
55   - return errorInfos;
56   - }
57   -
58   - public void setErrorInfos(List<ErrorInfo> errorInfos) {
59   - this.errorInfos = errorInfos;
60   - }
61   -
62   - public static class ErrorInfo {
63   - /** 规则id */
64   - private Long ruleId;
65   - /** 车辆自编号 */
66   - private String clZbh;
67   - /** 启用日期 */
68   - private Date qyrq;
69   - /** 错误描述 */
70   - private List<String> errorDescList = new ArrayList<>();
71   -
72   - public Long getRuleId() {
73   - return ruleId;
74   - }
75   -
76   - public void setRuleId(Long ruleId) {
77   - this.ruleId = ruleId;
78   - }
79   -
80   - public String getClZbh() {
81   - return clZbh;
82   - }
83   -
84   - public void setClZbh(String clZbh) {
85   - this.clZbh = clZbh;
86   - }
87   -
88   - public Date getQyrq() {
89   - return qyrq;
90   - }
91   -
92   - public void setQyrq(Date qyrq) {
93   - this.qyrq = qyrq;
94   - }
95   -
96   - public List<String> getErrorDescList() {
97   - return errorDescList;
98   - }
99   -
100   - public void setErrorDescList(List<String> errorDescList) {
101   - this.errorDescList = errorDescList;
102   - }
103   - }
104   -}
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 输出结果值。
  9 + */
  10 +public class ValidateRuleResult {
  11 + /** 线路id */
  12 + private Integer xlId;
  13 + /** 规则总数量 */
  14 + private Integer count;
  15 + /** 启用的规则数量 */
  16 + private Integer qyCount;
  17 + /** 启用规则中的错误数量 */
  18 + private Integer qyErrorCount;
  19 + /** 错误列表 */
  20 + private List<ErrorInfo> errorInfos = new ArrayList<>();
  21 +
  22 + public Integer getXlId() {
  23 + return xlId;
  24 + }
  25 +
  26 + public void setXlId(Integer xlId) {
  27 + this.xlId = xlId;
  28 + }
  29 +
  30 + public Integer getCount() {
  31 + return count;
  32 + }
  33 +
  34 + public void setCount(Integer count) {
  35 + this.count = count;
  36 + }
  37 +
  38 + public Integer getQyCount() {
  39 + return qyCount;
  40 + }
  41 +
  42 + public void setQyCount(Integer qyCount) {
  43 + this.qyCount = qyCount;
  44 + }
  45 +
  46 + public Integer getQyErrorCount() {
  47 + return qyErrorCount;
  48 + }
  49 +
  50 + public void setQyErrorCount(Integer qyErrorCount) {
  51 + this.qyErrorCount = qyErrorCount;
  52 + }
  53 +
  54 + public List<ErrorInfo> getErrorInfos() {
  55 + return errorInfos;
  56 + }
  57 +
  58 + public void setErrorInfos(List<ErrorInfo> errorInfos) {
  59 + this.errorInfos = errorInfos;
  60 + }
  61 +
  62 + public static class ErrorInfo {
  63 + /** 规则id */
  64 + private Long ruleId;
  65 + /** 车辆自编号 */
  66 + private String clZbh;
  67 + /** 启用日期 */
  68 + private Date qyrq;
  69 + /** 错误描述 */
  70 + private List<String> errorDescList = new ArrayList<>();
  71 +
  72 + public Long getRuleId() {
  73 + return ruleId;
  74 + }
  75 +
  76 + public void setRuleId(Long ruleId) {
  77 + this.ruleId = ruleId;
  78 + }
  79 +
  80 + public String getClZbh() {
  81 + return clZbh;
  82 + }
  83 +
  84 + public void setClZbh(String clZbh) {
  85 + this.clZbh = clZbh;
  86 + }
  87 +
  88 + public Date getQyrq() {
  89 + return qyrq;
  90 + }
  91 +
  92 + public void setQyrq(Date qyrq) {
  93 + this.qyrq = qyrq;
  94 + }
  95 +
  96 + public List<String> getErrorDescList() {
  97 + return errorDescList;
  98 + }
  99 +
  100 + public void setErrorDescList(List<String> errorDescList) {
  101 + this.errorDescList = errorDescList;
  102 + }
  103 + }
  104 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/WrapInput.java
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
2   -
3   -import com.bsth.entity.schedule.CarConfigInfo;
4   -import com.bsth.entity.schedule.EmployeeConfigInfo;
5   -import com.bsth.entity.schedule.GuideboardInfo;
6   -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
7   -import org.springframework.util.CollectionUtils;
8   -
9   -import java.util.*;
10   -
11   -/**
12   - * 聚合输入的待判定数据。
13   - */
14   -public class WrapInput {
15   - /** 线路Id */
16   - private Integer xlId;
17   - /** 车辆自编号 */
18   - private String clZbh;
19   - /** 路牌id列表 */
20   - private String lpIds;
21   - /** 路牌名字列表 */
22   - private String lpNames;
23   - /** 人员配置列表 */
24   - private String ecIds;
25   - /** 人员搭班编码列表 */
26   - private String ecDbbms;
27   - /** 路牌循环起始索引 */
28   - private Integer lpStartIndex;
29   - /** 人员循环起始索引 */
30   - private Integer ecStartIndex;
31   - /** 规则id */
32   - private Long ruleId;
33   - /** 启用日期 */
34   - private Date qyrq;
35   -
36   - private Map<String, CarConfigInfo> ccInfos = new HashMap<>();
37   - private Map<Long, GuideboardInfo> lpInfos = new HashMap<>();
38   - private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>();
39   -
40   - public WrapInput(ScheduleRule1Flat r,
41   - Map<String, CarConfigInfo> cc,
42   - Map<Long, GuideboardInfo> lp,
43   - Map<Long, EmployeeConfigInfo> ec) {
44   - this.xlId = r.getXl().getId();
45   - this.clZbh = r.getCarConfigInfo().getCl().getInsideCode();
46   - this.lpIds = r.getLpIds();
47   - this.lpNames = r.getLpNames();
48   - this.ecIds = r.getRyConfigIds();
49   - this.ecDbbms = r.getRyDbbms();
50   - this.lpStartIndex = r.getLpStart();
51   - this.ecStartIndex = r.getRyStart();
52   - this.ruleId = r.getId();
53   - this.qyrq = r.getQyrq();
54   -
55   - if (!CollectionUtils.isEmpty(cc)) {
56   - this.ccInfos.putAll(cc);
57   - }
58   - if (!CollectionUtils.isEmpty(lp)) {
59   - this.lpInfos.putAll(lp);
60   - }
61   - if (!CollectionUtils.isEmpty(ec)) {
62   - this.ecInfos.putAll(ec);
63   - }
64   -
65   - }
66   -
67   - public Integer getXlId() {
68   - return xlId;
69   - }
70   -
71   - public void setXlId(Integer xlId) {
72   - this.xlId = xlId;
73   - }
74   -
75   - public String getClZbh() {
76   - return clZbh;
77   - }
78   -
79   - public void setClZbh(String clZbh) {
80   - this.clZbh = clZbh;
81   - }
82   -
83   - public String getLpIds() {
84   - return lpIds;
85   - }
86   -
87   - public void setLpIds(String lpIds) {
88   - this.lpIds = lpIds;
89   - }
90   -
91   - public String getLpNames() {
92   - return lpNames;
93   - }
94   -
95   - public void setLpNames(String lpNames) {
96   - this.lpNames = lpNames;
97   - }
98   -
99   - public String getEcIds() {
100   - return ecIds;
101   - }
102   -
103   - public void setEcIds(String ecIds) {
104   - this.ecIds = ecIds;
105   - }
106   -
107   - public String getEcDbbms() {
108   - return ecDbbms;
109   - }
110   -
111   - public void setEcDbbms(String ecDbbms) {
112   - this.ecDbbms = ecDbbms;
113   - }
114   -
115   - public Integer getLpStartIndex() {
116   - return lpStartIndex;
117   - }
118   -
119   - public void setLpStartIndex(Integer lpStartIndex) {
120   - this.lpStartIndex = lpStartIndex;
121   - }
122   -
123   - public Integer getEcStartIndex() {
124   - return ecStartIndex;
125   - }
126   -
127   - public void setEcStartIndex(Integer ecStartIndex) {
128   - this.ecStartIndex = ecStartIndex;
129   - }
130   -
131   - public Long getRuleId() {
132   - return ruleId;
133   - }
134   -
135   - public void setRuleId(Long ruleId) {
136   - this.ruleId = ruleId;
137   - }
138   -
139   - public Date getQyrq() {
140   - return qyrq;
141   - }
142   -
143   - public void setQyrq(Date qyrq) {
144   - this.qyrq = qyrq;
145   - }
146   -
147   - public Map<String, CarConfigInfo> getCcInfos() {
148   - return ccInfos;
149   - }
150   -
151   - public void setCcInfos(Map<String, CarConfigInfo> ccInfos) {
152   - this.ccInfos = ccInfos;
153   - }
154   -
155   - public Map<Long, GuideboardInfo> getLpInfos() {
156   - return lpInfos;
157   - }
158   -
159   - public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) {
160   - this.lpInfos = lpInfos;
161   - }
162   -
163   - public Map<Long, EmployeeConfigInfo> getEcInfos() {
164   - return ecInfos;
165   - }
166   -
167   - public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) {
168   - this.ecInfos = ecInfos;
169   - }
170   -}
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  7 +import org.springframework.util.CollectionUtils;
  8 +
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * 聚合输入的待判定数据。
  13 + */
  14 +public class WrapInput {
  15 + /** 线路Id */
  16 + private Integer xlId;
  17 + /** 车辆自编号 */
  18 + private String clZbh;
  19 + /** 路牌id列表 */
  20 + private String lpIds;
  21 + /** 路牌名字列表 */
  22 + private String lpNames;
  23 + /** 人员配置列表 */
  24 + private String ecIds;
  25 + /** 人员搭班编码列表 */
  26 + private String ecDbbms;
  27 + /** 路牌循环起始索引 */
  28 + private Integer lpStartIndex;
  29 + /** 人员循环起始索引 */
  30 + private Integer ecStartIndex;
  31 + /** 规则id */
  32 + private Long ruleId;
  33 + /** 启用日期 */
  34 + private Date qyrq;
  35 +
  36 + private Map<String, CarConfigInfo> ccInfos = new HashMap<>();
  37 + private Map<Long, GuideboardInfo> lpInfos = new HashMap<>();
  38 + private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>();
  39 +
  40 + public WrapInput(ScheduleRule1Flat r,
  41 + Map<String, CarConfigInfo> cc,
  42 + Map<Long, GuideboardInfo> lp,
  43 + Map<Long, EmployeeConfigInfo> ec) {
  44 + this.xlId = r.getXl().getId();
  45 + this.clZbh = r.getCarConfigInfo().getCl().getInsideCode();
  46 + this.lpIds = r.getLpIds();
  47 + this.lpNames = r.getLpNames();
  48 + this.ecIds = r.getRyConfigIds();
  49 + this.ecDbbms = r.getRyDbbms();
  50 + this.lpStartIndex = r.getLpStart();
  51 + this.ecStartIndex = r.getRyStart();
  52 + this.ruleId = r.getId();
  53 + this.qyrq = r.getQyrq();
  54 +
  55 + if (!CollectionUtils.isEmpty(cc)) {
  56 + this.ccInfos.putAll(cc);
  57 + }
  58 + if (!CollectionUtils.isEmpty(lp)) {
  59 + this.lpInfos.putAll(lp);
  60 + }
  61 + if (!CollectionUtils.isEmpty(ec)) {
  62 + this.ecInfos.putAll(ec);
  63 + }
  64 +
  65 + }
  66 +
  67 + public Integer getXlId() {
  68 + return xlId;
  69 + }
  70 +
  71 + public void setXlId(Integer xlId) {
  72 + this.xlId = xlId;
  73 + }
  74 +
  75 + public String getClZbh() {
  76 + return clZbh;
  77 + }
  78 +
  79 + public void setClZbh(String clZbh) {
  80 + this.clZbh = clZbh;
  81 + }
  82 +
  83 + public String getLpIds() {
  84 + return lpIds;
  85 + }
  86 +
  87 + public void setLpIds(String lpIds) {
  88 + this.lpIds = lpIds;
  89 + }
  90 +
  91 + public String getLpNames() {
  92 + return lpNames;
  93 + }
  94 +
  95 + public void setLpNames(String lpNames) {
  96 + this.lpNames = lpNames;
  97 + }
  98 +
  99 + public String getEcIds() {
  100 + return ecIds;
  101 + }
  102 +
  103 + public void setEcIds(String ecIds) {
  104 + this.ecIds = ecIds;
  105 + }
  106 +
  107 + public String getEcDbbms() {
  108 + return ecDbbms;
  109 + }
  110 +
  111 + public void setEcDbbms(String ecDbbms) {
  112 + this.ecDbbms = ecDbbms;
  113 + }
  114 +
  115 + public Integer getLpStartIndex() {
  116 + return lpStartIndex;
  117 + }
  118 +
  119 + public void setLpStartIndex(Integer lpStartIndex) {
  120 + this.lpStartIndex = lpStartIndex;
  121 + }
  122 +
  123 + public Integer getEcStartIndex() {
  124 + return ecStartIndex;
  125 + }
  126 +
  127 + public void setEcStartIndex(Integer ecStartIndex) {
  128 + this.ecStartIndex = ecStartIndex;
  129 + }
  130 +
  131 + public Long getRuleId() {
  132 + return ruleId;
  133 + }
  134 +
  135 + public void setRuleId(Long ruleId) {
  136 + this.ruleId = ruleId;
  137 + }
  138 +
  139 + public Date getQyrq() {
  140 + return qyrq;
  141 + }
  142 +
  143 + public void setQyrq(Date qyrq) {
  144 + this.qyrq = qyrq;
  145 + }
  146 +
  147 + public Map<String, CarConfigInfo> getCcInfos() {
  148 + return ccInfos;
  149 + }
  150 +
  151 + public void setCcInfos(Map<String, CarConfigInfo> ccInfos) {
  152 + this.ccInfos = ccInfos;
  153 + }
  154 +
  155 + public Map<Long, GuideboardInfo> getLpInfos() {
  156 + return lpInfos;
  157 + }
  158 +
  159 + public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) {
  160 + this.lpInfos = lpInfos;
  161 + }
  162 +
  163 + public Map<Long, EmployeeConfigInfo> getEcInfos() {
  164 + return ecInfos;
  165 + }
  166 +
  167 + public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) {
  168 + this.ecInfos = ecInfos;
  169 + }
  170 +}
... ...
src/main/resources/datatools/ktrs/carsDataOutput.ktr
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<transformation>
3   - <info>
4   - <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</name>
5   - <description>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</description>
6   - <extended_description>&#x8f66;&#x8f86;&#x57fa;&#x7840;&#x4fe1;&#x606f;</extended_description>
7   - <trans_version/>
8   - <trans_type>Normal</trans_type>
9   - <trans_status>0</trans_status>
10   - <directory>&#x2f;</directory>
11   - <parameters>
12   - <parameter>
13   - <name>QUERY</name>
14   - <default_value/>
15   - <description>&#x67e5;&#x8be2;</description>
16   - </parameter>
17   - <parameter>
18   - <name>cgsbm_in</name>
19   - <default_value/>
20   - <description>&#x5206;&#x516c;&#x53f8;&#x7f16;&#x7801;</description>
21   - </parameter>
22   - <parameter>
23   - <name>filepath</name>
24   - <default_value>1&#x3d;1</default_value>
25   - <description>excel&#x6587;&#x4ef6;&#x8def;&#x5f84;</description>
26   - </parameter>
27   - </parameters>
28   - <log>
29   -<trans-log-table><connection/>
30   -<schema/>
31   -<table/>
32   -<size_limit_lines/>
33   -<interval/>
34   -<timeout_days/>
35   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field><field><id>EXECUTING_SERVER</id><enabled>N</enabled><name>EXECUTING_SERVER</name></field><field><id>EXECUTING_USER</id><enabled>N</enabled><name>EXECUTING_USER</name></field><field><id>CLIENT</id><enabled>N</enabled><name>CLIENT</name></field></trans-log-table>
36   -<perf-log-table><connection/>
37   -<schema/>
38   -<table/>
39   -<interval/>
40   -<timeout_days/>
41   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
42   -<channel-log-table><connection/>
43   -<schema/>
44   -<table/>
45   -<timeout_days/>
46   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
47   -<step-log-table><connection/>
48   -<schema/>
49   -<table/>
50   -<timeout_days/>
51   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
52   -<metrics-log-table><connection/>
53   -<schema/>
54   -<table/>
55   -<timeout_days/>
56   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>METRICS_DATE</id><enabled>Y</enabled><name>METRICS_DATE</name></field><field><id>METRICS_CODE</id><enabled>Y</enabled><name>METRICS_CODE</name></field><field><id>METRICS_DESCRIPTION</id><enabled>Y</enabled><name>METRICS_DESCRIPTION</name></field><field><id>METRICS_SUBJECT</id><enabled>Y</enabled><name>METRICS_SUBJECT</name></field><field><id>METRICS_TYPE</id><enabled>Y</enabled><name>METRICS_TYPE</name></field><field><id>METRICS_VALUE</id><enabled>Y</enabled><name>METRICS_VALUE</name></field></metrics-log-table>
57   - </log>
58   - <maxdate>
59   - <connection/>
60   - <table/>
61   - <field/>
62   - <offset>0.0</offset>
63   - <maxdiff>0.0</maxdiff>
64   - </maxdate>
65   - <size_rowset>10000</size_rowset>
66   - <sleep_time_empty>50</sleep_time_empty>
67   - <sleep_time_full>50</sleep_time_full>
68   - <unique_connections>N</unique_connections>
69   - <feedback_shown>Y</feedback_shown>
70   - <feedback_size>50000</feedback_size>
71   - <using_thread_priorities>Y</using_thread_priorities>
72   - <shared_objects_file/>
73   - <capture_step_performance>N</capture_step_performance>
74   - <step_performance_capturing_delay>1000</step_performance_capturing_delay>
75   - <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
76   - <dependencies>
77   - </dependencies>
78   - <partitionschemas>
79   - </partitionschemas>
80   - <slaveservers>
81   - </slaveservers>
82   - <clusterschemas>
83   - </clusterschemas>
84   - <created_user>-</created_user>
85   - <created_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</created_date>
86   - <modified_user>-</modified_user>
87   - <modified_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</modified_date>
88   - <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA&#x3d;</key_for_session_key>
89   - <is_key_private>N</is_key_private>
90   - </info>
91   - <notepads>
92   - </notepads>
93   - <connection>
94   - <name>192.168.168.1_jwgl_dw</name>
95   - <server>192.168.168.1</server>
96   - <type>ORACLE</type>
97   - <access>Native</access>
98   - <database>orcl</database>
99   - <port>1521</port>
100   - <username>jwgl_dw</username>
101   - <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password>
102   - <servername/>
103   - <data_tablespace/>
104   - <index_tablespace/>
105   - <attributes>
106   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
107   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
108   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
109   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
110   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
111   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
112   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
113   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
114   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
115   - </attributes>
116   - </connection>
117   - <connection>
118   - <name>bus_control_variable</name>
119   - <server>&#x24;&#x7b;v_db_ip&#x7d;</server>
120   - <type>MYSQL</type>
121   - <access>Native</access>
122   - <database>&#x24;&#x7b;v_db_dname&#x7d;</database>
123   - <port>3306</port>
124   - <username>&#x24;&#x7b;v_db_uname&#x7d;</username>
125   - <password>&#x24;&#x7b;v_db_pwd&#x7d;</password>
126   - <servername/>
127   - <data_tablespace/>
128   - <index_tablespace/>
129   - <attributes>
130   - <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
131   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
132   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
133   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
134   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
135   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
136   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
137   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
138   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
139   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
140   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
141   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
142   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
143   - </attributes>
144   - </connection>
145   - <connection>
146   - <name>bus_control_&#x516c;&#x53f8;_201</name>
147   - <server>localhost</server>
148   - <type>MYSQL</type>
149   - <access>Native</access>
150   - <database>control</database>
151   - <port>3306</port>
152   - <username>root</username>
153   - <password>Encrypted </password>
154   - <servername/>
155   - <data_tablespace/>
156   - <index_tablespace/>
157   - <attributes>
158   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
159   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
160   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
161   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
162   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
163   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
164   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
165   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
166   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
167   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
168   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
169   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
170   - </attributes>
171   - </connection>
172   - <connection>
173   - <name>bus_control_&#x672c;&#x673a;</name>
174   - <server>localhost</server>
175   - <type>MYSQL</type>
176   - <access>Native</access>
177   - <database>control</database>
178   - <port>3306</port>
179   - <username>root</username>
180   - <password>Encrypted </password>
181   - <servername/>
182   - <data_tablespace/>
183   - <index_tablespace/>
184   - <attributes>
185   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
186   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
187   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
188   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
189   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
190   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
191   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
192   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
193   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
194   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
195   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
196   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
197   - </attributes>
198   - </connection>
199   - <connection>
200   - <name>JGJW_VM</name>
201   - <server>192.168.198.240</server>
202   - <type>ORACLE</type>
203   - <access>Native</access>
204   - <database>orcl</database>
205   - <port>1521</port>
206   - <username>jwgl</username>
207   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
208   - <servername/>
209   - <data_tablespace/>
210   - <index_tablespace/>
211   - <attributes>
212   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
213   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
214   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
215   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
216   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
217   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
218   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
219   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
220   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
221   - </attributes>
222   - </connection>
223   - <connection>
224   - <name>NHJW_VM</name>
225   - <server>192.168.198.240</server>
226   - <type>ORACLE</type>
227   - <access>Native</access>
228   - <database>orcl</database>
229   - <port>1521</port>
230   - <username>nhjw</username>
231   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10d09aa5cd</password>
232   - <servername/>
233   - <data_tablespace/>
234   - <index_tablespace/>
235   - <attributes>
236   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
237   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
238   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
239   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
240   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
241   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
242   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
243   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
244   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
245   - </attributes>
246   - </connection>
247   - <connection>
248   - <name>PDGJ_VM</name>
249   - <server>192.168.198.240</server>
250   - <type>ORACLE</type>
251   - <access>Native</access>
252   - <database>orcl</database>
253   - <port>1521</port>
254   - <username>pdgj</username>
255   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10ce96a8d0</password>
256   - <servername/>
257   - <data_tablespace/>
258   - <index_tablespace/>
259   - <attributes>
260   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
261   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
262   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
263   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
264   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
265   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
266   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
267   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
268   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
269   - </attributes>
270   - </connection>
271   - <connection>
272   - <name>SNJW_VM</name>
273   - <server>192.168.198.240</server>
274   - <type>ORACLE</type>
275   - <access>Native</access>
276   - <database>orcl</database>
277   - <port>1521</port>
278   - <username>snjw</username>
279   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
280   - <servername/>
281   - <data_tablespace/>
282   - <index_tablespace/>
283   - <attributes>
284   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
285   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
286   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
287   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
288   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
289   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
290   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
291   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
292   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
293   - </attributes>
294   - </connection>
295   - <connection>
296   - <name>xlab_mysql_youle</name>
297   - <server>101.231.124.8</server>
298   - <type>MYSQL</type>
299   - <access>Native</access>
300   - <database>xlab_youle</database>
301   - <port>45687</port>
302   - <username>xlab-youle</username>
303   - <password>Encrypted 2be98afc86aa78a88aa1be369d187a3df</password>
304   - <servername/>
305   - <data_tablespace/>
306   - <index_tablespace/>
307   - <attributes>
308   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
309   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
310   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
311   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
312   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
313   - <attribute><code>PORT_NUMBER</code><attribute>45687</attribute></attribute>
314   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
315   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
316   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
317   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
318   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
319   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
320   - </attributes>
321   - </connection>
322   - <connection>
323   - <name>xlab_mysql_youle&#xff08;&#x672c;&#x673a;&#xff09;</name>
324   - <server>localhost</server>
325   - <type>MYSQL</type>
326   - <access>Native</access>
327   - <database>xlab_youle</database>
328   - <port>3306</port>
329   - <username>root</username>
330   - <password>Encrypted </password>
331   - <servername/>
332   - <data_tablespace/>
333   - <index_tablespace/>
334   - <attributes>
335   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
336   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
337   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
338   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
339   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
340   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
341   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
342   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
343   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
344   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
345   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
346   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
347   - </attributes>
348   - </connection>
349   - <connection>
350   - <name>xlab_youle</name>
351   - <server/>
352   - <type>MYSQL</type>
353   - <access>JNDI</access>
354   - <database>xlab_youle</database>
355   - <port>1521</port>
356   - <username/>
357   - <password>Encrypted </password>
358   - <servername/>
359   - <data_tablespace/>
360   - <index_tablespace/>
361   - <attributes>
362   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
363   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
364   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
365   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
366   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
367   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
368   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
369   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
370   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
371   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
372   - </attributes>
373   - </connection>
374   - <connection>
375   - <name>YGJW_VM</name>
376   - <server>192.168.198.240</server>
377   - <type>ORACLE</type>
378   - <access>Native</access>
379   - <database>orcl</database>
380   - <port>1521</port>
381   - <username>ygjw</username>
382   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
383   - <servername/>
384   - <data_tablespace/>
385   - <index_tablespace/>
386   - <attributes>
387   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
388   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
389   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
390   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
391   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
392   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
393   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
394   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
395   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
396   - </attributes>
397   - </connection>
398   - <connection>
399   - <name>&#x516c;&#x53f8;jgjw</name>
400   - <server>192.168.168.1</server>
401   - <type>ORACLE</type>
402   - <access>Native</access>
403   - <database>orcl</database>
404   - <port>1521</port>
405   - <username>jwgl</username>
406   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
407   - <servername/>
408   - <data_tablespace/>
409   - <index_tablespace/>
410   - <attributes>
411   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
412   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
413   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
414   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
415   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
416   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
417   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
418   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
419   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
420   - </attributes>
421   - </connection>
422   - <connection>
423   - <name>&#x516c;&#x53f8;snjw</name>
424   - <server>192.168.168.1</server>
425   - <type>ORACLE</type>
426   - <access>Native</access>
427   - <database>orcl</database>
428   - <port>1521</port>
429   - <username>snjw</username>
430   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
431   - <servername/>
432   - <data_tablespace/>
433   - <index_tablespace/>
434   - <attributes>
435   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
436   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
437   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
438   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
439   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
440   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
441   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
442   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
443   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
444   - </attributes>
445   - </connection>
446   - <connection>
447   - <name>&#x516c;&#x53f8;ygjw</name>
448   - <server>192.168.168.1</server>
449   - <type>ORACLE</type>
450   - <access>Native</access>
451   - <database>orcl</database>
452   - <port>1521</port>
453   - <username>ygjw</username>
454   - <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
455   - <servername/>
456   - <data_tablespace/>
457   - <index_tablespace/>
458   - <attributes>
459   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
460   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
461   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
462   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
463   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
464   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
465   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
466   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
467   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
468   - </attributes>
469   - </connection>
470   - <order>
471   - <hop> <from>&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
472   - <hop> <from>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</to><enabled>Y</enabled> </hop>
473   - <hop> <from>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</from><to>&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
474   - <hop> <from>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</from><to>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</to><enabled>Y</enabled> </hop>
475   - <hop> <from>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</from><to>&#x662f;&#x5426;&#x7535;&#x8f66;</to><enabled>Y</enabled> </hop>
476   - <hop> <from>&#x662f;&#x5426;&#x7535;&#x8f66;</from><to>Excel&#x8f93;&#x51fa;</to><enabled>Y</enabled> </hop>
477   - </order>
478   - <step>
479   - <name>Excel&#x8f93;&#x51fa;</name>
480   - <type>ExcelOutput</type>
481   - <description/>
482   - <distribute>Y</distribute>
483   - <custom_distribution/>
484   - <copies>1</copies>
485   - <partitioning>
486   - <method>none</method>
487   - <schema_name/>
488   - </partitioning>
489   - <header>Y</header>
490   - <footer>N</footer>
491   - <encoding/>
492   - <append>N</append>
493   - <add_to_result_filenames>Y</add_to_result_filenames>
494   - <file>
495   - <name>&#x24;&#x7b;filepath&#x7d;</name>
496   - <extention>xls</extention>
497   - <do_not_open_newfile_init>N</do_not_open_newfile_init>
498   - <create_parent_folder>N</create_parent_folder>
499   - <split>N</split>
500   - <add_date>N</add_date>
501   - <add_time>N</add_time>
502   - <SpecifyFormat>N</SpecifyFormat>
503   - <date_time_format>yyyyMMddHHmmss</date_time_format>
504   - <sheetname>&#x5de5;&#x4f5c;&#x8868;1</sheetname>
505   - <autosizecolums>N</autosizecolums>
506   - <nullisblank>N</nullisblank>
507   - <protect_sheet>N</protect_sheet>
508   - <password>Encrypted </password>
509   - <splitevery>0</splitevery>
510   - <usetempfiles>N</usetempfiles>
511   - <tempdirectory/>
512   - </file>
513   - <template>
514   - <enabled>N</enabled>
515   - <append>N</append>
516   - <filename>template.xls</filename>
517   - </template>
518   - <fields>
519   - <field>
520   - <name>&#x8f66;&#x724c;&#x53f7;</name>
521   - <type>String</type>
522   - <format/>
523   - </field>
524   - <field>
525   - <name>&#x5185;&#x90e8;&#x7f16;&#x7801;</name>
526   - <type>String</type>
527   - <format/>
528   - </field>
529   - <field>
530   - <name>&#x6240;&#x5c5e;&#x516c;&#x53f8;</name>
531   - <type>String</type>
532   - <format/>
533   - </field>
534   - <field>
535   - <name>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</name>
536   - <type>String</type>
537   - <format/>
538   - </field>
539   - <field>
540   - <name>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</name>
541   - <type>String</type>
542   - <format/>
543   - </field>
544   - <field>
545   - <name>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</name>
546   - <type>String</type>
547   - <format/>
548   - </field>
549   - <field>
550   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
551   - <type>String</type>
552   - <format/>
553   - </field>
554   - </fields>
555   - <custom>
556   - <header_font_name>arial</header_font_name>
557   - <header_font_size>10</header_font_size>
558   - <header_font_bold>N</header_font_bold>
559   - <header_font_italic>N</header_font_italic>
560   - <header_font_underline>no</header_font_underline>
561   - <header_font_orientation>horizontal</header_font_orientation>
562   - <header_font_color>black</header_font_color>
563   - <header_background_color>none</header_background_color>
564   - <header_row_height>255</header_row_height>
565   - <header_alignment>left</header_alignment>
566   - <header_image/>
567   - <row_font_name>arial</row_font_name>
568   - <row_font_size>10</row_font_size>
569   - <row_font_color>black</row_font_color>
570   - <row_background_color>none</row_background_color>
571   - </custom>
572   - <cluster_schema/>
573   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
574   - <xloc>498</xloc>
575   - <yloc>348</yloc>
576   - <draw>Y</draw>
577   - </GUI>
578   - </step>
579   -
580   - <step>
581   - <name>&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
582   - <type>DBLookup</type>
583   - <description/>
584   - <distribute>Y</distribute>
585   - <custom_distribution/>
586   - <copies>1</copies>
587   - <partitioning>
588   - <method>none</method>
589   - <schema_name/>
590   - </partitioning>
591   - <connection>bus_control_variable</connection>
592   - <cache>N</cache>
593   - <cache_load_all>N</cache_load_all>
594   - <cache_size>0</cache_size>
595   - <lookup>
596   - <schema/>
597   - <table>bsth_c_business</table>
598   - <orderby/>
599   - <fail_on_multiple>N</fail_on_multiple>
600   - <eat_row_on_failure>N</eat_row_on_failure>
601   - <key>
602   - <name>up_code</name>
603   - <field>up_code</field>
604   - <condition>&#x3d;</condition>
605   - <name2/>
606   - </key>
607   - <key>
608   - <name>business_code</name>
609   - <field>business_code</field>
610   - <condition>&#x3d;</condition>
611   - <name2/>
612   - </key>
613   - <value>
614   - <name>business_name</name>
615   - <rename>gs</rename>
616   - <default/>
617   - <type>String</type>
618   - </value>
619   - </lookup>
620   - <cluster_schema/>
621   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
622   - <xloc>364</xloc>
623   - <yloc>60</yloc>
624   - <draw>Y</draw>
625   - </GUI>
626   - </step>
627   -
628   - <step>
629   - <name>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
630   - <type>DBLookup</type>
631   - <description/>
632   - <distribute>Y</distribute>
633   - <custom_distribution/>
634   - <copies>1</copies>
635   - <partitioning>
636   - <method>none</method>
637   - <schema_name/>
638   - </partitioning>
639   - <connection>bus_control_variable</connection>
640   - <cache>N</cache>
641   - <cache_load_all>N</cache_load_all>
642   - <cache_size>0</cache_size>
643   - <lookup>
644   - <schema/>
645   - <table>bsth_c_business</table>
646   - <orderby/>
647   - <fail_on_multiple>N</fail_on_multiple>
648   - <eat_row_on_failure>N</eat_row_on_failure>
649   - <key>
650   - <name>business_code</name>
651   - <field>up_code</field>
652   - <condition>&#x3d;</condition>
653   - <name2/>
654   - </key>
655   - <key>
656   - <name>branche_company_code</name>
657   - <field>business_code</field>
658   - <condition>&#x3d;</condition>
659   - <name2/>
660   - </key>
661   - <value>
662   - <name>business_name</name>
663   - <rename>fgs</rename>
664   - <default/>
665   - <type>String</type>
666   - </value>
667   - </lookup>
668   - <cluster_schema/>
669   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
670   - <xloc>491</xloc>
671   - <yloc>60</yloc>
672   - <draw>Y</draw>
673   - </GUI>
674   - </step>
675   -
676   - <step>
677   - <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
678   - <type>SelectValues</type>
679   - <description/>
680   - <distribute>N</distribute>
681   - <custom_distribution/>
682   - <copies>1</copies>
683   - <partitioning>
684   - <method>none</method>
685   - <schema_name/>
686   - </partitioning>
687   - <fields> <field> <name>car_plate</name>
688   - <rename>&#x8f66;&#x724c;&#x53f7;</rename>
689   - <length>-2</length>
690   - <precision>-2</precision>
691   - </field> <field> <name>inside_code</name>
692   - <rename>&#x5185;&#x90e8;&#x7f16;&#x7801;</rename>
693   - <length>-2</length>
694   - <precision>-2</precision>
695   - </field> <field> <name>gs</name>
696   - <rename>&#x6240;&#x5c5e;&#x516c;&#x53f8;</rename>
697   - <length>-2</length>
698   - <precision>-2</precision>
699   - </field> <field> <name>fgs</name>
700   - <rename>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</rename>
701   - <length>-2</length>
702   - <precision>-2</precision>
703   - </field> <field> <name>supplier_name</name>
704   - <rename>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</rename>
705   - <length>-2</length>
706   - <precision>-2</precision>
707   - </field> <field> <name>equipment_code</name>
708   - <rename>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</rename>
709   - <length>-2</length>
710   - <precision>-2</precision>
711   - </field> <field> <name>sfdc</name>
712   - <rename>sfdc_cal</rename>
713   - <length>-2</length>
714   - <precision>-2</precision>
715   - </field> <select_unspecified>N</select_unspecified>
716   - </fields> <cluster_schema/>
717   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
718   - <xloc>495</xloc>
719   - <yloc>173</yloc>
720   - <draw>Y</draw>
721   - </GUI>
722   - </step>
723   -
724   - <step>
725   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
726   - <type>ScriptValueMod</type>
727   - <description/>
728   - <distribute>Y</distribute>
729   - <custom_distribution/>
730   - <copies>1</copies>
731   - <partitioning>
732   - <method>none</method>
733   - <schema_name/>
734   - </partitioning>
735   - <compatible>N</compatible>
736   - <optimizationLevel>9</optimizationLevel>
737   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
738   - <jsScript_name>Script 1</jsScript_name>
739   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#xa;if&#x28;sfdc_cal &#x3d;&#x3d; 0&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d; else if &#x28;sfdc_cal &#x3d;&#x3d; 1&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x662f;&#x22;&#x3b;&#xa;&#x7d; else &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
740   - </jsScript> </jsScripts> <fields> <field> <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
741   - <rename>&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
742   - <type>String</type>
743   - <length>-1</length>
744   - <precision>-1</precision>
745   - <replace>N</replace>
746   - </field> </fields> <cluster_schema/>
747   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
748   - <xloc>695</xloc>
749   - <yloc>173</yloc>
750   - <draw>Y</draw>
751   - </GUI>
752   - </step>
753   -
754   - <step>
755   - <name>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</name>
756   - <type>ScriptValueMod</type>
757   - <description/>
758   - <distribute>Y</distribute>
759   - <custom_distribution/>
760   - <copies>1</copies>
761   - <partitioning>
762   - <method>none</method>
763   - <schema_name/>
764   - </partitioning>
765   - <compatible>N</compatible>
766   - <optimizationLevel>9</optimizationLevel>
767   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
768   - <jsScript_name>Script 1</jsScript_name>
769   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var up_code &#x3d; &#x27;88&#x27;&#x3b;</jsScript_script>
770   - </jsScript> </jsScripts> <fields> <field> <name>up_code</name>
771   - <rename>up_code</rename>
772   - <type>String</type>
773   - <length>-1</length>
774   - <precision>-1</precision>
775   - <replace>N</replace>
776   - </field> </fields> <cluster_schema/>
777   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
778   - <xloc>227</xloc>
779   - <yloc>59</yloc>
780   - <draw>Y</draw>
781   - </GUI>
782   - </step>
783   -
784   - <step>
785   - <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</name>
786   - <type>TableInput</type>
787   - <description/>
788   - <distribute>Y</distribute>
789   - <custom_distribution/>
790   - <copies>1</copies>
791   - <partitioning>
792   - <method>none</method>
793   - <schema_name/>
794   - </partitioning>
795   - <connection>bus_control_variable</connection>
796   - <sql>SELECT &#x2a; FROM bsth_c_cars&#xa;where &#x24;&#x7b;QUERY&#x7d;</sql>
797   - <limit>0</limit>
798   - <lookup/>
799   - <execute_each_row>N</execute_each_row>
800   - <variables_active>Y</variables_active>
801   - <lazy_conversion_active>N</lazy_conversion_active>
802   - <cluster_schema/>
803   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
804   - <xloc>88</xloc>
805   - <yloc>59</yloc>
806   - <draw>Y</draw>
807   - </GUI>
808   - </step>
809   -
810   - <step_error_handling>
811   - </step_error_handling>
812   - <slave-step-copy-partition-distribution>
813   -</slave-step-copy-partition-distribution>
814   - <slave_transformation>N</slave_transformation>
815   -
816   -</transformation>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<transformation>
  3 + <info>
  4 + <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</name>
  5 + <description>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</description>
  6 + <extended_description>&#x8f66;&#x8f86;&#x57fa;&#x7840;&#x4fe1;&#x606f;</extended_description>
  7 + <trans_version/>
  8 + <trans_type>Normal</trans_type>
  9 + <trans_status>0</trans_status>
  10 + <directory>&#x2f;</directory>
  11 + <parameters>
  12 + <parameter>
  13 + <name>QUERY</name>
  14 + <default_value/>
  15 + <description>&#x67e5;&#x8be2;</description>
  16 + </parameter>
  17 + <parameter>
  18 + <name>cgsbm_in</name>
  19 + <default_value/>
  20 + <description>&#x5206;&#x516c;&#x53f8;&#x7f16;&#x7801;</description>
  21 + </parameter>
  22 + <parameter>
  23 + <name>filepath</name>
  24 + <default_value>1&#x3d;1</default_value>
  25 + <description>excel&#x6587;&#x4ef6;&#x8def;&#x5f84;</description>
  26 + </parameter>
  27 + </parameters>
  28 + <log>
  29 +<trans-log-table><connection/>
  30 +<schema/>
  31 +<table/>
  32 +<size_limit_lines/>
  33 +<interval/>
  34 +<timeout_days/>
  35 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field><field><id>EXECUTING_SERVER</id><enabled>N</enabled><name>EXECUTING_SERVER</name></field><field><id>EXECUTING_USER</id><enabled>N</enabled><name>EXECUTING_USER</name></field><field><id>CLIENT</id><enabled>N</enabled><name>CLIENT</name></field></trans-log-table>
  36 +<perf-log-table><connection/>
  37 +<schema/>
  38 +<table/>
  39 +<interval/>
  40 +<timeout_days/>
  41 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
  42 +<channel-log-table><connection/>
  43 +<schema/>
  44 +<table/>
  45 +<timeout_days/>
  46 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
  47 +<step-log-table><connection/>
  48 +<schema/>
  49 +<table/>
  50 +<timeout_days/>
  51 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
  52 +<metrics-log-table><connection/>
  53 +<schema/>
  54 +<table/>
  55 +<timeout_days/>
  56 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>METRICS_DATE</id><enabled>Y</enabled><name>METRICS_DATE</name></field><field><id>METRICS_CODE</id><enabled>Y</enabled><name>METRICS_CODE</name></field><field><id>METRICS_DESCRIPTION</id><enabled>Y</enabled><name>METRICS_DESCRIPTION</name></field><field><id>METRICS_SUBJECT</id><enabled>Y</enabled><name>METRICS_SUBJECT</name></field><field><id>METRICS_TYPE</id><enabled>Y</enabled><name>METRICS_TYPE</name></field><field><id>METRICS_VALUE</id><enabled>Y</enabled><name>METRICS_VALUE</name></field></metrics-log-table>
  57 + </log>
  58 + <maxdate>
  59 + <connection/>
  60 + <table/>
  61 + <field/>
  62 + <offset>0.0</offset>
  63 + <maxdiff>0.0</maxdiff>
  64 + </maxdate>
  65 + <size_rowset>10000</size_rowset>
  66 + <sleep_time_empty>50</sleep_time_empty>
  67 + <sleep_time_full>50</sleep_time_full>
  68 + <unique_connections>N</unique_connections>
  69 + <feedback_shown>Y</feedback_shown>
  70 + <feedback_size>50000</feedback_size>
  71 + <using_thread_priorities>Y</using_thread_priorities>
  72 + <shared_objects_file/>
  73 + <capture_step_performance>N</capture_step_performance>
  74 + <step_performance_capturing_delay>1000</step_performance_capturing_delay>
  75 + <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
  76 + <dependencies>
  77 + </dependencies>
  78 + <partitionschemas>
  79 + </partitionschemas>
  80 + <slaveservers>
  81 + </slaveservers>
  82 + <clusterschemas>
  83 + </clusterschemas>
  84 + <created_user>-</created_user>
  85 + <created_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</created_date>
  86 + <modified_user>-</modified_user>
  87 + <modified_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</modified_date>
  88 + <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA&#x3d;</key_for_session_key>
  89 + <is_key_private>N</is_key_private>
  90 + </info>
  91 + <notepads>
  92 + </notepads>
  93 + <connection>
  94 + <name>192.168.168.1_jwgl_dw</name>
  95 + <server>192.168.168.1</server>
  96 + <type>ORACLE</type>
  97 + <access>Native</access>
  98 + <database>orcl</database>
  99 + <port>1521</port>
  100 + <username>jwgl_dw</username>
  101 + <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password>
  102 + <servername/>
  103 + <data_tablespace/>
  104 + <index_tablespace/>
  105 + <attributes>
  106 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  107 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  108 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  109 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  110 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  111 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  112 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  113 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  114 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  115 + </attributes>
  116 + </connection>
  117 + <connection>
  118 + <name>bus_control_variable</name>
  119 + <server>&#x24;&#x7b;v_db_ip&#x7d;</server>
  120 + <type>MYSQL</type>
  121 + <access>Native</access>
  122 + <database>&#x24;&#x7b;v_db_dname&#x7d;</database>
  123 + <port>3306</port>
  124 + <username>&#x24;&#x7b;v_db_uname&#x7d;</username>
  125 + <password>&#x24;&#x7b;v_db_pwd&#x7d;</password>
  126 + <servername/>
  127 + <data_tablespace/>
  128 + <index_tablespace/>
  129 + <attributes>
  130 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
  131 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  132 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  133 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  134 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  135 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  136 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  137 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  138 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  139 + <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
  140 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  141 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  142 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  143 + </attributes>
  144 + </connection>
  145 + <connection>
  146 + <name>bus_control_&#x516c;&#x53f8;_201</name>
  147 + <server>localhost</server>
  148 + <type>MYSQL</type>
  149 + <access>Native</access>
  150 + <database>control</database>
  151 + <port>3306</port>
  152 + <username>root</username>
  153 + <password>Encrypted </password>
  154 + <servername/>
  155 + <data_tablespace/>
  156 + <index_tablespace/>
  157 + <attributes>
  158 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  159 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  160 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  161 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  162 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  163 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  164 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  165 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  166 + <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
  167 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  168 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  169 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  170 + </attributes>
  171 + </connection>
  172 + <connection>
  173 + <name>bus_control_&#x672c;&#x673a;</name>
  174 + <server>localhost</server>
  175 + <type>MYSQL</type>
  176 + <access>Native</access>
  177 + <database>control</database>
  178 + <port>3306</port>
  179 + <username>root</username>
  180 + <password>Encrypted </password>
  181 + <servername/>
  182 + <data_tablespace/>
  183 + <index_tablespace/>
  184 + <attributes>
  185 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  186 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  187 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  188 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  189 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  190 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  191 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  192 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  193 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  194 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  195 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  196 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  197 + </attributes>
  198 + </connection>
  199 + <connection>
  200 + <name>JGJW_VM</name>
  201 + <server>192.168.198.240</server>
  202 + <type>ORACLE</type>
  203 + <access>Native</access>
  204 + <database>orcl</database>
  205 + <port>1521</port>
  206 + <username>jwgl</username>
  207 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
  208 + <servername/>
  209 + <data_tablespace/>
  210 + <index_tablespace/>
  211 + <attributes>
  212 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  213 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  214 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  215 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  216 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  217 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  218 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  219 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  220 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  221 + </attributes>
  222 + </connection>
  223 + <connection>
  224 + <name>NHJW_VM</name>
  225 + <server>192.168.198.240</server>
  226 + <type>ORACLE</type>
  227 + <access>Native</access>
  228 + <database>orcl</database>
  229 + <port>1521</port>
  230 + <username>nhjw</username>
  231 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d09aa5cd</password>
  232 + <servername/>
  233 + <data_tablespace/>
  234 + <index_tablespace/>
  235 + <attributes>
  236 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  237 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  238 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  239 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  240 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  241 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  242 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  243 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  244 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  245 + </attributes>
  246 + </connection>
  247 + <connection>
  248 + <name>PDGJ_VM</name>
  249 + <server>192.168.198.240</server>
  250 + <type>ORACLE</type>
  251 + <access>Native</access>
  252 + <database>orcl</database>
  253 + <port>1521</port>
  254 + <username>pdgj</username>
  255 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10ce96a8d0</password>
  256 + <servername/>
  257 + <data_tablespace/>
  258 + <index_tablespace/>
  259 + <attributes>
  260 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  261 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  262 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  263 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  264 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  265 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  266 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  267 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  268 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  269 + </attributes>
  270 + </connection>
  271 + <connection>
  272 + <name>SNJW_VM</name>
  273 + <server>192.168.198.240</server>
  274 + <type>ORACLE</type>
  275 + <access>Native</access>
  276 + <database>orcl</database>
  277 + <port>1521</port>
  278 + <username>snjw</username>
  279 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
  280 + <servername/>
  281 + <data_tablespace/>
  282 + <index_tablespace/>
  283 + <attributes>
  284 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  285 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  286 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  287 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  288 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  289 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  290 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  291 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  292 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  293 + </attributes>
  294 + </connection>
  295 + <connection>
  296 + <name>xlab_mysql_youle</name>
  297 + <server>101.231.124.8</server>
  298 + <type>MYSQL</type>
  299 + <access>Native</access>
  300 + <database>xlab_youle</database>
  301 + <port>45687</port>
  302 + <username>xlab-youle</username>
  303 + <password>Encrypted 2be98afc86aa78a88aa1be369d187a3df</password>
  304 + <servername/>
  305 + <data_tablespace/>
  306 + <index_tablespace/>
  307 + <attributes>
  308 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  309 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  310 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  311 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  312 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  313 + <attribute><code>PORT_NUMBER</code><attribute>45687</attribute></attribute>
  314 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  315 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  316 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  317 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
  318 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
  319 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  320 + </attributes>
  321 + </connection>
  322 + <connection>
  323 + <name>xlab_mysql_youle&#xff08;&#x672c;&#x673a;&#xff09;</name>
  324 + <server>localhost</server>
  325 + <type>MYSQL</type>
  326 + <access>Native</access>
  327 + <database>xlab_youle</database>
  328 + <port>3306</port>
  329 + <username>root</username>
  330 + <password>Encrypted </password>
  331 + <servername/>
  332 + <data_tablespace/>
  333 + <index_tablespace/>
  334 + <attributes>
  335 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  336 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  337 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  338 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  339 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  340 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  341 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  342 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  343 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  344 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
  345 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
  346 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  347 + </attributes>
  348 + </connection>
  349 + <connection>
  350 + <name>xlab_youle</name>
  351 + <server/>
  352 + <type>MYSQL</type>
  353 + <access>JNDI</access>
  354 + <database>xlab_youle</database>
  355 + <port>1521</port>
  356 + <username/>
  357 + <password>Encrypted </password>
  358 + <servername/>
  359 + <data_tablespace/>
  360 + <index_tablespace/>
  361 + <attributes>
  362 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  363 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  364 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  365 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  366 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  367 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  368 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  369 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  370 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  371 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  372 + </attributes>
  373 + </connection>
  374 + <connection>
  375 + <name>YGJW_VM</name>
  376 + <server>192.168.198.240</server>
  377 + <type>ORACLE</type>
  378 + <access>Native</access>
  379 + <database>orcl</database>
  380 + <port>1521</port>
  381 + <username>ygjw</username>
  382 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
  383 + <servername/>
  384 + <data_tablespace/>
  385 + <index_tablespace/>
  386 + <attributes>
  387 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  388 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  389 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  390 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  391 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  392 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  393 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  394 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  395 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  396 + </attributes>
  397 + </connection>
  398 + <connection>
  399 + <name>&#x516c;&#x53f8;jgjw</name>
  400 + <server>192.168.168.1</server>
  401 + <type>ORACLE</type>
  402 + <access>Native</access>
  403 + <database>orcl</database>
  404 + <port>1521</port>
  405 + <username>jwgl</username>
  406 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
  407 + <servername/>
  408 + <data_tablespace/>
  409 + <index_tablespace/>
  410 + <attributes>
  411 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  412 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  413 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  414 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  415 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  416 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  417 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  418 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  419 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  420 + </attributes>
  421 + </connection>
  422 + <connection>
  423 + <name>&#x516c;&#x53f8;snjw</name>
  424 + <server>192.168.168.1</server>
  425 + <type>ORACLE</type>
  426 + <access>Native</access>
  427 + <database>orcl</database>
  428 + <port>1521</port>
  429 + <username>snjw</username>
  430 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
  431 + <servername/>
  432 + <data_tablespace/>
  433 + <index_tablespace/>
  434 + <attributes>
  435 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  436 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  437 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  438 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  439 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  440 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  441 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  442 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  443 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  444 + </attributes>
  445 + </connection>
  446 + <connection>
  447 + <name>&#x516c;&#x53f8;ygjw</name>
  448 + <server>192.168.168.1</server>
  449 + <type>ORACLE</type>
  450 + <access>Native</access>
  451 + <database>orcl</database>
  452 + <port>1521</port>
  453 + <username>ygjw</username>
  454 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
  455 + <servername/>
  456 + <data_tablespace/>
  457 + <index_tablespace/>
  458 + <attributes>
  459 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  460 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  461 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  462 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  463 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  464 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  465 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  466 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  467 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  468 + </attributes>
  469 + </connection>
  470 + <order>
  471 + <hop> <from>&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
  472 + <hop> <from>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</to><enabled>Y</enabled> </hop>
  473 + <hop> <from>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</from><to>&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
  474 + <hop> <from>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</from><to>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</to><enabled>Y</enabled> </hop>
  475 + <hop> <from>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</from><to>&#x662f;&#x5426;&#x7535;&#x8f66;</to><enabled>Y</enabled> </hop>
  476 + <hop> <from>&#x662f;&#x5426;&#x7535;&#x8f66;</from><to>Excel&#x8f93;&#x51fa;</to><enabled>Y</enabled> </hop>
  477 + </order>
  478 + <step>
  479 + <name>Excel&#x8f93;&#x51fa;</name>
  480 + <type>ExcelOutput</type>
  481 + <description/>
  482 + <distribute>Y</distribute>
  483 + <custom_distribution/>
  484 + <copies>1</copies>
  485 + <partitioning>
  486 + <method>none</method>
  487 + <schema_name/>
  488 + </partitioning>
  489 + <header>Y</header>
  490 + <footer>N</footer>
  491 + <encoding/>
  492 + <append>N</append>
  493 + <add_to_result_filenames>Y</add_to_result_filenames>
  494 + <file>
  495 + <name>&#x24;&#x7b;filepath&#x7d;</name>
  496 + <extention>xls</extention>
  497 + <do_not_open_newfile_init>N</do_not_open_newfile_init>
  498 + <create_parent_folder>N</create_parent_folder>
  499 + <split>N</split>
  500 + <add_date>N</add_date>
  501 + <add_time>N</add_time>
  502 + <SpecifyFormat>N</SpecifyFormat>
  503 + <date_time_format>yyyyMMddHHmmss</date_time_format>
  504 + <sheetname>&#x5de5;&#x4f5c;&#x8868;1</sheetname>
  505 + <autosizecolums>N</autosizecolums>
  506 + <nullisblank>N</nullisblank>
  507 + <protect_sheet>N</protect_sheet>
  508 + <password>Encrypted </password>
  509 + <splitevery>0</splitevery>
  510 + <usetempfiles>N</usetempfiles>
  511 + <tempdirectory/>
  512 + </file>
  513 + <template>
  514 + <enabled>N</enabled>
  515 + <append>N</append>
  516 + <filename>template.xls</filename>
  517 + </template>
  518 + <fields>
  519 + <field>
  520 + <name>&#x8f66;&#x724c;&#x53f7;</name>
  521 + <type>String</type>
  522 + <format/>
  523 + </field>
  524 + <field>
  525 + <name>&#x5185;&#x90e8;&#x7f16;&#x7801;</name>
  526 + <type>String</type>
  527 + <format/>
  528 + </field>
  529 + <field>
  530 + <name>&#x6240;&#x5c5e;&#x516c;&#x53f8;</name>
  531 + <type>String</type>
  532 + <format/>
  533 + </field>
  534 + <field>
  535 + <name>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</name>
  536 + <type>String</type>
  537 + <format/>
  538 + </field>
  539 + <field>
  540 + <name>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</name>
  541 + <type>String</type>
  542 + <format/>
  543 + </field>
  544 + <field>
  545 + <name>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</name>
  546 + <type>String</type>
  547 + <format/>
  548 + </field>
  549 + <field>
  550 + <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  551 + <type>String</type>
  552 + <format/>
  553 + </field>
  554 + </fields>
  555 + <custom>
  556 + <header_font_name>arial</header_font_name>
  557 + <header_font_size>10</header_font_size>
  558 + <header_font_bold>N</header_font_bold>
  559 + <header_font_italic>N</header_font_italic>
  560 + <header_font_underline>no</header_font_underline>
  561 + <header_font_orientation>horizontal</header_font_orientation>
  562 + <header_font_color>black</header_font_color>
  563 + <header_background_color>none</header_background_color>
  564 + <header_row_height>255</header_row_height>
  565 + <header_alignment>left</header_alignment>
  566 + <header_image/>
  567 + <row_font_name>arial</row_font_name>
  568 + <row_font_size>10</row_font_size>
  569 + <row_font_color>black</row_font_color>
  570 + <row_background_color>none</row_background_color>
  571 + </custom>
  572 + <cluster_schema/>
  573 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  574 + <xloc>498</xloc>
  575 + <yloc>348</yloc>
  576 + <draw>Y</draw>
  577 + </GUI>
  578 + </step>
  579 +
  580 + <step>
  581 + <name>&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
  582 + <type>DBLookup</type>
  583 + <description/>
  584 + <distribute>Y</distribute>
  585 + <custom_distribution/>
  586 + <copies>1</copies>
  587 + <partitioning>
  588 + <method>none</method>
  589 + <schema_name/>
  590 + </partitioning>
  591 + <connection>bus_control_variable</connection>
  592 + <cache>N</cache>
  593 + <cache_load_all>N</cache_load_all>
  594 + <cache_size>0</cache_size>
  595 + <lookup>
  596 + <schema/>
  597 + <table>bsth_c_business</table>
  598 + <orderby/>
  599 + <fail_on_multiple>N</fail_on_multiple>
  600 + <eat_row_on_failure>N</eat_row_on_failure>
  601 + <key>
  602 + <name>up_code</name>
  603 + <field>up_code</field>
  604 + <condition>&#x3d;</condition>
  605 + <name2/>
  606 + </key>
  607 + <key>
  608 + <name>business_code</name>
  609 + <field>business_code</field>
  610 + <condition>&#x3d;</condition>
  611 + <name2/>
  612 + </key>
  613 + <value>
  614 + <name>business_name</name>
  615 + <rename>gs</rename>
  616 + <default/>
  617 + <type>String</type>
  618 + </value>
  619 + </lookup>
  620 + <cluster_schema/>
  621 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  622 + <xloc>364</xloc>
  623 + <yloc>60</yloc>
  624 + <draw>Y</draw>
  625 + </GUI>
  626 + </step>
  627 +
  628 + <step>
  629 + <name>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
  630 + <type>DBLookup</type>
  631 + <description/>
  632 + <distribute>Y</distribute>
  633 + <custom_distribution/>
  634 + <copies>1</copies>
  635 + <partitioning>
  636 + <method>none</method>
  637 + <schema_name/>
  638 + </partitioning>
  639 + <connection>bus_control_variable</connection>
  640 + <cache>N</cache>
  641 + <cache_load_all>N</cache_load_all>
  642 + <cache_size>0</cache_size>
  643 + <lookup>
  644 + <schema/>
  645 + <table>bsth_c_business</table>
  646 + <orderby/>
  647 + <fail_on_multiple>N</fail_on_multiple>
  648 + <eat_row_on_failure>N</eat_row_on_failure>
  649 + <key>
  650 + <name>business_code</name>
  651 + <field>up_code</field>
  652 + <condition>&#x3d;</condition>
  653 + <name2/>
  654 + </key>
  655 + <key>
  656 + <name>branche_company_code</name>
  657 + <field>business_code</field>
  658 + <condition>&#x3d;</condition>
  659 + <name2/>
  660 + </key>
  661 + <value>
  662 + <name>business_name</name>
  663 + <rename>fgs</rename>
  664 + <default/>
  665 + <type>String</type>
  666 + </value>
  667 + </lookup>
  668 + <cluster_schema/>
  669 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  670 + <xloc>491</xloc>
  671 + <yloc>60</yloc>
  672 + <draw>Y</draw>
  673 + </GUI>
  674 + </step>
  675 +
  676 + <step>
  677 + <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
  678 + <type>SelectValues</type>
  679 + <description/>
  680 + <distribute>N</distribute>
  681 + <custom_distribution/>
  682 + <copies>1</copies>
  683 + <partitioning>
  684 + <method>none</method>
  685 + <schema_name/>
  686 + </partitioning>
  687 + <fields> <field> <name>car_plate</name>
  688 + <rename>&#x8f66;&#x724c;&#x53f7;</rename>
  689 + <length>-2</length>
  690 + <precision>-2</precision>
  691 + </field> <field> <name>inside_code</name>
  692 + <rename>&#x5185;&#x90e8;&#x7f16;&#x7801;</rename>
  693 + <length>-2</length>
  694 + <precision>-2</precision>
  695 + </field> <field> <name>gs</name>
  696 + <rename>&#x6240;&#x5c5e;&#x516c;&#x53f8;</rename>
  697 + <length>-2</length>
  698 + <precision>-2</precision>
  699 + </field> <field> <name>fgs</name>
  700 + <rename>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</rename>
  701 + <length>-2</length>
  702 + <precision>-2</precision>
  703 + </field> <field> <name>supplier_name</name>
  704 + <rename>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</rename>
  705 + <length>-2</length>
  706 + <precision>-2</precision>
  707 + </field> <field> <name>equipment_code</name>
  708 + <rename>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</rename>
  709 + <length>-2</length>
  710 + <precision>-2</precision>
  711 + </field> <field> <name>sfdc</name>
  712 + <rename>sfdc_cal</rename>
  713 + <length>-2</length>
  714 + <precision>-2</precision>
  715 + </field> <select_unspecified>N</select_unspecified>
  716 + </fields> <cluster_schema/>
  717 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  718 + <xloc>495</xloc>
  719 + <yloc>173</yloc>
  720 + <draw>Y</draw>
  721 + </GUI>
  722 + </step>
  723 +
  724 + <step>
  725 + <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  726 + <type>ScriptValueMod</type>
  727 + <description/>
  728 + <distribute>Y</distribute>
  729 + <custom_distribution/>
  730 + <copies>1</copies>
  731 + <partitioning>
  732 + <method>none</method>
  733 + <schema_name/>
  734 + </partitioning>
  735 + <compatible>N</compatible>
  736 + <optimizationLevel>9</optimizationLevel>
  737 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  738 + <jsScript_name>Script 1</jsScript_name>
  739 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#xa;if&#x28;sfdc_cal &#x3d;&#x3d; 0&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d; else if &#x28;sfdc_cal &#x3d;&#x3d; 1&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x662f;&#x22;&#x3b;&#xa;&#x7d; else &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
  740 + </jsScript> </jsScripts> <fields> <field> <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  741 + <rename>&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
  742 + <type>String</type>
  743 + <length>-1</length>
  744 + <precision>-1</precision>
  745 + <replace>N</replace>
  746 + </field> </fields> <cluster_schema/>
  747 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  748 + <xloc>695</xloc>
  749 + <yloc>173</yloc>
  750 + <draw>Y</draw>
  751 + </GUI>
  752 + </step>
  753 +
  754 + <step>
  755 + <name>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</name>
  756 + <type>ScriptValueMod</type>
  757 + <description/>
  758 + <distribute>Y</distribute>
  759 + <custom_distribution/>
  760 + <copies>1</copies>
  761 + <partitioning>
  762 + <method>none</method>
  763 + <schema_name/>
  764 + </partitioning>
  765 + <compatible>N</compatible>
  766 + <optimizationLevel>9</optimizationLevel>
  767 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  768 + <jsScript_name>Script 1</jsScript_name>
  769 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var up_code &#x3d; &#x27;88&#x27;&#x3b;</jsScript_script>
  770 + </jsScript> </jsScripts> <fields> <field> <name>up_code</name>
  771 + <rename>up_code</rename>
  772 + <type>String</type>
  773 + <length>-1</length>
  774 + <precision>-1</precision>
  775 + <replace>N</replace>
  776 + </field> </fields> <cluster_schema/>
  777 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  778 + <xloc>227</xloc>
  779 + <yloc>59</yloc>
  780 + <draw>Y</draw>
  781 + </GUI>
  782 + </step>
  783 +
  784 + <step>
  785 + <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</name>
  786 + <type>TableInput</type>
  787 + <description/>
  788 + <distribute>Y</distribute>
  789 + <custom_distribution/>
  790 + <copies>1</copies>
  791 + <partitioning>
  792 + <method>none</method>
  793 + <schema_name/>
  794 + </partitioning>
  795 + <connection>bus_control_variable</connection>
  796 + <sql>SELECT &#x2a; FROM bsth_c_cars&#xa;where &#x24;&#x7b;QUERY&#x7d;</sql>
  797 + <limit>0</limit>
  798 + <lookup/>
  799 + <execute_each_row>N</execute_each_row>
  800 + <variables_active>Y</variables_active>
  801 + <lazy_conversion_active>N</lazy_conversion_active>
  802 + <cluster_schema/>
  803 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  804 + <xloc>88</xloc>
  805 + <yloc>59</yloc>
  806 + <draw>Y</draw>
  807 + </GUI>
  808 + </step>
  809 +
  810 + <step_error_handling>
  811 + </step_error_handling>
  812 + <slave-step-copy-partition-distribution>
  813 +</slave-step-copy-partition-distribution>
  814 + <slave_transformation>N</slave_transformation>
  815 +
  816 +</transformation>
... ...
src/main/resources/rules/kBase1_core_functions.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core;
2   -
3   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount;
4   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime;
5   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno;
6   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult;
7   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq;
8   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb;
9   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb;
10   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core;
  2 +
  3 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount;
  4 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime;
  5 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno;
  6 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult;
  7 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq;
  8 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb;
  9 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb;
  10 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp;
... ...
src/main/resources/rules/kBase1_core_plan.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input;
7   -import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult;
8   -
9   -import com.bsth.repository.schedule.TTInfoDetailRepository;
10   -import com.bsth.repository.schedule.CarConfigInfoRepository;
11   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
12   -import com.bsth.repository.LineRepository;
13   -import com.bsth.repository.BusinessRepository;
14   -
15   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
16   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
17   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output;
18   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
19   -import com.bsth.entity.Line;
20   -import com.bsth.entity.Business;
21   -
22   -import com.bsth.entity.schedule.CarConfigInfo;
23   -import com.bsth.entity.schedule.EmployeeConfigInfo;
24   -import com.bsth.entity.schedule.TTInfo;
25   -import com.bsth.entity.schedule.TTInfoDetail;
26   -import com.bsth.entity.schedule.SchedulePlanInfo;
27   -
28   -import org.slf4j.Logger
29   -import org.joda.time.format.DateTimeFormat
30   -import org.apache.commons.lang3.StringUtils
31   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
32   -
33   -
34   -// 全局日志类(一般使用调用此规则的service类)
35   -global Logger log;
36   -
37   -global TTInfoDetailRepository tTInfoDetailRepository;
38   -global CarConfigInfoRepository carConfigInfoRepository;
39   -global EmployeeConfigInfoRepository employeeConfigInfoRepository;
40   -global LineRepository lineRepository;
41   -global BusinessRepository businessRepository;
42   -
43   -// 输出
44   -global PlanResult planResult;
45   -
46   -function Map xlidParams(String xlid) {
47   - Map param = new HashMap();
48   - param.put("xl.id_eq", Integer.valueOf(xlid));
49   - return param;
50   -}
51   -
52   -function List ecList(EmployeeConfigInfoRepository repo, String ecids) {
53   - List<String> ids = Arrays.asList(ecids.split("-"));
54   - List rst = new ArrayList();
55   - for (int i = 0; i < ids.size(); i++) {
56   - rst.add(repo.findOne(Long.parseLong(ids.get(i))));
57   - }
58   - return rst;
59   -}
60   -
61   -function LocalTime fcsjTime(String fcsj) {
62   - if ("NULL".equals(fcsj)) {
63   - return null;
64   - }
65   - return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm"));
66   -}
67   -
68   -function String ttInfoId_sd(Map map, DateTime sd) {
69   - TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd);
70   - return ttInfoResult_output.getTtInfoId();
71   -}
72   -
73   -function Map gsMap(List gses) {
74   - Map gsMap = new HashMap();
75   - for (int i = 0; i < gses.size(); i++) {
76   - Business gs = (Business) gses.get(i);
77   - if (StringUtils.isNotEmpty(gs.getBusinessCode())) {
78   - if ("88".equals(gs.getUpCode())) { // 浦东公交
79   - gsMap.put(gs.getBusinessCode(), gs);
80   - }
81   - if (gs.getBusinessCode().equals(gs.getUpCode())) { // 闵行,青浦
82   - gsMap.put(gs.getBusinessCode(), gs);
83   - }
84   - }
85   - }
86   - return gsMap;
87   -}
88   -
89   -function Map fgsMap(List gses) {
90   - // 这里简单将 businessCode和upCode合并
91   - Map fgsMap = new HashMap();
92   - for (int i = 0; i < gses.size(); i++) {
93   - Business gs = (Business) gses.get(i);
94   - if (StringUtils.isNotEmpty(gs.getBusinessCode()) && StringUtils.isNotEmpty(gs.getUpCode())) {
95   - fgsMap.put(gs.getUpCode() + "_" + gs.getBusinessCode(), gs);
96   - }
97   - }
98   - return fgsMap;
99   -}
100   -
101   -/*
102   - 规则说明:
103   - 根据循环规则输出,时刻表选择规则输出,组合计算排班明细
104   -*/
105   -
106   -//-------------------- 第一阶段、计算迭代数据 -----------------//
107   -declare Loop_result
108   - xlId: String // 线路id
109   -
110   - ruleLoop: List // 每天分配的规则 List<ScheduleResult_output>
111   -
112   - ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>>
113   - ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output>
114   - ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output>
115   -end
116   -
117   -rule "calcu_step1_Loop_result"
118   - salience 1000
119   - when
120   - $param: PlanCalcuParam_input($xlId: xlId)
121   - then
122   - Loop_result loop_result = new Loop_result();
123   - loop_result.setXlId($xlId);
124   - loop_result.setRuleLoop($param.getScheduleResults_output().getResults());
125   -
126   - loop_result.setTtInfoMapLoop(new HashMap());
127   - loop_result.setTtInfoMap(new HashMap());
128   -
129   - com.google.common.collect.Multimap ttInfoMap_temp =
130   - (com.google.common.collect.Multimap)
131   - $param.getTtInfoResults_output().getResults().get(
132   - String.valueOf($xlId));
133   -
134   - loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap());
135   -
136   - insert(loop_result);
137   -
138   -// log.info("calcu_step1_Loop_result");
139   -end
140   -
141   -rule "calcu_step2_loop_result"
142   - salience 1000
143   - no-loop
144   - when
145   - $param: PlanCalcuParam_input($xlId: xlId)
146   - $lr: Loop_result(xlId == $xlId)
147   - $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet()
148   - then
149   - // 当天时刻表只取第一张 TODO:
150   - Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd);
151   - Iterator iter = col.iterator();
152   - TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next();
153   - $lr.getTtInfoMapLoop().put($sd, ttInfo_result);
154   -
155   - // 总共使用的时刻表
156   - $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result);
157   -
158   - update($lr);
159   -
160   -// log.info("calcu_step2_Loop_result");
161   -end
162   -
163   -//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------//
164   -
165   -//--------------- 车辆配置信息载入 -------------//
166   -declare CarConfig_Wraps
167   - xlId: String // 线路Id
168   - ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
169   -end
170   -
171   -rule "calcu_CarConfig_Wraps"
172   - salience 800
173   - when
174   - $lr: Loop_result($xlId: xlId)
175   - then
176   - List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
177   -
178   - CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
179   - carConfig_wraps.setXlId($xlId);
180   - carConfig_wraps.setCcMap(new HashMap());
181   -
182   - for (int i = 0; i < carConfigInfos.size(); i++) {
183   - CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
184   - carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
185   - }
186   -
187   - insert(carConfig_wraps);
188   -
189   - log.info("calcu_CarConfig_Wrap");
190   -end
191   -
192   -//--------------- 人员配置信息载入 --------------//
193   -declare EmployeeConfig_Wraps
194   - xlId: String // 线路Id
195   - ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
196   -end
197   -
198   -rule "calcu_EmployeeConfig_Wraps"
199   - salience 800
200   - when
201   - $lr: Loop_result($xlId: xlId)
202   - then
203   - List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
204   -
205   - EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
206   - employeeConfig_wraps.setXlId($xlId);
207   - employeeConfig_wraps.setEcMap(new HashMap());
208   -
209   - for (int i = 0; i < employeeConfigInfos.size(); i++) {
210   - EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
211   - employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
212   - }
213   -
214   - insert(employeeConfig_wraps);
215   -
216   - log.info("calcu_EmployeeConfig_Wrap");
217   -end
218   -
219   -//----------------- 时刻表班次信息载入 -----------------//
220   -declare TTInfo_gid_stat
221   - xlId: String // 线路id(cast字符串-方便比较)
222   - ttInfoId: String // 时刻表id(cast字符串-方便比较)
223   - gid: String // 路牌id(cast字符串-方便比较)
224   -
225   - maxFcno: Integer // 最大发车顺序号
226   -
227   - fbTime: LocalTime // 分班时间
228   - fbfcno: Integer // 分班发车顺序号
229   -end
230   -
231   -rule "calcu_TTInfo_gid_stat"
232   - salience 800
233   - when
234   - $lr: Loop_result($xlId: xlId)
235   - $ttInfoId: String() from $lr.getTtInfoMap().keySet()
236   - $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidscount($ttd))
237   - $gid: String() from $gids
238   - $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbtime($ttd))
239   - $fbfcno: Integer() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbfcno($ttd))
240   - $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), max($ttd.getFcno()))
241   - then
242   - TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat();
243   - ttInfo_gid_stat.setXlId($xlId);
244   - ttInfo_gid_stat.setTtInfoId($ttInfoId);
245   - ttInfo_gid_stat.setGid($gid);
246   -
247   - ttInfo_gid_stat.setMaxFcno($maxfcno.intValue());
248   - ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str));
249   - ttInfo_gid_stat.setFbfcno($fbfcno);
250   -
251   - insert(ttInfo_gid_stat);
252   -
253   -// log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={},fbfcno={}",
254   -// $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime(), ttInfo_gid_stat.getFbfcno());
255   -
256   -end
257   -
258   -declare TTInfoDetail_Wrap
259   - isFirstBc: Boolean = false // 是否是当前路牌的第一个班次
260   - isLastBc: Boolean = false // 是否是当前路牌的最后一个班次
261   - isFb: Boolean = false // 是否分班
262   -
263   - self: TTInfoDetail // 原始数据
264   -end
265   -
266   -declare TTInfoDetail_Wraps
267   - xlId: String // 线路id(cast字符串-方便比较)
268   - ttInfoId: String // 时刻表id(cast字符串-方便比较)
269   -
270   - detailsMap: Map // 明细Map,Map<路牌id, List<TTInfoDetail_Wrap>>
271   -end
272   -
273   -rule "calcu_TTInfoDetail_Wraps"
274   - salience 700
275   - when
276   - $lr: Loop_result($xlId: xlId)
277   - $ttInfoId: String() from $lr.getTtInfoMap().keySet()
278   - $ttInfoStatList: List(size > 0) from collect (TTInfo_gid_stat(ttInfoId == $ttInfoId))
279   - then
280   - TTInfoDetail_Wraps ttInfoDetail_wraps = new TTInfoDetail_Wraps();
281   - ttInfoDetail_wraps.setXlId($xlId);
282   - ttInfoDetail_wraps.setTtInfoId($ttInfoId);
283   - ttInfoDetail_wraps.setDetailsMap(new HashMap());
284   -
285   - // 将list的形式变成 Map<路牌id, TTInfo_gid_stat>
286   - Map statMap = new HashMap();
287   - for (int i = 0; i < $ttInfoStatList.size(); i++) {
288   - TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) $ttInfoStatList.get(i);
289   - statMap.put(ttInfo_gid_stat.getGid(), ttInfo_gid_stat);
290   - }
291   -
292   - // 迭代ttinfodetail,拼装 TTInfoDetail_Wraps
293   - List detaillist = tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId));
294   - for (int j = 0; j < detaillist.size(); j++) {
295   - TTInfoDetail ttInfoDetail = (TTInfoDetail) detaillist.get(j);
296   - String gid = String.valueOf(ttInfoDetail.getLp().getId());
297   -
298   - if (ttInfoDetail_wraps.getDetailsMap().get(gid) == null) {
299   - ttInfoDetail_wraps.getDetailsMap().put(gid, new ArrayList());
300   - }
301   -
302   - // 获取stat
303   - TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) statMap.get(gid);
304   -
305   - TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap();
306   - ttInfoDetail_wrap.setIsFirstBc(1 == ttInfoDetail.getFcno());
307   - ttInfoDetail_wrap.setIsLastBc(ttInfo_gid_stat.getMaxFcno() == ttInfoDetail.getFcno());
308   -
309   - LocalTime fcsj = fcsjTime(ttInfoDetail.getFcsj());
310   - LocalTime fbsj = ttInfo_gid_stat.getFbTime();
311   - Integer fbfcno = ttInfo_gid_stat.getFbfcno();
312   - // 不用时间判定,因为有的路牌,后面的班次都是凌晨的,时间反而比分班时间早,不合理,所以使用发车顺序号做第二次比较
313   -// ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj)));
314   - ttInfoDetail_wrap.setIsFb(fbsj == null ? false : ttInfoDetail.getFcno() >= fbfcno);
315   -
316   - ttInfoDetail_wrap.setSelf(ttInfoDetail);
317   -
318   - ((List) ttInfoDetail_wraps.getDetailsMap().get(gid)).add(ttInfoDetail_wrap);
319   -
320   - }
321   -
322   -
323   - insert(ttInfoDetail_wraps);
324   -
325   - log.info("xlid={}, ttinfoid={}, lpstatCount={}, detailLpCount={}",
326   - $xlId, $ttInfoId, $ttInfoStatList.size(), ttInfoDetail_wraps.getDetailsMap().keySet().size());
327   -
328   -
329   -end
330   -
331   -declare TTInfoDetail_Wraps_map
332   - xlId: String // 线路id(cast字符串-方便比较)
333   -
334   - wrapsMap: Map // 明细Map,Map<时刻表Id, TTInfoDetail_Wraps>
335   -end
336   -
337   -rule "calcu_TTInfoDetail_Wraps_toMap"
338   - salience 600
339   - when
340   - $lr: Loop_result($xlId: xlId)
341   - $wrapsList: List(size > 0) from collect (TTInfoDetail_Wraps(xlId == $xlId))
342   - then
343   - // 转换成Map
344   - TTInfoDetail_Wraps_map all = new TTInfoDetail_Wraps_map();
345   - all.setXlId($xlId);
346   - all.setWrapsMap(new HashMap());
347   -
348   - for (int i = 0; i < $wrapsList.size(); i++) {
349   - TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $wrapsList.get(i);
350   - all.getWrapsMap().put(ttInfoDetail_wraps.getTtInfoId(), ttInfoDetail_wraps);
351   - }
352   -
353   - insert(all);
354   -end
355   -
356   -
357   -
358   -
359   -//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------//
360   -
361   -
362   -rule "Calcu_SchedulePlanInfo"
363   - salience 500
364   - when
365   - $param: PlanCalcuParam_input($xlId: xlId)
366   - $lr: Loop_result(xlId == $xlId)
367   - $ccs: CarConfig_Wraps(xlId == $xlId)
368   - $ecs: EmployeeConfig_Wraps(xlId == $xlId)
369   - $tts: TTInfoDetail_Wraps_map(xlId == $xlId)
370   - then
371   - // 线路
372   - Line xl = lineRepository.findOne(Integer.parseInt($xlId));
373   -
374   - // 查找公司
375   - List gses = (List) businessRepository.findAll();
376   - // 构造公司代码对应map
377   - Map gsMap = gsMap(gses);
378   - // 构造分公司对应的map
379   - Map fgsMap = fgsMap(gses);
380   -
381   - for (int i = 0; i < $lr.getRuleLoop().size(); i++) {
382   - ScheduleResult_output sro = (ScheduleResult_output) $lr.getRuleLoop().get(i);
383   -
384   - // 日期
385   - DateTime sd = sro.getSd();
386   - // 路牌
387   - String gid = sro.getGuideboardId();
388   - // 车辆配置
389   - CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
390   - (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
391   - // 人员配置
392   - List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
393   - ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
394   -
395   - // 时刻表id
396   - String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
397   - TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $tts.getWrapsMap().get(ttInfoId);
398   - if (ttInfoDetail_wraps == null) {
399   - // 时刻表为空,直接跳过
400   - // 如1118路,周末不开,此是时刻表指定一个空表
401   - // TODO:这个以后要改的,选时刻表的规则要修正,没有默认的时刻表
402   - continue;
403   - }
404   -
405   - List detaillist = (List) ttInfoDetail_wraps.getDetailsMap().get(gid);
406   - if (detaillist == null) {
407   - // 这里翻到的路牌时刻表里可能没有,
408   - // 因为没有考虑翻班格式(就是做几休几)
409   - // 所有翻班格式全由时刻表决定,即时刻表有的路牌就做,没有不做
410   - continue;
411   - }
412   -
413   - for (int j = 0; j < detaillist.size(); j++) {
414   - TTInfoDetail_Wrap wrap = (TTInfoDetail_Wrap) detaillist.get(j);
415   -
416   - SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
417   - xl,
418   - sro,
419   - wrap.getSelf(),
420   - wrap.getIsFb(),
421   - carConfigInfo,
422   - eclist,
423   - $param.getSchedulePlan(),
424   - wrap.getIsFirstBc(),
425   - wrap.getIsLastBc(),
426   - sro.getsType()
427   - );
428   -
429   - // 获取公司,分公司信息
430   - String gsbm = xl.getCompany();
431   - String fgsbm = xl.getBrancheCompany();
432   - Business gs = null;
433   - Business fgs = null;
434   -
435   - if (StringUtils.isNotEmpty(gsbm)) {
436   - gs = (Business) gsMap.get(gsbm);
437   - }
438   - if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
439   - fgs = (Business) fgsMap.get(gsbm + "_" + fgsbm);
440   - }
441   -
442   - if (gs != null) {
443   - schedulePlanInfo.setGsBm(gs.getBusinessCode());
444   - schedulePlanInfo.setGsName(gs.getBusinessName());
445   - }
446   - if (fgs != null) {
447   - schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
448   - schedulePlanInfo.setFgsName(fgs.getBusinessName());
449   - }
450   -
451   - // 操作人,操作时间
452   - schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy());
453   - schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate());
454   - schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy());
455   - schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate());
456   -
457   - // result 输出
458   - planResult.getSchedulePlanInfos().add(schedulePlanInfo);
459   -
460   - }
461   -
462   - }
463   -
464   - log.info("xlid={} plan ok!", $xlId);
465   -
466   -end
467   -
468   -
469   -
470   -
471   -
472   -
473   -
474   -
475   -
476   -
477   -
478   -
479   -
480   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input;
  7 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult;
  8 +
  9 +import com.bsth.repository.schedule.TTInfoDetailRepository;
  10 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  11 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  12 +import com.bsth.repository.LineRepository;
  13 +import com.bsth.repository.BusinessRepository;
  14 +
  15 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  16 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  17 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output;
  18 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.Business;
  21 +
  22 +import com.bsth.entity.schedule.CarConfigInfo;
  23 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  24 +import com.bsth.entity.schedule.TTInfo;
  25 +import com.bsth.entity.schedule.TTInfoDetail;
  26 +import com.bsth.entity.schedule.SchedulePlanInfo;
  27 +
  28 +import org.slf4j.Logger
  29 +import org.joda.time.format.DateTimeFormat
  30 +import org.apache.commons.lang3.StringUtils
  31 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
  32 +
  33 +
  34 +// 全局日志类(一般使用调用此规则的service类)
  35 +global Logger log;
  36 +
  37 +global TTInfoDetailRepository tTInfoDetailRepository;
  38 +global CarConfigInfoRepository carConfigInfoRepository;
  39 +global EmployeeConfigInfoRepository employeeConfigInfoRepository;
  40 +global LineRepository lineRepository;
  41 +global BusinessRepository businessRepository;
  42 +
  43 +// 输出
  44 +global PlanResult planResult;
  45 +
  46 +function Map xlidParams(String xlid) {
  47 + Map param = new HashMap();
  48 + param.put("xl.id_eq", Integer.valueOf(xlid));
  49 + return param;
  50 +}
  51 +
  52 +function List ecList(EmployeeConfigInfoRepository repo, String ecids) {
  53 + List<String> ids = Arrays.asList(ecids.split("-"));
  54 + List rst = new ArrayList();
  55 + for (int i = 0; i < ids.size(); i++) {
  56 + rst.add(repo.findOne(Long.parseLong(ids.get(i))));
  57 + }
  58 + return rst;
  59 +}
  60 +
  61 +function LocalTime fcsjTime(String fcsj) {
  62 + if ("NULL".equals(fcsj)) {
  63 + return null;
  64 + }
  65 + return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm"));
  66 +}
  67 +
  68 +function String ttInfoId_sd(Map map, DateTime sd) {
  69 + TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd);
  70 + return ttInfoResult_output.getTtInfoId();
  71 +}
  72 +
  73 +function Map gsMap(List gses) {
  74 + Map gsMap = new HashMap();
  75 + for (int i = 0; i < gses.size(); i++) {
  76 + Business gs = (Business) gses.get(i);
  77 + if (StringUtils.isNotEmpty(gs.getBusinessCode())) {
  78 + if ("88".equals(gs.getUpCode())) { // 浦东公交
  79 + gsMap.put(gs.getBusinessCode(), gs);
  80 + }
  81 + if (gs.getBusinessCode().equals(gs.getUpCode())) { // 闵行,青浦
  82 + gsMap.put(gs.getBusinessCode(), gs);
  83 + }
  84 + }
  85 + }
  86 + return gsMap;
  87 +}
  88 +
  89 +function Map fgsMap(List gses) {
  90 + // 这里简单将 businessCode和upCode合并
  91 + Map fgsMap = new HashMap();
  92 + for (int i = 0; i < gses.size(); i++) {
  93 + Business gs = (Business) gses.get(i);
  94 + if (StringUtils.isNotEmpty(gs.getBusinessCode()) && StringUtils.isNotEmpty(gs.getUpCode())) {
  95 + fgsMap.put(gs.getUpCode() + "_" + gs.getBusinessCode(), gs);
  96 + }
  97 + }
  98 + return fgsMap;
  99 +}
  100 +
  101 +/*
  102 + 规则说明:
  103 + 根据循环规则输出,时刻表选择规则输出,组合计算排班明细
  104 +*/
  105 +
  106 +//-------------------- 第一阶段、计算迭代数据 -----------------//
  107 +declare Loop_result
  108 + xlId: String // 线路id
  109 +
  110 + ruleLoop: List // 每天分配的规则 List<ScheduleResult_output>
  111 +
  112 + ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>>
  113 + ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output>
  114 + ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output>
  115 +end
  116 +
  117 +rule "calcu_step1_Loop_result"
  118 + salience 1000
  119 + when
  120 + $param: PlanCalcuParam_input($xlId: xlId)
  121 + then
  122 + Loop_result loop_result = new Loop_result();
  123 + loop_result.setXlId($xlId);
  124 + loop_result.setRuleLoop($param.getScheduleResults_output().getResults());
  125 +
  126 + loop_result.setTtInfoMapLoop(new HashMap());
  127 + loop_result.setTtInfoMap(new HashMap());
  128 +
  129 + com.google.common.collect.Multimap ttInfoMap_temp =
  130 + (com.google.common.collect.Multimap)
  131 + $param.getTtInfoResults_output().getResults().get(
  132 + String.valueOf($xlId));
  133 +
  134 + loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap());
  135 +
  136 + insert(loop_result);
  137 +
  138 +// log.info("calcu_step1_Loop_result");
  139 +end
  140 +
  141 +rule "calcu_step2_loop_result"
  142 + salience 1000
  143 + no-loop
  144 + when
  145 + $param: PlanCalcuParam_input($xlId: xlId)
  146 + $lr: Loop_result(xlId == $xlId)
  147 + $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet()
  148 + then
  149 + // 当天时刻表只取第一张 TODO:
  150 + Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd);
  151 + Iterator iter = col.iterator();
  152 + TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next();
  153 + $lr.getTtInfoMapLoop().put($sd, ttInfo_result);
  154 +
  155 + // 总共使用的时刻表
  156 + $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result);
  157 +
  158 + update($lr);
  159 +
  160 +// log.info("calcu_step2_Loop_result");
  161 +end
  162 +
  163 +//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------//
  164 +
  165 +//--------------- 车辆配置信息载入 -------------//
  166 +declare CarConfig_Wraps
  167 + xlId: String // 线路Id
  168 + ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
  169 +end
  170 +
  171 +rule "calcu_CarConfig_Wraps"
  172 + salience 800
  173 + when
  174 + $lr: Loop_result($xlId: xlId)
  175 + then
  176 + List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
  177 +
  178 + CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
  179 + carConfig_wraps.setXlId($xlId);
  180 + carConfig_wraps.setCcMap(new HashMap());
  181 +
  182 + for (int i = 0; i < carConfigInfos.size(); i++) {
  183 + CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
  184 + carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
  185 + }
  186 +
  187 + insert(carConfig_wraps);
  188 +
  189 + log.info("calcu_CarConfig_Wrap");
  190 +end
  191 +
  192 +//--------------- 人员配置信息载入 --------------//
  193 +declare EmployeeConfig_Wraps
  194 + xlId: String // 线路Id
  195 + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
  196 +end
  197 +
  198 +rule "calcu_EmployeeConfig_Wraps"
  199 + salience 800
  200 + when
  201 + $lr: Loop_result($xlId: xlId)
  202 + then
  203 + List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
  204 +
  205 + EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
  206 + employeeConfig_wraps.setXlId($xlId);
  207 + employeeConfig_wraps.setEcMap(new HashMap());
  208 +
  209 + for (int i = 0; i < employeeConfigInfos.size(); i++) {
  210 + EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
  211 + employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
  212 + }
  213 +
  214 + insert(employeeConfig_wraps);
  215 +
  216 + log.info("calcu_EmployeeConfig_Wrap");
  217 +end
  218 +
  219 +//----------------- 时刻表班次信息载入 -----------------//
  220 +declare TTInfo_gid_stat
  221 + xlId: String // 线路id(cast字符串-方便比较)
  222 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  223 + gid: String // 路牌id(cast字符串-方便比较)
  224 +
  225 + maxFcno: Integer // 最大发车顺序号
  226 +
  227 + fbTime: LocalTime // 分班时间
  228 + fbfcno: Integer // 分班发车顺序号
  229 +end
  230 +
  231 +rule "calcu_TTInfo_gid_stat"
  232 + salience 800
  233 + when
  234 + $lr: Loop_result($xlId: xlId)
  235 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  236 + $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidscount($ttd))
  237 + $gid: String() from $gids
  238 + $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbtime($ttd))
  239 + $fbfcno: Integer() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbfcno($ttd))
  240 + $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), max($ttd.getFcno()))
  241 + then
  242 + TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat();
  243 + ttInfo_gid_stat.setXlId($xlId);
  244 + ttInfo_gid_stat.setTtInfoId($ttInfoId);
  245 + ttInfo_gid_stat.setGid($gid);
  246 +
  247 + ttInfo_gid_stat.setMaxFcno($maxfcno.intValue());
  248 + ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str));
  249 + ttInfo_gid_stat.setFbfcno($fbfcno);
  250 +
  251 + insert(ttInfo_gid_stat);
  252 +
  253 +// log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={},fbfcno={}",
  254 +// $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime(), ttInfo_gid_stat.getFbfcno());
  255 +
  256 +end
  257 +
  258 +declare TTInfoDetail_Wrap
  259 + isFirstBc: Boolean = false // 是否是当前路牌的第一个班次
  260 + isLastBc: Boolean = false // 是否是当前路牌的最后一个班次
  261 + isFb: Boolean = false // 是否分班
  262 +
  263 + self: TTInfoDetail // 原始数据
  264 +end
  265 +
  266 +declare TTInfoDetail_Wraps
  267 + xlId: String // 线路id(cast字符串-方便比较)
  268 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  269 +
  270 + detailsMap: Map // 明细Map,Map<路牌id, List<TTInfoDetail_Wrap>>
  271 +end
  272 +
  273 +rule "calcu_TTInfoDetail_Wraps"
  274 + salience 700
  275 + when
  276 + $lr: Loop_result($xlId: xlId)
  277 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  278 + $ttInfoStatList: List(size > 0) from collect (TTInfo_gid_stat(ttInfoId == $ttInfoId))
  279 + then
  280 + TTInfoDetail_Wraps ttInfoDetail_wraps = new TTInfoDetail_Wraps();
  281 + ttInfoDetail_wraps.setXlId($xlId);
  282 + ttInfoDetail_wraps.setTtInfoId($ttInfoId);
  283 + ttInfoDetail_wraps.setDetailsMap(new HashMap());
  284 +
  285 + // 将list的形式变成 Map<路牌id, TTInfo_gid_stat>
  286 + Map statMap = new HashMap();
  287 + for (int i = 0; i < $ttInfoStatList.size(); i++) {
  288 + TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) $ttInfoStatList.get(i);
  289 + statMap.put(ttInfo_gid_stat.getGid(), ttInfo_gid_stat);
  290 + }
  291 +
  292 + // 迭代ttinfodetail,拼装 TTInfoDetail_Wraps
  293 + List detaillist = tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId));
  294 + for (int j = 0; j < detaillist.size(); j++) {
  295 + TTInfoDetail ttInfoDetail = (TTInfoDetail) detaillist.get(j);
  296 + String gid = String.valueOf(ttInfoDetail.getLp().getId());
  297 +
  298 + if (ttInfoDetail_wraps.getDetailsMap().get(gid) == null) {
  299 + ttInfoDetail_wraps.getDetailsMap().put(gid, new ArrayList());
  300 + }
  301 +
  302 + // 获取stat
  303 + TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) statMap.get(gid);
  304 +
  305 + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap();
  306 + ttInfoDetail_wrap.setIsFirstBc(1 == ttInfoDetail.getFcno());
  307 + ttInfoDetail_wrap.setIsLastBc(ttInfo_gid_stat.getMaxFcno() == ttInfoDetail.getFcno());
  308 +
  309 + LocalTime fcsj = fcsjTime(ttInfoDetail.getFcsj());
  310 + LocalTime fbsj = ttInfo_gid_stat.getFbTime();
  311 + Integer fbfcno = ttInfo_gid_stat.getFbfcno();
  312 + // 不用时间判定,因为有的路牌,后面的班次都是凌晨的,时间反而比分班时间早,不合理,所以使用发车顺序号做第二次比较
  313 +// ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj)));
  314 + ttInfoDetail_wrap.setIsFb(fbsj == null ? false : ttInfoDetail.getFcno() >= fbfcno);
  315 +
  316 + ttInfoDetail_wrap.setSelf(ttInfoDetail);
  317 +
  318 + ((List) ttInfoDetail_wraps.getDetailsMap().get(gid)).add(ttInfoDetail_wrap);
  319 +
  320 + }
  321 +
  322 +
  323 + insert(ttInfoDetail_wraps);
  324 +
  325 + log.info("xlid={}, ttinfoid={}, lpstatCount={}, detailLpCount={}",
  326 + $xlId, $ttInfoId, $ttInfoStatList.size(), ttInfoDetail_wraps.getDetailsMap().keySet().size());
  327 +
  328 +
  329 +end
  330 +
  331 +declare TTInfoDetail_Wraps_map
  332 + xlId: String // 线路id(cast字符串-方便比较)
  333 +
  334 + wrapsMap: Map // 明细Map,Map<时刻表Id, TTInfoDetail_Wraps>
  335 +end
  336 +
  337 +rule "calcu_TTInfoDetail_Wraps_toMap"
  338 + salience 600
  339 + when
  340 + $lr: Loop_result($xlId: xlId)
  341 + $wrapsList: List(size > 0) from collect (TTInfoDetail_Wraps(xlId == $xlId))
  342 + then
  343 + // 转换成Map
  344 + TTInfoDetail_Wraps_map all = new TTInfoDetail_Wraps_map();
  345 + all.setXlId($xlId);
  346 + all.setWrapsMap(new HashMap());
  347 +
  348 + for (int i = 0; i < $wrapsList.size(); i++) {
  349 + TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $wrapsList.get(i);
  350 + all.getWrapsMap().put(ttInfoDetail_wraps.getTtInfoId(), ttInfoDetail_wraps);
  351 + }
  352 +
  353 + insert(all);
  354 +end
  355 +
  356 +
  357 +
  358 +
  359 +//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------//
  360 +
  361 +
  362 +rule "Calcu_SchedulePlanInfo"
  363 + salience 500
  364 + when
  365 + $param: PlanCalcuParam_input($xlId: xlId)
  366 + $lr: Loop_result(xlId == $xlId)
  367 + $ccs: CarConfig_Wraps(xlId == $xlId)
  368 + $ecs: EmployeeConfig_Wraps(xlId == $xlId)
  369 + $tts: TTInfoDetail_Wraps_map(xlId == $xlId)
  370 + then
  371 + // 线路
  372 + Line xl = lineRepository.findOne(Integer.parseInt($xlId));
  373 +
  374 + // 查找公司
  375 + List gses = (List) businessRepository.findAll();
  376 + // 构造公司代码对应map
  377 + Map gsMap = gsMap(gses);
  378 + // 构造分公司对应的map
  379 + Map fgsMap = fgsMap(gses);
  380 +
  381 + for (int i = 0; i < $lr.getRuleLoop().size(); i++) {
  382 + ScheduleResult_output sro = (ScheduleResult_output) $lr.getRuleLoop().get(i);
  383 +
  384 + // 日期
  385 + DateTime sd = sro.getSd();
  386 + // 路牌
  387 + String gid = sro.getGuideboardId();
  388 + // 车辆配置
  389 + CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
  390 + (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
  391 + // 人员配置
  392 + List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
  393 + ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
  394 +
  395 + // 时刻表id
  396 + String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
  397 + TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $tts.getWrapsMap().get(ttInfoId);
  398 + if (ttInfoDetail_wraps == null) {
  399 + // 时刻表为空,直接跳过
  400 + // 如1118路,周末不开,此是时刻表指定一个空表
  401 + // TODO:这个以后要改的,选时刻表的规则要修正,没有默认的时刻表
  402 + continue;
  403 + }
  404 +
  405 + List detaillist = (List) ttInfoDetail_wraps.getDetailsMap().get(gid);
  406 + if (detaillist == null) {
  407 + // 这里翻到的路牌时刻表里可能没有,
  408 + // 因为没有考虑翻班格式(就是做几休几)
  409 + // 所有翻班格式全由时刻表决定,即时刻表有的路牌就做,没有不做
  410 + continue;
  411 + }
  412 +
  413 + for (int j = 0; j < detaillist.size(); j++) {
  414 + TTInfoDetail_Wrap wrap = (TTInfoDetail_Wrap) detaillist.get(j);
  415 +
  416 + SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
  417 + xl,
  418 + sro,
  419 + wrap.getSelf(),
  420 + wrap.getIsFb(),
  421 + carConfigInfo,
  422 + eclist,
  423 + $param.getSchedulePlan(),
  424 + wrap.getIsFirstBc(),
  425 + wrap.getIsLastBc(),
  426 + sro.getsType()
  427 + );
  428 +
  429 + // 获取公司,分公司信息
  430 + String gsbm = xl.getCompany();
  431 + String fgsbm = xl.getBrancheCompany();
  432 + Business gs = null;
  433 + Business fgs = null;
  434 +
  435 + if (StringUtils.isNotEmpty(gsbm)) {
  436 + gs = (Business) gsMap.get(gsbm);
  437 + }
  438 + if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
  439 + fgs = (Business) fgsMap.get(gsbm + "_" + fgsbm);
  440 + }
  441 +
  442 + if (gs != null) {
  443 + schedulePlanInfo.setGsBm(gs.getBusinessCode());
  444 + schedulePlanInfo.setGsName(gs.getBusinessName());
  445 + }
  446 + if (fgs != null) {
  447 + schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
  448 + schedulePlanInfo.setFgsName(fgs.getBusinessName());
  449 + }
  450 +
  451 + // 操作人,操作时间
  452 + schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy());
  453 + schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate());
  454 + schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy());
  455 + schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate());
  456 +
  457 + // result 输出
  458 + planResult.getSchedulePlanInfos().add(schedulePlanInfo);
  459 +
  460 + }
  461 +
  462 + }
  463 +
  464 + log.info("xlid={} plan ok!", $xlId);
  465 +
  466 +end
  467 +
  468 +
  469 +
  470 +
  471 +
  472 +
  473 +
  474 +
  475 +
  476 +
  477 +
  478 +
  479 +
  480 +
... ...
src/main/resources/rules/kBase1_core_rerun.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
7   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
8   -
9   -import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
10   -import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param;
11   -
12   -import com.bsth.repository.schedule.CarConfigInfoRepository;
13   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
14   -
15   -import org.slf4j.Logger;
16   -import com.bsth.entity.schedule.CarConfigInfo;
17   -import java.util.HashMap;
18   -import com.bsth.entity.schedule.EmployeeConfigInfo;
19   -import com.bsth.entity.schedule.SchedulePlanInfo;
20   -
21   -// 全局日志类(一般使用调用此规则的service类)
22   -global Logger log;
23   -
24   -global CarConfigInfoRepository carConfigInfoRepository;
25   -global EmployeeConfigInfoRepository employeeConfigInfoRepository;
26   -
27   -// 输出
28   -
29   -
30   -/*
31   - 规则说明:
32   - 1、对应路牌规则:将对应路牌的车辆,人员替换指定的套跑班次已有的配置
33   - 2、对应班车规则:直接使用指定的人员,车辆替换指定的套跑班次已有的配置
34   -*/
35   -
36   -//-------------------- 第一阶段、计算对应路牌套跑的车辆配置,人员配置数据 -----------------//
37   -
38   -//--------------- 车辆配置信息载入 -------------//
39   -declare Dylp_CarConfig_Wraps
40   - xlId: String // 线路Id
41   - ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
42   -end
43   -
44   -rule "calcu_Dylp_CarConfig_Wraps"
45   - salience 1000
46   - when
47   - $rp: RerunRule_param($xlId: mxlid)
48   - $dylpxlid: String() from $rp.getXlIds_dylp()
49   - then
50   - List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
51   -
52   - Dylp_CarConfig_Wraps carConfig_wraps = new Dylp_CarConfig_Wraps();
53   - carConfig_wraps.setXlId($dylpxlid);
54   - carConfig_wraps.setCcMap(new HashMap());
55   -
56   - for (int i = 0; i < carConfigInfos.size(); i++) {
57   - CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
58   - carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
59   - }
60   -
61   - insert(carConfig_wraps);
62   -
63   - log.info("calcu_Dylp_CarConfig_Wraps");
64   -
65   -end
66   -
67   -//--------------- 人员配置信息载入 --------------//
68   -declare Dylp_EmployeeConfig_Wraps
69   - xlId: String // 线路Id
70   - ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
71   -end
72   -
73   -rule "calcu_Dylp_EmployeeConfig_Wraps"
74   - salience 1000
75   - when
76   - $rp: RerunRule_param($xlId: mxlid)
77   - $dylpxlid: String() from $rp.getXlIds_dylp()
78   - then
79   - List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
80   -
81   - Dylp_EmployeeConfig_Wraps employeeConfig_wraps = new Dylp_EmployeeConfig_Wraps();
82   - employeeConfig_wraps.setXlId($dylpxlid);
83   - employeeConfig_wraps.setEcMap(new HashMap());
84   -
85   - for (int i = 0; i < employeeConfigInfos.size(); i++) {
86   - EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
87   - employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
88   - }
89   -
90   - insert(employeeConfig_wraps);
91   -
92   - log.info("calcu_Dylp_EmployeeConfig_Wraps");
93   -
94   -end
95   -
96   -//-------------------- 第二阶段、包装对应路牌的循环规则输出 -----------------//
97   -
98   -declare Dylp_ScheduleResult_output_wrap
99   - xlId: String // 线路
100   - sd: DateTime // 日期
101   - lp: String // 路牌
102   - cc: CarConfigInfo // 使用的车辆配置
103   - ec: List // 使用的人员配置 List<EmployeeConfigInfo>
104   -end
105   -
106   -rule "calcu_Dylp_ScheduleResult_output_wrap"
107   - salience 900
108   - when
109   - $sro: ScheduleResults_output($xlId: xlid)
110   - $sr: ScheduleResult_output() from $sro.getResults()
111   - Dylp_CarConfig_Wraps(xlId == $xlId, $ccmap: ccMap)
112   - Dylp_EmployeeConfig_Wraps(xlId == $xlId, $ecmap: ecMap)
113   - then
114   - Dylp_ScheduleResult_output_wrap wrap = new Dylp_ScheduleResult_output_wrap();
115   - wrap.setXlId($xlId);
116   - wrap.setSd($sr.getSd());
117   - wrap.setLp($sr.getGuideboardId());
118   - wrap.setCc((CarConfigInfo) $ccmap.get($sr.getCarConfigId()));
119   -
120   - List ecs = new ArrayList();
121   - String[] ecids = $sr.getEmployeeConfigId().split("-"); // 分班的人
122   - for (int i = 0; i < ecids.length; i++) {
123   - ecs.add($ecmap.get(ecids[i]));
124   - }
125   - wrap.setEc(ecs);
126   -
127   -// log.info("xlid = {}", $xlId);
128   -
129   - insert(wrap);
130   -end
131   -
132   -//-------------------- 第三阶段、套跑线路,替换班次的车辆,人员 --------------------//
133   -rule "calcu_Dylp_rerun_update_dylp"
134   - salience 800
135   -// no-loop
136   - when
137   - $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
138   - $ri: RerunRule_input(
139   - type == "dylp",
140   - xl == $xlid.toString(),
141   - ttinfo == $ttinfo.toString(),
142   - lp == $lp.toString(),
143   - fcsj == $fcsj,
144   - $sxl: s_xl, $slp: s_lp, $type: usetype, $hrtype: userhrtype
145   - )
146   - $dsro: Dylp_ScheduleResult_output_wrap(
147   - xlId == $sxl,
148   - lp == $slp,
149   - sd.getMillis() == $sd.getTime()
150   - )
151   - then
152   -// log.info("TODO:测试 {}", $fcsj);
153   -
154   - $spi.setRerunInfoDylp($dsro.getCc(), $dsro.getEc(), $type, $hrtype);
155   -
156   -end
157   -
158   -rule "calcu_Dylp_rerun_update_dybc"
159   - salience 700
160   - when
161   - $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
162   - $ri: RerunRule_input(
163   - type == "dybc",
164   - xl == $xlid.toString(),
165   - ttinfo == $ttinfo.toString(),
166   - lp == $lp.toString(),
167   - fcsj == $fcsj
168   - )
169   -
170   - then
171   -
172   - $spi.setRerunInfoDybc($ri);
173   -
174   -
175   -end
176   -
177   -
178   -
179   -
180   -
181   -
182   -
183   -
184   -
185   -
186   -
187   -
188   -
189   -
190   -
191   -
192   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  7 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  8 +
  9 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  10 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param;
  11 +
  12 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  13 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  14 +
  15 +import org.slf4j.Logger;
  16 +import com.bsth.entity.schedule.CarConfigInfo;
  17 +import java.util.HashMap;
  18 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  19 +import com.bsth.entity.schedule.SchedulePlanInfo;
  20 +
  21 +// 全局日志类(一般使用调用此规则的service类)
  22 +global Logger log;
  23 +
  24 +global CarConfigInfoRepository carConfigInfoRepository;
  25 +global EmployeeConfigInfoRepository employeeConfigInfoRepository;
  26 +
  27 +// 输出
  28 +
  29 +
  30 +/*
  31 + 规则说明:
  32 + 1、对应路牌规则:将对应路牌的车辆,人员替换指定的套跑班次已有的配置
  33 + 2、对应班车规则:直接使用指定的人员,车辆替换指定的套跑班次已有的配置
  34 +*/
  35 +
  36 +//-------------------- 第一阶段、计算对应路牌套跑的车辆配置,人员配置数据 -----------------//
  37 +
  38 +//--------------- 车辆配置信息载入 -------------//
  39 +declare Dylp_CarConfig_Wraps
  40 + xlId: String // 线路Id
  41 + ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
  42 +end
  43 +
  44 +rule "calcu_Dylp_CarConfig_Wraps"
  45 + salience 1000
  46 + when
  47 + $rp: RerunRule_param($xlId: mxlid)
  48 + $dylpxlid: String() from $rp.getXlIds_dylp()
  49 + then
  50 + List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
  51 +
  52 + Dylp_CarConfig_Wraps carConfig_wraps = new Dylp_CarConfig_Wraps();
  53 + carConfig_wraps.setXlId($dylpxlid);
  54 + carConfig_wraps.setCcMap(new HashMap());
  55 +
  56 + for (int i = 0; i < carConfigInfos.size(); i++) {
  57 + CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
  58 + carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
  59 + }
  60 +
  61 + insert(carConfig_wraps);
  62 +
  63 + log.info("calcu_Dylp_CarConfig_Wraps");
  64 +
  65 +end
  66 +
  67 +//--------------- 人员配置信息载入 --------------//
  68 +declare Dylp_EmployeeConfig_Wraps
  69 + xlId: String // 线路Id
  70 + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
  71 +end
  72 +
  73 +rule "calcu_Dylp_EmployeeConfig_Wraps"
  74 + salience 1000
  75 + when
  76 + $rp: RerunRule_param($xlId: mxlid)
  77 + $dylpxlid: String() from $rp.getXlIds_dylp()
  78 + then
  79 + List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
  80 +
  81 + Dylp_EmployeeConfig_Wraps employeeConfig_wraps = new Dylp_EmployeeConfig_Wraps();
  82 + employeeConfig_wraps.setXlId($dylpxlid);
  83 + employeeConfig_wraps.setEcMap(new HashMap());
  84 +
  85 + for (int i = 0; i < employeeConfigInfos.size(); i++) {
  86 + EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
  87 + employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
  88 + }
  89 +
  90 + insert(employeeConfig_wraps);
  91 +
  92 + log.info("calcu_Dylp_EmployeeConfig_Wraps");
  93 +
  94 +end
  95 +
  96 +//-------------------- 第二阶段、包装对应路牌的循环规则输出 -----------------//
  97 +
  98 +declare Dylp_ScheduleResult_output_wrap
  99 + xlId: String // 线路
  100 + sd: DateTime // 日期
  101 + lp: String // 路牌
  102 + cc: CarConfigInfo // 使用的车辆配置
  103 + ec: List // 使用的人员配置 List<EmployeeConfigInfo>
  104 +end
  105 +
  106 +rule "calcu_Dylp_ScheduleResult_output_wrap"
  107 + salience 900
  108 + when
  109 + $sro: ScheduleResults_output($xlId: xlid)
  110 + $sr: ScheduleResult_output() from $sro.getResults()
  111 + Dylp_CarConfig_Wraps(xlId == $xlId, $ccmap: ccMap)
  112 + Dylp_EmployeeConfig_Wraps(xlId == $xlId, $ecmap: ecMap)
  113 + then
  114 + Dylp_ScheduleResult_output_wrap wrap = new Dylp_ScheduleResult_output_wrap();
  115 + wrap.setXlId($xlId);
  116 + wrap.setSd($sr.getSd());
  117 + wrap.setLp($sr.getGuideboardId());
  118 + wrap.setCc((CarConfigInfo) $ccmap.get($sr.getCarConfigId()));
  119 +
  120 + List ecs = new ArrayList();
  121 + String[] ecids = $sr.getEmployeeConfigId().split("-"); // 分班的人
  122 + for (int i = 0; i < ecids.length; i++) {
  123 + ecs.add($ecmap.get(ecids[i]));
  124 + }
  125 + wrap.setEc(ecs);
  126 +
  127 +// log.info("xlid = {}", $xlId);
  128 +
  129 + insert(wrap);
  130 +end
  131 +
  132 +//-------------------- 第三阶段、套跑线路,替换班次的车辆,人员 --------------------//
  133 +rule "calcu_Dylp_rerun_update_dylp"
  134 + salience 800
  135 +// no-loop
  136 + when
  137 + $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
  138 + $ri: RerunRule_input(
  139 + type == "dylp",
  140 + xl == $xlid.toString(),
  141 + ttinfo == $ttinfo.toString(),
  142 + lp == $lp.toString(),
  143 + fcsj == $fcsj,
  144 + $sxl: s_xl, $slp: s_lp, $type: usetype, $hrtype: userhrtype
  145 + )
  146 + $dsro: Dylp_ScheduleResult_output_wrap(
  147 + xlId == $sxl,
  148 + lp == $slp,
  149 + sd.getMillis() == $sd.getTime()
  150 + )
  151 + then
  152 +// log.info("TODO:测试 {}", $fcsj);
  153 +
  154 + $spi.setRerunInfoDylp($dsro.getCc(), $dsro.getEc(), $type, $hrtype);
  155 +
  156 +end
  157 +
  158 +rule "calcu_Dylp_rerun_update_dybc"
  159 + salience 700
  160 + when
  161 + $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
  162 + $ri: RerunRule_input(
  163 + type == "dybc",
  164 + xl == $xlid.toString(),
  165 + ttinfo == $ttinfo.toString(),
  166 + lp == $lp.toString(),
  167 + fcsj == $fcsj
  168 + )
  169 +
  170 + then
  171 +
  172 + $spi.setRerunInfoDybc($ri);
  173 +
  174 +
  175 +end
  176 +
  177 +
  178 +
  179 +
  180 +
  181 +
  182 +
  183 +
  184 +
  185 +
  186 +
  187 +
  188 +
  189 +
  190 +
  191 +
  192 +
... ...
src/main/resources/rules/kBase1_core_shiftloop.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
7   -
8   -import com.bsth.service.schedule.utils.Md5Util;
9   -
10   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
11   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
12   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
13   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
14   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
15   -
16   -import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
17   -
18   -import com.bsth.entity.schedule.SchedulePlan;
19   -
20   -import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
21   -
22   -import org.slf4j.Logger;
23   -
24   -global Logger log;
25   -global ScheduleResults_output scheduleResult;
26   -global ScheduleRuleService scheduleRuleService;
27   -
28   -/*
29   - 存在(翻班格式)
30   -*/
31   -
32   -//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
33   -
34   -declare Calcu_days_result_pre
35   - ruleId: String // 规则Id
36   - ruleMd5: String // 规则md5
37   - ruleEcCount: Integer // 人员范围个数
38   -
39   - calcu_index_lp : Integer // 计算之后路牌的起始索引
40   - calcu_index_ry : Integer // 计算之后人员的起始索引
41   -
42   - fbtype: Integer // 翻班type,0:时刻表type 1:翻班格式type
43   - fbweeks: List // 翻班格式,如:1111001111001
44   - fbgs_index: Integer // 翻班格式起始索引(从0开始)
45   -
46   - // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)
47   - calcu_start_date_1: DateTime // 第一部分开始计算日期
48   - calcu_end_date_1: DateTime // 第一部分结束计算日期
49   -
50   - // 2、第二部分循环需要用到的数据
51   - sdays : Integer // 总共需要排班的天数
52   - calcu_start_date_2 : DateTime // 开始计算日期
53   - calcu_end_date_2 : DateTime // 结束计算日期
54   -
55   -end
56   -
57   -/*
58   - 计算启用日期,开始计算日期,结束计算日期,相差天数
59   - 1、规则启用日期小于开始计算日期
60   - 2、规则启用日期大于等于开始日期,小于等于结束日期
61   -*/
62   -// 1、启用日期 < 开始日期
63   -rule "calcu_days_1_"
64   - salience 1000
65   - when
66   - ScheduleCalcuParam_input(
67   - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
68   - $fromDate : fromDate,
69   - $toDate : toDate,
70   - $xlId: xlId
71   - )
72   - $sri: ScheduleRule_input(
73   - $ruleId : ruleId, $qyrq : qyrq,
74   - $lpindex : startGbdIndex, $ryindex: startEIndex)
75   - eval($qyrq.isBefore($fromDate))
76   - then
77   - scheduleResult.setXlid($xlId);
78   -
79   - // 构造Calcu_days_result_pre,用于路牌
80   - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
81   - cdrp.setRuleId($ruleId);
82   - cdrp.setCalcu_index_lp($lpindex);
83   - cdrp.setCalcu_index_ry($ryindex);
84   - cdrp.setCalcu_start_date_1($qyrq);
85   - cdrp.setCalcu_end_date_1($fromDate);
86   - Period p2 = new Period($fromDate, $toDate, PeriodType.days());
87   - cdrp.setSdays(p2.getDays() + 1);
88   - cdrp.setCalcu_start_date_2($fromDate);
89   - cdrp.setCalcu_end_date_2($toDate);
90   -
91   - // 翻班相关
92   - cdrp.setFbtype($sri.getFbtype());
93   - cdrp.setFbgs_index(0);
94   - cdrp.setFbweeks($sri.getWeekdays());
95   -
96   - /**
97   - * 规则md5值(不使用id判定,使用md5判定)
98   - * 使用,启用日期,路牌范围,结合生成md5编码
99   - */
100   - String ruleMd5 = Md5Util.getMd5(
101   - String.valueOf($qyrq.getMillis()) +
102   - "_" +
103   - $sri.getSelf().getLpIds() +
104   - "_" +
105   - $sri.getSelf().getLpStart().toString()
106   - );
107   - cdrp.setRuleMd5(ruleMd5);
108   - // 人员范围个数
109   - cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
110   -
111   - insert(cdrp);
112   -
113   -// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
114   -
115   -end
116   -
117   -// 启用日期 属于 [开始日期,结束日期]
118   -rule "calcu_days_2_"
119   - salience 1000
120   - when
121   - ScheduleCalcuParam_input(
122   - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
123   - $fromDate : fromDate,
124   - $toDate : toDate,
125   - $xlId: xlId
126   - )
127   - $sri: ScheduleRule_input(
128   - $ruleId : ruleId, $qyrq : qyrq,
129   - $lpindex : startGbdIndex, $ryindex: startEIndex)
130   - eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
131   - then
132   - scheduleResult.setXlid($xlId);
133   -
134   - // 构造Calcu_days_result_pre,用于路牌
135   - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
136   - cdrp.setRuleId($ruleId);
137   - cdrp.setCalcu_index_lp($lpindex);
138   - cdrp.setCalcu_index_ry($ryindex);
139   - cdrp.setCalcu_start_date_1($qyrq);
140   - cdrp.setCalcu_end_date_1($qyrq);
141   - Period p2 = new Period($qyrq, $toDate, PeriodType.days());
142   - cdrp.setSdays(p2.getDays() + 1);
143   - cdrp.setCalcu_start_date_2($qyrq);
144   - cdrp.setCalcu_end_date_2($toDate);
145   -
146   - // 翻班相关
147   - cdrp.setFbtype($sri.getFbtype());
148   - cdrp.setFbgs_index(0);
149   - cdrp.setFbweeks($sri.getWeekdays());
150   -
151   - /**
152   - * 规则md5值(不使用id判定,使用md5判定)
153   - * 使用,启用日期,路牌范围,结合生成md5编码
154   - */
155   - String ruleMd5 = Md5Util.getMd5(
156   - String.valueOf($qyrq.getMillis()) +
157   - "_" +
158   - $sri.getSelf().getLpIds() +
159   - "_" +
160   - $sri.getSelf().getLpStart().toString()
161   - );
162   - cdrp.setRuleMd5(ruleMd5);
163   - // 人员范围个数
164   - cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
165   -
166   - insert(cdrp);
167   -
168   -// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
169   -
170   -end
171   -
172   -// 使用已经排过班的数据修正Calcu_days_result_pre
173   -// 1、避免每次从规则的启用日期开始算
174   -// 2、时刻表会不停的修正,如果每次都从规则启用日期开始算,会出错
175   -
176   -declare SchedulePlanRuleResult_wrap
177   - ruleId: String // 规则Id
178   - ruleMd5: String // 规则md5编码
179   - scheduleDate: DateTime // 排班日期
180   -
181   - isUsed: Boolean = false // 是否被使用过
182   -
183   - self: SchedulePlanRuleResult; // 原始对象数据
184   -end
185   -
186   -rule "Calcu_SchedulePlanRuleResult_wrap"
187   - salience 950
188   - when
189   - ScheduleCalcuParam_input(
190   - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
191   - $fromDate : fromDate,
192   - $toDate : toDate,
193   - $xlId: xlId,
194   - $self: schedulePlan
195   - )
196   - eval($self.getIsHistoryPlanFirst() == true) // 是否使用历史排班标识
197   - $sprr: SchedulePlanRuleResult() from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate())
198   - eval($sprr.getQyrq() != null)
199   -
200   - then
201   - // 创建班序历史结果数据
202   - SchedulePlanRuleResult_wrap schedulePlanRuleResult_wrap = new SchedulePlanRuleResult_wrap();
203   - schedulePlanRuleResult_wrap.setRuleId($sprr.getRuleId());
204   - schedulePlanRuleResult_wrap.setScheduleDate(new DateTime($sprr.getScheduleDate()));
205   - schedulePlanRuleResult_wrap.setSelf($sprr);
206   -
207   - // 规则Md5编码
208   - String md5 = Md5Util.getMd5(
209   - String.valueOf($sprr.getQyrq().getTime()) +
210   - "_" +
211   - $sprr.getGids() +
212   - "_" +
213   - $sprr.getOrigingidindex()
214   - );
215   -
216   -// System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh());
217   -
218   - schedulePlanRuleResult_wrap.setRuleMd5(md5);
219   -
220   - insert(schedulePlanRuleResult_wrap);
221   -end
222   -
223   -
224   -// 1、启用日期 < 开始日期
225   -// 2、如果最近的排班规则历史时间在 (启用日期,开始日期) 之间,需要重新修正预处理数据
226   -rule "calcu_days_1_with_result"
227   - no-loop
228   - salience 960
229   - when
230   - $cdrp: Calcu_days_result_pre(
231   - calcu_start_date_1.isBefore(calcu_start_date_2),
232   - $ruleId: ruleId,
233   - $ruleMd5: ruleMd5,
234   - $ruleEcCount: ruleEcCount
235   - )
236   - $srrr_wrap: SchedulePlanRuleResult_wrap(
237   -// ruleId == $ruleId,
238   - ruleMd5 == $ruleMd5,
239   - scheduleDate.isAfter($cdrp.calcu_start_date_1),
240   - scheduleDate.isBefore($cdrp.calcu_start_date_2),
241   - isUsed == false,
242   - $scheduleDate: scheduleDate,
243   - $self: self
244   - )
245   - then
246   - // 修正排班数据
247   -// log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate);
248   -
249   - // 路牌范围起始index使用历史数据
250   - $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex()));
251   - // 人员范围起始index,需要判定,如果长度都是一样的,使用历史的,否则不更新,使用最新的
252   - String history_ecids = $self.getEcids();
253   - if ($ruleEcCount == history_ecids.split(",").length) {
254   - $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex()));
255   - }
256   -
257   - // 翻班格式利用路牌的历史index更新
258   - int fb_temp = Integer.valueOf($self.getGidindex()) % $cdrp.getFbweeks().size();
259   - $cdrp.setFbgs_index(fb_temp);
260   -
261   - $cdrp.setCalcu_start_date_1($scheduleDate);
262   - update($cdrp);
263   -
264   - $srrr_wrap.setIsUsed(true);
265   - update($srrr_wrap);
266   -
267   -end
268   -
269   -
270   -
271   -//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//
272   -
273   -function void calcu_loop1_fb(Calcu_days_result_pre $cdrp, ScheduleRule_input $sri, Logger log) {
274   - Integer $lpindex = $cdrp.getCalcu_index_lp();
275   - Integer $lprangesize = $sri.getGuideboardIds().size();
276   - Integer $ryindex = $cdrp.getCalcu_index_ry();
277   - Integer $ryrangesize = $sri.getEmployeeConfigIds().size();
278   - Integer $fbindex = $cdrp.getFbgs_index();
279   - Integer $fbfangesize = $sri.getWeekdays().size();
280   - DateTime $csd1 = $cdrp.getCalcu_start_date_1();
281   - DateTime $ced1 = $cdrp.getCalcu_end_date_1();
282   -
283   - String $ruleId = $cdrp.getRuleId();
284   -
285   - $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
286   - $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
287   -
288   - $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
289   - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
290   -
291   -// log.info("calcu_loop1_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
292   -// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd1, $ced1);
293   -
294   -}
295   -function void calcu_loop1_not_fb(Calcu_days_result_pre $cdrp, ScheduleRule_input $sri, Logger log) {
296   - DateTime $csd1 = $cdrp.getCalcu_start_date_1();
297   - DateTime $ced1 = $cdrp.getCalcu_end_date_1();
298   - Integer $fbindex = $cdrp.getFbgs_index();
299   - Integer $fbfangesize = $sri.getWeekdays().size();
300   -
301   - $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
302   - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
303   -
304   -// log.info("calcu_loop1_not_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
305   -// $cdrp.getRuleId(), $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd1, $ced1);
306   -}
307   -
308   -
309   -rule "Calcu_loop1_fbtype_with_0_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是false,就跳过
310   - salience 900
311   - when
312   - $cdrp: Calcu_days_result_pre(
313   - calcu_start_date_1.isBefore(calcu_end_date_1),
314   - $ruleId: ruleId,
315   - fbtype == "1",
316   - $fbindex : fbgs_index
317   - )
318   - $sri: ScheduleRule_input(
319   - ruleId == $ruleId,
320   - weekdays[$fbindex] == false
321   - )
322   - then
323   - calcu_loop1_not_fb($cdrp, $sri, log);
324   - update($cdrp);
325   -end
326   -
327   -rule "Calcu_loop1_fbtype_with_1_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里存在指定路牌,就翻
328   - salience 900
329   - when
330   - $cdrp: Calcu_days_result_pre(
331   - calcu_start_date_1.isBefore(calcu_end_date_1),
332   - $csd1: calcu_start_date_1,
333   - $ruleId: ruleId,
334   - fbtype == "1",
335   - $lpindex: calcu_index_lp,
336   - $fbindex : fbgs_index
337   - )
338   - $sri: ScheduleRule_input(
339   - ruleId == $ruleId,
340   - $gids: guideboardIds,
341   - weekdays[$fbindex] == true
342   - )
343   - $liro: LpInfoResult_output(
344   - dateTime.isEqual($csd1),
345   - $gids[$lpindex] == lpId
346   - )
347   - then
348   - calcu_loop1_fb($cdrp, $sri, log);
349   - update($cdrp);
350   -
351   -end
352   -
353   -rule "Calcu_loop1_fbtype_with_1_no_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里不存在指定路牌,就跳过
354   - salience 900
355   - when
356   - $cdrp: Calcu_days_result_pre(
357   - calcu_start_date_1.isBefore(calcu_end_date_1),
358   - $csd1: calcu_start_date_1,
359   - $ruleId: ruleId,
360   - fbtype == "1",
361   - $fbindex : fbgs_index
362   - )
363   - $sri: ScheduleRule_input(
364   - ruleId == $ruleId,
365   - weekdays[$fbindex] == true
366   - )
367   - then
368   - calcu_loop1_not_fb($cdrp, $sri, log);
369   - update($cdrp);
370   -end
371   -
372   -
373   -rule "Calcu_loop1_timetabletype_with_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中存在,就翻
374   - salience 900
375   - when
376   - $cdrp: Calcu_days_result_pre(
377   - calcu_start_date_1.isBefore(calcu_end_date_1),
378   - $csd1: calcu_start_date_1,
379   - $ruleId: ruleId,
380   - fbtype == "0",
381   - $lpindex: calcu_index_lp
382   - )
383   - $sri: ScheduleRule_input(
384   - ruleId == $ruleId,
385   - $gids: guideboardIds
386   - )
387   - $liro: LpInfoResult_output(
388   - dateTime.isEqual($csd1),
389   - $gids[$lpindex] == lpId
390   - )
391   - then
392   - calcu_loop1_fb($cdrp, $sri, log);
393   - update($cdrp);
394   -end
395   -
396   -rule "Calcu_loop1_timetabletype_with_no_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中不存在,就跳过
397   - salience 900
398   - when
399   - $cdrp: Calcu_days_result_pre(
400   - calcu_start_date_1.isBefore(calcu_end_date_1),
401   - $csd1: calcu_start_date_1,
402   - $ruleId: ruleId,
403   - fbtype == "0"
404   - )
405   - $sri: ScheduleRule_input(
406   - ruleId == $ruleId
407   - )
408   - then
409   - calcu_loop1_not_fb($cdrp, $sri, log);
410   - update($cdrp);
411   -end
412   -
413   -//------------------------- 第三阶段、计算规则准备数据2(第二组循环) ----------------------------//
414   -
415   -function void calcu_loop2_fb(
416   - SchedulePlan $sp,
417   - Calcu_days_result_pre $cdrp,
418   - ScheduleRule_input $sri,
419   - LpInfoResult_output $liro,
420   - ScheduleResults_output rs,
421   - Logger log) {
422   - String $ruleId = $cdrp.getRuleId();
423   - DateTime $csd2 = $cdrp.getCalcu_start_date_2();
424   - DateTime $ced2 = $cdrp.getCalcu_end_date_2();
425   - Integer $lpindex = $cdrp.getCalcu_index_lp();
426   - List $gids = $sri.getGuideboardIds();
427   - Integer $lprangesize = $sri.getGuideboardIds().size();
428   - Integer $ryindex = $cdrp.getCalcu_index_ry();
429   - List $eids = $sri.getEmployeeConfigIds();
430   - Integer $ryrangesize = $sri.getEmployeeConfigIds().size();
431   - Integer $fbindex = $cdrp.getFbgs_index();
432   - Integer $fbfangesize = $sri.getWeekdays().size();
433   - String $cid = $sri.getCarConfigId();
434   - String $xlid = $sri.getXlId();
435   -
436   - com.bsth.entity.schedule.rule.ScheduleRule1Flat $srf = $sri.getSelf();
437   -
438   - String $ttinfoId = $liro.getTtInfoId();
439   - String $ttinfoName = $liro.getTtInfoName();
440   -
441   - ScheduleResult_output ro = new ScheduleResult_output();
442   - ro.setRuleId($ruleId);
443   - ro.setSd($csd2);
444   - ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
445   - ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
446   - ro.setCarConfigId($cid);
447   - ro.setXlId($xlid);
448   -
449   - // 类型
450   - ro.setsType($sri.getsType());
451   -
452   - rs.getResults().add(ro);
453   -
454   -// log.info("gogoogogogogo");
455   -
456   - $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
457   - $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
458   -
459   - $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
460   - $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
461   -
462   - if ($sri.getsType() == ScheduleRule_Type.NORMAL) {
463   - // 保存排班规则循环结果 --> SchedulePlanRuleResult
464   - SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp);
465   -// schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId()));
466   - schedulePlanRuleResult.setXlId($srf.getXl().getId());
467   - schedulePlanRuleResult.setXlName($srf.getXl().getName());
468   - schedulePlanRuleResult.setRuleId($ruleId);
469   - schedulePlanRuleResult.setCcId($cid);
470   - schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
471   - schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
472   - schedulePlanRuleResult.setGnames($srf.getLpNames());
473   - schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
474   - schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
475   - schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());
476   - schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));
477   - schedulePlanRuleResult.setScheduleDate($csd2.toDate());
478   - schedulePlanRuleResult.setTtinfoId($ttinfoId);
479   - schedulePlanRuleResult.setTtinfoName($ttinfoName);
480   - schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算
481   - schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算
482   -
483   - rs.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
484   - }
485   -
486   -
487   -
488   -// log.info("calcu_loop2_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
489   -// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
490   -
491   -}
492   -
493   -function void calcu_loop2_not_fb(
494   - Calcu_days_result_pre $cdrp,
495   - ScheduleRule_input $sri,
496   - ScheduleResults_output rs,
497   - Logger log) {
498   -
499   - String $ruleId = $cdrp.getRuleId();
500   - DateTime $csd2 = $cdrp.getCalcu_start_date_2();
501   - DateTime $ced2 = $cdrp.getCalcu_end_date_2();
502   - Integer $lpindex = $cdrp.getCalcu_index_lp();
503   - List $gids = $sri.getGuideboardIds();
504   - Integer $ryindex = $cdrp.getCalcu_index_ry();
505   - List $eids = $sri.getEmployeeConfigIds();
506   - Integer $fbindex = $cdrp.getFbgs_index();
507   - Integer $fbfangesize = $sri.getWeekdays().size();
508   - String $cid = $sri.getCarConfigId();
509   - String $xlid = $sri.getXlId();
510   -
511   - ScheduleResult_output ro = new ScheduleResult_output();
512   - ro.setRuleId($ruleId);
513   - ro.setSd($csd2);
514   -// ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
515   - ro.setGuideboardId("not_fb_lp"); // 不翻班,路牌id用假的,后面会过滤
516   - ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
517   - ro.setCarConfigId($cid);
518   - ro.setXlId($xlid);
519   -
520   - // 类型
521   - ro.setsType($sri.getsType());
522   -
523   - rs.getResults().add(ro);
524   -
525   - $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
526   - $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
527   -
528   -// log.info("calcu_loop2_not_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
529   -// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
530   -
531   -}
532   -
533   -rule "Calcu_loop2_fbtype_with_0_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是false,就跳过
534   - salience 800
535   - when
536   - ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
537   - $cdrp: Calcu_days_result_pre(
538   - calcu_start_date_1.isEqual(calcu_end_date_1),
539   - calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
540   - $ruleId: ruleId,
541   - fbtype == "1",
542   - $fbindex : fbgs_index
543   - )
544   - $sri: ScheduleRule_input(
545   - ruleId == $ruleId,
546   - weekdays[$fbindex] == false
547   - )
548   - then
549   - calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
550   - update($cdrp);
551   -
552   -end
553   -
554   -rule "Calcu_loop2_fbtype_with_1_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里存在指定路牌,就翻
555   - salience 800
556   - when
557   - ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
558   - $cdrp: Calcu_days_result_pre(
559   - calcu_start_date_1.isEqual(calcu_end_date_1),
560   - calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
561   - $csd2: calcu_start_date_2,
562   - $ruleId: ruleId,
563   - fbtype == "1",
564   - $lpindex: calcu_index_lp,
565   - $fbindex : fbgs_index
566   - )
567   - $sri: ScheduleRule_input(
568   - ruleId == $ruleId,
569   - $gids: guideboardIds,
570   - weekdays[$fbindex] == true
571   - )
572   - $liro: LpInfoResult_output(
573   - dateTime.isEqual($csd2),
574   - $gids[$lpindex] == lpId
575   - )
576   - then
577   - calcu_loop2_fb($sp, $cdrp, $sri, $liro, scheduleResult, log);
578   - update($cdrp);
579   -end
580   -
581   -rule "Calcu_loop2_fbtype_with_1_no_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里不存在指定路牌,就跳过
582   - salience 800
583   - when
584   - ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
585   - $cdrp: Calcu_days_result_pre(
586   - calcu_start_date_1.isEqual(calcu_end_date_1),
587   - calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
588   - $ruleId: ruleId,
589   - fbtype == "1",
590   - $fbindex : fbgs_index
591   - )
592   - $sri: ScheduleRule_input(
593   - ruleId == $ruleId,
594   - weekdays[$fbindex] == true
595   - )
596   - then
597   - calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
598   - update($cdrp);
599   -
600   -end
601   -
602   -rule "Calcu_loop2_timetabletype_with_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中存在,就翻
603   - salience 800
604   - when
605   - ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
606   - $cdrp: Calcu_days_result_pre(
607   - calcu_start_date_1.isEqual(calcu_end_date_1),
608   - calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
609   - $csd2: calcu_start_date_2,
610   - $ruleId: ruleId,
611   - fbtype == "0",
612   - $lpindex: calcu_index_lp,
613   - $fbindex : fbgs_index
614   - )
615   - $sri: ScheduleRule_input(
616   - ruleId == $ruleId,
617   - $gids: guideboardIds
618   - )
619   - $liro: LpInfoResult_output(
620   - dateTime.isEqual($csd2),
621   - $gids[$lpindex] == lpId
622   - )
623   - then
624   - calcu_loop2_fb($sp, $cdrp, $sri, $liro, scheduleResult, log);
625   - update($cdrp);
626   -
627   -end
628   -
629   -rule "Calcu_loop2_timetabletype_with_no_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中不存在,就跳过
630   - salience 800
631   - when
632   - ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
633   - $cdrp: Calcu_days_result_pre(
634   - calcu_start_date_1.isEqual(calcu_end_date_1),
635   - calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
636   - $ruleId: ruleId,
637   - fbtype == "0"
638   - )
639   - $sri: ScheduleRule_input(
640   - ruleId == $ruleId
641   - )
642   - then
643   - calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
644   - update($cdrp);
645   -end
646   -
647   -
648   -
649   -
650   -
651   -
652   -
653   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
  7 +
  8 +import com.bsth.service.schedule.utils.Md5Util;
  9 +
  10 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
  11 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
  12 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
  13 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  14 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  15 +
  16 +import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
  17 +
  18 +import com.bsth.entity.schedule.SchedulePlan;
  19 +
  20 +import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
  21 +
  22 +import org.slf4j.Logger;
  23 +
  24 +global Logger log;
  25 +global ScheduleResults_output scheduleResult;
  26 +global ScheduleRuleService scheduleRuleService;
  27 +
  28 +/*
  29 + 存在(翻班格式)
  30 +*/
  31 +
  32 +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
  33 +
  34 +declare Calcu_days_result_pre
  35 + ruleId: String // 规则Id
  36 + ruleMd5: String // 规则md5
  37 + ruleEcCount: Integer // 人员范围个数
  38 +
  39 + calcu_index_lp : Integer // 计算之后路牌的起始索引
  40 + calcu_index_ry : Integer // 计算之后人员的起始索引
  41 +
  42 + fbtype: Integer // 翻班type,0:时刻表type 1:翻班格式type
  43 + fbweeks: List // 翻班格式,如:1111001111001
  44 + fbgs_index: Integer // 翻班格式起始索引(从0开始)
  45 +
  46 + // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)
  47 + calcu_start_date_1: DateTime // 第一部分开始计算日期
  48 + calcu_end_date_1: DateTime // 第一部分结束计算日期
  49 +
  50 + // 2、第二部分循环需要用到的数据
  51 + sdays : Integer // 总共需要排班的天数
  52 + calcu_start_date_2 : DateTime // 开始计算日期
  53 + calcu_end_date_2 : DateTime // 结束计算日期
  54 +
  55 +end
  56 +
  57 +/*
  58 + 计算启用日期,开始计算日期,结束计算日期,相差天数
  59 + 1、规则启用日期小于开始计算日期
  60 + 2、规则启用日期大于等于开始日期,小于等于结束日期
  61 +*/
  62 +// 1、启用日期 < 开始日期
  63 +rule "calcu_days_1_"
  64 + salience 1000
  65 + when
  66 + ScheduleCalcuParam_input(
  67 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  68 + $fromDate : fromDate,
  69 + $toDate : toDate,
  70 + $xlId: xlId
  71 + )
  72 + $sri: ScheduleRule_input(
  73 + $ruleId : ruleId, $qyrq : qyrq,
  74 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  75 + eval($qyrq.isBefore($fromDate))
  76 + then
  77 + scheduleResult.setXlid($xlId);
  78 +
  79 + // 构造Calcu_days_result_pre,用于路牌
  80 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  81 + cdrp.setRuleId($ruleId);
  82 + cdrp.setCalcu_index_lp($lpindex);
  83 + cdrp.setCalcu_index_ry($ryindex);
  84 + cdrp.setCalcu_start_date_1($qyrq);
  85 + cdrp.setCalcu_end_date_1($fromDate);
  86 + Period p2 = new Period($fromDate, $toDate, PeriodType.days());
  87 + cdrp.setSdays(p2.getDays() + 1);
  88 + cdrp.setCalcu_start_date_2($fromDate);
  89 + cdrp.setCalcu_end_date_2($toDate);
  90 +
  91 + // 翻班相关
  92 + cdrp.setFbtype($sri.getFbtype());
  93 + cdrp.setFbgs_index(0);
  94 + cdrp.setFbweeks($sri.getWeekdays());
  95 +
  96 + /**
  97 + * 规则md5值(不使用id判定,使用md5判定)
  98 + * 使用,启用日期,路牌范围,结合生成md5编码
  99 + */
  100 + String ruleMd5 = Md5Util.getMd5(
  101 + String.valueOf($qyrq.getMillis()) +
  102 + "_" +
  103 + $sri.getSelf().getLpIds() +
  104 + "_" +
  105 + $sri.getSelf().getLpStart().toString()
  106 + );
  107 + cdrp.setRuleMd5(ruleMd5);
  108 + // 人员范围个数
  109 + cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
  110 +
  111 + insert(cdrp);
  112 +
  113 +// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
  114 +
  115 +end
  116 +
  117 +// 启用日期 属于 [开始日期,结束日期]
  118 +rule "calcu_days_2_"
  119 + salience 1000
  120 + when
  121 + ScheduleCalcuParam_input(
  122 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  123 + $fromDate : fromDate,
  124 + $toDate : toDate,
  125 + $xlId: xlId
  126 + )
  127 + $sri: ScheduleRule_input(
  128 + $ruleId : ruleId, $qyrq : qyrq,
  129 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  130 + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
  131 + then
  132 + scheduleResult.setXlid($xlId);
  133 +
  134 + // 构造Calcu_days_result_pre,用于路牌
  135 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  136 + cdrp.setRuleId($ruleId);
  137 + cdrp.setCalcu_index_lp($lpindex);
  138 + cdrp.setCalcu_index_ry($ryindex);
  139 + cdrp.setCalcu_start_date_1($qyrq);
  140 + cdrp.setCalcu_end_date_1($qyrq);
  141 + Period p2 = new Period($qyrq, $toDate, PeriodType.days());
  142 + cdrp.setSdays(p2.getDays() + 1);
  143 + cdrp.setCalcu_start_date_2($qyrq);
  144 + cdrp.setCalcu_end_date_2($toDate);
  145 +
  146 + // 翻班相关
  147 + cdrp.setFbtype($sri.getFbtype());
  148 + cdrp.setFbgs_index(0);
  149 + cdrp.setFbweeks($sri.getWeekdays());
  150 +
  151 + /**
  152 + * 规则md5值(不使用id判定,使用md5判定)
  153 + * 使用,启用日期,路牌范围,结合生成md5编码
  154 + */
  155 + String ruleMd5 = Md5Util.getMd5(
  156 + String.valueOf($qyrq.getMillis()) +
  157 + "_" +
  158 + $sri.getSelf().getLpIds() +
  159 + "_" +
  160 + $sri.getSelf().getLpStart().toString()
  161 + );
  162 + cdrp.setRuleMd5(ruleMd5);
  163 + // 人员范围个数
  164 + cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
  165 +
  166 + insert(cdrp);
  167 +
  168 +// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
  169 +
  170 +end
  171 +
  172 +// 使用已经排过班的数据修正Calcu_days_result_pre
  173 +// 1、避免每次从规则的启用日期开始算
  174 +// 2、时刻表会不停的修正,如果每次都从规则启用日期开始算,会出错
  175 +
  176 +declare SchedulePlanRuleResult_wrap
  177 + ruleId: String // 规则Id
  178 + ruleMd5: String // 规则md5编码
  179 + scheduleDate: DateTime // 排班日期
  180 +
  181 + isUsed: Boolean = false // 是否被使用过
  182 +
  183 + self: SchedulePlanRuleResult; // 原始对象数据
  184 +end
  185 +
  186 +rule "Calcu_SchedulePlanRuleResult_wrap"
  187 + salience 950
  188 + when
  189 + ScheduleCalcuParam_input(
  190 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  191 + $fromDate : fromDate,
  192 + $toDate : toDate,
  193 + $xlId: xlId,
  194 + $self: schedulePlan
  195 + )
  196 + eval($self.getIsHistoryPlanFirst() == true) // 是否使用历史排班标识
  197 + $sprr: SchedulePlanRuleResult() from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate())
  198 + eval($sprr.getQyrq() != null)
  199 +
  200 + then
  201 + // 创建班序历史结果数据
  202 + SchedulePlanRuleResult_wrap schedulePlanRuleResult_wrap = new SchedulePlanRuleResult_wrap();
  203 + schedulePlanRuleResult_wrap.setRuleId($sprr.getRuleId());
  204 + schedulePlanRuleResult_wrap.setScheduleDate(new DateTime($sprr.getScheduleDate()));
  205 + schedulePlanRuleResult_wrap.setSelf($sprr);
  206 +
  207 + // 规则Md5编码
  208 + String md5 = Md5Util.getMd5(
  209 + String.valueOf($sprr.getQyrq().getTime()) +
  210 + "_" +
  211 + $sprr.getGids() +
  212 + "_" +
  213 + $sprr.getOrigingidindex()
  214 + );
  215 +
  216 +// System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh());
  217 +
  218 + schedulePlanRuleResult_wrap.setRuleMd5(md5);
  219 +
  220 + insert(schedulePlanRuleResult_wrap);
  221 +end
  222 +
  223 +
  224 +// 1、启用日期 < 开始日期
  225 +// 2、如果最近的排班规则历史时间在 (启用日期,开始日期) 之间,需要重新修正预处理数据
  226 +rule "calcu_days_1_with_result"
  227 + no-loop
  228 + salience 960
  229 + when
  230 + $cdrp: Calcu_days_result_pre(
  231 + calcu_start_date_1.isBefore(calcu_start_date_2),
  232 + $ruleId: ruleId,
  233 + $ruleMd5: ruleMd5,
  234 + $ruleEcCount: ruleEcCount
  235 + )
  236 + $srrr_wrap: SchedulePlanRuleResult_wrap(
  237 +// ruleId == $ruleId,
  238 + ruleMd5 == $ruleMd5,
  239 + scheduleDate.isAfter($cdrp.calcu_start_date_1),
  240 + scheduleDate.isBefore($cdrp.calcu_start_date_2),
  241 + isUsed == false,
  242 + $scheduleDate: scheduleDate,
  243 + $self: self
  244 + )
  245 + then
  246 + // 修正排班数据
  247 +// log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate);
  248 +
  249 + // 路牌范围起始index使用历史数据
  250 + $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex()));
  251 + // 人员范围起始index,需要判定,如果长度都是一样的,使用历史的,否则不更新,使用最新的
  252 + String history_ecids = $self.getEcids();
  253 + if ($ruleEcCount == history_ecids.split(",").length) {
  254 + $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex()));
  255 + }
  256 +
  257 + // 翻班格式利用路牌的历史index更新
  258 + int fb_temp = Integer.valueOf($self.getGidindex()) % $cdrp.getFbweeks().size();
  259 + $cdrp.setFbgs_index(fb_temp);
  260 +
  261 + $cdrp.setCalcu_start_date_1($scheduleDate);
  262 + update($cdrp);
  263 +
  264 + $srrr_wrap.setIsUsed(true);
  265 + update($srrr_wrap);
  266 +
  267 +end
  268 +
  269 +
  270 +
  271 +//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//
  272 +
  273 +function void calcu_loop1_fb(Calcu_days_result_pre $cdrp, ScheduleRule_input $sri, Logger log) {
  274 + Integer $lpindex = $cdrp.getCalcu_index_lp();
  275 + Integer $lprangesize = $sri.getGuideboardIds().size();
  276 + Integer $ryindex = $cdrp.getCalcu_index_ry();
  277 + Integer $ryrangesize = $sri.getEmployeeConfigIds().size();
  278 + Integer $fbindex = $cdrp.getFbgs_index();
  279 + Integer $fbfangesize = $sri.getWeekdays().size();
  280 + DateTime $csd1 = $cdrp.getCalcu_start_date_1();
  281 + DateTime $ced1 = $cdrp.getCalcu_end_date_1();
  282 +
  283 + String $ruleId = $cdrp.getRuleId();
  284 +
  285 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  286 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  287 +
  288 + $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
  289 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  290 +
  291 +// log.info("calcu_loop1_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  292 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd1, $ced1);
  293 +
  294 +}
  295 +function void calcu_loop1_not_fb(Calcu_days_result_pre $cdrp, ScheduleRule_input $sri, Logger log) {
  296 + DateTime $csd1 = $cdrp.getCalcu_start_date_1();
  297 + DateTime $ced1 = $cdrp.getCalcu_end_date_1();
  298 + Integer $fbindex = $cdrp.getFbgs_index();
  299 + Integer $fbfangesize = $sri.getWeekdays().size();
  300 +
  301 + $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
  302 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  303 +
  304 +// log.info("calcu_loop1_not_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  305 +// $cdrp.getRuleId(), $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd1, $ced1);
  306 +}
  307 +
  308 +
  309 +rule "Calcu_loop1_fbtype_with_0_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是false,就跳过
  310 + salience 900
  311 + when
  312 + $cdrp: Calcu_days_result_pre(
  313 + calcu_start_date_1.isBefore(calcu_end_date_1),
  314 + $ruleId: ruleId,
  315 + fbtype == "1",
  316 + $fbindex : fbgs_index
  317 + )
  318 + $sri: ScheduleRule_input(
  319 + ruleId == $ruleId,
  320 + weekdays[$fbindex] == false
  321 + )
  322 + then
  323 + calcu_loop1_not_fb($cdrp, $sri, log);
  324 + update($cdrp);
  325 +end
  326 +
  327 +rule "Calcu_loop1_fbtype_with_1_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里存在指定路牌,就翻
  328 + salience 900
  329 + when
  330 + $cdrp: Calcu_days_result_pre(
  331 + calcu_start_date_1.isBefore(calcu_end_date_1),
  332 + $csd1: calcu_start_date_1,
  333 + $ruleId: ruleId,
  334 + fbtype == "1",
  335 + $lpindex: calcu_index_lp,
  336 + $fbindex : fbgs_index
  337 + )
  338 + $sri: ScheduleRule_input(
  339 + ruleId == $ruleId,
  340 + $gids: guideboardIds,
  341 + weekdays[$fbindex] == true
  342 + )
  343 + $liro: LpInfoResult_output(
  344 + dateTime.isEqual($csd1),
  345 + $gids[$lpindex] == lpId
  346 + )
  347 + then
  348 + calcu_loop1_fb($cdrp, $sri, log);
  349 + update($cdrp);
  350 +
  351 +end
  352 +
  353 +rule "Calcu_loop1_fbtype_with_1_no_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里不存在指定路牌,就跳过
  354 + salience 900
  355 + when
  356 + $cdrp: Calcu_days_result_pre(
  357 + calcu_start_date_1.isBefore(calcu_end_date_1),
  358 + $csd1: calcu_start_date_1,
  359 + $ruleId: ruleId,
  360 + fbtype == "1",
  361 + $fbindex : fbgs_index
  362 + )
  363 + $sri: ScheduleRule_input(
  364 + ruleId == $ruleId,
  365 + weekdays[$fbindex] == true
  366 + )
  367 + then
  368 + calcu_loop1_not_fb($cdrp, $sri, log);
  369 + update($cdrp);
  370 +end
  371 +
  372 +
  373 +rule "Calcu_loop1_timetabletype_with_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中存在,就翻
  374 + salience 900
  375 + when
  376 + $cdrp: Calcu_days_result_pre(
  377 + calcu_start_date_1.isBefore(calcu_end_date_1),
  378 + $csd1: calcu_start_date_1,
  379 + $ruleId: ruleId,
  380 + fbtype == "0",
  381 + $lpindex: calcu_index_lp
  382 + )
  383 + $sri: ScheduleRule_input(
  384 + ruleId == $ruleId,
  385 + $gids: guideboardIds
  386 + )
  387 + $liro: LpInfoResult_output(
  388 + dateTime.isEqual($csd1),
  389 + $gids[$lpindex] == lpId
  390 + )
  391 + then
  392 + calcu_loop1_fb($cdrp, $sri, log);
  393 + update($cdrp);
  394 +end
  395 +
  396 +rule "Calcu_loop1_timetabletype_with_no_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中不存在,就跳过
  397 + salience 900
  398 + when
  399 + $cdrp: Calcu_days_result_pre(
  400 + calcu_start_date_1.isBefore(calcu_end_date_1),
  401 + $csd1: calcu_start_date_1,
  402 + $ruleId: ruleId,
  403 + fbtype == "0"
  404 + )
  405 + $sri: ScheduleRule_input(
  406 + ruleId == $ruleId
  407 + )
  408 + then
  409 + calcu_loop1_not_fb($cdrp, $sri, log);
  410 + update($cdrp);
  411 +end
  412 +
  413 +//------------------------- 第三阶段、计算规则准备数据2(第二组循环) ----------------------------//
  414 +
  415 +function void calcu_loop2_fb(
  416 + SchedulePlan $sp,
  417 + Calcu_days_result_pre $cdrp,
  418 + ScheduleRule_input $sri,
  419 + LpInfoResult_output $liro,
  420 + ScheduleResults_output rs,
  421 + Logger log) {
  422 + String $ruleId = $cdrp.getRuleId();
  423 + DateTime $csd2 = $cdrp.getCalcu_start_date_2();
  424 + DateTime $ced2 = $cdrp.getCalcu_end_date_2();
  425 + Integer $lpindex = $cdrp.getCalcu_index_lp();
  426 + List $gids = $sri.getGuideboardIds();
  427 + Integer $lprangesize = $sri.getGuideboardIds().size();
  428 + Integer $ryindex = $cdrp.getCalcu_index_ry();
  429 + List $eids = $sri.getEmployeeConfigIds();
  430 + Integer $ryrangesize = $sri.getEmployeeConfigIds().size();
  431 + Integer $fbindex = $cdrp.getFbgs_index();
  432 + Integer $fbfangesize = $sri.getWeekdays().size();
  433 + String $cid = $sri.getCarConfigId();
  434 + String $xlid = $sri.getXlId();
  435 +
  436 + com.bsth.entity.schedule.rule.ScheduleRule1Flat $srf = $sri.getSelf();
  437 +
  438 + String $ttinfoId = $liro.getTtInfoId();
  439 + String $ttinfoName = $liro.getTtInfoName();
  440 +
  441 + ScheduleResult_output ro = new ScheduleResult_output();
  442 + ro.setRuleId($ruleId);
  443 + ro.setSd($csd2);
  444 + ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  445 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  446 + ro.setCarConfigId($cid);
  447 + ro.setXlId($xlid);
  448 +
  449 + // 类型
  450 + ro.setsType($sri.getsType());
  451 +
  452 + rs.getResults().add(ro);
  453 +
  454 +// log.info("gogoogogogogo");
  455 +
  456 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  457 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  458 +
  459 + $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
  460 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  461 +
  462 + if ($sri.getsType() == ScheduleRule_Type.NORMAL) {
  463 + // 保存排班规则循环结果 --> SchedulePlanRuleResult
  464 + SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp);
  465 +// schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId()));
  466 + schedulePlanRuleResult.setXlId($srf.getXl().getId());
  467 + schedulePlanRuleResult.setXlName($srf.getXl().getName());
  468 + schedulePlanRuleResult.setRuleId($ruleId);
  469 + schedulePlanRuleResult.setCcId($cid);
  470 + schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
  471 + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
  472 + schedulePlanRuleResult.setGnames($srf.getLpNames());
  473 + schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
  474 + schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
  475 + schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());
  476 + schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));
  477 + schedulePlanRuleResult.setScheduleDate($csd2.toDate());
  478 + schedulePlanRuleResult.setTtinfoId($ttinfoId);
  479 + schedulePlanRuleResult.setTtinfoName($ttinfoName);
  480 + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算
  481 + schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算
  482 +
  483 + rs.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
  484 + }
  485 +
  486 +
  487 +
  488 +// log.info("calcu_loop2_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  489 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  490 +
  491 +}
  492 +
  493 +function void calcu_loop2_not_fb(
  494 + Calcu_days_result_pre $cdrp,
  495 + ScheduleRule_input $sri,
  496 + ScheduleResults_output rs,
  497 + Logger log) {
  498 +
  499 + String $ruleId = $cdrp.getRuleId();
  500 + DateTime $csd2 = $cdrp.getCalcu_start_date_2();
  501 + DateTime $ced2 = $cdrp.getCalcu_end_date_2();
  502 + Integer $lpindex = $cdrp.getCalcu_index_lp();
  503 + List $gids = $sri.getGuideboardIds();
  504 + Integer $ryindex = $cdrp.getCalcu_index_ry();
  505 + List $eids = $sri.getEmployeeConfigIds();
  506 + Integer $fbindex = $cdrp.getFbgs_index();
  507 + Integer $fbfangesize = $sri.getWeekdays().size();
  508 + String $cid = $sri.getCarConfigId();
  509 + String $xlid = $sri.getXlId();
  510 +
  511 + ScheduleResult_output ro = new ScheduleResult_output();
  512 + ro.setRuleId($ruleId);
  513 + ro.setSd($csd2);
  514 +// ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  515 + ro.setGuideboardId("not_fb_lp"); // 不翻班,路牌id用假的,后面会过滤
  516 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  517 + ro.setCarConfigId($cid);
  518 + ro.setXlId($xlid);
  519 +
  520 + // 类型
  521 + ro.setsType($sri.getsType());
  522 +
  523 + rs.getResults().add(ro);
  524 +
  525 + $cdrp.setFbgs_index(($fbindex + 1) % $fbfangesize);
  526 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  527 +
  528 +// log.info("calcu_loop2_not_fb ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  529 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  530 +
  531 +}
  532 +
  533 +rule "Calcu_loop2_fbtype_with_0_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是false,就跳过
  534 + salience 800
  535 + when
  536 + ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
  537 + $cdrp: Calcu_days_result_pre(
  538 + calcu_start_date_1.isEqual(calcu_end_date_1),
  539 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  540 + $ruleId: ruleId,
  541 + fbtype == "1",
  542 + $fbindex : fbgs_index
  543 + )
  544 + $sri: ScheduleRule_input(
  545 + ruleId == $ruleId,
  546 + weekdays[$fbindex] == false
  547 + )
  548 + then
  549 + calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
  550 + update($cdrp);
  551 +
  552 +end
  553 +
  554 +rule "Calcu_loop2_fbtype_with_1_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里存在指定路牌,就翻
  555 + salience 800
  556 + when
  557 + ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
  558 + $cdrp: Calcu_days_result_pre(
  559 + calcu_start_date_1.isEqual(calcu_end_date_1),
  560 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  561 + $csd2: calcu_start_date_2,
  562 + $ruleId: ruleId,
  563 + fbtype == "1",
  564 + $lpindex: calcu_index_lp,
  565 + $fbindex : fbgs_index
  566 + )
  567 + $sri: ScheduleRule_input(
  568 + ruleId == $ruleId,
  569 + $gids: guideboardIds,
  570 + weekdays[$fbindex] == true
  571 + )
  572 + $liro: LpInfoResult_output(
  573 + dateTime.isEqual($csd2),
  574 + $gids[$lpindex] == lpId
  575 + )
  576 + then
  577 + calcu_loop2_fb($sp, $cdrp, $sri, $liro, scheduleResult, log);
  578 + update($cdrp);
  579 +end
  580 +
  581 +rule "Calcu_loop2_fbtype_with_1_no_lp_" // 翻班模式为 type=1 使用翻班格式翻,当天翻班格式是true,并且当天时刻表里不存在指定路牌,就跳过
  582 + salience 800
  583 + when
  584 + ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
  585 + $cdrp: Calcu_days_result_pre(
  586 + calcu_start_date_1.isEqual(calcu_end_date_1),
  587 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  588 + $ruleId: ruleId,
  589 + fbtype == "1",
  590 + $fbindex : fbgs_index
  591 + )
  592 + $sri: ScheduleRule_input(
  593 + ruleId == $ruleId,
  594 + weekdays[$fbindex] == true
  595 + )
  596 + then
  597 + calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
  598 + update($cdrp);
  599 +
  600 +end
  601 +
  602 +rule "Calcu_loop2_timetabletype_with_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中存在,就翻
  603 + salience 800
  604 + when
  605 + ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
  606 + $cdrp: Calcu_days_result_pre(
  607 + calcu_start_date_1.isEqual(calcu_end_date_1),
  608 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  609 + $csd2: calcu_start_date_2,
  610 + $ruleId: ruleId,
  611 + fbtype == "0",
  612 + $lpindex: calcu_index_lp,
  613 + $fbindex : fbgs_index
  614 + )
  615 + $sri: ScheduleRule_input(
  616 + ruleId == $ruleId,
  617 + $gids: guideboardIds
  618 + )
  619 + $liro: LpInfoResult_output(
  620 + dateTime.isEqual($csd2),
  621 + $gids[$lpindex] == lpId
  622 + )
  623 + then
  624 + calcu_loop2_fb($sp, $cdrp, $sri, $liro, scheduleResult, log);
  625 + update($cdrp);
  626 +
  627 +end
  628 +
  629 +rule "Calcu_loop2_timetabletype_with_no_lp_" // 翻班模式为 type=0 使用时刻表格式翻,路牌在时刻表中不存在,就跳过
  630 + salience 800
  631 + when
  632 + ScheduleCalcuParam_input($sp: schedulePlan, $xlid: xlId)
  633 + $cdrp: Calcu_days_result_pre(
  634 + calcu_start_date_1.isEqual(calcu_end_date_1),
  635 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  636 + $ruleId: ruleId,
  637 + fbtype == "0"
  638 + )
  639 + $sri: ScheduleRule_input(
  640 + ruleId == $ruleId
  641 + )
  642 + then
  643 + calcu_loop2_not_fb($cdrp, $sri, scheduleResult, log);
  644 + update($cdrp);
  645 +end
  646 +
  647 +
  648 +
  649 +
  650 +
  651 +
  652 +
  653 +
... ...
src/main/resources/rules/kBase1_core_ttinfo.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2   -
3   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount;
4   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime;
5   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno;
6   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult;
7   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq;
8   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb;
9   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb;
10   -import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp;
11   -
12   -import org.joda.time.*;
13   -import java.util.*;
14   -
15   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoCalcuParam_input;
16   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfo_input;
17   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output;
18   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
19   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
20   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResults_output;
21   -
22   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
23   -
24   -import com.bsth.repository.schedule.TTInfoDetailRepository;
25   -
26   -import com.bsth.entity.schedule.TTInfo;
27   -import com.bsth.entity.schedule.TTInfoDetail;
28   -
29   -import org.slf4j.Logger
30   -
31   -// 全局日志
32   -global Logger log;
33   -// repostory
34   -global TTInfoDetailRepository tTInfoDetailRepository;
35   -// return输出
36   -global TTInfoResults_output results
37   -global LpInfoResults_output lpInfoResults_output
38   -
39   -function Long ttidParams(List ttinfolist) {
40   - // 获取第一张时刻表id
41   - TTInfo_input ttInfo_input = (TTInfo_input) ttinfolist.get(0);
42   - return Long.parseLong(ttInfo_input.getTtInfoId());
43   -}
44   -
45   -/*
46   - TODO:规则说明,以后待说明
47   -*/
48   -
49   -//----------------- pre 预处理 param对象 -----------------------//
50   -
51   -rule "pre_calcu_TTInfoCalcuParam_input"
52   - no-loop
53   - salience 1000
54   - when
55   - $ttp: TTInfoCalcuParam_input($xlId : xlId)
56   - $minqyrq: DateTime() from accumulate ($sri: ScheduleRule_input(xlId == $xlId), minruleqyrq($sri))
57   - then
58   - $ttp.setFromDate($minqyrq);
59   - update($ttp);
60   -end
61   -
62   -//----------------- 第一阶段、计算规则准备数据(天数)----------------//
63   -
64   -declare Calcu_days_result
65   - calcu_day : Integer // 该计算第几天
66   - calcu_weekday : Integer // 星期几(1到7)
67   - calcu_date : DateTime // 该计算的具体日期
68   - calcu_days : Integer // 总共需要计算的天数
69   - calcu_start_date : DateTime // 开始计算日期
70   - calcu_end_date : DateTime // 结束计算日期
71   - xlId : String // 线路Id
72   -end
73   -
74   -rule "calcu_days"
75   - when
76   - TTInfoCalcuParam_input(
77   - $fromDate : fromDate,
78   - $toDate : toDate,
79   - $xlId : xlId,
80   - $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate))
81   - then
82   - // 构造Calcu_days_result对象,进行下一阶段计算
83   - Calcu_days_result cdr = new Calcu_days_result();
84   - Period p = new Period($fromDate, $toDate, PeriodType.days());
85   -
86   - cdr.setCalcu_day(1);
87   - cdr.setCalcu_date($fromDate);
88   - cdr.setCalcu_days(p.getDays() + 1);
89   - cdr.setCalcu_weekday($fromDate.getDayOfWeek());
90   - cdr.setCalcu_start_date($fromDate);
91   - cdr.setCalcu_end_date(($toDate));
92   - cdr.setXlId($xlId);
93   -
94   -// log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1);
95   -
96   - insert(cdr); // 插入fact数据,进入下一个阶段
97   -end
98   -
99   -//----------------- 第二阶段、判定时刻表是否启用 ----------------//
100   -
101   -declare Calcu_ttinfo_enable_result
102   - xlId : String // 线路id
103   - ttInfo_input_list : ArrayList // 可用时刻表列表
104   - calcu_date : DateTime // 计算日期
105   -end
106   -
107   -rule "calcu_ttinfo_enable"
108   - salience 900
109   - when
110   - $calcu_days_result : Calcu_days_result($calcu_date : calcu_date, calcu_day <= calcu_days, $xlId : xlId)
111   - $ttInfo_input_list : ArrayList(size >= 1) from collect (TTInfo_input(xlId == $xlId, isEnable == true))
112   - then
113   - // 构造Calcu_ttinfo_enable_result对象,进行下一步计算
114   - Calcu_ttinfo_enable_result cter = new Calcu_ttinfo_enable_result();
115   - cter.setXlId($xlId);
116   - cter.setTtInfo_input_list($ttInfo_input_list);
117   - cter.setCalcu_date($calcu_date);
118   -
119   -// log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size());
120   -
121   - insert (cter);
122   -
123   -end
124   -
125   -//----------------- 第三阶段、时刻表的日期匹配 -------------------//
126   -
127   -rule "calcu_ttinfo_special_day" // 特殊日期匹配
128   - salience 800
129   - when
130   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
131   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day)
132   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list)
133   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
134   - then
135   - // 更新Calcu_days_result对象
136   - int new_calcu_day = $calcu_day + 1;
137   - $calcu_days_result.setCalcu_day(new_calcu_day);
138   - DateTime new_calcu_date = $calcu_date.plusDays(1);
139   - $calcu_days_result.setCalcu_date(new_calcu_date);
140   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
141   -
142   -// log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date);
143   -
144   - // $ttinfolist按时间倒排序,result输出
145   - Collections.sort($ttinfolist);
146   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
147   -
148   - // lp输出
149   - for (int i = 0; i < $lpInfoResults.size(); i++) {
150   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
151   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
152   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
153   - }
154   -
155   - update($calcu_days_result);
156   -end
157   -
158   -rule "calcu_ttinfo_normal_day" // 平日匹配
159   - salience 700
160   - when
161   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
162   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
163   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list)
164   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
165   - then
166   - // 更新Calcu_days_result对象
167   - int new_calcu_day = $calcu_day + 1;
168   - $calcu_days_result.setCalcu_day(new_calcu_day);
169   - DateTime new_calcu_date = $calcu_date.plusDays(1);
170   - $calcu_days_result.setCalcu_date(new_calcu_date);
171   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
172   -
173   -// log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size());
174   -
175   - // $ttinfolist按时间倒排序,result输出
176   - Collections.sort($ttinfolist);
177   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
178   -
179   - // lp输出
180   - for (int i = 0; i < $lpInfoResults.size(); i++) {
181   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
182   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
183   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
184   - }
185   -
186   - update($calcu_days_result);
187   -end
188   -
189   -rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配
190   - salience 500
191   - when
192   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
193   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
194   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list)
195   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
196   - then
197   - // 更新Calcu_days_result对象
198   - int new_calcu_day = $calcu_day + 1;
199   - $calcu_days_result.setCalcu_day(new_calcu_day);
200   - DateTime new_calcu_date = $calcu_date.plusDays(1);
201   - $calcu_days_result.setCalcu_date(new_calcu_date);
202   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
203   -
204   -// log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
205   -
206   - // $ttinfolist按时间倒排序,result输出
207   - Collections.sort($ttinfolist);
208   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
209   -
210   - // lp输出
211   - for (int i = 0; i < $lpInfoResults.size(); i++) {
212   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
213   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
214   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
215   - }
216   -
217   - update($calcu_days_result);
218   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
  2 +
  3 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount;
  4 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime;
  5 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno;
  6 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult;
  7 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq;
  8 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb;
  9 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb;
  10 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp;
  11 +
  12 +import org.joda.time.*;
  13 +import java.util.*;
  14 +
  15 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoCalcuParam_input;
  16 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfo_input;
  17 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output;
  18 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
  19 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
  20 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResults_output;
  21 +
  22 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
  23 +
  24 +import com.bsth.repository.schedule.TTInfoDetailRepository;
  25 +
  26 +import com.bsth.entity.schedule.TTInfo;
  27 +import com.bsth.entity.schedule.TTInfoDetail;
  28 +
  29 +import org.slf4j.Logger
  30 +
  31 +// 全局日志
  32 +global Logger log;
  33 +// repostory
  34 +global TTInfoDetailRepository tTInfoDetailRepository;
  35 +// return输出
  36 +global TTInfoResults_output results
  37 +global LpInfoResults_output lpInfoResults_output
  38 +
  39 +function Long ttidParams(List ttinfolist) {
  40 + // 获取第一张时刻表id
  41 + TTInfo_input ttInfo_input = (TTInfo_input) ttinfolist.get(0);
  42 + return Long.parseLong(ttInfo_input.getTtInfoId());
  43 +}
  44 +
  45 +/*
  46 + TODO:规则说明,以后待说明
  47 +*/
  48 +
  49 +//----------------- pre 预处理 param对象 -----------------------//
  50 +
  51 +rule "pre_calcu_TTInfoCalcuParam_input"
  52 + no-loop
  53 + salience 1000
  54 + when
  55 + $ttp: TTInfoCalcuParam_input($xlId : xlId)
  56 + $minqyrq: DateTime() from accumulate ($sri: ScheduleRule_input(xlId == $xlId), minruleqyrq($sri))
  57 + then
  58 + $ttp.setFromDate($minqyrq);
  59 + update($ttp);
  60 +end
  61 +
  62 +//----------------- 第一阶段、计算规则准备数据(天数)----------------//
  63 +
  64 +declare Calcu_days_result
  65 + calcu_day : Integer // 该计算第几天
  66 + calcu_weekday : Integer // 星期几(1到7)
  67 + calcu_date : DateTime // 该计算的具体日期
  68 + calcu_days : Integer // 总共需要计算的天数
  69 + calcu_start_date : DateTime // 开始计算日期
  70 + calcu_end_date : DateTime // 结束计算日期
  71 + xlId : String // 线路Id
  72 +end
  73 +
  74 +rule "calcu_days"
  75 + when
  76 + TTInfoCalcuParam_input(
  77 + $fromDate : fromDate,
  78 + $toDate : toDate,
  79 + $xlId : xlId,
  80 + $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate))
  81 + then
  82 + // 构造Calcu_days_result对象,进行下一阶段计算
  83 + Calcu_days_result cdr = new Calcu_days_result();
  84 + Period p = new Period($fromDate, $toDate, PeriodType.days());
  85 +
  86 + cdr.setCalcu_day(1);
  87 + cdr.setCalcu_date($fromDate);
  88 + cdr.setCalcu_days(p.getDays() + 1);
  89 + cdr.setCalcu_weekday($fromDate.getDayOfWeek());
  90 + cdr.setCalcu_start_date($fromDate);
  91 + cdr.setCalcu_end_date(($toDate));
  92 + cdr.setXlId($xlId);
  93 +
  94 +// log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1);
  95 +
  96 + insert(cdr); // 插入fact数据,进入下一个阶段
  97 +end
  98 +
  99 +//----------------- 第二阶段、判定时刻表是否启用 ----------------//
  100 +
  101 +declare Calcu_ttinfo_enable_result
  102 + xlId : String // 线路id
  103 + ttInfo_input_list : ArrayList // 可用时刻表列表
  104 + calcu_date : DateTime // 计算日期
  105 +end
  106 +
  107 +rule "calcu_ttinfo_enable"
  108 + salience 900
  109 + when
  110 + $calcu_days_result : Calcu_days_result($calcu_date : calcu_date, calcu_day <= calcu_days, $xlId : xlId)
  111 + $ttInfo_input_list : ArrayList(size >= 1) from collect (TTInfo_input(xlId == $xlId, isEnable == true))
  112 + then
  113 + // 构造Calcu_ttinfo_enable_result对象,进行下一步计算
  114 + Calcu_ttinfo_enable_result cter = new Calcu_ttinfo_enable_result();
  115 + cter.setXlId($xlId);
  116 + cter.setTtInfo_input_list($ttInfo_input_list);
  117 + cter.setCalcu_date($calcu_date);
  118 +
  119 +// log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size());
  120 +
  121 + insert (cter);
  122 +
  123 +end
  124 +
  125 +//----------------- 第三阶段、时刻表的日期匹配 -------------------//
  126 +
  127 +rule "calcu_ttinfo_special_day" // 特殊日期匹配
  128 + salience 800
  129 + when
  130 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  131 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day)
  132 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list)
  133 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
  134 + then
  135 + // 更新Calcu_days_result对象
  136 + int new_calcu_day = $calcu_day + 1;
  137 + $calcu_days_result.setCalcu_day(new_calcu_day);
  138 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  139 + $calcu_days_result.setCalcu_date(new_calcu_date);
  140 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  141 +
  142 +// log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date);
  143 +
  144 + // $ttinfolist按时间倒排序,result输出
  145 + Collections.sort($ttinfolist);
  146 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  147 +
  148 + // lp输出
  149 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  150 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  151 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  152 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  153 + }
  154 +
  155 + update($calcu_days_result);
  156 +end
  157 +
  158 +rule "calcu_ttinfo_normal_day" // 平日匹配
  159 + salience 700
  160 + when
  161 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  162 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
  163 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list)
  164 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
  165 + then
  166 + // 更新Calcu_days_result对象
  167 + int new_calcu_day = $calcu_day + 1;
  168 + $calcu_days_result.setCalcu_day(new_calcu_day);
  169 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  170 + $calcu_days_result.setCalcu_date(new_calcu_date);
  171 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  172 +
  173 +// log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size());
  174 +
  175 + // $ttinfolist按时间倒排序,result输出
  176 + Collections.sort($ttinfolist);
  177 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  178 +
  179 + // lp输出
  180 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  181 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  182 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  183 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  184 + }
  185 +
  186 + update($calcu_days_result);
  187 +end
  188 +
  189 +rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配
  190 + salience 500
  191 + when
  192 + $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
  193 + $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
  194 + $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list)
  195 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
  196 + then
  197 + // 更新Calcu_days_result对象
  198 + int new_calcu_day = $calcu_day + 1;
  199 + $calcu_days_result.setCalcu_day(new_calcu_day);
  200 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  201 + $calcu_days_result.setCalcu_date(new_calcu_date);
  202 + $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
  203 +
  204 +// log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
  205 +
  206 + // $ttinfolist按时间倒排序,result输出
  207 + Collections.sort($ttinfolist);
  208 + results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
  209 +
  210 + // lp输出
  211 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  212 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  213 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  214 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  215 + }
  216 +
  217 + update($calcu_days_result);
  218 +
219 219 end
220 220 \ No newline at end of file
... ...
src/main/resources/rules/kBase1_core_validate.drl
1   -package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2   -
3   -import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
5   -import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResource;
6   -
7   -import org.joda.time.*;
8   -import java.util.*;
9   -
10   -import org.slf4j.Logger;
11   -
12   -// 全局日志类(一般使用调用此规则的service类)
13   -global Logger log;
14   -
15   -// 输出
16   -global ValidateResults_output validResult;
17   -
18   -//------------------------- 第一阶段、构造验证源 ----------------------------//
19   -rule "Calcu_validate_resource"
20   - salience 2000
21   - when
22   - $spi: SchedulePlanInfo($sd: scheduleDate)
23   - $lpiList: ArrayList() from collect (LpInfoResult_output(dateTime.getMillis() == $sd.getTime()))
24   - then
25   - ValidateResource resource = new ValidateResource();
26   - resource.setSd($sd);
27   - resource.setSpi($spi);
28   - resource.setLpiList($lpiList);
29   -
30   - insert(resource);
31   -end
32   -
33   -//------------------------- 第二阶段、构造循环体 ----------------------------//
34   -
35   -declare Loop_param
36   - start_date: DateTime // 开始日期(这个要不停的更新迭代)
37   - end_date: DateTime // 结束日期
38   - sdays: Integer // 总共循环的天数
39   -end
40   -
41   -rule "Calcu_Loop_param"
42   - salience 1000
43   - when
44   - ValidateParam(
45   - $fd: fromDate,
46   - $ed: toDate,
47   - $days: days
48   - )
49   - then
50   - Loop_param p = new Loop_param();
51   - p.setStart_date($fd);
52   - p.setEnd_date($ed);
53   - p.setSdays($days);
54   -
55   - insert(p);
56   -end
57   -
58   -//------------------------- 第三阶段、验证计算 ----------------------------//
59   -
60   -
61   -rule "Valid_repeat_bc" // 验证是否存在重复班次,未套跑班次,未执行路牌
62   - salience 600
63   - when
64   - $lp: Loop_param($sd: start_date, $ed: end_date)
65   - eval($sd.isBefore($ed) || $sd.isEqual($ed))
66   - $vrList: ArrayList() from collect (ValidateResource(sd.getTime() == $sd.getMillis()))
67   - $infos: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vrb($vr.getSpi()))
68   - $infos2: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwrb($vr.getSpi()))
69   - $infos3: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwlp($vr))
70   - then
71   - // TODO:
72   -// log.info("日期={},班次重复错误数={}", $sd, $infos.size());
73   -
74   -// log.info("班次数={}", $vrList.size());
75   -
76   - validResult.getInfos().addAll($infos);
77   - validResult.getInfos().addAll($infos2);
78   - validResult.getInfos().addAll($infos3);
79   -
80   - // 迭代
81   - $lp.setStart_date($sd.plusDays(1));
82   - update($lp);
83   -
84   -end
85   -
86   -//
87   -//declare LpInfo_wrap
88   -// sd: DateTime // 具体日期
89   -// lpId: Long // 路牌Id
90   -// isPlan: Boolean = false // 是否排班
91   -//end
92   -//
93   -//rule "Calcu_LpInfo_wrap"
94   -// salience 500
95   -// when
96   -// $lp: LpInfoResult_output()
97   -// then
98   -// LpInfo_wrap ll = new LpInfo_wrap();
99   -// ll.setSd($lp.getDateTime());
100   -// ll.setLpId(Long.parseLong($lp.getLpId()));
101   -//
102   -// insert(ll);
103   -//end
104   -//
105   -//rule "Valid_Lp_plan" // 查看路牌是否被排班
106   -// salience 400
107   -// no-loop
108   -// when
109   -// $sp: SchedulePlanInfo($lp: lp)
110   -// $ll: LpInfo_wrap(lpId == $lp)
111   -// then
112   -// $ll.setIsPlan(true);
113   -// update($ll);
114   -//end
115   -//
116   -//// TODO:
117   -
118   -
119   -
120   -
121   -
122   -
123   -
124   -
125   -
126   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
  5 +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResource;
  6 +
  7 +import org.joda.time.*;
  8 +import java.util.*;
  9 +
  10 +import org.slf4j.Logger;
  11 +
  12 +// 全局日志类(一般使用调用此规则的service类)
  13 +global Logger log;
  14 +
  15 +// 输出
  16 +global ValidateResults_output validResult;
  17 +
  18 +//------------------------- 第一阶段、构造验证源 ----------------------------//
  19 +rule "Calcu_validate_resource"
  20 + salience 2000
  21 + when
  22 + $spi: SchedulePlanInfo($sd: scheduleDate)
  23 + $lpiList: ArrayList() from collect (LpInfoResult_output(dateTime.getMillis() == $sd.getTime()))
  24 + then
  25 + ValidateResource resource = new ValidateResource();
  26 + resource.setSd($sd);
  27 + resource.setSpi($spi);
  28 + resource.setLpiList($lpiList);
  29 +
  30 + insert(resource);
  31 +end
  32 +
  33 +//------------------------- 第二阶段、构造循环体 ----------------------------//
  34 +
  35 +declare Loop_param
  36 + start_date: DateTime // 开始日期(这个要不停的更新迭代)
  37 + end_date: DateTime // 结束日期
  38 + sdays: Integer // 总共循环的天数
  39 +end
  40 +
  41 +rule "Calcu_Loop_param"
  42 + salience 1000
  43 + when
  44 + ValidateParam(
  45 + $fd: fromDate,
  46 + $ed: toDate,
  47 + $days: days
  48 + )
  49 + then
  50 + Loop_param p = new Loop_param();
  51 + p.setStart_date($fd);
  52 + p.setEnd_date($ed);
  53 + p.setSdays($days);
  54 +
  55 + insert(p);
  56 +end
  57 +
  58 +//------------------------- 第三阶段、验证计算 ----------------------------//
  59 +
  60 +
  61 +rule "Valid_repeat_bc" // 验证是否存在重复班次,未套跑班次,未执行路牌
  62 + salience 600
  63 + when
  64 + $lp: Loop_param($sd: start_date, $ed: end_date)
  65 + eval($sd.isBefore($ed) || $sd.isEqual($ed))
  66 + $vrList: ArrayList() from collect (ValidateResource(sd.getTime() == $sd.getMillis()))
  67 + $infos: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vrb($vr.getSpi()))
  68 + $infos2: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwrb($vr.getSpi()))
  69 + $infos3: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwlp($vr))
  70 + then
  71 + // TODO:
  72 +// log.info("日期={},班次重复错误数={}", $sd, $infos.size());
  73 +
  74 +// log.info("班次数={}", $vrList.size());
  75 +
  76 + validResult.getInfos().addAll($infos);
  77 + validResult.getInfos().addAll($infos2);
  78 + validResult.getInfos().addAll($infos3);
  79 +
  80 + // 迭代
  81 + $lp.setStart_date($sd.plusDays(1));
  82 + update($lp);
  83 +
  84 +end
  85 +
  86 +//
  87 +//declare LpInfo_wrap
  88 +// sd: DateTime // 具体日期
  89 +// lpId: Long // 路牌Id
  90 +// isPlan: Boolean = false // 是否排班
  91 +//end
  92 +//
  93 +//rule "Calcu_LpInfo_wrap"
  94 +// salience 500
  95 +// when
  96 +// $lp: LpInfoResult_output()
  97 +// then
  98 +// LpInfo_wrap ll = new LpInfo_wrap();
  99 +// ll.setSd($lp.getDateTime());
  100 +// ll.setLpId(Long.parseLong($lp.getLpId()));
  101 +//
  102 +// insert(ll);
  103 +//end
  104 +//
  105 +//rule "Valid_Lp_plan" // 查看路牌是否被排班
  106 +// salience 400
  107 +// no-loop
  108 +// when
  109 +// $sp: SchedulePlanInfo($lp: lp)
  110 +// $ll: LpInfo_wrap(lpId == $lp)
  111 +// then
  112 +// $ll.setIsPlan(true);
  113 +// update($ll);
  114 +//end
  115 +//
  116 +//// TODO:
  117 +
  118 +
  119 +
  120 +
  121 +
  122 +
  123 +
  124 +
  125 +
  126 +
... ...
src/main/resources/rules/kBase2_wrap_rule.drl
1   -package com.bsth.service.schedule.impl.plan.kBase2.wrap.rule;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -import org.slf4j.Logger;
6   -
7   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
8   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
9   -import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
10   -import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
11   -
12   -import com.bsth.repository.schedule.RerunRuleRepository;
13   -import com.bsth.repository.schedule.ScheduleRule1FlatRepository;
14   -
15   -import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
16   -
17   -import com.bsth.entity.Line;
18   -import com.bsth.entity.schedule.CarConfigInfo
19   -import com.bsth.entity.schedule.EmployeeConfigInfo
20   -import javax.print.attribute.standard.DateTimeAtCompleted;
21   -
22   -// 全局日志类(一般使用调用此规则的service类)
23   -global Logger log;
24   -
25   -global ScheduleRule1FlatRepository srf;
26   -global RerunRuleRepository rrr;
27   -global ScheduleRuleService srservice;
28   -global List sriList;
29   -
30   -
31   -declare Sri_Wrap
32   - xlId : String // 线路id
33   - lpIds : List // 路牌id
34   - srf : Object // ScheduleRule1Flat类型
35   - sri : ScheduleRule_input; // ScheduleRule_input输入
36   -end
37   -
38   -rule "rw1"
39   - salience 1000
40   - when
41   - ScheduleCalcuParam_input(
42   - $fromDate : fromDate,
43   - $toDate : toDate,
44   - $xlId: xlId
45   - )
46   - $srf : Object() from srf.findByXlId(Integer.parseInt($xlId))
47   - then
48   - // 创建Sri_Wrap
49   - Sri_Wrap sw = new Sri_Wrap();
50   - sw.setXlId($xlId);
51   - sw.setSrf($srf);
52   - ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
53   - sw.setSri(sri);
54   - sw.setLpIds(sri.getGuideboardIds());
55   -
56   - insert(sw);
57   -
58   -end
59   -
60   -rule "rw2"
61   - salience 800
62   - no-loop
63   - when
64   - ScheduleCalcuParam_input(
65   - $fromDate : fromDate,
66   - $toDate : toDate,
67   - $xlId: xlId
68   - )
69   - $reu : RerunRule_input($lpId : lp) from srservice.findRerunrule(Integer.parseInt($xlId))
70   - not Sri_Wrap(xlId == $xlId, lpIds contains $lpId)
71   - then
72   - // 套跑中有规则,主线路的路牌,主线路该路牌不存在,添加一个临时的,做处理
73   - Sri_Wrap sw = new Sri_Wrap();
74   - sw.setSrf(new com.bsth.entity.schedule.rule.ScheduleRule1Flat());
75   - // 线路
76   - Line xl = new Line();
77   - xl.setId(Integer.valueOf($xlId));
78   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setXl(xl);
79   - // id,使用当前日期作为原始值加上路牌id最为临时id值
80   - DateTime dt = new DateTime(new Date());
81   - DateTime dt2 = new DateTime(dt.year().get(), dt.monthOfYear().get(), dt.dayOfMonth().get(), 0, 0, 0);
82   - long id = (dt2.toDate().getTime() + Long.parseLong($lpId));
83   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setId(id);
84   - // 启用日期
85   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setQyrq($fromDate.toDate());
86   - // 车辆配置
87   - CarConfigInfo cci = new CarConfigInfo();
88   - cci.setId(new Date().getTime());
89   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setCarConfigInfo(cci);
90   - // 人员配置
91   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyConfigIds("TEMP");
92   - // 人员搭班编码
93   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyDbbms("TEMP");
94   - // 起始人员
95   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyStart(1);
96   - // 路牌id
97   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpIds($lpId);
98   - // 起始路牌
99   - ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpStart(1);
100   -
101   - ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
102   - sri.setsType(ScheduleRule_Type.RERUN);
103   - sw.setSri(sri);
104   -
105   - sw.setXlId($xlId);
106   -
107   - List lpIds = new ArrayList();
108   - lpIds.add($lpId);
109   - sw.setLpIds(lpIds);
110   -
111   - insert(sw);
112   -end
113   -
114   -rule "rw3"
115   - salience 600
116   - when
117   - $sri_wrap : Sri_Wrap($sri : sri, $xlId: xlId, $lpIds : lpIds)
118   - then
119   - log.info("线路id={},type={},ruleId={},lpids={}", $xlId, $sri.getsType(), $sri.getRuleId(), $lpIds);
120   - sriList.add($sri);
  1 +package com.bsth.service.schedule.impl.plan.kBase2.wrap.rule;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +import org.slf4j.Logger;
  6 +
  7 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
  8 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
  9 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
  10 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  11 +
  12 +import com.bsth.repository.schedule.RerunRuleRepository;
  13 +import com.bsth.repository.schedule.ScheduleRule1FlatRepository;
  14 +
  15 +import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
  16 +
  17 +import com.bsth.entity.Line;
  18 +import com.bsth.entity.schedule.CarConfigInfo
  19 +import com.bsth.entity.schedule.EmployeeConfigInfo
  20 +import javax.print.attribute.standard.DateTimeAtCompleted;
  21 +
  22 +// 全局日志类(一般使用调用此规则的service类)
  23 +global Logger log;
  24 +
  25 +global ScheduleRule1FlatRepository srf;
  26 +global RerunRuleRepository rrr;
  27 +global ScheduleRuleService srservice;
  28 +global List sriList;
  29 +
  30 +
  31 +declare Sri_Wrap
  32 + xlId : String // 线路id
  33 + lpIds : List // 路牌id
  34 + srf : Object // ScheduleRule1Flat类型
  35 + sri : ScheduleRule_input; // ScheduleRule_input输入
  36 +end
  37 +
  38 +rule "rw1"
  39 + salience 1000
  40 + when
  41 + ScheduleCalcuParam_input(
  42 + $fromDate : fromDate,
  43 + $toDate : toDate,
  44 + $xlId: xlId
  45 + )
  46 + $srf : Object() from srf.findByXlId(Integer.parseInt($xlId))
  47 + then
  48 + // 创建Sri_Wrap
  49 + Sri_Wrap sw = new Sri_Wrap();
  50 + sw.setXlId($xlId);
  51 + sw.setSrf($srf);
  52 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  53 + sw.setSri(sri);
  54 + sw.setLpIds(sri.getGuideboardIds());
  55 +
  56 + insert(sw);
  57 +
  58 +end
  59 +
  60 +rule "rw2"
  61 + salience 800
  62 + no-loop
  63 + when
  64 + ScheduleCalcuParam_input(
  65 + $fromDate : fromDate,
  66 + $toDate : toDate,
  67 + $xlId: xlId
  68 + )
  69 + $reu : RerunRule_input($lpId : lp) from srservice.findRerunrule(Integer.parseInt($xlId))
  70 + not Sri_Wrap(xlId == $xlId, lpIds contains $lpId)
  71 + then
  72 + // 套跑中有规则,主线路的路牌,主线路该路牌不存在,添加一个临时的,做处理
  73 + Sri_Wrap sw = new Sri_Wrap();
  74 + sw.setSrf(new com.bsth.entity.schedule.rule.ScheduleRule1Flat());
  75 + // 线路
  76 + Line xl = new Line();
  77 + xl.setId(Integer.valueOf($xlId));
  78 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setXl(xl);
  79 + // id,使用当前日期作为原始值加上路牌id最为临时id值
  80 + DateTime dt = new DateTime(new Date());
  81 + DateTime dt2 = new DateTime(dt.year().get(), dt.monthOfYear().get(), dt.dayOfMonth().get(), 0, 0, 0);
  82 + long id = (dt2.toDate().getTime() + Long.parseLong($lpId));
  83 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setId(id);
  84 + // 启用日期
  85 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setQyrq($fromDate.toDate());
  86 + // 车辆配置
  87 + CarConfigInfo cci = new CarConfigInfo();
  88 + cci.setId(new Date().getTime());
  89 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setCarConfigInfo(cci);
  90 + // 人员配置
  91 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyConfigIds("TEMP");
  92 + // 人员搭班编码
  93 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyDbbms("TEMP");
  94 + // 起始人员
  95 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyStart(1);
  96 + // 路牌id
  97 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpIds($lpId);
  98 + // 起始路牌
  99 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpStart(1);
  100 +
  101 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  102 + sri.setsType(ScheduleRule_Type.RERUN);
  103 + sw.setSri(sri);
  104 +
  105 + sw.setXlId($xlId);
  106 +
  107 + List lpIds = new ArrayList();
  108 + lpIds.add($lpId);
  109 + sw.setLpIds(lpIds);
  110 +
  111 + insert(sw);
  112 +end
  113 +
  114 +rule "rw3"
  115 + salience 600
  116 + when
  117 + $sri_wrap : Sri_Wrap($sri : sri, $xlId: xlId, $lpIds : lpIds)
  118 + then
  119 + log.info("线路id={},type={},ruleId={},lpids={}", $xlId, $sri.getsType(), $sri.getRuleId(), $lpIds);
  120 + sriList.add($sri);
121 121 end
122 122 \ No newline at end of file
... ...
src/main/resources/rules/kBase3_validate_rule.drl
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
2   -
3   -import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ErrorInfoFunction srif;
4   -import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.ErrorBcCountFunction ecount;
5   -
6   -import org.joda.time.*;
7   -import java.util.*;
8   -
9   -import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam;
10   -import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
11   -import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult.ErrorInfo;
12   -import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.WrapInput;
13   -
14   -import com.bsth.repository.schedule.ScheduleRule1FlatRepository
15   -import com.bsth.repository.schedule.CarConfigInfoRepository;
16   -import com.bsth.repository.schedule.GuideboardInfoRepository;
17   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
18   -
19   -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
20   -import com.bsth.entity.schedule.CarConfigInfo;
21   -import com.bsth.entity.schedule.GuideboardInfo;
22   -import com.bsth.entity.schedule.EmployeeConfigInfo;
23   -
24   -import org.slf4j.Logger
25   -
26   -// 全局日志
27   -global Logger LOG;
28   -
29   -// repository查询
30   -global CarConfigInfoRepository ccRepo;
31   -global GuideboardInfoRepository lpRepo;
32   -global EmployeeConfigInfoRepository ecRepo;
33   -global ScheduleRule1FlatRepository ruleRepo;
34   -
35   -// return输出
36   -global ValidateRuleResult result;
37   -
38   -
39   -//------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------//
40   -
41   -// 1、车辆信息载入
42   -declare CarConfig_Wraps
43   - xlId: Integer // 线路Id
44   - ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo>
45   -end
46   -
47   -rule "calcu_CarConfig_Wraps"
48   - salience 800
49   - when
50   - $param: CalcuParam($xlId: xlId)
51   - then
52   - List ccInfos = ccRepo.findByXlId($xlId);
53   -
54   - CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
55   - carConfig_wraps.setXlId($xlId);
56   - carConfig_wraps.setCcMap(new HashMap());
57   -
58   - for (int i = 0; i < ccInfos.size(); i++) {
59   - CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i);
60   - if (!ccInfo.getIsCancel()) {
61   - carConfig_wraps.getCcMap().put(ccInfo.getCl().getInsideCode(), ccInfo);
62   - }
63   - }
64   -
65   - insert(carConfig_wraps);
66   -
67   - LOG.info("第一阶段 --> 1、车辆信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size());
68   -end
69   -
70   -// 2、路牌信息载入
71   -declare Lp_Wraps
72   - xlId: Integer // 线路Id
73   - lpMap: Map // 路牌Map Map<id, GuideboardInfo>
74   -end
75   -
76   -rule "calcu_Lp_Wraps"
77   - salience 800
78   - when
79   - $param: CalcuParam($xlId: xlId)
80   - then
81   - List lpInfos = lpRepo.findByXlId($xlId);
82   - Lp_Wraps lp_wraps = new Lp_Wraps();
83   - lp_wraps.setXlId($xlId);
84   - lp_wraps.setLpMap(new HashMap());
85   -
86   - for (int i = 0; i < lpInfos.size(); i++) {
87   - GuideboardInfo lpInfo = (GuideboardInfo) lpInfos.get(i);
88   - if (!lpInfo.getIsCancel()) {
89   - lp_wraps.getLpMap().put(lpInfo.getId(), lpInfo);
90   - }
91   - }
92   -
93   - insert(lp_wraps);
94   -
95   - LOG.info("第一阶段 --> 2、路牌信息载入 calcu_Lp_Wraps 有效路牌数={}", lpInfos.size());
96   -
97   -end
98   -
99   -// 3、人员信息载入
100   -declare EmployeeConfig_Wraps
101   - xlId: Integer // 线路Id
102   - ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
103   -end
104   -
105   -rule "calcu_EmployeeConfig_Wraps"
106   - salience 800
107   - when
108   - $param: CalcuParam($xlId: xlId)
109   - then
110   - List ecInfos = ecRepo.findByXlId($xlId);
111   -
112   - EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
113   - employeeConfig_wraps.setXlId($xlId);
114   - employeeConfig_wraps.setEcMap(new HashMap());
115   -
116   - for (int i = 0; i < ecInfos.size(); i++) {
117   - EmployeeConfigInfo ecInfo = (EmployeeConfigInfo) ecInfos.get(i);
118   - if (!ecInfo.getIsCancel()) {
119   - employeeConfig_wraps.getEcMap().put(ecInfo.getId(), ecInfo);
120   - }
121   - }
122   -
123   - insert(employeeConfig_wraps);
124   -
125   - LOG.info("第一阶段 --> 3、人员信息载入 calcu_EmployeeConfig_Wraps 有效人员配置数={}", ecInfos.size());
126   -end
127   -
128   -//------------------ 第二阶段、规则载入,计算相关数量 -----------------//
129   -
130   -declare Rule_Wraps
131   - xlId: Integer // 线路Id
132   - qyrq: Date // 启用日期
133   - rule: ScheduleRule1Flat // ScheduleRule1Flat规则
134   -end
135   -
136   -rule "calcu_schedule_rule_wrap"
137   - salience 700
138   - when
139   - $param: CalcuParam($xlId: xlId)
140   - $rule: ScheduleRule1Flat($qyrq: qyrq) from ruleRepo.findByXlId($xlId)
141   - then
142   - Rule_Wraps rw = new Rule_Wraps();
143   - rw.setXlId($xlId);
144   - rw.setQyrq($qyrq);
145   - rw.setRule($rule);
146   - insert(rw);
147   -end
148   -
149   -rule "calcu_all_rule_count"
150   - salience 600
151   - when
152   - $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
153   - $allList: ArrayList() from collect(Rule_Wraps(xlId == $xlId))
154   - then
155   - result.setXlId($xlId);
156   - result.setCount($allList.size());
157   -
158   - LOG.info("第二阶段 --> 规则总数={}", $allList.size());
159   -end
160   -
161   -rule "calcu_all_qy_rule_count"
162   - salience 500
163   - when
164   - $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
165   - $qyList: ArrayList() from collect(
166   - Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis()))
167   - then
168   - result.setXlId($xlId);
169   - result.setQyCount($qyList.size());
170   -
171   - LOG.info("第二阶段 --> 启用规则数={}", $qyList.size());
172   -
173   -end
174   -
175   -//------------------ 第三阶段、规则判定 -----------------//
176   -
177   -rule "calcu_Wrap_input"
178   - salience 400
179   - when
180   - $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
181   - $qy_rule: Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis())
182   - $cc: CarConfig_Wraps(xlId == $xlId)
183   - $lp: Lp_Wraps(xlId == $xlId)
184   - $ec: EmployeeConfig_Wraps(xlId == $xlId)
185   - then
186   - WrapInput wr = new WrapInput(
187   - $qy_rule.getRule(),
188   - $cc.getCcMap(),
189   - $lp.getLpMap(),
190   - $ec.getEcMap()
191   - );
192   - insert(wr);
193   -end
194   -
195   -rule "calcu_error_info"
196   - salience 300
197   - when
198   - $param: CalcuParam($xlId: xlId)
199   - $errorMap: Map() from accumulate ($wr: WrapInput(xlId == $xlId), srif($wr))
200   - then
201   - result.setQyErrorCount($errorMap.size());
202   - result.getErrorInfos().addAll($errorMap.values());
203   -
204   - LOG.info("第三阶段 --> 规则总数={}, 启用规则数={}, 错误的启用规则数={}",
205   - result.getCount(), result.getQyCount(), result.getQyErrorCount());
206   -
207   -end
208   -
209   -
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ErrorInfoFunction srif;
  4 +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.ErrorBcCountFunction ecount;
  5 +
  6 +import org.joda.time.*;
  7 +import java.util.*;
  8 +
  9 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam;
  10 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
  11 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult.ErrorInfo;
  12 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.WrapInput;
  13 +
  14 +import com.bsth.repository.schedule.ScheduleRule1FlatRepository
  15 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  16 +import com.bsth.repository.schedule.GuideboardInfoRepository;
  17 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  18 +
  19 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  20 +import com.bsth.entity.schedule.CarConfigInfo;
  21 +import com.bsth.entity.schedule.GuideboardInfo;
  22 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  23 +
  24 +import org.slf4j.Logger
  25 +
  26 +// 全局日志
  27 +global Logger LOG;
  28 +
  29 +// repository查询
  30 +global CarConfigInfoRepository ccRepo;
  31 +global GuideboardInfoRepository lpRepo;
  32 +global EmployeeConfigInfoRepository ecRepo;
  33 +global ScheduleRule1FlatRepository ruleRepo;
  34 +
  35 +// return输出
  36 +global ValidateRuleResult result;
  37 +
  38 +
  39 +//------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------//
  40 +
  41 +// 1、车辆信息载入
  42 +declare CarConfig_Wraps
  43 + xlId: Integer // 线路Id
  44 + ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo>
  45 +end
  46 +
  47 +rule "calcu_CarConfig_Wraps"
  48 + salience 800
  49 + when
  50 + $param: CalcuParam($xlId: xlId)
  51 + then
  52 + List ccInfos = ccRepo.findByXlId($xlId);
  53 +
  54 + CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
  55 + carConfig_wraps.setXlId($xlId);
  56 + carConfig_wraps.setCcMap(new HashMap());
  57 +
  58 + for (int i = 0; i < ccInfos.size(); i++) {
  59 + CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i);
  60 + if (!ccInfo.getIsCancel()) {
  61 + carConfig_wraps.getCcMap().put(ccInfo.getCl().getInsideCode(), ccInfo);
  62 + }
  63 + }
  64 +
  65 + insert(carConfig_wraps);
  66 +
  67 + LOG.info("第一阶段 --> 1、车辆信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size());
  68 +end
  69 +
  70 +// 2、路牌信息载入
  71 +declare Lp_Wraps
  72 + xlId: Integer // 线路Id
  73 + lpMap: Map // 路牌Map Map<id, GuideboardInfo>
  74 +end
  75 +
  76 +rule "calcu_Lp_Wraps"
  77 + salience 800
  78 + when
  79 + $param: CalcuParam($xlId: xlId)
  80 + then
  81 + List lpInfos = lpRepo.findByXlId($xlId);
  82 + Lp_Wraps lp_wraps = new Lp_Wraps();
  83 + lp_wraps.setXlId($xlId);
  84 + lp_wraps.setLpMap(new HashMap());
  85 +
  86 + for (int i = 0; i < lpInfos.size(); i++) {
  87 + GuideboardInfo lpInfo = (GuideboardInfo) lpInfos.get(i);
  88 + if (!lpInfo.getIsCancel()) {
  89 + lp_wraps.getLpMap().put(lpInfo.getId(), lpInfo);
  90 + }
  91 + }
  92 +
  93 + insert(lp_wraps);
  94 +
  95 + LOG.info("第一阶段 --> 2、路牌信息载入 calcu_Lp_Wraps 有效路牌数={}", lpInfos.size());
  96 +
  97 +end
  98 +
  99 +// 3、人员信息载入
  100 +declare EmployeeConfig_Wraps
  101 + xlId: Integer // 线路Id
  102 + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
  103 +end
  104 +
  105 +rule "calcu_EmployeeConfig_Wraps"
  106 + salience 800
  107 + when
  108 + $param: CalcuParam($xlId: xlId)
  109 + then
  110 + List ecInfos = ecRepo.findByXlId($xlId);
  111 +
  112 + EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
  113 + employeeConfig_wraps.setXlId($xlId);
  114 + employeeConfig_wraps.setEcMap(new HashMap());
  115 +
  116 + for (int i = 0; i < ecInfos.size(); i++) {
  117 + EmployeeConfigInfo ecInfo = (EmployeeConfigInfo) ecInfos.get(i);
  118 + if (!ecInfo.getIsCancel()) {
  119 + employeeConfig_wraps.getEcMap().put(ecInfo.getId(), ecInfo);
  120 + }
  121 + }
  122 +
  123 + insert(employeeConfig_wraps);
  124 +
  125 + LOG.info("第一阶段 --> 3、人员信息载入 calcu_EmployeeConfig_Wraps 有效人员配置数={}", ecInfos.size());
  126 +end
  127 +
  128 +//------------------ 第二阶段、规则载入,计算相关数量 -----------------//
  129 +
  130 +declare Rule_Wraps
  131 + xlId: Integer // 线路Id
  132 + qyrq: Date // 启用日期
  133 + rule: ScheduleRule1Flat // ScheduleRule1Flat规则
  134 +end
  135 +
  136 +rule "calcu_schedule_rule_wrap"
  137 + salience 700
  138 + when
  139 + $param: CalcuParam($xlId: xlId)
  140 + $rule: ScheduleRule1Flat($qyrq: qyrq) from ruleRepo.findByXlId($xlId)
  141 + then
  142 + Rule_Wraps rw = new Rule_Wraps();
  143 + rw.setXlId($xlId);
  144 + rw.setQyrq($qyrq);
  145 + rw.setRule($rule);
  146 + insert(rw);
  147 +end
  148 +
  149 +rule "calcu_all_rule_count"
  150 + salience 600
  151 + when
  152 + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
  153 + $allList: ArrayList() from collect(Rule_Wraps(xlId == $xlId))
  154 + then
  155 + result.setXlId($xlId);
  156 + result.setCount($allList.size());
  157 +
  158 + LOG.info("第二阶段 --> 规则总数={}", $allList.size());
  159 +end
  160 +
  161 +rule "calcu_all_qy_rule_count"
  162 + salience 500
  163 + when
  164 + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
  165 + $qyList: ArrayList() from collect(
  166 + Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis()))
  167 + then
  168 + result.setXlId($xlId);
  169 + result.setQyCount($qyList.size());
  170 +
  171 + LOG.info("第二阶段 --> 启用规则数={}", $qyList.size());
  172 +
  173 +end
  174 +
  175 +//------------------ 第三阶段、规则判定 -----------------//
  176 +
  177 +rule "calcu_Wrap_input"
  178 + salience 400
  179 + when
  180 + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate)
  181 + $qy_rule: Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis())
  182 + $cc: CarConfig_Wraps(xlId == $xlId)
  183 + $lp: Lp_Wraps(xlId == $xlId)
  184 + $ec: EmployeeConfig_Wraps(xlId == $xlId)
  185 + then
  186 + WrapInput wr = new WrapInput(
  187 + $qy_rule.getRule(),
  188 + $cc.getCcMap(),
  189 + $lp.getLpMap(),
  190 + $ec.getEcMap()
  191 + );
  192 + insert(wr);
  193 +end
  194 +
  195 +rule "calcu_error_info"
  196 + salience 300
  197 + when
  198 + $param: CalcuParam($xlId: xlId)
  199 + $errorMap: Map() from accumulate ($wr: WrapInput(xlId == $xlId), srif($wr))
  200 + then
  201 + result.setQyErrorCount($errorMap.size());
  202 + result.getErrorInfos().addAll($errorMap.values());
  203 +
  204 + LOG.info("第三阶段 --> 规则总数={}, 启用规则数={}, 错误的启用规则数={}",
  205 + result.getCount(), result.getQyCount(), result.getQyErrorCount());
  206 +
  207 +end
  208 +
  209 +
... ...
src/main/resources/rules/kBase3_validate_timetable.drl
1   -package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -import org.apache.commons.lang3.StringUtils;
6   -
7   -import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
8   -import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result.StatInfo;
9   -import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam;
10   -
11   -import com.bsth.entity.schedule.TTInfo;
12   -import com.bsth.entity.schedule.TTInfoDetail;
13   -import com.bsth.entity.Line;
14   -
15   -import com.bsth.repository.schedule.TTInfoDetailRepository;
16   -
17   -import org.slf4j.Logger
18   -import org.joda.time.format.DateTimeFormat
19   -import java.lang.String
20   -import java.lang.Object;
21   -
22   -
23   -// 全局日志类(一般使用调用此规则的service类)
24   -global Logger log;
25   -global TTInfoDetailRepository tTInfoDetailRepository;
26   -
27   -// 输出
28   -global Result rs;
29   -
30   -/*
31   - 规则说明:
32   - 1、找出指定线路,指定时间范围的时刻表
33   - 2、统计这些时刻表班次数据的情况
34   -*/
35   -
36   -//-------------- 第一阶段、计算规则迭代数据(天数) ------------//
37   -declare Calcu_iter_days_result
38   - xlId: Integer // 线路Id
39   - xlName: String // 线路名字
40   -
41   - // 迭代数据
42   - calcu_day: Integer // 准备计算第几天
43   - calcu_weekday: Integer // 准备计算星期几(1到7)
44   - calcu_date: DateTime // 准备计算的具体日期
45   -
46   - // 范围数据
47   - calcu_days: Integer // 总共需要计算的天数
48   - calcu_start_date: DateTime // 开始计算日期
49   - calcu_end_date: DateTime // 结束计算日期
50   -
51   - // 时刻表映射数据
52   - ttinfomap: Map // 指定时间段内,用的时刻表id映射 Map<Long, Long>
53   -end
54   -
55   -rule "calcu_iter_days"
56   - salience 1900
57   - when
58   - CalcuParam(
59   - $xlId: xlId,
60   - $fromDate: fromDate,
61   - $toDate: toDate,
62   - $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate)
63   - )
64   - $line: Line(id == $xlId)
65   - then
66   - // 构造Calcu_iter_days_result对象,进行下一步计算
67   - Calcu_iter_days_result cidr = new Calcu_iter_days_result();
68   - Period p = new Period($fromDate, $toDate, PeriodType.days());
69   -
70   - cidr.setXlId($xlId);
71   - cidr.setXlName($line.getName());
72   -
73   - cidr.setCalcu_day(new Integer(1));
74   - cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek()));
75   - cidr.setCalcu_date($fromDate);
76   -
77   - cidr.setCalcu_days(Integer.valueOf(p.getDays() + 1));
78   - cidr.setCalcu_start_date($fromDate);
79   - cidr.setCalcu_end_date($toDate);
80   -
81   - cidr.setTtinfomap(new HashMap());
82   -
83   - log.info(
84   - "线路={}-id={},开始时间={},结束时间={},总共计算的天数={},将从开始时间迭代",
85   - cidr.getXlName(),
86   - cidr.getXlId(),
87   - cidr.getCalcu_start_date(),
88   - cidr.getCalcu_end_date(),
89   - cidr.getCalcu_days()
90   - );
91   -
92   - insert(cidr);
93   -end
94   -
95   -//-------------- 第二阶段、包装时刻表实体类到内部对象 ------------//
96   -
97   -declare TTInfo_wrap
98   - id: Long // 时刻表id
99   - name: String // 时刻表名字
100   - weekdays: List // 周一到周日是否启用 List<Boolean>
101   - specialDays: List // 特殊节假日 List<DateTime>
102   - updateDate: DateTime // 最新修改时间
103   -end
104   -
105   -rule "TTInfo_wrap_result"
106   - salience 900
107   - when
108   - CalcuParam($xlId: xlId)
109   - $ttinfo: TTInfo(
110   - xl.id == $xlId,
111   - isEnableDisTemplate == true,
112   - isCancel == false
113   - )
114   - then
115   - TTInfo_wrap ttInfo_wrap = new TTInfo_wrap();
116   - ttInfo_wrap.setId($ttinfo.getId());
117   - ttInfo_wrap.setName($ttinfo.getName());
118   - ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate()));
119   - ttInfo_wrap.setWeekdays(new ArrayList());
120   - ttInfo_wrap.setSpecialDays(new ArrayList());
121   -
122   - String[] days = $ttinfo.getRule_days().split(",");
123   - for (int i = 0; i < 7; i++) {
124   - if ("1".equals(days[i])) {
125   - ttInfo_wrap.getWeekdays().add(true);
126   - } else {
127   - ttInfo_wrap.getWeekdays().add(false);
128   - }
129   - }
130   -
131   - if (StringUtils.isNotEmpty($ttinfo.getSpecial_days())) {
132   - String[] sdays = $ttinfo.getSpecial_days().split(",");
133   - for (int i = 0; i < sdays.length; i++) {
134   - ttInfo_wrap.getSpecialDays().add(
135   - DateTimeFormat.forPattern(
136   - "yyyy-MM-dd").parseDateTime(sdays[i]));
137   - }
138   - }
139   -
140   - log.info("时刻表={},id={},常规日期={},特殊日期={}",
141   - ttInfo_wrap.getName(),
142   - ttInfo_wrap.getId(),
143   - ttInfo_wrap.getWeekdays(),
144   - ttInfo_wrap.getSpecialDays());
145   -
146   - insert(ttInfo_wrap);
147   -
148   -end
149   -
150   -//-------------- 第三阶段、时刻表的日期匹配 ------------//
151   -
152   -declare TTInfoDetails_wrap
153   - ttInfoId: Long // 时刻表id
154   - bcInfoList: List // 班次信息列表 List<TTInfoDetail>
155   -end
156   -
157   -rule "Calcu_iter_days_special_day" // 特殊日期匹配
158   - salience 800
159   - when
160   - $cid : Calcu_iter_days_result(
161   - $calcu_date: calcu_date,
162   - $calcu_day: calcu_day,
163   - calcu_day <= calcu_days
164   - )
165   - TTInfo_wrap(
166   - $tid: id,
167   - $tname: name,
168   - specialDays contains $calcu_date
169   - )
170   - then
171   - // 更新迭代对象
172   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
173   - $cid.setCalcu_day(new_calcu_day);
174   - DateTime new_calcu_date = $calcu_date.plusDays(1);
175   - $cid.setCalcu_date(new_calcu_date);
176   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
177   -
178   - log.info("启用特殊日期时刻表:" +
179   - "时刻表id={} 特殊日期={}",
180   - $tid, $calcu_date);
181   -
182   - // 判定使用的时刻表
183   - if (!$cid.getTtinfomap().containsKey($tid)) {
184   - $cid.getTtinfomap().put($tid, $tid);
185   - StatInfo statInfo = new StatInfo();
186   - statInfo.setTtid($tid);
187   - statInfo.setTtname($tname);
188   - insert(statInfo);
189   -
190   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
191   - ttInfoDetails_wrap.setTtInfoId($tid);
192   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
193   - insert(ttInfoDetails_wrap);
194   - }
195   - update($cid);
196   -
197   -end
198   -
199   -rule "Calcu_iter_days_normal_day" // 平日匹配
200   - salience 700
201   - when
202   - $cid : Calcu_iter_days_result(
203   - $calcu_date: calcu_date,
204   - $calcu_weekday: calcu_weekday,
205   - $calcu_day: calcu_day,
206   - calcu_day <= calcu_days
207   - )
208   - TTInfo_wrap(
209   - $tid: id,
210   - $tname: name,
211   - specialDays not contains $calcu_date,
212   - weekdays[$calcu_weekday - 1] == Boolean.TRUE
213   - )
214   - then
215   - // 更新迭代对象
216   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
217   - $cid.setCalcu_day(new_calcu_day);
218   - DateTime new_calcu_date = $calcu_date.plusDays(1);
219   - $cid.setCalcu_date(new_calcu_date);
220   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
221   -
222   -
223   - log.info("启用常规日期时刻表:" +
224   - "时刻表id={} 常规日期={} 星期几={}",
225   - $tid, $calcu_date, $calcu_weekday);
226   -
227   - // 判定使用的时刻表
228   - if (!$cid.getTtinfomap().containsKey($tid)) {
229   - $cid.getTtinfomap().put($tid, $tid);
230   - StatInfo statInfo = new StatInfo();
231   - statInfo.setTtid($tid);
232   - statInfo.setTtname($tname);
233   - insert(statInfo);
234   -
235   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
236   - ttInfoDetails_wrap.setTtInfoId($tid);
237   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
238   - insert(ttInfoDetails_wrap);
239   - }
240   - update($cid);
241   -
242   -end
243   -
244   -rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配
245   - salience 500
246   - when
247   - $cid : Calcu_iter_days_result(
248   - $calcu_date: calcu_date,
249   - $calcu_weekday: calcu_weekday,
250   - $calcu_day: calcu_day,
251   - calcu_day <= calcu_days
252   - )
253   - TTInfo_wrap(
254   - $tid: id,
255   - $tname: name,
256   - specialDays not contains $calcu_date,
257   - weekdays[$calcu_weekday - 1] == false
258   - )
259   - then
260   - // 更新迭代对象
261   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
262   - $cid.setCalcu_day(new_calcu_day);
263   - DateTime new_calcu_date = $calcu_date.plusDays(1);
264   - $cid.setCalcu_date(new_calcu_date);
265   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
266   -
267   - log.info("启用默认日期时刻表:" +
268   - "时刻表id={} 常规日期={} 星期几={}",
269   - $tid, $calcu_date, $calcu_weekday);
270   -
271   - // 判定使用的时刻表
272   - if (!$cid.getTtinfomap().containsKey($tid)) {
273   - $cid.getTtinfomap().put($tid, $tid);
274   - StatInfo statInfo = new StatInfo();
275   - statInfo.setTtid($tid);
276   - statInfo.setTtname($tname);
277   - insert(statInfo);
278   -
279   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
280   - ttInfoDetails_wrap.setTtInfoId($tid);
281   - Map<String, Object> param = new HashMap<String, Object>();
282   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
283   - insert(ttInfoDetails_wrap);
284   - }
285   - update($cid);
286   -
287   -end
288   -
289   -//-------------- 第四阶段、时刻表明细统计值 ------------//
290   -
291   -rule "statinfo_result" // 统计计算结果
292   - salience 300
293   - no-loop
294   - when
295   - $statInfo: StatInfo($tid: ttid)
296   - $ttInfoDetails_wrap: TTInfoDetails_wrap(ttInfoId == $tid)
297   - $allbc: Long() from accumulate (TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), count())
298   - $inbc: Long() from accumulate (TTInfoDetail(bcType == "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
299   - $outbc: Long() from accumulate (TTInfoDetail(bcType == "out") from $ttInfoDetails_wrap.getBcInfoList(), count())
300   - $yybc: Long() from accumulate (TTInfoDetail(bcType != "out", bcType != "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
301   - $errorbc: Long() from accumulate ($ttd: TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), ecount($ttd))
302   - then
303   - log.info("时刻表={},id={},班次数={},进场={},出场={},营运={},错误={}", $statInfo.getTtname(), $statInfo.getTtid(), $allbc, $inbc, $outbc, $yybc, $errorbc);
304   -
305   - $statInfo.setAllbc($allbc);
306   - $statInfo.setInbc($inbc);
307   - $statInfo.setOutbc($outbc);
308   - $statInfo.setYybc($yybc);
309   - $statInfo.setErrorbc($errorbc);
310   -
311   - int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion();
312   - $statInfo.setLineVersion(lineVersion);
313   -
314   - rs.getInfos().add($statInfo);
315   -
316   -end
317   -
318   -
319   -
320   -
321   -
322   -
323   -
324   -
325   -
326   -
327   -
328   -
329   -
330   -
331   -
332   -
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +
  7 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
  8 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result.StatInfo;
  9 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam;
  10 +
  11 +import com.bsth.entity.schedule.TTInfo;
  12 +import com.bsth.entity.schedule.TTInfoDetail;
  13 +import com.bsth.entity.Line;
  14 +
  15 +import com.bsth.repository.schedule.TTInfoDetailRepository;
  16 +
  17 +import org.slf4j.Logger
  18 +import org.joda.time.format.DateTimeFormat
  19 +import java.lang.String
  20 +import java.lang.Object;
  21 +
  22 +
  23 +// 全局日志类(一般使用调用此规则的service类)
  24 +global Logger log;
  25 +global TTInfoDetailRepository tTInfoDetailRepository;
  26 +
  27 +// 输出
  28 +global Result rs;
  29 +
  30 +/*
  31 + 规则说明:
  32 + 1、找出指定线路,指定时间范围的时刻表
  33 + 2、统计这些时刻表班次数据的情况
  34 +*/
  35 +
  36 +//-------------- 第一阶段、计算规则迭代数据(天数) ------------//
  37 +declare Calcu_iter_days_result
  38 + xlId: Integer // 线路Id
  39 + xlName: String // 线路名字
  40 +
  41 + // 迭代数据
  42 + calcu_day: Integer // 准备计算第几天
  43 + calcu_weekday: Integer // 准备计算星期几(1到7)
  44 + calcu_date: DateTime // 准备计算的具体日期
  45 +
  46 + // 范围数据
  47 + calcu_days: Integer // 总共需要计算的天数
  48 + calcu_start_date: DateTime // 开始计算日期
  49 + calcu_end_date: DateTime // 结束计算日期
  50 +
  51 + // 时刻表映射数据
  52 + ttinfomap: Map // 指定时间段内,用的时刻表id映射 Map<Long, Long>
  53 +end
  54 +
  55 +rule "calcu_iter_days"
  56 + salience 1900
  57 + when
  58 + CalcuParam(
  59 + $xlId: xlId,
  60 + $fromDate: fromDate,
  61 + $toDate: toDate,
  62 + $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate)
  63 + )
  64 + $line: Line(id == $xlId)
  65 + then
  66 + // 构造Calcu_iter_days_result对象,进行下一步计算
  67 + Calcu_iter_days_result cidr = new Calcu_iter_days_result();
  68 + Period p = new Period($fromDate, $toDate, PeriodType.days());
  69 +
  70 + cidr.setXlId($xlId);
  71 + cidr.setXlName($line.getName());
  72 +
  73 + cidr.setCalcu_day(new Integer(1));
  74 + cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek()));
  75 + cidr.setCalcu_date($fromDate);
  76 +
  77 + cidr.setCalcu_days(Integer.valueOf(p.getDays() + 1));
  78 + cidr.setCalcu_start_date($fromDate);
  79 + cidr.setCalcu_end_date($toDate);
  80 +
  81 + cidr.setTtinfomap(new HashMap());
  82 +
  83 + log.info(
  84 + "线路={}-id={},开始时间={},结束时间={},总共计算的天数={},将从开始时间迭代",
  85 + cidr.getXlName(),
  86 + cidr.getXlId(),
  87 + cidr.getCalcu_start_date(),
  88 + cidr.getCalcu_end_date(),
  89 + cidr.getCalcu_days()
  90 + );
  91 +
  92 + insert(cidr);
  93 +end
  94 +
  95 +//-------------- 第二阶段、包装时刻表实体类到内部对象 ------------//
  96 +
  97 +declare TTInfo_wrap
  98 + id: Long // 时刻表id
  99 + name: String // 时刻表名字
  100 + weekdays: List // 周一到周日是否启用 List<Boolean>
  101 + specialDays: List // 特殊节假日 List<DateTime>
  102 + updateDate: DateTime // 最新修改时间
  103 +end
  104 +
  105 +rule "TTInfo_wrap_result"
  106 + salience 900
  107 + when
  108 + CalcuParam($xlId: xlId)
  109 + $ttinfo: TTInfo(
  110 + xl.id == $xlId,
  111 + isEnableDisTemplate == true,
  112 + isCancel == false
  113 + )
  114 + then
  115 + TTInfo_wrap ttInfo_wrap = new TTInfo_wrap();
  116 + ttInfo_wrap.setId($ttinfo.getId());
  117 + ttInfo_wrap.setName($ttinfo.getName());
  118 + ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate()));
  119 + ttInfo_wrap.setWeekdays(new ArrayList());
  120 + ttInfo_wrap.setSpecialDays(new ArrayList());
  121 +
  122 + String[] days = $ttinfo.getRule_days().split(",");
  123 + for (int i = 0; i < 7; i++) {
  124 + if ("1".equals(days[i])) {
  125 + ttInfo_wrap.getWeekdays().add(true);
  126 + } else {
  127 + ttInfo_wrap.getWeekdays().add(false);
  128 + }
  129 + }
  130 +
  131 + if (StringUtils.isNotEmpty($ttinfo.getSpecial_days())) {
  132 + String[] sdays = $ttinfo.getSpecial_days().split(",");
  133 + for (int i = 0; i < sdays.length; i++) {
  134 + ttInfo_wrap.getSpecialDays().add(
  135 + DateTimeFormat.forPattern(
  136 + "yyyy-MM-dd").parseDateTime(sdays[i]));
  137 + }
  138 + }
  139 +
  140 + log.info("时刻表={},id={},常规日期={},特殊日期={}",
  141 + ttInfo_wrap.getName(),
  142 + ttInfo_wrap.getId(),
  143 + ttInfo_wrap.getWeekdays(),
  144 + ttInfo_wrap.getSpecialDays());
  145 +
  146 + insert(ttInfo_wrap);
  147 +
  148 +end
  149 +
  150 +//-------------- 第三阶段、时刻表的日期匹配 ------------//
  151 +
  152 +declare TTInfoDetails_wrap
  153 + ttInfoId: Long // 时刻表id
  154 + bcInfoList: List // 班次信息列表 List<TTInfoDetail>
  155 +end
  156 +
  157 +rule "Calcu_iter_days_special_day" // 特殊日期匹配
  158 + salience 800
  159 + when
  160 + $cid : Calcu_iter_days_result(
  161 + $calcu_date: calcu_date,
  162 + $calcu_day: calcu_day,
  163 + calcu_day <= calcu_days
  164 + )
  165 + TTInfo_wrap(
  166 + $tid: id,
  167 + $tname: name,
  168 + specialDays contains $calcu_date
  169 + )
  170 + then
  171 + // 更新迭代对象
  172 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  173 + $cid.setCalcu_day(new_calcu_day);
  174 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  175 + $cid.setCalcu_date(new_calcu_date);
  176 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  177 +
  178 + log.info("启用特殊日期时刻表:" +
  179 + "时刻表id={} 特殊日期={}",
  180 + $tid, $calcu_date);
  181 +
  182 + // 判定使用的时刻表
  183 + if (!$cid.getTtinfomap().containsKey($tid)) {
  184 + $cid.getTtinfomap().put($tid, $tid);
  185 + StatInfo statInfo = new StatInfo();
  186 + statInfo.setTtid($tid);
  187 + statInfo.setTtname($tname);
  188 + insert(statInfo);
  189 +
  190 + TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
  191 + ttInfoDetails_wrap.setTtInfoId($tid);
  192 + ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
  193 + insert(ttInfoDetails_wrap);
  194 + }
  195 + update($cid);
  196 +
  197 +end
  198 +
  199 +rule "Calcu_iter_days_normal_day" // 平日匹配
  200 + salience 700
  201 + when
  202 + $cid : Calcu_iter_days_result(
  203 + $calcu_date: calcu_date,
  204 + $calcu_weekday: calcu_weekday,
  205 + $calcu_day: calcu_day,
  206 + calcu_day <= calcu_days
  207 + )
  208 + TTInfo_wrap(
  209 + $tid: id,
  210 + $tname: name,
  211 + specialDays not contains $calcu_date,
  212 + weekdays[$calcu_weekday - 1] == Boolean.TRUE
  213 + )
  214 + then
  215 + // 更新迭代对象
  216 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  217 + $cid.setCalcu_day(new_calcu_day);
  218 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  219 + $cid.setCalcu_date(new_calcu_date);
  220 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  221 +
  222 +
  223 + log.info("启用常规日期时刻表:" +
  224 + "时刻表id={} 常规日期={} 星期几={}",
  225 + $tid, $calcu_date, $calcu_weekday);
  226 +
  227 + // 判定使用的时刻表
  228 + if (!$cid.getTtinfomap().containsKey($tid)) {
  229 + $cid.getTtinfomap().put($tid, $tid);
  230 + StatInfo statInfo = new StatInfo();
  231 + statInfo.setTtid($tid);
  232 + statInfo.setTtname($tname);
  233 + insert(statInfo);
  234 +
  235 + TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
  236 + ttInfoDetails_wrap.setTtInfoId($tid);
  237 + ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
  238 + insert(ttInfoDetails_wrap);
  239 + }
  240 + update($cid);
  241 +
  242 +end
  243 +
  244 +rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配
  245 + salience 500
  246 + when
  247 + $cid : Calcu_iter_days_result(
  248 + $calcu_date: calcu_date,
  249 + $calcu_weekday: calcu_weekday,
  250 + $calcu_day: calcu_day,
  251 + calcu_day <= calcu_days
  252 + )
  253 + TTInfo_wrap(
  254 + $tid: id,
  255 + $tname: name,
  256 + specialDays not contains $calcu_date,
  257 + weekdays[$calcu_weekday - 1] == false
  258 + )
  259 + then
  260 + // 更新迭代对象
  261 + Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
  262 + $cid.setCalcu_day(new_calcu_day);
  263 + DateTime new_calcu_date = $calcu_date.plusDays(1);
  264 + $cid.setCalcu_date(new_calcu_date);
  265 + $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
  266 +
  267 + log.info("启用默认日期时刻表:" +
  268 + "时刻表id={} 常规日期={} 星期几={}",
  269 + $tid, $calcu_date, $calcu_weekday);
  270 +
  271 + // 判定使用的时刻表
  272 + if (!$cid.getTtinfomap().containsKey($tid)) {
  273 + $cid.getTtinfomap().put($tid, $tid);
  274 + StatInfo statInfo = new StatInfo();
  275 + statInfo.setTtid($tid);
  276 + statInfo.setTtname($tname);
  277 + insert(statInfo);
  278 +
  279 + TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
  280 + ttInfoDetails_wrap.setTtInfoId($tid);
  281 + Map<String, Object> param = new HashMap<String, Object>();
  282 + ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
  283 + insert(ttInfoDetails_wrap);
  284 + }
  285 + update($cid);
  286 +
  287 +end
  288 +
  289 +//-------------- 第四阶段、时刻表明细统计值 ------------//
  290 +
  291 +rule "statinfo_result" // 统计计算结果
  292 + salience 300
  293 + no-loop
  294 + when
  295 + $statInfo: StatInfo($tid: ttid)
  296 + $ttInfoDetails_wrap: TTInfoDetails_wrap(ttInfoId == $tid)
  297 + $allbc: Long() from accumulate (TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), count())
  298 + $inbc: Long() from accumulate (TTInfoDetail(bcType == "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
  299 + $outbc: Long() from accumulate (TTInfoDetail(bcType == "out") from $ttInfoDetails_wrap.getBcInfoList(), count())
  300 + $yybc: Long() from accumulate (TTInfoDetail(bcType != "out", bcType != "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
  301 + $errorbc: Long() from accumulate ($ttd: TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), ecount($ttd))
  302 + then
  303 + log.info("时刻表={},id={},班次数={},进场={},出场={},营运={},错误={}", $statInfo.getTtname(), $statInfo.getTtid(), $allbc, $inbc, $outbc, $yybc, $errorbc);
  304 +
  305 + $statInfo.setAllbc($allbc);
  306 + $statInfo.setInbc($inbc);
  307 + $statInfo.setOutbc($outbc);
  308 + $statInfo.setYybc($yybc);
  309 + $statInfo.setErrorbc($errorbc);
  310 +
  311 + int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion();
  312 + $statInfo.setLineVersion(lineVersion);
  313 +
  314 + rs.getInfos().add($statInfo);
  315 +
  316 +end
  317 +
  318 +
  319 +
  320 +
  321 +
  322 +
  323 +
  324 +
  325 +
  326 +
  327 +
  328 +
  329 +
  330 +
  331 +
  332 +
... ...
src/main/resources/static/index.html
... ... @@ -632,6 +632,7 @@
632 632 data-exclude=1></script>
633 633 <!-- echarts4 误删 -->
634 634 <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script>
  635 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
635 636  
636 637 </body>
637 638 </html>
638 639 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/search.js
... ... @@ -28,7 +28,7 @@ var gb_ct_search = function () {
28 28  
29 29 var searchComplete = function (e) {
30 30 console.log('e.wr', e);
31   - var htmlStr = template('geo_d_e_search_result-temp', {list: e.Br});
  31 + var htmlStr = template('geo_d_e_search_result-temp', {list: e.Ar});
32 32 $('.ct_search_result').html(htmlStr);
33 33  
34 34 };
... ...
src/main/resources/static/pages/base/lineversions/add.html
... ... @@ -108,6 +108,7 @@
108 108 <select name="status" class="form-control" id="statusInput">
109 109 <option value="">请选择...</option>
110 110 <option value="1">当前版本</option>
  111 +
111 112 <option value="2">待更新版本</option>
112 113 <option value="0">历史版本</option>
113 114 </select>
... ...
src/main/resources/static/pages/base/lineversions/edit.html
... ... @@ -54,7 +54,7 @@
54 54 <span class="required"> * </span>线路名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
55 55 </label>
56 56 <div class="col-md-4">
57   - <select name="line" class="form-control" style="width:100%" id="lineSelect"></select>
  57 + <select name="line" class="form-control" style="width:100%" id="lineSelect" disabled="true"></select>
58 58 </div>
59 59 </div>
60 60 <!-- 表单分组组件 form-group END -->
... ... @@ -87,7 +87,7 @@
87 87 <span class="required"> * </span>线路版本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
88 88 </label>
89 89 <div class="col-md-4">
90   - <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" />
  90 + <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" readonly="true" />
91 91 </div>
92 92 </div>
93 93 <!-- 表单分组组件 form-group END -->
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js
... ... @@ -207,7 +207,6 @@
207 207 submit();
208 208 // 提交
209 209 function submit() {
210   - debugger
211 210 // 添加数据
212 211 $post('/lineVersions/update', params, function(result) {
213 212 // 如果返回结果不为空
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js
... ... @@ -299,6 +299,36 @@
299 299 /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
300 300 loadTableDate(params,true);
301 301 });
  302 + // 删除待更新线路版本
  303 + $(document).on('click', 'a.update_delete_btn', function () {
  304 + var id = $(this).data('id');
  305 + swal({
  306 + title: "确认删除这个待更新线路版本!",
  307 + type: "warning",
  308 + showCancelButton: true,
  309 + confirmButtonColor: "#DD6B55",
  310 + confirmButtonText: "是的!",
  311 + cancelButtonText: "我在考虑下...",
  312 + closeOnConfirm: false },
  313 + function(isConfirm){
  314 + if(isConfirm){
  315 + $post('/lineVersions/delete', {"id":id}, function(result) {
  316 + // 如果返回结果不为空
  317 + if(result){
  318 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  319 + if(result.status=='SUCCESS') {
  320 + // 弹出添加成功提示消息
  321 + layer.msg('删除成功...');
  322 + } else if(result.status=='ERROR') {
  323 + // 弹出添加失败提示消息
  324 + layer.msg('删除失败...');
  325 + }
  326 + }
  327 + });
  328 + swal.close();
  329 + }
  330 + });
  331 + });
302 332 // 线路版本编辑
303 333 $(document).on('click', 'a.update_versions_route_btn', function () {
304 334 var lineId = $(this).data('lineid');
... ...
src/main/resources/static/pages/base/lineversions/list.html
... ... @@ -145,9 +145,12 @@
145 145 {{obj.remark}}
146 146 </td>
147 147 <td>
148   - <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  148 + {{if obj.status != '0'}}
  149 + <a href="edit.html?no={{obj.id}}" class="btn btn-info btn-sm" data-pjax> 修改 </a>
  150 + {{/if}}
149 151 {{if obj.status == '2'}}
150   - <a class="update_versions_route_btn btn default blue-stripe btn-sm" data-lineid="{{obj.line.id}}" data-pjax> 编辑版本路线 </a>
  152 + <a class="update_delete_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax> 删除 </a>
  153 + <a class="update_versions_route_btn btn btn-info btn-sm" data-lineid="{{obj.line.id}}" data-pjax> 编辑版本路线 </a>
151 154 {{/if}}
152 155 {{if obj.status == '2' && obj.isupdate!=1}}
153 156 <a class="issue_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax>发布</a>
... ...
src/main/resources/static/pages/base/roadspeed/js/add-form-wizard.js
... ... @@ -78,7 +78,6 @@ var FormWizard = function() {
78 78 submitHandler : function(f) {
79 79 // 防止用户多次提交
80 80 $("#submintBtn").addClass("disabled");
81   - debugger
82 81 var params = form.serializeJSON();// 表单序列化.
83 82 if(params.roadVector=='') {
84 83 layer.msg('路段几何图形为空~请先在路段位置步骤中绘制出线路走向!');
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
... ... @@ -66,9 +66,9 @@ window.WorldsBMap = function () {
66 66 var dragMarkerDragEvent = function (e) {
67 67 if (editPolygon) {
68 68 // 中心点是否超出多边形
69   - if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) {
70   - dragMarker.setPosition(dragMarker._old_point);//还原位置
71   - }
  69 + // if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) {
  70 + // dragMarker.setPosition(dragMarker._old_point);//还原位置
  71 + // }
72 72 centerPoint = e.target._position;
73 73 }
74 74 else if (editCircle) {
... ... @@ -321,7 +321,7 @@ window.WorldsBMap = function () {
321 321 mapBValue.centerAndZoom(point, 18);
322 322 editCircle = circle;
323 323 // 允许覆盖物在map.clearOverlays方法中被清除
324   - circle.enableMassClear();
  324 + // circle.enableMassClear();
325 325 // 百度地图添加覆盖物圆
326 326 mapBValue.addOverlay(circle);
327 327 // 开启编辑功能
... ... @@ -349,7 +349,7 @@ window.WorldsBMap = function () {
349 349 $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]);
350 350 });
351 351 });
352   - // 编辑多
  352 + // 编辑多
353 353 } else if (stationShapesTypeV == 'd') {
354 354 // 获取中心点坐标字符串
355 355 var testpointStr = station.stationJwpoints;
... ... @@ -383,7 +383,9 @@ window.WorldsBMap = function () {
383 383 mapBValue.addOverlay(polygon);
384 384 // 开启编辑功能(自 1.1 新增)
385 385 polygon.enableEditing();
386   - // 添加多变行编辑事件
  386 + //禁止覆盖物在map.clearOverlays方法中被清除
  387 + // polygon.disableMassClear();
  388 + // 添加多边形编辑事件
387 389 polygon.addEventListener('dblclick', function (e) {
388 390 // 获取编辑的多边形对象
389 391 var edit_pointE = polygon;
... ...
src/main/resources/static/pages/base/stationroute/list.html
... ... @@ -351,7 +351,9 @@
351 351  
352 352 function setPlace(){
353 353 // myMap.clearOverlays(); //清除地图上所有覆盖物
354   - WorldsBMap.clearOtherOverlay();
  354 + var local = new BMap.LocalSearch(myMap, { //智能搜索
  355 + onSearchComplete: myFun
  356 + });
355 357 function myFun(){
356 358 var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point;
357 359 if(pp) {
... ... @@ -361,22 +363,19 @@
361 363 layer.msg('找不到您输入的位置!')
362 364 }
363 365 }
364   - var local = new BMap.LocalSearch(myMap, { //智能搜索
365   - onSearchComplete: myFun
366   - });
367 366 local.search(myValue);
368 367 }
369 368 $("#searchInput").on('input propertychange change', function () {
370 369 if($("#searchInput").val() != null && $("#searchInput").val() != "")
371 370 $('.search_panel .clear').removeClass('hide');
372 371 else {
373   - WorldsBMap.clearOtherOverlay();
  372 + // WorldsBMap.clearOtherOverlay();
374 373 $('.search_panel .clear').addClass('hide');
375 374 }
376 375 });
377 376  
378 377 $('.search_panel .clear').on('click',function () {
379   - WorldsBMap.clearOtherOverlay();
  378 + // WorldsBMap.clearOtherOverlay();
380 379 $("#searchInput").val('');
381 380 $("#searchInput").change();
382 381 });
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/InternalScheduleObj.js
1   -/**
2   - * v2_2版本的行车计划对象。
3   - *
4   - * 本次修正和原来区别,一边生成班次,一边调整班次间隔
5   - * 1、初始化行车计划基本布局,主要是有几辆车,路牌分布情况(连班,分班,5休2分班),上标线的初始班次列表
6   - *
7   - */
8   -var InternalScheduleObj_v2_2 = (function() {
9   -
10   - // 内部utils类
11   - var _utils = function() {
12   - return {
13   - /**
14   - * 创建班次对象。
15   - * @param lpObj InternalLpObj路牌对象
16   - * @param bcType 班次类型(normal等等)
17   - * @param isUp 是否上行
18   - * @param fcno 发车顺序号
19   - * @param fcTimeObj 发车时间对象
20   - * @param paramObj 参数对象
21   - * @returns {InternalBcObj}
22   - */
23   - createBcObj : function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
24   - var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType); // 班次里程
25   - var _fcsj = fcTimeObj; // 发车时间
26   - // var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); // 班次历时
27   - var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _fcsj, paramObj); // 使用策略计算班次行驶时间
28   -
29   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
30   -
31   - var _arrsj = paramObj.addMinute(_fcsj, _bcsj); // 到达时间
32   - // 停站时间范围,[最小停站时间,最大停站时间]
33   - // var _stopTimeRange = paramObj.calcuTripLayoverTimeRange(_arrsj, isUp, _bcsj);
34   - var _stopTimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
35   - _fcsj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
36   -
37   - var _stoptime = _stopTimeRange[0]; // 使用最小停站时间
38   - var _tccid = paramObj.getTTinfoId();
39   - var _ttinfoid = paramObj.getTTinfoId();
40   - var _xl = paramObj.getXlId();
41   - var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
42   - var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
43   -
44   - if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间
45   - if (isUp) { // 上行
46   - _fcsj = paramObj.addMinute(
47   - _fcsj,
48   - -(paramObj.getUpOutTime() + paramObj.getLbTime()));
49   - _bcsj = paramObj.getLbTime();
50   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
51   - _stoptime = 0;
52   - } else { // 下行
53   - _fcsj = paramObj.addMinute(
54   - _fcsj,
55   - -(paramObj.getDownOutTime() + paramObj.getLbTime()));
56   - _bcsj = paramObj.getLbTime();
57   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
58   - _stoptime = 0;
59   - }
60   - } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间
61   - if (isUp) { // 上行
62   - _fcsj = paramObj.addMinute(
63   - _fcsj,
64   - paramObj.getUpInTime());
65   - _bcsj = paramObj.getLbTime();
66   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
67   - _stoptime = 0;
68   - } else { // 下行
69   - _fcsj = paramObj.addMinute(
70   - _fcsj,
71   - paramObj.getDownInTime());
72   - _bcsj = paramObj.getLbTime();
73   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
74   - _stoptime = 0;
75   - }
76   - } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间
77   - if (isUp) { // 上行
78   - _fcsj = paramObj.addMinute(
79   - _fcsj,
80   - -paramObj.getUpOutTime());
81   - _bcsj = paramObj.getUpOutTime();
82   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
83   - _stoptime = 0;
84   - } else { // 下行
85   - _fcsj = paramObj.addMinute(
86   - _fcsj,
87   - -paramObj.getDownOutTime());
88   - _bcsj = paramObj.getDownOutTime();
89   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
90   - _stoptime = 0;
91   - }
92   - } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间
93   - if (isUp) { // 上行
94   - _bcsj = paramObj.getUpInTime();
95   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
96   - _stoptime = 0;
97   - } else { // 下行
98   - _bcsj = paramObj.getDownInTime();
99   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
100   - _stoptime = 0;
101   - }
102   - } else if (bcType == "cf") { // 吃饭班次
103   - // 以13:00为分界,之前的为午饭,之后的为晚饭
104   - if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) {
105   - _bcsj = paramObj.fnGetLunchTime();
106   - } else {
107   - _bcsj = paramObj.fnGetDinnerTime();
108   - }
109   - _arrsj = paramObj.addMinute(_fcsj, _bcsj);
110   - _stoptime = 0;
111   - }
112   -
113   - var bcParamObj = {};
114   - bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等)
115   - bcParamObj.isUp = isUp; // boolean是否上下行
116   - bcParamObj.fcno = fcno; // 发车顺序号
117   - bcParamObj.fcTimeObj = _fcsj; // 发车时间对象
118   - bcParamObj.bclc = _bclc; // 班次里程
119   - bcParamObj.bcsj = _bcsj; // 班次历时
120   - bcParamObj.arrtime = _arrsj; // 到达时间对象
121   - bcParamObj.stoptime = _stoptime; // 停站时间
122   - bcParamObj.tccid = _tccid; // 停车场id
123   - bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
124   - bcParamObj.xl = _xl; // 线路id
125   - bcParamObj.qdzid = _qdz; // 起点站id
126   - bcParamObj.zdzid = _zdz; // 终点站id
127   -
128   - return new InternalBcObj(lpObj, bcParamObj);
129   - },
130   -
131   - /**
132   - * 修正上标线主站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续说有班次。
133   - * @param oLp 上标线路牌
134   - * @param fromFcsj 开始发车时间对象
135   - * @param fromGroupIndex 开始圈索引
136   - * @param fromBcIndex 开始班次索引
137   - * @param isUp 开始班次是上行还是下行
138   - * @param oParam 参数对象
139   - */
140   - modifySBXMasterBc: function(oLp, fromFcsj, fromGroupIndex, fromBcIndex, isUp, oParam) {
141   - // 清空指定位置班次及后续班次
142   - oLp.clearBc(fromGroupIndex, fromBcIndex);
143   - // 初始化上标线,从指定圈索引开始
144   - oLp.initDataFromTime(fromFcsj, isUp, fromGroupIndex, oParam, _utils);
145   -
146   - }
147   -
148   - };
149   - }();
150   -
151   -
152   -
153   - /**
154   - * 内部行车计划对象。
155   - * @param oParam 参数封装对象
156   - * @param aLp 路牌(甘特图用的路牌对象)
157   - * @constructor
158   - */
159   - function InternalScheduleObj(oParam, aLp) {
160   - // 参数对象和甘特图用路牌数组
161   - this._oParam = oParam;
162   - this._aGanttLpArray = aLp;
163   -
164   - // 目前这个只支持主站停站
165   - if (this._oParam.isTwoWayStop()) {
166   - alert("v2_2版本不支持双向停站类型线路!");
167   - throw "v2_2版本不支持双向停站类型线路";
168   - }
169   -
170   - console.log("//->>>>>>>>>>>>>>>>>>>>>>>>> v2_2行车计划,初始化1,圈信息,路牌 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-//");
171   - //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
172   - this._qIsUp = true; // 每一圈是上行开始还是下行开始
173   -
174   - // 确定_qIsUp,哪个方向的首班车晚就用哪个
175   - // this._qIsUp = this._oParam.getUpFirstDTimeObj().isBefore(
176   - // this._oParam.getDownFirstDTimeObj()) ? false : true;
177   -
178   - // 确定_qIsUp,哪个方向的首班车晚就用哪个
179   - // 使用diff判定,如果两个时间相等 this._qIsUp = false
180   - this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
181   -
182   -
183   - // 上标线开始时间,就是方向的首班车时间
184   - var st = this._qIsUp ? oParam.getUpFirstDTimeObj() : oParam.getDownFirstDTimeObj();
185   - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
186   - var et;
187   - var et_IsUp;
188   - if (oParam.getUpLastDtimeObj().isBefore(
189   - oParam.getDownLastDTimeObj())) {
190   - et = oParam.getDownLastDTimeObj();
191   - et_IsUp = false;
192   - } else {
193   - et = oParam.getUpLastDtimeObj();
194   - et_IsUp = true;
195   - }
196   - //------------------------ 2、计算总共有多少圈 ------------------------//
197   - this._qCount = 0; // 总的圈数
198   -
199   - // 以开始时间,结束时间,构造上标线用连班班次发车时间
200   - var bcFcsjArrays = []; // 班次发车时间对象数组
201   - var bcArsjArrays = []; // 班次到达时间对象数组
202   - var isUp = this._qIsUp; // 方向
203   - var bcCount = 1; // 班次数
204   -
205   - var _kssj = st; // 开始时间
206   - var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _kssj, oParam); // 使用策略计算班次行驶时间
207   - var _arrsj = oParam.addMinute(_kssj, _bcsj); // 到达时间
208   - var _stoptimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
209   - _kssj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam);
210   - var _stoptime = _stoptimeRange[0]; // 最小停站时间
211   -
212   - do {
213   - bcFcsjArrays.push(_kssj);
214   - bcArsjArrays.push(_arrsj);
215   -
216   - _kssj = oParam.addMinute(_kssj, _bcsj + _stoptime);
217   - // _bcsj = oParam.calcuTravelTime(_kssj, isUp);
218   -
219   - _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _kssj, oParam); // 使用策略计算班次行驶时间
220   - _arrsj = oParam.addMinute(_kssj, _bcsj);
221   - _stoptimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
222   - _kssj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam);
223   - _stoptime = _stoptimeRange[0]; // 最小停站时间
224   -
225   - bcCount ++;
226   - isUp = !isUp;
227   - } while(_kssj.isBefore(et));
228   - bcCount--; // 因为先做do,所以总的班次要减1
229   -
230   - var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
231   - var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
232   -
233   - // 利用连班数组计算圈数
234   - this._qCount = 1; // 前面加1圈,补中标线的班次
235   - this._qCount += _qCount_p1;
236   - this._qCount += _qCount_p2;
237   -
238   - // 计算最后是不是还要补一圈
239   - if (this._qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
240   - if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
241   - // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
242   - // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
243   - if (!this._qIsUp == et_IsUp) {
244   - // 一致不用加圈数
245   - } else {
246   - // 不一致需要加圈补最后一个结束时间班次
247   - this._qCount ++;
248   - }
249   - } else {
250   - // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
251   - // 不需要在补圈数了
252   - }
253   - }
254   - //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
255   - this._internalLpArray = []; // 内部路牌(InternalLpObj对象)数组
256   -
257   - // 创建内部的路牌数组
258   - var i;
259   - for (i = 0; i < this._aGanttLpArray.length; i++) {
260   - this._internalLpArray.push(
261   - new InternalLpObj(this._aGanttLpArray[i], this._qCount, this._qIsUp));
262   - }
263   -
264   - // 初始化上标线,从第1圈开始
265   - this._internalLpArray[0].initDataFromTimeToTime(
266   - bcFcsjArrays[0], et, this._qIsUp, 1, oParam, _utils);
267   -
268   -
269   - console.log("上行首班车时间:" + oParam.getUpFirstDTimeObj().format("HH:mm") +
270   - "上行末班车时间:" + oParam.getUpLastDtimeObj().format("HH:mm"));
271   - console.log("下行首班车时间:" + oParam.getDownFirstDTimeObj().format("HH:mm") +
272   - "下行末班车时间:" + oParam.getDownLastDTimeObj().format("HH:mm"));
273   - console.log("总共计算的圈数:" + this._qCount);
274   - console.log("圈的方向isUP:" + this._qIsUp);
275   -
276   - console.log("//->>>>>>>>>>>>>>>>>>>>>>>>> v2_2行车计划,初始化2,工时,路牌信息 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-//");
277   - //------------------------ 1、以上标线为基础,计算各种班型工时对应的圈数、班次数 -----------------------//
278   - var aBcArray = this._internalLpArray[0].getBcArray();
279   - aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识
280   -
281   - if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算
282   - aBcArray.splice(aBcArray.length - 1, 1);
283   - }
284   -
285   - var iLTime = oParam.fnGetLunchTime(); // 午饭吃饭时间
286   - var iDTime = oParam.fnGetDinnerTime(); // 晚饭吃饭时间
287   - var iOutTime = this._qIsUp ? oParam.getUpOutTime() : oParam.getDownOutTime(); // 出场时间
288   - var iInTime = this._qIsUp ? oParam.getDownInTime() : oParam.getUpInTime(); // 进场时间
289   - var iBTime = oParam.getLbTime(); // 例保时间
290   -
291   - var sum = 0; // 总班次时间
292   - for (i = 0; i < aBcArray.length; i++) {
293   - sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime();
294   - }
295   - sum += iLTime; // 加午饭时间
296   - sum += iDTime; // 加晚饭时间
297   -
298   - this._aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时)
299   - {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0},
300   - {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0},
301   - {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0},
302   - {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0},
303   - {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0},
304   - {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0},
305   - {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0},
306   - {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0}
307   - ];
308   -
309   - for (i = 0; i < this._aBxDesc.length; i++) {
310   - this._aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间
311   -
312   - // 计算5休2的班次数(双进出场,4个例保)
313   - if (i == 6) {
314   - this._aBxDesc[i].fQCount =
315   - (this._aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) /
316   - this._aBxDesc[i].fAverTime;
317   - this._aBxDesc[i].fBcCount = this._aBxDesc[i].fQCount * 2;
318   - } else { // 进出场,2个例保
319   - this._aBxDesc[i].fQCount =
320   - (this._aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) /
321   - this._aBxDesc[i].fAverTime;
322   - this._aBxDesc[i].fBcCount = this._aBxDesc[i].fQCount * 2;
323   - }
324   - }
325   - console.log("班型描述(以下):");
326   - console.log(this._aBxDesc);
327   - //--------------------- 2、计算分班连班班型车辆分布数 --------------------//
328   - this._iBx_lb_lpcount = 0; // 连班路牌数
329   - this._iBx_5_2_fb_lpcount = 0; // 5休2分班路牌数
330   - this._iBx_other_fb_lpcount = 0; // 其他分班路牌数
331   -
332   - // 总共车辆数(高峰最大车辆数)
333   - var iCls = InternalScheduleObj_v2_2.calcuClzx(oParam);
334   - // 计算低谷最大周转时间
335   - var _iTroughCycleTime =
336   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.toTimeObj("13:00"), oParam) +
337   - StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
338   - oParam.toTimeObj("13:00"), true,
339   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1] +
340   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.toTimeObj("13:00"), oParam) +
341   - StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
342   - oParam.toTimeObj("13:00"), false,
343   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1];
344   -
345   - // 低谷最少配车(预估最少连班车数量)
346   - var iDgminpc = Math.ceil(_iTroughCycleTime / oParam.getTroughMaxFcjx());
347   - // 加班车路牌数(做5休2的路牌数)
348   - var i_5_2_lpes = oParam.getJBLpes();
349   -
350   - // v2_2版本的路牌分布就是连班分班加班车分布,总车辆数减去加班车,剩下的车对半开连班和其他分班,但是连班必须大于最少连班
351   - if (iCls < iDgminpc) {
352   - alert("总配车数小于低谷最小配车");
353   - throw "总配车数小于低谷最小配车";
354   - } else {
355   - // 5_2路牌数
356   - this._iBx_5_2_fb_lpcount = i_5_2_lpes;
357   -
358   - // 剩余车辆数
359   - var _iOtherCls = iCls - this._iBx_5_2_fb_lpcount;
360   - var _iHalfCls1; // 连班路牌数
361   - var _iHalfCls2; // 其他分班路牌数
362   - if (_iOtherCls % 2 == 0) { // 能整除
363   - _iHalfCls1 = _iOtherCls / 2;
364   - _iHalfCls2 = _iOtherCls / 2;
365   - } else {
366   - _iHalfCls1 = Math.floor(_iOtherCls / 2) + 1;
367   - _iHalfCls2 = Math.floor(_iOtherCls / 2);
368   - }
369   - if (_iHalfCls1 > iDgminpc) {
370   - this._iBx_lb_lpcount = _iHalfCls1;
371   - this._iBx_other_fb_lpcount = _iHalfCls2;
372   - } else {
373   - this._iBx_lb_lpcount = iDgminpc;
374   - this._iBx_other_fb_lpcount = iCls - this._iBx_lb_lpcount - i_5_2_lpes;
375   - }
376   - }
377   -
378   - //------------------------ 3、利用间隔法计算连班路牌分布 --------------------//
379   - var i;
380   - var j;
381   - var iC1 = Math.floor(this._internalLpArray.length / this._iBx_lb_lpcount);
382   - var iC2 = this._internalLpArray.length % this._iBx_lb_lpcount;
383   - var iLpIndex;
384   -
385   - for (i = 0; i < this._iBx_lb_lpcount - iC2; i++) {
386   - iLpIndex = i * iC1;
387   - this._internalLpArray[iLpIndex].setBxLb(true);
388   - this._internalLpArray[iLpIndex].setBxDesc("连班");
389   - }
390   - for (j = 0; j < iC2; j++) {
391   - iLpIndex = i * iC1 + j * (iC1 + 1);
392   - this._internalLpArray[iLpIndex].setBxLb(true);
393   - this._internalLpArray[iLpIndex].setBxDesc("连班");
394   - }
395   - //------------------------ 4、利用间隔法计算分班班型路牌分布 --------------------//
396   - // 获取分班路牌索引
397   - var aNotLbIndexes = [];
398   - for (i = 0; i < this._internalLpArray.length; i++) {
399   - if (!this._internalLpArray[i].isBxLb()) {
400   - aNotLbIndexes.push(i);
401   - }
402   - }
403   - // 先5休2分班
404   - iC1 = Math.floor(aNotLbIndexes.length / this._iBx_5_2_fb_lpcount);
405   - iC2 = aNotLbIndexes.length % this._iBx_5_2_fb_lpcount;
406   -
407   - for (i = 0; i < this._iBx_5_2_fb_lpcount - iC2; i++) {
408   - iLpIndex = aNotLbIndexes[i * iC1];
409   - this._internalLpArray[iLpIndex].setBxLb(false);
410   - this._internalLpArray[iLpIndex].setBxFb(true);
411   - this._internalLpArray[iLpIndex].setBxFb5_2(true);
412   - this._internalLpArray[iLpIndex].setBxDesc("5休2分班");
413   - }
414   - for (i = 0; i < iC2; i++) {
415   - iLpIndex = aNotLbIndexes[this._iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)];
416   - this._internalLpArray[iLpIndex].setBxLb(false);
417   - this._internalLpArray[iLpIndex].setBxFb(true);
418   - this._internalLpArray[iLpIndex].setBxFb5_2(true);
419   - this._internalLpArray[iLpIndex].setBxDesc("5休2分班");
420   - }
421   - // 其他分班
422   - for (i = 0; i < aNotLbIndexes.length; i++) {
423   - iLpIndex = aNotLbIndexes[i];
424   - if (!this._internalLpArray[iLpIndex].isBxFb5_2()) {
425   - this._internalLpArray[iLpIndex].setBxLb(false);
426   - this._internalLpArray[iLpIndex].setBxFb(true);
427   - this._internalLpArray[iLpIndex].setBxFb5_2(false);
428   - this._internalLpArray[iLpIndex].setBxDesc("其他分班");
429   - }
430   - }
431   -
432   - console.log("高峰周转时间:" + oParam.calcuPeakZzsj());
433   - console.log("连班路牌数:" + this._iBx_lb_lpcount);
434   - console.log("5休2分班路牌数:" + this._iBx_5_2_fb_lpcount);
435   - console.log("其他分班路牌数:" + this._iBx_other_fb_lpcount);
436   - var aLbIndexes = [];
437   - for (i = 0; i < this._internalLpArray.length; i++) {
438   - if (this._internalLpArray[i].isBxLb()) {
439   - aLbIndexes.push(i);
440   - }
441   - }
442   - console.log("连班路牌indexes=" + aLbIndexes);
443   - var a_5_2_fbIndexes = [];
444   - for (i = 0; i < this._internalLpArray.length; i++) {
445   - if (this._internalLpArray[i].isBxFb() && this._internalLpArray[i].isBxFb5_2()) {
446   - a_5_2_fbIndexes.push(i);
447   - }
448   - }
449   - console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes);
450   - var a_other_fbIndexes = [];
451   - for (i = 0; i < this._internalLpArray.length; i++) {
452   - if (this._internalLpArray[i].isBxFb() && !this._internalLpArray[i].isBxFb5_2()) {
453   - a_other_fbIndexes.push(i);
454   - }
455   - }
456   - console.log("其他分班路牌indexes=" + a_other_fbIndexes);
457   -
458   - console.log("//->>>>>>>>>>>>>>>>> v2_3行车计划,初始化3,计算上标线第一个主站副站班次信息 <<<<<<<<<<<<<<<<<<<<<-//");
459   - // 计算上标线第一个主站班次,副站班次的位置
460   - this._oFirstMasterBc = undefined; // 早高峰主站方向班次
461   - this._iFirstMasterBcGroupIndex = undefined; // 早高峰主站方向圈索引
462   - this._iFirstMasterBcIndex = undefined; // 早高峰主站方向班次索引
463   -
464   - this._oFirstSlaveBc = undefined; // 早高峰副站方向班次
465   - this._iFirstSlaveBcGroupIndex = undefined; // 早高峰副站方向圈索引
466   - this._iFirstSlaveBcIndex = undefined; // 早高峰副站方向班次索引
467   -
468   - if (this._qIsUp) {
469   - if (this._oParam.isUpOneWayStop()) {
470   - this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 0);
471   - this._iFirstMasterBcGroupIndex = 1;
472   - this._iFirstMasterBcIndex = 0;
473   -
474   - this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 1);
475   - this._iFirstSlaveBcGroupIndex = 1;
476   - this._iFirstSlaveBcIndex = 1;
477   - } else {
478   - this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 1);
479   - this._iFirstMasterBcGroupIndex = 1;
480   - this._iFirstMasterBcIndex = 1;
481   -
482   - this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 0);
483   - this._iFirstSlaveBcGroupIndex = 1;
484   - this._iFirstSlaveBcIndex = 0;
485   - }
486   - } else {
487   - if (this._oParam.isUpOneWayStop()) {
488   - this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 1);
489   - this._iFirstMasterBcGroupIndex = 1;
490   - this._iFirstMasterBcIndex = 1;
491   -
492   - this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 0);
493   - this._iFirstSlaveBcGroupIndex = 1;
494   - this._iFirstSlaveBcIndex = 0;
495   - } else {
496   - this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 0);
497   - this._iFirstMasterBcGroupIndex = 1;
498   - this._iFirstMasterBcIndex = 0;
499   -
500   - this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 1);
501   - this._iFirstSlaveBcGroupIndex = 1;
502   - this._iFirstSlaveBcIndex = 1;
503   - }
504   - }
505   -
506   - console.log("早高峰副站方向(start)班次=" + (this._oFirstSlaveBc ? this._oFirstSlaveBc.getFcTimeObj().format("HH:mm") : "未找到"));
507   - console.log("早高峰副站方向(start)班次圈索引=" + (this._oFirstSlaveBc ? this._iFirstSlaveBcGroupIndex : "未找到"));
508   - console.log("早高峰副站方向(start)班次索引=" + (this._oFirstSlaveBc ? this._iFirstSlaveBcIndex : "未找到"));
509   - console.log("早高峰主站方向(start)班次=" + (this._oFirstMasterBc ? this._oFirstMasterBc.getFcTimeObj().format("HH:mm") : "未找到"));
510   - console.log("早高峰主站方向(start)班次圈索引=" + (this._oFirstMasterBc ? this._iFirstMasterBcGroupIndex : "未找到"));
511   - console.log("早高峰主站方向(start)班次索引=" + (this._oFirstMasterBc ? this._iFirstMasterBcIndex : "未找到"));
512   -
513   - console.log("//->>>>>>>>>>>>>>>>> v2_4行车计划,初始化4,从上标线第一圈第一个副站班次开始初始化后续路牌班次列表 <<<<<<<<<<<<<<<<<<<<<-//");
514   - // 初始化上标线副站班次
515   - var oPreBc; // 上一个班次(从上标线副站班次开始)
516   - var oNextBc; // 计算的下一个班次
517   - var oNextBcFcTime; // 下一个班次的发车时间
518   - var aBcInterval = []; // 班次间隔数组
519   - var oBcInterval; // 班次间隔对象
520   - var iNextBcInterval; // 下一个班次发车间隔
521   -
522   - // 当初始化完一圈的副站班次后,最后一个班次是下一圈的上标线副站班次(一圈的周转结束班次),需要调整时间及其前一个主站班次的时间
523   - var _modifyTimeNextGroupIndex; // 上标线下一圈索引
524   - var _modifyTimeNextBcIndex; // 上标线下一圈班次索引
525   - var _modifyBc; // 上标线下一个圈的班次
526   - var _modifyPreBc; // 上标线下一个圈班次的前一个班次
527   - var _modifyTime; // 上标线下一个圈班次的前一个班次的调整时间
528   -
529   - if (this._iFirstSlaveBcIndex == 0) { // 第一圈第二个班次是主站,则第一个班次是副站
530   - oPreBc = this._internalLpArray[0].getBc(this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex);
531   -
532   - aBcInterval = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(
533   - this,
534   - this._oParam,
535   - 1,
536   - this._iFirstSlaveBcIndex,
537   - this._$calcuCycleTime(oPreBc.getFcTimeObj())[0],
538   - this._$calcuCycleTime(oPreBc.getFcTimeObj())[1]
539   - );
540   -
541   - for (i = 1; i < this._internalLpArray.length; i++) {
542   - oBcInterval = aBcInterval[i - 1];
543   -
544   - if (oBcInterval.hasBc) {
545   - // 参考的发车间隔
546   - iNextBcInterval = oBcInterval.iFcInterval;
547   - oNextBcFcTime = this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval);
548   - this._internalLpArray[i].fnSetVerticalIntervalTime(
549   - this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, iNextBcInterval);
550   - this._internalLpArray[i].fnSetHeadwayS2_P(
551   - this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, oBcInterval.fP);
552   -
553   - oNextBc = _utils.createBcObj(
554   - this._internalLpArray[i],
555   - "normal",
556   - !this._oParam.isUpOneWayStop(),
557   - 1,
558   - oNextBcFcTime,
559   - this._oParam);
560   -
561   - this._internalLpArray[i].setBc(
562   - this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, oNextBc);
563   -
564   - oPreBc = oNextBc;
565   - }
566   - }
567   -
568   - // 修正上标线副站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续所有班次
569   - iNextBcInterval = aBcInterval[i - 1].iFcInterval;
570   - _modifyTimeNextGroupIndex = this._iFirstSlaveBcGroupIndex + 1;
571   - _modifyTimeNextBcIndex = this._iFirstSlaveBcIndex;
572   -
573   - _utils.modifySBXMasterBc(
574   - this._internalLpArray[0],
575   - this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval),
576   - this._iFirstSlaveBcGroupIndex + 1,
577   - this._iFirstSlaveBcIndex,
578   - oPreBc.isUp(),
579   - this._oParam
580   - );
581   -
582   - // 调整上标线副站班次一圈后的前一个主站班次时间
583   - _modifyBc = this._internalLpArray[0].getBc(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex);
584   - if (_modifyBc) {
585   - this._internalLpArray[0].fnSetVerticalIntervalTime(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex, iNextBcInterval);
586   -
587   - _modifyPreBc = this._internalLpArray[0].getPreBc(_modifyBc);
588   - _modifyTime = _modifyBc.getFcTimeObj().diff(_modifyPreBc.getArrTimeObj(), "m") - 1; // 主站到副站停站使用1分钟
589   - // 修改发车时间,到达时间,不改行驶时间
590   - _modifyPreBc.getFcTimeObj().add(_modifyTime, "m");
591   - _modifyPreBc.getArrTimeObj().add(_modifyTime, "m");
592   -
593   - }
594   -
595   - }
596   -
597   - console.log("//->>>>>>>>>>>>>>>>> v2_6行车计划,初始化6,创建第一圈的主站班次开始班次列表,然后修正 <<<<<<<<<<<<<<<<<<<<<-//");
598   - this.fnCreateBclistWithMasterBc(1, 1); // 从上标线第一圈的主站班次开始初始化所有路牌的相关班次
599   - // 第一圈的第一个班次是副站,则需要修正this.fnCreateBclistWithMasterBc(1)班次之间的问题,停站时间为负数
600   - if (this._iFirstSlaveBcIndex == 0) {
601   - StrategyUtils_v2_2.sFn("ADJUST_HEADWAY")(
602   - this, this._oParam,
603   - this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex,
604   - this._iFirstMasterBcGroupIndex, this._iFirstMasterBcIndex,
605   - 5 // 修正至少要5分钟停站
606   - );
607   - }
608   -
609   - console.log("//->>>>>>>>>>>>>>>>> v2_7行车计划,初始化7,修正中标线班次列表 <<<<<<<<<<<<<<<<<<<<<-//");
610   - // // TODO:补充中标线班次,这里假设,前一半圈就是中标线,以后再精细处理
611   - // // 中标线开始时间,早的首班车时间,和上标线的开始时间方向相反
612   - // var oSt = !this._qIsUp ? this._oParam.getUpFirstDTimeObj() : this._oParam.getDownFirstDTimeObj();
613   - // var iStRuntime; // 中标线方向班次行驶时间(使用低谷)
614   - // if (!this._qIsUp) { // 上行
615   - // if (this._oParam.isTroughBc(oSt)) {
616   - // iStRuntime = this._oParam.getUpTroughTime();
617   - // } else {
618   - // iStRuntime = this._oParam.getUpMPeakTime();
619   - // }
620   - // } else { // 下行
621   - // if (this._oParam.isTroughBc(oSt)) {
622   - // iStRuntime = this._oParam.getDownTroughTime();
623   - // } else {
624   - // iStRuntime = this._oParam.getDownMPeakTime();
625   - // }
626   - // }
627   - //
628   - // var oSLp;
629   - // var oSBc;
630   - // var oSEmuBcFcTime; // 模拟班次发车时间
631   - // var iTimeDiff;
632   - // var iTempTime;
633   - // var iSModifyLpIndex; // 中标线对应路牌索引
634   - // for (i = 1; i < this._internalLpArray.length; i++) {
635   - // oSLp = this._internalLpArray[i];
636   - // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
637   - // if (!oSBc) { // 可能没有,跳过
638   - // continue;
639   - // }
640   - // oSEmuBcFcTime = this._oParam.addMinute(
641   - // oSBc.getFcTimeObj(),
642   - // -(iStRuntime + 1)
643   - // );
644   - // iTempTime = oSEmuBcFcTime.diff(oSt, "m");
645   - // if (iTimeDiff == undefined) {
646   - // iTimeDiff = iTempTime;
647   - // iSModifyLpIndex = i;
648   - // } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff) && oSEmuBcFcTime.isAfter(oSt)) {
649   - // iTimeDiff = iTempTime;
650   - // iSModifyLpIndex = i;
651   - // }
652   - // }
653   - //
654   - // // 添加上标线头班次(分班连班都可能)
655   - // this._internalLpArray[iSModifyLpIndex].setBc(
656   - // 0, 1,
657   - // _utils.createBcObj(
658   - // this._internalLpArray[iSModifyLpIndex],
659   - // "normal",
660   - // !this._qIsUp,
661   - // 1,
662   - // oSt,
663   - // this._oParam)
664   - // );
665   - //
666   - // // 从当前班次开始,如果是低谷,隔开方向加班次,如果是高峰,都加班次
667   - // var iSInverval = Math.ceil((this._oParam.getMPeakMinFcjx() + this._oParam.getMPeakMaxFcjx()) / 2);
668   - // for (i = iSModifyLpIndex + 1; i < this._internalLpArray.length; i++) {
669   - // oSLp = this._internalLpArray[i];
670   - // oSEmuBcFcTime = this._oParam.addMinute(oSt, iSInverval * (i - iSModifyLpIndex));
671   - // if (this._oParam.isMPeakBc(oSEmuBcFcTime)) { // 高峰
672   - // if (!this._qIsUp) { // 上行
673   - // iStRuntime = this._oParam.getUpMPeakTime();
674   - // } else { // 下行
675   - // iStRuntime = this._oParam.getDownMPeakTime();
676   - // }
677   - // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
678   - // oSLp.setBc(
679   - // 0, 1,
680   - // _utils.createBcObj(
681   - // oSLp,
682   - // "normal",
683   - // !this._qIsUp,
684   - // 1,
685   - // this._oParam.addMinute(oSBc.getFcTimeObj(), -(iStRuntime + 1)),
686   - // this._oParam)
687   - // );
688   - // } else { // 低谷隔开出班次
689   - // if (!this._qIsUp) { // 上行
690   - // iStRuntime = this._oParam.getUpTroughTime();
691   - // } else { // 下行
692   - // iStRuntime = this._oParam.getDownTroughTime();
693   - // }
694   - //
695   - // if (!this._internalLpArray[i - 1].getBc(0, 1)) {
696   - // // 上一个路牌没有班次,添加
697   - // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
698   - // if (oSBc) {
699   - // oSLp.setBc(
700   - // 0, 1,
701   - // _utils.createBcObj(
702   - // oSLp,
703   - // "normal",
704   - // !this._qIsUp,
705   - // 1,
706   - // this._oParam.addMinute(oSBc.getFcTimeObj(), -(iStRuntime + 1)),
707   - // this._oParam)
708   - // );
709   - //
710   - // // 如果生成的班次行驶时间不足,删除这个班次
711   - // if (oSLp.getBc(1, 0).getFcTimeObj().isBefore(oSLp.getBc(0, 1).getArrTimeObj())) {
712   - // oSLp.getGroup(0).setBc1(undefined);
713   - // oSLp.getGroup(0).setBc2(undefined);
714   - // }
715   - // }
716   - // }
717   - // }
718   - // }
719   - //
720   - // console.log("中标线路牌索引=" + iSModifyLpIndex);
721   -
722   -
723   - }
724   -
725   - //------------------------- 核心业务方法 -----------------------//
726   -
727   - /**
728   - * 核心方法,从上标线主站班次开始,一圈一圈生成每圈的主站班次,
729   - * 每生成一个主站班次,尝试生成后面紧邻的副站班次(停站时间1到3分种调整)。
730   - * @param iGroupIndex 圈索引
731   - * @param iCount 共几圈
732   - */
733   - InternalScheduleObj.prototype.fnCreateBclistWithMasterBc = function(iGroupIndex, iCount) {
734   - var i;
735   - var j;
736   - // var oPreBc = this._oFirstMasterBc; // 上一个班次(从上标线主站班次开始)
737   - var oPreBc = this._internalLpArray[0].getBc(iGroupIndex, this._iFirstMasterBcIndex);
738   - var oNextBc; // 计算的下一个班次
739   - var oNextBcFcTime; // 下一个班次的发车时间
740   - var aBcInterval = []; // 班次间隔数组
741   - var oBcInterval; // 班次间隔对象
742   - var iNextBcInterval; // 下一个班次发车间隔
743   -
744   - var oPreSlaveBc; // 上一个副站班次(上标线主站后的一个副站班次)
745   - var oNextSlaveBc; // 下一个副站班次
746   -
747   - // 当初始化完一圈的主站班次后,最后一个班次是下一圈的上标线主站班次,需要判定存在然后添加间隔
748   - var _modifyTimeNextGroupIndex; // 上标线下一圈索引
749   - var _modifyTimeNextBcIndex; // 上标线下一圈班次索引
750   - var _modifyBc; // 上标线下一个圈的班次
751   -
752   - var iStart = iGroupIndex;
753   - var iEnd = iGroupIndex + iCount;
754   - if (iEnd > this._qCount) {
755   - iEnd = this._qCount;
756   - }
757   -
758   - for (i = iStart; i < iEnd; i++) {
759   - aBcInterval = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(
760   - this,
761   - this._oParam,
762   - i,
763   - this._iFirstMasterBcIndex,
764   - this._$calcuCycleTime(oPreBc.getFcTimeObj())[0],
765   - this._$calcuCycleTime(oPreBc.getFcTimeObj())[1]
766   - );
767   -
768   - if (aBcInterval.length == 0) {
769   - // 等于0说明上标线没班次了
770   - break;
771   - }
772   -
773   - for (j = 1; j < this._internalLpArray.length; j++) {
774   - oBcInterval = aBcInterval[j - 1];
775   - if (oBcInterval.hasBc) {
776   - iNextBcInterval = oBcInterval.iFcInterval;
777   - oNextBcFcTime = this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval);
778   - this._internalLpArray[j].fnSetVerticalIntervalTime(i, this._iFirstMasterBcIndex, iNextBcInterval);
779   - this._internalLpArray[j].fnSetHeadwayS2_P(i, this._iFirstMasterBcIndex, oBcInterval.fP);
780   -
781   - oNextBc = _utils.createBcObj(
782   - this._internalLpArray[j],
783   - "normal",
784   - this._oParam.isUpOneWayStop(),
785   - 1,
786   - oNextBcFcTime,
787   - this._oParam);
788   -
789   - this._internalLpArray[j].setBc(
790   - i, this._iFirstMasterBcIndex, oNextBc);
791   - oPreBc = oNextBc;
792   - }
793   - }
794   -
795   - // 修正上标线主站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续所有班次
796   - oBcInterval = aBcInterval[j - 1];
797   - if (oBcInterval.hasBc) {
798   - iNextBcInterval = oBcInterval.iFcInterval;
799   - _modifyTimeNextGroupIndex = i + 1;
800   - _modifyTimeNextBcIndex = this._iFirstMasterBcIndex;
801   -
802   - _utils.modifySBXMasterBc(
803   - this._internalLpArray[0],
804   - this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval),
805   - _modifyTimeNextGroupIndex,
806   - _modifyTimeNextBcIndex,
807   - oPreBc.isUp(),
808   - this._oParam
809   - );
810   -
811   - // 修正上标线主站方向的班次后,一圈结束的班次可能不存在(超过末班车时间了),需要判定
812   - _modifyBc = this._internalLpArray[0].getBc(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex);
813   - if (_modifyBc) { // 存在修正间隔值
814   - this._internalLpArray[0].fnSetVerticalIntervalTime(
815   - _modifyTimeNextGroupIndex, _modifyTimeNextBcIndex, iNextBcInterval);
816   - oPreBc = _modifyBc;
817   - }
818   -
819   - }
820   -
821   - // 添加副站班次,就是主站班次到达时间加1分钟
822   - // TODO:因为副站停站时间1分钟到3分钟,几乎没有停站时间,一般前面主站是多少间隔,后面如果有副站的话也是多少间隔
823   - // TODO:此时,可能出现临界问题,当主站还是高峰接近低谷时,副站已经是低谷,此时副站发车间隔还是高峰间隔
824   - // TODO:上述情况可以通过让临界的主站高峰班次使用高峰最大间隔,副站使用3分钟的最大停站使副站间隔达到低谷最小间隔
825   - oPreSlaveBc = this._internalLpArray[0].getBc(
826   - this._iFirstMasterBcIndex == 0 ? i : i + 1,
827   - this._iFirstMasterBcIndex == 0 ? 1 : 0
828   - );
829   - for (j = 1; j < this._internalLpArray.length; j++) {
830   - if (oPreSlaveBc) {
831   - if (aBcInterval[j - 1].hasBc) { // 有主站必有副站
832   - // 获取当前路牌前一个主站班次
833   - if (this._internalLpArray[j].getBc(
834   - i,
835   - this._iFirstMasterBcIndex)) { // 相同路牌上一个主站班次存在
836   - oNextSlaveBc = _utils.createBcObj(
837   - this._internalLpArray[j],
838   - "normal",
839   - !this._oParam.isUpOneWayStop(),
840   - 1,
841   - this._oParam.addMinute( // 使用1分钟副站停站
842   - this._internalLpArray[j].getBc(
843   - i, this._iFirstMasterBcIndex).getArrTimeObj(),
844   - 1),
845   - this._oParam);
846   -
847   - if (oNextSlaveBc.isUp()) {
848   - if (!oNextSlaveBc.getFcTimeObj().isAfter(this._oParam.getUpLastDtimeObj())) {
849   - this._internalLpArray[j].setBc(
850   - this._iFirstMasterBcIndex == 0 ? i : i + 1,
851   - this._iFirstMasterBcIndex == 0 ? 1 : 0,
852   - oNextSlaveBc);
853   - oPreSlaveBc = oNextSlaveBc;
854   - }
855   - } else {
856   - if (!oPreSlaveBc.getFcTimeObj().isAfter(this._oParam.getDownLastDTimeObj())) {
857   - this._internalLpArray[j].setBc(
858   - this._iFirstMasterBcIndex == 0 ? i : i + 1,
859   - this._iFirstMasterBcIndex == 0 ? 1 : 0,
860   - oNextSlaveBc);
861   - oPreSlaveBc = oNextSlaveBc;
862   - }
863   - }
864   - }
865   - }
866   - }
867   - }
868   -
869   -
870   - }
871   -
872   - };
873   -
874   - //------------- 其他业务方法 -------------//
875   -
876   - /**
877   - * 调整发车间隔。
878   - */
879   - InternalScheduleObj.prototype.fnAdjustHeadway = function() {
880   - // // TODO:572测试,尝试调整第6圈
881   - // StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
882   - // this, this._oParam,
883   - // 6, 0,
884   - // 6, 1,
885   - // 0.2
886   - // );
887   - // // TODO:843测试
888   - // StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
889   - // this, this._oParam,
890   - // 3, 0,
891   - // 3, 1,
892   - // 0.2
893   - // );
894   -
895   - var i;
896   - var bQIsAnotherWay; // 圈的第一个班次是否副站
897   - if (this._qIsUp) {
898   - if (this._oParam.getDirAnotherWayStop()) {
899   - bQIsAnotherWay = true;
900   - } else {
901   - bQIsAnotherWay = false;
902   - }
903   - } else {
904   - if (this._oParam.getDirAnotherWayStop()) {
905   - bQIsAnotherWay = false;
906   - } else {
907   - bQIsAnotherWay = true;
908   - }
909   - }
910   -
911   - if (this._qIsUp == bQIsAnotherWay) {
912   - for (i = 0; i < this._qCount; i++) {
913   - StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
914   - this, this._oParam,
915   - i, 0,
916   - i, 1,
917   - 0.2
918   - );
919   - }
920   - } else { // 圈的第一个班次是主站班次
921   - for (i = 0; i < this._qCount; i++) {
922   - if ((i + 1) < this._qCount) {
923   - StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
924   - this, this._oParam,
925   - i, 1,
926   - (i + 1), 0,
927   - 0.2
928   - );
929   - }
930   - }
931   - }
932   -
933   -
934   - };
935   -
936   - /**
937   - * 计算吃饭班次。
938   - */
939   - InternalScheduleObj.prototype.fnCalcuEatBc = function() {
940   - var i;
941   - var j;
942   - var oLp;
943   - var oBc;
944   - // 1、标记吃饭班次
945   - var oEatFlag = {}; // {"路牌编号":{isLaunch: false, isDinner: false},...}
946   - for (i = 0; i < this._internalLpArray.length; i++) {
947   - oLp = this._internalLpArray[i];
948   - if (oLp.isBxLb()) { // 暂时判定只有连班吃饭
949   - oEatFlag[oLp.getLpNo()] = {};
950   - oEatFlag[oLp.getLpNo()]["isLaunch"] = false;
951   - oEatFlag[oLp.getLpNo()]["isDinner"] = false;
952   - for (j = 0; j < oLp.getBcArray().length; j++) {
953   - oBc = oLp.getBcArray()[j];
954   - // 午饭,暂时判定10:30到13:00
955   - if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
956   - oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("10:30")) &&
957   - oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("13:30"))) {
958   - if (!oEatFlag[oLp.getLpNo()]["isLaunch"]) {
959   - oBc.fnSetEatTime(this._oParam.fnGetLunchTime());
960   - oEatFlag[oLp.getLpNo()]["isLaunch"] = true;
961   - // console.log("吃饭班次时间=" + oBc.format("HH:mm"));
962   - }
963   - }
964   - // 晚饭,暂时判定17:30
965   - if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
966   - oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("17:00")) &&
967   - oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("20:00"))) {
968   - if (!oEatFlag[oLp.getLpNo()]["isDinner"]) {
969   - oBc.fnSetEatTime(this._oParam.fnGetDinnerTime());
970   - oEatFlag[oLp.getLpNo()]["isDinner"] = true;
971   - // console.log("晚饭班次时间=" + oBc.format("HH:mm"));
972   - }
973   - }
974   - }
975   - }
976   - }
977   -
978   - // 2、调整吃饭所需的停站时间
979   - StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_3_EAT")(
980   - this, this._oParam
981   - );
982   - };
983   -
984   - /**
985   - * 计算末班车。
986   - * 1、将上下行拉成上下行两个班次列表(包括标记班次)
987   - * 2、分别找出离末班车发车时间最近的班次,并替换时间
988   - * 3、删除之后的班次
989   - */
990   - InternalScheduleObj.prototype.fnCalcuLastBc = function() {
991   - var i;
992   - var iTimeDiff;
993   - var iTempTime;
994   - var aBc;
995   - var oLastBcTime;
996   - var oLastBcIsUp;
997   - var iModifyIndex;
998   -
999   - // 查找末班车早的末班车时间和方向
1000   - if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
1001   - oLastBcTime = this._oParam.getUpLastDtimeObj();
1002   - oLastBcIsUp = true;
1003   - } else {
1004   - oLastBcTime = this._oParam.getDownLastDTimeObj();
1005   - oLastBcIsUp = false;
1006   - }
1007   -
1008   - // 确定早的末班车时间
1009   - aBc = this.fnGetBcList(oLastBcIsUp);
1010   - for (i = 0; i < aBc.length; i++) {
1011   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
1012   - if (iTimeDiff == undefined) {
1013   - iTimeDiff = iTempTime;
1014   - iModifyIndex = i;
1015   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
1016   - iTimeDiff = iTempTime;
1017   - iModifyIndex = i;
1018   - }
1019   - }
1020   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
1021   - aBc[iModifyIndex].fnSetDelFlag(false);
1022   - aBc[iModifyIndex].fnSetIsLastBc(true);
1023   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
1024   - this._qIsUp == oLastBcIsUp ?
1025   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
1026   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
1027   - }
1028   -
1029   - // 查找末班车晚的末班车时间和方向
1030   - if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
1031   - oLastBcTime = this._oParam.getDownLastDTimeObj();
1032   - oLastBcIsUp = false;
1033   - } else {
1034   - oLastBcTime = this._oParam.getUpLastDtimeObj();
1035   - oLastBcIsUp = true;
1036   - }
1037   - // 确定晚的末班车时间
1038   - aBc = this.fnGetBcList(oLastBcIsUp);
1039   - var oBc;
1040   - var aBcIndex;
1041   - var iLpIndex;
1042   - var iQIndex;
1043   - var iBcIndex;
1044   -
1045   - iTimeDiff = undefined;
1046   - for (i = 0; i < aBc.length; i++) {
1047   - oBc = aBc[i];
1048   - aBcIndex = this.fnGetBcIndex(oBc);
1049   -
1050   - iLpIndex = aBcIndex[0];
1051   - iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
1052   - iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
1053   -
1054   - if (!this._internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
1055   - continue;
1056   - }
1057   -
1058   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
1059   - if (iTimeDiff == undefined) {
1060   - iTimeDiff = iTempTime;
1061   - iModifyIndex = i;
1062   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
1063   - iTimeDiff = iTempTime;
1064   - iModifyIndex = i;
1065   - }
1066   - }
1067   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
1068   - aBc[iModifyIndex].fnSetDelFlag(false);
1069   - aBc[iModifyIndex].fnSetIsLastBc(true);
1070   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
1071   - this._qIsUp == oLastBcIsUp ?
1072   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
1073   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
1074   - }
1075   - };
1076   -
1077   - /**
1078   - * 重新设置停站时间(发车时间减到达时间)。
1079   - */
1080   - InternalScheduleObj.prototype.fnReSetLayoverTime = function() {
1081   - for (var i = 0; i < this._internalLpArray.length; i++) {
1082   - this._internalLpArray[i].modifyLayoverTimeWithoutFcTime();
1083   - }
1084   - };
1085   -
1086   - /**
1087   - * 补进出场例保班次。
1088   - */
1089   - InternalScheduleObj.prototype.fnCalcuOtherBc = function() {
1090   - var i;
1091   - var j;
1092   - var iBcChainCount;
1093   - var oLp;
1094   - var aOtherBc;
1095   - var oStartBc;
1096   - var oEndBc;
1097   -
1098   - for (i = 0; i < this._internalLpArray.length; i++) {
1099   - aOtherBc = [];
1100   - oLp = this._internalLpArray[i];
1101   - iBcChainCount = oLp.fnGetBcChainCount();
1102   -
1103   - if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
1104   - // 头部要添加出场,例保班次
1105   - oStartBc = oLp.getBc(
1106   - oLp.fnGetBcChainInfo(0)["s_q"],
1107   - oLp.fnGetBcChainInfo(0)["s_b"]
1108   - );
1109   - aOtherBc.push(_utils.createBcObj(
1110   - oLp, "bd", oStartBc.isUp(), 1,
1111   - oStartBc.getFcTimeObj(),
1112   - this._oParam
1113   - ));
1114   - aOtherBc.push(_utils.createBcObj(
1115   - oLp, "out", oStartBc.isUp(), 1,
1116   - oStartBc.getFcTimeObj(),
1117   - this._oParam
1118   - ));
1119   -
1120   - // 尾部需添加进场,例保班次
1121   - oEndBc = oLp.getBc(
1122   - oLp.fnGetBcChainInfo(0)["e_q"],
1123   - oLp.fnGetBcChainInfo(0)["e_b"]
1124   - );
1125   - oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置
1126   - oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置
1127   - aOtherBc.push(_utils.createBcObj(
1128   - oLp, "in", !oEndBc.isUp(), 1,
1129   - oEndBc.getArrTimeObj(),
1130   - this._oParam
1131   - ));
1132   - aOtherBc.push(_utils.createBcObj(
1133   - oLp, "lc", !oEndBc.isUp(), 1,
1134   - oEndBc.getArrTimeObj(),
1135   - this._oParam
1136   - ));
1137   - } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
1138   - // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
1139   - oStartBc = oLp.getBc(
1140   - oLp.fnGetBcChainInfo(0)["s_q"],
1141   - oLp.fnGetBcChainInfo(0)["s_b"]
1142   - );
1143   - aOtherBc.push(_utils.createBcObj(
1144   - oLp, "bd", oStartBc.isUp(), 1,
1145   - oStartBc.getFcTimeObj(),
1146   - this._oParam
1147   - ));
1148   - aOtherBc.push(_utils.createBcObj(
1149   - oLp, "out", oStartBc.isUp(), 1,
1150   - oStartBc.getFcTimeObj(),
1151   - this._oParam
1152   - ));
1153   -
1154   - oEndBc = oLp.getBc(
1155   - oLp.fnGetBcChainInfo(0)["e_q"],
1156   - oLp.fnGetBcChainInfo(0)["e_b"]
1157   - );
1158   - aOtherBc.push(_utils.createBcObj(
1159   - oLp, "in", !oEndBc.isUp(), 1,
1160   - oEndBc.getArrTimeObj(),
1161   - this._oParam
1162   - ));
1163   -
1164   - // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次
1165   - oStartBc = oLp.getBc(
1166   - oLp.fnGetBcChainInfo(1)["s_q"],
1167   - oLp.fnGetBcChainInfo(1)["s_b"]
1168   - );
1169   - aOtherBc.push(_utils.createBcObj(
1170   - oLp, "bd", oStartBc.isUp(), 1,
1171   - oStartBc.getFcTimeObj(),
1172   - this._oParam
1173   - ));
1174   - aOtherBc.push(_utils.createBcObj(
1175   - oLp, "out", oStartBc.isUp(), 1,
1176   - oStartBc.getFcTimeObj(),
1177   - this._oParam
1178   - ));
1179   -
1180   - oEndBc = oLp.getBc(
1181   - oLp.fnGetBcChainInfo(1)["e_q"],
1182   - oLp.fnGetBcChainInfo(1)["e_b"]
1183   - );
1184   - aOtherBc.push(_utils.createBcObj(
1185   - oLp, "in", !oEndBc.isUp(), 1,
1186   - oEndBc.getArrTimeObj(),
1187   - this._oParam
1188   - ));
1189   - aOtherBc.push(_utils.createBcObj(
1190   - oLp, "lc", !oEndBc.isUp(), 1,
1191   - oEndBc.getArrTimeObj(),
1192   - this._oParam
1193   - ));
1194   -
1195   -
1196   - } else {
1197   - // 2个车次链以上,暂时没有此班型
1198   - }
1199   -
1200   - oLp.addOtherBcArray(aOtherBc);
1201   - }
1202   - };
1203   -
1204   -
1205   - //------------- 其他非业务方法方法 -------------//
1206   - /**
1207   - * 获取班次列表。
1208   - * @param isUp boolean 是否上行
1209   - * @returns [(InternalBcObj)]
1210   - */
1211   - InternalScheduleObj.prototype.fnGetBcList = function(isUp) {
1212   - var i;
1213   - var j;
1214   - var oLp;
1215   - var oBc;
1216   - var aBc = [];
1217   -
1218   - for (j = 0; j < this._qCount; j++) {
1219   - for (i = 0; i < this._internalLpArray.length; i++) {
1220   - oLp = this._internalLpArray[i];
1221   - oBc = oLp.getBc(
1222   - j,
1223   - this._qIsUp == isUp ? 0 : 1
1224   - );
1225   - if (oBc) {
1226   - aBc.push(oBc);
1227   - }
1228   - }
1229   - }
1230   -
1231   - var aBcFcTime = [];
1232   - for (i = 0; i < aBc.length; i++) {
1233   - oBc = aBc[i];
1234   - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
1235   - }
1236   - console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
1237   -
1238   - return aBc;
1239   - };
1240   -
1241   - /**
1242   - * 获取班次索引。
1243   - * @param oBc 班次对象
1244   - * @returns [{路牌索引},{圈索引},{班次索引}]
1245   - */
1246   - InternalScheduleObj.prototype.fnGetBcIndex = function(oBc) {
1247   - // 路牌索引
1248   - var i;
1249   - var iLpIndex;
1250   - for (i = 0; i < this._internalLpArray.length; i++) {
1251   - if (this._internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
1252   - iLpIndex = i;
1253   - break;
1254   - }
1255   - }
1256   - // 圈索引
1257   - var j;
1258   - var iGroupIndex;
1259   - var bFlag = false;
1260   - for (i = 0; i < this._internalLpArray.length; i++) {
1261   - if (bFlag) {
1262   - break;
1263   - }
1264   - for (j = 0; j < this._qCount; j++) {
1265   - if (this._internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
1266   - iGroupIndex = j;
1267   - bFlag = true;
1268   - break;
1269   - }
1270   - }
1271   - }
1272   - // 班次索引
1273   - var iBcIndex = this._qIsUp == oBc.isUp() ? 0 : 1;
1274   -
1275   - if (iLpIndex == undefined) {
1276   - return null;
1277   - } else {
1278   - return [].concat(iLpIndex, iGroupIndex, iBcIndex);
1279   - }
1280   - };
1281   -
1282   - /**
1283   - * 返回内部路牌数据列表。
1284   - * @returns {Array}
1285   - */
1286   - InternalScheduleObj.prototype.fnGetLpArray = function() {
1287   - return this._internalLpArray;
1288   - };
1289   -
1290   - /**
1291   - * 获取班型描述。
1292   - * @return {*[]}
1293   - */
1294   - InternalScheduleObj.prototype.fnGetBxDesc = function() {
1295   - return this._aBxDesc;
1296   - };
1297   -
1298   - /**
1299   - * 获取圈的第一个班次是上行还是下行。
1300   - * @return {boolean|*}
1301   - */
1302   - InternalScheduleObj.prototype.fnGetGroupIsUp = function() {
1303   - return this._qIsUp;
1304   - };
1305   -
1306   - /**
1307   - * 返回内部工具对象。
1308   - * @return {{createBcObj, modifySBXMasterBc}}
1309   - */
1310   - InternalScheduleObj.prototype.fnGetUitls = function() {
1311   - return _utils;
1312   - };
1313   -
1314   - /**
1315   - * 内部数据转化成显示用的班次数组。
1316   - */
1317   - InternalScheduleObj.prototype.fnToGanttBcArray = function() {
1318   - var aAllBc = [];
1319   - var aLpBc = [];
1320   - var aEatBc = [];
1321   - var oLp;
1322   - var i;
1323   - var j;
1324   -
1325   - for (i = 0; i < this._internalLpArray.length; i++) {
1326   - oLp = this._internalLpArray[i];
1327   - aLpBc = [];
1328   - aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
1329   -
1330   - aEatBc = [];
1331   - // TODO:根据班次的吃饭时间添加吃饭班次
1332   - for (j = 0; j < aLpBc.length; j++) {
1333   - if (aLpBc[j].fnGetEatTime() > 0) {
1334   - aEatBc.push(_utils.createBcObj(
1335   - oLp,
1336   - "cf",
1337   - aLpBc[j].isUp(), // 和上一个班次方向相反
1338   - 1,
1339   - this._oParam.addMinute(aLpBc[j].getFcTimeObj(), -aLpBc[j].fnGetEatTime()),
1340   - this._oParam
1341   - ));
1342   - }
1343   - }
1344   - aLpBc = aLpBc.concat(aEatBc);
1345   -
1346   - // 按照发车时间排序
1347   - aLpBc.sort(function(o1, o2) {
1348   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1349   - return -1;
1350   - } else {
1351   - return 1;
1352   - }
1353   - });
1354   -
1355   - // 重新赋值fcno
1356   - for (j = 0; j < aLpBc.length; j++) {
1357   - aLpBc[j].fnSetFcno(j + 1);
1358   - }
1359   -
1360   - aAllBc = aAllBc.concat(aLpBc);
1361   - }
1362   -
1363   - var aGanttBc = [];
1364   - for (i = 0; i < aAllBc.length; i++) {
1365   - aGanttBc.push(aAllBc[i].toGanttBcObj());
1366   - }
1367   -
1368   - return aGanttBc;
1369   - };
1370   -
1371   - /**
1372   - * 计算指定开始时间,指定方向班次执行后的最大最小停站时间。
1373   - * @param oStartFcTime 开始发车时间
1374   - * @param isUp 是否上行
1375   - * @returns array [最小值,最大值]
1376   - */
1377   - InternalScheduleObj.prototype._$calcuLayoverTime = function(oStartFcTime, isUp) {
1378   - var aRtn = [];
1379   - var _iRunningTime; // 行驶时间
1380   - var _iLayoverTime; // 停站时间
1381   -
1382   - // 最小停站时间
1383   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1384   - isUp, oStartFcTime, this._oParam);
1385   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1386   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1387   - this._oParam)[0]; // 最小停站
1388   - aRtn.push(_iLayoverTime);
1389   -
1390   - // 最大停站时间
1391   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1392   - isUp, oStartFcTime, this._oParam);
1393   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1394   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1395   - this._oParam)[1]; // 最大停站
1396   - aRtn.push(_iLayoverTime);
1397   -
1398   - return aRtn;
1399   - };
1400   -
1401   - /**
1402   - * 计算指定时间,指定方向开始的最大最小周转时间
1403   - * @param oStartFcTime 开始发车时间
1404   - * @param isUp 是否上行
1405   - * @returns array [最小值,最大值]
1406   - * @private
1407   - */
1408   - InternalScheduleObj.prototype._$calcuCycleTime = function(oStartFcTime, isUp) {
1409   - var aRtn = [];
1410   - var _iRunningTime; // 行驶时间
1411   - var _iLayoverTime; // 停站时间
1412   - var _iCycleTime; // 周转时间
1413   - var _oNextFcTime;
1414   -
1415   - // 最小周转时间
1416   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1417   - isUp, oStartFcTime, this._oParam);
1418   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1419   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1420   - this._oParam)[0]; // 最小停站
1421   - _iCycleTime = _iRunningTime + _iLayoverTime;
1422   - _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
1423   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1424   - !isUp, _oNextFcTime, this._oParam);
1425   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1426   - _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1427   - this._oParam)[0]; // 最小停站
1428   - _iCycleTime += _iRunningTime;
1429   - _iCycleTime += _iLayoverTime;
1430   -
1431   - aRtn.push(_iCycleTime);
1432   -
1433   - // 最大周转时间
1434   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1435   - isUp, oStartFcTime, this._oParam);
1436   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1437   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1438   - this._oParam)[1]; // 最大停站
1439   - _iCycleTime = _iRunningTime + _iLayoverTime;
1440   - _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
1441   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1442   - !isUp, _oNextFcTime, this._oParam);
1443   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1444   - _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1445   - this._oParam)[1]; // 最大停站
1446   - _iCycleTime += _iRunningTime;
1447   - _iCycleTime += _iLayoverTime;
1448   -
1449   - aRtn.push(_iCycleTime);
1450   -
1451   - return aRtn;
1452   - };
1453   -
1454   - //-------------------- static静态方法 ----------------------//
1455   -
1456   - /**
1457   - * 计算车辆数(最大周转时间/最大发车间隔)。
1458   - * @param oParam 参数对象
1459   - */
1460   - InternalScheduleObj.calcuClzx = function(oParam) {
1461   - var _iUpRT; // 上行行驶时间
1462   - var _iUpLT; // 上行停站时间
1463   - var _iDownRT; // 下行行驶时间
1464   - var _iDownLT; // 下行停站时间
1465   -
1466   - // 计算早高峰最大周转时间
1467   - _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getMPeakStartTimeObj(), oParam);
1468   - _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1469   - oParam.getMPeakStartTimeObj(), true,
1470   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1471   - _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getMPeakStartTimeObj(), oParam);
1472   - _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1473   - oParam.getMPeakStartTimeObj(), false,
1474   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1475   - var _iAMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1476   - // 早高峰预估车辆数,使用早高峰最大发车间隔
1477   - var _iAMPeakVehicleCount = _iAMPeakRCTime / oParam.getMPeakMaxFcjx();
1478   -
1479   - // 计算晚高峰最大周转时间
1480   - _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getEPeakStartTimeObj(), oParam);
1481   - _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1482   - oParam.getEPeakStartTimeObj(), true,
1483   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1484   - _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getEPeakStartTimeObj(), oParam);
1485   - _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1486   - oParam.getEPeakStartTimeObj(), false,
1487   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1488   - var _iPMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1489   - // 晚高峰预估车辆数,使用晚高峰最大发车间隔
1490   - var _iPMPeakVehicleCount = _iPMPeakRCTime / oParam.getEPeakMaxFcjx();
1491   -
1492   - // 取最大值为最终车辆数
1493   - // 大于或等于的最小整数,人话就是有小数点就加1
1494   - if (_iAMPeakVehicleCount > _iPMPeakVehicleCount) {
1495   - return Math.ceil(_iAMPeakVehicleCount);
1496   - } else {
1497   - return Math.ceil(_iPMPeakVehicleCount);
1498   - }
1499   -
1500   - };
1501   -
1502   -
1503   - return InternalScheduleObj;
  1 +/**
  2 + * v2_2版本的行车计划对象。
  3 + *
  4 + * 本次修正和原来区别,一边生成班次,一边调整班次间隔
  5 + * 1、初始化行车计划基本布局,主要是有几辆车,路牌分布情况(连班,分班,5休2分班),上标线的初始班次列表
  6 + *
  7 + */
  8 +var InternalScheduleObj_v2_2 = (function() {
  9 +
  10 + // 内部utils类
  11 + var _utils = function() {
  12 + return {
  13 + /**
  14 + * 创建班次对象。
  15 + * @param lpObj InternalLpObj路牌对象
  16 + * @param bcType 班次类型(normal等等)
  17 + * @param isUp 是否上行
  18 + * @param fcno 发车顺序号
  19 + * @param fcTimeObj 发车时间对象
  20 + * @param paramObj 参数对象
  21 + * @returns {InternalBcObj}
  22 + */
  23 + createBcObj : function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
  24 + var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType); // 班次里程
  25 + var _fcsj = fcTimeObj; // 发车时间
  26 + // var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); // 班次历时
  27 + var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _fcsj, paramObj); // 使用策略计算班次行驶时间
  28 +
  29 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
  30 +
  31 + var _arrsj = paramObj.addMinute(_fcsj, _bcsj); // 到达时间
  32 + // 停站时间范围,[最小停站时间,最大停站时间]
  33 + // var _stopTimeRange = paramObj.calcuTripLayoverTimeRange(_arrsj, isUp, _bcsj);
  34 + var _stopTimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  35 + _fcsj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
  36 +
  37 + var _stoptime = _stopTimeRange[0]; // 使用最小停站时间
  38 + var _tccid = paramObj.getTTinfoId();
  39 + var _ttinfoid = paramObj.getTTinfoId();
  40 + var _xl = paramObj.getXlId();
  41 + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  42 + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  43 +
  44 + if (bcType == "bd") { // 早例保,传过来的发车时间是第一个班次的发车时间
  45 + if (isUp) { // 上行
  46 + _fcsj = paramObj.addMinute(
  47 + _fcsj,
  48 + -(paramObj.getUpOutTime() + paramObj.getLbTime()));
  49 + _bcsj = paramObj.getLbTime();
  50 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  51 + _stoptime = 0;
  52 + } else { // 下行
  53 + _fcsj = paramObj.addMinute(
  54 + _fcsj,
  55 + -(paramObj.getDownOutTime() + paramObj.getLbTime()));
  56 + _bcsj = paramObj.getLbTime();
  57 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  58 + _stoptime = 0;
  59 + }
  60 + } else if (bcType == "lc") { // 晚例保,传过来的发车时间是最后一个班次的到达时间
  61 + if (isUp) { // 上行
  62 + _fcsj = paramObj.addMinute(
  63 + _fcsj,
  64 + paramObj.getUpInTime());
  65 + _bcsj = paramObj.getLbTime();
  66 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  67 + _stoptime = 0;
  68 + } else { // 下行
  69 + _fcsj = paramObj.addMinute(
  70 + _fcsj,
  71 + paramObj.getDownInTime());
  72 + _bcsj = paramObj.getLbTime();
  73 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  74 + _stoptime = 0;
  75 + }
  76 + } else if (bcType == "out") { // 出场,传过来的发车时间是第一个班次的发车时间
  77 + if (isUp) { // 上行
  78 + _fcsj = paramObj.addMinute(
  79 + _fcsj,
  80 + -paramObj.getUpOutTime());
  81 + _bcsj = paramObj.getUpOutTime();
  82 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  83 + _stoptime = 0;
  84 + } else { // 下行
  85 + _fcsj = paramObj.addMinute(
  86 + _fcsj,
  87 + -paramObj.getDownOutTime());
  88 + _bcsj = paramObj.getDownOutTime();
  89 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  90 + _stoptime = 0;
  91 + }
  92 + } else if (bcType == "in") { // 进场,传过来的发车时间是最后一个班次的到达时间
  93 + if (isUp) { // 上行
  94 + _bcsj = paramObj.getUpInTime();
  95 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  96 + _stoptime = 0;
  97 + } else { // 下行
  98 + _bcsj = paramObj.getDownInTime();
  99 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  100 + _stoptime = 0;
  101 + }
  102 + } else if (bcType == "cf") { // 吃饭班次
  103 + // 以13:00为分界,之前的为午饭,之后的为晚饭
  104 + if (fcTimeObj.isBefore(paramObj.toTimeObj("13:00"))) {
  105 + _bcsj = paramObj.fnGetLunchTime();
  106 + } else {
  107 + _bcsj = paramObj.fnGetDinnerTime();
  108 + }
  109 + _arrsj = paramObj.addMinute(_fcsj, _bcsj);
  110 + _stoptime = 0;
  111 + }
  112 +
  113 + var bcParamObj = {};
  114 + bcParamObj.bcType = bcType; // 班次类型(normal,in_,out, bd, lc, cf等)
  115 + bcParamObj.isUp = isUp; // boolean是否上下行
  116 + bcParamObj.fcno = fcno; // 发车顺序号
  117 + bcParamObj.fcTimeObj = _fcsj; // 发车时间对象
  118 + bcParamObj.bclc = _bclc; // 班次里程
  119 + bcParamObj.bcsj = _bcsj; // 班次历时
  120 + bcParamObj.arrtime = _arrsj; // 到达时间对象
  121 + bcParamObj.stoptime = _stoptime; // 停站时间
  122 + bcParamObj.tccid = _tccid; // 停车场id
  123 + bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
  124 + bcParamObj.xl = _xl; // 线路id
  125 + bcParamObj.qdzid = _qdz; // 起点站id
  126 + bcParamObj.zdzid = _zdz; // 终点站id
  127 +
  128 + return new InternalBcObj(lpObj, bcParamObj);
  129 + },
  130 +
  131 + /**
  132 + * 修正上标线主站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续说有班次。
  133 + * @param oLp 上标线路牌
  134 + * @param fromFcsj 开始发车时间对象
  135 + * @param fromGroupIndex 开始圈索引
  136 + * @param fromBcIndex 开始班次索引
  137 + * @param isUp 开始班次是上行还是下行
  138 + * @param oParam 参数对象
  139 + */
  140 + modifySBXMasterBc: function(oLp, fromFcsj, fromGroupIndex, fromBcIndex, isUp, oParam) {
  141 + // 清空指定位置班次及后续班次
  142 + oLp.clearBc(fromGroupIndex, fromBcIndex);
  143 + // 初始化上标线,从指定圈索引开始
  144 + oLp.initDataFromTime(fromFcsj, isUp, fromGroupIndex, oParam, _utils);
  145 +
  146 + }
  147 +
  148 + };
  149 + }();
  150 +
  151 +
  152 +
  153 + /**
  154 + * 内部行车计划对象。
  155 + * @param oParam 参数封装对象
  156 + * @param aLp 路牌(甘特图用的路牌对象)
  157 + * @constructor
  158 + */
  159 + function InternalScheduleObj(oParam, aLp) {
  160 + // 参数对象和甘特图用路牌数组
  161 + this._oParam = oParam;
  162 + this._aGanttLpArray = aLp;
  163 +
  164 + // 目前这个只支持主站停站
  165 + if (this._oParam.isTwoWayStop()) {
  166 + alert("v2_2版本不支持双向停站类型线路!");
  167 + throw "v2_2版本不支持双向停站类型线路";
  168 + }
  169 +
  170 + console.log("//->>>>>>>>>>>>>>>>>>>>>>>>> v2_2行车计划,初始化1,圈信息,路牌 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-//");
  171 + //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
  172 + this._qIsUp = true; // 每一圈是上行开始还是下行开始
  173 +
  174 + // 确定_qIsUp,哪个方向的首班车晚就用哪个
  175 + // this._qIsUp = this._oParam.getUpFirstDTimeObj().isBefore(
  176 + // this._oParam.getDownFirstDTimeObj()) ? false : true;
  177 +
  178 + // 确定_qIsUp,哪个方向的首班车晚就用哪个
  179 + // 使用diff判定,如果两个时间相等 this._qIsUp = false
  180 + this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
  181 +
  182 +
  183 + // 上标线开始时间,就是方向的首班车时间
  184 + var st = this._qIsUp ? oParam.getUpFirstDTimeObj() : oParam.getDownFirstDTimeObj();
  185 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  186 + var et;
  187 + var et_IsUp;
  188 + if (oParam.getUpLastDtimeObj().isBefore(
  189 + oParam.getDownLastDTimeObj())) {
  190 + et = oParam.getDownLastDTimeObj();
  191 + et_IsUp = false;
  192 + } else {
  193 + et = oParam.getUpLastDtimeObj();
  194 + et_IsUp = true;
  195 + }
  196 + //------------------------ 2、计算总共有多少圈 ------------------------//
  197 + this._qCount = 0; // 总的圈数
  198 +
  199 + // 以开始时间,结束时间,构造上标线用连班班次发车时间
  200 + var bcFcsjArrays = []; // 班次发车时间对象数组
  201 + var bcArsjArrays = []; // 班次到达时间对象数组
  202 + var isUp = this._qIsUp; // 方向
  203 + var bcCount = 1; // 班次数
  204 +
  205 + var _kssj = st; // 开始时间
  206 + var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _kssj, oParam); // 使用策略计算班次行驶时间
  207 + var _arrsj = oParam.addMinute(_kssj, _bcsj); // 到达时间
  208 + var _stoptimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  209 + _kssj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam);
  210 + var _stoptime = _stoptimeRange[0]; // 最小停站时间
  211 +
  212 + do {
  213 + bcFcsjArrays.push(_kssj);
  214 + bcArsjArrays.push(_arrsj);
  215 +
  216 + _kssj = oParam.addMinute(_kssj, _bcsj + _stoptime);
  217 + // _bcsj = oParam.calcuTravelTime(_kssj, isUp);
  218 +
  219 + _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(isUp, _kssj, oParam); // 使用策略计算班次行驶时间
  220 + _arrsj = oParam.addMinute(_kssj, _bcsj);
  221 + _stoptimeRange = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  222 + _kssj, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam);
  223 + _stoptime = _stoptimeRange[0]; // 最小停站时间
  224 +
  225 + bcCount ++;
  226 + isUp = !isUp;
  227 + } while(_kssj.isBefore(et));
  228 + bcCount--; // 因为先做do,所以总的班次要减1
  229 +
  230 + var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
  231 + var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
  232 +
  233 + // 利用连班数组计算圈数
  234 + this._qCount = 1; // 前面加1圈,补中标线的班次
  235 + this._qCount += _qCount_p1;
  236 + this._qCount += _qCount_p2;
  237 +
  238 + // 计算最后是不是还要补一圈
  239 + if (this._qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
  240 + if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
  241 + // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
  242 + // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
  243 + if (!this._qIsUp == et_IsUp) {
  244 + // 一致不用加圈数
  245 + } else {
  246 + // 不一致需要加圈补最后一个结束时间班次
  247 + this._qCount ++;
  248 + }
  249 + } else {
  250 + // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
  251 + // 不需要在补圈数了
  252 + }
  253 + }
  254 + //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
  255 + this._internalLpArray = []; // 内部路牌(InternalLpObj对象)数组
  256 +
  257 + // 创建内部的路牌数组
  258 + var i;
  259 + for (i = 0; i < this._aGanttLpArray.length; i++) {
  260 + this._internalLpArray.push(
  261 + new InternalLpObj(this._aGanttLpArray[i], this._qCount, this._qIsUp));
  262 + }
  263 +
  264 + // 初始化上标线,从第1圈开始
  265 + this._internalLpArray[0].initDataFromTimeToTime(
  266 + bcFcsjArrays[0], et, this._qIsUp, 1, oParam, _utils);
  267 +
  268 +
  269 + console.log("上行首班车时间:" + oParam.getUpFirstDTimeObj().format("HH:mm") +
  270 + "上行末班车时间:" + oParam.getUpLastDtimeObj().format("HH:mm"));
  271 + console.log("下行首班车时间:" + oParam.getDownFirstDTimeObj().format("HH:mm") +
  272 + "下行末班车时间:" + oParam.getDownLastDTimeObj().format("HH:mm"));
  273 + console.log("总共计算的圈数:" + this._qCount);
  274 + console.log("圈的方向isUP:" + this._qIsUp);
  275 +
  276 + console.log("//->>>>>>>>>>>>>>>>>>>>>>>>> v2_2行车计划,初始化2,工时,路牌信息 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-//");
  277 + //------------------------ 1、以上标线为基础,计算各种班型工时对应的圈数、班次数 -----------------------//
  278 + var aBcArray = this._internalLpArray[0].getBcArray();
  279 + aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识
  280 +
  281 + if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算
  282 + aBcArray.splice(aBcArray.length - 1, 1);
  283 + }
  284 +
  285 + var iLTime = oParam.fnGetLunchTime(); // 午饭吃饭时间
  286 + var iDTime = oParam.fnGetDinnerTime(); // 晚饭吃饭时间
  287 + var iOutTime = this._qIsUp ? oParam.getUpOutTime() : oParam.getDownOutTime(); // 出场时间
  288 + var iInTime = this._qIsUp ? oParam.getDownInTime() : oParam.getUpInTime(); // 进场时间
  289 + var iBTime = oParam.getLbTime(); // 例保时间
  290 +
  291 + var sum = 0; // 总班次时间
  292 + for (i = 0; i < aBcArray.length; i++) {
  293 + sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime();
  294 + }
  295 + sum += iLTime; // 加午饭时间
  296 + sum += iDTime; // 加晚饭时间
  297 +
  298 + this._aBxDesc = [ // 各种班型描述(班型名称,平均工时,平均需要的班次数,平均工时)
  299 + {'sType':'六工一休', 'fHoursV':6.66, 'fBcCount': 0, 'fAverTime': 0},
  300 + {'sType':'五工一休', 'fHoursV':6.85, 'fBcCount': 0, 'fAverTime': 0},
  301 + {'sType':'四工一休', 'fHoursV':7.14, 'fBcCount': 0, 'fAverTime': 0},
  302 + {'sType':'三工一休', 'fHoursV':7.61, 'fBcCount': 0, 'fAverTime': 0},
  303 + {'sType':'二工一休', 'fHoursV':8.57, 'fBcCount': 0, 'fAverTime': 0},
  304 + {'sType':'一工一休', 'fHoursV':11.42, 'fBcCount': 0, 'fAverTime': 0},
  305 + {'sType':'五工二休', 'fHoursV':7.99, 'fBcCount': 0, 'fAverTime': 0},
  306 + {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0}
  307 + ];
  308 +
  309 + for (i = 0; i < this._aBxDesc.length; i++) {
  310 + this._aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间
  311 +
  312 + // 计算5休2的班次数(双进出场,4个例保)
  313 + if (i == 6) {
  314 + this._aBxDesc[i].fQCount =
  315 + (this._aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) /
  316 + this._aBxDesc[i].fAverTime;
  317 + this._aBxDesc[i].fBcCount = this._aBxDesc[i].fQCount * 2;
  318 + } else { // 进出场,2个例保
  319 + this._aBxDesc[i].fQCount =
  320 + (this._aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) /
  321 + this._aBxDesc[i].fAverTime;
  322 + this._aBxDesc[i].fBcCount = this._aBxDesc[i].fQCount * 2;
  323 + }
  324 + }
  325 + console.log("班型描述(以下):");
  326 + console.log(this._aBxDesc);
  327 + //--------------------- 2、计算分班连班班型车辆分布数 --------------------//
  328 + this._iBx_lb_lpcount = 0; // 连班路牌数
  329 + this._iBx_5_2_fb_lpcount = 0; // 5休2分班路牌数
  330 + this._iBx_other_fb_lpcount = 0; // 其他分班路牌数
  331 +
  332 + // 总共车辆数(高峰最大车辆数)
  333 + var iCls = InternalScheduleObj_v2_2.calcuClzx(oParam);
  334 + // 计算低谷最大周转时间
  335 + var _iTroughCycleTime =
  336 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.toTimeObj("13:00"), oParam) +
  337 + StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  338 + oParam.toTimeObj("13:00"), true,
  339 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1] +
  340 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.toTimeObj("13:00"), oParam) +
  341 + StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  342 + oParam.toTimeObj("13:00"), false,
  343 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1];
  344 +
  345 + // 低谷最少配车(预估最少连班车数量)
  346 + var iDgminpc = Math.ceil(_iTroughCycleTime / oParam.getTroughMaxFcjx());
  347 + // 加班车路牌数(做5休2的路牌数)
  348 + var i_5_2_lpes = oParam.getJBLpes();
  349 +
  350 + // v2_2版本的路牌分布就是连班分班加班车分布,总车辆数减去加班车,剩下的车对半开连班和其他分班,但是连班必须大于最少连班
  351 + if (iCls < iDgminpc) {
  352 + alert("总配车数小于低谷最小配车");
  353 + throw "总配车数小于低谷最小配车";
  354 + } else {
  355 + // 5_2路牌数
  356 + this._iBx_5_2_fb_lpcount = i_5_2_lpes;
  357 +
  358 + // 剩余车辆数
  359 + var _iOtherCls = iCls - this._iBx_5_2_fb_lpcount;
  360 + var _iHalfCls1; // 连班路牌数
  361 + var _iHalfCls2; // 其他分班路牌数
  362 + if (_iOtherCls % 2 == 0) { // 能整除
  363 + _iHalfCls1 = _iOtherCls / 2;
  364 + _iHalfCls2 = _iOtherCls / 2;
  365 + } else {
  366 + _iHalfCls1 = Math.floor(_iOtherCls / 2) + 1;
  367 + _iHalfCls2 = Math.floor(_iOtherCls / 2);
  368 + }
  369 + if (_iHalfCls1 > iDgminpc) {
  370 + this._iBx_lb_lpcount = _iHalfCls1;
  371 + this._iBx_other_fb_lpcount = _iHalfCls2;
  372 + } else {
  373 + this._iBx_lb_lpcount = iDgminpc;
  374 + this._iBx_other_fb_lpcount = iCls - this._iBx_lb_lpcount - i_5_2_lpes;
  375 + }
  376 + }
  377 +
  378 + //------------------------ 3、利用间隔法计算连班路牌分布 --------------------//
  379 + var i;
  380 + var j;
  381 + var iC1 = Math.floor(this._internalLpArray.length / this._iBx_lb_lpcount);
  382 + var iC2 = this._internalLpArray.length % this._iBx_lb_lpcount;
  383 + var iLpIndex;
  384 +
  385 + for (i = 0; i < this._iBx_lb_lpcount - iC2; i++) {
  386 + iLpIndex = i * iC1;
  387 + this._internalLpArray[iLpIndex].setBxLb(true);
  388 + this._internalLpArray[iLpIndex].setBxDesc("连班");
  389 + }
  390 + for (j = 0; j < iC2; j++) {
  391 + iLpIndex = i * iC1 + j * (iC1 + 1);
  392 + this._internalLpArray[iLpIndex].setBxLb(true);
  393 + this._internalLpArray[iLpIndex].setBxDesc("连班");
  394 + }
  395 + //------------------------ 4、利用间隔法计算分班班型路牌分布 --------------------//
  396 + // 获取分班路牌索引
  397 + var aNotLbIndexes = [];
  398 + for (i = 0; i < this._internalLpArray.length; i++) {
  399 + if (!this._internalLpArray[i].isBxLb()) {
  400 + aNotLbIndexes.push(i);
  401 + }
  402 + }
  403 + // 先5休2分班
  404 + iC1 = Math.floor(aNotLbIndexes.length / this._iBx_5_2_fb_lpcount);
  405 + iC2 = aNotLbIndexes.length % this._iBx_5_2_fb_lpcount;
  406 +
  407 + for (i = 0; i < this._iBx_5_2_fb_lpcount - iC2; i++) {
  408 + iLpIndex = aNotLbIndexes[i * iC1];
  409 + this._internalLpArray[iLpIndex].setBxLb(false);
  410 + this._internalLpArray[iLpIndex].setBxFb(true);
  411 + this._internalLpArray[iLpIndex].setBxFb5_2(true);
  412 + this._internalLpArray[iLpIndex].setBxDesc("5休2分班");
  413 + }
  414 + for (i = 0; i < iC2; i++) {
  415 + iLpIndex = aNotLbIndexes[this._iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)];
  416 + this._internalLpArray[iLpIndex].setBxLb(false);
  417 + this._internalLpArray[iLpIndex].setBxFb(true);
  418 + this._internalLpArray[iLpIndex].setBxFb5_2(true);
  419 + this._internalLpArray[iLpIndex].setBxDesc("5休2分班");
  420 + }
  421 + // 其他分班
  422 + for (i = 0; i < aNotLbIndexes.length; i++) {
  423 + iLpIndex = aNotLbIndexes[i];
  424 + if (!this._internalLpArray[iLpIndex].isBxFb5_2()) {
  425 + this._internalLpArray[iLpIndex].setBxLb(false);
  426 + this._internalLpArray[iLpIndex].setBxFb(true);
  427 + this._internalLpArray[iLpIndex].setBxFb5_2(false);
  428 + this._internalLpArray[iLpIndex].setBxDesc("其他分班");
  429 + }
  430 + }
  431 +
  432 + console.log("高峰周转时间:" + oParam.calcuPeakZzsj());
  433 + console.log("连班路牌数:" + this._iBx_lb_lpcount);
  434 + console.log("5休2分班路牌数:" + this._iBx_5_2_fb_lpcount);
  435 + console.log("其他分班路牌数:" + this._iBx_other_fb_lpcount);
  436 + var aLbIndexes = [];
  437 + for (i = 0; i < this._internalLpArray.length; i++) {
  438 + if (this._internalLpArray[i].isBxLb()) {
  439 + aLbIndexes.push(i);
  440 + }
  441 + }
  442 + console.log("连班路牌indexes=" + aLbIndexes);
  443 + var a_5_2_fbIndexes = [];
  444 + for (i = 0; i < this._internalLpArray.length; i++) {
  445 + if (this._internalLpArray[i].isBxFb() && this._internalLpArray[i].isBxFb5_2()) {
  446 + a_5_2_fbIndexes.push(i);
  447 + }
  448 + }
  449 + console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes);
  450 + var a_other_fbIndexes = [];
  451 + for (i = 0; i < this._internalLpArray.length; i++) {
  452 + if (this._internalLpArray[i].isBxFb() && !this._internalLpArray[i].isBxFb5_2()) {
  453 + a_other_fbIndexes.push(i);
  454 + }
  455 + }
  456 + console.log("其他分班路牌indexes=" + a_other_fbIndexes);
  457 +
  458 + console.log("//->>>>>>>>>>>>>>>>> v2_3行车计划,初始化3,计算上标线第一个主站副站班次信息 <<<<<<<<<<<<<<<<<<<<<-//");
  459 + // 计算上标线第一个主站班次,副站班次的位置
  460 + this._oFirstMasterBc = undefined; // 早高峰主站方向班次
  461 + this._iFirstMasterBcGroupIndex = undefined; // 早高峰主站方向圈索引
  462 + this._iFirstMasterBcIndex = undefined; // 早高峰主站方向班次索引
  463 +
  464 + this._oFirstSlaveBc = undefined; // 早高峰副站方向班次
  465 + this._iFirstSlaveBcGroupIndex = undefined; // 早高峰副站方向圈索引
  466 + this._iFirstSlaveBcIndex = undefined; // 早高峰副站方向班次索引
  467 +
  468 + if (this._qIsUp) {
  469 + if (this._oParam.isUpOneWayStop()) {
  470 + this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 0);
  471 + this._iFirstMasterBcGroupIndex = 1;
  472 + this._iFirstMasterBcIndex = 0;
  473 +
  474 + this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 1);
  475 + this._iFirstSlaveBcGroupIndex = 1;
  476 + this._iFirstSlaveBcIndex = 1;
  477 + } else {
  478 + this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 1);
  479 + this._iFirstMasterBcGroupIndex = 1;
  480 + this._iFirstMasterBcIndex = 1;
  481 +
  482 + this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 0);
  483 + this._iFirstSlaveBcGroupIndex = 1;
  484 + this._iFirstSlaveBcIndex = 0;
  485 + }
  486 + } else {
  487 + if (this._oParam.isUpOneWayStop()) {
  488 + this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 1);
  489 + this._iFirstMasterBcGroupIndex = 1;
  490 + this._iFirstMasterBcIndex = 1;
  491 +
  492 + this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 0);
  493 + this._iFirstSlaveBcGroupIndex = 1;
  494 + this._iFirstSlaveBcIndex = 0;
  495 + } else {
  496 + this._oFirstMasterBc = this._internalLpArray[0].getBc(1, 0);
  497 + this._iFirstMasterBcGroupIndex = 1;
  498 + this._iFirstMasterBcIndex = 0;
  499 +
  500 + this._oFirstSlaveBc = this._internalLpArray[0].getBc(1, 1);
  501 + this._iFirstSlaveBcGroupIndex = 1;
  502 + this._iFirstSlaveBcIndex = 1;
  503 + }
  504 + }
  505 +
  506 + console.log("早高峰副站方向(start)班次=" + (this._oFirstSlaveBc ? this._oFirstSlaveBc.getFcTimeObj().format("HH:mm") : "未找到"));
  507 + console.log("早高峰副站方向(start)班次圈索引=" + (this._oFirstSlaveBc ? this._iFirstSlaveBcGroupIndex : "未找到"));
  508 + console.log("早高峰副站方向(start)班次索引=" + (this._oFirstSlaveBc ? this._iFirstSlaveBcIndex : "未找到"));
  509 + console.log("早高峰主站方向(start)班次=" + (this._oFirstMasterBc ? this._oFirstMasterBc.getFcTimeObj().format("HH:mm") : "未找到"));
  510 + console.log("早高峰主站方向(start)班次圈索引=" + (this._oFirstMasterBc ? this._iFirstMasterBcGroupIndex : "未找到"));
  511 + console.log("早高峰主站方向(start)班次索引=" + (this._oFirstMasterBc ? this._iFirstMasterBcIndex : "未找到"));
  512 +
  513 + console.log("//->>>>>>>>>>>>>>>>> v2_4行车计划,初始化4,从上标线第一圈第一个副站班次开始初始化后续路牌班次列表 <<<<<<<<<<<<<<<<<<<<<-//");
  514 + // 初始化上标线副站班次
  515 + var oPreBc; // 上一个班次(从上标线副站班次开始)
  516 + var oNextBc; // 计算的下一个班次
  517 + var oNextBcFcTime; // 下一个班次的发车时间
  518 + var aBcInterval = []; // 班次间隔数组
  519 + var oBcInterval; // 班次间隔对象
  520 + var iNextBcInterval; // 下一个班次发车间隔
  521 +
  522 + // 当初始化完一圈的副站班次后,最后一个班次是下一圈的上标线副站班次(一圈的周转结束班次),需要调整时间及其前一个主站班次的时间
  523 + var _modifyTimeNextGroupIndex; // 上标线下一圈索引
  524 + var _modifyTimeNextBcIndex; // 上标线下一圈班次索引
  525 + var _modifyBc; // 上标线下一个圈的班次
  526 + var _modifyPreBc; // 上标线下一个圈班次的前一个班次
  527 + var _modifyTime; // 上标线下一个圈班次的前一个班次的调整时间
  528 +
  529 + if (this._iFirstSlaveBcIndex == 0) { // 第一圈第二个班次是主站,则第一个班次是副站
  530 + oPreBc = this._internalLpArray[0].getBc(this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex);
  531 +
  532 + aBcInterval = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(
  533 + this,
  534 + this._oParam,
  535 + 1,
  536 + this._iFirstSlaveBcIndex,
  537 + this._$calcuCycleTime(oPreBc.getFcTimeObj())[0],
  538 + this._$calcuCycleTime(oPreBc.getFcTimeObj())[1]
  539 + );
  540 +
  541 + for (i = 1; i < this._internalLpArray.length; i++) {
  542 + oBcInterval = aBcInterval[i - 1];
  543 +
  544 + if (oBcInterval.hasBc) {
  545 + // 参考的发车间隔
  546 + iNextBcInterval = oBcInterval.iFcInterval;
  547 + oNextBcFcTime = this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval);
  548 + this._internalLpArray[i].fnSetVerticalIntervalTime(
  549 + this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, iNextBcInterval);
  550 + this._internalLpArray[i].fnSetHeadwayS2_P(
  551 + this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, oBcInterval.fP);
  552 +
  553 + oNextBc = _utils.createBcObj(
  554 + this._internalLpArray[i],
  555 + "normal",
  556 + !this._oParam.isUpOneWayStop(),
  557 + 1,
  558 + oNextBcFcTime,
  559 + this._oParam);
  560 +
  561 + this._internalLpArray[i].setBc(
  562 + this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex, oNextBc);
  563 +
  564 + oPreBc = oNextBc;
  565 + }
  566 + }
  567 +
  568 + // 修正上标线副站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续所有班次
  569 + iNextBcInterval = aBcInterval[i - 1].iFcInterval;
  570 + _modifyTimeNextGroupIndex = this._iFirstSlaveBcGroupIndex + 1;
  571 + _modifyTimeNextBcIndex = this._iFirstSlaveBcIndex;
  572 +
  573 + _utils.modifySBXMasterBc(
  574 + this._internalLpArray[0],
  575 + this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval),
  576 + this._iFirstSlaveBcGroupIndex + 1,
  577 + this._iFirstSlaveBcIndex,
  578 + oPreBc.isUp(),
  579 + this._oParam
  580 + );
  581 +
  582 + // 调整上标线副站班次一圈后的前一个主站班次时间
  583 + _modifyBc = this._internalLpArray[0].getBc(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex);
  584 + if (_modifyBc) {
  585 + this._internalLpArray[0].fnSetVerticalIntervalTime(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex, iNextBcInterval);
  586 +
  587 + _modifyPreBc = this._internalLpArray[0].getPreBc(_modifyBc);
  588 + _modifyTime = _modifyBc.getFcTimeObj().diff(_modifyPreBc.getArrTimeObj(), "m") - 1; // 主站到副站停站使用1分钟
  589 + // 修改发车时间,到达时间,不改行驶时间
  590 + _modifyPreBc.getFcTimeObj().add(_modifyTime, "m");
  591 + _modifyPreBc.getArrTimeObj().add(_modifyTime, "m");
  592 +
  593 + }
  594 +
  595 + }
  596 +
  597 + console.log("//->>>>>>>>>>>>>>>>> v2_6行车计划,初始化6,创建第一圈的主站班次开始班次列表,然后修正 <<<<<<<<<<<<<<<<<<<<<-//");
  598 + this.fnCreateBclistWithMasterBc(1, 1); // 从上标线第一圈的主站班次开始初始化所有路牌的相关班次
  599 + // 第一圈的第一个班次是副站,则需要修正this.fnCreateBclistWithMasterBc(1)班次之间的问题,停站时间为负数
  600 + if (this._iFirstSlaveBcIndex == 0) {
  601 + StrategyUtils_v2_2.sFn("ADJUST_HEADWAY")(
  602 + this, this._oParam,
  603 + this._iFirstSlaveBcGroupIndex, this._iFirstSlaveBcIndex,
  604 + this._iFirstMasterBcGroupIndex, this._iFirstMasterBcIndex,
  605 + 5 // 修正至少要5分钟停站
  606 + );
  607 + }
  608 +
  609 + console.log("//->>>>>>>>>>>>>>>>> v2_7行车计划,初始化7,修正中标线班次列表 <<<<<<<<<<<<<<<<<<<<<-//");
  610 + // // TODO:补充中标线班次,这里假设,前一半圈就是中标线,以后再精细处理
  611 + // // 中标线开始时间,早的首班车时间,和上标线的开始时间方向相反
  612 + // var oSt = !this._qIsUp ? this._oParam.getUpFirstDTimeObj() : this._oParam.getDownFirstDTimeObj();
  613 + // var iStRuntime; // 中标线方向班次行驶时间(使用低谷)
  614 + // if (!this._qIsUp) { // 上行
  615 + // if (this._oParam.isTroughBc(oSt)) {
  616 + // iStRuntime = this._oParam.getUpTroughTime();
  617 + // } else {
  618 + // iStRuntime = this._oParam.getUpMPeakTime();
  619 + // }
  620 + // } else { // 下行
  621 + // if (this._oParam.isTroughBc(oSt)) {
  622 + // iStRuntime = this._oParam.getDownTroughTime();
  623 + // } else {
  624 + // iStRuntime = this._oParam.getDownMPeakTime();
  625 + // }
  626 + // }
  627 + //
  628 + // var oSLp;
  629 + // var oSBc;
  630 + // var oSEmuBcFcTime; // 模拟班次发车时间
  631 + // var iTimeDiff;
  632 + // var iTempTime;
  633 + // var iSModifyLpIndex; // 中标线对应路牌索引
  634 + // for (i = 1; i < this._internalLpArray.length; i++) {
  635 + // oSLp = this._internalLpArray[i];
  636 + // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
  637 + // if (!oSBc) { // 可能没有,跳过
  638 + // continue;
  639 + // }
  640 + // oSEmuBcFcTime = this._oParam.addMinute(
  641 + // oSBc.getFcTimeObj(),
  642 + // -(iStRuntime + 1)
  643 + // );
  644 + // iTempTime = oSEmuBcFcTime.diff(oSt, "m");
  645 + // if (iTimeDiff == undefined) {
  646 + // iTimeDiff = iTempTime;
  647 + // iSModifyLpIndex = i;
  648 + // } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff) && oSEmuBcFcTime.isAfter(oSt)) {
  649 + // iTimeDiff = iTempTime;
  650 + // iSModifyLpIndex = i;
  651 + // }
  652 + // }
  653 + //
  654 + // // 添加上标线头班次(分班连班都可能)
  655 + // this._internalLpArray[iSModifyLpIndex].setBc(
  656 + // 0, 1,
  657 + // _utils.createBcObj(
  658 + // this._internalLpArray[iSModifyLpIndex],
  659 + // "normal",
  660 + // !this._qIsUp,
  661 + // 1,
  662 + // oSt,
  663 + // this._oParam)
  664 + // );
  665 + //
  666 + // // 从当前班次开始,如果是低谷,隔开方向加班次,如果是高峰,都加班次
  667 + // var iSInverval = Math.ceil((this._oParam.getMPeakMinFcjx() + this._oParam.getMPeakMaxFcjx()) / 2);
  668 + // for (i = iSModifyLpIndex + 1; i < this._internalLpArray.length; i++) {
  669 + // oSLp = this._internalLpArray[i];
  670 + // oSEmuBcFcTime = this._oParam.addMinute(oSt, iSInverval * (i - iSModifyLpIndex));
  671 + // if (this._oParam.isMPeakBc(oSEmuBcFcTime)) { // 高峰
  672 + // if (!this._qIsUp) { // 上行
  673 + // iStRuntime = this._oParam.getUpMPeakTime();
  674 + // } else { // 下行
  675 + // iStRuntime = this._oParam.getDownMPeakTime();
  676 + // }
  677 + // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
  678 + // oSLp.setBc(
  679 + // 0, 1,
  680 + // _utils.createBcObj(
  681 + // oSLp,
  682 + // "normal",
  683 + // !this._qIsUp,
  684 + // 1,
  685 + // this._oParam.addMinute(oSBc.getFcTimeObj(), -(iStRuntime + 1)),
  686 + // this._oParam)
  687 + // );
  688 + // } else { // 低谷隔开出班次
  689 + // if (!this._qIsUp) { // 上行
  690 + // iStRuntime = this._oParam.getUpTroughTime();
  691 + // } else { // 下行
  692 + // iStRuntime = this._oParam.getDownTroughTime();
  693 + // }
  694 + //
  695 + // if (!this._internalLpArray[i - 1].getBc(0, 1)) {
  696 + // // 上一个路牌没有班次,添加
  697 + // oSBc = oSLp.getBc(1, 0); // 第一圈第一个班次
  698 + // if (oSBc) {
  699 + // oSLp.setBc(
  700 + // 0, 1,
  701 + // _utils.createBcObj(
  702 + // oSLp,
  703 + // "normal",
  704 + // !this._qIsUp,
  705 + // 1,
  706 + // this._oParam.addMinute(oSBc.getFcTimeObj(), -(iStRuntime + 1)),
  707 + // this._oParam)
  708 + // );
  709 + //
  710 + // // 如果生成的班次行驶时间不足,删除这个班次
  711 + // if (oSLp.getBc(1, 0).getFcTimeObj().isBefore(oSLp.getBc(0, 1).getArrTimeObj())) {
  712 + // oSLp.getGroup(0).setBc1(undefined);
  713 + // oSLp.getGroup(0).setBc2(undefined);
  714 + // }
  715 + // }
  716 + // }
  717 + // }
  718 + // }
  719 + //
  720 + // console.log("中标线路牌索引=" + iSModifyLpIndex);
  721 +
  722 +
  723 + }
  724 +
  725 + //------------------------- 核心业务方法 -----------------------//
  726 +
  727 + /**
  728 + * 核心方法,从上标线主站班次开始,一圈一圈生成每圈的主站班次,
  729 + * 每生成一个主站班次,尝试生成后面紧邻的副站班次(停站时间1到3分种调整)。
  730 + * @param iGroupIndex 圈索引
  731 + * @param iCount 共几圈
  732 + */
  733 + InternalScheduleObj.prototype.fnCreateBclistWithMasterBc = function(iGroupIndex, iCount) {
  734 + var i;
  735 + var j;
  736 + // var oPreBc = this._oFirstMasterBc; // 上一个班次(从上标线主站班次开始)
  737 + var oPreBc = this._internalLpArray[0].getBc(iGroupIndex, this._iFirstMasterBcIndex);
  738 + var oNextBc; // 计算的下一个班次
  739 + var oNextBcFcTime; // 下一个班次的发车时间
  740 + var aBcInterval = []; // 班次间隔数组
  741 + var oBcInterval; // 班次间隔对象
  742 + var iNextBcInterval; // 下一个班次发车间隔
  743 +
  744 + var oPreSlaveBc; // 上一个副站班次(上标线主站后的一个副站班次)
  745 + var oNextSlaveBc; // 下一个副站班次
  746 +
  747 + // 当初始化完一圈的主站班次后,最后一个班次是下一圈的上标线主站班次,需要判定存在然后添加间隔
  748 + var _modifyTimeNextGroupIndex; // 上标线下一圈索引
  749 + var _modifyTimeNextBcIndex; // 上标线下一圈班次索引
  750 + var _modifyBc; // 上标线下一个圈的班次
  751 +
  752 + var iStart = iGroupIndex;
  753 + var iEnd = iGroupIndex + iCount;
  754 + if (iEnd > this._qCount) {
  755 + iEnd = this._qCount;
  756 + }
  757 +
  758 + for (i = iStart; i < iEnd; i++) {
  759 + aBcInterval = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(
  760 + this,
  761 + this._oParam,
  762 + i,
  763 + this._iFirstMasterBcIndex,
  764 + this._$calcuCycleTime(oPreBc.getFcTimeObj())[0],
  765 + this._$calcuCycleTime(oPreBc.getFcTimeObj())[1]
  766 + );
  767 +
  768 + if (aBcInterval.length == 0) {
  769 + // 等于0说明上标线没班次了
  770 + break;
  771 + }
  772 +
  773 + for (j = 1; j < this._internalLpArray.length; j++) {
  774 + oBcInterval = aBcInterval[j - 1];
  775 + if (oBcInterval.hasBc) {
  776 + iNextBcInterval = oBcInterval.iFcInterval;
  777 + oNextBcFcTime = this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval);
  778 + this._internalLpArray[j].fnSetVerticalIntervalTime(i, this._iFirstMasterBcIndex, iNextBcInterval);
  779 + this._internalLpArray[j].fnSetHeadwayS2_P(i, this._iFirstMasterBcIndex, oBcInterval.fP);
  780 +
  781 + oNextBc = _utils.createBcObj(
  782 + this._internalLpArray[j],
  783 + "normal",
  784 + this._oParam.isUpOneWayStop(),
  785 + 1,
  786 + oNextBcFcTime,
  787 + this._oParam);
  788 +
  789 + this._internalLpArray[j].setBc(
  790 + i, this._iFirstMasterBcIndex, oNextBc);
  791 + oPreBc = oNextBc;
  792 + }
  793 + }
  794 +
  795 + // 修正上标线主站方向班次(一圈的结束班次,也是下一圈的开始班次)以及后续所有班次
  796 + oBcInterval = aBcInterval[j - 1];
  797 + if (oBcInterval.hasBc) {
  798 + iNextBcInterval = oBcInterval.iFcInterval;
  799 + _modifyTimeNextGroupIndex = i + 1;
  800 + _modifyTimeNextBcIndex = this._iFirstMasterBcIndex;
  801 +
  802 + _utils.modifySBXMasterBc(
  803 + this._internalLpArray[0],
  804 + this._oParam.addMinute(oPreBc.getFcTimeObj(), iNextBcInterval),
  805 + _modifyTimeNextGroupIndex,
  806 + _modifyTimeNextBcIndex,
  807 + oPreBc.isUp(),
  808 + this._oParam
  809 + );
  810 +
  811 + // 修正上标线主站方向的班次后,一圈结束的班次可能不存在(超过末班车时间了),需要判定
  812 + _modifyBc = this._internalLpArray[0].getBc(_modifyTimeNextGroupIndex, _modifyTimeNextBcIndex);
  813 + if (_modifyBc) { // 存在修正间隔值
  814 + this._internalLpArray[0].fnSetVerticalIntervalTime(
  815 + _modifyTimeNextGroupIndex, _modifyTimeNextBcIndex, iNextBcInterval);
  816 + oPreBc = _modifyBc;
  817 + }
  818 +
  819 + }
  820 +
  821 + // 添加副站班次,就是主站班次到达时间加1分钟
  822 + // TODO:因为副站停站时间1分钟到3分钟,几乎没有停站时间,一般前面主站是多少间隔,后面如果有副站的话也是多少间隔
  823 + // TODO:此时,可能出现临界问题,当主站还是高峰接近低谷时,副站已经是低谷,此时副站发车间隔还是高峰间隔
  824 + // TODO:上述情况可以通过让临界的主站高峰班次使用高峰最大间隔,副站使用3分钟的最大停站使副站间隔达到低谷最小间隔
  825 + oPreSlaveBc = this._internalLpArray[0].getBc(
  826 + this._iFirstMasterBcIndex == 0 ? i : i + 1,
  827 + this._iFirstMasterBcIndex == 0 ? 1 : 0
  828 + );
  829 + for (j = 1; j < this._internalLpArray.length; j++) {
  830 + if (oPreSlaveBc) {
  831 + if (aBcInterval[j - 1].hasBc) { // 有主站必有副站
  832 + // 获取当前路牌前一个主站班次
  833 + if (this._internalLpArray[j].getBc(
  834 + i,
  835 + this._iFirstMasterBcIndex)) { // 相同路牌上一个主站班次存在
  836 + oNextSlaveBc = _utils.createBcObj(
  837 + this._internalLpArray[j],
  838 + "normal",
  839 + !this._oParam.isUpOneWayStop(),
  840 + 1,
  841 + this._oParam.addMinute( // 使用1分钟副站停站
  842 + this._internalLpArray[j].getBc(
  843 + i, this._iFirstMasterBcIndex).getArrTimeObj(),
  844 + 1),
  845 + this._oParam);
  846 +
  847 + if (oNextSlaveBc.isUp()) {
  848 + if (!oNextSlaveBc.getFcTimeObj().isAfter(this._oParam.getUpLastDtimeObj())) {
  849 + this._internalLpArray[j].setBc(
  850 + this._iFirstMasterBcIndex == 0 ? i : i + 1,
  851 + this._iFirstMasterBcIndex == 0 ? 1 : 0,
  852 + oNextSlaveBc);
  853 + oPreSlaveBc = oNextSlaveBc;
  854 + }
  855 + } else {
  856 + if (!oPreSlaveBc.getFcTimeObj().isAfter(this._oParam.getDownLastDTimeObj())) {
  857 + this._internalLpArray[j].setBc(
  858 + this._iFirstMasterBcIndex == 0 ? i : i + 1,
  859 + this._iFirstMasterBcIndex == 0 ? 1 : 0,
  860 + oNextSlaveBc);
  861 + oPreSlaveBc = oNextSlaveBc;
  862 + }
  863 + }
  864 + }
  865 + }
  866 + }
  867 + }
  868 +
  869 +
  870 + }
  871 +
  872 + };
  873 +
  874 + //------------- 其他业务方法 -------------//
  875 +
  876 + /**
  877 + * 调整发车间隔。
  878 + */
  879 + InternalScheduleObj.prototype.fnAdjustHeadway = function() {
  880 + // // TODO:572测试,尝试调整第6圈
  881 + // StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
  882 + // this, this._oParam,
  883 + // 6, 0,
  884 + // 6, 1,
  885 + // 0.2
  886 + // );
  887 + // // TODO:843测试
  888 + // StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
  889 + // this, this._oParam,
  890 + // 3, 0,
  891 + // 3, 1,
  892 + // 0.2
  893 + // );
  894 +
  895 + var i;
  896 + var bQIsAnotherWay; // 圈的第一个班次是否副站
  897 + if (this._qIsUp) {
  898 + if (this._oParam.getDirAnotherWayStop()) {
  899 + bQIsAnotherWay = true;
  900 + } else {
  901 + bQIsAnotherWay = false;
  902 + }
  903 + } else {
  904 + if (this._oParam.getDirAnotherWayStop()) {
  905 + bQIsAnotherWay = false;
  906 + } else {
  907 + bQIsAnotherWay = true;
  908 + }
  909 + }
  910 +
  911 + if (this._qIsUp == bQIsAnotherWay) {
  912 + for (i = 0; i < this._qCount; i++) {
  913 + StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
  914 + this, this._oParam,
  915 + i, 0,
  916 + i, 1,
  917 + 0.2
  918 + );
  919 + }
  920 + } else { // 圈的第一个班次是主站班次
  921 + for (i = 0; i < this._qCount; i++) {
  922 + if ((i + 1) < this._qCount) {
  923 + StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_2")(
  924 + this, this._oParam,
  925 + i, 1,
  926 + (i + 1), 0,
  927 + 0.2
  928 + );
  929 + }
  930 + }
  931 + }
  932 +
  933 +
  934 + };
  935 +
  936 + /**
  937 + * 计算吃饭班次。
  938 + */
  939 + InternalScheduleObj.prototype.fnCalcuEatBc = function() {
  940 + var i;
  941 + var j;
  942 + var oLp;
  943 + var oBc;
  944 + // 1、标记吃饭班次
  945 + var oEatFlag = {}; // {"路牌编号":{isLaunch: false, isDinner: false},...}
  946 + for (i = 0; i < this._internalLpArray.length; i++) {
  947 + oLp = this._internalLpArray[i];
  948 + if (oLp.isBxLb()) { // 暂时判定只有连班吃饭
  949 + oEatFlag[oLp.getLpNo()] = {};
  950 + oEatFlag[oLp.getLpNo()]["isLaunch"] = false;
  951 + oEatFlag[oLp.getLpNo()]["isDinner"] = false;
  952 + for (j = 0; j < oLp.getBcArray().length; j++) {
  953 + oBc = oLp.getBcArray()[j];
  954 + // 午饭,暂时判定10:30到13:00
  955 + if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
  956 + oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("10:30")) &&
  957 + oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("13:30"))) {
  958 + if (!oEatFlag[oLp.getLpNo()]["isLaunch"]) {
  959 + oBc.fnSetEatTime(this._oParam.fnGetLunchTime());
  960 + oEatFlag[oLp.getLpNo()]["isLaunch"] = true;
  961 + // console.log("吃饭班次时间=" + oBc.format("HH:mm"));
  962 + }
  963 + }
  964 + // 晚饭,暂时判定17:30
  965 + if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
  966 + oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("17:00")) &&
  967 + oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("20:00"))) {
  968 + if (!oEatFlag[oLp.getLpNo()]["isDinner"]) {
  969 + oBc.fnSetEatTime(this._oParam.fnGetDinnerTime());
  970 + oEatFlag[oLp.getLpNo()]["isDinner"] = true;
  971 + // console.log("晚饭班次时间=" + oBc.format("HH:mm"));
  972 + }
  973 + }
  974 + }
  975 + }
  976 + }
  977 +
  978 + // 2、调整吃饭所需的停站时间
  979 + StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_3_EAT")(
  980 + this, this._oParam
  981 + );
  982 + };
  983 +
  984 + /**
  985 + * 计算末班车。
  986 + * 1、将上下行拉成上下行两个班次列表(包括标记班次)
  987 + * 2、分别找出离末班车发车时间最近的班次,并替换时间
  988 + * 3、删除之后的班次
  989 + */
  990 + InternalScheduleObj.prototype.fnCalcuLastBc = function() {
  991 + var i;
  992 + var iTimeDiff;
  993 + var iTempTime;
  994 + var aBc;
  995 + var oLastBcTime;
  996 + var oLastBcIsUp;
  997 + var iModifyIndex;
  998 +
  999 + // 查找末班车早的末班车时间和方向
  1000 + if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
  1001 + oLastBcTime = this._oParam.getUpLastDtimeObj();
  1002 + oLastBcIsUp = true;
  1003 + } else {
  1004 + oLastBcTime = this._oParam.getDownLastDTimeObj();
  1005 + oLastBcIsUp = false;
  1006 + }
  1007 +
  1008 + // 确定早的末班车时间
  1009 + aBc = this.fnGetBcList(oLastBcIsUp);
  1010 + for (i = 0; i < aBc.length; i++) {
  1011 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1012 + if (iTimeDiff == undefined) {
  1013 + iTimeDiff = iTempTime;
  1014 + iModifyIndex = i;
  1015 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1016 + iTimeDiff = iTempTime;
  1017 + iModifyIndex = i;
  1018 + }
  1019 + }
  1020 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1021 + aBc[iModifyIndex].fnSetDelFlag(false);
  1022 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1023 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1024 + this._qIsUp == oLastBcIsUp ?
  1025 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1026 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
  1027 + }
  1028 +
  1029 + // 查找末班车晚的末班车时间和方向
  1030 + if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
  1031 + oLastBcTime = this._oParam.getDownLastDTimeObj();
  1032 + oLastBcIsUp = false;
  1033 + } else {
  1034 + oLastBcTime = this._oParam.getUpLastDtimeObj();
  1035 + oLastBcIsUp = true;
  1036 + }
  1037 + // 确定晚的末班车时间
  1038 + aBc = this.fnGetBcList(oLastBcIsUp);
  1039 + var oBc;
  1040 + var aBcIndex;
  1041 + var iLpIndex;
  1042 + var iQIndex;
  1043 + var iBcIndex;
  1044 +
  1045 + iTimeDiff = undefined;
  1046 + for (i = 0; i < aBc.length; i++) {
  1047 + oBc = aBc[i];
  1048 + aBcIndex = this.fnGetBcIndex(oBc);
  1049 +
  1050 + iLpIndex = aBcIndex[0];
  1051 + iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
  1052 + iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
  1053 +
  1054 + if (!this._internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
  1055 + continue;
  1056 + }
  1057 +
  1058 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1059 + if (iTimeDiff == undefined) {
  1060 + iTimeDiff = iTempTime;
  1061 + iModifyIndex = i;
  1062 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1063 + iTimeDiff = iTempTime;
  1064 + iModifyIndex = i;
  1065 + }
  1066 + }
  1067 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1068 + aBc[iModifyIndex].fnSetDelFlag(false);
  1069 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1070 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1071 + this._qIsUp == oLastBcIsUp ?
  1072 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1073 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
  1074 + }
  1075 + };
  1076 +
  1077 + /**
  1078 + * 重新设置停站时间(发车时间减到达时间)。
  1079 + */
  1080 + InternalScheduleObj.prototype.fnReSetLayoverTime = function() {
  1081 + for (var i = 0; i < this._internalLpArray.length; i++) {
  1082 + this._internalLpArray[i].modifyLayoverTimeWithoutFcTime();
  1083 + }
  1084 + };
  1085 +
  1086 + /**
  1087 + * 补进出场例保班次。
  1088 + */
  1089 + InternalScheduleObj.prototype.fnCalcuOtherBc = function() {
  1090 + var i;
  1091 + var j;
  1092 + var iBcChainCount;
  1093 + var oLp;
  1094 + var aOtherBc;
  1095 + var oStartBc;
  1096 + var oEndBc;
  1097 +
  1098 + for (i = 0; i < this._internalLpArray.length; i++) {
  1099 + aOtherBc = [];
  1100 + oLp = this._internalLpArray[i];
  1101 + iBcChainCount = oLp.fnGetBcChainCount();
  1102 +
  1103 + if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
  1104 + // 头部要添加出场,例保班次
  1105 + oStartBc = oLp.getBc(
  1106 + oLp.fnGetBcChainInfo(0)["s_q"],
  1107 + oLp.fnGetBcChainInfo(0)["s_b"]
  1108 + );
  1109 + aOtherBc.push(_utils.createBcObj(
  1110 + oLp, "bd", oStartBc.isUp(), 1,
  1111 + oStartBc.getFcTimeObj(),
  1112 + this._oParam
  1113 + ));
  1114 + aOtherBc.push(_utils.createBcObj(
  1115 + oLp, "out", oStartBc.isUp(), 1,
  1116 + oStartBc.getFcTimeObj(),
  1117 + this._oParam
  1118 + ));
  1119 +
  1120 + // 尾部需添加进场,例保班次
  1121 + oEndBc = oLp.getBc(
  1122 + oLp.fnGetBcChainInfo(0)["e_q"],
  1123 + oLp.fnGetBcChainInfo(0)["e_b"]
  1124 + );
  1125 + oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置
  1126 + oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置
  1127 + aOtherBc.push(_utils.createBcObj(
  1128 + oLp, "in", !oEndBc.isUp(), 1,
  1129 + oEndBc.getArrTimeObj(),
  1130 + this._oParam
  1131 + ));
  1132 + aOtherBc.push(_utils.createBcObj(
  1133 + oLp, "lc", !oEndBc.isUp(), 1,
  1134 + oEndBc.getArrTimeObj(),
  1135 + this._oParam
  1136 + ));
  1137 + } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
  1138 + // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
  1139 + oStartBc = oLp.getBc(
  1140 + oLp.fnGetBcChainInfo(0)["s_q"],
  1141 + oLp.fnGetBcChainInfo(0)["s_b"]
  1142 + );
  1143 + aOtherBc.push(_utils.createBcObj(
  1144 + oLp, "bd", oStartBc.isUp(), 1,
  1145 + oStartBc.getFcTimeObj(),
  1146 + this._oParam
  1147 + ));
  1148 + aOtherBc.push(_utils.createBcObj(
  1149 + oLp, "out", oStartBc.isUp(), 1,
  1150 + oStartBc.getFcTimeObj(),
  1151 + this._oParam
  1152 + ));
  1153 +
  1154 + oEndBc = oLp.getBc(
  1155 + oLp.fnGetBcChainInfo(0)["e_q"],
  1156 + oLp.fnGetBcChainInfo(0)["e_b"]
  1157 + );
  1158 + aOtherBc.push(_utils.createBcObj(
  1159 + oLp, "in", !oEndBc.isUp(), 1,
  1160 + oEndBc.getArrTimeObj(),
  1161 + this._oParam
  1162 + ));
  1163 +
  1164 + // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次
  1165 + oStartBc = oLp.getBc(
  1166 + oLp.fnGetBcChainInfo(1)["s_q"],
  1167 + oLp.fnGetBcChainInfo(1)["s_b"]
  1168 + );
  1169 + aOtherBc.push(_utils.createBcObj(
  1170 + oLp, "bd", oStartBc.isUp(), 1,
  1171 + oStartBc.getFcTimeObj(),
  1172 + this._oParam
  1173 + ));
  1174 + aOtherBc.push(_utils.createBcObj(
  1175 + oLp, "out", oStartBc.isUp(), 1,
  1176 + oStartBc.getFcTimeObj(),
  1177 + this._oParam
  1178 + ));
  1179 +
  1180 + oEndBc = oLp.getBc(
  1181 + oLp.fnGetBcChainInfo(1)["e_q"],
  1182 + oLp.fnGetBcChainInfo(1)["e_b"]
  1183 + );
  1184 + aOtherBc.push(_utils.createBcObj(
  1185 + oLp, "in", !oEndBc.isUp(), 1,
  1186 + oEndBc.getArrTimeObj(),
  1187 + this._oParam
  1188 + ));
  1189 + aOtherBc.push(_utils.createBcObj(
  1190 + oLp, "lc", !oEndBc.isUp(), 1,
  1191 + oEndBc.getArrTimeObj(),
  1192 + this._oParam
  1193 + ));
  1194 +
  1195 +
  1196 + } else {
  1197 + // 2个车次链以上,暂时没有此班型
  1198 + }
  1199 +
  1200 + oLp.addOtherBcArray(aOtherBc);
  1201 + }
  1202 + };
  1203 +
  1204 +
  1205 + //------------- 其他非业务方法方法 -------------//
  1206 + /**
  1207 + * 获取班次列表。
  1208 + * @param isUp boolean 是否上行
  1209 + * @returns [(InternalBcObj)]
  1210 + */
  1211 + InternalScheduleObj.prototype.fnGetBcList = function(isUp) {
  1212 + var i;
  1213 + var j;
  1214 + var oLp;
  1215 + var oBc;
  1216 + var aBc = [];
  1217 +
  1218 + for (j = 0; j < this._qCount; j++) {
  1219 + for (i = 0; i < this._internalLpArray.length; i++) {
  1220 + oLp = this._internalLpArray[i];
  1221 + oBc = oLp.getBc(
  1222 + j,
  1223 + this._qIsUp == isUp ? 0 : 1
  1224 + );
  1225 + if (oBc) {
  1226 + aBc.push(oBc);
  1227 + }
  1228 + }
  1229 + }
  1230 +
  1231 + var aBcFcTime = [];
  1232 + for (i = 0; i < aBc.length; i++) {
  1233 + oBc = aBc[i];
  1234 + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
  1235 + }
  1236 + console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
  1237 +
  1238 + return aBc;
  1239 + };
  1240 +
  1241 + /**
  1242 + * 获取班次索引。
  1243 + * @param oBc 班次对象
  1244 + * @returns [{路牌索引},{圈索引},{班次索引}]
  1245 + */
  1246 + InternalScheduleObj.prototype.fnGetBcIndex = function(oBc) {
  1247 + // 路牌索引
  1248 + var i;
  1249 + var iLpIndex;
  1250 + for (i = 0; i < this._internalLpArray.length; i++) {
  1251 + if (this._internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
  1252 + iLpIndex = i;
  1253 + break;
  1254 + }
  1255 + }
  1256 + // 圈索引
  1257 + var j;
  1258 + var iGroupIndex;
  1259 + var bFlag = false;
  1260 + for (i = 0; i < this._internalLpArray.length; i++) {
  1261 + if (bFlag) {
  1262 + break;
  1263 + }
  1264 + for (j = 0; j < this._qCount; j++) {
  1265 + if (this._internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
  1266 + iGroupIndex = j;
  1267 + bFlag = true;
  1268 + break;
  1269 + }
  1270 + }
  1271 + }
  1272 + // 班次索引
  1273 + var iBcIndex = this._qIsUp == oBc.isUp() ? 0 : 1;
  1274 +
  1275 + if (iLpIndex == undefined) {
  1276 + return null;
  1277 + } else {
  1278 + return [].concat(iLpIndex, iGroupIndex, iBcIndex);
  1279 + }
  1280 + };
  1281 +
  1282 + /**
  1283 + * 返回内部路牌数据列表。
  1284 + * @returns {Array}
  1285 + */
  1286 + InternalScheduleObj.prototype.fnGetLpArray = function() {
  1287 + return this._internalLpArray;
  1288 + };
  1289 +
  1290 + /**
  1291 + * 获取班型描述。
  1292 + * @return {*[]}
  1293 + */
  1294 + InternalScheduleObj.prototype.fnGetBxDesc = function() {
  1295 + return this._aBxDesc;
  1296 + };
  1297 +
  1298 + /**
  1299 + * 获取圈的第一个班次是上行还是下行。
  1300 + * @return {boolean|*}
  1301 + */
  1302 + InternalScheduleObj.prototype.fnGetGroupIsUp = function() {
  1303 + return this._qIsUp;
  1304 + };
  1305 +
  1306 + /**
  1307 + * 返回内部工具对象。
  1308 + * @return {{createBcObj, modifySBXMasterBc}}
  1309 + */
  1310 + InternalScheduleObj.prototype.fnGetUitls = function() {
  1311 + return _utils;
  1312 + };
  1313 +
  1314 + /**
  1315 + * 内部数据转化成显示用的班次数组。
  1316 + */
  1317 + InternalScheduleObj.prototype.fnToGanttBcArray = function() {
  1318 + var aAllBc = [];
  1319 + var aLpBc = [];
  1320 + var aEatBc = [];
  1321 + var oLp;
  1322 + var i;
  1323 + var j;
  1324 +
  1325 + for (i = 0; i < this._internalLpArray.length; i++) {
  1326 + oLp = this._internalLpArray[i];
  1327 + aLpBc = [];
  1328 + aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
  1329 +
  1330 + aEatBc = [];
  1331 + // TODO:根据班次的吃饭时间添加吃饭班次
  1332 + for (j = 0; j < aLpBc.length; j++) {
  1333 + if (aLpBc[j].fnGetEatTime() > 0) {
  1334 + aEatBc.push(_utils.createBcObj(
  1335 + oLp,
  1336 + "cf",
  1337 + aLpBc[j].isUp(), // 和上一个班次方向相反
  1338 + 1,
  1339 + this._oParam.addMinute(aLpBc[j].getFcTimeObj(), -aLpBc[j].fnGetEatTime()),
  1340 + this._oParam
  1341 + ));
  1342 + }
  1343 + }
  1344 + aLpBc = aLpBc.concat(aEatBc);
  1345 +
  1346 + // 按照发车时间排序
  1347 + aLpBc.sort(function(o1, o2) {
  1348 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1349 + return -1;
  1350 + } else {
  1351 + return 1;
  1352 + }
  1353 + });
  1354 +
  1355 + // 重新赋值fcno
  1356 + for (j = 0; j < aLpBc.length; j++) {
  1357 + aLpBc[j].fnSetFcno(j + 1);
  1358 + }
  1359 +
  1360 + aAllBc = aAllBc.concat(aLpBc);
  1361 + }
  1362 +
  1363 + var aGanttBc = [];
  1364 + for (i = 0; i < aAllBc.length; i++) {
  1365 + aGanttBc.push(aAllBc[i].toGanttBcObj());
  1366 + }
  1367 +
  1368 + return aGanttBc;
  1369 + };
  1370 +
  1371 + /**
  1372 + * 计算指定开始时间,指定方向班次执行后的最大最小停站时间。
  1373 + * @param oStartFcTime 开始发车时间
  1374 + * @param isUp 是否上行
  1375 + * @returns array [最小值,最大值]
  1376 + */
  1377 + InternalScheduleObj.prototype._$calcuLayoverTime = function(oStartFcTime, isUp) {
  1378 + var aRtn = [];
  1379 + var _iRunningTime; // 行驶时间
  1380 + var _iLayoverTime; // 停站时间
  1381 +
  1382 + // 最小停站时间
  1383 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1384 + isUp, oStartFcTime, this._oParam);
  1385 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1386 + oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1387 + this._oParam)[0]; // 最小停站
  1388 + aRtn.push(_iLayoverTime);
  1389 +
  1390 + // 最大停站时间
  1391 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1392 + isUp, oStartFcTime, this._oParam);
  1393 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1394 + oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1395 + this._oParam)[1]; // 最大停站
  1396 + aRtn.push(_iLayoverTime);
  1397 +
  1398 + return aRtn;
  1399 + };
  1400 +
  1401 + /**
  1402 + * 计算指定时间,指定方向开始的最大最小周转时间
  1403 + * @param oStartFcTime 开始发车时间
  1404 + * @param isUp 是否上行
  1405 + * @returns array [最小值,最大值]
  1406 + * @private
  1407 + */
  1408 + InternalScheduleObj.prototype._$calcuCycleTime = function(oStartFcTime, isUp) {
  1409 + var aRtn = [];
  1410 + var _iRunningTime; // 行驶时间
  1411 + var _iLayoverTime; // 停站时间
  1412 + var _iCycleTime; // 周转时间
  1413 + var _oNextFcTime;
  1414 +
  1415 + // 最小周转时间
  1416 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1417 + isUp, oStartFcTime, this._oParam);
  1418 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1419 + oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1420 + this._oParam)[0]; // 最小停站
  1421 + _iCycleTime = _iRunningTime + _iLayoverTime;
  1422 + _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
  1423 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1424 + !isUp, _oNextFcTime, this._oParam);
  1425 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1426 + _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1427 + this._oParam)[0]; // 最小停站
  1428 + _iCycleTime += _iRunningTime;
  1429 + _iCycleTime += _iLayoverTime;
  1430 +
  1431 + aRtn.push(_iCycleTime);
  1432 +
  1433 + // 最大周转时间
  1434 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1435 + isUp, oStartFcTime, this._oParam);
  1436 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1437 + oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1438 + this._oParam)[1]; // 最大停站
  1439 + _iCycleTime = _iRunningTime + _iLayoverTime;
  1440 + _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
  1441 + _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
  1442 + !isUp, _oNextFcTime, this._oParam);
  1443 + _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1444 + _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
  1445 + this._oParam)[1]; // 最大停站
  1446 + _iCycleTime += _iRunningTime;
  1447 + _iCycleTime += _iLayoverTime;
  1448 +
  1449 + aRtn.push(_iCycleTime);
  1450 +
  1451 + return aRtn;
  1452 + };
  1453 +
  1454 + //-------------------- static静态方法 ----------------------//
  1455 +
  1456 + /**
  1457 + * 计算车辆数(最大周转时间/最大发车间隔)。
  1458 + * @param oParam 参数对象
  1459 + */
  1460 + InternalScheduleObj.calcuClzx = function(oParam) {
  1461 + var _iUpRT; // 上行行驶时间
  1462 + var _iUpLT; // 上行停站时间
  1463 + var _iDownRT; // 下行行驶时间
  1464 + var _iDownLT; // 下行停站时间
  1465 +
  1466 + // 计算早高峰最大周转时间
  1467 + _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getMPeakStartTimeObj(), oParam);
  1468 + _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1469 + oParam.getMPeakStartTimeObj(), true,
  1470 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
  1471 + _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getMPeakStartTimeObj(), oParam);
  1472 + _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1473 + oParam.getMPeakStartTimeObj(), false,
  1474 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
  1475 + var _iAMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  1476 + // 早高峰预估车辆数,使用早高峰最大发车间隔
  1477 + var _iAMPeakVehicleCount = _iAMPeakRCTime / oParam.getMPeakMaxFcjx();
  1478 +
  1479 + // 计算晚高峰最大周转时间
  1480 + _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getEPeakStartTimeObj(), oParam);
  1481 + _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1482 + oParam.getEPeakStartTimeObj(), true,
  1483 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
  1484 + _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getEPeakStartTimeObj(), oParam);
  1485 + _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  1486 + oParam.getEPeakStartTimeObj(), false,
  1487 + StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
  1488 + var _iPMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
  1489 + // 晚高峰预估车辆数,使用晚高峰最大发车间隔
  1490 + var _iPMPeakVehicleCount = _iPMPeakRCTime / oParam.getEPeakMaxFcjx();
  1491 +
  1492 + // 取最大值为最终车辆数
  1493 + // 大于或等于的最小整数,人话就是有小数点就加1
  1494 + if (_iAMPeakVehicleCount > _iPMPeakVehicleCount) {
  1495 + return Math.ceil(_iAMPeakVehicleCount);
  1496 + } else {
  1497 + return Math.ceil(_iPMPeakVehicleCount);
  1498 + }
  1499 +
  1500 + };
  1501 +
  1502 +
  1503 + return InternalScheduleObj;
1504 1504 }());
1505 1505 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/Main_v2_2_ExcelObj.js
1   -/**
2   - * v2_2版本时刻表excel对象。
3   - */
4   -var Main_v2_2_ExcelObj = (function() {
5   - // html5导出下载文件方法
6   - var _fnDownloadFile = function(data, mimeType, fileName) {
7   - var success = false;
8   - var blob = new Blob([data], { type: mimeType });
9   - try {
10   - if (navigator.msSaveBlob)
11   - navigator.msSaveBlob(blob, fileName);
12   - else {
13   - // Try using other saveBlob implementations, if available
14   - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
15   - if (saveBlob === undefined) throw "Not supported";
16   - saveBlob(blob, fileName);
17   - }
18   - success = true;
19   - } catch (ex) {
20   - console.log("saveBlob method failed with the following exception:");
21   - console.log(ex);
22   - }
23   -
24   - if (!success) {
25   - // Get the blob url creator
26   - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
27   - if (urlCreator) {
28   - // Try to use a download link
29   - var link = document.createElement('a');
30   - if ('download' in link) {
31   - // Try to simulate a click
32   - try {
33   - // Prepare a blob URL
34   - var url = urlCreator.createObjectURL(blob);
35   - link.setAttribute('href', url);
36   -
37   - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
38   - link.setAttribute("download", fileName);
39   -
40   - // Simulate clicking the download link
41   - var event = document.createEvent('MouseEvents');
42   - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
43   - link.dispatchEvent(event);
44   - success = true;
45   -
46   - } catch (ex) {
47   - console.log("Download link method with simulated click failed with the following exception:");
48   - console.log(ex);
49   - }
50   - }
51   -
52   - if (!success) {
53   - // Fallback to window.location method
54   - try {
55   - // Prepare a blob URL
56   - // Use application/octet-stream when using window.location to force download
57   - var url = urlCreator.createObjectURL(blob);
58   - window.location = url;
59   - console.log("Download link method with window.location succeeded");
60   - success = true;
61   - } catch (ex) {
62   - console.log("Download link method with window.location failed with the following exception:");
63   - console.log(ex);
64   - }
65   - }
66   - }
67   - }
68   -
69   - if (!success) {
70   - // Fallback to window.open method
71   - console.log("No methods worked for saving the arraybuffer, using last resort window.open");
72   - window.open("", '_blank', '');
73   - }
74   - };
75   -
76   - // 计算导出参数sheet数据。
77   - var _fnCalcuExportParam_sheet = function(_paramObj) {
78   - return [
79   - {'paramItem' : '上行首班时间', 'paramValue' : _paramObj.getUpFirstDTimeObj().format("HH:mm")},
80   - {'paramItem' : '上行末班时间', 'paramValue' : _paramObj.getUpLastDtimeObj().format("HH:mm")},
81   - {'paramItem' : '下行首班时间', 'paramValue' : _paramObj.getDownFirstDTimeObj().format("HH:mm")},
82   - {'paramItem' : '下行末班时间', 'paramValue' : _paramObj.getDownLastDTimeObj().format("HH:mm")},
83   - {'paramItem' : '早高峰开始时间', 'paramValue' : _paramObj.getMPeakStartTimeObj().format("HH:mm")},
84   - {'paramItem' : '早高峰结束时间', 'paramValue' : _paramObj.getMPeakEndTimeObj().format("HH:mm")},
85   - {'paramItem' : '晚高峰开始时间', 'paramValue' : _paramObj.getEPeakStartTimeObj().format("HH:mm")},
86   - {'paramItem' : '晚高峰结束时间', 'paramValue' : _paramObj.getEPeakEndTimeObj().format("HH:mm")},
87   - {'paramItem' : '上行进场时间', 'paramValue' : _paramObj.getUpInTime()},
88   - {'paramItem' : '上行出场时间', 'paramValue' : _paramObj.getUpOutTime()},
89   - {'paramItem' : '下行进场时间', 'paramValue' : _paramObj.getDownInTime()},
90   - {'paramItem' : '下行出场时间', 'paramValue' : _paramObj.getDownOutTime()},
91   - {'paramItem' : '早高峰上行时间', 'paramValue' : _paramObj.getUpMPeakTime()},
92   - {'paramItem' : '早高峰下行时间', 'paramValue' : _paramObj.getDownMPeakTime()},
93   - {'paramItem' : '晚高峰上行时间', 'paramValue' : _paramObj.getUpEPeakTime()},
94   - {'paramItem' : '晚高峰下行时间', 'paramValue' : _paramObj.getDownEPeakTime()},
95   - {'paramItem' : '低谷上行时间', 'paramValue' : _paramObj.getUpTroughTime()},
96   - {'paramItem' : '低谷下行时间', 'paramValue' : _paramObj.getDownTroughTime()},
97   - {'paramItem' : '线路规划类型', 'paramValue' : "双向"},
98   - {'paramItem' : '吃饭地点', 'paramValue' : _paramObj.fnIsEat() ? (_paramObj.fnIsBothEat() ? "上下行" : (_paramObj.fnIsUpEat() ? "上行" : "下行")) : "不吃饭"},
99   - {'paramItem' : '早晚例行保养', 'paramValue' : _paramObj.getLbTime()},
100   - {'paramItem' : '停车场', 'paramValue' : _paramObj.getTccId()},
101   - {'paramItem' : '工作餐午餐时间', 'paramValue' : _paramObj.fnGetLunchTime()},
102   - {'paramItem' : '工作餐晚餐时间', 'paramValue' : _paramObj.fnGetDinnerTime()},
103   - {'paramItem' : '早高峰发车间隔', 'paramValue' : "[" + _paramObj.getMPeakMinFcjx() + "," + _paramObj.getMPeakMaxFcjx() + "]"},
104   - {'paramItem' : '晚高峰发车间隔', 'paramValue' : "[" + _paramObj.getEPeakMinFcjx() + "," + _paramObj.getEPeakMaxFcjx() + "]"},
105   - {'paramItem' : '低谷发车间隔', 'paramValue' : "[" + _paramObj.getTroughMinFcjx() + "," + _paramObj.getTroughMaxFcjx() + "]"},
106   - {'paramItem' : '建议加班路牌数', 'paramValue' : _paramObj.getJBLpes()},
107   - {'paramItem' : '停站类型', 'paramValue' : _paramObj.isTwoWayStop() ? "双向停站" : (_paramObj.isUpOneWayStop() ? "上行主站" : "下行主站") },
108   - {'paramItem' : '建议高峰配车数', 'paramValue' : _paramObj.getAdvicePeakClzs()}
109   - ]
110   - };
111   -
112   - // 计算班次统计数据sheet数据。
113   - var _fnCalcuExportStatInfo_sheet = function(aBc, oParam) {
114   - var countBc = 0, // 总班次
115   - serviceBc = 0, // 营运班次
116   - jcbc = 0, // 进场总班次.
117   - ccbc = 0, // 出场总班次.
118   - cfbc = 0, // 吃饭总班次.
119   - zwlbbc = 0, // 早晚例保总班次.
120   - countGs = 0.0, // 总工时
121   - servicesj = 0, // 营运班次总时间
122   - jcsj = 0.0, // 进场总时间.
123   - ccsj = 0.0, // 出场总时间.
124   - cfsj = 0.0, // 吃饭总时间.
125   - zwlbsj = 0.0, // 早晚例保总时间.
126   - ksBc = 0, // 空驶班次
127   - serviceLc = 0.0, // 营运里程
128   - ksLc = 0.0, // 空驶里程
129   - avgTzjx = 0.0, // 平均停站间隙
130   - gfServiceBc = 0, // 高峰营运班次
131   - dgServiceBc = 0, // 低谷营运班次
132   - gfAvgTzjx = 0.0, // 高峰平均停站间隙
133   - dgAvgTzjx = 0.0; // 低谷平均停站间隙
134   -
135   - var i;
136   - var oBc;
137   - for (i = 0; i < aBc.length; i++) {
138   - oBc = aBc[i];
139   -
140   - if (oBc.bcsj > 0) {
141   - countBc = countBc + 1;
142   - countGs = countGs + oBc.STOPTIME + oBc.bcsj;
143   - if (oParam.isTroughBc(oParam.toTimeObj(oBc.fcsj))) {
144   - if (oBc.bcType == "normal") {
145   - dgServiceBc = dgServiceBc + 1;
146   - dgAvgTzjx = dgAvgTzjx + oBc.STOPTIME;
147   - }
148   - } else {
149   - if (oBc.bcType == "normal") {
150   - gfServiceBc = gfServiceBc + 1;
151   - gfAvgTzjx = gfAvgTzjx + oBc.STOPTIME;
152   - }
153   - }
154   -
155   - if (oBc.bcType == "normal" || oBc.bcType == "cf") {
156   - serviceBc = serviceBc + 1;
157   - serviceLc = serviceLc + oBc.jhlc;
158   - servicesj = servicesj + oBc.bcsj;
159   - avgTzjx = avgTzjx + oBc.STOPTIME;
160   -
161   - if (oBc.bcType == "cf") {
162   - cfbc = cfbc + 1;
163   - cfsj = cfsj + oBc.bcsj;
164   - }
165   - } else if (oBc.bcType == "in") {
166   - jcbc = jcbc + 1;
167   - jcsj = jcsj + oBc.bcsj;
168   - } else if (oBc.bcType == "out") {
169   - ccbc = ccbc + 1;
170   - ccsj = ccsj + oBc.bcsj;
171   - } else if (oBc.bcType == "bd") {
172   - zwlbbc = zwlbbc + 1;
173   - zwlbsj = zwlbsj + oBc.bcsj;
174   - } else if (oBc.bcType == "lc") {
175   - zwlbbc = zwlbbc + 1;
176   - zwlbsj = zwlbsj + oBc.bcsj;
177   - }
178   - }
179   - }
180   -
181   - dgAvgTzjx = dgAvgTzjx / dgServiceBc;
182   - gfAvgTzjx = gfAvgTzjx / gfServiceBc;
183   - avgTzjx = avgTzjx / dgServiceBc;
184   -
185   - return [
186   - {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc},
187   - {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc},
188   - {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc},
189   - {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc},
190   - {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc},
191   - {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc},
192   - {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60},
193   - {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60},
194   - {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60},
195   - {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60},
196   - {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60},
197   - {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60},
198   - {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc},
199   - {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc},
200   - {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc},
201   - {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx},
202   - {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc},
203   - {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc},
204   - {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx},
205   - {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx},
206   - {'statItem': '综合评估', 'statValue': 3}
207   - ];
208   -
209   - };
210   -
211   - /**
212   - * 内部计算Excel班次方法1,
213   - * 这里是假设班次按照从早到晚排序,并且路牌也是从小到大排序。
214   - * @param aExcelLp excel显示用路牌
215   - * @param aGanttBc 甘特图班次列表
216   - * @param oParam 参数对象
217   - * @param bQIsUp 每一圈是上行开始还是下行开始
218   - * @private
219   - */
220   - function InternalCalcuExcelBc1(aExcelLp, aGanttBc, oParam, bQIsUp) {
221   - this._aExcelLp = aExcelLp;
222   - this._oParam = oParam;
223   - this._bQIsUp = bQIsUp;
224   -
225   - this._iUpGroupIndex = 0;
226   - this._iDownGroupIndex = 0;
227   -
228   - // {"路牌名字":{"isFlag": 是否为标记班次(表示扫描过但是没有班次对象),"normal":正常班次}}
229   - this._oLpGroupNormalGanttBc = {};
230   - // [吃饭类型班次]
231   - this._aLpGroupCfGanttBc = [];
232   -
233   - // TODO:其他类型的班次再议
234   -
235   - // 计算上行gantt班次列表,下行gantt班次列表,并排序
236   - var i;
237   - var oGanttBc;
238   - this._aUpGanttBc = [];
239   - this._aDownGanttBc = [];
240   - for (i = 0; i < aGanttBc.length; i++) {
241   - oGanttBc = aGanttBc[i];
242   - if (oGanttBc.xlDir == "relationshipGraph-up") {
243   - this._aUpGanttBc.push(oGanttBc);
244   - } else {
245   - this._aDownGanttBc.push(oGanttBc);
246   - }
247   - }
248   - // 排序班次
249   - this._fnSortBc(this._aUpGanttBc);
250   - this._fnSortBc(this._aDownGanttBc);
251   -
252   - if (this._aUpGanttBc.length == 0) {
253   - throw "没有上行班次,不能导出数据!";
254   - }
255   - if (this._aDownGanttBc.length == 0) {
256   - throw "没有下行班次,不能导出数据!"
257   - }
258   -
259   - }
260   -
261   - //----------------------- 外部方法 -----------------------//
262   - InternalCalcuExcelBc1.prototype.fnGenerateExcelLpBcList = function() {
263   - // 计算Excel班次
264   - this._calcuExcelBc();
265   -
266   - // 设置路牌圈数
267   - var iGroupCount = this._iUpGroupIndex > this._iDownGroupIndex ?
268   - (this._iUpGroupIndex + 1) : (this._iDownGroupIndex + 1);
269   -
270   - // 设置路由id
271   - var oUpNormalBc;
272   - var oDownNormalBc;
273   - var i;
274   - for (i = 0; i < this._aUpGanttBc.length; i++) {
275   - if (this._aUpGanttBc[i].bcType == "normal") {
276   - oUpNormalBc = this._aUpGanttBc[i];
277   - break;
278   - }
279   - }
280   - for (i = 0; i < this._aDownGanttBc.length; i++) {
281   - if (this._aDownGanttBc[i].bcType == "normal") {
282   - oDownNormalBc = this._aDownGanttBc[i];
283   - break;
284   - }
285   - }
286   -
287   - var stationRouteId1;
288   - var stationRouteId2;
289   - if (this._bQIsUp) {
290   - stationRouteId1 = oUpNormalBc.qdz;
291   - stationRouteId2 = oDownNormalBc.qdz;
292   - } else {
293   - stationRouteId1 = oDownNormalBc.qdz;
294   - stationRouteId2 = oUpNormalBc.qdz;
295   - }
296   -
297   - var oExcelLp;
298   - for (i = 0; i < this._aExcelLp.length; i++) {
299   - oExcelLp = this._aExcelLp[i];
300   - oExcelLp.groupCount = iGroupCount;
301   - oExcelLp.stationRouteId1 = stationRouteId1;
302   - oExcelLp.stationRouteId2 = stationRouteId2;
303   -
304   - // 删除临时参数
305   - delete oExcelLp["_bcObjGroupList"];
306   - }
307   -
308   - // 路牌数据统计
309   - var j = 0;
310   - var aLpBc;
311   - var oLpBc;
312   - for (i = 0; i < this._aExcelLp.length; i++) {
313   - oExcelLp = this._aExcelLp[i];
314   - aLpBc = oExcelLp.bcObjList;
315   - for (j = 0; j < aLpBc.length; j++) {
316   - oLpBc = aLpBc[j];
317   - if (oLpBc.bcType == "normal") {
318   - oExcelLp.zlc = oExcelLp.zlc +
319   - oLpBc._bclc; // 总里程
320   - oExcelLp.yylc = oExcelLp.yylc +
321   - oLpBc._bclc; // 营运里程
322   - oExcelLp.yygs = oExcelLp.yygs +
323   - oLpBc.bcsj + // 班次时间
324   - oLpBc.ssj + // 停站时间
325   - oLpBc.eatsj; // 吃饭时间
326   - oExcelLp.yybc = oExcelLp.yybc + 1;
327   -
328   - oExcelLp.zgs = oExcelLp.zgs +
329   - oLpBc.bcsj + // 班次时间
330   - oLpBc.ssj + // 停站时间
331   - oLpBc.eatsj; // 吃饭时间
332   - oExcelLp.zbc = oExcelLp.zbc + 1;
333   - } else if (
334   - oLpBc.bcType == "bd" ||
335   - oLpBc.bcType == "out" ||
336   - oLpBc.bcType == "in" ||
337   - oLpBc.bcType == "lc") {
338   - oExcelLp.kslc = oExcelLp.kslc +
339   - oLpBc._bclc; // 里程
340   - oExcelLp.zlc = oExcelLp.zlc +
341   - oLpBc._bclc; // 里程
342   - oExcelLp.zgs = oExcelLp.zgs +
343   - oLpBc.bcsj + // 班次时间
344   - oLpBc.ssj; // 停站时间
345   -
346   - if (oLpBc.bcType != "bd" && oLpBc.bcType != "lc") {
347   - oExcelLp.zbc = oExcelLp.zbc + 1;
348   - }
349   -
350   - }
351   -
352   - delete oLpBc._bclc; // 删除临时变量
353   -
354   - }
355   - }
356   -
357   -
358   -
359   - return this._aExcelLp;
360   - };
361   -
362   - //----------------------- 内部方法 ------------------------//
363   - // 排序班次
364   - InternalCalcuExcelBc1.prototype._fnSortBc = function(aGanttBc) {
365   - var oParam = this._oParam;
366   - aGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
367   - var o1_fcsj;
368   - var o2_fcsj;
369   - if (o1.fcsj.indexOf("00:") >= 0) { // 大于00点是第二天
370   - o1_fcsj = oParam.toTimeObj(o1.fcsj).add(1, "d");
371   - } else {
372   - o1_fcsj = oParam.toTimeObj(o1.fcsj);
373   - }
374   -
375   - if (o2.fcsj.indexOf("00:") >= 0) { // 大于00点是第二天
376   - o2_fcsj = oParam.toTimeObj(o2.fcsj).add(1, "d");
377   - } else {
378   - o2_fcsj = oParam.toTimeObj(o2.fcsj);
379   - }
380   -
381   -
382   - if (o1_fcsj.isBefore(o2_fcsj)) {
383   - return -1;
384   - } else {
385   - return 1;
386   - }
387   - });
388   - // 此处假设班次按照从早倒晚排,每一圈按照路牌顺序排
389   -
390   - // TODO:如果发生同一圈路牌交叉发车,不是按照路牌排序的,导出时有问题,再议
391   - };
392   -
393   - InternalCalcuExcelBc1.prototype._calcuExcelBc = function() {
394   - var i = 0;
395   - var j = 0;
396   -
397   - var aUpBc;
398   - var aDownBc;
399   - if (this._bQIsUp) {
400   - aUpBc = this._aUpGanttBc;
401   - aDownBc = this._aDownGanttBc;
402   - } else {
403   - aUpBc = this._aDownGanttBc;
404   - aDownBc = this._aUpGanttBc;
405   - }
406   -
407   - do {
408   - i = this._calcuExcelBcPerGroup(this._bQIsUp, i);
409   - j = this._calcuExcelBcPerGroup(!this._bQIsUp, j);
410   - } while(i < aUpBc.length || j < aDownBc.length);
411   -
412   - // 重新计算报到,出场,进场,离场班次的圈,班次索引
413   - this._resetBdOutInLcBcGroup();
414   -
415   - };
416   -
417   - /**
418   - * 重新计算Excel显示班次(计算1圈)。
419   - * @param bIsUp 是否上行
420   - * @param iBcIndex 班次索引
421   - * @return 下一次计算索引
422   - */
423   - InternalCalcuExcelBc1.prototype._calcuExcelBcPerGroup = function(bIsUp, iBcIndex) {
424   - this._oLpGroupNormalGanttBc = {};
425   -
426   - var i;
427   - var j = 0;
428   - var oExcelLp;
429   - var oGanttBc;
430   - var aGBc = bIsUp ? this._aUpGanttBc : this._aDownGanttBc;
431   -
432   - for (i = iBcIndex; i < aGBc.length; i++) {
433   - oGanttBc = aGBc[i];
434   -
435   - // 添加到场,出场,进场,离场班次
436   - this._addBdOutInLcBc(oGanttBc, bIsUp);
437   -
438   - while(j < this._aExcelLp.length) {
439   - oExcelLp = this._aExcelLp[j];
440   -
441   - if (oGanttBc.bcType == "cf") { // 吃饭班次
442   - this._aLpGroupCfGanttBc.push(oGanttBc);
443   - break;
444   - } else if (oGanttBc.bcType == "normal") { // 正常班次
445   - this._oLpGroupNormalGanttBc[oExcelLp.lpname] = {
446   - "isFlag": true, "normal": null
447   - };
448   - if (oExcelLp.lpname == oGanttBc.lpName) {
449   - this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag = false;
450   - this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal = oGanttBc;
451   - j++;
452   - break;
453   - } else {
454   - j++;
455   - }
456   - } else {
457   -
458   - break;
459   - }
460   -
461   - }
462   -
463   - if (j == this._aExcelLp.length) { // 完整的一圈处理
464   - this._resetCalcuGroup(bIsUp);
465   - j = 0;
466   - if (oGanttBc.lpName !=
467   - this._aExcelLp[this._aExcelLp.length - 1].lpname) {
468   - i--;
469   - break;
470   -
471   - }
472   -
473   - break;
474   - }
475   -
476   - }
477   -
478   - // 最后一圈reset一下
479   - if (j > 0) {
480   - this._resetCalcuGroup(bIsUp);
481   - }
482   - return i + 1;
483   -
484   - };
485   -
486   - InternalCalcuExcelBc1.prototype._resetCalcuGroup = function(bIsUp) {
487   - // 判定是否开始分班,添加圈数
488   - if (bIsUp) {
489   - if (this._fnIsFBcQ(bIsUp)) {
490   - this._iUpGroupIndex += 1;
491   - this._iDownGroupIndex += 1;
492   - }
493   - } else {
494   - if (this._fnIsFBcQ(!bIsUp)) {
495   - this._iUpGroupIndex += 1;
496   - this._iDownGroupIndex += 1;
497   - }
498   - }
499   -
500   - // 重置计算圈及班次
501   - var oExcelLp;
502   - var oGroupGanttNormalBc;
503   - var oGroupGanttEatBc;
504   - for (var i = 0; i < this._aExcelLp.length; i++) {
505   - oExcelLp = this._aExcelLp[i];
506   - if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
507   - if (!this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag) { // 非标记班次
508   - oGroupGanttNormalBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
509   -
510   - // 获取吃饭班次
511   - oGroupGanttEatBc = null;
512   - if (this._aLpGroupCfGanttBc.length > 0) {
513   - if (this._aLpGroupCfGanttBc[0].lpName == oExcelLp.lpname) {
514   - if (this._oParam.toTimeObj(this._aLpGroupCfGanttBc[0].fcsj).isBefore(
515   - this._oParam.toTimeObj(oGroupGanttNormalBc.fcsj))) {
516   - oGroupGanttEatBc = this._aLpGroupCfGanttBc.shift();
517   - }
518   - }
519   - }
520   -
521   - oExcelLp.bcObjList.push({
522   - "bcsj": oGroupGanttNormalBc.bcsj, // 班次时间
523   - "ssj": oGroupGanttNormalBc.STOPTIME, // 停站时间
524   - "eatsj": oGroupGanttEatBc ? oGroupGanttEatBc.bcsj : 0, // 吃饭时间
525   -
526   - "tccid": oGroupGanttNormalBc.tcc, // 停车场id
527   - "qdzid": oGroupGanttNormalBc.qdz, // 起点站id
528   - "zdzid": oGroupGanttNormalBc.zdz, // 终点站id
529   -
530   - "isUp": bIsUp, // 是否上行
531   -
532   - "bcType": oGroupGanttNormalBc.bcType, // 班次类型
533   - "fcsj": oGroupGanttEatBc ?
534   - ("*" + oGroupGanttNormalBc.fcsj) :
535   - oGroupGanttNormalBc.fcsj, // 发车时间描述
536   - "fcsjDesc": oGroupGanttEatBc ?
537   - ("(吃" + oGroupGanttNormalBc.fcsj + ")") :
538   - oGroupGanttNormalBc.fcsj, // 发车时间描述2
539   -
540   - "groupNo": bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
541   - "groupBcNo": bIsUp == this._bQIsUp ? 0 : 1, // 圈里第几个班次
542   -
543   - "_bclc": oGroupGanttNormalBc.jhlc // 班次里程(最后需要删除)
544   -
545   - });
546   -
547   - oExcelLp._bcObjGroupList.push({
548   - fcsj: oGroupGanttNormalBc.fcsj, // 发车时间
549   - groupIndex: bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
550   - bcIndex: bIsUp == this._bQIsUp ? 0 : 1 // 圈里第几个班次
551   - });
552   - }
553   - }
554   - }
555   -
556   - if (bIsUp) {
557   - this._iUpGroupIndex ++;
558   - } else {
559   - this._iDownGroupIndex ++;
560   - }
561   - this._oLpGroupNormalGanttBc = {};
562   - };
563   -
564   - // 添加报到,出场,进场,离场班次
565   - InternalCalcuExcelBc1.prototype._addBdOutInLcBc = function(oGanttBc, bIsUp) {
566   - var i;
567   - var oExcelLp;
568   - var bcType;
569   - for (i = 0; i < this._aExcelLp.length; i++) {
570   - oExcelLp = this._aExcelLp[i];
571   - if (oGanttBc.lpName == oExcelLp.lpname) {
572   - bcType = oGanttBc.bcType;
573   - if (bcType == "bd" || bcType == "out" || bcType == "in" || bcType == "lc") {
574   - oExcelLp.bcObjList.push({
575   - "bcsj": oGanttBc.bcsj, // 班次时间
576   - "ssj": oGanttBc.STOPTIME, // 停站时间
577   - "eatsj": 0, // 吃饭时间
578   -
579   - "tccid": oGanttBc.tcc, // 停车场id
580   - "qdzid": oGanttBc.qdz, // 起点站id
581   - "zdzid": oGanttBc.zdz, // 终点站id
582   -
583   - "isUp": bIsUp, // 是否上行
584   - "isFb": null, // 是否分班(_resetBdOutInLcBcGroup方法修正)
585   -
586   - "bcType": oGanttBc.bcType, // 班次类型(bc、out、in、lc)
587   - "fcsj": oGanttBc.fcsj, // 发车时间描述
588   -
589   - "groupNo": -99, // 第几圈(_resetBdOutInLcBcGroup方法修正)
590   - "groupBcNo": -99, // 圈里第几个班次(_resetBdOutInLcBcGroup方法修正)
591   -
592   - "_bclc": oGanttBc.jhlc // 班次里程(最后需要删除)
593   - });
594   - break;
595   - }
596   - }
597   - }
598   -
599   - };
600   - // 重新计算报到,出场,进场,离场班次的圈索引及班次索引
601   - InternalCalcuExcelBc1.prototype._resetBdOutInLcBcGroup = function() {
602   - var i;
603   - var j;
604   - var k;
605   - var sFcsjDesc = [];
606   - var oExcelLp;
607   - var oLpBc;
608   -
609   - // {"bd":到场班次index,"out":出场班次index, "nextBc": 出场后第一个normal班次索引, "nextBcGroup":出场后第一个normal班次group索引}
610   - var oBdOutLpBc = {};
611   - // 到场出场班次组合数组
612   - var aBdOutLpBc = [];
613   -
614   - // {"in":进场班次index,"lc":离场班次index, "preBc": 进场前一个normal班次索引, "preBcGroup":进场前一个normal班次group索引}
615   - var oInLcLpBc = {};
616   - // 进场离场班次组合数组
617   - var aInLcLpBc = [];
618   -
619   - for (i = 0; i < this._aExcelLp.length; i++) {
620   - oExcelLp = this._aExcelLp[i];
621   -
622   - // 排序oExcelLp班次列表
623   - this._fnSortBc(oExcelLp.bcObjList);
624   -
625   - aBdOutLpBc = [];
626   - aInLcLpBc = [];
627   -
628   - for (j = 0; j < oExcelLp.bcObjList.length; j++) {
629   - oLpBc = oExcelLp.bcObjList[j];
630   -
631   - if (oLpBc.bcType == "out") { // 出场班次
632   - oBdOutLpBc = {"bd": null, "out": null, "nextBc": null, "nextBcGroup": null};
633   - oBdOutLpBc["out"] = j;
634   - // 查找上一个班次是否是报到班次(不存在有可能,中间分班班次可能没有报到时间)
635   - if ((j - 1) >= 0 && (j - 1) < oExcelLp.bcObjList.length) {
636   - if (oExcelLp.bcObjList[j - 1].bcType == "bd") {
637   - oBdOutLpBc["bd"] = j - 1;
638   - }
639   - }
640   - // 查找下一个班次是否是normal班次(不存在或者不是normal班次,这个报到出场班次组合忽略)
641   - if ((j + 1) < oExcelLp.bcObjList.length) {
642   - if (oExcelLp.bcObjList[j + 1].bcType == "normal") {
643   - for (k = 0; k < oExcelLp._bcObjGroupList.length; k++) {
644   - if (oExcelLp.bcObjList[j + 1].fcsj == oExcelLp._bcObjGroupList[k].fcsj) {
645   - oBdOutLpBc["nextBc"] = j + 1;
646   - oBdOutLpBc["nextBcGroup"] = k;
647   - aBdOutLpBc.push(oBdOutLpBc);
648   - break;
649   - }
650   - }
651   - }
652   - }
653   - } else if (oLpBc.bcType == "in") { // 进场班次
654   - oInLcLpBc = {"in": null, "lc": null, "preBc": null, "preBcGroup": null};
655   - oInLcLpBc["in"] = j;
656   - // 查找系一个班次是否是离场班次(不存在有可能,中间分班班次可能没有离场时间)
657   - if ((j + 1) < oExcelLp.bcObjList.length) {
658   - if (oExcelLp.bcObjList[j + 1].bcType == "lc") {
659   - oInLcLpBc["lc"] = j + 1;
660   - }
661   - }
662   - // 查找上一个班次是否是normal班次(不存在或者不是normal班次,这个进场离场班次组合忽略)
663   - if ((j - 1) >= 0 && (j - 1) < oExcelLp.bcObjList.length) {
664   - if (oExcelLp.bcObjList[j - 1].bcType == "normal") {
665   - for (k = 0; k < oExcelLp._bcObjGroupList.length; k++) {
666   - if (oExcelLp.bcObjList[j - 1].fcsj == oExcelLp._bcObjGroupList[k].fcsj) {
667   - oInLcLpBc["preBc"] = j - 1;
668   - oInLcLpBc["preBcGroup"] = k;
669   - aInLcLpBc.push(oInLcLpBc);
670   - break;
671   - }
672   - }
673   - }
674   - }
675   -
676   - }
677   -
678   - }
679   -
680   - if (aBdOutLpBc.length == 2) { // 分班(以出场班次为主)
681   - // 处理第一个出场
682   - sFcsjDesc = [];
683   - oBdOutLpBc = aBdOutLpBc[0];
684   - if (oBdOutLpBc.bd != null) {
685   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
686   - oLpBc.isFb = false;
687   - oLpBc.groupNo = -1;
688   - oLpBc.groupBcNo = -1;
689   - sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
690   - }
691   -
692   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
693   - oLpBc.isFb = false;
694   - oLpBc.groupNo = -1;
695   - oLpBc.groupBcNo = -2;
696   - sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
697   -
698   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
699   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
700   - oLpBc.fcsjDesc = sFcsjDesc.join("");
701   -
702   - // 处理第二个出场
703   - sFcsjDesc = [];
704   - oBdOutLpBc = aBdOutLpBc[1];
705   - if (oBdOutLpBc.bd != null) {
706   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
707   - oLpBc.isFb = true;
708   - oLpBc.groupNo = oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex - 1;
709   - oLpBc.groupBcNo = oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex;
710   - sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
711   - }
712   -
713   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
714   - oLpBc.isFb = true;
715   - oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex == 0) ?
716   - (oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex - 1) :
717   - oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex);
718   - oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex == 0) ? 1 : 0);
719   - sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
720   -
721   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
722   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
723   - oLpBc.fcsjDesc = sFcsjDesc.join("");
724   -
725   - // 2个以上进场班次,处理第一个和第二个,第一个做为中间进场
726   - if (aInLcLpBc.length >= 2) {
727   - sFcsjDesc = [];
728   - oInLcLpBc = aInLcLpBc[0];
729   -
730   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
731   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
732   -
733   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
734   - oLpBc.isFb = true;
735   - oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
736   - oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
737   - (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
738   - oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
739   - sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
740   -
741   - oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
742   -
743   - sFcsjDesc = [];
744   - oInLcLpBc = aInLcLpBc[1];
745   -
746   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
747   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
748   -
749   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
750   - oLpBc.isFb = false;
751   - oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
752   - oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
753   - (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
754   - oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
755   - sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
756   -
757   - if (oInLcLpBc.lc) {
758   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
759   - oLpBc.isFb = false;
760   - oLpBc.groupNo = -2;
761   - oLpBc.groupBcNo = -4;
762   - sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
763   - }
764   - oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
765   - }
766   -
767   - // 一个进场班次,做为最后一个进场班次处理
768   - if (aInLcLpBc.length == 1) {
769   - sFcsjDesc = [];
770   - oInLcLpBc = aInLcLpBc[0];
771   -
772   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
773   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
774   -
775   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
776   - oLpBc.isFb = false;
777   - oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
778   - oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
779   - (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
780   - oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
781   - sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
782   -
783   - if (oInLcLpBc.lc) {
784   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
785   - oLpBc.isFb = false;
786   - oLpBc.groupNo = -2;
787   - oLpBc.groupBcNo = -4;
788   - sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
789   - }
790   - oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
791   - }
792   -
793   -
794   - } else if (aBdOutLpBc.length == 1) {
795   - // 处理出场
796   - sFcsjDesc = [];
797   - oBdOutLpBc = aBdOutLpBc[0];
798   - if (oBdOutLpBc.bd != null) {
799   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
800   - oLpBc.isFb = false;
801   - oLpBc.groupNo = -1;
802   - oLpBc.groupBcNo = -1;
803   - sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
804   - }
805   -
806   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
807   - oLpBc.isFb = false;
808   - oLpBc.groupNo = -1;
809   - oLpBc.groupBcNo = -2;
810   - sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
811   -
812   - oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
813   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
814   - oLpBc.fcsjDesc = sFcsjDesc.join("");
815   -
816   - // 处理进场
817   - if (aInLcLpBc.length > 0) {
818   - sFcsjDesc = [];
819   - oInLcLpBc = aInLcLpBc[0];
820   -
821   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
822   - sFcsjDesc.push("(" + oLpBc.fcsj + ")");
823   -
824   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
825   - oLpBc.isFb = false;
826   - oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
827   - oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
828   - (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
829   - oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
830   - sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
831   -
832   - if (oInLcLpBc.lc) {
833   - oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
834   - oLpBc.isFb = false;
835   - oLpBc.groupNo = -2;
836   - oLpBc.groupBcNo = -4;
837   - sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
838   - }
839   - oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
840   -
841   - }
842   -
843   - }
844   -
845   - // console.log("todo");
846   -
847   -
848   - }
849   -
850   - // console.log("ddd");
851   -
852   - };
853   -
854   - // 判定当前圈是否是有分班后的第一个normal班次
855   - InternalCalcuExcelBc1.prototype._fnIsFBcQ = function(bIsUp) {
856   - var oExcelLp;
857   - var i;
858   - var oLpPreExcelBc;
859   - var oLpCurGranttBc;
860   - var oPreBcFcsj;
861   - var oCurBcFcsj;
862   - var idiffTime;
863   - var bFbFlag = false;
864   - for (i = 0; i < this._aExcelLp.length; i++) {
865   - oExcelLp = this._aExcelLp[i];
866   - if (oExcelLp.bcObjList.length > 0) {
867   - oLpPreExcelBc = oExcelLp.bcObjList[oExcelLp.bcObjList.length - 1];
868   - if (oLpPreExcelBc.bcType == "normal") {
869   - oPreBcFcsj = this._oParam.toTimeObj(
870   - oLpPreExcelBc.fcsj.indexOf("*") >= 0 ? oLpPreExcelBc.fcsj.substr(1) : oLpPreExcelBc.fcsj
871   - );
872   - if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
873   - oLpCurGranttBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
874   - if (oLpCurGranttBc) {
875   - oCurBcFcsj = this._oParam.toTimeObj(oLpCurGranttBc.fcsj);
876   - idiffTime = oCurBcFcsj.diff(oPreBcFcsj, "m");
877   - if (idiffTime > oLpPreExcelBc.bcsj * 3) {
878   - bFbFlag = true;
879   - break;
880   - }
881   - }
882   - }
883   - }
884   - }
885   -
886   - }
887   -
888   - return bFbFlag;
889   -
890   - };
891   -
892   - /**
893   - * 内部Excel对象。
894   - * @param oParam 参数对象
895   - * @param fnGetGanttBcArray 返回gantt用的班次列表
896   - * @constructor
897   - */
898   - function InternalExcelObj(oParam, fnGetGanttBcArray) {
899   - // 参数对象
900   - this._oParam = oParam;
901   - // 获取gantt班次的方法
902   - this._fnBc = fnGetGanttBcArray;
903   -
904   - // 每一圈是上行开始还是下行开始
905   - this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
906   -
907   - }
908   -
909   - // html5导出excel方法
910   - InternalExcelObj.prototype.downloadFile = function(data, mimeType, fileName) {
911   - _fnDownloadFile(data, mimeType, fileName);
912   - };
913   - /**
914   - * 获取班次统计数据。
915   - */
916   - InternalExcelObj.prototype.fnGetStatInfoList = function() {
917   - return _fnCalcuExportStatInfo_sheet(this._fnBc(), this._oParam);
918   - };
919   - /**
920   - * 获取参数数据。
921   - */
922   - InternalExcelObj.prototype.fnGetParamInfoList = function() {
923   - return _fnCalcuExportParam_sheet(this._oParam);
924   - };
925   - /**
926   - * 获取路牌班次数据。
927   - * @return {*}
928   - */
929   - InternalExcelObj.prototype.fnGetLpBcInfoList = function() {
930   - // 构造显示用lp对象
931   - var oTempLpFlag = {};
932   - var aGanttBc = this._fnBc();
933   - var oGanttBc;
934   - var aLp = [];
935   - var oLp;
936   - var i;
937   - for (i = 0; i < aGanttBc.length; i++) {
938   - oGanttBc = aGanttBc[i];
939   - if (oTempLpFlag[oGanttBc.lpName]) {
940   - // 已经存在路牌,不处理
941   - continue;
942   - }
943   -
944   - oLp = {
945   - "lpname": oGanttBc.lpName, // 路牌名字
946   - "isUp": this._qIsUp, // 每圈的第一个班次是否上行
947   - "bcObjList": [], // 内部班次列表(后面计算班次列表)
948   - "_bcObjGroupList": [], // 每个normal班次对应的group对象 {fcsj: 发车时间, groupIndex: 圈索引, bcIndex: 班次索引},最后返回要删除
949   - "groupCount": 0, // 总圈数(后面计算总圈数)
950   - "zlc": 0, // 总里程
951   - "yylc": 0, // 营运里程
952   - "kslc": 0, // 空驶里程
953   - "zgs": 0, // 总工时
954   - "zbc": 0, // 总班次
955   - "yygs": 0, // 营运工时
956   - "yybc": 0, // 营运班次
957   - "stationRouteId1": 0, // 第一个班次起点站路由id
958   - "stationRouteId2": 0 // 第二个班次起点站路由id
959   - };
960   - oTempLpFlag[oGanttBc.lpName] = {"flag" : true}; // 标记一下
961   - aLp.push(oLp);
962   - }
963   -
964   - // 计算Excel班次
965   - var _celb = new InternalCalcuExcelBc1(aLp, aGanttBc, this._oParam, this._qIsUp);
966   - return _celb.fnGenerateExcelLpBcList();
967   - };
968   -
969   - return InternalExcelObj;
970   -
  1 +/**
  2 + * v2_2版本时刻表excel对象。
  3 + */
  4 +var Main_v2_2_ExcelObj = (function() {
  5 + // html5导出下载文件方法
  6 + var _fnDownloadFile = function(data, mimeType, fileName) {
  7 + var success = false;
  8 + var blob = new Blob([data], { type: mimeType });
  9 + try {
  10 + if (navigator.msSaveBlob)
  11 + navigator.msSaveBlob(blob, fileName);
  12 + else {
  13 + // Try using other saveBlob implementations, if available
  14 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  15 + if (saveBlob === undefined) throw "Not supported";
  16 + saveBlob(blob, fileName);
  17 + }
  18 + success = true;
  19 + } catch (ex) {
  20 + console.log("saveBlob method failed with the following exception:");
  21 + console.log(ex);
  22 + }
  23 +
  24 + if (!success) {
  25 + // Get the blob url creator
  26 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  27 + if (urlCreator) {
  28 + // Try to use a download link
  29 + var link = document.createElement('a');
  30 + if ('download' in link) {
  31 + // Try to simulate a click
  32 + try {
  33 + // Prepare a blob URL
  34 + var url = urlCreator.createObjectURL(blob);
  35 + link.setAttribute('href', url);
  36 +
  37 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  38 + link.setAttribute("download", fileName);
  39 +
  40 + // Simulate clicking the download link
  41 + var event = document.createEvent('MouseEvents');
  42 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  43 + link.dispatchEvent(event);
  44 + success = true;
  45 +
  46 + } catch (ex) {
  47 + console.log("Download link method with simulated click failed with the following exception:");
  48 + console.log(ex);
  49 + }
  50 + }
  51 +
  52 + if (!success) {
  53 + // Fallback to window.location method
  54 + try {
  55 + // Prepare a blob URL
  56 + // Use application/octet-stream when using window.location to force download
  57 + var url = urlCreator.createObjectURL(blob);
  58 + window.location = url;
  59 + console.log("Download link method with window.location succeeded");
  60 + success = true;
  61 + } catch (ex) {
  62 + console.log("Download link method with window.location failed with the following exception:");
  63 + console.log(ex);
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 + if (!success) {
  70 + // Fallback to window.open method
  71 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  72 + window.open("", '_blank', '');
  73 + }
  74 + };
  75 +
  76 + // 计算导出参数sheet数据。
  77 + var _fnCalcuExportParam_sheet = function(_paramObj) {
  78 + return [
  79 + {'paramItem' : '上行首班时间', 'paramValue' : _paramObj.getUpFirstDTimeObj().format("HH:mm")},
  80 + {'paramItem' : '上行末班时间', 'paramValue' : _paramObj.getUpLastDtimeObj().format("HH:mm")},
  81 + {'paramItem' : '下行首班时间', 'paramValue' : _paramObj.getDownFirstDTimeObj().format("HH:mm")},
  82 + {'paramItem' : '下行末班时间', 'paramValue' : _paramObj.getDownLastDTimeObj().format("HH:mm")},
  83 + {'paramItem' : '早高峰开始时间', 'paramValue' : _paramObj.getMPeakStartTimeObj().format("HH:mm")},
  84 + {'paramItem' : '早高峰结束时间', 'paramValue' : _paramObj.getMPeakEndTimeObj().format("HH:mm")},
  85 + {'paramItem' : '晚高峰开始时间', 'paramValue' : _paramObj.getEPeakStartTimeObj().format("HH:mm")},
  86 + {'paramItem' : '晚高峰结束时间', 'paramValue' : _paramObj.getEPeakEndTimeObj().format("HH:mm")},
  87 + {'paramItem' : '上行进场时间', 'paramValue' : _paramObj.getUpInTime()},
  88 + {'paramItem' : '上行出场时间', 'paramValue' : _paramObj.getUpOutTime()},
  89 + {'paramItem' : '下行进场时间', 'paramValue' : _paramObj.getDownInTime()},
  90 + {'paramItem' : '下行出场时间', 'paramValue' : _paramObj.getDownOutTime()},
  91 + {'paramItem' : '早高峰上行时间', 'paramValue' : _paramObj.getUpMPeakTime()},
  92 + {'paramItem' : '早高峰下行时间', 'paramValue' : _paramObj.getDownMPeakTime()},
  93 + {'paramItem' : '晚高峰上行时间', 'paramValue' : _paramObj.getUpEPeakTime()},
  94 + {'paramItem' : '晚高峰下行时间', 'paramValue' : _paramObj.getDownEPeakTime()},
  95 + {'paramItem' : '低谷上行时间', 'paramValue' : _paramObj.getUpTroughTime()},
  96 + {'paramItem' : '低谷下行时间', 'paramValue' : _paramObj.getDownTroughTime()},
  97 + {'paramItem' : '线路规划类型', 'paramValue' : "双向"},
  98 + {'paramItem' : '吃饭地点', 'paramValue' : _paramObj.fnIsEat() ? (_paramObj.fnIsBothEat() ? "上下行" : (_paramObj.fnIsUpEat() ? "上行" : "下行")) : "不吃饭"},
  99 + {'paramItem' : '早晚例行保养', 'paramValue' : _paramObj.getLbTime()},
  100 + {'paramItem' : '停车场', 'paramValue' : _paramObj.getTccId()},
  101 + {'paramItem' : '工作餐午餐时间', 'paramValue' : _paramObj.fnGetLunchTime()},
  102 + {'paramItem' : '工作餐晚餐时间', 'paramValue' : _paramObj.fnGetDinnerTime()},
  103 + {'paramItem' : '早高峰发车间隔', 'paramValue' : "[" + _paramObj.getMPeakMinFcjx() + "," + _paramObj.getMPeakMaxFcjx() + "]"},
  104 + {'paramItem' : '晚高峰发车间隔', 'paramValue' : "[" + _paramObj.getEPeakMinFcjx() + "," + _paramObj.getEPeakMaxFcjx() + "]"},
  105 + {'paramItem' : '低谷发车间隔', 'paramValue' : "[" + _paramObj.getTroughMinFcjx() + "," + _paramObj.getTroughMaxFcjx() + "]"},
  106 + {'paramItem' : '建议加班路牌数', 'paramValue' : _paramObj.getJBLpes()},
  107 + {'paramItem' : '停站类型', 'paramValue' : _paramObj.isTwoWayStop() ? "双向停站" : (_paramObj.isUpOneWayStop() ? "上行主站" : "下行主站") },
  108 + {'paramItem' : '建议高峰配车数', 'paramValue' : _paramObj.getAdvicePeakClzs()}
  109 + ]
  110 + };
  111 +
  112 + // 计算班次统计数据sheet数据。
  113 + var _fnCalcuExportStatInfo_sheet = function(aBc, oParam) {
  114 + var countBc = 0, // 总班次
  115 + serviceBc = 0, // 营运班次
  116 + jcbc = 0, // 进场总班次.
  117 + ccbc = 0, // 出场总班次.
  118 + cfbc = 0, // 吃饭总班次.
  119 + zwlbbc = 0, // 早晚例保总班次.
  120 + countGs = 0.0, // 总工时
  121 + servicesj = 0, // 营运班次总时间
  122 + jcsj = 0.0, // 进场总时间.
  123 + ccsj = 0.0, // 出场总时间.
  124 + cfsj = 0.0, // 吃饭总时间.
  125 + zwlbsj = 0.0, // 早晚例保总时间.
  126 + ksBc = 0, // 空驶班次
  127 + serviceLc = 0.0, // 营运里程
  128 + ksLc = 0.0, // 空驶里程
  129 + avgTzjx = 0.0, // 平均停站间隙
  130 + gfServiceBc = 0, // 高峰营运班次
  131 + dgServiceBc = 0, // 低谷营运班次
  132 + gfAvgTzjx = 0.0, // 高峰平均停站间隙
  133 + dgAvgTzjx = 0.0; // 低谷平均停站间隙
  134 +
  135 + var i;
  136 + var oBc;
  137 + for (i = 0; i < aBc.length; i++) {
  138 + oBc = aBc[i];
  139 +
  140 + if (oBc.bcsj > 0) {
  141 + countBc = countBc + 1;
  142 + countGs = countGs + oBc.STOPTIME + oBc.bcsj;
  143 + if (oParam.isTroughBc(oParam.toTimeObj(oBc.fcsj))) {
  144 + if (oBc.bcType == "normal") {
  145 + dgServiceBc = dgServiceBc + 1;
  146 + dgAvgTzjx = dgAvgTzjx + oBc.STOPTIME;
  147 + }
  148 + } else {
  149 + if (oBc.bcType == "normal") {
  150 + gfServiceBc = gfServiceBc + 1;
  151 + gfAvgTzjx = gfAvgTzjx + oBc.STOPTIME;
  152 + }
  153 + }
  154 +
  155 + if (oBc.bcType == "normal" || oBc.bcType == "cf") {
  156 + serviceBc = serviceBc + 1;
  157 + serviceLc = serviceLc + oBc.jhlc;
  158 + servicesj = servicesj + oBc.bcsj;
  159 + avgTzjx = avgTzjx + oBc.STOPTIME;
  160 +
  161 + if (oBc.bcType == "cf") {
  162 + cfbc = cfbc + 1;
  163 + cfsj = cfsj + oBc.bcsj;
  164 + }
  165 + } else if (oBc.bcType == "in") {
  166 + jcbc = jcbc + 1;
  167 + jcsj = jcsj + oBc.bcsj;
  168 + } else if (oBc.bcType == "out") {
  169 + ccbc = ccbc + 1;
  170 + ccsj = ccsj + oBc.bcsj;
  171 + } else if (oBc.bcType == "bd") {
  172 + zwlbbc = zwlbbc + 1;
  173 + zwlbsj = zwlbsj + oBc.bcsj;
  174 + } else if (oBc.bcType == "lc") {
  175 + zwlbbc = zwlbbc + 1;
  176 + zwlbsj = zwlbsj + oBc.bcsj;
  177 + }
  178 + }
  179 + }
  180 +
  181 + dgAvgTzjx = dgAvgTzjx / dgServiceBc;
  182 + gfAvgTzjx = gfAvgTzjx / gfServiceBc;
  183 + avgTzjx = avgTzjx / dgServiceBc;
  184 +
  185 + return [
  186 + {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc},
  187 + {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc},
  188 + {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc},
  189 + {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc},
  190 + {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc},
  191 + {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc},
  192 + {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60},
  193 + {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60},
  194 + {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60},
  195 + {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60},
  196 + {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60},
  197 + {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60},
  198 + {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc},
  199 + {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc},
  200 + {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc},
  201 + {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx},
  202 + {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc},
  203 + {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc},
  204 + {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx},
  205 + {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx},
  206 + {'statItem': '综合评估', 'statValue': 3}
  207 + ];
  208 +
  209 + };
  210 +
  211 + /**
  212 + * 内部计算Excel班次方法1,
  213 + * 这里是假设班次按照从早到晚排序,并且路牌也是从小到大排序。
  214 + * @param aExcelLp excel显示用路牌
  215 + * @param aGanttBc 甘特图班次列表
  216 + * @param oParam 参数对象
  217 + * @param bQIsUp 每一圈是上行开始还是下行开始
  218 + * @private
  219 + */
  220 + function InternalCalcuExcelBc1(aExcelLp, aGanttBc, oParam, bQIsUp) {
  221 + this._aExcelLp = aExcelLp;
  222 + this._oParam = oParam;
  223 + this._bQIsUp = bQIsUp;
  224 +
  225 + this._iUpGroupIndex = 0;
  226 + this._iDownGroupIndex = 0;
  227 +
  228 + // {"路牌名字":{"isFlag": 是否为标记班次(表示扫描过但是没有班次对象),"normal":正常班次}}
  229 + this._oLpGroupNormalGanttBc = {};
  230 + // [吃饭类型班次]
  231 + this._aLpGroupCfGanttBc = [];
  232 +
  233 + // TODO:其他类型的班次再议
  234 +
  235 + // 计算上行gantt班次列表,下行gantt班次列表,并排序
  236 + var i;
  237 + var oGanttBc;
  238 + this._aUpGanttBc = [];
  239 + this._aDownGanttBc = [];
  240 + for (i = 0; i < aGanttBc.length; i++) {
  241 + oGanttBc = aGanttBc[i];
  242 + if (oGanttBc.xlDir == "relationshipGraph-up") {
  243 + this._aUpGanttBc.push(oGanttBc);
  244 + } else {
  245 + this._aDownGanttBc.push(oGanttBc);
  246 + }
  247 + }
  248 + // 排序班次
  249 + this._fnSortBc(this._aUpGanttBc);
  250 + this._fnSortBc(this._aDownGanttBc);
  251 +
  252 + if (this._aUpGanttBc.length == 0) {
  253 + throw "没有上行班次,不能导出数据!";
  254 + }
  255 + if (this._aDownGanttBc.length == 0) {
  256 + throw "没有下行班次,不能导出数据!"
  257 + }
  258 +
  259 + }
  260 +
  261 + //----------------------- 外部方法 -----------------------//
  262 + InternalCalcuExcelBc1.prototype.fnGenerateExcelLpBcList = function() {
  263 + // 计算Excel班次
  264 + this._calcuExcelBc();
  265 +
  266 + // 设置路牌圈数
  267 + var iGroupCount = this._iUpGroupIndex > this._iDownGroupIndex ?
  268 + (this._iUpGroupIndex + 1) : (this._iDownGroupIndex + 1);
  269 +
  270 + // 设置路由id
  271 + var oUpNormalBc;
  272 + var oDownNormalBc;
  273 + var i;
  274 + for (i = 0; i < this._aUpGanttBc.length; i++) {
  275 + if (this._aUpGanttBc[i].bcType == "normal") {
  276 + oUpNormalBc = this._aUpGanttBc[i];
  277 + break;
  278 + }
  279 + }
  280 + for (i = 0; i < this._aDownGanttBc.length; i++) {
  281 + if (this._aDownGanttBc[i].bcType == "normal") {
  282 + oDownNormalBc = this._aDownGanttBc[i];
  283 + break;
  284 + }
  285 + }
  286 +
  287 + var stationRouteId1;
  288 + var stationRouteId2;
  289 + if (this._bQIsUp) {
  290 + stationRouteId1 = oUpNormalBc.qdz;
  291 + stationRouteId2 = oDownNormalBc.qdz;
  292 + } else {
  293 + stationRouteId1 = oDownNormalBc.qdz;
  294 + stationRouteId2 = oUpNormalBc.qdz;
  295 + }
  296 +
  297 + var oExcelLp;
  298 + for (i = 0; i < this._aExcelLp.length; i++) {
  299 + oExcelLp = this._aExcelLp[i];
  300 + oExcelLp.groupCount = iGroupCount;
  301 + oExcelLp.stationRouteId1 = stationRouteId1;
  302 + oExcelLp.stationRouteId2 = stationRouteId2;
  303 +
  304 + // 删除临时参数
  305 + delete oExcelLp["_bcObjGroupList"];
  306 + }
  307 +
  308 + // 路牌数据统计
  309 + var j = 0;
  310 + var aLpBc;
  311 + var oLpBc;
  312 + for (i = 0; i < this._aExcelLp.length; i++) {
  313 + oExcelLp = this._aExcelLp[i];
  314 + aLpBc = oExcelLp.bcObjList;
  315 + for (j = 0; j < aLpBc.length; j++) {
  316 + oLpBc = aLpBc[j];
  317 + if (oLpBc.bcType == "normal") {
  318 + oExcelLp.zlc = oExcelLp.zlc +
  319 + oLpBc._bclc; // 总里程
  320 + oExcelLp.yylc = oExcelLp.yylc +
  321 + oLpBc._bclc; // 营运里程
  322 + oExcelLp.yygs = oExcelLp.yygs +
  323 + oLpBc.bcsj + // 班次时间
  324 + oLpBc.ssj + // 停站时间
  325 + oLpBc.eatsj; // 吃饭时间
  326 + oExcelLp.yybc = oExcelLp.yybc + 1;
  327 +
  328 + oExcelLp.zgs = oExcelLp.zgs +
  329 + oLpBc.bcsj + // 班次时间
  330 + oLpBc.ssj + // 停站时间
  331 + oLpBc.eatsj; // 吃饭时间
  332 + oExcelLp.zbc = oExcelLp.zbc + 1;
  333 + } else if (
  334 + oLpBc.bcType == "bd" ||
  335 + oLpBc.bcType == "out" ||
  336 + oLpBc.bcType == "in" ||
  337 + oLpBc.bcType == "lc") {
  338 + oExcelLp.kslc = oExcelLp.kslc +
  339 + oLpBc._bclc; // 里程
  340 + oExcelLp.zlc = oExcelLp.zlc +
  341 + oLpBc._bclc; // 里程
  342 + oExcelLp.zgs = oExcelLp.zgs +
  343 + oLpBc.bcsj + // 班次时间
  344 + oLpBc.ssj; // 停站时间
  345 +
  346 + if (oLpBc.bcType != "bd" && oLpBc.bcType != "lc") {
  347 + oExcelLp.zbc = oExcelLp.zbc + 1;
  348 + }
  349 +
  350 + }
  351 +
  352 + delete oLpBc._bclc; // 删除临时变量
  353 +
  354 + }
  355 + }
  356 +
  357 +
  358 +
  359 + return this._aExcelLp;
  360 + };
  361 +
  362 + //----------------------- 内部方法 ------------------------//
  363 + // 排序班次
  364 + InternalCalcuExcelBc1.prototype._fnSortBc = function(aGanttBc) {
  365 + var oParam = this._oParam;
  366 + aGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
  367 + var o1_fcsj;
  368 + var o2_fcsj;
  369 + if (o1.fcsj.indexOf("00:") >= 0) { // 大于00点是第二天
  370 + o1_fcsj = oParam.toTimeObj(o1.fcsj).add(1, "d");
  371 + } else {
  372 + o1_fcsj = oParam.toTimeObj(o1.fcsj);
  373 + }
  374 +
  375 + if (o2.fcsj.indexOf("00:") >= 0) { // 大于00点是第二天
  376 + o2_fcsj = oParam.toTimeObj(o2.fcsj).add(1, "d");
  377 + } else {
  378 + o2_fcsj = oParam.toTimeObj(o2.fcsj);
  379 + }
  380 +
  381 +
  382 + if (o1_fcsj.isBefore(o2_fcsj)) {
  383 + return -1;
  384 + } else {
  385 + return 1;
  386 + }
  387 + });
  388 + // 此处假设班次按照从早倒晚排,每一圈按照路牌顺序排
  389 +
  390 + // TODO:如果发生同一圈路牌交叉发车,不是按照路牌排序的,导出时有问题,再议
  391 + };
  392 +
  393 + InternalCalcuExcelBc1.prototype._calcuExcelBc = function() {
  394 + var i = 0;
  395 + var j = 0;
  396 +
  397 + var aUpBc;
  398 + var aDownBc;
  399 + if (this._bQIsUp) {
  400 + aUpBc = this._aUpGanttBc;
  401 + aDownBc = this._aDownGanttBc;
  402 + } else {
  403 + aUpBc = this._aDownGanttBc;
  404 + aDownBc = this._aUpGanttBc;
  405 + }
  406 +
  407 + do {
  408 + i = this._calcuExcelBcPerGroup(this._bQIsUp, i);
  409 + j = this._calcuExcelBcPerGroup(!this._bQIsUp, j);
  410 + } while(i < aUpBc.length || j < aDownBc.length);
  411 +
  412 + // 重新计算报到,出场,进场,离场班次的圈,班次索引
  413 + this._resetBdOutInLcBcGroup();
  414 +
  415 + };
  416 +
  417 + /**
  418 + * 重新计算Excel显示班次(计算1圈)。
  419 + * @param bIsUp 是否上行
  420 + * @param iBcIndex 班次索引
  421 + * @return 下一次计算索引
  422 + */
  423 + InternalCalcuExcelBc1.prototype._calcuExcelBcPerGroup = function(bIsUp, iBcIndex) {
  424 + this._oLpGroupNormalGanttBc = {};
  425 +
  426 + var i;
  427 + var j = 0;
  428 + var oExcelLp;
  429 + var oGanttBc;
  430 + var aGBc = bIsUp ? this._aUpGanttBc : this._aDownGanttBc;
  431 +
  432 + for (i = iBcIndex; i < aGBc.length; i++) {
  433 + oGanttBc = aGBc[i];
  434 +
  435 + // 添加到场,出场,进场,离场班次
  436 + this._addBdOutInLcBc(oGanttBc, bIsUp);
  437 +
  438 + while(j < this._aExcelLp.length) {
  439 + oExcelLp = this._aExcelLp[j];
  440 +
  441 + if (oGanttBc.bcType == "cf") { // 吃饭班次
  442 + this._aLpGroupCfGanttBc.push(oGanttBc);
  443 + break;
  444 + } else if (oGanttBc.bcType == "normal") { // 正常班次
  445 + this._oLpGroupNormalGanttBc[oExcelLp.lpname] = {
  446 + "isFlag": true, "normal": null
  447 + };
  448 + if (oExcelLp.lpname == oGanttBc.lpName) {
  449 + this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag = false;
  450 + this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal = oGanttBc;
  451 + j++;
  452 + break;
  453 + } else {
  454 + j++;
  455 + }
  456 + } else {
  457 +
  458 + break;
  459 + }
  460 +
  461 + }
  462 +
  463 + if (j == this._aExcelLp.length) { // 完整的一圈处理
  464 + this._resetCalcuGroup(bIsUp);
  465 + j = 0;
  466 + if (oGanttBc.lpName !=
  467 + this._aExcelLp[this._aExcelLp.length - 1].lpname) {
  468 + i--;
  469 + break;
  470 +
  471 + }
  472 +
  473 + break;
  474 + }
  475 +
  476 + }
  477 +
  478 + // 最后一圈reset一下
  479 + if (j > 0) {
  480 + this._resetCalcuGroup(bIsUp);
  481 + }
  482 + return i + 1;
  483 +
  484 + };
  485 +
  486 + InternalCalcuExcelBc1.prototype._resetCalcuGroup = function(bIsUp) {
  487 + // 判定是否开始分班,添加圈数
  488 + if (bIsUp) {
  489 + if (this._fnIsFBcQ(bIsUp)) {
  490 + this._iUpGroupIndex += 1;
  491 + this._iDownGroupIndex += 1;
  492 + }
  493 + } else {
  494 + if (this._fnIsFBcQ(!bIsUp)) {
  495 + this._iUpGroupIndex += 1;
  496 + this._iDownGroupIndex += 1;
  497 + }
  498 + }
  499 +
  500 + // 重置计算圈及班次
  501 + var oExcelLp;
  502 + var oGroupGanttNormalBc;
  503 + var oGroupGanttEatBc;
  504 + for (var i = 0; i < this._aExcelLp.length; i++) {
  505 + oExcelLp = this._aExcelLp[i];
  506 + if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
  507 + if (!this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag) { // 非标记班次
  508 + oGroupGanttNormalBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
  509 +
  510 + // 获取吃饭班次
  511 + oGroupGanttEatBc = null;
  512 + if (this._aLpGroupCfGanttBc.length > 0) {
  513 + if (this._aLpGroupCfGanttBc[0].lpName == oExcelLp.lpname) {
  514 + if (this._oParam.toTimeObj(this._aLpGroupCfGanttBc[0].fcsj).isBefore(
  515 + this._oParam.toTimeObj(oGroupGanttNormalBc.fcsj))) {
  516 + oGroupGanttEatBc = this._aLpGroupCfGanttBc.shift();
  517 + }
  518 + }
  519 + }
  520 +
  521 + oExcelLp.bcObjList.push({
  522 + "bcsj": oGroupGanttNormalBc.bcsj, // 班次时间
  523 + "ssj": oGroupGanttNormalBc.STOPTIME, // 停站时间
  524 + "eatsj": oGroupGanttEatBc ? oGroupGanttEatBc.bcsj : 0, // 吃饭时间
  525 +
  526 + "tccid": oGroupGanttNormalBc.tcc, // 停车场id
  527 + "qdzid": oGroupGanttNormalBc.qdz, // 起点站id
  528 + "zdzid": oGroupGanttNormalBc.zdz, // 终点站id
  529 +
  530 + "isUp": bIsUp, // 是否上行
  531 +
  532 + "bcType": oGroupGanttNormalBc.bcType, // 班次类型
  533 + "fcsj": oGroupGanttEatBc ?
  534 + ("*" + oGroupGanttNormalBc.fcsj) :
  535 + oGroupGanttNormalBc.fcsj, // 发车时间描述
  536 + "fcsjDesc": oGroupGanttEatBc ?
  537 + ("(吃" + oGroupGanttNormalBc.fcsj + ")") :
  538 + oGroupGanttNormalBc.fcsj, // 发车时间描述2
  539 +
  540 + "groupNo": bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
  541 + "groupBcNo": bIsUp == this._bQIsUp ? 0 : 1, // 圈里第几个班次
  542 +
  543 + "_bclc": oGroupGanttNormalBc.jhlc // 班次里程(最后需要删除)
  544 +
  545 + });
  546 +
  547 + oExcelLp._bcObjGroupList.push({
  548 + fcsj: oGroupGanttNormalBc.fcsj, // 发车时间
  549 + groupIndex: bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
  550 + bcIndex: bIsUp == this._bQIsUp ? 0 : 1 // 圈里第几个班次
  551 + });
  552 + }
  553 + }
  554 + }
  555 +
  556 + if (bIsUp) {
  557 + this._iUpGroupIndex ++;
  558 + } else {
  559 + this._iDownGroupIndex ++;
  560 + }
  561 + this._oLpGroupNormalGanttBc = {};
  562 + };
  563 +
  564 + // 添加报到,出场,进场,离场班次
  565 + InternalCalcuExcelBc1.prototype._addBdOutInLcBc = function(oGanttBc, bIsUp) {
  566 + var i;
  567 + var oExcelLp;
  568 + var bcType;
  569 + for (i = 0; i < this._aExcelLp.length; i++) {
  570 + oExcelLp = this._aExcelLp[i];
  571 + if (oGanttBc.lpName == oExcelLp.lpname) {
  572 + bcType = oGanttBc.bcType;
  573 + if (bcType == "bd" || bcType == "out" || bcType == "in" || bcType == "lc") {
  574 + oExcelLp.bcObjList.push({
  575 + "bcsj": oGanttBc.bcsj, // 班次时间
  576 + "ssj": oGanttBc.STOPTIME, // 停站时间
  577 + "eatsj": 0, // 吃饭时间
  578 +
  579 + "tccid": oGanttBc.tcc, // 停车场id
  580 + "qdzid": oGanttBc.qdz, // 起点站id
  581 + "zdzid": oGanttBc.zdz, // 终点站id
  582 +
  583 + "isUp": bIsUp, // 是否上行
  584 + "isFb": null, // 是否分班(_resetBdOutInLcBcGroup方法修正)
  585 +
  586 + "bcType": oGanttBc.bcType, // 班次类型(bc、out、in、lc)
  587 + "fcsj": oGanttBc.fcsj, // 发车时间描述
  588 +
  589 + "groupNo": -99, // 第几圈(_resetBdOutInLcBcGroup方法修正)
  590 + "groupBcNo": -99, // 圈里第几个班次(_resetBdOutInLcBcGroup方法修正)
  591 +
  592 + "_bclc": oGanttBc.jhlc // 班次里程(最后需要删除)
  593 + });
  594 + break;
  595 + }
  596 + }
  597 + }
  598 +
  599 + };
  600 + // 重新计算报到,出场,进场,离场班次的圈索引及班次索引
  601 + InternalCalcuExcelBc1.prototype._resetBdOutInLcBcGroup = function() {
  602 + var i;
  603 + var j;
  604 + var k;
  605 + var sFcsjDesc = [];
  606 + var oExcelLp;
  607 + var oLpBc;
  608 +
  609 + // {"bd":到场班次index,"out":出场班次index, "nextBc": 出场后第一个normal班次索引, "nextBcGroup":出场后第一个normal班次group索引}
  610 + var oBdOutLpBc = {};
  611 + // 到场出场班次组合数组
  612 + var aBdOutLpBc = [];
  613 +
  614 + // {"in":进场班次index,"lc":离场班次index, "preBc": 进场前一个normal班次索引, "preBcGroup":进场前一个normal班次group索引}
  615 + var oInLcLpBc = {};
  616 + // 进场离场班次组合数组
  617 + var aInLcLpBc = [];
  618 +
  619 + for (i = 0; i < this._aExcelLp.length; i++) {
  620 + oExcelLp = this._aExcelLp[i];
  621 +
  622 + // 排序oExcelLp班次列表
  623 + this._fnSortBc(oExcelLp.bcObjList);
  624 +
  625 + aBdOutLpBc = [];
  626 + aInLcLpBc = [];
  627 +
  628 + for (j = 0; j < oExcelLp.bcObjList.length; j++) {
  629 + oLpBc = oExcelLp.bcObjList[j];
  630 +
  631 + if (oLpBc.bcType == "out") { // 出场班次
  632 + oBdOutLpBc = {"bd": null, "out": null, "nextBc": null, "nextBcGroup": null};
  633 + oBdOutLpBc["out"] = j;
  634 + // 查找上一个班次是否是报到班次(不存在有可能,中间分班班次可能没有报到时间)
  635 + if ((j - 1) >= 0 && (j - 1) < oExcelLp.bcObjList.length) {
  636 + if (oExcelLp.bcObjList[j - 1].bcType == "bd") {
  637 + oBdOutLpBc["bd"] = j - 1;
  638 + }
  639 + }
  640 + // 查找下一个班次是否是normal班次(不存在或者不是normal班次,这个报到出场班次组合忽略)
  641 + if ((j + 1) < oExcelLp.bcObjList.length) {
  642 + if (oExcelLp.bcObjList[j + 1].bcType == "normal") {
  643 + for (k = 0; k < oExcelLp._bcObjGroupList.length; k++) {
  644 + if (oExcelLp.bcObjList[j + 1].fcsj == oExcelLp._bcObjGroupList[k].fcsj) {
  645 + oBdOutLpBc["nextBc"] = j + 1;
  646 + oBdOutLpBc["nextBcGroup"] = k;
  647 + aBdOutLpBc.push(oBdOutLpBc);
  648 + break;
  649 + }
  650 + }
  651 + }
  652 + }
  653 + } else if (oLpBc.bcType == "in") { // 进场班次
  654 + oInLcLpBc = {"in": null, "lc": null, "preBc": null, "preBcGroup": null};
  655 + oInLcLpBc["in"] = j;
  656 + // 查找系一个班次是否是离场班次(不存在有可能,中间分班班次可能没有离场时间)
  657 + if ((j + 1) < oExcelLp.bcObjList.length) {
  658 + if (oExcelLp.bcObjList[j + 1].bcType == "lc") {
  659 + oInLcLpBc["lc"] = j + 1;
  660 + }
  661 + }
  662 + // 查找上一个班次是否是normal班次(不存在或者不是normal班次,这个进场离场班次组合忽略)
  663 + if ((j - 1) >= 0 && (j - 1) < oExcelLp.bcObjList.length) {
  664 + if (oExcelLp.bcObjList[j - 1].bcType == "normal") {
  665 + for (k = 0; k < oExcelLp._bcObjGroupList.length; k++) {
  666 + if (oExcelLp.bcObjList[j - 1].fcsj == oExcelLp._bcObjGroupList[k].fcsj) {
  667 + oInLcLpBc["preBc"] = j - 1;
  668 + oInLcLpBc["preBcGroup"] = k;
  669 + aInLcLpBc.push(oInLcLpBc);
  670 + break;
  671 + }
  672 + }
  673 + }
  674 + }
  675 +
  676 + }
  677 +
  678 + }
  679 +
  680 + if (aBdOutLpBc.length == 2) { // 分班(以出场班次为主)
  681 + // 处理第一个出场
  682 + sFcsjDesc = [];
  683 + oBdOutLpBc = aBdOutLpBc[0];
  684 + if (oBdOutLpBc.bd != null) {
  685 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
  686 + oLpBc.isFb = false;
  687 + oLpBc.groupNo = -1;
  688 + oLpBc.groupBcNo = -1;
  689 + sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
  690 + }
  691 +
  692 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
  693 + oLpBc.isFb = false;
  694 + oLpBc.groupNo = -1;
  695 + oLpBc.groupBcNo = -2;
  696 + sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
  697 +
  698 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
  699 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  700 + oLpBc.fcsjDesc = sFcsjDesc.join("");
  701 +
  702 + // 处理第二个出场
  703 + sFcsjDesc = [];
  704 + oBdOutLpBc = aBdOutLpBc[1];
  705 + if (oBdOutLpBc.bd != null) {
  706 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
  707 + oLpBc.isFb = true;
  708 + oLpBc.groupNo = oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex - 1;
  709 + oLpBc.groupBcNo = oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex;
  710 + sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
  711 + }
  712 +
  713 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
  714 + oLpBc.isFb = true;
  715 + oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex == 0) ?
  716 + (oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex - 1) :
  717 + oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].groupIndex);
  718 + oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oBdOutLpBc.nextBcGroup].bcIndex == 0) ? 1 : 0);
  719 + sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
  720 +
  721 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
  722 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  723 + oLpBc.fcsjDesc = sFcsjDesc.join("");
  724 +
  725 + // 2个以上进场班次,处理第一个和第二个,第一个做为中间进场
  726 + if (aInLcLpBc.length >= 2) {
  727 + sFcsjDesc = [];
  728 + oInLcLpBc = aInLcLpBc[0];
  729 +
  730 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
  731 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  732 +
  733 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
  734 + oLpBc.isFb = true;
  735 + oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
  736 + oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
  737 + (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
  738 + oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
  739 + sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
  740 +
  741 + oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
  742 +
  743 + sFcsjDesc = [];
  744 + oInLcLpBc = aInLcLpBc[1];
  745 +
  746 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
  747 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  748 +
  749 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
  750 + oLpBc.isFb = false;
  751 + oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
  752 + oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
  753 + (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
  754 + oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
  755 + sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
  756 +
  757 + if (oInLcLpBc.lc) {
  758 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
  759 + oLpBc.isFb = false;
  760 + oLpBc.groupNo = -2;
  761 + oLpBc.groupBcNo = -4;
  762 + sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
  763 + }
  764 + oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
  765 + }
  766 +
  767 + // 一个进场班次,做为最后一个进场班次处理
  768 + if (aInLcLpBc.length == 1) {
  769 + sFcsjDesc = [];
  770 + oInLcLpBc = aInLcLpBc[0];
  771 +
  772 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
  773 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  774 +
  775 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
  776 + oLpBc.isFb = false;
  777 + oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
  778 + oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
  779 + (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
  780 + oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
  781 + sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
  782 +
  783 + if (oInLcLpBc.lc) {
  784 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
  785 + oLpBc.isFb = false;
  786 + oLpBc.groupNo = -2;
  787 + oLpBc.groupBcNo = -4;
  788 + sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
  789 + }
  790 + oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
  791 + }
  792 +
  793 +
  794 + } else if (aBdOutLpBc.length == 1) {
  795 + // 处理出场
  796 + sFcsjDesc = [];
  797 + oBdOutLpBc = aBdOutLpBc[0];
  798 + if (oBdOutLpBc.bd != null) {
  799 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.bd];
  800 + oLpBc.isFb = false;
  801 + oLpBc.groupNo = -1;
  802 + oLpBc.groupBcNo = -1;
  803 + sFcsjDesc.push("(到" + oLpBc.fcsj + ")");
  804 + }
  805 +
  806 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.out];
  807 + oLpBc.isFb = false;
  808 + oLpBc.groupNo = -1;
  809 + oLpBc.groupBcNo = -2;
  810 + sFcsjDesc.push("(出" + oLpBc.fcsj + ")");
  811 +
  812 + oLpBc = oExcelLp.bcObjList[oBdOutLpBc.nextBc];
  813 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  814 + oLpBc.fcsjDesc = sFcsjDesc.join("");
  815 +
  816 + // 处理进场
  817 + if (aInLcLpBc.length > 0) {
  818 + sFcsjDesc = [];
  819 + oInLcLpBc = aInLcLpBc[0];
  820 +
  821 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.preBc];
  822 + sFcsjDesc.push("(" + oLpBc.fcsj + ")");
  823 +
  824 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.in];
  825 + oLpBc.isFb = false;
  826 + oLpBc.groupNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ?
  827 + oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex :
  828 + (oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].groupIndex + 1));
  829 + oLpBc.groupBcNo = ((oExcelLp._bcObjGroupList[oInLcLpBc.preBcGroup].bcIndex == 0) ? 1 : 0);
  830 + sFcsjDesc.push("(进" + oLpBc.fcsj + ")");
  831 +
  832 + if (oInLcLpBc.lc) {
  833 + oLpBc = oExcelLp.bcObjList[oInLcLpBc.lc];
  834 + oLpBc.isFb = false;
  835 + oLpBc.groupNo = -2;
  836 + oLpBc.groupBcNo = -4;
  837 + sFcsjDesc.push("(离" + oLpBc.fcsj + ")");
  838 + }
  839 + oExcelLp.bcObjList[oInLcLpBc.preBc].fcsjDesc = sFcsjDesc.join("");
  840 +
  841 + }
  842 +
  843 + }
  844 +
  845 + // console.log("todo");
  846 +
  847 +
  848 + }
  849 +
  850 + // console.log("ddd");
  851 +
  852 + };
  853 +
  854 + // 判定当前圈是否是有分班后的第一个normal班次
  855 + InternalCalcuExcelBc1.prototype._fnIsFBcQ = function(bIsUp) {
  856 + var oExcelLp;
  857 + var i;
  858 + var oLpPreExcelBc;
  859 + var oLpCurGranttBc;
  860 + var oPreBcFcsj;
  861 + var oCurBcFcsj;
  862 + var idiffTime;
  863 + var bFbFlag = false;
  864 + for (i = 0; i < this._aExcelLp.length; i++) {
  865 + oExcelLp = this._aExcelLp[i];
  866 + if (oExcelLp.bcObjList.length > 0) {
  867 + oLpPreExcelBc = oExcelLp.bcObjList[oExcelLp.bcObjList.length - 1];
  868 + if (oLpPreExcelBc.bcType == "normal") {
  869 + oPreBcFcsj = this._oParam.toTimeObj(
  870 + oLpPreExcelBc.fcsj.indexOf("*") >= 0 ? oLpPreExcelBc.fcsj.substr(1) : oLpPreExcelBc.fcsj
  871 + );
  872 + if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
  873 + oLpCurGranttBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
  874 + if (oLpCurGranttBc) {
  875 + oCurBcFcsj = this._oParam.toTimeObj(oLpCurGranttBc.fcsj);
  876 + idiffTime = oCurBcFcsj.diff(oPreBcFcsj, "m");
  877 + if (idiffTime > oLpPreExcelBc.bcsj * 3) {
  878 + bFbFlag = true;
  879 + break;
  880 + }
  881 + }
  882 + }
  883 + }
  884 + }
  885 +
  886 + }
  887 +
  888 + return bFbFlag;
  889 +
  890 + };
  891 +
  892 + /**
  893 + * 内部Excel对象。
  894 + * @param oParam 参数对象
  895 + * @param fnGetGanttBcArray 返回gantt用的班次列表
  896 + * @constructor
  897 + */
  898 + function InternalExcelObj(oParam, fnGetGanttBcArray) {
  899 + // 参数对象
  900 + this._oParam = oParam;
  901 + // 获取gantt班次的方法
  902 + this._fnBc = fnGetGanttBcArray;
  903 +
  904 + // 每一圈是上行开始还是下行开始
  905 + this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
  906 +
  907 + }
  908 +
  909 + // html5导出excel方法
  910 + InternalExcelObj.prototype.downloadFile = function(data, mimeType, fileName) {
  911 + _fnDownloadFile(data, mimeType, fileName);
  912 + };
  913 + /**
  914 + * 获取班次统计数据。
  915 + */
  916 + InternalExcelObj.prototype.fnGetStatInfoList = function() {
  917 + return _fnCalcuExportStatInfo_sheet(this._fnBc(), this._oParam);
  918 + };
  919 + /**
  920 + * 获取参数数据。
  921 + */
  922 + InternalExcelObj.prototype.fnGetParamInfoList = function() {
  923 + return _fnCalcuExportParam_sheet(this._oParam);
  924 + };
  925 + /**
  926 + * 获取路牌班次数据。
  927 + * @return {*}
  928 + */
  929 + InternalExcelObj.prototype.fnGetLpBcInfoList = function() {
  930 + // 构造显示用lp对象
  931 + var oTempLpFlag = {};
  932 + var aGanttBc = this._fnBc();
  933 + var oGanttBc;
  934 + var aLp = [];
  935 + var oLp;
  936 + var i;
  937 + for (i = 0; i < aGanttBc.length; i++) {
  938 + oGanttBc = aGanttBc[i];
  939 + if (oTempLpFlag[oGanttBc.lpName]) {
  940 + // 已经存在路牌,不处理
  941 + continue;
  942 + }
  943 +
  944 + oLp = {
  945 + "lpname": oGanttBc.lpName, // 路牌名字
  946 + "isUp": this._qIsUp, // 每圈的第一个班次是否上行
  947 + "bcObjList": [], // 内部班次列表(后面计算班次列表)
  948 + "_bcObjGroupList": [], // 每个normal班次对应的group对象 {fcsj: 发车时间, groupIndex: 圈索引, bcIndex: 班次索引},最后返回要删除
  949 + "groupCount": 0, // 总圈数(后面计算总圈数)
  950 + "zlc": 0, // 总里程
  951 + "yylc": 0, // 营运里程
  952 + "kslc": 0, // 空驶里程
  953 + "zgs": 0, // 总工时
  954 + "zbc": 0, // 总班次
  955 + "yygs": 0, // 营运工时
  956 + "yybc": 0, // 营运班次
  957 + "stationRouteId1": 0, // 第一个班次起点站路由id
  958 + "stationRouteId2": 0 // 第二个班次起点站路由id
  959 + };
  960 + oTempLpFlag[oGanttBc.lpName] = {"flag" : true}; // 标记一下
  961 + aLp.push(oLp);
  962 + }
  963 +
  964 + // 计算Excel班次
  965 + var _celb = new InternalCalcuExcelBc1(aLp, aGanttBc, this._oParam, this._qIsUp);
  966 + return _celb.fnGenerateExcelLpBcList();
  967 + };
  968 +
  969 + return InternalExcelObj;
  970 +
971 971 } ());
972 972 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/main_v2_2.js
1   -/**
2   - * 主类(v2_2版本)。
3   - */
4   -var Main_v2_2 = function() {
5   -
6   - var _paramObj; // 参数对象
7   -
8   - return {
9   - /**
10   - * 使用发车间隔策略生成时刻表。
11   - * @param paramObj 参数对象
12   - * @param lpArray 路牌数组
13   - * @constructor
14   - */
15   - BXPplaceClassesTime03 : function(paramObj, lpArray) {
16   - // 参数对象
17   - _paramObj = paramObj;
18   -
19   - // // 测试行驶时间
20   - // var _fcsj = paramObj.toTimeObj("16:20");
21   - // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间
22   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
23   - //
24   -
25   - // // 测试停站时间
26   - // var _fcsj = paramObj.toTimeObj("05:30");
27   - // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
28   - // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
29   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime);
30   - //
31   - // var schedule = {};
32   -
33   - // // 测试间隔时间
34   - // var _fcsj = paramObj.toTimeObj("07:30");
35   - // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj);
36   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway);
37   -
38   - // 1、初始化行车计划
39   - var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray);
40   - // 2、生成班次(从第2圈开始)
41   - schedule.fnCreateBclistWithMasterBc(2, 20);
42   - // 3、调整发车间隔
43   - schedule.fnAdjustHeadway();
44   - // 4、计算吃饭班次
45   - schedule.fnCalcuEatBc();
46   - // // 6、计算末班车
47   - // schedule.fnCalcuLastBc();
48   - // 7、重新设置停站时间
49   - schedule.fnReSetLayoverTime();
50   - // 8、补进出场例保班次
51   - schedule.fnCalcuOtherBc();
52   -
53   - //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
54   - // TODO:班型再议
55   - return {
56   - 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
57   - 'aInternalLpObj': schedule.fnGetLpArray()
58   - };
59   - },
60   -
61   - //----------------------------------- 导入导出配置 -----------------------------------//
62   -
63   - /**
64   - * 导出时刻表配置。
65   - * @param fnGetGanttBc 获取gantt班次方法
66   - */
67   - exportExcelConfig: function(fnGetGanttBc) {
68   - var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc);
69   -
70   - $('.exportAddXls').off('click');
71   - $('.exportAddXlsx').off('click');
72   -
73   - $('.exportAddXls').on('click', function() {
74   -
75   - var aInfos = {
76   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
77   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
78   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
79   - };
80   -
81   - console.log(aInfos);
82   -
83   - $(".exportAdd").addClass("disabled");
84   - $(".exportAddSpan").html("正在导出...");
85   -
86   - // 提交
87   - $.ajax({
88   - type: 'POST',
89   - url: "/tidc/exportDTDFile/xls",
90   - dataType: 'binary',
91   - contentType: "application/json",
92   - data: JSON.stringify(aInfos),
93   - success: function(data){
94   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
95   -
96   - $(".exportAdd").removeClass("disabled");
97   - $(".exportAddSpan").html(" 导出数据");
98   - },
99   - error: function(xhr, type){
100   - alert('错误:TODO');
101   -
102   - $(".exportAdd").removeClass("disabled");
103   - $(".exportAddSpan").html(" 导出数据");
104   - }
105   - });
106   - });
107   -
108   - $('.exportAddXlsx').on('click', function() {
109   - var aInfos = {
110   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
111   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
112   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
113   - };
114   -
115   - console.log(aInfos);
116   -
117   - $(".exportAdd").addClass("disabled");
118   - $(".exportAddSpan").html("正在导出...");
119   -
120   - // 提交
121   - $.ajax({
122   - type: 'POST',
123   - url: "/tidc/exportDTDFile/xlsx",
124   - dataType: 'binary',
125   - contentType: "application/json",
126   - data: JSON.stringify(aInfos),
127   - success: function(data){
128   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
129   -
130   - $(".exportAdd").removeClass("disabled");
131   - $(".exportAddSpan").html(" 导出数据");
132   - },
133   - error: function(xhr, type){
134   - alert('错误:TODO');
135   -
136   - $(".exportAdd").removeClass("disabled");
137   - $(".exportAddSpan").html(" 导出数据");
138   - }
139   - });
140   - });
141   - }
142   -
143   -
144   - }
  1 +/**
  2 + * 主类(v2_2版本)。
  3 + */
  4 +var Main_v2_2 = function() {
  5 +
  6 + var _paramObj; // 参数对象
  7 +
  8 + return {
  9 + /**
  10 + * 使用发车间隔策略生成时刻表。
  11 + * @param paramObj 参数对象
  12 + * @param lpArray 路牌数组
  13 + * @constructor
  14 + */
  15 + BXPplaceClassesTime03 : function(paramObj, lpArray) {
  16 + // 参数对象
  17 + _paramObj = paramObj;
  18 +
  19 + // // 测试行驶时间
  20 + // var _fcsj = paramObj.toTimeObj("16:20");
  21 + // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间
  22 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
  23 + //
  24 +
  25 + // // 测试停站时间
  26 + // var _fcsj = paramObj.toTimeObj("05:30");
  27 + // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  28 + // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
  29 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime);
  30 + //
  31 + // var schedule = {};
  32 +
  33 + // // 测试间隔时间
  34 + // var _fcsj = paramObj.toTimeObj("07:30");
  35 + // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj);
  36 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway);
  37 +
  38 + // 1、初始化行车计划
  39 + var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray);
  40 + // 2、生成班次(从第2圈开始)
  41 + schedule.fnCreateBclistWithMasterBc(2, 20);
  42 + // 3、调整发车间隔
  43 + schedule.fnAdjustHeadway();
  44 + // 4、计算吃饭班次
  45 + schedule.fnCalcuEatBc();
  46 + // // 6、计算末班车
  47 + // schedule.fnCalcuLastBc();
  48 + // 7、重新设置停站时间
  49 + schedule.fnReSetLayoverTime();
  50 + // 8、补进出场例保班次
  51 + schedule.fnCalcuOtherBc();
  52 +
  53 + //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
  54 + // TODO:班型再议
  55 + return {
  56 + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
  57 + 'aInternalLpObj': schedule.fnGetLpArray()
  58 + };
  59 + },
  60 +
  61 + //----------------------------------- 导入导出配置 -----------------------------------//
  62 +
  63 + /**
  64 + * 导出时刻表配置。
  65 + * @param fnGetGanttBc 获取gantt班次方法
  66 + */
  67 + exportExcelConfig: function(fnGetGanttBc) {
  68 + var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc);
  69 +
  70 + $('.exportAddXls').off('click');
  71 + $('.exportAddXlsx').off('click');
  72 +
  73 + $('.exportAddXls').on('click', function() {
  74 +
  75 + var aInfos = {
  76 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  77 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  78 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  79 + };
  80 +
  81 + console.log(aInfos);
  82 +
  83 + $(".exportAdd").addClass("disabled");
  84 + $(".exportAddSpan").html("正在导出...");
  85 +
  86 + // 提交
  87 + $.ajax({
  88 + type: 'POST',
  89 + url: "/tidc/exportDTDFile/xls",
  90 + dataType: 'binary',
  91 + contentType: "application/json",
  92 + data: JSON.stringify(aInfos),
  93 + success: function(data){
  94 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
  95 +
  96 + $(".exportAdd").removeClass("disabled");
  97 + $(".exportAddSpan").html(" 导出数据");
  98 + },
  99 + error: function(xhr, type){
  100 + alert('错误:TODO');
  101 +
  102 + $(".exportAdd").removeClass("disabled");
  103 + $(".exportAddSpan").html(" 导出数据");
  104 + }
  105 + });
  106 + });
  107 +
  108 + $('.exportAddXlsx').on('click', function() {
  109 + var aInfos = {
  110 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  111 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  112 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  113 + };
  114 +
  115 + console.log(aInfos);
  116 +
  117 + $(".exportAdd").addClass("disabled");
  118 + $(".exportAddSpan").html("正在导出...");
  119 +
  120 + // 提交
  121 + $.ajax({
  122 + type: 'POST',
  123 + url: "/tidc/exportDTDFile/xlsx",
  124 + dataType: 'binary',
  125 + contentType: "application/json",
  126 + data: JSON.stringify(aInfos),
  127 + success: function(data){
  128 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
  129 +
  130 + $(".exportAdd").removeClass("disabled");
  131 + $(".exportAddSpan").html(" 导出数据");
  132 + },
  133 + error: function(xhr, type){
  134 + alert('错误:TODO');
  135 +
  136 + $(".exportAdd").removeClass("disabled");
  137 + $(".exportAddSpan").html(" 导出数据");
  138 + }
  139 + });
  140 + });
  141 + }
  142 +
  143 +
  144 + }
145 145 }();
146 146 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/strategy/headway/AdjustHeadwayS1.js
1   -/**
2   - * 调整某一圈的发车间隔,在已有的间隔上做修正。
3   - * 1、圈的第一个班次,最后一个班次发车时间固定不变,调整其余班次间隔
4   - * 2、调整的判定原则是某个班次和该路牌下一个班次之间的layovertime为负值,需要调整当前班次间隔
5   - * 3、TODO:如果仅靠调整间隔无法调整,可以考虑删除某个路牌的班次
6   - * 4、TODO:目前只用在第一圈第一个方向班次列表上,低谷在前,高峰在后
7   - */
8   -var AdjustHeadwayS1 = (function() {
9   -
10   - /**
11   - * 从指定路牌的班次开始往下所有的班次发车时间尝试减一分钟。
12   - * @param aLp 路牌数组
13   - * @param lpIndex 从下往上第一个停站时间不足的班次所在路牌索引
14   - * @param iCurrentGroupIndex 班次圈索引
15   - * @param iCurrentBcIndex 班次索引
16   - * @param oParam 参数对象
17   - */
18   - function _a_down(aLp, lpIndex, iCurrentGroupIndex, iCurrentBcIndex, oParam) {
19   - // 如果最后一个路牌的班次就停站时间不足,则不调整
20   - if (lpIndex == aLp.length - 1) {
21   - return false;
22   - }
23   - // 有班次的路牌索引数组(往下)
24   - var i;
25   - var aLpIndex = [];
26   - for (i = lpIndex; i < aLp.length; i++) {
27   - if (aLp[i].getBc(iCurrentGroupIndex, iCurrentBcIndex)) {
28   - aLpIndex.push(i);
29   - }
30   - }
31   -
32   - // 当前班次开始与下一个路牌的对应班次的发车时间间隔
33   - var aHeadWay = [];
34   - var oHeadWay;
35   - for (i = 0; i < aLpIndex.length - 1; i++) {
36   - oHeadWay = {};
37   - oHeadWay.iStartLpIndex = aLpIndex[i];
38   - oHeadWay.iEndLpIndex = aLpIndex[i + 1];
39   - if (oParam.isMPeakBc(aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj())) {
40   - oHeadWay.bMPeakBc = true;
41   - } else {
42   - oHeadWay.bMPeakBc = false;
43   - }
44   - oHeadWay.iHeadWay = aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj().diff(
45   - aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj(), "m"
46   - );
47   -
48   - aHeadWay.push(oHeadWay);
49   - }
50   -
51   - // 找出第一个间隔小于高峰最大发车间隔的位置,
52   - // 然后从lpIndex开始到这个位置减发车时间,
53   - // 从而达到从lpIndex开始到这个位置,局部减少发车时间的作用
54   - // 最终的结果是停站时间足够,并且停站时间也是一个过渡效果
55   - var bIsFind = false;
56   - var iFindIndex;
57   - for (i = 0; i < aHeadWay.length; i++) {
58   - if (aHeadWay[i].bMPeakBc) {
59   - if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
60   - iFindIndex = i;
61   - bIsFind = true;
62   - break;
63   - }
64   - } else {
65   - iFindIndex = i;
66   - bIsFind = true;
67   - break;
68   - }
69   - }
70   -
71   - if (!bIsFind) {
72   - return false;
73   - }
74   -
75   - // 调整间隔
76   - var iStartLpIndex = aHeadWay[iFindIndex].iStartLpIndex;
77   - var oLp;
78   - var oBc;
79   - for (i = 0; i < aLpIndex.length; i++) {
80   - if (aLpIndex[i] <= iStartLpIndex && aLpIndex[i] > lpIndex) {
81   - oLp = aLp[aLpIndex[i]];
82   - oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
83   - oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
84   -
85   - oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
86   - iCurrentGroupIndex, iCurrentBcIndex,
87   - oLp.fnGetVerticalIntervalTime(iCurrentGroupIndex, iCurrentBcIndex) - 1);
88   - }
89   - }
90   -
91   - return true;
92   - }
93   - // // TODO:向上局部减少发车调整有问题,不能下上所有的班次都减发车时间,需要像_a_down逐步减,下次修正
94   - // function _a_up2(lpIndex, aLp,
95   - // iCurrentGroupIndex, iCurrentBcIndex, oParam) {
96   - // // 有班次的路牌索引数组(往上)
97   - // var i;
98   - // var aLpIndex = [];
99   - // for (i = lpIndex; i >= 0; i--) {
100   - // if (aLp[i].getBc(iCurrentGroupIndex, iCurrentBcIndex)) {
101   - // aLpIndex.push(i);
102   - // }
103   - // }
104   - // // 当前班次开始与下一个路牌的对应班次的发车时间间隔
105   - // var aHeadWay = [];
106   - // var oHeadWay = {};
107   - // for (i = 0; i < aLpIndex.length - 1; i++) {
108   - // oHeadWay = {};
109   - // oHeadWay.iStartLpIndex = aLpIndex[i + 1];
110   - // oHeadWay.iEndLpIndex = aLpIndex[i];
111   - // if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj())) {
112   - // oHeadWay.bMPeakBc = true;
113   - // } else {
114   - // oHeadWay.bMPeakBc = false;
115   - // }
116   - // oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj().diff(
117   - // aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj(), "m"
118   - // );
119   - //
120   - // aHeadWay.push(oHeadWay);
121   - // }
122   - //
123   - // // 找出第一个间隔小的班次间隔
124   - // var bIsFind = false;
125   - // var iFindIndex;
126   - // for (i = 0; i < aHeadWay.length; i++) {
127   - // if (aHeadWay[i].bMPeakBc) {
128   - // if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
129   - // iFindIndex = i;
130   - // bIsFind = true;
131   - // break;
132   - // }
133   - // } else {
134   - // iFindIndex = i;
135   - // bIsFind = true;
136   - // break;
137   - // }
138   - // }
139   - //
140   - // if (!bIsFind) {
141   - // return false;
142   - // }
143   - //
144   - // // 调整间隔
145   - // var iStartLpIndex = aHeadWay[iFindIndex].iStartLpIndex;
146   - // var oLp;
147   - // var oBc;
148   - // for (i = 0; i < aLpIndex.length; i++) {
149   - // if (aLpIndex[i] <= lpIndex && aLpIndex[i] >= iStartLpIndex) {
150   - // oLp = aLp[aLpIndex[i]];
151   - // oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
152   - // oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
153   - // }
154   - // }
155   - //
156   - // return true;
157   - //
158   - // }
159   -
160   - /**
161   - * 从指定路牌的班次开始往上所有的班次发车时间尝试减一分钟。
162   - * @param lpIndex 开始路牌索引
163   - * @param aLp 路牌列表
164   - * @param iCurrentGroupIndex 当前班次圈索引
165   - * @param iCurrentBcIndex 当前班次索引
166   - * @param oParam 参数对象
167   - */
168   - function _a_up(lpIndex, aLp,
169   - iCurrentGroupIndex, iCurrentBcIndex, oParam) {
170   - var i;
171   - var oLp;
172   - var oBc;
173   - for (i = lpIndex; i > 0; i--) { // 第一个路牌的班次不能动
174   - oLp = aLp[i];
175   - oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
176   - if (oBc) {
177   - oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
178   -
179   - oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
180   - iCurrentGroupIndex, iCurrentBcIndex,
181   - oLp.fnGetVerticalIntervalTime(iCurrentGroupIndex, iCurrentBcIndex) - 1);
182   - }
183   -
184   - }
185   - }
186   -
187   - /**
188   - * 主函数。
189   - * @param oInternalSchedule 行车计划
190   - * @param oParam 参数对象
191   - * @param iCGIndex 圈索引
192   - * @param iCBIndex 班次索引
193   - * @param iNGIndex 同路牌下一个邻接圈索引
194   - * @param iNBIndex 同路牌下一个邻接班次索引
195   - * @param iMinLayoverTime 要求的最小停站时间
196   - */
197   - function main(oInternalSchedule, oParam,
198   - iCGIndex, iCBIndex,
199   - iNGIndex, iNBIndex,
200   - iMinLayoverTime) {
201   - var _iIterCount = 0; // 当前迭代次数
202   - var _iMaxIter = 100; // 最大迭代100次
203   -
204   - var bLpFind = false;
205   - var iLpIndex;
206   - var i;
207   - var aLp = oInternalSchedule.fnGetLpArray();
208   - var oLp;
209   - var oCBc;
210   - var oNBc;
211   - while (_iIterCount <= _iMaxIter) {
212   - // 反方向查找第一个停站时间不足的班次
213   - for (i = aLp.length - 1; i > 0; i--) {
214   - oLp = aLp[i];
215   - oCBc = oLp.getBc(iCGIndex, iCBIndex);
216   - oNBc = oLp.getBc(iNGIndex, iNBIndex);
217   - if (oCBc && oNBc) {
218   - if (oNBc.getFcTimeObj().diff(oCBc.getArrTimeObj(), "m") <= (iMinLayoverTime - 1)) {
219   - iLpIndex = i;
220   - bLpFind = true;
221   - break;
222   - }
223   - }
224   - }
225   - if (!bLpFind) {
226   - break;
227   - }
228   -
229   - if (iLpIndex == aLp.length - 1) { // 最后一个路牌的班次停站时间不足,不能调整了
230   - break;
231   - }
232   -
233   - // 如果当前班次和下一个班次的间隔是早高峰最大发车间隔,需要尝试下面的班次发车时间减1分钟
234   - if (aLp[iLpIndex + 1].getBc(iCGIndex, iCBIndex).getFcTimeObj().diff(
235   - aLp[iLpIndex].getBc(iCGIndex, iCBIndex).getFcTimeObj(), "m") == oParam.getMPeakMaxFcjx()) {
236   - if (_a_down(aLp, iLpIndex, iCGIndex, iCBIndex, oParam)) {
237   - _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
238   - } else {
239   - break;
240   - }
241   - } else {
242   - _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
243   - }
244   -
245   - bLpFind = false;
246   - _iIterCount ++;
247   - }
248   -
249   - }
250   -
251   - return main;
  1 +/**
  2 + * 调整某一圈的发车间隔,在已有的间隔上做修正。
  3 + * 1、圈的第一个班次,最后一个班次发车时间固定不变,调整其余班次间隔
  4 + * 2、调整的判定原则是某个班次和该路牌下一个班次之间的layovertime为负值,需要调整当前班次间隔
  5 + * 3、TODO:如果仅靠调整间隔无法调整,可以考虑删除某个路牌的班次
  6 + * 4、TODO:目前只用在第一圈第一个方向班次列表上,低谷在前,高峰在后
  7 + */
  8 +var AdjustHeadwayS1 = (function() {
  9 +
  10 + /**
  11 + * 从指定路牌的班次开始往下所有的班次发车时间尝试减一分钟。
  12 + * @param aLp 路牌数组
  13 + * @param lpIndex 从下往上第一个停站时间不足的班次所在路牌索引
  14 + * @param iCurrentGroupIndex 班次圈索引
  15 + * @param iCurrentBcIndex 班次索引
  16 + * @param oParam 参数对象
  17 + */
  18 + function _a_down(aLp, lpIndex, iCurrentGroupIndex, iCurrentBcIndex, oParam) {
  19 + // 如果最后一个路牌的班次就停站时间不足,则不调整
  20 + if (lpIndex == aLp.length - 1) {
  21 + return false;
  22 + }
  23 + // 有班次的路牌索引数组(往下)
  24 + var i;
  25 + var aLpIndex = [];
  26 + for (i = lpIndex; i < aLp.length; i++) {
  27 + if (aLp[i].getBc(iCurrentGroupIndex, iCurrentBcIndex)) {
  28 + aLpIndex.push(i);
  29 + }
  30 + }
  31 +
  32 + // 当前班次开始与下一个路牌的对应班次的发车时间间隔
  33 + var aHeadWay = [];
  34 + var oHeadWay;
  35 + for (i = 0; i < aLpIndex.length - 1; i++) {
  36 + oHeadWay = {};
  37 + oHeadWay.iStartLpIndex = aLpIndex[i];
  38 + oHeadWay.iEndLpIndex = aLpIndex[i + 1];
  39 + if (oParam.isMPeakBc(aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj())) {
  40 + oHeadWay.bMPeakBc = true;
  41 + } else {
  42 + oHeadWay.bMPeakBc = false;
  43 + }
  44 + oHeadWay.iHeadWay = aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj().diff(
  45 + aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj(), "m"
  46 + );
  47 +
  48 + aHeadWay.push(oHeadWay);
  49 + }
  50 +
  51 + // 找出第一个间隔小于高峰最大发车间隔的位置,
  52 + // 然后从lpIndex开始到这个位置减发车时间,
  53 + // 从而达到从lpIndex开始到这个位置,局部减少发车时间的作用
  54 + // 最终的结果是停站时间足够,并且停站时间也是一个过渡效果
  55 + var bIsFind = false;
  56 + var iFindIndex;
  57 + for (i = 0; i < aHeadWay.length; i++) {
  58 + if (aHeadWay[i].bMPeakBc) {
  59 + if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
  60 + iFindIndex = i;
  61 + bIsFind = true;
  62 + break;
  63 + }
  64 + } else {
  65 + iFindIndex = i;
  66 + bIsFind = true;
  67 + break;
  68 + }
  69 + }
  70 +
  71 + if (!bIsFind) {
  72 + return false;
  73 + }
  74 +
  75 + // 调整间隔
  76 + var iStartLpIndex = aHeadWay[iFindIndex].iStartLpIndex;
  77 + var oLp;
  78 + var oBc;
  79 + for (i = 0; i < aLpIndex.length; i++) {
  80 + if (aLpIndex[i] <= iStartLpIndex && aLpIndex[i] > lpIndex) {
  81 + oLp = aLp[aLpIndex[i]];
  82 + oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
  83 + oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
  84 +
  85 + oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
  86 + iCurrentGroupIndex, iCurrentBcIndex,
  87 + oLp.fnGetVerticalIntervalTime(iCurrentGroupIndex, iCurrentBcIndex) - 1);
  88 + }
  89 + }
  90 +
  91 + return true;
  92 + }
  93 + // // TODO:向上局部减少发车调整有问题,不能下上所有的班次都减发车时间,需要像_a_down逐步减,下次修正
  94 + // function _a_up2(lpIndex, aLp,
  95 + // iCurrentGroupIndex, iCurrentBcIndex, oParam) {
  96 + // // 有班次的路牌索引数组(往上)
  97 + // var i;
  98 + // var aLpIndex = [];
  99 + // for (i = lpIndex; i >= 0; i--) {
  100 + // if (aLp[i].getBc(iCurrentGroupIndex, iCurrentBcIndex)) {
  101 + // aLpIndex.push(i);
  102 + // }
  103 + // }
  104 + // // 当前班次开始与下一个路牌的对应班次的发车时间间隔
  105 + // var aHeadWay = [];
  106 + // var oHeadWay = {};
  107 + // for (i = 0; i < aLpIndex.length - 1; i++) {
  108 + // oHeadWay = {};
  109 + // oHeadWay.iStartLpIndex = aLpIndex[i + 1];
  110 + // oHeadWay.iEndLpIndex = aLpIndex[i];
  111 + // if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj())) {
  112 + // oHeadWay.bMPeakBc = true;
  113 + // } else {
  114 + // oHeadWay.bMPeakBc = false;
  115 + // }
  116 + // oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj().diff(
  117 + // aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj(), "m"
  118 + // );
  119 + //
  120 + // aHeadWay.push(oHeadWay);
  121 + // }
  122 + //
  123 + // // 找出第一个间隔小的班次间隔
  124 + // var bIsFind = false;
  125 + // var iFindIndex;
  126 + // for (i = 0; i < aHeadWay.length; i++) {
  127 + // if (aHeadWay[i].bMPeakBc) {
  128 + // if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
  129 + // iFindIndex = i;
  130 + // bIsFind = true;
  131 + // break;
  132 + // }
  133 + // } else {
  134 + // iFindIndex = i;
  135 + // bIsFind = true;
  136 + // break;
  137 + // }
  138 + // }
  139 + //
  140 + // if (!bIsFind) {
  141 + // return false;
  142 + // }
  143 + //
  144 + // // 调整间隔
  145 + // var iStartLpIndex = aHeadWay[iFindIndex].iStartLpIndex;
  146 + // var oLp;
  147 + // var oBc;
  148 + // for (i = 0; i < aLpIndex.length; i++) {
  149 + // if (aLpIndex[i] <= lpIndex && aLpIndex[i] >= iStartLpIndex) {
  150 + // oLp = aLp[aLpIndex[i]];
  151 + // oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
  152 + // oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
  153 + // }
  154 + // }
  155 + //
  156 + // return true;
  157 + //
  158 + // }
  159 +
  160 + /**
  161 + * 从指定路牌的班次开始往上所有的班次发车时间尝试减一分钟。
  162 + * @param lpIndex 开始路牌索引
  163 + * @param aLp 路牌列表
  164 + * @param iCurrentGroupIndex 当前班次圈索引
  165 + * @param iCurrentBcIndex 当前班次索引
  166 + * @param oParam 参数对象
  167 + */
  168 + function _a_up(lpIndex, aLp,
  169 + iCurrentGroupIndex, iCurrentBcIndex, oParam) {
  170 + var i;
  171 + var oLp;
  172 + var oBc;
  173 + for (i = lpIndex; i > 0; i--) { // 第一个路牌的班次不能动
  174 + oLp = aLp[i];
  175 + oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
  176 + if (oBc) {
  177 + oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
  178 +
  179 + oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
  180 + iCurrentGroupIndex, iCurrentBcIndex,
  181 + oLp.fnGetVerticalIntervalTime(iCurrentGroupIndex, iCurrentBcIndex) - 1);
  182 + }
  183 +
  184 + }
  185 + }
  186 +
  187 + /**
  188 + * 主函数。
  189 + * @param oInternalSchedule 行车计划
  190 + * @param oParam 参数对象
  191 + * @param iCGIndex 圈索引
  192 + * @param iCBIndex 班次索引
  193 + * @param iNGIndex 同路牌下一个邻接圈索引
  194 + * @param iNBIndex 同路牌下一个邻接班次索引
  195 + * @param iMinLayoverTime 要求的最小停站时间
  196 + */
  197 + function main(oInternalSchedule, oParam,
  198 + iCGIndex, iCBIndex,
  199 + iNGIndex, iNBIndex,
  200 + iMinLayoverTime) {
  201 + var _iIterCount = 0; // 当前迭代次数
  202 + var _iMaxIter = 100; // 最大迭代100次
  203 +
  204 + var bLpFind = false;
  205 + var iLpIndex;
  206 + var i;
  207 + var aLp = oInternalSchedule.fnGetLpArray();
  208 + var oLp;
  209 + var oCBc;
  210 + var oNBc;
  211 + while (_iIterCount <= _iMaxIter) {
  212 + // 反方向查找第一个停站时间不足的班次
  213 + for (i = aLp.length - 1; i > 0; i--) {
  214 + oLp = aLp[i];
  215 + oCBc = oLp.getBc(iCGIndex, iCBIndex);
  216 + oNBc = oLp.getBc(iNGIndex, iNBIndex);
  217 + if (oCBc && oNBc) {
  218 + if (oNBc.getFcTimeObj().diff(oCBc.getArrTimeObj(), "m") <= (iMinLayoverTime - 1)) {
  219 + iLpIndex = i;
  220 + bLpFind = true;
  221 + break;
  222 + }
  223 + }
  224 + }
  225 + if (!bLpFind) {
  226 + break;
  227 + }
  228 +
  229 + if (iLpIndex == aLp.length - 1) { // 最后一个路牌的班次停站时间不足,不能调整了
  230 + break;
  231 + }
  232 +
  233 + // 如果当前班次和下一个班次的间隔是早高峰最大发车间隔,需要尝试下面的班次发车时间减1分钟
  234 + if (aLp[iLpIndex + 1].getBc(iCGIndex, iCBIndex).getFcTimeObj().diff(
  235 + aLp[iLpIndex].getBc(iCGIndex, iCBIndex).getFcTimeObj(), "m") == oParam.getMPeakMaxFcjx()) {
  236 + if (_a_down(aLp, iLpIndex, iCGIndex, iCBIndex, oParam)) {
  237 + _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
  238 + } else {
  239 + break;
  240 + }
  241 + } else {
  242 + _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
  243 + }
  244 +
  245 + bLpFind = false;
  246 + _iIterCount ++;
  247 + }
  248 +
  249 + }
  250 +
  251 + return main;
252 252 } ());
253 253 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/strategy/headway/AdjustHeadwayS2.js
1   -/**
2   - * 调整某一圈的发车间隔,在已有的间隔上做修正。
3   - * 1、圈的第一个班次,发车时间固定不变,调整其余班次间隔
4   - * 2、当前圈一般是副站圈,与邻接的主站班次之间的layovertime太大,调整
5   - */
6   -var AdjustHeadwayS2 = (function() {
7   -
8   - /**
9   - * 调整班次发车时间(当前班次和紧领的下一个班次)
10   - * @param oBcInfo 内部班次对象
11   - * @param aLp 路牌列表
12   - * @param iMinute 时间
13   - * @private
14   - */
15   - function _modifyHeadway(oBcInfo, aLp, iMinute) {
16   - if (!oBcInfo) {
17   - return;
18   - }
19   -
20   - // 调整班次发车间隔
21   - var iBcGroupIndex = oBcInfo.iGroupIndex;
22   - var iBcIndex = oBcInfo.iBcIndex;
23   - var oLp = aLp[oBcInfo.iLpIndex];
24   -
25   - var oBc = oLp.getBc(iBcGroupIndex, iBcIndex);
26   - var oNextBc = oLp.getBc(
27   - iBcIndex == 1 ? iBcGroupIndex + 1 : iBcGroupIndex,
28   - iBcIndex == 0 ? 1 : 0
29   - );
30   - if (oBc) {
31   - oBc.addMinuteToFcsj(iMinute);
32   -
33   - oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
34   - iBcGroupIndex, iBcIndex,
35   - oLp.fnGetVerticalIntervalTime(iBcGroupIndex, iBcIndex) + iMinute);
36   - }
37   - if (oNextBc) {
38   - oNextBc.addMinuteToFcsj(iMinute);
39   - }
40   - }
41   -
42   - /**
43   - * 从当前班次开始向上尝试减一分钟。
44   - * @param oBcInfo 内部班次对象
45   - * @param aLp 路牌列表
46   - * @param oParam 参数对象
47   - * @private
48   - */
49   - function _headway_up(oBcInfo, aLp, oParam) {
50   - if (!oBcInfo) {
51   - return;
52   - }
53   -
54   - // 有班次的路牌索引数组(往下)
55   - var i;
56   - var aLpIndex = [];
57   - for (i = oBcInfo.iLpIndex; i >= 0; i--) {
58   - if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
59   - aLpIndex.push(i);
60   - }
61   - }
62   -
63   - // 当前班次与上一个班次之间的间隔列表
64   - var aHeadWay = [];
65   - var oHeadWay;
66   - for (i = 0; i < aLpIndex.length - 1; i++) {
67   - oHeadWay = {};
68   - oHeadWay.iStartLpIndex = aLpIndex[i + 1];
69   - oHeadWay.iEndLpIndex = aLpIndex[i];
70   - if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
71   - oHeadWay.bMPeakBc = true;
72   - } else if (oParam.isEPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
73   - oHeadWay.bEPeakBc = true;
74   - } else {
75   - oHeadWay.bTroughBc = true;
76   - }
77   -
78   - oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
79   - aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
80   - );
81   -
82   - aHeadWay.push(oHeadWay);
83   - }
84   -
85   - // 找出第一个间隔大于最小发车间隔的位置
86   - // 从当前位置往上到此位置所有班次往前减一分钟
87   - var bIsFind = false;
88   - var iFindIndex;
89   - for (i = 0; i < aHeadWay.length; i++) {
90   - if (aHeadWay[i].bMPeakBc) { // 早高峰
91   - if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
92   - iFindIndex = i;
93   - bIsFind = true;
94   - break;
95   - }
96   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
97   - if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
98   - iFindIndex = i;
99   - bIsFind = true;
100   - break;
101   - }
102   - } else { // 低谷
103   - if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
104   - iFindIndex = i;
105   - bIsFind = true;
106   - break;
107   - }
108   - }
109   - }
110   -
111   - if (!bIsFind) {
112   - return;
113   - }
114   -
115   - // 调整间隔
116   - var _oBcInfo;
117   - for (i = 0; i < iFindIndex; i++) {
118   - _oBcInfo = {};
119   - _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
120   - _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
121   - _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
122   - _modifyHeadway(_oBcInfo, aLp, -1);
123   - }
124   -
125   - }
126   -
127   - /**
128   - * 从当前班次开始向下尝试减一分钟。
129   - * @param oBcInfo 内部班次对象
130   - * @param aLp 路牌列表
131   - * @param oParam 参数对象
132   - * @private
133   - */
134   - function _headway_down(oBcInfo, aLp, oParam) {
135   - if (!oBcInfo) {
136   - return;
137   - }
138   -
139   - // 有班次的路牌索引数组(往下)
140   - var i;
141   - var aLpIndex = [];
142   - for (i = oBcInfo.iLpIndex; i < aLp.length; i++) {
143   - if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
144   - aLpIndex.push(i);
145   - }
146   - }
147   -
148   - // 当前班次与下一个班次之间的间隔列表
149   - var aHeadWay = [];
150   - var oHeadWay;
151   - for (i = 0; i < aLpIndex.length - 1; i++) {
152   - oHeadWay = {};
153   - oHeadWay.iStartLpIndex = aLpIndex[i];
154   - oHeadWay.iEndLpIndex = aLpIndex[i + 1];
155   - if (oParam.isMPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
156   - oHeadWay.bMPeakBc = true;
157   - } else if (oParam.isEPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
158   - oHeadWay.bEPeakBc = true;
159   - } else {
160   - oHeadWay.bTroughBc = true;
161   - }
162   -
163   - oHeadWay.iHeadWay = aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
164   - aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
165   - );
166   -
167   - aHeadWay.push(oHeadWay);
168   - }
169   -
170   - // 找出第一个间隔小于最大发车间隔的位置
171   - // 从当前位置往下到此位置所有班次往前减一分钟
172   - var bIsFind = false;
173   - var iFindIndex;
174   - for (i = 0; i < aHeadWay.length; i++) {
175   - if (aHeadWay[i].bMPeakBc) { // 早高峰
176   - if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
177   - iFindIndex = i;
178   - bIsFind = true;
179   - break;
180   - }
181   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
182   - if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
183   - iFindIndex = i;
184   - bIsFind = true;
185   - break;
186   - }
187   - } else { // 低谷
188   - if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
189   - iFindIndex = i;
190   - bIsFind = true;
191   - break;
192   - }
193   - }
194   - }
195   -
196   - if (!bIsFind) {
197   - return;
198   - }
199   -
200   - // 调整间隔
201   - var _oBcInfo;
202   - for (i = 0; i < iFindIndex; i++) {
203   - _oBcInfo = {};
204   - _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
205   - _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
206   - _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
207   - if (_oBcInfo.iLpIndex != oBcInfo.iLpIndex) {
208   - // 跳过当前班次
209   - _modifyHeadway(_oBcInfo, aLp, -1);
210   - }
211   - }
212   - }
213   -
214   - /**
215   - * 找出当前圈最大需要修正停站时间的班次对象。
216   - * @param oInternalSchedule 行车计划
217   - * @param iCGIndex 圈索引(副站班次圈)
218   - * @param iCBIndex 班次索引
219   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
220   - * @param iNBIndex 同路牌下一个邻接班次索引
221   - * @param fPercent 最大超出百分比
222   - * @return {*} {路牌索引,圈索引,班次索引}
223   - * @private
224   - */
225   - function _maxMoreLayoverBcInfo(
226   - oInternalSchedule,
227   - iCGIndex, iCBIndex,
228   - iNGIndex, iNBIndex,
229   - fPercent
230   - ) {
231   - var i;
232   - var oLp;
233   - var oBc;
234   - var oNextBc;
235   - var iMaxLayoverTime;
236   - var iActualLayoverTime;
237   - var iActualMaxLayoverTime = 0;
238   - var iActualMaxLayoverTimeLpIndex;
239   -
240   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
241   - oLp = oInternalSchedule.fnGetLpArray()[i];
242   - oBc = oLp.getBc(iCGIndex, iCBIndex);
243   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
244   - if (oBc && oNextBc) {
245   - iMaxLayoverTime = oInternalSchedule._$calcuLayoverTime(
246   - oBc.getFcTimeObj(), oBc.isUp())[1];
247   - iActualLayoverTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
248   -
249   - if (iActualLayoverTime > iMaxLayoverTime &&
250   - iActualLayoverTime > iMaxLayoverTime * (1 + fPercent) &&
251   - iActualLayoverTime > iActualMaxLayoverTime
252   - ) {
253   - iActualMaxLayoverTime = iActualLayoverTime;
254   - iActualMaxLayoverTimeLpIndex = i;
255   - }
256   - }
257   - }
258   -
259   - if (iActualMaxLayoverTimeLpIndex == undefined) {
260   - return false;
261   - } else {
262   - return {
263   - iLpIndex: iActualMaxLayoverTimeLpIndex,
264   - iGroupIndex: iNGIndex, // 主站班次圈索引
265   - iBcIndex: iNBIndex
266   - };
267   - }
268   - }
269   -
270   - /**
271   - * 计算当前圈是否需要修正layovertime。
272   - * @param oInternalSchedule 行车计划对象
273   - * @param iCGIndex 圈索引(副站班次圈)
274   - * @param iCBIndex 班次索引
275   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
276   - * @param iNBIndex 同路牌下一个邻接班次索引
277   - * @param fPercent 最大超出百分比
278   - * @return {boolean}
279   - * @private
280   - */
281   - function _isNeedModify(
282   - oInternalSchedule,
283   - iCGIndex, iCBIndex,
284   - iNGIndex, iNBIndex,
285   - fPercent
286   - ) {
287   - var i;
288   - var oLp;
289   - var oBc;
290   - var oNextBc;
291   - var iMaxLayoverTime = 0;
292   - // 计算当前圈的所有相关班次总最大标准停站时间
293   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
294   - oLp = oInternalSchedule.fnGetLpArray()[i];
295   - oBc = oLp.getBc(iCGIndex, iCBIndex);
296   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
297   - if (oBc && oNextBc) {
298   - iMaxLayoverTime += oInternalSchedule._$calcuLayoverTime(
299   - oBc.getFcTimeObj(), oBc.isUp())[1];
300   - }
301   - }
302   -
303   - var iActualLayoverTime = 0;
304   - // 计算当前圈的所有相关班次总停站时间
305   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
306   - oLp = oInternalSchedule.fnGetLpArray()[i];
307   - oBc = oLp.getBc(iCGIndex, iCBIndex);
308   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
309   - if (oBc && oNextBc) {
310   - iActualLayoverTime += oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
311   - }
312   - }
313   -
314   - // console.log("iMaxLayoverTime=" + iMaxLayoverTime);
315   - // console.log("iActualLayoverTime=" + iActualLayoverTime);
316   -
317   - // 判定是否超出指定范围
318   - if (iActualLayoverTime > iMaxLayoverTime &&
319   - iActualLayoverTime > iMaxLayoverTime * (1 + fPercent)) {
320   - return true;
321   - } else {
322   - return false;
323   - }
324   - }
325   -
326   - /**
327   - * 主函数。
328   - * @param oInternalSchedule 行车计划
329   - * @param oParam 参数对象
330   - * @param iCGIndex 圈索引(副站班次圈)
331   - * @param iCBIndex 班次索引
332   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
333   - * @param iNBIndex 同路牌下一个邻接班次索引
334   - * @param fPercent 最大超出百分比
335   - */
336   - function main(
337   - oInternalSchedule, oParam,
338   - iCGIndex, iCBIndex,
339   - iNGIndex, iNBIndex,
340   - fPercent
341   - ) {
342   - var _iIterCount = 0; // 当前迭代次数
343   - var _iMaxIter = 100; // 最大迭代次数
344   -
345   - var oBcInfo; // 内部班次对象
346   -
347   - while (_iIterCount <= _iMaxIter) {
348   -
349   - // 判定当前圈的layovertime是否超出百分比
350   - if (_isNeedModify(oInternalSchedule,
351   - iCGIndex, iCBIndex,
352   - iNGIndex, iNBIndex, fPercent)) {
353   - // 找出超出最大的班次对象
354   - oBcInfo = _maxMoreLayoverBcInfo(
355   - oInternalSchedule,
356   - iCGIndex, iCBIndex,
357   - iNGIndex, iNBIndex, fPercent
358   - );
359   - // 尝试向上部分班次逐个调整
360   - _headway_up(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
361   - // 尝试调整当前班次
362   - _modifyHeadway(oBcInfo, oInternalSchedule.fnGetLpArray(), -1);
363   - // 尝试向下部分班次逐个调整
364   - _headway_down(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
365   -
366   - }
367   -
368   - _iIterCount ++;
369   - }
370   -
371   - }
372   -
373   - return main;
  1 +/**
  2 + * 调整某一圈的发车间隔,在已有的间隔上做修正。
  3 + * 1、圈的第一个班次,发车时间固定不变,调整其余班次间隔
  4 + * 2、当前圈一般是副站圈,与邻接的主站班次之间的layovertime太大,调整
  5 + */
  6 +var AdjustHeadwayS2 = (function() {
  7 +
  8 + /**
  9 + * 调整班次发车时间(当前班次和紧领的下一个班次)
  10 + * @param oBcInfo 内部班次对象
  11 + * @param aLp 路牌列表
  12 + * @param iMinute 时间
  13 + * @private
  14 + */
  15 + function _modifyHeadway(oBcInfo, aLp, iMinute) {
  16 + if (!oBcInfo) {
  17 + return;
  18 + }
  19 +
  20 + // 调整班次发车间隔
  21 + var iBcGroupIndex = oBcInfo.iGroupIndex;
  22 + var iBcIndex = oBcInfo.iBcIndex;
  23 + var oLp = aLp[oBcInfo.iLpIndex];
  24 +
  25 + var oBc = oLp.getBc(iBcGroupIndex, iBcIndex);
  26 + var oNextBc = oLp.getBc(
  27 + iBcIndex == 1 ? iBcGroupIndex + 1 : iBcGroupIndex,
  28 + iBcIndex == 0 ? 1 : 0
  29 + );
  30 + if (oBc) {
  31 + oBc.addMinuteToFcsj(iMinute);
  32 +
  33 + oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
  34 + iBcGroupIndex, iBcIndex,
  35 + oLp.fnGetVerticalIntervalTime(iBcGroupIndex, iBcIndex) + iMinute);
  36 + }
  37 + if (oNextBc) {
  38 + oNextBc.addMinuteToFcsj(iMinute);
  39 + }
  40 + }
  41 +
  42 + /**
  43 + * 从当前班次开始向上尝试减一分钟。
  44 + * @param oBcInfo 内部班次对象
  45 + * @param aLp 路牌列表
  46 + * @param oParam 参数对象
  47 + * @private
  48 + */
  49 + function _headway_up(oBcInfo, aLp, oParam) {
  50 + if (!oBcInfo) {
  51 + return;
  52 + }
  53 +
  54 + // 有班次的路牌索引数组(往下)
  55 + var i;
  56 + var aLpIndex = [];
  57 + for (i = oBcInfo.iLpIndex; i >= 0; i--) {
  58 + if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
  59 + aLpIndex.push(i);
  60 + }
  61 + }
  62 +
  63 + // 当前班次与上一个班次之间的间隔列表
  64 + var aHeadWay = [];
  65 + var oHeadWay;
  66 + for (i = 0; i < aLpIndex.length - 1; i++) {
  67 + oHeadWay = {};
  68 + oHeadWay.iStartLpIndex = aLpIndex[i + 1];
  69 + oHeadWay.iEndLpIndex = aLpIndex[i];
  70 + if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
  71 + oHeadWay.bMPeakBc = true;
  72 + } else if (oParam.isEPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
  73 + oHeadWay.bEPeakBc = true;
  74 + } else {
  75 + oHeadWay.bTroughBc = true;
  76 + }
  77 +
  78 + oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
  79 + aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
  80 + );
  81 +
  82 + aHeadWay.push(oHeadWay);
  83 + }
  84 +
  85 + // 找出第一个间隔大于最小发车间隔的位置
  86 + // 从当前位置往上到此位置所有班次往前减一分钟
  87 + var bIsFind = false;
  88 + var iFindIndex;
  89 + for (i = 0; i < aHeadWay.length; i++) {
  90 + if (aHeadWay[i].bMPeakBc) { // 早高峰
  91 + if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
  92 + iFindIndex = i;
  93 + bIsFind = true;
  94 + break;
  95 + }
  96 + } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
  97 + if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
  98 + iFindIndex = i;
  99 + bIsFind = true;
  100 + break;
  101 + }
  102 + } else { // 低谷
  103 + if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
  104 + iFindIndex = i;
  105 + bIsFind = true;
  106 + break;
  107 + }
  108 + }
  109 + }
  110 +
  111 + if (!bIsFind) {
  112 + return;
  113 + }
  114 +
  115 + // 调整间隔
  116 + var _oBcInfo;
  117 + for (i = 0; i < iFindIndex; i++) {
  118 + _oBcInfo = {};
  119 + _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
  120 + _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
  121 + _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
  122 + _modifyHeadway(_oBcInfo, aLp, -1);
  123 + }
  124 +
  125 + }
  126 +
  127 + /**
  128 + * 从当前班次开始向下尝试减一分钟。
  129 + * @param oBcInfo 内部班次对象
  130 + * @param aLp 路牌列表
  131 + * @param oParam 参数对象
  132 + * @private
  133 + */
  134 + function _headway_down(oBcInfo, aLp, oParam) {
  135 + if (!oBcInfo) {
  136 + return;
  137 + }
  138 +
  139 + // 有班次的路牌索引数组(往下)
  140 + var i;
  141 + var aLpIndex = [];
  142 + for (i = oBcInfo.iLpIndex; i < aLp.length; i++) {
  143 + if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
  144 + aLpIndex.push(i);
  145 + }
  146 + }
  147 +
  148 + // 当前班次与下一个班次之间的间隔列表
  149 + var aHeadWay = [];
  150 + var oHeadWay;
  151 + for (i = 0; i < aLpIndex.length - 1; i++) {
  152 + oHeadWay = {};
  153 + oHeadWay.iStartLpIndex = aLpIndex[i];
  154 + oHeadWay.iEndLpIndex = aLpIndex[i + 1];
  155 + if (oParam.isMPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
  156 + oHeadWay.bMPeakBc = true;
  157 + } else if (oParam.isEPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
  158 + oHeadWay.bEPeakBc = true;
  159 + } else {
  160 + oHeadWay.bTroughBc = true;
  161 + }
  162 +
  163 + oHeadWay.iHeadWay = aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
  164 + aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
  165 + );
  166 +
  167 + aHeadWay.push(oHeadWay);
  168 + }
  169 +
  170 + // 找出第一个间隔小于最大发车间隔的位置
  171 + // 从当前位置往下到此位置所有班次往前减一分钟
  172 + var bIsFind = false;
  173 + var iFindIndex;
  174 + for (i = 0; i < aHeadWay.length; i++) {
  175 + if (aHeadWay[i].bMPeakBc) { // 早高峰
  176 + if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
  177 + iFindIndex = i;
  178 + bIsFind = true;
  179 + break;
  180 + }
  181 + } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
  182 + if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
  183 + iFindIndex = i;
  184 + bIsFind = true;
  185 + break;
  186 + }
  187 + } else { // 低谷
  188 + if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
  189 + iFindIndex = i;
  190 + bIsFind = true;
  191 + break;
  192 + }
  193 + }
  194 + }
  195 +
  196 + if (!bIsFind) {
  197 + return;
  198 + }
  199 +
  200 + // 调整间隔
  201 + var _oBcInfo;
  202 + for (i = 0; i < iFindIndex; i++) {
  203 + _oBcInfo = {};
  204 + _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
  205 + _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
  206 + _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
  207 + if (_oBcInfo.iLpIndex != oBcInfo.iLpIndex) {
  208 + // 跳过当前班次
  209 + _modifyHeadway(_oBcInfo, aLp, -1);
  210 + }
  211 + }
  212 + }
  213 +
  214 + /**
  215 + * 找出当前圈最大需要修正停站时间的班次对象。
  216 + * @param oInternalSchedule 行车计划
  217 + * @param iCGIndex 圈索引(副站班次圈)
  218 + * @param iCBIndex 班次索引
  219 + * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
  220 + * @param iNBIndex 同路牌下一个邻接班次索引
  221 + * @param fPercent 最大超出百分比
  222 + * @return {*} {路牌索引,圈索引,班次索引}
  223 + * @private
  224 + */
  225 + function _maxMoreLayoverBcInfo(
  226 + oInternalSchedule,
  227 + iCGIndex, iCBIndex,
  228 + iNGIndex, iNBIndex,
  229 + fPercent
  230 + ) {
  231 + var i;
  232 + var oLp;
  233 + var oBc;
  234 + var oNextBc;
  235 + var iMaxLayoverTime;
  236 + var iActualLayoverTime;
  237 + var iActualMaxLayoverTime = 0;
  238 + var iActualMaxLayoverTimeLpIndex;
  239 +
  240 + for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
  241 + oLp = oInternalSchedule.fnGetLpArray()[i];
  242 + oBc = oLp.getBc(iCGIndex, iCBIndex);
  243 + oNextBc = oLp.getBc(iNGIndex, iNBIndex);
  244 + if (oBc && oNextBc) {
  245 + iMaxLayoverTime = oInternalSchedule._$calcuLayoverTime(
  246 + oBc.getFcTimeObj(), oBc.isUp())[1];
  247 + iActualLayoverTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
  248 +
  249 + if (iActualLayoverTime > iMaxLayoverTime &&
  250 + iActualLayoverTime > iMaxLayoverTime * (1 + fPercent) &&
  251 + iActualLayoverTime > iActualMaxLayoverTime
  252 + ) {
  253 + iActualMaxLayoverTime = iActualLayoverTime;
  254 + iActualMaxLayoverTimeLpIndex = i;
  255 + }
  256 + }
  257 + }
  258 +
  259 + if (iActualMaxLayoverTimeLpIndex == undefined) {
  260 + return false;
  261 + } else {
  262 + return {
  263 + iLpIndex: iActualMaxLayoverTimeLpIndex,
  264 + iGroupIndex: iNGIndex, // 主站班次圈索引
  265 + iBcIndex: iNBIndex
  266 + };
  267 + }
  268 + }
  269 +
  270 + /**
  271 + * 计算当前圈是否需要修正layovertime。
  272 + * @param oInternalSchedule 行车计划对象
  273 + * @param iCGIndex 圈索引(副站班次圈)
  274 + * @param iCBIndex 班次索引
  275 + * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
  276 + * @param iNBIndex 同路牌下一个邻接班次索引
  277 + * @param fPercent 最大超出百分比
  278 + * @return {boolean}
  279 + * @private
  280 + */
  281 + function _isNeedModify(
  282 + oInternalSchedule,
  283 + iCGIndex, iCBIndex,
  284 + iNGIndex, iNBIndex,
  285 + fPercent
  286 + ) {
  287 + var i;
  288 + var oLp;
  289 + var oBc;
  290 + var oNextBc;
  291 + var iMaxLayoverTime = 0;
  292 + // 计算当前圈的所有相关班次总最大标准停站时间
  293 + for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
  294 + oLp = oInternalSchedule.fnGetLpArray()[i];
  295 + oBc = oLp.getBc(iCGIndex, iCBIndex);
  296 + oNextBc = oLp.getBc(iNGIndex, iNBIndex);
  297 + if (oBc && oNextBc) {
  298 + iMaxLayoverTime += oInternalSchedule._$calcuLayoverTime(
  299 + oBc.getFcTimeObj(), oBc.isUp())[1];
  300 + }
  301 + }
  302 +
  303 + var iActualLayoverTime = 0;
  304 + // 计算当前圈的所有相关班次总停站时间
  305 + for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
  306 + oLp = oInternalSchedule.fnGetLpArray()[i];
  307 + oBc = oLp.getBc(iCGIndex, iCBIndex);
  308 + oNextBc = oLp.getBc(iNGIndex, iNBIndex);
  309 + if (oBc && oNextBc) {
  310 + iActualLayoverTime += oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
  311 + }
  312 + }
  313 +
  314 + // console.log("iMaxLayoverTime=" + iMaxLayoverTime);
  315 + // console.log("iActualLayoverTime=" + iActualLayoverTime);
  316 +
  317 + // 判定是否超出指定范围
  318 + if (iActualLayoverTime > iMaxLayoverTime &&
  319 + iActualLayoverTime > iMaxLayoverTime * (1 + fPercent)) {
  320 + return true;
  321 + } else {
  322 + return false;
  323 + }
  324 + }
  325 +
  326 + /**
  327 + * 主函数。
  328 + * @param oInternalSchedule 行车计划
  329 + * @param oParam 参数对象
  330 + * @param iCGIndex 圈索引(副站班次圈)
  331 + * @param iCBIndex 班次索引
  332 + * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
  333 + * @param iNBIndex 同路牌下一个邻接班次索引
  334 + * @param fPercent 最大超出百分比
  335 + */
  336 + function main(
  337 + oInternalSchedule, oParam,
  338 + iCGIndex, iCBIndex,
  339 + iNGIndex, iNBIndex,
  340 + fPercent
  341 + ) {
  342 + var _iIterCount = 0; // 当前迭代次数
  343 + var _iMaxIter = 100; // 最大迭代次数
  344 +
  345 + var oBcInfo; // 内部班次对象
  346 +
  347 + while (_iIterCount <= _iMaxIter) {
  348 +
  349 + // 判定当前圈的layovertime是否超出百分比
  350 + if (_isNeedModify(oInternalSchedule,
  351 + iCGIndex, iCBIndex,
  352 + iNGIndex, iNBIndex, fPercent)) {
  353 + // 找出超出最大的班次对象
  354 + oBcInfo = _maxMoreLayoverBcInfo(
  355 + oInternalSchedule,
  356 + iCGIndex, iCBIndex,
  357 + iNGIndex, iNBIndex, fPercent
  358 + );
  359 + // 尝试向上部分班次逐个调整
  360 + _headway_up(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
  361 + // 尝试调整当前班次
  362 + _modifyHeadway(oBcInfo, oInternalSchedule.fnGetLpArray(), -1);
  363 + // 尝试向下部分班次逐个调整
  364 + _headway_down(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
  365 +
  366 + }
  367 +
  368 + _iIterCount ++;
  369 + }
  370 +
  371 + }
  372 +
  373 + return main;
374 374 } ());
375 375 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/strategy/headway/AdjustHeadwayS3_eat.js
1   -/**
2   - * 调整待吃饭班次的发车间隔,从而调整停站时间满足吃饭时间。
3   - * 1、因为是单向进场,所以班次一定在主站方向上
4   - * 2、一般吃饭班次都是跨圈的,所以需要把指定方向上的所有班次组成数组参与判定
5   - */
6   -var AdjustHeadwayS3_eat = (function() {
7   -
8   - /**
9   - * 获取班次列表。
10   - * @param oInternalSchedule 行车计划
11   - * @param oParam 参数对象
12   - * @param isUp 是否上行
13   - */
14   - function _getBcList(oInternalSchedule, oParam, isUp) {
15   - var aRtnBc = [];
16   - var oRtnBc = {oBc: null, iBcIndex: -1, lpIndex: 0, groupIndex: 0, bcIndex: 0};
17   -
18   - var i;
19   - var j;
20   - var aLp = oInternalSchedule.fnGetLpArray();
21   - var oLp;
22   - var oBc;
23   -
24   - for (j = 0; j < oInternalSchedule._qCount; j++) {
25   - for (i = 0; i < aLp.length; i++) {
26   - oLp = aLp[i];
27   - oBc = oLp.getBc(
28   - j,
29   - oInternalSchedule._qIsUp == isUp ? 0 : 1
30   - );
31   -
32   - if (oBc) {
33   - oRtnBc = {
34   - "oBc": oBc,
35   - "lpIndex": i,
36   - "groupIndex": j,
37   - "bcIndex": oInternalSchedule._qIsUp == isUp ? 0 : 1
38   - };
39   - oRtnBc.iBcIndex = aRtnBc.length;
40   - aRtnBc.push(oRtnBc);
41   - }
42   - }
43   - }
44   -
45   - return aRtnBc;
46   - }
47   -
48   - /**
49   - * 判定是否是吃饭班次,是否需要调整相关的时间。
50   - * @param oRtnBc 内部班次对象
51   - * @param aLp 路牌列表
52   - */
53   - function _isNeedModifyLayoverTime(oRtnBc, aLp) {
54   - var oBc = oRtnBc.oBc; // 当前班次
55   - var oLp = aLp[oRtnBc.lpIndex]; // 所在路牌
56   - var oPreBc = oLp.getPreBc(oBc); // 所在路牌前一个相邻班次
57   -
58   - if (!oPreBc) { // 如果当前路牌没有之前的班次,不能吃饭,一般不可能的
59   - return false;
60   - }
61   -
62   - // 发车之前的停站时间(用于吃饭)
63   - var recoverTime = oBc.getFcTimeObj().diff(oPreBc.getArrTimeObj(), 'm');
64   - if (recoverTime < 20) { // 小于20分钟,需要调整
65   - return true;
66   - } else {
67   - return false;
68   - }
69   -
70   - }
71   -
72   - /**
73   - * 调整班次发车时间(当前班次和紧领的下一个班次)
74   - * @param oRtnBc 内部班次对象
75   - * @param aLp 路牌列表
76   - * @param iMinute 时间
77   - * @private
78   - */
79   - function _modifyHeadway(oRtnBc, aLp, iMinute) {
80   - var iBcGroupIndex = oRtnBc.groupIndex;
81   - var iBcIndex = oRtnBc.bcIndex;
82   - var oLp = aLp[oRtnBc.lpIndex];
83   -
84   - var oBc = oLp.getBc(iBcGroupIndex, iBcIndex);
85   - var oNextBc = oLp.getBc(
86   - iBcIndex == 1 ? iBcGroupIndex + 1 : iBcGroupIndex,
87   - iBcIndex == 0 ? 1 : 0
88   - );
89   - if (oBc) {
90   - oBc.addMinuteToFcsj(iMinute);
91   -
92   - oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
93   - iBcGroupIndex, iBcIndex,
94   - oLp.fnGetVerticalIntervalTime(iBcGroupIndex, iBcIndex) + iMinute);
95   - }
96   - if (oNextBc) {
97   - oNextBc.addMinuteToFcsj(iMinute);
98   - }
99   - }
100   -
101   - /**
102   - * 从当前班次开始向上尝试加一分钟。
103   - * @param oRtnBc 内部班次对象
104   - * @param aRtnBc 内部班次列表
105   - * @param aLp 路牌列表
106   - * @param oParam 参数对象
107   - * @private
108   - */
109   - function _headway_up(oRtnBc, aRtnBc, aLp, oParam) {
110   - var i;
111   -
112   - // 当前班次与上一个班次之间的间隔列表
113   - var aHeadWay = [];
114   - var oHeadWay;
115   - for (i = oRtnBc.iBcIndex; i > 0; i--) {
116   - oHeadWay = {};
117   - oHeadWay.iStartRtnBcIndex = (i - 1);
118   - oHeadWay.iEndRtnBcIndex = i;
119   - if (oParam.isMPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
120   - oHeadWay.bMPeakBc = true;
121   - } else if (oParam.isEPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
122   - oHeadWay.bEPeakBc = true;
123   - } else {
124   - oHeadWay.bTroughBc = true;
125   - }
126   -
127   - oHeadWay.iHeadWay = aRtnBc[i].oBc.getFcTimeObj().diff(
128   - aRtnBc[i - 1].oBc.getFcTimeObj(), "m"
129   - );
130   -
131   - aHeadWay.push(oHeadWay);
132   - }
133   -
134   - // 找出第一个间隔小于最大发车间隔的位置
135   - // 从当前位置往上到此位置所有班次往后加1分钟
136   - var bIsFind = false;
137   - var iFindIndex;
138   - for (i = 0; i < aHeadWay.length; i++) {
139   - if (aHeadWay[i].bMPeakBc) { // 早高峰
140   - if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
141   - iFindIndex = i;
142   - bIsFind = true;
143   - break;
144   - }
145   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
146   - if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
147   - iFindIndex = i;
148   - bIsFind = true;
149   - break;
150   - }
151   - } else { // 低谷
152   - if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
153   - iFindIndex = i;
154   - bIsFind = true;
155   - break;
156   - }
157   - }
158   - }
159   -
160   - if (!bIsFind) {
161   - return;
162   - }
163   -
164   - // 调整间隔
165   - for (i = 0; i < iFindIndex; i++) {
166   - _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
167   - }
168   -
169   - }
170   -
171   - /**
172   - * 从当前班次开始向下尝试加一分钟。
173   - * @param oRtnBc 内部班次对象
174   - * @param aRtnBc 内部班次列表
175   - * @param aLp 路牌列表
176   - * @param oParam 参数对象
177   - * @private
178   - */
179   - function _headway_down(oRtnBc, aRtnBc, aLp, oParam) {
180   - var i;
181   -
182   - // 当前班次与下一个班次之间的间隔列表
183   - var aHeadWay = [];
184   - var oHeadWay;
185   - for (i = oRtnBc.iBcIndex; i < aRtnBc.length - 1; i++) {
186   - oHeadWay = {};
187   - oHeadWay.iStartRtnBcIndex = i;
188   - oHeadWay.iEndRtnBcIndex = i + 1;
189   - if (oParam.isMPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
190   - oHeadWay.bMPeakBc = true;
191   - } else if (oParam.isEPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
192   - oHeadWay.bEPeakBc = true;
193   - } else {
194   - oHeadWay.bTroughBc = true;
195   - }
196   -
197   - oHeadWay.iHeadWay = aRtnBc[i + 1].oBc.getFcTimeObj().diff(
198   - aRtnBc[i].oBc.getFcTimeObj(), "m"
199   - );
200   -
201   - aHeadWay.push(oHeadWay);
202   - }
203   -
204   - // 找出第一个间隔大于最小发车间隔的位置
205   - // 从当前位置往上到此位置所有班次往后加1分钟
206   - var bIsFind = false;
207   - var iFindIndex;
208   - for (i = 0; i < aHeadWay.length; i++) {
209   - if (aHeadWay[i].bMPeakBc) { // 早高峰
210   - if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
211   - iFindIndex = i;
212   - bIsFind = true;
213   - break;
214   - }
215   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
216   - if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
217   - iFindIndex = i;
218   - bIsFind = true;
219   - break;
220   - }
221   - } else { // 低谷
222   - if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
223   - iFindIndex = i;
224   - bIsFind = true;
225   - break;
226   - }
227   - }
228   - }
229   -
230   - if (!bIsFind) {
231   - return;
232   - }
233   -
234   - // 调整间隔
235   - for (i = 0; i <= iFindIndex; i++) {
236   - _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
237   - }
238   - }
239   -
240   - /**
241   - * 主函数。
242   - * @param oInternalSchedule 行车计划
243   - * @param oParam 参数对象
244   - */
245   - function main(
246   - oInternalSchedule, oParam
247   - ) {
248   - var _iIterCount = 0; // 当前迭代次数
249   - var _iMaxIter = 100; // 最大迭代次数
250   -
251   - var i;
252   - var oRtnBc;
253   - var oBc;
254   -
255   - while (_iIterCount <= _iMaxIter) {
256   - // 获取主站方向班次列表
257   - var aRtnBc = _getBcList(
258   - oInternalSchedule,
259   - oParam,
260   - oParam.isUpOneWayStop());
261   -
262   - for (i = 0; i < aRtnBc.length; i++) {
263   - oRtnBc = aRtnBc[i];
264   - oBc = oRtnBc.oBc;
265   - if (oBc.fnGetEatTime() > 0) { // 标记了吃饭时间,吃饭班次
266   - if (_isNeedModifyLayoverTime(oRtnBc, oInternalSchedule.fnGetLpArray())) { // 是否需要调整停站时间满足吃饭
267   - // 尝试向上部分班次逐个调整
268   - _headway_up(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
269   - // 尝试调整本班次,以及向下部分班次逐个调整
270   - _headway_down(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
271   -
272   - break;
273   - }
274   - }
275   - }
276   -
277   -
278   - _iIterCount ++;
279   - }
280   -
281   -
282   - }
283   -
284   - return main;
285   -
  1 +/**
  2 + * 调整待吃饭班次的发车间隔,从而调整停站时间满足吃饭时间。
  3 + * 1、因为是单向进场,所以班次一定在主站方向上
  4 + * 2、一般吃饭班次都是跨圈的,所以需要把指定方向上的所有班次组成数组参与判定
  5 + */
  6 +var AdjustHeadwayS3_eat = (function() {
  7 +
  8 + /**
  9 + * 获取班次列表。
  10 + * @param oInternalSchedule 行车计划
  11 + * @param oParam 参数对象
  12 + * @param isUp 是否上行
  13 + */
  14 + function _getBcList(oInternalSchedule, oParam, isUp) {
  15 + var aRtnBc = [];
  16 + var oRtnBc = {oBc: null, iBcIndex: -1, lpIndex: 0, groupIndex: 0, bcIndex: 0};
  17 +
  18 + var i;
  19 + var j;
  20 + var aLp = oInternalSchedule.fnGetLpArray();
  21 + var oLp;
  22 + var oBc;
  23 +
  24 + for (j = 0; j < oInternalSchedule._qCount; j++) {
  25 + for (i = 0; i < aLp.length; i++) {
  26 + oLp = aLp[i];
  27 + oBc = oLp.getBc(
  28 + j,
  29 + oInternalSchedule._qIsUp == isUp ? 0 : 1
  30 + );
  31 +
  32 + if (oBc) {
  33 + oRtnBc = {
  34 + "oBc": oBc,
  35 + "lpIndex": i,
  36 + "groupIndex": j,
  37 + "bcIndex": oInternalSchedule._qIsUp == isUp ? 0 : 1
  38 + };
  39 + oRtnBc.iBcIndex = aRtnBc.length;
  40 + aRtnBc.push(oRtnBc);
  41 + }
  42 + }
  43 + }
  44 +
  45 + return aRtnBc;
  46 + }
  47 +
  48 + /**
  49 + * 判定是否是吃饭班次,是否需要调整相关的时间。
  50 + * @param oRtnBc 内部班次对象
  51 + * @param aLp 路牌列表
  52 + */
  53 + function _isNeedModifyLayoverTime(oRtnBc, aLp) {
  54 + var oBc = oRtnBc.oBc; // 当前班次
  55 + var oLp = aLp[oRtnBc.lpIndex]; // 所在路牌
  56 + var oPreBc = oLp.getPreBc(oBc); // 所在路牌前一个相邻班次
  57 +
  58 + if (!oPreBc) { // 如果当前路牌没有之前的班次,不能吃饭,一般不可能的
  59 + return false;
  60 + }
  61 +
  62 + // 发车之前的停站时间(用于吃饭)
  63 + var recoverTime = oBc.getFcTimeObj().diff(oPreBc.getArrTimeObj(), 'm');
  64 + if (recoverTime < 20) { // 小于20分钟,需要调整
  65 + return true;
  66 + } else {
  67 + return false;
  68 + }
  69 +
  70 + }
  71 +
  72 + /**
  73 + * 调整班次发车时间(当前班次和紧领的下一个班次)
  74 + * @param oRtnBc 内部班次对象
  75 + * @param aLp 路牌列表
  76 + * @param iMinute 时间
  77 + * @private
  78 + */
  79 + function _modifyHeadway(oRtnBc, aLp, iMinute) {
  80 + var iBcGroupIndex = oRtnBc.groupIndex;
  81 + var iBcIndex = oRtnBc.bcIndex;
  82 + var oLp = aLp[oRtnBc.lpIndex];
  83 +
  84 + var oBc = oLp.getBc(iBcGroupIndex, iBcIndex);
  85 + var oNextBc = oLp.getBc(
  86 + iBcIndex == 1 ? iBcGroupIndex + 1 : iBcGroupIndex,
  87 + iBcIndex == 0 ? 1 : 0
  88 + );
  89 + if (oBc) {
  90 + oBc.addMinuteToFcsj(iMinute);
  91 +
  92 + oLp.fnSetVerticalIntervalTime( // 调整对应的路牌发车间隔
  93 + iBcGroupIndex, iBcIndex,
  94 + oLp.fnGetVerticalIntervalTime(iBcGroupIndex, iBcIndex) + iMinute);
  95 + }
  96 + if (oNextBc) {
  97 + oNextBc.addMinuteToFcsj(iMinute);
  98 + }
  99 + }
  100 +
  101 + /**
  102 + * 从当前班次开始向上尝试加一分钟。
  103 + * @param oRtnBc 内部班次对象
  104 + * @param aRtnBc 内部班次列表
  105 + * @param aLp 路牌列表
  106 + * @param oParam 参数对象
  107 + * @private
  108 + */
  109 + function _headway_up(oRtnBc, aRtnBc, aLp, oParam) {
  110 + var i;
  111 +
  112 + // 当前班次与上一个班次之间的间隔列表
  113 + var aHeadWay = [];
  114 + var oHeadWay;
  115 + for (i = oRtnBc.iBcIndex; i > 0; i--) {
  116 + oHeadWay = {};
  117 + oHeadWay.iStartRtnBcIndex = (i - 1);
  118 + oHeadWay.iEndRtnBcIndex = i;
  119 + if (oParam.isMPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
  120 + oHeadWay.bMPeakBc = true;
  121 + } else if (oParam.isEPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
  122 + oHeadWay.bEPeakBc = true;
  123 + } else {
  124 + oHeadWay.bTroughBc = true;
  125 + }
  126 +
  127 + oHeadWay.iHeadWay = aRtnBc[i].oBc.getFcTimeObj().diff(
  128 + aRtnBc[i - 1].oBc.getFcTimeObj(), "m"
  129 + );
  130 +
  131 + aHeadWay.push(oHeadWay);
  132 + }
  133 +
  134 + // 找出第一个间隔小于最大发车间隔的位置
  135 + // 从当前位置往上到此位置所有班次往后加1分钟
  136 + var bIsFind = false;
  137 + var iFindIndex;
  138 + for (i = 0; i < aHeadWay.length; i++) {
  139 + if (aHeadWay[i].bMPeakBc) { // 早高峰
  140 + if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
  141 + iFindIndex = i;
  142 + bIsFind = true;
  143 + break;
  144 + }
  145 + } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
  146 + if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
  147 + iFindIndex = i;
  148 + bIsFind = true;
  149 + break;
  150 + }
  151 + } else { // 低谷
  152 + if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
  153 + iFindIndex = i;
  154 + bIsFind = true;
  155 + break;
  156 + }
  157 + }
  158 + }
  159 +
  160 + if (!bIsFind) {
  161 + return;
  162 + }
  163 +
  164 + // 调整间隔
  165 + for (i = 0; i < iFindIndex; i++) {
  166 + _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
  167 + }
  168 +
  169 + }
  170 +
  171 + /**
  172 + * 从当前班次开始向下尝试加一分钟。
  173 + * @param oRtnBc 内部班次对象
  174 + * @param aRtnBc 内部班次列表
  175 + * @param aLp 路牌列表
  176 + * @param oParam 参数对象
  177 + * @private
  178 + */
  179 + function _headway_down(oRtnBc, aRtnBc, aLp, oParam) {
  180 + var i;
  181 +
  182 + // 当前班次与下一个班次之间的间隔列表
  183 + var aHeadWay = [];
  184 + var oHeadWay;
  185 + for (i = oRtnBc.iBcIndex; i < aRtnBc.length - 1; i++) {
  186 + oHeadWay = {};
  187 + oHeadWay.iStartRtnBcIndex = i;
  188 + oHeadWay.iEndRtnBcIndex = i + 1;
  189 + if (oParam.isMPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
  190 + oHeadWay.bMPeakBc = true;
  191 + } else if (oParam.isEPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
  192 + oHeadWay.bEPeakBc = true;
  193 + } else {
  194 + oHeadWay.bTroughBc = true;
  195 + }
  196 +
  197 + oHeadWay.iHeadWay = aRtnBc[i + 1].oBc.getFcTimeObj().diff(
  198 + aRtnBc[i].oBc.getFcTimeObj(), "m"
  199 + );
  200 +
  201 + aHeadWay.push(oHeadWay);
  202 + }
  203 +
  204 + // 找出第一个间隔大于最小发车间隔的位置
  205 + // 从当前位置往上到此位置所有班次往后加1分钟
  206 + var bIsFind = false;
  207 + var iFindIndex;
  208 + for (i = 0; i < aHeadWay.length; i++) {
  209 + if (aHeadWay[i].bMPeakBc) { // 早高峰
  210 + if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
  211 + iFindIndex = i;
  212 + bIsFind = true;
  213 + break;
  214 + }
  215 + } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
  216 + if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
  217 + iFindIndex = i;
  218 + bIsFind = true;
  219 + break;
  220 + }
  221 + } else { // 低谷
  222 + if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
  223 + iFindIndex = i;
  224 + bIsFind = true;
  225 + break;
  226 + }
  227 + }
  228 + }
  229 +
  230 + if (!bIsFind) {
  231 + return;
  232 + }
  233 +
  234 + // 调整间隔
  235 + for (i = 0; i <= iFindIndex; i++) {
  236 + _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
  237 + }
  238 + }
  239 +
  240 + /**
  241 + * 主函数。
  242 + * @param oInternalSchedule 行车计划
  243 + * @param oParam 参数对象
  244 + */
  245 + function main(
  246 + oInternalSchedule, oParam
  247 + ) {
  248 + var _iIterCount = 0; // 当前迭代次数
  249 + var _iMaxIter = 100; // 最大迭代次数
  250 +
  251 + var i;
  252 + var oRtnBc;
  253 + var oBc;
  254 +
  255 + while (_iIterCount <= _iMaxIter) {
  256 + // 获取主站方向班次列表
  257 + var aRtnBc = _getBcList(
  258 + oInternalSchedule,
  259 + oParam,
  260 + oParam.isUpOneWayStop());
  261 +
  262 + for (i = 0; i < aRtnBc.length; i++) {
  263 + oRtnBc = aRtnBc[i];
  264 + oBc = oRtnBc.oBc;
  265 + if (oBc.fnGetEatTime() > 0) { // 标记了吃饭时间,吃饭班次
  266 + if (_isNeedModifyLayoverTime(oRtnBc, oInternalSchedule.fnGetLpArray())) { // 是否需要调整停站时间满足吃饭
  267 + // 尝试向上部分班次逐个调整
  268 + _headway_up(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
  269 + // 尝试调整本班次,以及向下部分班次逐个调整
  270 + _headway_down(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
  271 +
  272 + break;
  273 + }
  274 + }
  275 + }
  276 +
  277 +
  278 + _iIterCount ++;
  279 + }
  280 +
  281 +
  282 + }
  283 +
  284 + return main;
  285 +
286 286 } ());
287 287 \ No newline at end of file
... ...
src/main/resources/static/pages/electricity/list/list.html
... ... @@ -183,7 +183,11 @@
183 183 {{obj.gsname}}
184 184 </td>
185 185 <td>
186   - {{obj.xlname}}
  186 + {{if obj.linename=='' || obj.linename==null}}
  187 + {{obj.xlname}}
  188 + {{else}}
  189 + {{obj.linename}}
  190 + {{/if}}
187 191 </td>
188 192 <td>
189 193 <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
... ... @@ -194,7 +198,11 @@
194 198 <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input>
195 199 <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button>
196 200 {{else}}
197   - {{obj.jsy}}/{{obj.name}}
  201 + {{if obj.jname=='' || obj.jname==null}}
  202 + {{obj.jsy}}/{{obj.name}}
  203 + {{else}}
  204 + {{obj.jsy}}/{{obj.jname}}
  205 + {{/if}}
198 206 {{/if}}
199 207 </td>
200 208 <td>
... ... @@ -546,7 +554,8 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
546 554 params['order'] = 'nbbm';
547 555 params['page'] = page;
548 556 params['rq'] = $("#rq").val();
549   -
  557 + params['type'] = '2';
  558 +
550 559  
551 560 var l = layer.load(2);
552 561 $get('/dlb/dlbList', params, function (data) {
... ... @@ -847,6 +856,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
847 856 $("#export").on("click", function () {
848 857 if ($("#rq").val() != "") {
849 858 var params=getParamsList();
  859 + params['type']='2';
850 860 $post('/dlb/listExport', params, function (result) {
851 861 window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存电量" );
852 862 });
... ...
src/main/resources/static/pages/forms/calc/calcjsyspy.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid;
  11 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px;
  15 + text-align: center; }
  16 +
  17 + .table > tbody + tbody {
  18 + border-top: 1px solid; }
  19 +</style>
  20 +
  21 +<div class="page-head">
  22 + <div class="page-title">
  23 + <h1>人车班次公里统计</h1>
  24 + </div>
  25 +</div>
  26 +
  27 +<div class="row">
  28 + <div class="col-md-12">
  29 + <div class="portlet light porttlet-fit bordered">
  30 + <div class="portlet-title">
  31 + <form class="form-inline" action="">
  32 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth">
  33 + <span class="item-label" style="width: 80px;">公司: </span>
  34 + <select class="form-control" name="company" id="gsdmManth" style="width: 140px;"></select>
  35 + </div>
  36 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth">
  37 + <span class="item-label" style="width: 80px;">分公司: </span>
  38 + <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select>
  39 + </div>
  40 + <div style="display: inline-block;margin-left: 10px">
  41 + <span class="item-label" style="width: 150px;">线路: </span>
  42 + <select class="form-control" name="line" id="line" style="width: 136px;"></select>
  43 + </div>
  44 + <div style="margin-top: 10px">
  45 +
  46 + </div>
  47 + <div style="display: inline-block;margin-left: 5px;">
  48 + <span class="item-label" style="width: 80px;">开始时间: </span>
  49 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  50 + </div>
  51 + <div style="display: inline-block;margin-left: 10px;">
  52 + <span class="item-label" style="width: 80px;">结束时间: </span>
  53 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  54 + </div>
  55 + <div style="display: inline-block;margin-left: 10px">
  56 + <span class="item-label" style="width: 80px;">统计: </span>
  57 + <select class="form-control" style="width: 136px;" id='empnames'>
  58 + <option value="驾驶员">驾驶员</option>
  59 + <option value="售票员">售票员</option>
  60 + <option value="车辆自编号">车辆自编号</option>
  61 + </select>
  62 + </div>
  63 + <div style="display: inline-block;margin-left: 0px">
  64 + <span class="item-label" style="width: 150px;">:</span>
  65 + <input class="form-control" name="cont" id="cont" style="width: 136px;"></input>
  66 + </div>
  67 + <div class="form-group">
  68 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  69 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  70 + </div>
  71 + </form>
  72 + </div>
  73 + <div class="portlet-body">
  74 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  75 + <table class="table table-bordered table-hover table-checkable" id="forms">
  76 + <thead>
  77 + <tr>
  78 + <th>序号</th>
  79 + <th id='empname'>驾驶员</th>
  80 + <th>计划营运班次</th>
  81 + <th>实际营运班次</th>
  82 + <th>烂班班次</th>
  83 + <th>临加班次</th>
  84 + <th>计划总里程</th>
  85 + <th>计划营运里程</th>
  86 + <th>计划空驶里程</th>
  87 + <th>实际总里程</th>
  88 + <th>实际营运里程</th>
  89 + <th>实际空驶里程</th>
  90 + <th>烂班里程</th>
  91 + <th>临加营运里程</th>
  92 + <th>临加空驶里程</th>
  93 + </tr>
  94 + </thead>
  95 + <tbody>
  96 +
  97 + </tbody>
  98 + </table>
  99 + </div>
  100 + </div>
  101 + </div>
  102 + </div>
  103 +</div>
  104 +
  105 +<script>
  106 + $(function(){
  107 + // 关闭左侧栏
  108 + if (!$('body').hasClass('page-sidebar-closed'))
  109 + $('.menu-toggler.sidebar-toggler').click();
  110 +
  111 + var d = new Date();
  112 + d.setTime(d.getTime() - 1*1000*60*60*24);
  113 + var year = d.getFullYear();
  114 + var month = d.getMonth() + 1;
  115 + var day = d.getDate();
  116 + if(month < 10)
  117 + month = "0" + month;
  118 + if(day < 10)
  119 + day = "0" + day;
  120 + var dateTime = year + "-" + month + "-" + day;
  121 + $("#startDate,#endDate").datetimepicker({
  122 + format : 'YYYY-MM-DD',
  123 + locale : 'zh-cn',
  124 + maxDate : dateTime
  125 + });
  126 + $("#startDate,#endDate").val(year + "-" + month + "-" + day);
  127 +
  128 + var fage=false;
  129 + var obj = [];
  130 + var xlList;
  131 + $.get('/report/lineList',function(result){
  132 + xlList=result;
  133 + $.get('/user/companyData', function(result){
  134 + obj = result;
  135 + var options = '';
  136 + for(var i = 0; i < obj.length; i++){
  137 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  138 + }
  139 +
  140 + if(obj.length ==0){
  141 + $("#gsdmDiv_manth").css('display','none');
  142 + $('#fgsdmDiv_manth').css('display','none');
  143 + }else if(obj.length ==1){
  144 + $("#gsdmDiv_manth").css('display','none');
  145 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  146 + $('#fgsdmDiv_manth').css('display','none');
  147 + }
  148 + $('#gsdmManth').html(options);
  149 + updateCompany();
  150 + });
  151 + })
  152 + $("#gsdmManth").on("change",updateCompany);
  153 + function updateCompany(){
  154 + var company = $('#gsdmManth').val();
  155 + var options = '<option value="">全部分公司</option>';
  156 + for(var i = 0; i < obj.length; i++){
  157 + if(obj[i].companyCode == company){
  158 + var children = obj[i].children;
  159 + for(var j = 0; j < children.length; j++){
  160 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  161 + }
  162 + }
  163 + }
  164 + $('#fgsdmManth').html(options);
  165 + }
  166 +
  167 +
  168 + var tempData = {};
  169 + $.get('/report/lineList',function(xlList){
  170 + var data = [];
  171 + data.push({id: " ", text: "全部线路"});
  172 + $.get('/user/companyData', function(result){
  173 + for(var i = 0; i < result.length; i++){
  174 + var companyCode = result[i].companyCode;
  175 + var children = result[i].children;
  176 + for(var j = 0; j < children.length; j++){
  177 + var code = children[j].code;
  178 + for(var k=0;k < xlList.length;k++ ){
  179 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  180 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  181 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  182 + }
  183 + }
  184 + }
  185 + }
  186 + initPinYinSelect2('#line',data,'');
  187 +
  188 + });
  189 + });
  190 +
  191 + $("#line").on("change", function(){
  192 + if($("#line").val() == " "){
  193 + $("#gsdmManth").attr("disabled", false);
  194 + $("#fgsdmManth").attr("disabled", false);
  195 + } else {
  196 + var temp = tempData[$("#line").val()].split(":");
  197 + $("#gsdmManth").val(temp[0]);
  198 + updateCompany();
  199 + $("#fgsdmManth").val(temp[1]);
  200 + $("#gsdmManth").attr("disabled", true);
  201 +// $("#fgsdmManth").attr("disabled", true);
  202 + }
  203 + });
  204 +
  205 + var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
  206 + $("#empnames").on("change",function(){
  207 + if(cont == "驾驶员"){
  208 + cont1 = $("#cont").val();
  209 + } else if(cont == "售票员"){
  210 + cont2 = $("#cont").val();
  211 + } else if(cont == "车辆自编号"){
  212 + cont3 = $("#cont").val();
  213 + }
  214 + cont = $("#empnames").val();
  215 + if($("#empnames").val() == "驾驶员"){
  216 + $("#cont").val(cont1);
  217 + } else if($("#empnames").val() == "售票员"){
  218 + $("#cont").val(cont2);
  219 + } else if($("#empnames").val() == "车辆自编号"){
  220 + $("#cont").val(cont3);
  221 + }
  222 + });
  223 +
  224 + $("#query").on("click",function(){
  225 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  226 + layer.msg("请选择时间范围!");
  227 + return;
  228 + }
  229 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  230 + layer.msg("请选择时间范围!");
  231 + return;
  232 + }
  233 + $("#empname").html($("#empnames").val())
  234 + var params={};
  235 + params.empnames=$("#empnames").val();
  236 + params.cont = $("#cont").val();
  237 + params.line = $("#line").val();
  238 + params.startDate = $("#startDate").val();
  239 + params.endDate = $("#endDate").val();
  240 + params.lpName = $("#lpName").val();
  241 + params.gsdmManth= $("#gsdmManth").val();
  242 + params.fgsdmManth= $("#fgsdmManth").val();
  243 + var i = layer.load(2);
  244 + $get("/calc_mix/calcjsyspy",params,function(result){
  245 +
  246 + var list_calcjsyspy = template('list_calcjsyspy',{list:result});
  247 + // 把渲染好的模版html文本追加到表格中
  248 + $('#forms tbody').html(list_calcjsyspy);
  249 + layer.close(i);
  250 +
  251 + });
  252 + });
  253 +
  254 + $("#export").on("click",function(){
  255 + var lineName = $('#line option:selected').text();
  256 + var startDate = $("#startDate").val();
  257 + var endDate = $("#endDate").val();
  258 + var params={};
  259 + params.empnames=$("#empnames").val();
  260 + params.cont = $("#cont").val();
  261 + params.line = $("#line").val();
  262 + params.startDate = $("#startDate").val();
  263 + params.endDate = $("#endDate").val();
  264 + params.lpName = $("#lpName").val();
  265 + params.gsdmManth= $("#gsdmManth").val();
  266 + params.fgsdmManth= $("#fgsdmManth").val();
  267 + params.lineName = lineName;
  268 + params.type='export';
  269 + var i = layer.load(2);
  270 + $get('/calc_export/waybilldayExport',params,function(result){
  271 + var dateTime = "";
  272 + if(startDate == endDate){
  273 + dateTime = moment(startDate).format("YYYYMMDD");
  274 + } else {
  275 + dateTime = moment(startDate).format("YYYYMMDD")
  276 + +"-"+moment(endDate).format("YYYYMMDD");
  277 + }
  278 + window.open("/downloadFile/download?fileName="
  279 + +dateTime+"-"+lineName+"-人车班次公里统计");
  280 + layer.close(i);
  281 + });
  282 + });
  283 +
  284 + });
  285 +
  286 +
  287 +</script>
  288 +<script type="text/html" id="list_calcjsyspy">
  289 + {{each list as obj i}}
  290 + <tr>
  291 + <td>{{i+1}}</td>
  292 + <td>{{obj.jName}}</td>
  293 + <td>{{obj.jhyybc}}</td>
  294 + <td>{{obj.sjyybc}}</td>
  295 + <td>{{obj.lbbc}}</td>
  296 + <td>{{obj.ljbc}}</td>
  297 + <td>{{obj.jhzlc}}</td>
  298 + <td>{{obj.jhyylc}}</td>
  299 + <td>{{obj.jhfyylc}}</td>
  300 + <td>{{obj.sjzlc}}</td>
  301 + <td>{{obj.sjyylc}}</td>
  302 + <td>{{obj.sjfyylc}}</td>
  303 + <td>{{obj.lblc}}</td>
  304 + <td>{{obj.ljyylc}}</td>
  305 + <td>{{obj.ljfyylc}}</td>
  306 + </tr>
  307 + {{/each}}
  308 + {{if list.length == 0}}
  309 + <tr>
  310 + <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
  311 + </tr>
  312 + {{/if}}
  313 +</script>
0 314 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/calc/calcsingledata.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px;
  14 + text-align: center; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>路单数据(统计)</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div style="display: inline-block; margin-left: 31px;" id="gsdmDiv_sing">
  32 + <span class="item-label" style="width: 80px;">公司: </span>
  33 + <select class="form-control" name="company" id="gsdmSing" style="width: 140px;"></select>
  34 + </div>
  35 + <div style="display: inline-block; margin-left: 22px;" id="fgsdmDiv_sing">
  36 + <span class="item-label" style="width: 80px;">分公司: </span>
  37 + <select class="form-control" name="subCompany" id="fgsdmSing" style="width: 140px;"></select>
  38 + </div>
  39 + <div style="display: inline-block; margin-left: 31px;">
  40 + <span class="item-label" style="width: 80px;">线路: </span>
  41 + <select class="form-control" name="line" id="line" style="width: 140px;"></select>
  42 + </div>
  43 + <div style="margin-top: 10px"></div>
  44 + <div style="display: inline-block;margin-left: 3px;">
  45 + <span class="item-label" style="width: 140px;">开始时间: </span>
  46 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  47 + </div>
  48 + <div style="display: inline-block;margin-left: 8px;">
  49 + <span class="item-label" style="width: 140px;">结束时间: </span>
  50 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  51 + </div>
  52 + <div style="display: inline-block;margin-left: 31px">
  53 + <span class="item-label" style="width: 150px;">统计: </span>
  54 + <select class="form-control" name="tjtype" id="tjtype" style="width: 140px;">
  55 + <option value="驾驶员">驾驶员</option>
  56 + <option value="售票员">售票员</option>
  57 + <option value="车辆自编号">车辆自编号</option>
  58 + </select>
  59 + <div style="display: inline-block;margin-left: 0px">
  60 + <span class="item-label" style="width: 150px;">:</span>
  61 + <input class="form-control" name="cont" id="cont" style="width: 136px;"></input>
  62 + </div>
  63 + </div>
  64 + <div class="form-group">
  65 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  66 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  67 + </div>
  68 + </form>
  69 + </div>
  70 + <div class="portlet-body">
  71 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  72 + <table class="table table-bordered table-hover table-checkable" id="forms">
  73 + <thead>
  74 + <tr>
  75 + <th>序号</th>
  76 + <th>所属公司</th>
  77 + <th>线路</th>
  78 + <th id='empname'>驾驶员</th>
  79 + <th>行驶里程(包括空放)</th>
  80 + <th>空驶里程</th>
  81 + <th>耗油量</th>
  82 + <th>加注量</th>
  83 + <th>非营业用油</th>
  84 + <th>计划公里</th>
  85 + </tr>
  86 + </thead>
  87 + <tbody>
  88 +
  89 + </tbody>
  90 + </table>
  91 + </div>
  92 + </div>
  93 + </div>
  94 + </div>
  95 +</div>
  96 +
  97 +<script>
  98 + $(function(){
  99 + // 关闭左侧栏
  100 + if (!$('body').hasClass('page-sidebar-closed'))
  101 + $('.menu-toggler.sidebar-toggler').click();
  102 +
  103 + $("#startDate,#endDate").datetimepicker({
  104 + format : 'YYYY-MM-DD',
  105 + locale : 'zh-cn'
  106 + });
  107 +
  108 + var d = new Date();
  109 + var year = d.getFullYear();
  110 + var month = d.getMonth() + 1;
  111 + var day = d.getDate();
  112 + if(month < 10)
  113 + month = "0" + month;
  114 + if(day < 10)
  115 + day = "0" + day;
  116 + $("#startDate,#endDate").val(year + "-" + month + "-" + day);
  117 +
  118 + var fage=false;
  119 + var xlList;
  120 + var obj = [];
  121 +
  122 + $.get('/report/lineList',function(result){
  123 + xlList=result;
  124 + $.get('/user/companyData', function(result){
  125 + obj = result;
  126 + var options = '';
  127 + for(var i = 0; i < obj.length; i++){
  128 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  129 + }
  130 +
  131 + if(obj.length ==0){
  132 + $("#gsdmDiv_sing").css('display','none');
  133 + }else if(obj.length ==1){
  134 + $("#gsdmDiv_sing").css('display','none');
  135 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  136 + $('#fgsdmDiv_sing').css('display','none');
  137 + }
  138 + $('#gsdmSing').html(options);
  139 + updateCompany();
  140 + });
  141 + })
  142 + $("#gsdmSing").on("change",updateCompany);
  143 + function updateCompany(){
  144 + var company = $('#gsdmSing').val();
  145 +// var options = '<option value="">全部分公司</option>';
  146 + var options ='';
  147 + for(var i = 0; i < obj.length; i++){
  148 + if(obj[i].companyCode == company){
  149 + var children = obj[i].children;
  150 + for(var j = 0; j < children.length; j++){
  151 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  152 + }
  153 + }
  154 + }
  155 + $('#fgsdmSing').html(options);
  156 + }
  157 +
  158 + var tempData = {};
  159 + $.get('/report/lineList',function(xlList){
  160 + var data = [];
  161 + data.push({id: " ", text: "全部线路"});
  162 + $.get('/user/companyData', function(result){
  163 + for(var i = 0; i < result.length; i++){
  164 + var companyCode = result[i].companyCode;
  165 + var children = result[i].children;
  166 + for(var j = 0; j < children.length; j++){
  167 + var code = children[j].code;
  168 + for(var k=0;k < xlList.length;k++ ){
  169 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  170 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  171 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  172 + }
  173 + }
  174 + }
  175 + }
  176 + initPinYinSelect2('#line',data,'');
  177 +
  178 + });
  179 + });
  180 +
  181 + $("#line").on("change", function(){
  182 + if($("#line").val() == " "){
  183 + $("#gsdmSing").attr("disabled", false);
  184 + $("#fgsdmSing").attr("disabled", false);
  185 + } else {
  186 + var temp = tempData[$("#line").val()].split(":");
  187 + $("#gsdmSing").val(temp[0]);
  188 + updateCompany();
  189 +// $("#fgsdmSing").val(temp[1]);
  190 + $("#fgsdmSing").val("");
  191 + $("#gsdmSing").attr("disabled", true);
  192 +// $("#fgsdmSing").attr("disabled", true);
  193 + }
  194 + });
  195 +
  196 + var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
  197 + $("#tjtype").on("change",function(){
  198 + if(cont == "驾驶员"){
  199 + cont1 = $("#cont").val();
  200 + } else if(cont == "售票员"){
  201 + cont2 = $("#cont").val();
  202 + } else if(cont == "车辆自编号"){
  203 + cont3 = $("#cont").val();
  204 + }
  205 + cont = $("#tjtype").val();
  206 + if($("#tjtype").val() == "驾驶员"){
  207 + $("#cont").val(cont1);
  208 + } else if($("#tjtype").val() == "售票员"){
  209 + $("#cont").val(cont2);
  210 + } else if($("#tjtype").val() == "车辆自编号"){
  211 + $("#cont").val(cont3);
  212 + }
  213 + });
  214 +
  215 + $("#query").on("click",function(){
  216 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  217 + layer.msg("请选择时间!");
  218 + return;
  219 + }
  220 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  221 + layer.msg("请选择时间!");
  222 + return;
  223 + }
  224 + $("#empname").html($("#tjtype").val());
  225 + var line = $("#line").val();
  226 + var startDate = $("#startDate").val();
  227 + var endDate = $("#endDate").val();
  228 + var gsdmSing = $("#gsdmSing").val();
  229 + var fgsdmSing = $("#fgsdmSing").val();
  230 + var tjtype=$("#tjtype").val();
  231 + var cont=$("#cont").val();
  232 + var params = {};
  233 + var i = layer.load(2);
  234 + $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont},function(result){
  235 + layer.close(i);
  236 + var singledata = template('singledata',{list:result});
  237 + // 把渲染好的模版html文本追加到表格中
  238 + $('#forms tbody').html(singledata);
  239 + });
  240 + });
  241 +
  242 + $("#export").on("click",function(){
  243 + var line = $("#line").val();
  244 + var startDate = $("#startDate").val();
  245 + var endDate = $("#endDate").val();
  246 + var gsdmSing = $("#gsdmSing").val();
  247 + var fgsdmSing = $("#fgsdmSing").val();
  248 + var tjtype=$("#tjtype").val();
  249 + var cont=$("#cont").val();
  250 + var lineName = $('#line option:selected').text();
  251 + if(lineName == "全部线路")
  252 + lineName = $('#fgsdmSing option:selected').text();
  253 + var i = layer.load(2);
  254 + $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,type:'export',lineName:lineName},function(result){
  255 + var dateTime = "";
  256 + if(startDate == endDate){
  257 + dateTime = moment(startDate).format("YYYYMMDD");
  258 + } else {
  259 + dateTime = moment(startDate).format("YYYYMMDD")
  260 + +"-"+moment(endDate).format("YYYYMMDD");
  261 + }
  262 + window.open("/downloadFile/download?fileName="
  263 + +dateTime+"-"+lineName+"-路单数据(统计)");
  264 + layer.close(i);
  265 + });
  266 + });
  267 + });
  268 +
  269 +</script>
  270 +<script type="text/html" id="singledata">
  271 + {{each list as obj i}}
  272 + <tr>
  273 + <td>{{i+1}}</td>
  274 + <td>{{obj.gS}}</td>
  275 + <td>{{obj.xlName}}</td>
  276 + <td>{{obj.jName}}</td>
  277 + <td>{{obj.sjzlc}}</td>
  278 + <td>{{obj.sjfyylc}}</td>
  279 + <td>{{obj.hyl}}</td>
  280 + <td>{{obj.jzl}}</td>
  281 + <td>{{obj.sh}}</td>
  282 + <td>{{obj.jhzlc}}</td>
  283 + </tr>
  284 + {{/each}}
  285 + {{if list.length == 0}}
  286 + <tr>
  287 + <td colspan="16"><h6 class="muted">没有找到相关数据</h6></td>
  288 + </tr>
  289 + {{/if}}
  290 +</script>
... ...
src/main/resources/static/pages/forms/mould/calcTurnoutrateZgf.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/calcjsyspy.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/calcsingledata.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/scheduleDaily_df.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/statisticsDaily_3.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -398,21 +398,42 @@
398 398 var zdsjActual = (obj.zdsjActual).split(":");
399 399 var zdsj = (obj.zdsj).split(":");
400 400 if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
401   - obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  401 + if((zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]))>1200){
  402 + obj["fast"] = 1440-((zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])));
  403 +
  404 + }else{
  405 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  406 +
  407 + }
402 408 }
403 409 else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
404   - obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  410 + if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]))>1200){
  411 + obj["slow"] =1440-((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])));
  412 + }else{
  413 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  414 +
  415 + }
405 416 }
406 417 }
407 418  
408 419 if(obj.fcsj != null && obj.fcsjActual != null ){
409 420 var fcsjActual = (obj.fcsjActual).split(":");
410 421 var fcsj = (obj.fcsj).split(":");
  422 +
411 423 if(fcsjActual[0]*60+Number(fcsjActual[1]) > fcsj[0]*60+Number(fcsj[1])){
412   - obj["slow0"] = (fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1]));
  424 + if((fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1]))>1200){
  425 + obj["fast0"] = 1440-((fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1])));
  426 + }else{
  427 + obj["slow0"] = (fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1]));
  428 + }
413 429 }
414 430 else if(fcsjActual[0]*60+Number(fcsjActual[1]) < fcsj[0]*60+Number(fcsj[1])){
415   - obj["fast0"] = (fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]));
  431 + if( (fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]))>1200){
  432 + obj["slow0"] = 1440-((fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1])));;
  433 + }else{
  434 + obj["fast0"] = (fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]));
  435 +
  436 + }
416 437 }
417 438 }
418 439 });
... ... @@ -446,7 +467,7 @@
446 467 divFrom2 = window.document.getElementById('forms_1');
447 468 divFrom2.style.width=divFrom1.offsetWidth+"px";
448 469 });
449   - $.get('/realSchedule/realScheduleList_zrw',{line:line,date:date,type:"query"},function(result){
  470 + $.get('/realSchedule/realScheduleList',{line:line,date:date,type:"query"},function(result){
450 471 getTime(result);
451 472 var scheduleDaily_3 = template('scheduleDaily_3',{list:result});
452 473 $('#forms_2 .scheduleDaily_3').html(scheduleDaily_3);
... ...
src/main/resources/static/pages/forms/statement/scheduleDaily_df.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid;
  11 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +
  19 +
  20 +
  21 + #ddrbBody tr> td >span{
  22 + word-break: keep-all;white-space:nowrap;
  23 + }
  24 +</style>
  25 +
  26 +<div class="page-head" >
  27 + <div class="page-title">
  28 + <h1>调度日报</h1>
  29 + </div>
  30 +</div>
  31 +
  32 +<!-- <div class="row" > -->
  33 + <div class=" row col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)">
  34 +<!-- <div class="" > -->
  35 + <div class="portlet-title">
  36 + <form class="form-inline" action="">
  37 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_ddrb">
  38 + <span class="item-label" style="width: 80px;">公司: </span>
  39 + <select class="form-control" name="company" id="gsdmDdrb" style="width: 180px;"></select>
  40 + </div>
  41 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_ddrb">
  42 + <span class="item-label" style="width: 80px;">分公司: </span>
  43 + <select class="form-control" name="subCompany" id="fgsdmDdrb" style="width: 180px;"></select>
  44 + </div>
  45 + <div style="margin-top: 2px"></div>
  46 + <div style="display: inline-block;">
  47 + <span class="item-label" style="width: 80px;margin-left: 33px;">线路: </span>
  48 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  49 + </div>
  50 + <div style="display: inline-block;margin-left: 38px;">
  51 + <span class="item-label" style="width: 80px;">时间: </span>
  52 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  53 + </div>
  54 + <div class="form-group">
  55 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  56 +<!-- <input class="btn btn-default" type="button" id="month" value="按月查询"/> -->
  57 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  58 + </div>
  59 + </form>
  60 + </div>
  61 + <div class="portlet-body" id="ddrbBody" style="overflow:auto;height: calc(100% - 80px)">
  62 + <div class="table-container" style="margin-top: 10px;min-width: 906px">
  63 + <label>日期:<span id="rqxs"></span>&nbsp;&nbsp;&nbsp;&nbsp;早高峰:6:31~8:30&nbsp;&nbsp;&nbsp;&nbsp;晚高峰:16:01~18:00</label>
  64 + <br/><label>计划+临加-少驶=<span id="jls"></span>&nbsp;&nbsp;计算机实驶:<span id="jsjss"></span></label>
  65 + &nbsp;&nbsp;当班调派:<span id="dbdp"></span></label>
  66 + <table class="table table-bordered table-hover table-checkable" id="forms">
  67 + <thead>
  68 + <tr>
  69 + <th colspan="40"><label id="xlmc"></label>线路调度日报</th>
  70 + </tr>
  71 + <tr>
  72 + <td rowspan="3"><span>路线</span></td>
  73 + <td colspan="16">全日营运里程(公里)</td>
  74 + <td colspan="15">全日营运班次</td>
  75 + <td colspan="9">大间隔情况</td>
  76 + </tr>
  77 + <tr>
  78 + <td rowspan="2"><span >计划</span></td>
  79 + <td rowspan="2"><span >实驶</span></td>
  80 + <td rowspan="2"><span>少驶公里</span></td>
  81 + <td rowspan="2"><span>少驶班次</span></td>
  82 + <td colspan="11">少驶原因(公里)</td>
  83 + <td rowspan="2"><span >临加公里</span></td>
  84 + <td colspan="3">计划班次</td>
  85 + <td colspan="3">实际班次</td>
  86 + <td colspan="3">临加班次</td>
  87 + <td colspan="3">放站班次</td>
  88 + <td colspan="3">调头班次</td>
  89 + <td colspan="3">发生次数</td>
  90 + <td rowspan="2">最大间隔时间(秒)</td>
  91 + <td colspan="5" rowspan="2">原因</td>
  92 + </tr>
  93 + <tr>
  94 + <td><span>路阻</span></td>
  95 + <td><span>吊慢</span></td>
  96 + <td><span>故障</span></td>
  97 + <td><span>纠纷</span></td>
  98 + <td><span>肇事</span></td>
  99 + <td><span>缺人</span></td>
  100 + <td><span>缺车</span></td>
  101 + <td><span>客稀</span></td>
  102 + <td><span>气候</span></td>
  103 + <td><span>援外</span></td>
  104 + <td><span>其他</span></td>
  105 + <td><span>全日</span></td>
  106 + <td><span>早高峰</span></td>
  107 + <td><span>晚高峰</span></td>
  108 + <td><span>全日</span></td>
  109 + <td><span>早高峰</span></td>
  110 + <td><span>晚高峰</span></td>
  111 + <td><span>全日</span></td>
  112 + <td><span>早高峰</span></td>
  113 + <td><span>晚高峰</span></td>
  114 + <td><span>全日</span></td>
  115 + <td><span>早高峰</span></td>
  116 + <td><span>晚高峰</span></td>
  117 + <td><span>全日</span></td>
  118 + <td><span>早高峰</span></td>
  119 + <td><span>晚高峰</span></td>
  120 + <td><span>全日</span></td>
  121 + <td><span>早高峰</span></td>
  122 + <td><span>晚高峰</span></td>
  123 + </tr>
  124 + </thead>
  125 +
  126 + <tbody class="scheduleDaily_1">
  127 +
  128 + </tbody>
  129 + <tr>
  130 + <td colspan="40">&nbsp;</td>
  131 + </tr>
  132 + </table>
  133 + <!-- <tr>
  134 + <td colspan="40">合计</td>
  135 + </tr>
  136 + <tr>
  137 + <td>售票</td>
  138 + <td colspan="2">1元</td>
  139 + <td colspan="2">2元</td>
  140 + <td colspan="2">3元</td>
  141 + <td colspan="2">4元</td>
  142 + <td colspan="2">5元</td>
  143 + <td colspan="2">6元</td>
  144 + <td colspan="2">7元</td>
  145 + <td colspan="2">8元</td>
  146 + <td colspan="2">9元</td>
  147 + <td colspan="2">10元</td>
  148 + <td colspan="2">&nbsp;</td>
  149 + <td colspan="2">合计张数</td>
  150 + <td colspan="2">&nbsp;</td>
  151 + <td colspan="2">预售票</td>
  152 + <td colspan="2">1元</td>
  153 + <td colspan="2">1.5元</td>
  154 + <td colspan="2">合计张数</td>
  155 + <td colspan="5">&nbsp;</td>
  156 + </tr>
  157 + <tr>
  158 + <td>张数</td>
  159 + <td colspan="2">&nbsp;</td>
  160 + <td colspan="2">&nbsp;</td>
  161 + <td colspan="2">&nbsp;</td>
  162 + <td colspan="2">&nbsp;</td>
  163 + <td colspan="2">&nbsp;</td>
  164 + <td colspan="2">&nbsp;</td>
  165 + <td colspan="2">&nbsp;</td>
  166 + <td colspan="2">&nbsp;</td>
  167 + <td colspan="2">&nbsp;</td>
  168 + <td colspan="2">&nbsp;</td>
  169 + <td colspan="2">&nbsp;</td>
  170 + <td colspan="2">合计金额</td>
  171 + <td colspan="2">&nbsp;</td>
  172 + <td colspan="2">张数</td>
  173 + <td colspan="2">&nbsp;</td>
  174 + <td colspan="2">&nbsp;</td>
  175 + <td colspan="2">合计金额</td>
  176 + <td colspan="5">&nbsp;</td>
  177 + </tr>
  178 + <tr>
  179 + <td colspan="40">&nbsp;</td>
  180 + </tr> -->
  181 + <table class="table table-bordered table-hover table-checkable" id="forms_1">
  182 + <tr>
  183 + <td colspan="2"><label>路牌</label></td>
  184 + <td colspan="2"><label>车号</label></td>
  185 + <td> <label>司早</label></td>
  186 + <td><label>售早</label></td>
  187 + <td><label>司晚</label></td>
  188 + <td><label>售晚</label></td>
  189 + <td colspan="2"><label>路牌</label></td>
  190 + <td colspan="2"><label>车号</label></td>
  191 + <td><label>司早</label></td>
  192 + <td><label>售早</label></td>
  193 + <td><label>司晚</label></td>
  194 + <td><label>售晚</label></td>
  195 + <td colspan="2"><label>路牌</label></td>
  196 + <td colspan="2"><label>车号</label></td>
  197 + <td><label>司早</label></td>
  198 + <td><label>售早</label></td>
  199 + <td><label>司晚</label></td>
  200 + <td><label>售晚</label></td>
  201 + <td colspan="2"><label>路牌</label></td>
  202 + <td colspan="2"><label>车号</label></td>
  203 + <td><label>司早</label></td>
  204 + <td><label>售早</label></td>
  205 + <td><label>司晚</label></td>
  206 + <td><label>售晚</label></td>
  207 + <td colspan="2"><label>路牌</label></td>
  208 + <td colspan="2"><label>车号</label></td>
  209 + <td><label>司早</label></td>
  210 + <td><label>售早</label></td>
  211 + <td><label>司晚</label></td>
  212 + <td><label>售晚</label></td>
  213 + </tr>
  214 + <tbody class="scheduleDaily_2">
  215 +
  216 + </tbody>
  217 + <tr>
  218 + <td colspan="40">&nbsp;</td>
  219 + </tr>
  220 + </table>
  221 + <table class="table table-bordered table-hover table-checkable" id="forms_2">
  222 + <tr>
  223 + <td rowspan="2">路牌</td>
  224 + <td colspan="2" rowspan="2" style="word-break: keep-all;white-space:nowrap;">起点站</td>
  225 + <td colspan="4">到达时间</td>
  226 + <td colspan="4">发车时间</td>
  227 + <td colspan="3">待发时间</td>
  228 + <td colspan="2" rowspan="2">备注</td>
  229 + <td rowspan="2">路牌</td>
  230 + <td colspan="2" rowspan="2" style="word-break: keep-all;white-space:nowrap;">起点站</td>
  231 + <td colspan="4">到达时间</td>
  232 + <td colspan="4">发车时间</td>
  233 + <td colspan="3">待发时间</td>
  234 + <td colspan="2" rowspan="2">备注</td>
  235 + <td rowspan="2">路牌</td>
  236 + <td colspan="2" rowspan="2" style="word-break: keep-all;white-space:nowrap;">起点站</td>
  237 + <td colspan="4">到达时间</td>
  238 + <td colspan="4">发车时间</td>
  239 + <td colspan="3">待发时间</td>
  240 + <td colspan="2" rowspan="2">备注</td>
  241 + </tr>
  242 + <tr>
  243 + <td>应到</td>
  244 + <td>实到</td>
  245 + <td>快</td>
  246 + <td>慢</td>
  247 + <td>应发</td>
  248 + <td>实发</td>
  249 + <td>快</td>
  250 + <td>慢</td>
  251 + <td>待发</td>
  252 + <td>快</td>
  253 + <td>慢</td>
  254 + <td>应到</td>
  255 + <td>实到</td>
  256 + <td>快</td>
  257 + <td>慢</td>
  258 + <td>应发</td>
  259 + <td>实发</td>
  260 + <td>快</td>
  261 + <td>慢</td>
  262 + <td>待发</td>
  263 + <td>快</td>
  264 + <td>慢</td>
  265 + <td>应到</td>
  266 + <td>实到</td>
  267 + <td>快</td>
  268 + <td>慢</td>
  269 + <td>应发</td>
  270 + <td>实发</td>
  271 + <td>快</td>
  272 + <td>慢</td>
  273 + <td>待发</td>
  274 + <td>快</td>
  275 + <td>慢</td>
  276 + </tr>
  277 + <tbody class="scheduleDaily_3">
  278 +
  279 + </tbody>
  280 + </table>
  281 + </div>
  282 + </div>
  283 +<!-- </div> -->
  284 +<!-- </div> -->
  285 +</div>
  286 +
  287 +<script>
  288 + $(function(){
  289 + // 关闭左侧栏
  290 + if (!$('body').hasClass('page-sidebar-closed'))
  291 + $('.menu-toggler.sidebar-toggler').click();
  292 +
  293 + $("#date").datetimepicker({
  294 + format : 'YYYY-MM-DD',
  295 + locale : 'zh-cn'
  296 + });
  297 + var d = new Date();
  298 + var year = d.getFullYear();
  299 + var month = d.getMonth() + 1;
  300 + var day = d.getDate();
  301 + if(month < 10)
  302 + month = "0" + month;
  303 + if(day < 10)
  304 + day = "0" + day;
  305 + $("#date").val(year + "-" + month + "-" + day);
  306 +
  307 +// $("#ddrbBody").height($(window).height()-200);
  308 +
  309 + var divFrom1 = window.document.getElementById('forms');
  310 + var divFrom2 = window.document.getElementById('forms_1');
  311 + var divFrom3 = window.document.getElementById('forms_2');
  312 + divFrom2.style.width=divFrom1.offsetWidth+"px";
  313 + divFrom3.style.width=divFrom1.offsetWidth+"px";
  314 + /* $.get('/basic/lineCode2Name',function(result){
  315 + var data=[];
  316 +
  317 + for(var code in result){
  318 + data.push({id: code, text: result[code]});
  319 + }
  320 + initPinYinSelect2('#line',data,'');
  321 +
  322 + }) */
  323 + var fage=false;
  324 + var obj = [];
  325 + var xlList;
  326 + $.get('/report/lineList',function(result){
  327 + xlList=result;
  328 + $.get('/user/companyData', function(result){
  329 + obj = result;
  330 + var options = '';
  331 + for(var i = 0; i < obj.length; i++){
  332 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  333 + }
  334 + if(obj.length ==0){
  335 + $("#gsdmDiv_ddrb").css('display','none');
  336 + }else if(obj.length ==1){
  337 + $("#gsdmDiv_ddrb").css('display','none');
  338 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  339 + $('#fgsdmDiv_ddrb').css('display','none');
  340 + }
  341 + $('#gsdmDdrb').html(options);
  342 + updateCompany();
  343 + });
  344 + })
  345 + $("#gsdmDdrb").on("change",updateCompany);
  346 + function updateCompany(){
  347 + var company = $('#gsdmDdrb').val();
  348 + var options = '';
  349 + for(var i = 0; i < obj.length; i++){
  350 + if(obj[i].companyCode == company){
  351 + var children = obj[i].children;
  352 + for(var j = 0; j < children.length; j++){
  353 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  354 + }
  355 + }
  356 + }
  357 + $('#fgsdmDdrb').html(options);
  358 + }
  359 +
  360 +
  361 + var tempData = {};
  362 + $.get('/report/lineList',function(xlList){
  363 + var data = [];
  364 + $.get('/user/companyData', function(result){
  365 + for(var i = 0; i < result.length; i++){
  366 + var companyCode = result[i].companyCode;
  367 + var children = result[i].children;
  368 + for(var j = 0; j < children.length; j++){
  369 + var code = children[j].code;
  370 + for(var k=0;k < xlList.length;k++ ){
  371 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  372 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  373 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  374 + }
  375 + }
  376 + }
  377 + }
  378 + initPinYinSelect2('#line',data,'');
  379 +
  380 + });
  381 + });
  382 +
  383 + $("#line").on("change", function(){
  384 + if($("#line").val() == " "){
  385 + $("#gsdmDdrb").attr("disabled", false);
  386 + $("#fgsdmDdrb").attr("disabled", false);
  387 + } else {
  388 + var temp = tempData[$("#line").val()].split(":");
  389 + $("#gsdmDdrb").val(temp[0]);
  390 + updateCompany();
  391 + $("#fgsdmDdrb").val(temp[1]);
  392 + $("#gsdmDdrb").attr("disabled", true);
  393 + $("#fgsdmDdrb").attr("disabled", true);
  394 + }
  395 + });
  396 +
  397 +
  398 + $('#export').attr('disabled', "true");
  399 +
  400 + var line = $("#line").val();
  401 + var xlName = $("#select2-line-container").html();
  402 + var date = $("#date").val();
  403 +
  404 + function getTime(list){
  405 + $.each(list, function(i, obj) {
  406 + if(obj.zdsj != null && obj.zdsjActual != null ){
  407 + var zdsjActual = (obj.zdsjActual).split(":");
  408 + var zdsj = (obj.zdsj).split(":");
  409 + if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
  410 + if((zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]))>1200){
  411 + obj["fast"] = 1440-((zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])));
  412 +
  413 + }else{
  414 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  415 +
  416 + }
  417 + }
  418 + else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
  419 + if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]))>1200){
  420 + obj["slow"] =1440-((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])));
  421 + }else{
  422 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  423 +
  424 + }
  425 + }
  426 + }
  427 +
  428 + if(obj.fcsj != null && obj.fcsjActual != null ){
  429 + var fcsjActual = (obj.fcsjActual).split(":");
  430 + var fcsj = (obj.fcsj).split(":");
  431 + var dfsj= (obj.dfsj).split(":");
  432 +
  433 + if(fcsjActual[0]*60+Number(fcsjActual[1]) > fcsj[0]*60+Number(fcsj[1])){
  434 + if((fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1]))>1200){
  435 + obj["fast0"] = 1440-((fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1])));
  436 + }else{
  437 + obj["slow0"] = (fcsjActual[0]*60+Number(fcsjActual[1])) - (fcsj[0]*60+Number(fcsj[1]));
  438 + }
  439 + }
  440 + else if(fcsjActual[0]*60+Number(fcsjActual[1]) < fcsj[0]*60+Number(fcsj[1])){
  441 + if( (fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]))>1200){
  442 + obj["slow0"] = 1440-((fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1])));;
  443 + }else{
  444 + obj["fast0"] = (fcsj[0]*60+Number(fcsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]));
  445 +
  446 + }
  447 + }
  448 +
  449 + if(fcsjActual[0]*60+Number(fcsjActual[1]) > dfsj[0]*60+Number(dfsj[1])){
  450 + if((fcsjActual[0]*60+Number(fcsjActual[1])) - (dfsj[0]*60+Number(dfsj[1]))>1200){
  451 + obj["fast1"]=1440-((fcsjActual[0]*60+Number(fcsjActual[1])) - (dfsj[0]*60+Number(dfsj[1])));
  452 + }else{
  453 + obj["slow1"] = (fcsjActual[0]*60+Number(fcsjActual[1])) - (dfsj[0]*60+Number(dfsj[1]));
  454 + }
  455 + }
  456 + else if(fcsjActual[0]*60+Number(fcsjActual[1]) < dfsj[0]*60+Number(dfsj[1])){
  457 + if((dfsj[0]*60+Number(dfsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]))>1200){
  458 + obj["slow1"]=1440-((dfsj[0]*60+Number(dfsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1])));
  459 + }else{
  460 + obj["fast1"] = (dfsj[0]*60+Number(dfsj[1])) - (fcsjActual[0]*60+Number(fcsjActual[1]));
  461 + }
  462 + }
  463 + }
  464 + });
  465 + }
  466 + //查询
  467 + $("#query").on('click',function(){
  468 + line = $("#line").val();
  469 + xlName = $("#select2-line-container").html();
  470 + date = $("#date").val();
  471 + $("#rqxs").html(date);
  472 + if(date == null || date.length == 0){
  473 + layer.msg("请选择时间");
  474 + return;
  475 + }
  476 + $("#xlmc").html(xlName+" "+date+" ");
  477 +// $("#ddrbBody").height($(window).height()-300);
  478 + $("c").html("全日");
  479 + $("#export").removeAttr("disabled");
  480 + var i = layer.load(2);
  481 + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
  482 + var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
  483 + $("#jls").html(result[0].jls);
  484 + $("#jsjss").html(result[0].sjgl);
  485 + $("#dbdp").html(result[0].dbdp);
  486 + $('#forms .scheduleDaily_1').html(scheduleDaily_1);
  487 + });
  488 + $.get('/realSchedule/queryUserInfo',{line:line,date:date,state:2,type:"query"},function(result){
  489 + var scheduleDaily_2 = template('scheduleDaily_2',{list:result});
  490 + $('#forms_1 .scheduleDaily_2').html(scheduleDaily_2);
  491 + divFrom1 = window.document.getElementById('forms');
  492 + divFrom2 = window.document.getElementById('forms_1');
  493 + divFrom2.style.width=divFrom1.offsetWidth+"px";
  494 + });
  495 + $.get('/realSchedule/realScheduleList',{line:line,date:date,type:"query"},function(result){
  496 + getTime(result);
  497 + var scheduleDaily_3 = template('scheduleDaily_3',{list:result});
  498 + $('#forms_2 .scheduleDaily_3').html(scheduleDaily_3);
  499 + divFrom1 = window.document.getElementById('forms');
  500 + divFrom3 = window.document.getElementById('forms_2');
  501 + divFrom3.style.width=divFrom1.offsetWidth+"px";
  502 + layer.close(i);
  503 + });
  504 +
  505 + });
  506 +
  507 + //按月查询
  508 + /* $("#month").on('click',function(){
  509 + line = $("#line").val();
  510 + xlName = $("#select2-line-container").html();
  511 + date = $("#date").val();
  512 + if(date == null || date.length == 0){
  513 + layer.msg("请选择时间");
  514 + return;
  515 + }
  516 + date = date.substring(0, 7);
  517 + $("c").html("全月");
  518 + $("#export").removeAttr("disabled");
  519 + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
  520 + var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
  521 + $('#forms .scheduleDaily_1').html(scheduleDaily_1);
  522 + });
  523 + $('#forms .scheduleDaily_2').html("");
  524 + $('#forms .scheduleDaily_3').html("");
  525 +
  526 + }); */
  527 +
  528 + $("#export").on("click",function(){
  529 + var params = {};
  530 + if(date == null || date.length == 0){
  531 + layer.msg("请选择时间");
  532 + return;
  533 + }
  534 + var lineName = $('#line option:selected').text();
  535 + params['line'] = line;
  536 + params['lineName'] = lineName;
  537 + params['date'] = date;
  538 + params['xlName'] = xlName;
  539 + params['type'] = "export";
  540 + params['state'] = '2';
  541 + params['genre'] = 'fqp';
  542 + params['df'] = 'df';
  543 + $get('/realSchedule/scheduleDailyExport', params, function(result){
  544 + if(date.length == 10)
  545 + window.open("/downloadFile/download?fileName="+moment(date).format("YYYYMMDD")+"-"+lineName+"-调度日报");
  546 + else
  547 + window.open("/downloadFile/download?fileName="+moment(date).format("YYYYMM")+"-"+lineName+"-调度日报");
  548 + });
  549 + });
  550 +
  551 + });
  552 +</script>
  553 +<script type="text/html" id="scheduleDaily_1">
  554 + {{each list as obj i}}
  555 + <tr >
  556 + <td>{{obj.xlName}}</td>
  557 + <td>{{obj.jhlc}}</td>
  558 + <td>{{obj.sjgl}}</td>
  559 + <td>{{obj.ssgl}}</td>
  560 + <td>{{obj.ssbc}}</td>
  561 + <td>{{obj.ssgl_lz}}</td>
  562 + <td>{{obj.ssgl_dm}}</td>
  563 + <td>{{obj.ssgl_gz}}</td>
  564 + <td>{{obj.ssgl_jf}}</td>
  565 + <td>{{obj.ssgl_zs}}</td>
  566 + <td>{{obj.ssgl_qr}}</td>
  567 + <td>{{obj.ssgl_qc}}</td>
  568 + <td>{{obj.ssgl_kx}}</td>
  569 + <td>{{obj.ssgl_qh}}</td>
  570 + <td>{{obj.ssgl_yw}}</td>
  571 + <td>{{obj.ssgl_other}}</td>
  572 + <td>{{obj.ljgl}}</td>
  573 + <td>{{obj.jhbc}}</td>
  574 + <td>{{obj.jhbc_m}}</td>
  575 + <td>{{obj.jhbc_a}}</td>
  576 + <td>{{obj.sjbc}}</td>
  577 + <td>{{obj.sjbc_m}}</td>
  578 + <td>{{obj.sjbc_a}}</td>
  579 + <td>{{obj.ljbc}}</td>
  580 + <td>{{obj.ljbc_m}}</td>
  581 + <td>{{obj.ljbc_a}}</td>
  582 + <td>{{obj.fzbc}}</td>
  583 + <td>{{obj.fzbc_m}}</td>
  584 + <td>{{obj.fzbc_a}}</td>
  585 + <td>{{obj.dtbc}}</td>
  586 + <td>{{obj.dtbc_m}}</td>
  587 + <td>{{obj.dtbc_a}}</td>
  588 + <td>{{obj.djg}}</td>
  589 + <td>{{obj.djg_m}}</td>
  590 + <td>{{obj.djg_a}}</td>
  591 + <td>{{obj.djg_time}}</td>
  592 + <td colspan="5">&nbsp;</td>
  593 + </tr>
  594 + {{/each}}
  595 + {{if list.length == 0}}
  596 + <tr>
  597 + <td colspan="40"><h6 class="muted">没有找到相关数据</h6></td>
  598 + </tr>
  599 + {{/if}}
  600 +</script>
  601 +<script type="text/html" id="scheduleDaily_2">
  602 + {{each list as obj i}}
  603 + {{if i%5 == 0}}
  604 + <tr>
  605 + {{/if}}
  606 + <td colspan="2">{{obj[3]}}</td>
  607 + <td colspan="2">{{obj[2]}}</td>
  608 + <td>{{obj[1]}}/{{obj[4]}}</td>
  609 + <td>{{if obj[5] !=null}}
  610 + {{obj[5]}}/
  611 + {{obj[6]}}
  612 +
  613 + {{/if}}
  614 + </td>
  615 + <td>&nbsp;</td>
  616 + <td>&nbsp;</td>
  617 + {{if (i+1)%5 == 0}}
  618 + </tr>
  619 + {{/if}}
  620 + {{/each}}
  621 + {{if list.length == 0}}
  622 + <tr>
  623 + <td colspan="40"><h6 class="muted">没有找到相关数据</h6></td>
  624 + </tr>
  625 + {{/if}}
  626 +</script>
  627 +<script type="text/html" id="scheduleDaily_3">
  628 + {{each list as obj i}}
  629 + {{if i%3 == 0}}
  630 + <tr>
  631 + {{/if}}
  632 + <td>{{obj.lpName}}</td>
  633 + <td colspan="2" style="word-break: keep-all;white-space:nowrap;">{{obj.qdzName}}</td>
  634 + <td>{{obj.zdsj}}</td>
  635 + <td>{{obj.zdsjActual}}</td>
  636 + <td>{{obj.fast}}</td>
  637 + <td>{{obj.slow}}</td>
  638 + <td>{{obj.fcsj}}</td>
  639 + <td>{{obj.fcsjActual}}
  640 + {{if obj.bcType== "in"}}
  641 + (进)
  642 + {{/if}}
  643 + {{if obj.bcType== "out"}}
  644 + (出)
  645 + {{/if}}
  646 + </td>
  647 + <td>{{obj.fast0}}</td>
  648 + <td>{{obj.slow0}}
  649 + <td>{{obj.dfsj}}</td>
  650 + <td>{{obj.fast1}}</td>
  651 + <td>{{obj.slow1}}</td>
  652 + </td>
  653 + <td colspan="2" title="{{obj.remark}}">{{obj.remarks}}</td>
  654 + {{if (i+1)%3 == 0}}
  655 + </tr>
  656 + {{/if}}
  657 + {{/each}}
  658 + {{if list.length == 0}}
  659 + <tr>
  660 + <td colspan="40"><h6 class="muted">没有找到相关数据</h6></td>
  661 + </tr>
  662 + {{/if}}
  663 +</script>
0 664 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/statisticsDaily.html
... ... @@ -28,7 +28,7 @@
28 28  
29 29 <div class="page-head">
30 30 <div class="page-title">
31   - <h1>统计日报(按年、月、季度查询请点击<a href="statisticsDailyCalc2.html" target="_blank">统计查询</a>)</h1>
  31 + <h1>统计日报(按年、月、季度查询请点击<a href="statisticsDailyCalc2.html" target="_blank">【统计查询】</a>)</h1>
32 32 </div>
33 33 </div>
34 34  
... ... @@ -274,6 +274,8 @@
274 274 var gsdm="";
275 275 var fgsdm="";
276 276 var nature="";
  277 + var time1="";
  278 + var time2="";
277 279 $("#query").on("click",function(){
278 280 if($("#date").val() == null || $("#date").val().trim().length == 0){
279 281 layer.msg("请选择时间范围!");
... ... @@ -298,36 +300,41 @@
298 300 if(line=="请选择"){
299 301 line="";
300 302 }
301   - var time1 = Date.parse(new Date(date));
302   - var time2 = Date.parse(new Date(date2));
  303 + time1 = Date.parse(new Date(date));
  304 + time2 = Date.parse(new Date(date2));
303 305 if(date==null || date =="" ||date2==null || date2 ==""){
304 306 layer.msg('请选择时间段.');
305 307 }else if(time2<time1){
306 308 layer.msg('结束日期不能小于开始日期.');
307 309 }else{
308   - $("#tjrq").html(date+"至"+date2);
309   - var params = {};
310   - params['gsdm'] = gsdm;
311   - params['fgsdm'] =fgsdm ;
312   - params['line'] = line;
313   - params['date'] = date;
314   - params['date2'] = date2;
315   - params['xlName'] = xlName;
316   - params['nature'] = nature;
317   - params['type'] = "query";
318   - var i = layer.load(2);
319   - $get('/realSchedule/statisticsDailyTj',params,function(result){
320   - // 把数据填充到模版中
321   - var tbodyHtml = template('statisticsDaily',{list:result});
322   - // 把渲染好的模版html文本追加到表格中
323   - $('#forms .statisticsDaily').html(tbodyHtml);
324   - layer.close(i);
325   -
326   - if(result.length == 0)
327   - $("#export").attr('disabled',"true");
328   - else
329   - $("#export").removeAttr("disabled");
330   - });
  310 + if((time2-time1)>2678400000){
  311 + layer.msg('查询超过一个月请点击【统计查询】.');
  312 + }else{
  313 + $("#tjrq").html(date+"至"+date2);
  314 + var params = {};
  315 + params['gsdm'] = gsdm;
  316 + params['fgsdm'] =fgsdm ;
  317 + params['line'] = line;
  318 + params['date'] = date;
  319 + params['date2'] = date2;
  320 + params['xlName'] = xlName;
  321 + params['nature'] = nature;
  322 + params['type'] = "query";
  323 + var i = layer.load(2);
  324 + $get('/realSchedule/statisticsDailyTj',params,function(result){
  325 + // 把数据填充到模版中
  326 + var tbodyHtml = template('statisticsDaily',{list:result});
  327 + // 把渲染好的模版html文本追加到表格中
  328 + $('#forms .statisticsDaily').html(tbodyHtml);
  329 + layer.close(i);
  330 +
  331 + if(result.length == 0)
  332 + $("#export").attr('disabled',"true");
  333 + else
  334 + $("#export").removeAttr("disabled");
  335 + });
  336 + }
  337 +
331 338 }
332 339  
333 340 });
... ... @@ -337,24 +344,30 @@
337 344 params['gsdm'] = gsdm;
338 345 params['fgsdm'] =fgsdm;
339 346 params['line'] = line;
  347 + date = $("#date").val();
  348 + date2 =$("#date2").val();
340 349 params['date'] = date;
341 350 params['date2'] = date2;
342 351 params['xlName'] = xlName;
343 352 params['nature'] = nature;
344 353 params['type'] = "export";
345   - var i = layer.load(2);
346   - $get('/realSchedule/statisticsDailyTj',params,function(result){
347   - var dateTime = "";
348   - if(date == date2){
349   - dateTime = moment(date).format("YYYYMMDD");
350   - } else {
351   - dateTime = moment(date).format("YYYYMMDD")
352   - +"-"+moment(date2).format("YYYYMMDD");
  354 + if((time2-time1)>2678400000){
  355 + layer.msg('查询超过一个月请点击【统计查询】.');
  356 + }else{
  357 + var i = layer.load(2);
  358 + $get('/realSchedule/statisticsDailyTj',params,function(result){
  359 + var dateTime = "";
  360 + if(date == date2){
  361 + dateTime = moment(date).format("YYYYMMDD");
  362 + } else {
  363 + dateTime = moment(date).format("YYYYMMDD")
  364 + +"-"+moment(date2).format("YYYYMMDD");
  365 + }
  366 + window.open("/downloadFile/download?fileName="
  367 + +dateTime+"-"+xlName+"-统计日报");
  368 + layer.close(i);
  369 + });
353 370 }
354   - window.open("/downloadFile/download?fileName="
355   - +dateTime+"-"+xlName+"-统计日报");
356   - layer.close(i);
357   - });
358 371 });
359 372  
360 373 });
... ...
src/main/resources/static/pages/forms/statement/statisticsDailyCalc.html
... ... @@ -28,7 +28,7 @@
28 28  
29 29 <div class="page-head">
30 30 <div class="page-title">
31   - <h1>缁熻鏃ユ姤</h1>
  31 + <h1>统计日报(按年、月、季度查询请点击<a href="statisticsDailyCalc2.html" target="_blank">【统计查询】</a>)</h1>
32 32 </div>
33 33 </div>
34 34  
... ... @@ -37,115 +37,126 @@
37 37 <!-- <div> -->
38 38 <div class="portlet-title">
39 39 <form class="form-inline" action="">
40   - <div style="display: inline-block; " id="gsdmDiv">
41   - <span class="item-label" style="width: 80px;">鍏徃: </span>
  40 + <div style="display: inline-block;margin-left: 29px; " id="gsdmDiv">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
42 42 <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
43 43 </div>
44 44 <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
45   - <span class="item-label" style="width: 80px;">鍒嗗叕鍙�: </span>
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
46 46 <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
47 47 </div>
48   - <div style="margin-top: 2px"></div>
49   - <div style="display: inline-block;">
50   - <span class="item-label" style="width: 80px;">绾胯矾: </span>
  48 + <div style="display: inline-block;margin-left: 42px;">
  49 + <span class="item-label" style="width: 80px;">线路: </span>
51 50 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
52 51 </div>
  52 + <div style="margin-top: 3px"></div>
  53 + <div style="display: inline-block;">
  54 + <span class="item-label" style="width: 80px;">线路性质: </span>
  55 + <select
  56 + class="form-control" name="nature" id="nature"
  57 + style="width: 180px;">
  58 + <option value="0">全部线路</option>
  59 + <option value="1" selected="selected">营运线路</option>
  60 + <option value="2">非营运线路</option>
  61 + </select>
  62 + </div>
53 63 <div style="display: inline-block;margin-left: 15px;">
54   - <span class="item-label" style="width: 80px;">寮�濮嬫椂闂�: </span>
  64 + <span class="item-label" style="width: 80px;">开始时间: </span>
55 65 <input class="form-control" type="text" id="date" style="width: 180px;"/>
56 66 </div>
57 67 <div style="display: inline-block;margin-left: 15px;">
58   - <span class="item-label" style="width: 80px;">缁撴潫鏃堕棿: </span>
  68 + <span class="item-label" style="width: 80px;">结束时间: </span>
59 69 <input class="form-control" type="text" id="date2" style="width: 180px;"/>
60 70 </div>
61 71 <div class="form-group">
62   - <input class="btn btn-default" type="button" id="query" value="鏌ヨ"/>
63   - <input class="btn btn-default" type="button" id="export" value="瀵煎嚭"/>
  72 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  73 + <input class="btn btn-default" type="button" id="export" value="导出"/>
64 74 </div>
65 75 </form>
66 76 </div>
67 77 <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)">
68 78 <div class="table-container" style="margin-top: 10px;min-width: 906px">
69   - <label>鏃╅珮宄�:6:31~8:30&nbsp;&nbsp;&nbsp;&nbsp;鏅氶珮宄�:16:01~18:00</label>
  79 + <label>早高峰:6:31~8:30&nbsp;&nbsp;&nbsp;&nbsp;晚高峰:16:01~18:00</label>
70 80 <table class="table table-bordered table-hover table-checkable" id="forms">
71 81 <thead>
72 82 <tr>
73   - <th colspan="44"><label id="tjrq"></label> 绾胯矾缁熻鏃ユ姤</th>
  83 + <th colspan="45"><label id="tjrq"></label> 线路统计日报</th>
74 84 </tr>
75 85 <tr>
76   - <td rowspan="3"><span >璺嚎鍚�</span></td>
77   - <td colspan="20">鍏ㄦ棩钀ヨ繍閲岀▼锛堝叕閲岋級</td>
78   - <td colspan="15">鍏ㄦ棩钀ヨ繍鐝</td>
79   - <td colspan="9">澶ч棿闅旀儏鍐�</td>
  86 + <td rowspan="3"><span >分公司</span></td>
  87 + <td rowspan="3"><span >路线名</span></td>
  88 + <td colspan="21">全日营运里程(公里)(注:实际营运里程、实际空驶里程、实际总里程均已包含临加里程)</td>
  89 + <td colspan="15">全日营运班次</td>
  90 + <td colspan="9">大间隔情况</td>
80 91 </tr>
81 92 <tr>
82   - <td rowspan="2"><label>璁″垝鎬�</label>
83   - <label>鍏噷&nbsp;&nbsp;&nbsp;</label></td>
84   - <td rowspan="2"><label>璁″垝钀�</label><label>杩愬叕閲�</label></td>
85   - <td rowspan="2"><label>璁″垝绌�</label><label>椹跺叕閲�</label></td>
86   - <td rowspan="2"><label>瀹為檯</label><label>鎬诲叕閲�</label></td>
87   - <td rowspan="2"><label>瀹為檯钀�</label><label>杩愬叕閲�</label></td>
88   - <td rowspan="2"><label>瀹為檯绌�</label><label>椹跺叕閲�</label></td>
89   - <td rowspan="2"><span>灏戦┒鍏噷</span></td>
90   - <td rowspan="2"><span>灏戦┒鐝</span></td>
91   - <td colspan="11">灏戦┒鍘熷洜锛堝叕閲岋級</td>
92   - <td rowspan="2"><span >涓村姞鍏噷</span></td>
93   - <td colspan="3">璁″垝鐝</td>
94   - <td colspan="3">瀹為檯鐝</td>
95   - <td colspan="3">涓村姞鐝</td>
96   - <td colspan="3">鏀剧珯鐝</td>
97   - <td colspan="3">璋冨ご鐝</td>
98   - <td colspan="3">鍙戠敓娆℃暟</td>
99   - <td rowspan="2">鏈�澶ч棿闅旀椂闂达紙鍒嗭級</td>
100   - <td rowspan="2">鍘熷洜</td>
  93 + <td rowspan="2"><label>计划总</label>
  94 + <label>公里&nbsp;&nbsp;&nbsp;</label></td>
  95 + <td rowspan="2"><label>计划营</label><label>运公里</label></td>
  96 + <td rowspan="2"><label>计划空</label><label>驶公里</label></td>
  97 + <td rowspan="2"><label>实际</label><label>总公里</label></td>
  98 + <td rowspan="2"><label>实际营</label><label>运公里</label></td>
  99 + <td rowspan="2"><label>实际空</label><label>驶公里</label></td>
  100 + <td rowspan="2"><span>少驶公里</span></td>
  101 + <td rowspan="2"><span>少驶班次</span></td>
  102 + <td colspan="11">少驶原因(公里)</td>
  103 + <td colspan="2">临加公里</td>
  104 + <td colspan="3">计划班次</td>
  105 + <td colspan="3">实际班次</td>
  106 + <td colspan="3">临加班次</td>
  107 + <td colspan="3">放站班次</td>
  108 + <td colspan="3">调头班次</td>
  109 + <td colspan="3">发生次数</td>
  110 + <td rowspan="2">最大间隔时间(分)</td>
  111 + <td rowspan="2">原因</td>
101 112 </tr>
102 113 <tr>
103   - <td><span >璺樆</span></td>
104   - <td><span>鍚婃參</span></td>
105   - <td><span >鏁呴殰</span></td>
106   - <td><span >绾犵悍</span></td>
107   - <td><span >鑲囦簨</span></td>
108   - <td><span>缂轰汉</span></td>
109   - <td><span>缂鸿溅</span></td>
110   - <td><span >瀹㈢█</span></td>
111   - <td><span>姘斿��</span></td>
112   - <td><span>鎻村</span></td>
113   - <td><span>鍏朵粬</span></td>
114   - <td><span>鍏ㄦ棩</span></td>
115   - <td><span>鏃╅珮宄�</span></td>
116   - <td><span>鏅氶珮宄�</span></td>
117   - <td><span>鍏ㄦ棩</span></td>
118   - <td><span>鏃╅珮宄�</span></td>
119   - <td><span>鏅氶珮宄�</span></td>
120   - <td><span>鍏ㄦ棩</span></td>
121   - <td><span>鏃╅珮宄�</span></td>
122   - <td><span>鏅氶珮宄�</span></td>
123   - <td><span>鍏ㄦ棩</span></td>
124   - <td><span>鏃╅珮宄�</span></td>
125   - <td><span>鏅氶珮宄�</span></td>
126   - <td><span>鍏ㄦ棩</span></td>
127   - <td><span>鏃╅珮宄�</span></td>
128   - <td><span>鏅氶珮宄�</span></td>
129   - <td><span>鍏ㄦ棩</span></td>
130   - <td><span>鏃╅珮宄�</span></td>
131   - <td><span>鏅氶珮宄�</span></td>
  114 + <td><span >路阻</span></td>
  115 + <td><span>吊慢</span></td>
  116 + <td><span >故障</span></td>
  117 + <td><span >纠纷</span></td>
  118 + <td><span >肇事</span></td>
  119 + <td><span>缺人</span></td>
  120 + <td><span>缺车</span></td>
  121 + <td><span >客稀</span></td>
  122 + <td><span>气候</span></td>
  123 + <td><span>援外</span></td>
  124 + <td><span>其他</span></td>
  125 + <td><span>营运</span></td>
  126 + <td><span>空驶</span></td>
  127 + <td><span>全日</span></td>
  128 + <td><span>早高峰</span></td>
  129 + <td><span>晚高峰</span></td>
  130 + <td><span>全日</span></td>
  131 + <td><span>早高峰</span></td>
  132 + <td><span>晚高峰</span></td>
  133 + <td><span>全日</span></td>
  134 + <td><span>早高峰</span></td>
  135 + <td><span>晚高峰</span></td>
  136 + <td><span>全日</span></td>
  137 + <td><span>早高峰</span></td>
  138 + <td><span>晚高峰</span></td>
  139 + <td><span>全日</span></td>
  140 + <td><span>早高峰</span></td>
  141 + <td><span>晚高峰</span></td>
  142 + <td><span>全日</span></td>
  143 + <td><span>早高峰</span></td>
  144 + <td><span>晚高峰</span></td>
132 145 </tr>
133 146 </thead>
134   - <tbody class="statisticsDailyCalc">
  147 + <tbody class="statisticsDailyCalc2">
135 148  
136 149 </tbody>
137 150 </table>
138 151 </div>
139 152 </div>
140 153 </div>
141   - </div>
142   -</div>
143 154  
144 155 <script>
145 156 $(function(){
146 157 $('#export').attr('disabled', "true");
147 158  
148   - // 鍏抽棴宸︿晶鏍�
  159 + // 关闭左侧栏
149 160 if (!$('body').hasClass('page-sidebar-closed'))
150 161 $('.menu-toggler.sidebar-toggler').click();
151 162  
... ... @@ -162,18 +173,18 @@
162 173 $("#date").datetimepicker({
163 174 format : 'YYYY-MM-DD',
164 175 locale : 'zh-cn',
165   - maxDate : dateTime
  176 +// maxDate : dateTime
166 177 });
167 178 $("#date2").datetimepicker({
168 179 format : 'YYYY-MM-DD',
169 180 locale : 'zh-cn',
170   - maxDate : dateTime
  181 +// maxDate : dateTime
171 182 });
172 183 $("#date").val(dateTime);
173 184 $("#date2").val(dateTime);
174 185  
175 186  
176   - var fage=false;
  187 + var fage=true;
177 188 var obj = [];
178 189 var xlList;
179 190 $.get('/report/lineList',function(result){
... ... @@ -189,8 +200,10 @@
189 200 $("#gsdmDiv").css('display','none');
190 201 }else if(obj.length ==1){
191 202 $("#gsdmDiv").css('display','none');
192   - if(obj[0].children.length == 1 || obj[0].children.length ==0)
  203 + if(obj[0].children.length == 1 || obj[0].children.length ==0){
  204 + fage=false;
193 205 $('#fgsdmDiv').css('display','none');
  206 + }
194 207 }
195 208 $('#gsdm').html(options);
196 209 updateCompany();
... ... @@ -200,6 +213,9 @@
200 213 function updateCompany(){
201 214 var company = $('#gsdm').val();
202 215 var options = '';
  216 + if(fage){
  217 + options = '<option value="">请选择</option>';
  218 + }
203 219 for(var i = 0; i < obj.length; i++){
204 220 if(obj[i].companyCode == company){
205 221 var children = obj[i].children;
... ... @@ -215,7 +231,7 @@
215 231 var tempData = {};
216 232 $.get('/report/lineList',function(xlList){
217 233 var data = [];
218   - data.push({id: " ", text: "鍏ㄩ儴绾胯矾"});
  234 + data.push({id: " ", text: "全部线路"});
219 235 $.get('/user/companyData', function(result){
220 236 for(var i = 0; i < result.length; i++){
221 237 var companyCode = result[i].companyCode;
... ... @@ -256,13 +272,14 @@
256 272 var date2 ="";
257 273 var gsdm="";
258 274 var fgsdm="";
  275 + var nature="";
259 276 $("#query").on("click",function(){
260 277 if($("#date").val() == null || $("#date").val().trim().length == 0){
261   - layer.msg("璇烽�夋嫨鏃堕棿鑼冨洿锛�");
  278 + layer.msg("请选择时间范围!");
262 279 return;
263 280 }
264 281 if($("#date2").val() == null || $("#date2").val().trim().length == 0){
265   - layer.msg("璇烽�夋嫨鏃堕棿鑼冨洿锛�");
  282 + layer.msg("请选择时间范围!");
266 283 return;
267 284 }
268 285 // $("#tjrbBody").height($(window).height()-100);
... ... @@ -271,16 +288,19 @@
271 288 date2 =$("#date2").val();
272 289 gsdm =$("#gsdm").val();
273 290 fgsdm=$("#fgsdm").val();
  291 + nature=$("#nature").val();
274 292 xlName = $("#select2-line-container").html();
275   - if(xlName == "鍏ㄩ儴绾胯矾")
  293 + if(xlName == "全部线路")
276 294 xlName = $('#fgsdm option:selected').text();
277   - if(line=="璇烽�夋嫨"){
  295 + if(xlName =='请选择')
  296 + xlName = $('#gsdm option:selected').text();
  297 + if(line=="请选择"){
278 298 line="";
279 299 }
280 300 if(date==null || date =="" ||date2==null || date2 ==""){
281   - layer.msg('璇烽�夋嫨鏃堕棿娈�.');
  301 + layer.msg('请选择时间段.');
282 302 }else{
283   - $("#tjrq").html(date+"鑷�"+date2);
  303 + $("#tjrq").html(date+""+date2);
284 304 var params = {};
285 305 params['gsdm'] = gsdm;
286 306 params['fgsdm'] =fgsdm ;
... ... @@ -289,13 +309,14 @@
289 309 params['date2'] = date2;
290 310 params['xlName'] = xlName;
291 311 params['type'] = "query";
  312 + params['nature']=nature;
292 313 var i = layer.load(2);
293 314 // $get('/realSchedule/statisticsDailyTj',params,function(result){
294   - $get('/calcWaybill/statisticsDailyTj',params,function(result){
295   - // 鎶婃暟鎹~鍏呭埌妯$増涓�
296   - var tbodyHtml = template('statisticsDailyCalc',{list:result});
297   - // 鎶婃覆鏌撳ソ鐨勬ā鐗坔tml鏂囨湰杩藉姞鍒拌〃鏍间腑
298   - $('#forms .statisticsDailyCalc').html(tbodyHtml);
  315 + $get('/calcWaybill/calcStatisticsDaily2',params,function(result){
  316 + // 把数据填充到模版中
  317 + var tbodyHtml = template('statisticsDailyCalc2',{list:result});
  318 + // 把渲染好的模版html文本追加到表格中
  319 + $('#forms .statisticsDailyCalc2').html(tbodyHtml);
299 320 layer.close(i);
300 321  
301 322 if(result.length == 0)
... ... @@ -315,10 +336,11 @@
315 336 params['date'] = date;
316 337 params['date2'] = date2;
317 338 params['xlName'] = xlName;
318   - params['type'] = "export";
  339 + params['type'] = "export";
  340 + params['nature']=nature;
319 341 var i = layer.load(2);
320 342 // $get('/realSchedule/statisticsDailyTj',params,function(result){
321   - $get('/calcWaybill/statisticsDailyTj',params,function(result){
  343 + $get('/calcWaybill/calcStatisticsDaily2',params,function(result){
322 344 var dateTime = "";
323 345 if(date == date2){
324 346 dateTime = moment(date).format("YYYYMMDD");
... ... @@ -327,16 +349,17 @@
327 349 +"-"+moment(date2).format("YYYYMMDD");
328 350 }
329 351 window.open("/downloadFile/download?fileName="
330   - +dateTime+"-"+xlName+"-缁熻鏃ユ姤");
  352 + +dateTime+"-"+xlName+"-统计日报");
331 353 layer.close(i);
332 354 });
333 355 });
334 356  
335 357 });
336 358 </script>
337   -<script type="text/html" id="statisticsDailyCalc">
  359 +<script type="text/html" id="statisticsDailyCalc2">
338 360 {{each list as obj i}}
339 361 <tr {{if obj.zt==1}}style='color: red'{{/if}}>
  362 + <td>{{obj.fgsName}}</td>
340 363 <td>{{obj.xlName}}</td>
341 364 <td>{{obj.jhzlc}}</td>
342 365 <td>{{obj.jhlc}}</td>
... ... @@ -358,6 +381,7 @@
358 381 <td>{{obj.ssgl_yw}}</td>
359 382 <td>{{obj.ssgl_other}}</td>
360 383 <td>{{obj.ljgl}}</td>
  384 + <td>{{obj.ljks}}</td>
361 385 <td>{{obj.jhbc}}</td>
362 386 <td>{{obj.jhbc_m}}</td>
363 387 <td>{{obj.jhbc_a}}</td>
... ... @@ -382,7 +406,7 @@
382 406 {{/each}}
383 407 {{if list.length == 0}}
384 408 <tr>
385   - <td colspan="44"><h6 class="muted">娌℃湁鎵惧埌鐩稿叧鏁版嵁</h6></td>
  409 + <td colspan="44"><h6 class="muted">没有找到相关数据</h6></td>
386 410 </tr>
387 411 {{/if}}
388 412 </script>
389 413 \ No newline at end of file
... ...
src/main/resources/static/pages/mforms/singledatas/singledata.html
... ... @@ -41,15 +41,15 @@
41 41 <select class="form-control" name="line" id="line" style="width: 140px;"></select>
42 42 </div>
43 43 <div style="margin-top: 10px"></div>
44   - <div style="display: inline-block; margin-left: 5px">
  44 + <!-- <div style="display: inline-block; margin-left: 5px">
45 45 <span class="item-label" style="width: 80px;">是否营运: </span>
46 46 <select class="form-control" name="sfyy" id="sfyy" style="width: 140px;">
47 47 <option value="0">全部线路</option>
48 48 <option value="1" selected="selected">营运线路</option>
49 49 <option value="2">非营运线路</option>
50 50 </select>
51   - </div>
52   - <div style="display: inline-block;margin-left: 24px;">
  51 + </div> -->
  52 + <div style="display: inline-block;margin-left: 33px;">
53 53 <span class="item-label" style="width: 140px;">时间: </span>
54 54 <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
55 55 </div>
... ... @@ -111,6 +111,16 @@
111 111 locale : 'zh-cn'
112 112 });
113 113  
  114 + var d = new Date();
  115 + var year = d.getFullYear();
  116 + var month = d.getMonth() + 1;
  117 + var day = d.getDate();
  118 + if(month < 10)
  119 + month = "0" + month;
  120 + if(day < 10)
  121 + day = "0" + day;
  122 + $("#startDate").val(year + "-" + month + "-" + day);
  123 +
114 124 var fage=false;
115 125 var xlList;
116 126 var obj = [];
... ... @@ -138,7 +148,8 @@
138 148 $("#gsdmSing").on("change",updateCompany);
139 149 function updateCompany(){
140 150 var company = $('#gsdmSing').val();
141   - var options = '<option value="">全部分公司</option>';
  151 +// var options = '<option value="">全部分公司</option>';
  152 + var options ='';
142 153 for(var i = 0; i < obj.length; i++){
143 154 if(obj[i].companyCode == company){
144 155 var children = obj[i].children;
... ... @@ -181,8 +192,8 @@
181 192 var temp = tempData[$("#line").val()].split(":");
182 193 $("#gsdmSing").val(temp[0]);
183 194 updateCompany();
184   -// $("#fgsdmSing").val(temp[1]);
185   - $("#fgsdmSing").val("");
  195 + $("#fgsdmSing").val(temp[1]);
  196 +// $("#fgsdmSing").val("");
186 197 $("#gsdmSing").attr("disabled", true);
187 198 // $("#fgsdmSing").attr("disabled", true);
188 199 }
... ...
src/main/resources/static/pages/mforms/singledatas/singledata_date.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px;
  14 + text-align: center; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>路单统计</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_sing">
  32 + <span class="item-label" style="width: 140px;">&nbsp;&nbsp;&nbsp;&nbsp;
  33 + &nbsp;
  34 + 公司: </span>
  35 + <select class="form-control" name="company" id="gsdmSing" style="width: 140px;"></select>
  36 + </div>
  37 + <div style="display: inline-block; margin-left: 10px;" id="fgsdmDiv_sing">
  38 + <span class="item-label" style="width: 140px;">&nbsp;&nbsp;&nbsp;&nbsp;分公司: </span>
  39 + <select class="form-control" name="subCompany" id="fgsdmSing" style="width: 140px;"></select>
  40 + </div>
  41 + <div style="display: inline-block; margin-left: 15px;">
  42 + <span class="item-label" style="width: 80px;">线路: </span>
  43 + <select class="form-control" name="line" id="line" style="width: 140px;"></select>
  44 + </div>
  45 + <div style="margin-top: 10px"></div>
  46 +
  47 + <div style="display: inline-block;margin-left: 33px;">
  48 + <span class="item-label" style="width: 140px;">开始时间: </span>
  49 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  50 + </div>
  51 + <div style="display: inline-block;margin-left: 15px;">
  52 + <span class="item-label" style="width: 140px;">结束时间: </span>
  53 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  54 + </div>
  55 +
  56 + <div style="display: inline-block;margin-left: 15px">
  57 + <span class="item-label" style="width: 150px;">统计: </span>
  58 + <select class="form-control" name="tjtype" id="tjtype" style="width: 140px;">
  59 + <option value="jsy">驾驶员</option>
  60 + <option value="spy">售票员</option>
  61 + </select>
  62 +
  63 + </div>
  64 + <div class="form-group">
  65 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  66 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  67 + </div>
  68 + </form>
  69 + </div>
  70 + <div class="portlet-body">
  71 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  72 + <table class="table table-bordered table-hover table-checkable" id="forms">
  73 + <thead>
  74 + <tr>
  75 + <th>序号</th>
  76 + <th>日期</th>
  77 + <th>所属公司</th>
  78 + <th>线路</th>
  79 + <th>车号</th>
  80 + <th>司机职号</th>
  81 + <th>司机姓名</th>
  82 + <th>售票员职号</th>
  83 + <th>售票员姓名</th>
  84 + <th>行驶里程(包括空放)</th>
  85 + <th>空驶里程</th>
  86 + <th>耗油量</th>
  87 + <th>加注量</th>
  88 + <th>非营业用油</th>
  89 + <th>计划公里</th>
  90 + </tr>
  91 + </thead>
  92 + <tbody>
  93 +
  94 + </tbody>
  95 + </table>
  96 + </div>
  97 + </div>
  98 + </div>
  99 + </div>
  100 +</div>
  101 +
  102 +<script>
  103 + $(function(){
  104 + // 关闭左侧栏
  105 + if (!$('body').hasClass('page-sidebar-closed'))
  106 + $('.menu-toggler.sidebar-toggler').click();
  107 +
  108 + $("#startDate,#endDate").datetimepicker({
  109 + format : 'YYYY-MM-DD',
  110 + locale : 'zh-cn'
  111 + });
  112 + var d = new Date();
  113 + var year = d.getFullYear();
  114 + var month = d.getMonth() + 1;
  115 + var day = d.getDate();
  116 + if(month < 10)
  117 + month = "0" + month;
  118 + if(day < 10)
  119 + day = "0" + day;
  120 + $("#startDate").val(year + "-" + month + "-" + day);
  121 + $("#endDate").val(year + "-" + month + "-" + day);
  122 +
  123 +
  124 + var fage=false;
  125 + var xlList;
  126 + var obj = [];
  127 +
  128 + $.get('/report/lineList',function(result){
  129 + xlList=result;
  130 + $.get('/user/companyData', function(result){
  131 + obj = result;
  132 + var options = '';
  133 + for(var i = 0; i < obj.length; i++){
  134 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  135 + }
  136 +
  137 + if(obj.length ==0){
  138 + $("#gsdmDiv_sing").css('display','none');
  139 + }else if(obj.length ==1){
  140 + $("#gsdmDiv_sing").css('display','none');
  141 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  142 + $('#fgsdmDiv_sing').css('display','none');
  143 + }
  144 + $('#gsdmSing').html(options);
  145 + updateCompany();
  146 + });
  147 + })
  148 + $("#gsdmSing").on("change",updateCompany);
  149 + function updateCompany(){
  150 + var company = $('#gsdmSing').val();
  151 + var options ='';
  152 +// var options = '<option value="">全部分公司</option>';
  153 + for(var i = 0; i < obj.length; i++){
  154 + if(obj[i].companyCode == company){
  155 + var children = obj[i].children;
  156 + for(var j = 0; j < children.length; j++){
  157 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  158 + }
  159 + }
  160 + }
  161 + $('#fgsdmSing').html(options);
  162 + }
  163 +
  164 + var tempData = {};
  165 + $.get('/report/lineList',function(xlList){
  166 + var data = [];
  167 + data.push({id: " ", text: "全部线路"});
  168 + $.get('/user/companyData', function(result){
  169 + for(var i = 0; i < result.length; i++){
  170 + var companyCode = result[i].companyCode;
  171 + var children = result[i].children;
  172 + for(var j = 0; j < children.length; j++){
  173 + var code = children[j].code;
  174 + for(var k=0;k < xlList.length;k++ ){
  175 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  176 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  177 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  178 + }
  179 + }
  180 + }
  181 + }
  182 + initPinYinSelect2('#line',data,'');
  183 +
  184 + });
  185 + });
  186 +
  187 + $("#line").on("change", function(){
  188 + if($("#line").val() == " "){
  189 + $("#gsdmSing").attr("disabled", false);
  190 + $("#fgsdmSing").attr("disabled", false);
  191 + } else {
  192 + var temp = tempData[$("#line").val()].split(":");
  193 + $("#gsdmSing").val(temp[0]);
  194 + updateCompany();
  195 + $("#fgsdmSing").val(temp[1]);
  196 +// $("#fgsdmSing").val("");
  197 + $("#gsdmSing").attr("disabled", true);
  198 + $("#fgsdmSing").attr("disabled", true);
  199 + }
  200 + });
  201 +
  202 +
  203 + $("#query").on("click",function(){
  204 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  205 + layer.msg("请选择时间!");
  206 + return;
  207 + }
  208 + var i = layer.load(2);
  209 + var params = {};
  210 + params['sfyy'] = $("#sfyy").val();
  211 + params['gsdmSing'] = $("#gsdmSing").val();
  212 + params['fgsdmSing'] = $("#fgsdmSing").val();
  213 + params['line'] = $("#line").val();
  214 + params['startDate'] = $("#startDate").val();
  215 + params['endDate'] = $("#endDate").val();
  216 + params['lpName'] = $("#lpName").val();
  217 + params['tjtype'] = $("#tjtype").val();
  218 + params['spy'] = "zrw";
  219 +
  220 + $get("/report/singledatatj",params,function(result){
  221 + layer.close(i);
  222 + var singledata = template('singledata',{list:result});
  223 + // 把渲染好的模版html文本追加到表格中
  224 + $('#forms tbody').html(singledata);
  225 +
  226 + });
  227 +
  228 + });
  229 +
  230 + $("#export").on("click",function(){
  231 + var params = {};
  232 + params['sfyy'] = $("#sfyy").val();
  233 + params['gsdmSing'] = $("#gsdmSing").val();
  234 + params['fgsdmSing'] = $("#fgsdmSing").val();
  235 + params['line'] = $("#line").val();
  236 + params['startDate'] = $("#startDate").val();
  237 + params['endDate'] = $("#endDate").val();
  238 + params['lpName'] = $("#lpName").val();
  239 + params['tjtype'] = $("#tjtype").val();
  240 + params['spy'] = "zrw";
  241 + var lineName = $('#line option:selected').text();
  242 + if(lineName == "全部线路")
  243 + lineName = $('#fgsdmSing option:selected').text();
  244 +
  245 + params['lineName'] =lineName;
  246 + params['type'] ='export';
  247 + var i = layer.load(2);
  248 + $get('/report/singledatatj',params,function(result){
  249 + var exportDate="";
  250 + if( $("#startDate").val()==$("#endDate").val()){
  251 + exportDate=moment($("#startDate").val()).format("YYYYMMDD");
  252 + }else{
  253 + exportDate=moment($("#startDate").val()).format("YYYYMMDD")
  254 + +"-"+moment($("#endDate").val()).format("YYYYMMDD");
  255 +
  256 + }
  257 + console.log("exportDate:"+exportDate);
  258 + window.open("/downloadFile/download?fileName="
  259 + +exportDate
  260 + +"-"+lineName+"-路单统计");
  261 + layer.close(i);
  262 + });
  263 +
  264 + });
  265 + });
  266 +</script>
  267 +<script type="text/html" id="singledata">
  268 + {{each list as obj i}}
  269 + <tr>
  270 + <td>{{i+1}}</td>
  271 + <td>{{obj.rQ}}</td>
  272 + <td>{{obj.gS}}</td>
  273 + <td>{{obj.xlmc}}</td>
  274 + <td>{{obj.clzbh}}</td>
  275 + <td>{{obj.jsy}}</td>
  276 + <td>{{obj.jName}}</td>
  277 + <td>{{obj.sgh}}</td>
  278 + <td>{{obj.sName}}</td>
  279 + <td>{{obj.jhlc}}</td>
  280 + <td>{{obj.emptMileage}}</td>
  281 + <td>{{obj.hyl}}</td>
  282 + <td>{{obj.jzl}}</td>
  283 + <td>{{obj.unyyyl}}</td>
  284 + <td>{{obj.jhjl}}</td>
  285 + </tr>
  286 + {{/each}}
  287 + {{if list.length == 0}}
  288 + <tr>
  289 + <td colspan="16"><h6 class="muted">没有找到相关数据</h6></td>
  290 + </tr>
  291 + {{/if}}
  292 +</script>
  293 +<script type="text/html" id="singledata2">
  294 + {{each list as obj i}}
  295 + <tr>
  296 + <td>{{i+1}}</td>
  297 + <td>{{obj.rQ}}</td>
  298 + <td>{{obj.gS}}</td>
  299 + <td>{{obj.xlmc}}</td>
  300 + <td>{{obj.clzbh}}</td>
  301 + <td></td>
  302 + <td></td>
  303 + <td>{{obj.sgh}}</td>
  304 + <td>{{obj.sName}}</td>
  305 + <td>{{obj.jhlc}}</td>
  306 + <td>{{obj.emptMileage}}</td>
  307 + <td></td>
  308 + <td></td>
  309 + <td></td>
  310 + <td>{{obj.jhjl}}</td>
  311 + </tr>
  312 + {{/each}}
  313 + {{if list.length == 0}}
  314 + <tr>
  315 + <td colspan="16"><h6 class="muted">没有找到相关数据</h6></td>
  316 + </tr>
  317 + {{/if}}
  318 +</script>
... ...
src/main/resources/static/pages/mforms/turnoutrates/calcTurnoutrateZgf.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px;
  14 + text-align: center;}
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 + .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ text-align: center; }
  19 +.table-checkable tr > th:first-child, .table-checkable tr > td:first-child {
  20 + text-align: center;
  21 + max-width: initial;
  22 + min-width: 40px;
  23 + padding-left: 0;
  24 + padding-right: 0;
  25 +}
  26 +
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>营运线路出车率统计表</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="" method="post">
  40 + <div style="display: inline-block; margin-left: 20px;" id="gsdmDiv_turn">
  41 + <span class="item-label" style="width: 80px;margin-left: 11px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdmTurn" style="width: 140px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 20px;" id="fgsdmDiv_turn">
  45 + <span class="item-label" style="width: 80px;margin-left: 5px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdmTurn" style="width: 140px;"></select>
  47 + </div>
  48 + <div style="display: inline-block; margin-left: 33px;">
  49 + <span class="item-label" style="width: 80px;margin-left: 11px;">线路: </span>
  50 + <select class="form-control" name="line" id="line" style="width: 140px;"></select>
  51 + </div>
  52 + <div style="margin-top: 10px"></div>
  53 + <div style="display: inline-block;margin-left: 15px;">
  54 + <span class="item-label" style="width: 80px;">开始时间: </span>
  55 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  56 + </div>
  57 + <div style="display: inline-block;margin-left: 15px;">
  58 + <span class="item-label" style="width: 80px;">结束时间: </span>
  59 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  60 + </div>
  61 + <div class="form-group">
  62 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  63 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  64 + </div>
  65 + </form>
  66 + </div>
  67 + <div class="portlet-body">
  68 + <div class="table-container" style="margin-top: 20px;overflow:auto;min-width: 1000px">
  69 + <table class="table table-bordered table-hover table-checkable" id="forms1">
  70 + <thead>
  71 + <tr>
  72 + <th colspan="15">营运线路出车率统计表</th>
  73 + </tr>
  74 + <tr>
  75 + <td style=" padding-top: 20px;">日期</td>
  76 + <td style=" padding-top: 20px;">公司</td>
  77 + <td style=" padding-top: 20px;">直属公司</td>
  78 + <td style=" padding-top: 20px;">线路</td>
  79 + <td style=" padding-top: 20px;">计划全日</td>
  80 + <td style=" padding-top: 20px;">实际全日</td>
  81 + <td style=" padding-top: 20px;">出车率</td>
  82 + <td style=" padding-top: 20px;">计划早高峰</td>
  83 + <td style=" padding-top: 20px;">实际早高峰</td>
  84 + <td style=" padding-top: 20px;">出车率</td>
  85 + </tr>
  86 +
  87 +
  88 + </thead>
  89 + <tbody id="tbody">
  90 +
  91 + </tbody>
  92 + </table>
  93 + </div>
  94 + </div>
  95 + </div>
  96 + </div>
  97 +</div>
  98 +
  99 +<script>
  100 + $(function(){
  101 + // 关闭左侧栏
  102 + if (!$('body').hasClass('page-sidebar-closed'))
  103 + $('.menu-toggler.sidebar-toggler').click();
  104 +
  105 +
  106 + var d = new Date();
  107 + d.setTime(d.getTime() - 1*1000*60*60*24);
  108 + var year = d.getFullYear();
  109 + var month = d.getMonth() + 1;
  110 + var day = d.getDate();
  111 + if(month < 10)
  112 + month = "0" + month;
  113 + if(day < 10)
  114 + day = "0" + day;
  115 + var dateTime = year + "-" + month + "-" + day;
  116 + $("#startDate,#endDate").datetimepicker({
  117 + format : 'YYYY-MM-DD',
  118 + locale : 'zh-cn',
  119 + maxDate : dateTime
  120 + });
  121 + $("#startDate").val(dateTime);
  122 + $("#endDate").val(dateTime);
  123 +
  124 + var fage=true;
  125 + var xlList;
  126 + var obj = [];
  127 +
  128 + $.get('/report/lineList',function(result){
  129 + xlList=result;
  130 + $.get('/user/companyData', function(result){
  131 + obj = result;
  132 + var options = '';
  133 + for(var i = 0; i < obj.length; i++){
  134 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  135 + }
  136 +
  137 + if(obj.length ==0){
  138 + $("#gsdmDiv_turn").css('display','none');
  139 + }else if(obj.length ==1){
  140 + $("#gsdmDiv_turn").css('display','none');
  141 + if(obj[0].children.length == 1 || obj[0].children.length ==0){
  142 + fage=false;
  143 + $('#fgsdmDiv_turn').css('display','none');
  144 +
  145 + }
  146 + }
  147 + $('#gsdmTurn').html(options);
  148 + updateCompany();
  149 + });
  150 + })
  151 + $("#gsdmTurn").on("change",updateCompany);
  152 + function updateCompany(){
  153 + var company = $('#gsdmTurn').val();
  154 + var options = '';
  155 + if(fage){
  156 + options = '<option value="">请选择</option>';
  157 + }
  158 + for(var i = 0; i < obj.length; i++){
  159 + if(obj[i].companyCode == company){
  160 + var children = obj[i].children;
  161 + for(var j = 0; j < children.length; j++){
  162 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  163 + }
  164 + }
  165 + }
  166 + $('#fgsdmTurn').html(options);
  167 + }
  168 +
  169 + var tempData = {};
  170 + $.get('/report/lineList',function(xlList){
  171 + var data = [];
  172 + data.push({id: " ", text: "全部线路"});
  173 + $.get('/user/companyData', function(result){
  174 + for(var i = 0; i < result.length; i++){
  175 + var companyCode = result[i].companyCode;
  176 + var children = result[i].children;
  177 + for(var j = 0; j < children.length; j++){
  178 + var code = children[j].code;
  179 + for(var k=0;k < xlList.length;k++ ){
  180 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  181 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  182 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  183 + }
  184 + }
  185 + }
  186 + }
  187 + initPinYinSelect2('#line',data,'');
  188 +
  189 + });
  190 + });
  191 +
  192 + $("#line").on("change", function(){
  193 + if($("#line").val() == " "){
  194 + $("#gsdmTurn").attr("disabled", false);
  195 + $("#fgsdmTurn").attr("disabled", false);
  196 + } else {
  197 + var temp = tempData[$("#line").val()].split(":");
  198 + $("#gsdmTurn").val(temp[0]);
  199 + updateCompany();
  200 + $("#fgsdmTurn").val(temp[1]);
  201 + $("#gsdmTurn").attr("disabled", true);
  202 + $("#fgsdmTurn").attr("disabled", true);
  203 + }
  204 + });
  205 +
  206 + var line;
  207 + var startDate;
  208 + var endDate;
  209 + var gsdmTurn;
  210 + var fgsdmTurn;
  211 + var nature;
  212 + $("#query").on("click",function(){
  213 +
  214 + line = $("#line").val();
  215 + startDate=$("#startDate").val();
  216 + endDate=$("#endDate").val();
  217 + gsdmTurn=$("#gsdmTurn").val();
  218 + fgsdmTurn=$("#fgsdmTurn").val();
  219 + nature=$("#nature").val();
  220 + if(startDate!=''&&endDate!=''){
  221 + var i = layer.load(2);
  222 + $get('/calcSheet/calcTurnoutrateZgf',
  223 + { gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:startDate,endDate:endDate,nature:nature,type:'query'},function(result){
  224 +// var result=[];
  225 + // 把数据填充到模版中
  226 + var tbodyHtml = template('calcTurnoutrate',{list:result});
  227 + // 把渲染好的模版html文本追加到表格中
  228 + $('#tbody').html(tbodyHtml);
  229 + layer.close(i);
  230 + line = $("#line").val();
  231 + startDate = $("#startDate").val();
  232 + endDate = $("#endDate").val();
  233 + $("#sDate").text(startDate);
  234 + $("#eDate").text(endDate);
  235 + var temp = {};
  236 + var today_account = 0;
  237 +
  238 + temp["line"] = $("#line").text();
  239 + $.each(result, function(i, obj) {
  240 + if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){
  241 + today_account++;
  242 + }
  243 + obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
  244 + });
  245 +
  246 + });
  247 +
  248 + }else{
  249 + layer.msg("请选择时间范围!");
  250 + }
  251 + });
  252 +
  253 + $("#export").on("click",function(){
  254 + line = $("#line").val();
  255 + startDate=$("#startDate").val();
  256 + endDate=$("#endDate").val();
  257 + gsdmTurn=$("#gsdmTurn").val();
  258 + fgsdmTurn=$("#fgsdmTurn").val();
  259 + nature=$("#nature").val();
  260 + var lineName = $('#line option:selected').text();
  261 + if(lineName == "全部线路")
  262 + lineName = $('#fgsdmTurn option:selected').text();
  263 + if(lineName =="请选择")
  264 + lineName = $('#gsdmTurn option:selected').text();
  265 + var i = layer.load(2);
  266 + $get('/calcSheet/calcTurnoutrateZgf',{gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn,line:line,startDate:startDate,endDate:endDate,nature:nature,type:'export',lineName:lineName},function(result){
  267 + var dateTime = "";
  268 + if(startDate == endDate){
  269 + dateTime = startDate;
  270 + } else {
  271 + dateTime = startDate+"-"+endDate;
  272 + }
  273 + window.open("/downloadFile/download?fileName="
  274 + +dateTime+"-"+lineName+"-营运线路出车率统计表");
  275 + layer.close(i);
  276 + });
  277 + });
  278 + });
  279 +</script>
  280 +<script type="text/html" id="calcTurnoutrate">
  281 + {{each list as obj i}}
  282 + <tr>
  283 + <td>{{obj.rq}}</td>
  284 + <td>{{obj.gsName}}</td>
  285 + <td>{{obj.fgsName}}</td>
  286 + <td>{{obj.xlName}}</td>
  287 + <td>{{obj.jhcc}}</td>
  288 + <td>{{obj.sjcc}}</td>
  289 + <td>{{obj.ccl}}</td>
  290 + <td>{{obj.jhcczgf}}</td>
  291 + <td>{{obj.sjcczgf}}</td>
  292 + <td>{{obj.cclzgf}}</td>
  293 + </tr>
  294 + {{/each}}
  295 + {{if list.length == 0}}
  296 + <tr>
  297 + <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td>
  298 + </tr>
  299 + {{/if}}
  300 +</script>
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -242,7 +242,12 @@
242 242 {{obj.fgsname}}
243 243 </td>
244 244 <td width="8%">
245   - {{obj.xlname}}
  245 + {{if obj.linename=='' || obj.linename==null}}
  246 + {{obj.xlname}}
  247 + {{else}}
  248 + {{obj.linename}}
  249 + {{/if}}
  250 +
246 251 </td>
247 252 <td width="5%">
248 253 <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
... ... @@ -253,7 +258,11 @@
253 258 <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input>
254 259 <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button>
255 260 {{else}}
256   - {{obj.jsy}}/{{obj.name}}
  261 + {{if obj.jname=='' || obj.jname==null}}
  262 + {{obj.jsy}}/{{obj.name}}
  263 + {{else}}
  264 + {{obj.jsy}}/{{obj.jname}}
  265 + {{/if}}
257 266 {{/if}}
258 267  
259 268 </td>
... ... @@ -704,7 +713,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
704 713 params['order'] = 'nbbm';
705 714 params['page'] = page;
706 715 params['rq'] = $("#rq").val();
707   -
  716 + params['type']='2';
708 717 var l = layer.load(2);
709 718 $get('/ylb/ylbList', params, function (data) {
710 719 for(var i=1;i<data.length;i++){
... ... @@ -1026,6 +1035,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
1026 1035 $("#export").on("click", function () {
1027 1036 if ($("#rq").val() != "") {
1028 1037 var params=getParamsList();
  1038 + params['type']='2';
1029 1039 $post('/ylb/listExport', params, function (result) {
1030 1040 window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" );
1031 1041 });
... ...
src/main/resources/static/pages/permission/authorize_all/user_auth.html
1   -<!-- 用户线调授权页面 -->
2   -<div id="user_authorize_wrap" style="height: 100%;">
3   - <div class="top_title"></div>
4   -
5   - <div class="xd_line_list">
6   - </div>
7   - <div class="top_tools">
8   - <form class="ct_pattern_form">
9   - <div class="uk-margin">
10   - <div uk-form-custom="target: > * > span:first" style="display: none">
11   - <select id="pattern_select">
12   - <option value="0">监控模式</option>
13   - <option value="1">主调模式</option>
14   - <option value="2">作废模式</option>
15   - </select>
16   - <button class="uk-button uk-button-default" type="button" tabindex="-1">
17   - <span></span>
18   - <span uk-icon="icon: chevron-down"></span>
19   - </button>
20   - </div>
21   - </div>
22   - </form>
23   - <div class="add_line_icon" uk-toggle="target: #select_line_modal">
24   - <i uk-icon="icon: plus"></i> 添加线路
25   - </div>
26   - &nbsp;&nbsp;
27   - <button class="uk-button uk-button-primary uk-button-small" id="global_save_btn">保存哇!</button>
28   - </div>
29   -
30   - <div class="uk-child-width-expand uk-grid-small xd_menu_grid" uk-grid style="display: none;">
31   -
32   - <div>
33   - <h4>数据&统计</h4>
34   - <ul class="uk-list uk-list-large uk-list-divider">
35   - <li><label><input class="uk-checkbox" type="checkbox" data-event="curr_date_schedule"> 当日计划排班</label></li>
36   - <li><label><input class="uk-checkbox" type="checkbox" data-event="cache_data_manage"> 缓存数据管理</label></li>
37   - <li><label><input class="uk-checkbox" type="checkbox" data-event="history_sch_maintain"> 历史路单维护</label></li>
38   - <li><label><input class="uk-checkbox" type="checkbox" data-event="sch_edit_info"> 班次修正日志</label></li>
39   - </ul>
40   - </div>
41   -
42   - <div>
43   - <h4>报表管理</h4>
44   - <ul class="uk-list uk-list-large uk-list-divider">
45   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_waybill"> 行车路单</label></li>
46   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_history_message"> 调度历史消息</label></li>
47   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_account"> 驾驶员请求台账</label></li>
48   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_correctForm"> 修正报表</label></li>
49   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_statisticsDaily"> 统计日报</label></li>
50   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleDaily"> 调度日报</label></li>
51   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_jobSummary"> 工作汇总</label></li>
52   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_daily"> 班次日报表</label></li>
53   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_inoutstation"> 班次到离站</label></li>
54   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_oilListMonth"> 月存油报表</label></li>
55   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
56   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
57   - <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
58   - </ul>
59   - </div>
60   -
61   - <div>
62   - <h4>车载设备</h4>
63   - <ul class="uk-list uk-list-large uk-list-divider">
64   - <li><label><input class="uk-checkbox" type="checkbox" data-event="all_devices"> 设备管理</label></li>
65   - <li><label><input class="uk-checkbox" type="checkbox" data-event="directive_history"> 指令下发记录</label></li>
66   - <li><label><input class="uk-checkbox" type="checkbox" data-event="device_report"> 设备上报记录</label></li>
67   - <li><label><input class="uk-checkbox" type="checkbox" data-event="gps_play_back"> 轨迹回放</label></li>
68   - <li><label><input class="uk-checkbox" type="checkbox" data-event="safe_driving"> 安全驾驶(图像)</label></li>
69   - </ul>
70   - </div>
71   -
72   - <div>
73   - <h4>系统设置</h4>
74   - <ul class="uk-list uk-list-large uk-list-divider">
75   - <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li>
76   - <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li>
77   - <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li>
78   - <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
79   - </ul>
80   - </div>
81   -
82   - </div>
83   -
84   - <!-- This is the modal -->
85   - <div id="select_line_modal" class="uk-modal-container" uk-modal="bg-close:false;">
86   - <div class="uk-modal-dialog uk-modal-body">
87   - <button class="uk-modal-close-outside" type="button" uk-close></button>
88   - <h2 class="uk-modal-title">添加线路权限</h2>
89   - <div>
90   - <form>
91   - <div class="ct_field" style="width: 140px;">
92   - <label>状态</label>
93   - <select class="uk-select" id="modal_type_select" style="width: 94px;">
94   - <option value="-1">全部</option>
95   - <option value="0">营运</option>
96   - <option value="1">撤销</option>
97   - </select>
98   - </div>
99   - <div class="ct_field">
100   - <label>公司</label>
101   - <select class="uk-select" id="modal_company_select"></select>
102   - </div>
103   - <div class="ct_field">
104   - <label>分公司</label>
105   - <select class="uk-select" id="modal_sub_company_select" disabled></select>
106   - </div>
107   - <div class="ct_field">
108   - <label>线路</label>
109   - <input class="uk-input" id="modal_line_input" placeholder="没做拼音映射!!"/>
110   - </div>
111   - <label><input class="uk-checkbox" type="checkbox" id="globalCheckbox"> 全选</label>
112   - </form>
113   - <div class="uk-modal-body line_checkbox_list" style="padding: 0 !important;" uk-overflow-auto>
114   - </div>
115   - </div>
116   - <p class="uk-text-right">
117   - <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
118   - <button class="uk-button uk-button-primary" id="confirmBtn" type="button">确定</button>
119   - </p>
120   - </div>
121   - </div>
122   -
123   - <script id="authorize-user-auth-lines-temp" type="text/html">
124   - {{each list as t i}}
125   - <h5>{{t.fgsName}}</h5>
126   - <div class="sub_lines">
127   - {{each t.list as obj j}}
128   - <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span>
129   - {{/each}}
130   - </div>
131   - {{/each}}
132   - </script>
133   - <script id="authorize-user-auth-title-temp" type="text/html">
134   - <div style="font-weight: 600;">{{name}}({{userName}})
135   - </div>
136   - <!--<div class="desc">最近登录 {{lastLoginDateStr}}</div>-->
137   - <div class="desc">...</div>
138   - </script>
139   -
140   - <script id="authorize-modal-lines-temp" type="text/html">
141   - {{each list as obj i}}
142   - <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}"
143   - title="{{obj.name}}" data-code="{{obj.lineCode}}">
144   - <input class="uk-checkbox" type="checkbox">{{obj.name}}
145   - </label>
146   - {{/each}}
147   - </script>
148   - <script>
149   - (function () {
150   - var wrap = '#user_authorize_wrap', user, xd_auth, all_lines, companyData;
151   - //分公司名称映射(只用于分组展示,就写死)
152   - var fgs_name_mapp = {
153   - '55_3': '上南公司(六分公司)',
154   - '55_1': '上南公司(二分公司)',
155   - '55_2': '上南公司(三分公司)',
156   - '55_4': '上南公司(一分公司)',
157   - '55_5': '上南公司(培训部)',
158   - '22_2': '金高公司(二分公司)',
159   - '22_1': '金高公司(四分公司)',
160   - '22_3': '金高公司(三分公司)',
161   - '22_5': '金高公司(一分公司)',
162   - '26_3': '南汇公司(三分公司)',
163   - '26_2': '南汇公司(南汇二分)',
164   - '26_1': '南汇公司(南汇一分)',
165   - '26_4': '南汇公司(南汇维修公司)',
166   - '26_5': '南汇公司(南汇公司)',
167   - '26_6': '南汇公司(南汇六分)',
168   - '05_5': '杨高公司(杨高分公司)',
169   - '05_6': '杨高公司(周浦分公司)',
170   - '05_3': '杨高公司(芦潮港分公司)',
171   - '05_1': '杨高公司(川沙分公司)',
172   - '05_2': '杨高公司(金桥分公司)',
173   - '77_78': '闵行公司',
174   - '300_301': '金球公交',
175   - '99_100': '青浦公交',
176   - '24_1': '一车队',
177   - '24_2': '二车队',
178   - '24_3': '三车队'
179   - };
180   -
181   - var defauleConfig;
182   - var patSelect;
183   - $(wrap).on('init', function (e, data) {
184   - e.stopPropagation();
185   - user = data.user;
186   - all_lines = data.lineArray;
187   - companyData = data.companyData;
188   -
189   - all_lines.sort(function (a, b) {
190   - return a.name.localeCompare(b.name);
191   - });
192   - //top title
193   - var htmlStr = template('authorize-user-auth-title-temp', user);
194   - $('.top_title', wrap).html(htmlStr);
195   -
196   - //用户线调权限
197   - defauleConfig = {userId: user.id, pattern: 0, excludeMenus: 'history_sch_maintain'};
198   - $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) {
199   - //console.log('rsrs',rs);
200   - xd_auth = rs;
201   - if (!xd_auth)
202   - xd_auth = defauleConfig;
203   - //渲染线路权限
204   - render_auth_lines();
205   - //渲染菜单权限
206   - render_auth_menus();
207   - //渲染线路选择modal
208   - //render_line_select_modal();
209   - patSelect = rs.pattern;
210   - $('#pattern_select', wrap).val(xd_auth.pattern).trigger('change').parent().show();
211   - });
212   - });
213   - $('#pattern_select').change(function () {
214   - if ($('#pattern_select', wrap).val() == 2 && $('#pattern_select', wrap).val() != patSelect) {
215   - // UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function(){
216   - //
217   - // });
218   - UIkit.modal.alert("选择作废模式后该用户将失去所有线路和权限!");
219   - }
220   -
221   - })
222   -
223   - function render_auth_lines() {
224   - var data = [], codeArray = [];
225   - if (xd_auth && xd_auth.lineCodeStr)
226   - codeArray = xd_auth.lineCodeStr.split(',');
227   -
228   - $.each(all_lines, function () {
229   - if (codeArray.indexOf(this.lineCode) != -1)
230   - data.push(this);
231   - });
232   -
233   - data.sort(function (a, b) {
234   - return a.name.localeCompare(b.name);
235   - });
236   - //按分公司分组
237   - var gd = groupBy(data, 'cgsbm');
238   - data = [];
239   - for (var code in gd) {
240   - data.push({
241   - code: code,
242   - fgsName: fgs_name_mapp[code],
243   - list: gd[code]
244   - });
245   - if (!fgs_name_mapp[code]) {
246   - alert('出现异常的公司归属 :' + code);
247   - }
248   - }
249   -
250   - data.sort(function (a, b) {
251   - return a.fgsName.localeCompare(b.fgsName);
252   - });
253   -
254   - var htmlStr = template('authorize-user-auth-lines-temp', {list: data});
255   - $('.xd_line_list', wrap).html(htmlStr);
256   -
257   - //滚动条
258   - $('.xd_line_list', wrap).perfectScrollbar({suppressScrollX: true});
259   - }
260   -
261   - function render_auth_menus() {
262   - debugger
263   - var excludeArray = [], event;
264   - if (xd_auth && xd_auth.excludeMenus)
265   - excludeArray = xd_auth.excludeMenus.split(',');
266   -
267   - $('.xd_menu_grid li>label>input').each(function () {
268   - event = $(this).data('event');
269   - if (excludeArray.indexOf(event) == -1)
270   - this.checked = true;
271   - });
272   - $('.xd_menu_grid').show();
273   - $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update');
274   - }
275   -
276   - $('.xd_menu_grid .uk-list', wrap).perfectScrollbar({suppressScrollX: true});
277   -
278   - /**
279   - * 线路选择modal
280   - */
281   - var compSelectData, modal = '#select_line_modal', modalRender;
282   - $(modal).on('show', function () {
283   - if (!modalRender) {
284   - render_line_select_modal();
285   - modalRender = true;
286   - }
287   - $('#modal_line_input', modal).focus();
288   - });
289   -
290   - function render_line_select_modal() {
291   - var htmlStr = template('authorize-modal-lines-temp', {
292   - list: all_lines,
293   - destroy: $('.modal_type_select', modal).val()
294   - });
295   - $('.line_checkbox_list').html(htmlStr);
296   - //选中线路
297   - var codeArray = [];
298   - if (xd_auth && xd_auth.lineCodeStr)
299   - codeArray = xd_auth.lineCodeStr.split(',');
300   -
301   - $('.line_checkbox_list>label.btn').each(function () {
302   - if (codeArray.indexOf($(this).data('code') + '') != -1) {
303   - $(this).addClass('active').find('>input')[0].checked = true;
304   - }
305   - });
306   -
307   - //构建公司级联下拉框
308   - compSelectData = convert_buss_data(companyData);
309   - var companyStr = '<option value="">请选择...</option>';
310   - for (var code in compSelectData) {
311   - companyStr += '<option value="' + code + '">' + compSelectData[code].name + '</option>';
312   - }
313   - $('#modal_company_select', modal).html(companyStr).on('change', function () {
314   - var code = $(this).val(), subSelect = $('#modal_sub_company_select', modal);
315   - if (!code)
316   - subSelect.empty().attr('disabled', 'disabled');
317   - else {
318   - var subCompStr = '<option value="">请选择...</option>';
319   - $.each(compSelectData[code].childs, function () {
320   - subCompStr += '<option value="' + this.businessCode + '">' + this.businessName + '</option>';
321   - });
322   - subSelect.html(subCompStr).removeAttr('disabled');
323   - }
324   - //过滤线路
325   - filter_modal_lines();
326   - });
327   - $('#modal_sub_company_select', modal).on('change', filter_modal_lines);
328   - $('#modal_type_select', modal).on('change', filter_modal_lines);
329   - }
330   -
331   - $('#modal_line_input', modal).on('input', function () {
332   - var t = $(this).val() + '';
333   - if (!t) {
334   - filter_modal_lines();
335   - return;
336   - }
337   - var codes = [];
338   - $.each(all_lines, function () {
339   - if (this.name.indexOf(t) != -1)
340   - codes.push(this.lineCode);
341   - });
342   -
343   - var array = $('.line_checkbox_list>label.btn').css('display', 'none');
344   - array.each(function () {
345   - if (codes.indexOf($(this).data('code') + '') != -1)
346   - $(this).css('display', 'inline-block');
347   - });
348   - });
349   -
350   - function filter_modal_lines() {
351   - console.log('filter_modal_lines');
352   - var company = $('#modal_company_select', modal).val(),//公司代码
353   - sub_company = $('#modal_sub_company_select', modal).val(),//分公司代码
354   - type = $('#modal_type_select', modal).val();//线路状态
355   -
356   - var array = $('.line_checkbox_list>label.btn').css('display', 'none'), s_dom = [];
357   -
358   - if (!company && !sub_company && type == -1) {
359   - array.css('display', 'inline-block');
360   - return;
361   - }
362   -
363   - var status;
364   - array.each(function () {
365   - if (company && $(this).data('gs') != company)
366   - return true;
367   - if (sub_company && $(this).data('fgs') != sub_company)
368   - return true;
369   -
370   - status = $(this).hasClass('destroy') ? 1 : 0;
371   - if (type != -1 && type != status)
372   - return true;
373   -
374   - s_dom.push(this);
375   - });
376   - for (var i = 0, dom; dom = s_dom[i++];)
377   - $(dom).css('display', 'inline-block');
378   - }
379   -
380   - $('.line_checkbox_list').on('click', 'label.btn', function () {
381   - if ($('input', this)[0].checked)
382   - $(this).addClass('active');
383   - else
384   - $(this).removeClass('active');
385   - });
386   -
387   - //全选
388   - $('#globalCheckbox', modal).on('click', function () {
389   - var state = this.checked;
390   - $('.line_checkbox_list>label.btn:visible>input').each(function () {
391   - this.checked = state;
392   - });
393   -
394   - $('.line_checkbox_list>label.btn:visible').each(function () {
395   - if (state)
396   - $(this).addClass('active');
397   - else
398   - $(this).removeClass('active');
399   - });
400   - });
401   -
402   - //确定
403   - $('#confirmBtn', modal).on('click', function () {
404   - var lines = '';
405   - $('.line_checkbox_list>label.btn.active').each(function () {
406   - lines += ($(this).data('code') + ',');
407   - });
408   - xd_auth.lineCodeStr = lines;
409   - render_auth_lines();
410   - UIkit.modal(modal).hide();
411   - });
412   -
413   -
414   - //保存
415   - $('#global_save_btn', wrap).on('click', function () {
416   - $(this).attr('disabled', 'disabled');
417   - //调度模式
418   - xd_auth.pattern = $('#pattern_select', wrap).val();
419   - //要排除的线调菜单
420   - var excludeMenus = '';
421   - $('.xd_menu_grid ul input[type=checkbox]').each(function () {
422   - if (!this.checked)
423   - excludeMenus += $(this).data('event') + ',';
424   - });
425   - xd_auth.excludeMenus = excludeMenus;
426   - if (xd_auth.pattern == 2) {
427   - //UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function () {
428   - xd_auth.lineCodeStr = '';
429   - var excludeMenusAll = '';
430   - $('.xd_menu_grid ul input[type=checkbox]').each(function () {
431   - excludeMenusAll += $(this).data('event') + ',';
432   - });
433   - xd_auth.excludeMenus = excludeMenusAll;
434   - //});
435   -
436   - }
437   - $.post('/realControAuthority', xd_auth, function (rs) {
438   - UIkit.notification('保存成功!', 'primary');
439   - $('.authorize_right_cont').trigger('refresh-user');
440   - });
441   - });
442   - })();
443   - </script>
  1 +<!-- 用户线调授权页面 -->
  2 +<div id="user_authorize_wrap" style="height: 100%;">
  3 + <div class="top_title"></div>
  4 +
  5 + <div class="xd_line_list">
  6 + </div>
  7 + <div class="top_tools">
  8 + <form class="ct_pattern_form">
  9 + <div class="uk-margin">
  10 + <div uk-form-custom="target: > * > span:first" style="display: none">
  11 + <select id="pattern_select">
  12 + <option value="0">监控模式</option>
  13 + <option value="1">主调模式</option>
  14 + <option value="2">作废模式</option>
  15 + </select>
  16 + <button class="uk-button uk-button-default" type="button" tabindex="-1">
  17 + <span></span>
  18 + <span uk-icon="icon: chevron-down"></span>
  19 + </button>
  20 + </div>
  21 + </div>
  22 + </form>
  23 + <div class="add_line_icon" uk-toggle="target: #select_line_modal">
  24 + <i uk-icon="icon: plus"></i> 添加线路
  25 + </div>
  26 + &nbsp;&nbsp;
  27 + <button class="uk-button uk-button-primary uk-button-small" id="global_save_btn">保存哇!</button>
  28 + </div>
  29 +
  30 + <div class="uk-child-width-expand uk-grid-small xd_menu_grid" uk-grid style="display: none;">
  31 +
  32 + <div>
  33 + <h4>数据&统计</h4>
  34 + <ul class="uk-list uk-list-large uk-list-divider">
  35 + <li><label><input class="uk-checkbox" type="checkbox" data-event="curr_date_schedule"> 当日计划排班</label></li>
  36 + <li><label><input class="uk-checkbox" type="checkbox" data-event="cache_data_manage"> 缓存数据管理</label></li>
  37 + <li><label><input class="uk-checkbox" type="checkbox" data-event="history_sch_maintain"> 历史路单维护</label></li>
  38 + <li><label><input class="uk-checkbox" type="checkbox" data-event="sch_edit_info"> 班次修正日志</label></li>
  39 + </ul>
  40 + </div>
  41 +
  42 + <div>
  43 + <h4>报表管理</h4>
  44 + <ul class="uk-list uk-list-large uk-list-divider">
  45 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_waybill"> 行车路单</label></li>
  46 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_history_message"> 调度历史消息</label></li>
  47 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_account"> 驾驶员请求台账</label></li>
  48 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_correctForm"> 修正报表</label></li>
  49 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_statisticsDaily"> 统计日报</label></li>
  50 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleDaily"> 调度日报</label></li>
  51 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_jobSummary"> 工作汇总</label></li>
  52 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_daily"> 班次日报表</label></li>
  53 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_inoutstation"> 班次到离站</label></li>
  54 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_oilListMonth"> 月存油报表</label></li>
  55 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
  56 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
  57 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
  58 + </ul>
  59 + </div>
  60 +
  61 + <div>
  62 + <h4>车载设备</h4>
  63 + <ul class="uk-list uk-list-large uk-list-divider">
  64 + <li><label><input class="uk-checkbox" type="checkbox" data-event="all_devices"> 设备管理</label></li>
  65 + <li><label><input class="uk-checkbox" type="checkbox" data-event="directive_history"> 指令下发记录</label></li>
  66 + <li><label><input class="uk-checkbox" type="checkbox" data-event="device_report"> 设备上报记录</label></li>
  67 + <li><label><input class="uk-checkbox" type="checkbox" data-event="gps_play_back"> 轨迹回放</label></li>
  68 + <li><label><input class="uk-checkbox" type="checkbox" data-event="safe_driving"> 安全驾驶(图像)</label></li>
  69 + </ul>
  70 + </div>
  71 +
  72 + <div>
  73 + <h4>系统设置</h4>
  74 + <ul class="uk-list uk-list-large uk-list-divider">
  75 + <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li>
  76 + <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li>
  77 + <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li>
  78 + <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
  79 + </ul>
  80 + </div>
  81 +
  82 + </div>
  83 +
  84 + <!-- This is the modal -->
  85 + <div id="select_line_modal" class="uk-modal-container" uk-modal="bg-close:false;">
  86 + <div class="uk-modal-dialog uk-modal-body">
  87 + <button class="uk-modal-close-outside" type="button" uk-close></button>
  88 + <h2 class="uk-modal-title">添加线路权限</h2>
  89 + <div>
  90 + <form>
  91 + <div class="ct_field" style="width: 140px;">
  92 + <label>状态</label>
  93 + <select class="uk-select" id="modal_type_select" style="width: 94px;">
  94 + <option value="-1">全部</option>
  95 + <option value="0">营运</option>
  96 + <option value="1">撤销</option>
  97 + </select>
  98 + </div>
  99 + <div class="ct_field">
  100 + <label>公司</label>
  101 + <select class="uk-select" id="modal_company_select"></select>
  102 + </div>
  103 + <div class="ct_field">
  104 + <label>分公司</label>
  105 + <select class="uk-select" id="modal_sub_company_select" disabled></select>
  106 + </div>
  107 + <div class="ct_field">
  108 + <label>线路</label>
  109 + <input class="uk-input" id="modal_line_input" placeholder="没做拼音映射!!"/>
  110 + </div>
  111 + <label><input class="uk-checkbox" type="checkbox" id="globalCheckbox"> 全选</label>
  112 + </form>
  113 + <div class="uk-modal-body line_checkbox_list" style="padding: 0 !important;" uk-overflow-auto>
  114 + </div>
  115 + </div>
  116 + <p class="uk-text-right">
  117 + <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
  118 + <button class="uk-button uk-button-primary" id="confirmBtn" type="button">确定</button>
  119 + </p>
  120 + </div>
  121 + </div>
  122 +
  123 + <script id="authorize-user-auth-lines-temp" type="text/html">
  124 + {{each list as t i}}
  125 + <h5>{{t.fgsName}}</h5>
  126 + <div class="sub_lines">
  127 + {{each t.list as obj j}}
  128 + <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span>
  129 + {{/each}}
  130 + </div>
  131 + {{/each}}
  132 + </script>
  133 + <script id="authorize-user-auth-title-temp" type="text/html">
  134 + <div style="font-weight: 600;">{{name}}({{userName}})
  135 + </div>
  136 + <!--<div class="desc">最近登录 {{lastLoginDateStr}}</div>-->
  137 + <div class="desc">...</div>
  138 + </script>
  139 +
  140 + <script id="authorize-modal-lines-temp" type="text/html">
  141 + {{each list as obj i}}
  142 + <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}"
  143 + title="{{obj.name}}" data-code="{{obj.lineCode}}">
  144 + <input class="uk-checkbox" type="checkbox">{{obj.name}}
  145 + </label>
  146 + {{/each}}
  147 + </script>
  148 + <script>
  149 + (function () {
  150 + var wrap = '#user_authorize_wrap', user, xd_auth, all_lines, companyData;
  151 + //分公司名称映射(只用于分组展示,就写死)
  152 +<<<<<<< HEAD
  153 + var fgs_name_mapp = {
  154 + '55_3': '上南公司(六分公司)',
  155 + '55_1': '上南公司(二分公司)',
  156 + '55_2': '上南公司(三分公司)',
  157 + '55_4': '上南公司(一分公司)',
  158 + '55_5': '上南公司(培训部)',
  159 + '22_2': '金高公司(二分公司)',
  160 + '22_1': '金高公司(四分公司)',
  161 + '22_3': '金高公司(三分公司)',
  162 + '22_5': '金高公司(一分公司)',
  163 + '26_3': '南汇公司(三分公司)',
  164 + '26_2': '南汇公司(南汇二分)',
  165 + '26_1': '南汇公司(南汇一分)',
  166 + '26_4': '南汇公司(南汇维修公司)',
  167 + '26_5': '南汇公司(南汇公司)',
  168 + '26_6': '南汇公司(南汇六分)',
  169 + '05_5': '杨高公司(杨高分公司)',
  170 + '05_6': '杨高公司(周浦分公司)',
  171 + '05_3': '杨高公司(芦潮港分公司)',
  172 + '05_1': '杨高公司(川沙分公司)',
  173 + '05_2': '杨高公司(金桥分公司)',
  174 + '77_78': '闵行公司',
  175 + '300_301': '金球公交',
  176 + '99_100': '青浦公交',
  177 + '24_1': '一车队',
  178 + '24_2': '二车队',
  179 + '24_3': '三车队'
  180 +=======
  181 + var fgs_name_mapp={
  182 + '55_3': '上南公司(六分公司)', '55_1': '上南公司(二分公司)', '55_2': '上南公司(三分公司)', '55_4': '上南公司(一分公司)', '55_5': '上南公司(培训部)',
  183 + '22_2': '金高公司(二分公司)', '22_1': '金高公司(四分公司)', '22_3': '金高公司(三分公司)', '22_5': '金高公司(一分公司)',
  184 + '26_3': '南汇公司(三分公司)', '26_2': '南汇公司(南汇二分)', '26_1': '南汇公司(南汇一分)', '26_4': '南汇公司(南汇维修公司)', '26_5': '南汇公司(南汇公司)', '26_6': '南汇公司(南汇六分)',
  185 + '05_5': '杨高公司(杨高分公司)', '05_6': '杨高公司(周浦分公司)', '05_3': '杨高公司(芦潮港分公司)', '05_1': '杨高公司(川沙分公司)', '05_2': '杨高公司(金桥分公司)',
  186 + '77_78': '闵行公司','300_301': '金球公交','302_303': '露虹公交', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队'
  187 +>>>>>>> 46649faa9a8c89602fbb3f73b0242c178de95777
  188 + };
  189 +
  190 + var defauleConfig;
  191 + var patSelect;
  192 + $(wrap).on('init', function (e, data) {
  193 + e.stopPropagation();
  194 + user = data.user;
  195 + all_lines = data.lineArray;
  196 + companyData = data.companyData;
  197 +
  198 + all_lines.sort(function (a, b) {
  199 + return a.name.localeCompare(b.name);
  200 + });
  201 + //top title
  202 + var htmlStr = template('authorize-user-auth-title-temp', user);
  203 + $('.top_title', wrap).html(htmlStr);
  204 +
  205 + //用户线调权限
  206 + defauleConfig = {userId: user.id, pattern: 0, excludeMenus: 'history_sch_maintain'};
  207 + $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) {
  208 + //console.log('rsrs',rs);
  209 + xd_auth = rs;
  210 + if (!xd_auth)
  211 + xd_auth = defauleConfig;
  212 + //渲染线路权限
  213 + render_auth_lines();
  214 + //渲染菜单权限
  215 + render_auth_menus();
  216 + //渲染线路选择modal
  217 + //render_line_select_modal();
  218 + patSelect = rs.pattern;
  219 + $('#pattern_select', wrap).val(xd_auth.pattern).trigger('change').parent().show();
  220 + });
  221 + });
  222 + $('#pattern_select').change(function () {
  223 + if ($('#pattern_select', wrap).val() == 2 && $('#pattern_select', wrap).val() != patSelect) {
  224 + // UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function(){
  225 + //
  226 + // });
  227 + UIkit.modal.alert("选择作废模式后该用户将失去所有线路和权限!");
  228 + }
  229 +
  230 + })
  231 +
  232 + function render_auth_lines() {
  233 + var data = [], codeArray = [];
  234 + if (xd_auth && xd_auth.lineCodeStr)
  235 + codeArray = xd_auth.lineCodeStr.split(',');
  236 +
  237 + $.each(all_lines, function () {
  238 + if (codeArray.indexOf(this.lineCode) != -1)
  239 + data.push(this);
  240 + });
  241 +
  242 + data.sort(function (a, b) {
  243 + return a.name.localeCompare(b.name);
  244 + });
  245 + //按分公司分组
  246 + var gd = groupBy(data, 'cgsbm');
  247 + data = [];
  248 + for (var code in gd) {
  249 + data.push({
  250 + code: code,
  251 + fgsName: fgs_name_mapp[code],
  252 + list: gd[code]
  253 + });
  254 + if (!fgs_name_mapp[code]) {
  255 + alert('出现异常的公司归属 :' + code);
  256 + }
  257 + }
  258 +
  259 + data.sort(function (a, b) {
  260 + return a.fgsName.localeCompare(b.fgsName);
  261 + });
  262 +
  263 + var htmlStr = template('authorize-user-auth-lines-temp', {list: data});
  264 + $('.xd_line_list', wrap).html(htmlStr);
  265 +
  266 + //滚动条
  267 + $('.xd_line_list', wrap).perfectScrollbar({suppressScrollX: true});
  268 + }
  269 +
  270 + function render_auth_menus() {
  271 + debugger
  272 + var excludeArray = [], event;
  273 + if (xd_auth && xd_auth.excludeMenus)
  274 + excludeArray = xd_auth.excludeMenus.split(',');
  275 +
  276 + $('.xd_menu_grid li>label>input').each(function () {
  277 + event = $(this).data('event');
  278 + if (excludeArray.indexOf(event) == -1)
  279 + this.checked = true;
  280 + });
  281 + $('.xd_menu_grid').show();
  282 + $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update');
  283 + }
  284 +
  285 + $('.xd_menu_grid .uk-list', wrap).perfectScrollbar({suppressScrollX: true});
  286 +
  287 + /**
  288 + * 线路选择modal
  289 + */
  290 + var compSelectData, modal = '#select_line_modal', modalRender;
  291 + $(modal).on('show', function () {
  292 + if (!modalRender) {
  293 + render_line_select_modal();
  294 + modalRender = true;
  295 + }
  296 + $('#modal_line_input', modal).focus();
  297 + });
  298 +
  299 + function render_line_select_modal() {
  300 + var htmlStr = template('authorize-modal-lines-temp', {
  301 + list: all_lines,
  302 + destroy: $('.modal_type_select', modal).val()
  303 + });
  304 + $('.line_checkbox_list').html(htmlStr);
  305 + //选中线路
  306 + var codeArray = [];
  307 + if (xd_auth && xd_auth.lineCodeStr)
  308 + codeArray = xd_auth.lineCodeStr.split(',');
  309 +
  310 + $('.line_checkbox_list>label.btn').each(function () {
  311 + if (codeArray.indexOf($(this).data('code') + '') != -1) {
  312 + $(this).addClass('active').find('>input')[0].checked = true;
  313 + }
  314 + });
  315 +
  316 + //构建公司级联下拉框
  317 + compSelectData = convert_buss_data(companyData);
  318 + var companyStr = '<option value="">请选择...</option>';
  319 + for (var code in compSelectData) {
  320 + companyStr += '<option value="' + code + '">' + compSelectData[code].name + '</option>';
  321 + }
  322 + $('#modal_company_select', modal).html(companyStr).on('change', function () {
  323 + var code = $(this).val(), subSelect = $('#modal_sub_company_select', modal);
  324 + if (!code)
  325 + subSelect.empty().attr('disabled', 'disabled');
  326 + else {
  327 + var subCompStr = '<option value="">请选择...</option>';
  328 + $.each(compSelectData[code].childs, function () {
  329 + subCompStr += '<option value="' + this.businessCode + '">' + this.businessName + '</option>';
  330 + });
  331 + subSelect.html(subCompStr).removeAttr('disabled');
  332 + }
  333 + //过滤线路
  334 + filter_modal_lines();
  335 + });
  336 + $('#modal_sub_company_select', modal).on('change', filter_modal_lines);
  337 + $('#modal_type_select', modal).on('change', filter_modal_lines);
  338 + }
  339 +
  340 + $('#modal_line_input', modal).on('input', function () {
  341 + var t = $(this).val() + '';
  342 + if (!t) {
  343 + filter_modal_lines();
  344 + return;
  345 + }
  346 + var codes = [];
  347 + $.each(all_lines, function () {
  348 + if (this.name.indexOf(t) != -1)
  349 + codes.push(this.lineCode);
  350 + });
  351 +
  352 + var array = $('.line_checkbox_list>label.btn').css('display', 'none');
  353 + array.each(function () {
  354 + if (codes.indexOf($(this).data('code') + '') != -1)
  355 + $(this).css('display', 'inline-block');
  356 + });
  357 + });
  358 +
  359 + function filter_modal_lines() {
  360 + console.log('filter_modal_lines');
  361 + var company = $('#modal_company_select', modal).val(),//公司代码
  362 + sub_company = $('#modal_sub_company_select', modal).val(),//分公司代码
  363 + type = $('#modal_type_select', modal).val();//线路状态
  364 +
  365 + var array = $('.line_checkbox_list>label.btn').css('display', 'none'), s_dom = [];
  366 +
  367 + if (!company && !sub_company && type == -1) {
  368 + array.css('display', 'inline-block');
  369 + return;
  370 + }
  371 +
  372 + var status;
  373 + array.each(function () {
  374 + if (company && $(this).data('gs') != company)
  375 + return true;
  376 + if (sub_company && $(this).data('fgs') != sub_company)
  377 + return true;
  378 +
  379 + status = $(this).hasClass('destroy') ? 1 : 0;
  380 + if (type != -1 && type != status)
  381 + return true;
  382 +
  383 + s_dom.push(this);
  384 + });
  385 + for (var i = 0, dom; dom = s_dom[i++];)
  386 + $(dom).css('display', 'inline-block');
  387 + }
  388 +
  389 + $('.line_checkbox_list').on('click', 'label.btn', function () {
  390 + if ($('input', this)[0].checked)
  391 + $(this).addClass('active');
  392 + else
  393 + $(this).removeClass('active');
  394 + });
  395 +
  396 + //全选
  397 + $('#globalCheckbox', modal).on('click', function () {
  398 + var state = this.checked;
  399 + $('.line_checkbox_list>label.btn:visible>input').each(function () {
  400 + this.checked = state;
  401 + });
  402 +
  403 + $('.line_checkbox_list>label.btn:visible').each(function () {
  404 + if (state)
  405 + $(this).addClass('active');
  406 + else
  407 + $(this).removeClass('active');
  408 + });
  409 + });
  410 +
  411 + //确定
  412 + $('#confirmBtn', modal).on('click', function () {
  413 + var lines = '';
  414 + $('.line_checkbox_list>label.btn.active').each(function () {
  415 + lines += ($(this).data('code') + ',');
  416 + });
  417 + xd_auth.lineCodeStr = lines;
  418 + render_auth_lines();
  419 + UIkit.modal(modal).hide();
  420 + });
  421 +
  422 +
  423 + //保存
  424 + $('#global_save_btn', wrap).on('click', function () {
  425 + $(this).attr('disabled', 'disabled');
  426 + //调度模式
  427 + xd_auth.pattern = $('#pattern_select', wrap).val();
  428 + //要排除的线调菜单
  429 + var excludeMenus = '';
  430 + $('.xd_menu_grid ul input[type=checkbox]').each(function () {
  431 + if (!this.checked)
  432 + excludeMenus += $(this).data('event') + ',';
  433 + });
  434 + xd_auth.excludeMenus = excludeMenus;
  435 + if (xd_auth.pattern == 2) {
  436 + //UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function () {
  437 + xd_auth.lineCodeStr = '';
  438 + var excludeMenusAll = '';
  439 + $('.xd_menu_grid ul input[type=checkbox]').each(function () {
  440 + excludeMenusAll += $(this).data('event') + ',';
  441 + });
  442 + xd_auth.excludeMenus = excludeMenusAll;
  443 + //});
  444 +
  445 + }
  446 + $.post('/realControAuthority', xd_auth, function (rs) {
  447 + UIkit.notification('保存成功!', 'primary');
  448 + $('.authorize_right_cont').trigger('refresh-user');
  449 + });
  450 + });
  451 + })();
  452 + </script>
444 453 </div>
445 454 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/queryOption/saOrderOption.js
1   -/**
2   - * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的)
3   - * 属性如下:
4   - * name(必须):控件的名字
5   - * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...]
6   - * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'}
7   - */
8   -angular.module('ScheduleApp').directive(
9   - 'saOrderoption',
10   - [
11   - function() {
12   - return {
13   - restrict: 'E',
14   - templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html',
15   - scope: {
16   - columns: '=',
17   - ordercolumns: '='
18   - },
19   - controllerAs: '$saOrderOptionCtrl',
20   - bindToController: true,
21   - controller: function() {
22   - var self = this;
23   -
24   - // 字段列表是否预载入
25   - self.$$columns_loaded = false;
26   - // 字段排序是否预载入
27   - self.$$ordercolumns_loaded = false;
28   -
29   -
30   - // 每组选项内部数据源
31   - // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}]
32   - self.$$selectgroupds = [];
33   -
34   - // TODO:选择事件
35   -
36   - self.$$select_column_change = function() {
37   - self.$$refresh_selectgroupds();
38   - };
39   -
40   - self.$$select_dir_change = function() {
41   - self.$$refresh_selectgroupds();
42   - };
43   -
44   - self.$$add_option_click = function(index) {
45   - self.$$selectgroupds.splice(index, 0, {
46   - column: self.columns[0].name,
47   - dir: "ASC"
48   - });
49   - self.$$refresh_selectgroupds();
50   - };
51   - self.$$del_option_click = function(index) {
52   - self.$$selectgroupds.splice(index, 1);
53   - self.$$refresh_selectgroupds();
54   - };
55   -
56   - // 刷新选项内部数据源
57   - self.$$refresh_selectgroupds = function() {
58   - if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) {
59   - // 没有载入完成,或者字段列表为空
60   - return;
61   - }
62   -
63   - if (self.$$selectgroupds.length == 0) { // 默认添加一组排序
64   - self.$$selectgroupds.push({
65   - column: self.columns[0].name,
66   - dir: "ASC"
67   - });
68   - }
69   -
70   - // 重新计算ordercolumns
71   -
72   - var aColumn = [];
73   - var aDir = [];
74   - for (var i = 0; i < self.$$selectgroupds.length; i++) {
75   - aColumn.push(self.$$selectgroupds[i].column);
76   - aDir.push(self.$$selectgroupds[i].dir);
77   - }
78   - if (self.ordercolumns) {
79   - self.ordercolumns.order = aColumn.join(",");
80   - self.ordercolumns.direction = aDir.join(",");
81   - } else {
82   - self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")}
83   - }
84   -
85   - }
86   - },
87   - compile: function(tElem, tAttrs) {
88   - // 获取所有属性,并验证
89   - var $name_attr = tAttrs['name']; // 控件的名字
90   - if (!$name_attr) {
91   - throw "必须有名称属性";
92   - }
93   -
94   - // controlAs名字
95   - var ctrlAs = '$saOrderOptionCtrl';
96   -
97   - // TODO:
98   -
99   -
100   -
101   - return {
102   - pre: function(scope, element, attr) {
103   -
104   - },
105   -
106   - post: function(scope, element, attr) {
107   -
108   - //--------------------- 监控属性方法 -------------------//
109   - // 监控字段名字列表
110   - scope.$watch(
111   - function() {
112   - return scope[ctrlAs].columns;
113   - },
114   - function(newValue, oldValue) {
115   - if (!scope[ctrlAs].$$columns_loaded) {
116   - // TODO:格式判定以后做,假设格式是对的
117   -
118   -
119   - }
120   -
121   - scope[ctrlAs].$$columns_loaded = true;
122   - scope[ctrlAs].$$refresh_selectgroupds();
123   - },
124   - true
125   - );
126   - // 监控字段排序列表
127   - scope.$watch(
128   - function() {
129   - return scope[ctrlAs].ordercolumns;
130   - },
131   - function(newValue, oldValue) {
132   - if (!scope[ctrlAs].$$ordercolumns_loaded) {
133   - if (newValue) {
134   - var aColumns = []; // 排序的字段
135   - var aDirs = []; // 排序字段对应的排序方向
136   -
137   - if (newValue.order) {
138   - aColumns = newValue.order.split(",");
139   - }
140   - if (newValue.direction) {
141   - aDirs = newValue.direction.split(",");
142   - }
143   -
144   - for (var i = 0; i < aColumns.length; i++) {
145   - if (i < aDirs.length) {
146   - scope[ctrlAs].$$selectgroupds.push({
147   - column: aColumns[i],
148   - dir: aDirs[i]
149   - });
150   - } else {
151   - scope[ctrlAs].$$selectgroupds.push({
152   - column: aColumns[i],
153   - dir: 'ASC'
154   - });
155   - }
156   - }
157   - }
158   - }
159   - scope[ctrlAs].$$ordercolumns_loaded = true;
160   - scope[ctrlAs].$$refresh_selectgroupds();
161   -
162   - },
163   - true
164   - );
165   - }
166   -
167   - };
168   - }
169   - };
170   - }
171   - ]
  1 +/**
  2 + * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的)
  3 + * 属性如下:
  4 + * name(必须):控件的名字
  5 + * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...]
  6 + * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'}
  7 + */
  8 +angular.module('ScheduleApp').directive(
  9 + 'saOrderoption',
  10 + [
  11 + function() {
  12 + return {
  13 + restrict: 'E',
  14 + templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html',
  15 + scope: {
  16 + columns: '=',
  17 + ordercolumns: '='
  18 + },
  19 + controllerAs: '$saOrderOptionCtrl',
  20 + bindToController: true,
  21 + controller: function() {
  22 + var self = this;
  23 +
  24 + // 字段列表是否预载入
  25 + self.$$columns_loaded = false;
  26 + // 字段排序是否预载入
  27 + self.$$ordercolumns_loaded = false;
  28 +
  29 +
  30 + // 每组选项内部数据源
  31 + // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}]
  32 + self.$$selectgroupds = [];
  33 +
  34 + // TODO:选择事件
  35 +
  36 + self.$$select_column_change = function() {
  37 + self.$$refresh_selectgroupds();
  38 + };
  39 +
  40 + self.$$select_dir_change = function() {
  41 + self.$$refresh_selectgroupds();
  42 + };
  43 +
  44 + self.$$add_option_click = function(index) {
  45 + self.$$selectgroupds.splice(index, 0, {
  46 + column: self.columns[0].name,
  47 + dir: "ASC"
  48 + });
  49 + self.$$refresh_selectgroupds();
  50 + };
  51 + self.$$del_option_click = function(index) {
  52 + self.$$selectgroupds.splice(index, 1);
  53 + self.$$refresh_selectgroupds();
  54 + };
  55 +
  56 + // 刷新选项内部数据源
  57 + self.$$refresh_selectgroupds = function() {
  58 + if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) {
  59 + // 没有载入完成,或者字段列表为空
  60 + return;
  61 + }
  62 +
  63 + if (self.$$selectgroupds.length == 0) { // 默认添加一组排序
  64 + self.$$selectgroupds.push({
  65 + column: self.columns[0].name,
  66 + dir: "ASC"
  67 + });
  68 + }
  69 +
  70 + // 重新计算ordercolumns
  71 +
  72 + var aColumn = [];
  73 + var aDir = [];
  74 + for (var i = 0; i < self.$$selectgroupds.length; i++) {
  75 + aColumn.push(self.$$selectgroupds[i].column);
  76 + aDir.push(self.$$selectgroupds[i].dir);
  77 + }
  78 + if (self.ordercolumns) {
  79 + self.ordercolumns.order = aColumn.join(",");
  80 + self.ordercolumns.direction = aDir.join(",");
  81 + } else {
  82 + self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")}
  83 + }
  84 +
  85 + }
  86 + },
  87 + compile: function(tElem, tAttrs) {
  88 + // 获取所有属性,并验证
  89 + var $name_attr = tAttrs['name']; // 控件的名字
  90 + if (!$name_attr) {
  91 + throw "必须有名称属性";
  92 + }
  93 +
  94 + // controlAs名字
  95 + var ctrlAs = '$saOrderOptionCtrl';
  96 +
  97 + // TODO:
  98 +
  99 +
  100 +
  101 + return {
  102 + pre: function(scope, element, attr) {
  103 +
  104 + },
  105 +
  106 + post: function(scope, element, attr) {
  107 +
  108 + //--------------------- 监控属性方法 -------------------//
  109 + // 监控字段名字列表
  110 + scope.$watch(
  111 + function() {
  112 + return scope[ctrlAs].columns;
  113 + },
  114 + function(newValue, oldValue) {
  115 + if (!scope[ctrlAs].$$columns_loaded) {
  116 + // TODO:格式判定以后做,假设格式是对的
  117 +
  118 +
  119 + }
  120 +
  121 + scope[ctrlAs].$$columns_loaded = true;
  122 + scope[ctrlAs].$$refresh_selectgroupds();
  123 + },
  124 + true
  125 + );
  126 + // 监控字段排序列表
  127 + scope.$watch(
  128 + function() {
  129 + return scope[ctrlAs].ordercolumns;
  130 + },
  131 + function(newValue, oldValue) {
  132 + if (!scope[ctrlAs].$$ordercolumns_loaded) {
  133 + if (newValue) {
  134 + var aColumns = []; // 排序的字段
  135 + var aDirs = []; // 排序字段对应的排序方向
  136 +
  137 + if (newValue.order) {
  138 + aColumns = newValue.order.split(",");
  139 + }
  140 + if (newValue.direction) {
  141 + aDirs = newValue.direction.split(",");
  142 + }
  143 +
  144 + for (var i = 0; i < aColumns.length; i++) {
  145 + if (i < aDirs.length) {
  146 + scope[ctrlAs].$$selectgroupds.push({
  147 + column: aColumns[i],
  148 + dir: aDirs[i]
  149 + });
  150 + } else {
  151 + scope[ctrlAs].$$selectgroupds.push({
  152 + column: aColumns[i],
  153 + dir: 'ASC'
  154 + });
  155 + }
  156 + }
  157 + }
  158 + }
  159 + scope[ctrlAs].$$ordercolumns_loaded = true;
  160 + scope[ctrlAs].$$refresh_selectgroupds();
  161 +
  162 + },
  163 + true
  164 + );
  165 + }
  166 +
  167 + };
  168 + }
  169 + };
  170 + }
  171 + ]
172 172 );
173 173 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html
1   -<style>
2   - .option_panel {
3   - height: 100%;
4   - margin: 0;
5   - padding: 0;
6   - }
7   - .option_panel .detail-wrap {
8   - padding: 0;
9   - max-height: 300px;
10   - border: 1px solid #ddd;
11   - background: #fafafa;
12   - border-radius: 10px !important;
13   - moz-user-select: -moz-none;
14   - -moz-user-select: none;
15   - -o-user-select: none;
16   - -khtml-user-select: none;
17   - -webkit-user-select: none;
18   - -ms-user-select: none;
19   - user-select: none;
20   - overflow: auto;
21   - }
22   -
23   - .option_panel .detail-wrap > .option {
24   - margin-top: 5px;
25   - }
26   -
27   - .option_panel .detail-wrap > .option:nth-last-child(1) {
28   - margin-bottom: 5px;
29   - }
30   -
31   - .option_panel .detail-wrap > .option .option_column {
32   - padding-left: 3px;
33   - padding-right: 5px;
34   - }
35   - .option_panel .detail-wrap > .option .option_dir {
36   - padding-left: 0px;
37   - padding-right: 5px;
38   - }
39   - .option_panel .detail-wrap > .option .option_opt {
40   - width: 70px;
41   - padding-left: 0px;
42   - padding-right: 0px;
43   - }
44   -
45   - .option_panel .detail-wrap .option .form-control {
46   - font-size: 10px;
47   - }
48   -
49   -
50   - .option_scrollbar::-webkit-scrollbar {
51   - width: 18px;
52   - height: 18px;
53   - }
54   -
55   - .option_scrollbar::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb {
56   - border-radius: 999px;
57   - border: 5px solid transparent;
58   - }
59   -
60   - .option_scrollbar::-webkit-scrollbar-track {
61   - box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset;
62   - }
63   -
64   - .option_scrollbar::-webkit-scrollbar-thumb {
65   - min-height: 20px;
66   - background-clip: content-box;
67   - box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
68   - }
69   -
70   - .option_scrollbar::-webkit-scrollbar-corner {
71   - background: transparent;
72   - }
73   -
74   -</style>
75   -
76   -<div>
77   - <div class="option_panel">
78   - <div class="detail-wrap option_scrollbar">
79   -
80   - <div class="col-md-12 option" ng-repeat="$option in $saOrderOptionCtrl.$$selectgroupds track by $index" ng-init="rowIndex = $index">
81   - <div class="col-md-5 option_column">
82   - <select class="form-control aria-invalid="false" ng-model="$option.column" ng-change="$saOrderOptionCtrl.$$select_column_change()">
83   - <option ng-repeat="$column in $saOrderOptionCtrl.columns track by $index"
84   - ng-init="colIndex = $index"
85   - ng-selected="$option.column==$column.name"
86   - value="{{$column.name}}">
87   - {{$column.desc}}
88   - </option>
89   - </select>
90   - </div>
91   - <div class="col-md-3 option_dir">
92   - <select class="form-control aria-invalid="false" ng-model="$option.dir" ng-change="$saOrderOptionCtrl.$$select_dir_change()">
93   - <option value="ASC" ng-selected="$option.dir=='ASC'">升序</option>
94   - <option value="DESC" ng-selected="$option.dir=='DESC'">降序</option>
95   - </select>
96   - </div>
97   - <div class="col-md-3 btn-group option_opt">
98   - <button type="button" class="btn btn-default" ng-click="$saOrderOptionCtrl.$$add_option_click(rowIndex)">+</button>
99   - <button type="button" class="btn btn-default" ng-click="$saOrderOptionCtrl.$$del_option_click(rowIndex)">-</button>
100   - </div>
101   -
102   - </div>
103   -
104   -
105   - </div>
106   -
107   -
108   - </div>
109   -
  1 +<style>
  2 + .option_panel {
  3 + height: 100%;
  4 + margin: 0;
  5 + padding: 0;
  6 + }
  7 + .option_panel .detail-wrap {
  8 + padding: 0;
  9 + max-height: 300px;
  10 + border: 1px solid #ddd;
  11 + background: #fafafa;
  12 + border-radius: 10px !important;
  13 + moz-user-select: -moz-none;
  14 + -moz-user-select: none;
  15 + -o-user-select: none;
  16 + -khtml-user-select: none;
  17 + -webkit-user-select: none;
  18 + -ms-user-select: none;
  19 + user-select: none;
  20 + overflow: auto;
  21 + }
  22 +
  23 + .option_panel .detail-wrap > .option {
  24 + margin-top: 5px;
  25 + }
  26 +
  27 + .option_panel .detail-wrap > .option:nth-last-child(1) {
  28 + margin-bottom: 5px;
  29 + }
  30 +
  31 + .option_panel .detail-wrap > .option .option_column {
  32 + padding-left: 3px;
  33 + padding-right: 5px;
  34 + }
  35 + .option_panel .detail-wrap > .option .option_dir {
  36 + padding-left: 0px;
  37 + padding-right: 5px;
  38 + }
  39 + .option_panel .detail-wrap > .option .option_opt {
  40 + width: 70px;
  41 + padding-left: 0px;
  42 + padding-right: 0px;
  43 + }
  44 +
  45 + .option_panel .detail-wrap .option .form-control {
  46 + font-size: 10px;
  47 + }
  48 +
  49 +
  50 + .option_scrollbar::-webkit-scrollbar {
  51 + width: 18px;
  52 + height: 18px;
  53 + }
  54 +
  55 + .option_scrollbar::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb {
  56 + border-radius: 999px;
  57 + border: 5px solid transparent;
  58 + }
  59 +
  60 + .option_scrollbar::-webkit-scrollbar-track {
  61 + box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset;
  62 + }
  63 +
  64 + .option_scrollbar::-webkit-scrollbar-thumb {
  65 + min-height: 20px;
  66 + background-clip: content-box;
  67 + box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
  68 + }
  69 +
  70 + .option_scrollbar::-webkit-scrollbar-corner {
  71 + background: transparent;
  72 + }
  73 +
  74 +</style>
  75 +
  76 +<div>
  77 + <div class="option_panel">
  78 + <div class="detail-wrap option_scrollbar">
  79 +
  80 + <div class="col-md-12 option" ng-repeat="$option in $saOrderOptionCtrl.$$selectgroupds track by $index" ng-init="rowIndex = $index">
  81 + <div class="col-md-5 option_column">
  82 + <select class="form-control aria-invalid="false" ng-model="$option.column" ng-change="$saOrderOptionCtrl.$$select_column_change()">
  83 + <option ng-repeat="$column in $saOrderOptionCtrl.columns track by $index"
  84 + ng-init="colIndex = $index"
  85 + ng-selected="$option.column==$column.name"
  86 + value="{{$column.name}}">
  87 + {{$column.desc}}
  88 + </option>
  89 + </select>
  90 + </div>
  91 + <div class="col-md-3 option_dir">
  92 + <select class="form-control aria-invalid="false" ng-model="$option.dir" ng-change="$saOrderOptionCtrl.$$select_dir_change()">
  93 + <option value="ASC" ng-selected="$option.dir=='ASC'">升序</option>
  94 + <option value="DESC" ng-selected="$option.dir=='DESC'">降序</option>
  95 + </select>
  96 + </div>
  97 + <div class="col-md-3 btn-group option_opt">
  98 + <button type="button" class="btn btn-default" ng-click="$saOrderOptionCtrl.$$add_option_click(rowIndex)">+</button>
  99 + <button type="button" class="btn btn-default" ng-click="$saOrderOptionCtrl.$$del_option_click(rowIndex)">-</button>
  100 + </div>
  101 +
  102 + </div>
  103 +
  104 +
  105 + </div>
  106 +
  107 +
  108 + </div>
  109 +
110 110 </div>
111 111 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saSrule.js
1   -/**
2   - * saSrule指令(非通用指令,只在排班计划form中使用)。
3   - * 属性如下:
4   - * name(必须):控件的名字
5   - * xlid(必须):线路id
6   - * from(必须):独立作用域-绑定的开始时间属性名
7   - * to(必须):独立作用域-绑定的结束时间属性名
8   - * error(必须):独立作用域-绑定的错误描述属性名
9   - */
10   -angular.module('ScheduleApp').directive(
11   - 'saSrule',
12   - [
13   - 'SchedulePlanManageService_g',
14   - function(service) {
15   - return {
16   - restrict: 'E',
17   - templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html',
18   - scope: {
19   - from: '=',
20   - to: '=',
21   - xlid: '=',
22   - error: '='
23   - },
24   - controllerAs: '$saSruleCtrl',
25   - bindToController: true,
26   - controller: function() {
27   - var self = this;
28   -
29   - // 内部ng-model值,用于和required配对
30   - self.$$internalmodel = undefined;
31   -
32   - // 内部数据源(时刻表的一些信息)
33   - self.$$count = 0;
34   - self.$$qyCount = 0;
35   - self.$$qyErrorCount = 0;
36   - self.$$errorInfos = [];
37   -
38   - },
39   - compile: function(tElem, tAttrs) {
40   - // 获取所有属性,并验证
41   - var $name_attr = tAttrs['name']; // 控件的名字
42   - if (!$name_attr) {
43   - throw "必须有名称属性";
44   - }
45   -
46   - // controlAs名字
47   - var ctrlAs = '$saSruleCtrl';
48   -
49   - // 线路id
50   - var xl_id = undefined;
51   - // 开始时间
52   - var from_date = undefined;
53   - // 结束时间
54   - var to_date = undefined;
55   -
56   - // 内部添加required验证,将所有的错误应用到required验证上去
57   - tElem.find("div").attr("required", "");
58   -
59   - return {
60   - pre: function(scope, element, attr) {
61   -
62   - },
63   -
64   - post: function(scope, element, attr) {
65   - // 属性值
66   - if ($name_attr) {
67   - scope[ctrlAs]["$name_attr"] = $name_attr;
68   - }
69   -
70   - // 开始日期open属性,及方法
71   - scope[ctrlAs].$$fromDateOpen = false;
72   - scope[ctrlAs].$$fromDate_open = function() {
73   - scope[ctrlAs].$$fromDateOpen = true;
74   - };
75   -
76   - // 结束日期open属性,及方法
77   - scope[ctrlAs].$$toDateOpen = false;
78   - scope[ctrlAs].$$toDate_open = function() {
79   - scope[ctrlAs].$$toDateOpen = true;
80   - };
81   -
82   - // 内部模型刷新
83   - scope[ctrlAs].$$internal_model_refresh = function() {
84   - if (!xl_id) {
85   - scope[ctrlAs].$$internalmodel = undefined;
86   - scope[ctrlAs].error = "线路必须选择";
87   - return;
88   - }
89   - if (!from_date) {
90   - scope[ctrlAs].$$internalmodel = undefined;
91   - scope[ctrlAs].error = "开始日期必须选择";
92   - return;
93   - }
94   - if (!to_date) {
95   - scope[ctrlAs].$$internalmodel = undefined;
96   - scope[ctrlAs].error = "结束日期必须选择";
97   - return;
98   - }
99   - if (from_date > to_date) {
100   - scope[ctrlAs].$$internalmodel = undefined;
101   - scope[ctrlAs].error = "开始日期必须在结束日期之前";
102   - return;
103   - }
104   -
105   - scope[ctrlAs].$$count = 0;
106   - scope[ctrlAs].$$qyCount = 0;
107   - scope[ctrlAs].$$qyErrorCount = 0;
108   - scope[ctrlAs].$$errorInfos = [];
109   -
110   - if (scope[ctrlAs].$$qyCount == 0) {
111   - scope[ctrlAs].$$internalmodel = undefined;
112   - scope[ctrlAs].error = "无可启用的规则数";
113   - }
114   -
115   - var QClass = service.v_rules;
116   - QClass.val({xlid: xl_id, from: from_date, to: to_date},
117   - function(result) {
118   - scope[ctrlAs].$$count = result.data.count;
119   - scope[ctrlAs].$$qyCount = result.data.qyCount;
120   - scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount;
121   -
122   - angular.forEach(result.data.errorInfos, function(obj) {
123   - scope[ctrlAs].$$errorInfos.push({
124   - ruleId: obj.ruleId,
125   - clZbh: obj.clZbh,
126   - qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"),
127   - infos: obj.errorDescList.join("")
128   - });
129   - });
130   -
131   - if (scope[ctrlAs].$$qyErrorCount > 0) {
132   - scope[ctrlAs].$$internalmodel = undefined;
133   - scope[ctrlAs].error = "有错误的规则";
134   - } else {
135   - scope[ctrlAs].$$internalmodel = "ok";
136   - scope[ctrlAs].$$errorInfos = [];
137   - }
138   - },
139   - function() {
140   - scope[ctrlAs].$$internalmodel = undefined;
141   - scope[ctrlAs].error = "获取规则数据失败!";
142   - }
143   - );
144   -
145   - scope[ctrlAs].$$internalmodel = "ok";
146   - };
147   -
148   - scope[ctrlAs].$$internal_model_refresh(); // 初始执行
149   -
150   - //--------------------- 监控属性方法 -------------------//
151   - // 监控线路id模型值变化
152   - scope.$watch(
153   - function() {
154   - return scope[ctrlAs].xlid;
155   - },
156   - function(newValue, oldValue) {
157   - xl_id = newValue;
158   - scope[ctrlAs].$$internal_model_refresh();
159   - }
160   - );
161   -
162   - // 监控开始时间模型值变化
163   - scope.$watch(
164   - function() {
165   - return scope[ctrlAs].from;
166   - },
167   - function(newValue, oldValue) {
168   - from_date = newValue;
169   - scope[ctrlAs].$$internal_model_refresh();
170   - }
171   - );
172   - // 监控结束时间模型值变化
173   - scope.$watch(
174   - function() {
175   - return scope[ctrlAs].to;
176   - },
177   - function(newValue, oldValue) {
178   - to_date = newValue;
179   - scope[ctrlAs].$$internal_model_refresh();
180   - }
181   - );
182   - }
183   - };
184   - }
185   - };
186   - }
187   - ]
  1 +/**
  2 + * saSrule指令(非通用指令,只在排班计划form中使用)。
  3 + * 属性如下:
  4 + * name(必须):控件的名字
  5 + * xlid(必须):线路id
  6 + * from(必须):独立作用域-绑定的开始时间属性名
  7 + * to(必须):独立作用域-绑定的结束时间属性名
  8 + * error(必须):独立作用域-绑定的错误描述属性名
  9 + */
  10 +angular.module('ScheduleApp').directive(
  11 + 'saSrule',
  12 + [
  13 + 'SchedulePlanManageService_g',
  14 + function(service) {
  15 + return {
  16 + restrict: 'E',
  17 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html',
  18 + scope: {
  19 + from: '=',
  20 + to: '=',
  21 + xlid: '=',
  22 + error: '='
  23 + },
  24 + controllerAs: '$saSruleCtrl',
  25 + bindToController: true,
  26 + controller: function() {
  27 + var self = this;
  28 +
  29 + // 内部ng-model值,用于和required配对
  30 + self.$$internalmodel = undefined;
  31 +
  32 + // 内部数据源(时刻表的一些信息)
  33 + self.$$count = 0;
  34 + self.$$qyCount = 0;
  35 + self.$$qyErrorCount = 0;
  36 + self.$$errorInfos = [];
  37 +
  38 + },
  39 + compile: function(tElem, tAttrs) {
  40 + // 获取所有属性,并验证
  41 + var $name_attr = tAttrs['name']; // 控件的名字
  42 + if (!$name_attr) {
  43 + throw "必须有名称属性";
  44 + }
  45 +
  46 + // controlAs名字
  47 + var ctrlAs = '$saSruleCtrl';
  48 +
  49 + // 线路id
  50 + var xl_id = undefined;
  51 + // 开始时间
  52 + var from_date = undefined;
  53 + // 结束时间
  54 + var to_date = undefined;
  55 +
  56 + // 内部添加required验证,将所有的错误应用到required验证上去
  57 + tElem.find("div").attr("required", "");
  58 +
  59 + return {
  60 + pre: function(scope, element, attr) {
  61 +
  62 + },
  63 +
  64 + post: function(scope, element, attr) {
  65 + // 属性值
  66 + if ($name_attr) {
  67 + scope[ctrlAs]["$name_attr"] = $name_attr;
  68 + }
  69 +
  70 + // 开始日期open属性,及方法
  71 + scope[ctrlAs].$$fromDateOpen = false;
  72 + scope[ctrlAs].$$fromDate_open = function() {
  73 + scope[ctrlAs].$$fromDateOpen = true;
  74 + };
  75 +
  76 + // 结束日期open属性,及方法
  77 + scope[ctrlAs].$$toDateOpen = false;
  78 + scope[ctrlAs].$$toDate_open = function() {
  79 + scope[ctrlAs].$$toDateOpen = true;
  80 + };
  81 +
  82 + // 内部模型刷新
  83 + scope[ctrlAs].$$internal_model_refresh = function() {
  84 + if (!xl_id) {
  85 + scope[ctrlAs].$$internalmodel = undefined;
  86 + scope[ctrlAs].error = "线路必须选择";
  87 + return;
  88 + }
  89 + if (!from_date) {
  90 + scope[ctrlAs].$$internalmodel = undefined;
  91 + scope[ctrlAs].error = "开始日期必须选择";
  92 + return;
  93 + }
  94 + if (!to_date) {
  95 + scope[ctrlAs].$$internalmodel = undefined;
  96 + scope[ctrlAs].error = "结束日期必须选择";
  97 + return;
  98 + }
  99 + if (from_date > to_date) {
  100 + scope[ctrlAs].$$internalmodel = undefined;
  101 + scope[ctrlAs].error = "开始日期必须在结束日期之前";
  102 + return;
  103 + }
  104 +
  105 + scope[ctrlAs].$$count = 0;
  106 + scope[ctrlAs].$$qyCount = 0;
  107 + scope[ctrlAs].$$qyErrorCount = 0;
  108 + scope[ctrlAs].$$errorInfos = [];
  109 +
  110 + if (scope[ctrlAs].$$qyCount == 0) {
  111 + scope[ctrlAs].$$internalmodel = undefined;
  112 + scope[ctrlAs].error = "无可启用的规则数";
  113 + }
  114 +
  115 + var QClass = service.v_rules;
  116 + QClass.val({xlid: xl_id, from: from_date, to: to_date},
  117 + function(result) {
  118 + scope[ctrlAs].$$count = result.data.count;
  119 + scope[ctrlAs].$$qyCount = result.data.qyCount;
  120 + scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount;
  121 +
  122 + angular.forEach(result.data.errorInfos, function(obj) {
  123 + scope[ctrlAs].$$errorInfos.push({
  124 + ruleId: obj.ruleId,
  125 + clZbh: obj.clZbh,
  126 + qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"),
  127 + infos: obj.errorDescList.join("")
  128 + });
  129 + });
  130 +
  131 + if (scope[ctrlAs].$$qyErrorCount > 0) {
  132 + scope[ctrlAs].$$internalmodel = undefined;
  133 + scope[ctrlAs].error = "有错误的规则";
  134 + } else {
  135 + scope[ctrlAs].$$internalmodel = "ok";
  136 + scope[ctrlAs].$$errorInfos = [];
  137 + }
  138 + },
  139 + function() {
  140 + scope[ctrlAs].$$internalmodel = undefined;
  141 + scope[ctrlAs].error = "获取规则数据失败!";
  142 + }
  143 + );
  144 +
  145 + scope[ctrlAs].$$internalmodel = "ok";
  146 + };
  147 +
  148 + scope[ctrlAs].$$internal_model_refresh(); // 初始执行
  149 +
  150 + //--------------------- 监控属性方法 -------------------//
  151 + // 监控线路id模型值变化
  152 + scope.$watch(
  153 + function() {
  154 + return scope[ctrlAs].xlid;
  155 + },
  156 + function(newValue, oldValue) {
  157 + xl_id = newValue;
  158 + scope[ctrlAs].$$internal_model_refresh();
  159 + }
  160 + );
  161 +
  162 + // 监控开始时间模型值变化
  163 + scope.$watch(
  164 + function() {
  165 + return scope[ctrlAs].from;
  166 + },
  167 + function(newValue, oldValue) {
  168 + from_date = newValue;
  169 + scope[ctrlAs].$$internal_model_refresh();
  170 + }
  171 + );
  172 + // 监控结束时间模型值变化
  173 + scope.$watch(
  174 + function() {
  175 + return scope[ctrlAs].to;
  176 + },
  177 + function(newValue, oldValue) {
  178 + to_date = newValue;
  179 + scope[ctrlAs].$$internal_model_refresh();
  180 + }
  181 + );
  182 + }
  183 + };
  184 + }
  185 + };
  186 + }
  187 + ]
188 188 );
189 189 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html
1   -<div name="{{$saSruleCtrl.$name_attr}}" ng-model="$saSruleCtrl.$$internalmodel">
2   - <style>
3   - .s-rule-select {
4   - min-height: 180px;
5   - border: 1px solid #ddd;
6   - }
7   - .s-rule-select .s-rule-input {
8   - margin: 0px 5px 5px 5px;
9   - padding-top: 7px;
10   - padding-left: 0;
11   - }
12   - .s-rule-select .s-rule-select-cont {
13   - text-align: left;
14   - min-height: 100px;
15   - padding-right: 0px;
16   - }
17   - .s-rule-select .s-rule-select-body {
18   - margin-top: 10px;
19   - overflow: auto;
20   - width: auto;
21   - min-height: 100px;
22   - }
23   -
24   -
25   - </style>
26   -
27   -
28   - <div class="col-md-12 s-rule-select">
29   - <div class="col-md-12 s-rule-input">
30   - <div class="col-md-12">
31   - 总规则{{$saSruleCtrl.$$count}}条,启用规则{{$saSruleCtrl.$$qyCount}}条,错误规则{{$saSruleCtrl.$$qyErrorCount}}条
32   - </div>
33   - </div>
34   - <div class="col-md-12 s-rule-select-cont">
35   - <div class="s-rule-select-body">
36   -
37   - <div ng-repeat="info in $saSruleCtrl.$$errorInfos track by $index">
38   - <a ui-sref="scheduleRuleManage_edit({id: info.ruleId})">
39   - {{info.clZbh}},{{info.qyrq}},{{info.infos}}
40   - </a>
41   -
42   - </div>
43   -
44   - </div>
45   - </div>
46   - </div>
47   -
  1 +<div name="{{$saSruleCtrl.$name_attr}}" ng-model="$saSruleCtrl.$$internalmodel">
  2 + <style>
  3 + .s-rule-select {
  4 + min-height: 180px;
  5 + border: 1px solid #ddd;
  6 + }
  7 + .s-rule-select .s-rule-input {
  8 + margin: 0px 5px 5px 5px;
  9 + padding-top: 7px;
  10 + padding-left: 0;
  11 + }
  12 + .s-rule-select .s-rule-select-cont {
  13 + text-align: left;
  14 + min-height: 100px;
  15 + padding-right: 0px;
  16 + }
  17 + .s-rule-select .s-rule-select-body {
  18 + margin-top: 10px;
  19 + overflow: auto;
  20 + width: auto;
  21 + min-height: 100px;
  22 + }
  23 +
  24 +
  25 + </style>
  26 +
  27 +
  28 + <div class="col-md-12 s-rule-select">
  29 + <div class="col-md-12 s-rule-input">
  30 + <div class="col-md-12">
  31 + 总规则{{$saSruleCtrl.$$count}}条,启用规则{{$saSruleCtrl.$$qyCount}}条,错误规则{{$saSruleCtrl.$$qyErrorCount}}条
  32 + </div>
  33 + </div>
  34 + <div class="col-md-12 s-rule-select-cont">
  35 + <div class="s-rule-select-body">
  36 +
  37 + <div ng-repeat="info in $saSruleCtrl.$$errorInfos track by $index">
  38 + <a ui-sref="scheduleRuleManage_edit({id: info.ruleId})">
  39 + {{info.clZbh}},{{info.qyrq}},{{info.infos}}
  40 + </a>
  41 +
  42 + </div>
  43 +
  44 + </div>
  45 + </div>
  46 + </div>
  47 +
48 48 </div>
49 49 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage2/orderOptionOpen.html
1   -<div class="modal-header">
2   - <div class="modal-title">
3   - <h3>
4   - <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
5   - <span class="caption-subject bold uppercase">排序字段选择</span>
6   - </h3>
7   - </div>
8   -</div>
9   -<div class="modal-body">
10   - <!--order={{$ctrl.orderColumns.order}}-->
11   - <!--<br>-->
12   - <!--direction={{$ctrl.orderColumns.direction}}-->
13   - <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
14   - </sa-Orderoption>
15   -</div>
16   -<div class="modal-footer">
17   - <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
  1 +<div class="modal-header">
  2 + <div class="modal-title">
  3 + <h3>
  4 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  5 + <span class="caption-subject bold uppercase">排序字段选择</span>
  6 + </h3>
  7 + </div>
  8 +</div>
  9 +<div class="modal-body">
  10 + <!--order={{$ctrl.orderColumns.order}}-->
  11 + <!--<br>-->
  12 + <!--direction={{$ctrl.orderColumns.direction}}-->
  13 + <sa-Orderoption name="orderOptions" columns="$ctrl.columns" ordercolumns="$ctrl.orderColumns">
  14 + </sa-Orderoption>
  15 +</div>
  16 +<div class="modal-footer">
  17 + <button class="btn btn-primary" ng-click="$ctrl.confirm($ctrl.orderColumns)">确定</button>
18 18 </div>
19 19 \ No newline at end of file
... ...
src/main/resources/static/pages/trafficManage/js/timeTempletUploadRecord.js
... ... @@ -201,7 +201,7 @@
201 201 // 绑定查询事件
202 202 $("#search").click(searchM);
203 203 // 查询方法
204   - function searchM(p, pagination) {
  204 + function searchM() {
205 205 var params = {};
206 206 // 取得输入框的值
207 207 var inputs = $(".breadcrumb input,select");
... ... @@ -209,6 +209,19 @@
209 209 $.each(inputs, function(i, element) {
210 210 params[$(element).attr("name")] = $(element).val();
211 211 });
  212 + page = 0;
  213 + loadTableDate(params,true);
  214 + }
  215 +
  216 + function loadTableDate(param,isPon) {
  217 + // 搜索参数
  218 + var params = {};
  219 + if(param)
  220 + params = param;
  221 + // 排序(按更新时间)
  222 + params['order'] = 'id';
  223 + // 记录当前页数
  224 + params['page'] = page;
212 225 var i = layer.load(2);
213 226 $get('/skb_log', params, function(data) {
214 227 var content = data.content;
... ... @@ -217,7 +230,7 @@
217 230 list : content
218 231 });
219 232 $('#datatable_logger tbody').html(bodyHtm);
220   - if(pagination && data.content.length > 0){
  233 + if(isPon && data.content.length > 0){
221 234 //重新分页
222 235 initPagination = true;
223 236 showPagination(data);
... ... @@ -250,10 +263,8 @@
250 263 initPagination = false;
251 264 return;
252 265 }
253   -
254   -
255 266 page = num - 1;
256   - searchM(null, false);
  267 + loadTableDate(null, false);
257 268 }
258 269 });
259 270 }
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/wxsb.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal ct_move_modal" id="schedule-wxsb-modal">
  2 + <div class="uk-modal-dialog">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>维修上报</h2></div>
  6 + <form class="uk-form uk-form-horizontal">
  7 + </form>
  8 + </div>
  9 +
  10 + <script id="schedule-wxsb-form-temp" type="text/html">
  11 + <input type="hidden" name="id" value="{{id}}"/>
  12 + <div class="uk-grid">
  13 + <div class="uk-width-1-2">
  14 + <div class="uk-form-row">
  15 + <label class="uk-form-label" >车辆编码</label>
  16 + <div class="uk-form-controls">
  17 + <input type="text" name="nbbm" value="{{clZbh}}" readonly>
  18 + </div>
  19 + </div>
  20 + </div>
  21 + <div class="uk-width-1-2">
  22 + <div class="uk-form-row">
  23 + <label class="uk-form-label" >报修类型</label>
  24 + <div class="uk-form-controls">
  25 + <select name="bxType"></select>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  31 + <button type="button" class="uk-button uk-modal-close">取消</button>
  32 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  33 + </div>
  34 + </script>
  35 +
  36 + <script>
  37 + (function() {
  38 + var modal = '#schedule-wxsb-modal'
  39 + ,sch;
  40 +
  41 + $(modal).on('init', function(e, data) {
  42 + e.stopPropagation();
  43 + sch=data.sch;
  44 + var formHtml = template('schedule-wxsb-form-temp', sch);
  45 + $('form', modal).html(formHtml);
  46 +
  47 + //班次类型字典
  48 + var bxtypes=[{code:"9101", des:"轨迹不连续"}, {code:"9102", des:"无轨迹"}, {code:"9103", des:"收不到调度指令"}, {code:"9104", des:"漂移"}, {code:"9109", des:"其它"}],opts='';
  49 + for(var i = 0;i < bxtypes.length;i++){
  50 + opts+='<option value="'+bxtypes[i].code+'">'+bxtypes[i].des+'</option>';
  51 + }
  52 + $('[name=bxType]', modal).html(opts);
  53 +
  54 + //submit
  55 + var f = $('form', modal).formValidation(gb_form_validation_opts);
  56 + f.on('success.form.fv', function(e) {
  57 + e.preventDefault();
  58 + $('[type=submit]', f).attr('disabled', 'disabled');
  59 + var data = $(this).serializeJSON();
  60 + gb_common.$post('/realSchedule/wxsb', data, function(rs){
  61 + //更新班次信息
  62 + notify_succ('操作成功!');
  63 + UIkit.modal(modal).hide();
  64 + });
  65 + });
  66 + });
  67 + })();
  68 + </script>
  69 +</div>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/editor.html
... ... @@ -374,7 +374,7 @@
374 374 $('[name=bcType]', f).trigger('change');
375 375 }
376 376  
377   -
  377 +
378 378 function initScheduleTypeChange(f, cb) {
379 379 (function (f, cb) {
380 380 $('[name=bcType]', f).on('change', function () {
... ... @@ -396,7 +396,8 @@
396 396 var time, mileage;
397 397 switch (bcType_e.val()) {
398 398 case 'out':
399   - qdz.html(park_opts).val(information.carPark);
  399 + if (gb_sch && gb_sch.qdzCode) qdz.html(park_opts).val(gb_sch.qdzCode);
  400 + else qdz.html(park_opts).val(information.carPark);
400 401 zdz.html(opts);
401 402 //出场结束时间
402 403 time = updown == 0 ? information.upOutTimer : information.downOutTimer;
... ... @@ -404,7 +405,8 @@
404 405 break;
405 406 case 'in':
406 407 qdz.html(opts);
407   - zdz.html(park_opts).val(information.carPark);
  408 + if (gb_sch && gb_sch.zdzCode) zdz.html(park_opts).val(gb_sch.zdzCode);
  409 + else zdz.html(park_opts).val(information.carPark);
408 410 //进场结束时间
409 411 time = updown == 0 ? information.upInTimer : information.downInTimer;
410 412 mileage = updown == 0 ? information.upInMileage : information.downInMileage;
... ...
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
... ... @@ -285,6 +285,11 @@ var gb_schedule_context_menu = (function () {
285 285 open_modal(folder + '/sub_task_v2/main.html', {
286 286 sch: sch
287 287 }, modal_opts);
  288 + },
  289 + wxsb: function (sch) {
  290 + open_modal(folder + '/wxsb.html', {
  291 + sch: sch
  292 + }, modal_opts);
288 293 }
289 294 };
290 295  
... ... @@ -343,9 +348,13 @@ var gb_schedule_context_menu = (function () {
343 348 'wdtz': {
344 349 name: '误点调整'
345 350 },
346   - 'sep4': '---------',
  351 + 'sep5': '---------',
347 352 'lp_change': {
348 353 name: '路牌对调'
  354 + },
  355 + 'sep6': '---------',
  356 + 'wxsb': {
  357 + name: '维修上报'
349 358 }
350 359 }
351 360 });
... ...