Commit deb01f8b82c10c5f6def51b1d4054839f96023bc

Authored by 游瑞烽
2 parents 4b33c7b5 10983d1d

Merge remote-tracking branch 'origin/pudong' into pudong

Showing 186 changed files with 12602 additions and 6318 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
... ... @@ -152,7 +152,11 @@ public class DlbController extends BaseController<Dlb, Integer>{
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<Ylb, Integer>{
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 1 package com.bsth.controller.realcontrol;
2 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 +
3 26 import com.alibaba.fastjson.JSONArray;
4 27 import com.bsth.common.ResponseCode;
5 28 import com.bsth.controller.BaseController;
... ... @@ -10,14 +33,11 @@ import com.bsth.data.schedule.DayOfSchedule;
10 33 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
11 34 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 35 import com.bsth.entity.schedule.SchedulePlanInfo;
  36 +import com.bsth.entity.sys.SysUser;
  37 +import com.bsth.security.util.SecurityUtils;
13 38 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.*;
  39 +import com.bsth.util.ConfigUtil;
  40 +import com.fasterxml.jackson.databind.ObjectMapper;
21 41  
22 42 @RestController
23 43 @RequestMapping("/realSchedule")
... ... @@ -691,4 +711,74 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
691 711 public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
692 712 return scheduleRealInfoService.deleteToHistory(id);
693 713 }
  714 +
  715 + /**
  716 + * 从历史库里删除临加班次
  717 + * @param sch
  718 + * @return
  719 + */
  720 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  721 + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
  722 + SysUser user = SecurityUtils.getCurrentUser();
  723 + String uname = user.getUserName();
  724 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
  725 + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
  726 + // 分公司保存格式 分公司编码_公司编码
  727 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
  728 + String[] arr = val.split("_");
  729 + if (!"22".equals(arr[1])) {
  730 + Map<String, Object> res = new HashMap<String, Object>();
  731 + res.put("status", ResponseCode.ERROR);
  732 + res.put("msg", "除金高公司外暂未开通此功能");
  733 +
  734 + return res;
  735 + }
  736 + url.append("&fgs=").append(arr[0]);
  737 +
  738 + return request(url.toString());
  739 + }
  740 +
  741 + @SuppressWarnings("unchecked")
  742 + private static Map<String, Object> request(String url) {
  743 + Map<String, Object> res = new HashMap<String, Object>();
  744 + res.put("status", ResponseCode.SUCCESS);
  745 + InputStream in = null;
  746 + HttpURLConnection con = null;
  747 + try {
  748 + con = (HttpURLConnection)new URL(url).openConnection();
  749 + con.setRequestMethod("POST");
  750 + con.setRequestProperty("keep-alive", "true");
  751 + con.setRequestProperty("accept", "application/json");
  752 + con.setRequestProperty("content-type", "application/json");
  753 + con.setDoInput(true);
  754 + con.setReadTimeout(2500);
  755 + con.setConnectTimeout(2500);
  756 +
  757 + con.connect();
  758 + if (con.getResponseCode() == 200) {
  759 + in = con.getInputStream();
  760 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  761 + IOUtils.copy(in, bout); bout.close();
  762 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  763 + if (!"报修成功".equals(response.get("msg"))) {
  764 + res.put("status", ResponseCode.ERROR);
  765 + res.putAll(response);
  766 + }
  767 + }
  768 + } catch (IOException e) {
  769 + // TODO Auto-generated catch block
  770 + res.put("status", ResponseCode.ERROR);
  771 + res.put("msg", "调用上报接口异常");
  772 + } finally {
  773 + try {
  774 + if (in != null) in.close();
  775 + if (con != null) con.disconnect();
  776 + } catch (IOException e) {
  777 + // TODO Auto-generated catch block
  778 + e.printStackTrace();
  779 + }
  780 + }
  781 +
  782 + return res;
  783 + }
694 784 }
... ...
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/controller/schedule/core/CarConfigInfoController.java
... ... @@ -63,6 +63,20 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
63 63 return rtn;
64 64 }
65 65  
  66 + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
  68 + Map<String, Object> rtn = new HashMap<>();
  69 + try {
  70 + carConfigInfoService.validate_cars(xlId, clId);
  71 + rtn.put("status", ResponseCode.SUCCESS);
  72 + } catch (ScheduleException exp) {
  73 + rtn.put("status", ResponseCode.ERROR);
  74 + rtn.put("msg", exp.getMessage());
  75 + }
  76 +
  77 + return rtn;
  78 + }
  79 +
66 80 @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
67 81 public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
68 82 HttpSession session = request.getSession();
... ...
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
... ... @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController&lt;SchedulePlan, Long&gt; {
57 57 return rtn;
58 58 }
59 59  
  60 + /**
  61 + * 验证排班计划时间范围内规则的正确性。
  62 + * @return
  63 + * @throws Exception
  64 + */
  65 + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET)
  66 + public Map<String, Object> validateRule(
  67 + @PathVariable(value = "xlid") Integer xlid,
  68 + @PathVariable(value = "from") Date from,
  69 + @PathVariable(value = "to") Date to
  70 + ) throws Exception {
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + rtn.put("data", schedulePlanService.validateRule(xlid, from, to));
  74 + return rtn;
  75 + }
  76 +
60 77 }
... ...
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/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/schedule/SchedulePlanInfo.java
1 1 package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  5 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
7 7  
8 8 import javax.persistence.*;
9 9 import java.sql.PreparedStatement;
... ...
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/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
... ... @@ -28,13 +28,13 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
28 28 * @param rq
29 29 * @return
30 30 */
31   - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  31 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and ssgsdm like %?2% "
32 32 + " and fgsdm like %?3%"
33 33 + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true)
34 34 List<Dlb> obtainDl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px);
35 35  
36 36 @Query(value="select s from Dlb s "
37   - + " where to_days(?1)=to_days(s.rq) "
  37 + + " where to_days(s.rq)=to_days(?1) "
38 38 + " and s.ssgsdm like %?2% "
39 39 + " and s.fgsdm like %?3%"
40 40 + " and s.xlbm like %?4% "
... ... @@ -49,14 +49,14 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
49 49 * @param xlbm
50 50 * @return
51 51 */
52   - @Query(value="select nbbm,count(nbbm) from bsth_c_dlb where to_days(?1)=to_days(rq) and "
  52 + @Query(value="select nbbm,count(nbbm) from bsth_c_dlb where rq=?1 and "
53 53 + " ssgsdm like %?2% "
54 54 + " and fgsdm like %?3%"
55 55 + " and xlbm like %?4% and nbbm like %?5% "
56 56 + " group by nbbm,rq,ssgsdm,fgsdm",nativeQuery=true)
57 57 List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
58 58  
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 "
  59 + @Query(value="select nbbm,sum(cdl*100) as cdl ,sum(zlc*100) as zlc from bsth_c_dlb where rq= ?1 and "
60 60 + " ssgsdm like %?2% "
61 61 + " and fgsdm like %?3%"
62 62 + " and xlbm like %?4% and nbbm like %?5% "
... ... @@ -66,7 +66,7 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
66 66  
67 67  
68 68 @Query(value="select cdl,hd,sh from Dlb s "
69   - + " where to_days(?1)=to_days(s.rq) "
  69 + + " where to_days(s.rq)=to_days(?1) "
70 70 + " and s.ssgsdm like %?2% "
71 71 + " and s.fgsdm like %?3%"
72 72 + " and s.xlbm like %?4% "
... ... @@ -74,7 +74,7 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
74 74 List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
75 75  
76 76 @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb "
77   - + " where to_days(?1)=to_days(rq) "
  77 + + " where rq=?1 "
78 78 + " and ssgsdm like %?2% "
79 79 + " and fgsdm like %?3%"
80 80 + " and xlbm like %?4% "
... ... @@ -93,10 +93,10 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
93 93 " WHERE id = ?1", nativeQuery=true)
94 94 public void dlbUpdate(Integer id,double czcd,double jzcd,double hd, double sh,String shyy,int yhlx);
95 95  
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)
  96 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
97 97 List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm);
98 98  
99   - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true)
  99 + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and xlbm=?2",nativeQuery=true)
100 100 List<Dlb> queryDlbByRqXlbm(String rq, String xlbm);
101 101  
102 102 }
... ...
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,7 +126,7 @@ 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% "
... ... @@ -134,7 +134,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
134 134 List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
135 135  
136 136 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
137   - + " where to_days(?1)=to_days(rq) "
  137 + + " where rq=?1 "
138 138 + " and ssgsdm like %?2% "
139 139 + " and fgsdm like %?3%"
140 140 + " and xlbm like %?4% "
... ... @@ -144,7 +144,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
144 144  
145 145  
146 146 @Query(value="select s from Ylb s "
147   - + " where to_days(?1)=to_days(s.rq) "
  147 + + " where to_days(s.rq)=to_days(?1) "
148 148 + " and s.ssgsdm =?2 "
149 149 + " and s.fgsdm =?3 "
150 150 + " and s.xlbm like %?4% "
... ...
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
... ... @@ -50,4 +50,7 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L
50 50  
51 51 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
52 52 List<CarConfigInfo> findByXlId(Integer xlid);
  53 +
  54 + @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
  55 + List<CarConfigInfo> findByClId(Integer clid);
53 56 }
54 57 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/schedule/GuideboardInfoRepository.java
... ... @@ -43,5 +43,7 @@ public interface GuideboardInfoRepository extends BaseRepository&lt;GuideboardInfo,
43 43  
44 44 @Query(value = "SELECT g FROM GuideboardInfo g where g.xl =?1 and g.lpName = ?2 and g.lpNo = ?3 and lpType =?4 and isCancel = 0")
45 45 List<GuideboardInfo> validateLp(Line xl,String lpName , int lpNo,String lpType);
  46 +
  47 + List<GuideboardInfo> findByXlId(Integer id);
46 48  
47 49 }
... ...
src/main/java/com/bsth/repository/schedule/TTInfoRepository.java
... ... @@ -48,4 +48,6 @@ public interface TTInfoRepository extends BaseRepository&lt;TTInfo, Long&gt; {
48 48 "from LineVersions lv where lv.line.id = ?1 and lv.status = ?2 ")
49 49 List<Map<String, Object>> findLineVersionDescs3(Integer lineId, Integer status);
50 50  
  51 + List<TTInfo> findByXlId(Integer xlId);
  52 +
51 53 }
... ...
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/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>>(){
... ...
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());
... ... @@ -884,7 +886,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
884 886 String px) {
885 887 // TODO Auto-generated method stub
886 888 String sql="SELECT * FROM bsth_c_dlb "
887   - + " where to_days('"+rq+"')=to_days(rq) and ssgsdm like '%"+gsdm+"%' "
  889 + + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' "
888 890 + " and fgsdm like '%"+fgsdm+"%'";
889 891 if(xlbm.equals("")){
890 892 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());
... ...
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/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/CarConfigInfoService.java
... ... @@ -10,7 +10,10 @@ import java.util.List;
10 10 * Created by xu on 16/5/9.
11 11 */
12 12 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
  13 + // 判定车辆是否配置在其他线路上
13 14 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  15 + // 判定车辆是否配置在其他线路上2
  16 + void validate_cars(Integer xlId, Integer clId) throws ScheduleException;
14 17 // 判定车辆是否配置在当前线路中
15 18 void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException;
16 19 // 判定车辆所属公司和当前用户的所属公司
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4   -import com.bsth.service.schedule.rules.ttinfo2.Result;
  4 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
  5 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
5 6  
6 7 import java.util.Date;
7 8  
... ... @@ -26,4 +27,13 @@ public interface SchedulePlanService extends BService&lt;SchedulePlan, Long&gt; {
26 27 * @return
27 28 */
28 29 Result validateTTInfo(Integer xlid, Date from, Date to);
  30 +
  31 + /**
  32 + * 验证规则。
  33 + * @param xlId 线路id
  34 + * @param from 排班计划开始时间
  35 + * @param to 排班计划结束时间
  36 + * @return
  37 + */
  38 + ValidateRuleResult validateRule(Integer xlId, Date from, Date to);
29 39 }
30 40 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
... ... @@ -130,6 +130,18 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
130 130 }
131 131  
132 132 @Override
  133 + public void validate_cars(Integer xlId, Integer clId) throws ScheduleException {
  134 + Map<String, Object> param = new HashMap<>();
  135 + param.put("cl.id_eq", clId);
  136 + List<CarConfigInfo> carConfigInfos = list(param);
  137 + for (CarConfigInfo carConfigInfo : carConfigInfos) {
  138 + if (!carConfigInfo.getXl().getId().equals(xlId)) {
  139 + throw new ScheduleException("车辆不配置在当前线路下,配置在" + carConfigInfo.getXl().getName() + "线路中!");
  140 + }
  141 + }
  142 + }
  143 +
  144 + @Override
133 145 public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
134 146 Map<String, Object> param = new HashMap<>();
135 147 param.put("xl.id_eq", carConfigInfo.getXl().getId());
... ...
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.CarDevice;
3 4 import com.bsth.entity.Cars;
  5 +import com.bsth.entity.schedule.CarConfigInfo;
  6 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  7 +import com.bsth.service.schedule.CarDeviceService;
4 8 import com.bsth.service.schedule.CarsService;
5 9 import com.bsth.service.schedule.exception.ScheduleException;
6 10 import com.bsth.service.schedule.utils.DataToolsFile;
... ... @@ -12,7 +16,9 @@ import org.springframework.transaction.annotation.Transactional;
12 16 import org.springframework.util.CollectionUtils;
13 17  
14 18 import java.io.File;
  19 +import java.util.Date;
15 20 import java.util.HashMap;
  21 +import java.util.List;
16 22 import java.util.Map;
17 23  
18 24 /**
... ... @@ -24,6 +30,48 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars
24 30 @Qualifier(value = "cars_dataTool")
25 31 private DataToolsService dataToolsService;
26 32  
  33 + @Autowired
  34 + @Qualifier(value = "carDeviceServiceImpl_sc")
  35 + private CarDeviceService carDeviceService;
  36 +
  37 + @Autowired
  38 + private CarConfigInfoRepository carConfigInfoRepository;
  39 +
  40 + @Override
  41 + public Cars save(Cars cars) {
  42 + if (cars.getId() != null && cars.getScrapState()) { // 更新车辆信息,报废车辆
  43 + // 1、作废的车辆,修改报废号
  44 + String eCode = cars.getEquipmentCode();
  45 + cars.setEquipmentCode("BF-" + eCode);
  46 + cars.setScrapCode("BF-" + cars.getEquipmentCode());
  47 + // 2、添加一条相关的设备替换记录
  48 + // 查找在哪条线路上
  49 + List<CarConfigInfo> carConfigInfoList = carConfigInfoRepository.findByClId(cars.getId());
  50 + for (CarConfigInfo carConfigInfo : carConfigInfoList) {
  51 + CarDevice carDevice = new CarDevice();
  52 + carDevice.setGsName(cars.getCompany());
  53 + carDevice.setCompany(cars.getBusinessCode());
  54 + carDevice.setBrancheCompany(cars.getBrancheCompanyCode());
  55 + carDevice.setCl(cars.getId());
  56 + carDevice.setClZbh(cars.getInsideCode());
  57 + carDevice.setXl(carConfigInfo.getXl().getId());
  58 + carDevice.setXlName(carConfigInfo.getXl().getName());
  59 + carDevice.setXlBm(carConfigInfo.getXl().getLineCode());
  60 + carDevice.setOldDeviceNo(eCode);
  61 + carDevice.setNewDeviceNo("BF-" + eCode);
  62 + carDevice.setIsCancel(false);
  63 +
  64 + carDevice.setCreateBy(cars.getCreateBy());
  65 + carDevice.setUpdateBy(cars.getUpdateBy());
  66 + carDevice.setCreateDate(new Date());
  67 + carDevice.setUpdateDate(new Date());
  68 + carDeviceService.save(carDevice);
  69 + }
  70 + }
  71 +
  72 + return super.save(cars);
  73 + }
  74 +
27 75 @Override
28 76 public void importData(File file, Map<String, Object> params) throws ScheduleException {
29 77 dataToolsService.importData(file, params);
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.Line;
3 4 import com.bsth.entity.schedule.SchedulePlan;
4 5 import com.bsth.entity.schedule.TTInfo;
5 6 import com.bsth.repository.BusinessRepository;
... ... @@ -7,10 +8,11 @@ import com.bsth.repository.LineRepository;
7 8 import com.bsth.repository.schedule.*;
8 9 import com.bsth.service.schedule.SchedulePlanService;
9 10 import com.bsth.service.schedule.exception.ScheduleException;
10   -import com.bsth.service.schedule.plan.DroolsSchedulePlan;
11   -import com.bsth.service.schedule.rules.ScheduleRuleService;
12   -import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
13   -import com.bsth.service.schedule.rules.ttinfo2.Result;
  11 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
  12 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam;
  13 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
  14 +import com.bsth.service.schedule.impl.plan.DroolsSchedulePlan;
  15 +import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
14 16 import org.joda.time.DateTime;
15 17 import org.kie.api.KieBase;
16 18 import org.kie.api.runtime.KieSession;
... ... @@ -42,6 +44,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
42 44 private KieBase preKBase;
43 45  
44 46 @Autowired
  47 + @Qualifier("KBase3")
  48 + private KieBase validateKBase;
  49 +
  50 + @Autowired
45 51 private ScheduleRule1FlatRepository scheduleRule1FlatRepository;
46 52 @Autowired
47 53 private TTInfoRepository ttInfoRepository;
... ... @@ -52,6 +58,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
52 58 @Autowired
53 59 private CarConfigInfoRepository carConfigInfoRepository;
54 60 @Autowired
  61 + private GuideboardInfoRepository guideboardInfoRepository;
  62 + @Autowired
55 63 private EmployeeConfigInfoRepository employeeConfigInfoRepository;
56 64 @Autowired
57 65 private BusinessRepository businessRepository;
... ... @@ -146,22 +154,25 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
146 154 public Result validateTTInfo(Integer xlid, Date from, Date to) {
147 155 // 构造drools session->载入数据->启动规则->计算->销毁session
148 156 // 创建session,内部配置的是stateful
149   - KieSession session = coreKBase.newKieSession();
  157 + KieSession session = validateKBase.newKieSession();
150 158 // 设置gloable对象,在drl中通过别名使用
151 159 session.setGlobal("log", logger);
152   - session.setGlobal("lineRepository", lineRepository);
153 160 session.setGlobal("tTInfoDetailRepository", ttInfoDetailRepository);
154 161  
155 162 Result rs = new Result(); // 输出gloable对象
156 163 session.setGlobal("rs", rs);
157 164  
158 165 // 载入数据
  166 + Line line = lineRepository.findOne(xlid);
  167 + session.insert(line);
  168 +
159 169 CalcuParam calcuParam = new CalcuParam(
160 170 new DateTime(from), new DateTime(to), xlid);
161 171 session.insert(calcuParam);
162   - List<TTInfo> ttInfos = (List<TTInfo>) ttInfoRepository.findAll();
163   - for (TTInfo ttInfo: ttInfos)
164   - session.insert(ttInfo);
  172 + List<TTInfo> ttInfos = ttInfoRepository.findByXlId(xlid);
  173 + for (TTInfo ttInfo: ttInfos) {
  174 + session.insert(ttInfo);
  175 + }
165 176  
166 177 // 执行rule
167 178 session.fireAllRules();
... ... @@ -171,4 +182,30 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
171 182  
172 183 return rs;
173 184 }
  185 +
  186 + @Override
  187 + public ValidateRuleResult validateRule(Integer xlId, Date from, Date to) {
  188 + KieSession session = validateKBase.newKieSession();
  189 + session.setGlobal("LOG", logger);
  190 + session.setGlobal("ccRepo", carConfigInfoRepository);
  191 + session.setGlobal("lpRepo", guideboardInfoRepository);
  192 + session.setGlobal("ecRepo", employeeConfigInfoRepository);
  193 + session.setGlobal("ruleRepo", scheduleRule1FlatRepository);
  194 +
  195 + ValidateRuleResult result = new ValidateRuleResult();
  196 + session.setGlobal("result", result);
  197 +
  198 + com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam calcuParam =
  199 + new com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam();
  200 + calcuParam.setXlId(xlId);
  201 + calcuParam.setFromDate(new DateTime(from));
  202 + calcuParam.setToDate(new DateTime(to));
  203 + session.insert(calcuParam);
  204 +
  205 + session.fireAllRules();
  206 +
  207 + session.dispose();;
  208 +
  209 + return result;
  210 + }
174 211 }
... ...
src/main/java/com/bsth/service/schedule/plan/DroolsSchedulePlan.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/DroolsSchedulePlan.java
1   -package com.bsth.service.schedule.plan;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.Line;
4 4 import com.bsth.entity.schedule.SchedulePlan;
... ... @@ -8,17 +8,16 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
8 8 import com.bsth.repository.BusinessRepository;
9 9 import com.bsth.repository.LineRepository;
10 10 import com.bsth.repository.schedule.*;
11   -import com.bsth.service.schedule.rules.ScheduleRuleService;
12   -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
13   -import com.bsth.service.schedule.rules.plan.PlanResult;
14   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
15   -import com.bsth.service.schedule.rules.rerun.RerunRule_param;
16   -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
17   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
18   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
19   -import com.bsth.service.schedule.rules.ttinfo.*;
20   -import com.bsth.service.schedule.rules.validate.ValidateParam;
21   -import com.bsth.service.schedule.rules.validate.ValidateResults_output;
  11 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input;
  12 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult;
  13 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  14 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param;
  15 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
  16 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  17 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
  18 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.*;
  19 +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateParam;
  20 +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResults_output;
22 21 import org.apache.commons.lang3.StringUtils;
23 22 import org.joda.time.DateTime;
24 23 import org.kie.api.KieBase;
... ...
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/MyDroolsConfiguration.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import org.kie.api.KieBase;
4 4 import org.kie.api.KieBaseConfiguration;
... ... @@ -56,27 +56,24 @@ public class MyDroolsConfiguration {
56 56 // 3.2、写入drl(写法超多,有点混乱)
57 57 // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
58 58 // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
59   - kfs.write("src/main/resources/functions.drl", kieServices.getResources()
  59 + kfs.write("src/main/resources/kBase1_core_shiftloop.drl", kieServices.getResources()
60 60 .newInputStreamResource(this.getClass().getResourceAsStream(
61   - "/rules/functions.drl"), "UTF-8"));
62   - kfs.write("src/main/resources/shiftloop_fb_2.drl", kieServices.getResources()
  61 + "/rules/kBase1_core_shiftloop.drl"), "UTF-8"));
  62 + kfs.write("src/main/resources/kBase1_core_ttinfo.drl", kieServices.getResources()
63 63 .newInputStreamResource(this.getClass().getResourceAsStream(
64   - "/rules/shiftloop_fb_2.drl"), "UTF-8"));
65   - kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
  64 + "/rules/kBase1_core_ttinfo.drl"), "UTF-8"));
  65 + kfs.write("src/main/resources/kBase1_core_plan.drl", kieServices.getResources()
66 66 .newInputStreamResource(this.getClass().getResourceAsStream(
67   - "/rules/ttinfo.drl"), "UTF-8"));
68   - kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources()
  67 + "/rules/kBase1_core_plan.drl"), "UTF-8"));
  68 + kfs.write("src/main/resources/kBase1_core_rerun.drl", kieServices.getResources()
69 69 .newInputStreamResource(this.getClass().getResourceAsStream(
70   - "/rules/ttinfo2.drl"), "UTF-8"));
71   - kfs.write("src/main/resources/plan.drl", kieServices.getResources()
  70 + "/rules/kBase1_core_rerun.drl"), "UTF-8"));
  71 + kfs.write("src/main/resources/kBase1_core_validate.drl", kieServices.getResources()
72 72 .newInputStreamResource(this.getClass().getResourceAsStream(
73   - "/rules/plan.drl"), "UTF-8"));
74   - kfs.write("src/main/resources/rerun.drl", kieServices.getResources()
  73 + "/rules/kBase1_core_validate.drl"), "UTF-8"));
  74 + kfs.write("src/main/resources/kBase1_core_functions.drl", kieServices.getResources()
75 75 .newInputStreamResource(this.getClass().getResourceAsStream(
76   - "/rules/rerun.drl"), "UTF-8"));
77   - kfs.write("src/main/resources/validplan.drl", kieServices.getResources()
78   - .newInputStreamResource(this.getClass().getResourceAsStream(
79   - "/rules/validplan.drl"), "UTF-8"));
  76 + "/rules/kBase1_core_functions.drl"), "UTF-8"));
80 77 // TODO:还有其他drl....
81 78  
82 79 // 4、创建KieBuilder,使用KieFileSystem构建
... ... @@ -134,9 +131,9 @@ public class MyDroolsConfiguration {
134 131 // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
135 132 // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
136 133  
137   - kfs.write("src/main/resources/ruleWrap.drl", kieServices.getResources()
  134 + kfs.write("src/main/resources/kBase2_wrap_rule.drl", kieServices.getResources()
138 135 .newInputStreamResource(this.getClass().getResourceAsStream(
139   - "/rules/ruleWrap.drl"), "UTF-8"));
  136 + "/rules/kBase2_wrap_rule.drl"), "UTF-8"));
140 137  
141 138 // TODO:还有其他drl....
142 139  
... ... @@ -161,4 +158,52 @@ public class MyDroolsConfiguration {
161 158  
162 159 return kieBase;
163 160 }
  161 +
  162 + /**
  163 + * 验证相关的drl知识库。
  164 + * @return
  165 + */
  166 + @Bean(name = "KBase3")
  167 + public KieBase myKieBase3() {
  168 + KieServices kieServices = KieServices.Factory.get();
  169 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  170 + KieBaseModel kieBaseModel = kieModuleModel.newKieBaseModel("KBase3")
  171 + .setDefault(true)
  172 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  173 + .setEventProcessingMode(EventProcessingOption.STREAM);
  174 + kieBaseModel.newKieSessionModel("KSession1")
  175 + .setDefault(true)
  176 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  177 + .setClockType(ClockTypeOption.get("realtime"));
  178 +
  179 + KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
  180 + kieFileSystem.writeKModuleXML(kieModuleModel.toXML());
  181 +
  182 + kieFileSystem.write(
  183 + "src/main/resources/kBase3_validate_timetable.drl",
  184 + kieServices.getResources().newInputStreamResource(
  185 + this.getClass().getResourceAsStream("/rules/kBase3_validate_timetable.drl"),
  186 + "UTF-8"));
  187 + kieFileSystem.write(
  188 + "src/main/resources/kbase3_validate_rule.drl",
  189 + kieServices.getResources().newInputStreamResource(
  190 + this.getClass().getResourceAsStream("/rules/kBase3_validate_rule.drl"),
  191 + "UTF-8"));
  192 +
  193 + KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
  194 + Results results = kieBuilder.getResults();
  195 + if (results.hasMessages(Message.Level.ERROR)) {
  196 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  197 + }
  198 +
  199 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  200 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  201 +
  202 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  203 + KieBase kieBase = kieContainer.newKieBase("KBase3", kieBaseConfiguration);
  204 +
  205 + return kieBase;
  206 +
  207 + }
  208 +
164 209 }
... ...
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleService.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleService.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
6   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
7 7  
8 8 import java.util.Date;
9 9 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleServiceImpl.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
6   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
7 7 import org.slf4j.Logger;
8 8 import org.slf4j.LoggerFactory;
9 9 import org.springframework.beans.factory.annotation.Autowired;
... ...
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.plan;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
5   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  5 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
6 6  
7 7 /**
8 8 * 排班规则-规则输入参数。
... ...
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanResult.java
1   -package com.bsth.service.schedule.rules.plan;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/readme.txt
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_input.java
1   -package com.bsth.service.schedule.rules.rerun;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
2 2  
3 3 /**
4 4 * Created by xu on 17/4/26.
... ...
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_param.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_param.java
1   -package com.bsth.service.schedule.rules.rerun;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
2 2  
3 3 import java.util.Set;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbFcnoFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbFcnoFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbTimeFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbTimeFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.joda.time.LocalTime;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidsCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidsCountFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import org.joda.time.DateTime;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResult_output.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResults_output.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_Type.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_Type.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 /**
4 4 * 排班规则_输入_输出_类型。
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_input.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
4 4 import com.google.common.base.Splitter;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResult_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResultsFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResults_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/MinRuleQyrqFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/MinRuleQyrqFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  3 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
4 4 import org.joda.time.DateTime;
5 5 import org.kie.api.runtime.rule.AccumulateFunction;
6 6  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResult_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResults_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.google.common.collect.ArrayListMultimap;
4 4 import com.google.common.collect.Multimap;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfo_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfo_input.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.bsth.entity.schedule.TTInfo;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/readme.txt
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidRepeatBcFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidWantLpFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWantLpFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
5 5 import org.kie.api.runtime.rule.AccumulateFunction;
6 6  
7 7 import java.io.*;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidWholeRerunBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWholeRerunBcFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateParam.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import org.joda.time.DateTime;
4 4 import org.joda.time.Period;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResource.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResource.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
5 5  
6 6 import java.util.Date;
7 7 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResults_output.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.Date;
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/CalcuParam.java 0 → 100644
  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 0 → 100644
  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 0 → 100644
  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 0 → 100644
  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/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/CalcuParam.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/ErrorBcCountFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/Result.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.List;
... ... @@ -22,6 +22,8 @@ public class Result {
22 22 private Long ttid;
23 23 /** 时刻表名字 */
24 24 private String ttname;
  25 + /** 线路版本 */
  26 + private Integer lineVersion;
25 27  
26 28 /** 所有班次数 */
27 29 private Long allbc;
... ... @@ -90,5 +92,13 @@ public class Result {
90 92 public void setErrorbc(Long errorbc) {
91 93 this.errorbc = errorbc;
92 94 }
  95 +
  96 + public Integer getLineVersion() {
  97 + return lineVersion;
  98 + }
  99 +
  100 + public void setLineVersion(Integer lineVersion) {
  101 + this.lineVersion = lineVersion;
  102 + }
93 103 }
94 104 }
... ...
src/main/resources/application-prod.properties
... ... @@ -17,15 +17,22 @@ spring.datasource.max-idle=8
17 17 spring.datasource.min-idle=8
18 18 spring.datasource.initial-size=5
19 19  
  20 +spring.datasource.max-wait=10000
  21 +spring.datasource.remove-abandoned=true
  22 +spring.datasource.remove-abandoned-timeout=120
  23 +
20 24 spring.datasource.test-on-borrow=true
21 25 spring.datasource.test-on-connect=true
22 26 spring.datasource.test-on-return=true
23 27 spring.datasource.test-while-idle=true
24 28 spring.datasource.validation-query=select 1
  29 +spring.datasource.time-between-eviction-runs-millis=1800000
25 30  
26 31 ## gps client data
27 32 http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
28 33 ## gateway real data
29 34 http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/
30 35 ## gateway send directive
31   -http.send.directive = http://10.10.200.79:8080/transport_server/message/
32 36 \ No newline at end of file
  37 +http.send.directive = http://10.10.200.79:8080/transport_server/message/
  38 +## maintenance report
  39 +http.report.url = http://116.247.73.122:9098/jgjwsystem_j2ee/
33 40 \ No newline at end of file
... ...
src/main/resources/application.properties
1 1 spring.profiles: dev,prod
2   -spring.profiles.active: dev
  2 +spring.profiles.active: prod
3 3  
4 4 spring.view.suffix=.html
5 5 server.session-timeout=-1
... ...
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>cgsbm_in</name>
14   - <default_value/>
15   - <description>&#x5206;&#x516c;&#x53f8;&#x7f16;&#x7801;</description>
16   - </parameter>
17   - <parameter>
18   - <name>filepath</name>
19   - <default_value/>
20   - <description>excel&#x6587;&#x4ef6;&#x8def;&#x5f84;</description>
21   - </parameter>
22   - </parameters>
23   - <log>
24   -<trans-log-table><connection/>
25   -<schema/>
26   -<table/>
27   -<size_limit_lines/>
28   -<interval/>
29   -<timeout_days/>
30   -<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>
31   -<perf-log-table><connection/>
32   -<schema/>
33   -<table/>
34   -<interval/>
35   -<timeout_days/>
36   -<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>
37   -<channel-log-table><connection/>
38   -<schema/>
39   -<table/>
40   -<timeout_days/>
41   -<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>
42   -<step-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>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>
47   -<metrics-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>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>
52   - </log>
53   - <maxdate>
54   - <connection/>
55   - <table/>
56   - <field/>
57   - <offset>0.0</offset>
58   - <maxdiff>0.0</maxdiff>
59   - </maxdate>
60   - <size_rowset>10000</size_rowset>
61   - <sleep_time_empty>50</sleep_time_empty>
62   - <sleep_time_full>50</sleep_time_full>
63   - <unique_connections>N</unique_connections>
64   - <feedback_shown>Y</feedback_shown>
65   - <feedback_size>50000</feedback_size>
66   - <using_thread_priorities>Y</using_thread_priorities>
67   - <shared_objects_file/>
68   - <capture_step_performance>N</capture_step_performance>
69   - <step_performance_capturing_delay>1000</step_performance_capturing_delay>
70   - <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
71   - <dependencies>
72   - </dependencies>
73   - <partitionschemas>
74   - </partitionschemas>
75   - <slaveservers>
76   - </slaveservers>
77   - <clusterschemas>
78   - </clusterschemas>
79   - <created_user>-</created_user>
80   - <created_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</created_date>
81   - <modified_user>-</modified_user>
82   - <modified_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</modified_date>
83   - <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA&#x3d;</key_for_session_key>
84   - <is_key_private>N</is_key_private>
85   - </info>
86   - <notepads>
87   - </notepads>
88   - <connection>
89   - <name>192.168.168.1_jwgl_dw</name>
90   - <server>192.168.168.1</server>
91   - <type>ORACLE</type>
92   - <access>Native</access>
93   - <database>orcl</database>
94   - <port>1521</port>
95   - <username>jwgl_dw</username>
96   - <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password>
97   - <servername/>
98   - <data_tablespace/>
99   - <index_tablespace/>
100   - <attributes>
101   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
102   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
103   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
104   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
105   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
106   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
107   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
108   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
109   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
110   - </attributes>
111   - </connection>
112   - <connection>
113   - <name>bus_control_variable</name>
114   - <server>&#x24;&#x7b;v_db_ip&#x7d;</server>
115   - <type>MYSQL</type>
116   - <access>Native</access>
117   - <database>&#x24;&#x7b;v_db_dname&#x7d;</database>
118   - <port>3306</port>
119   - <username>&#x24;&#x7b;v_db_uname&#x7d;</username>
120   - <password>&#x24;&#x7b;v_db_pwd&#x7d;</password>
121   - <servername/>
122   - <data_tablespace/>
123   - <index_tablespace/>
124   - <attributes>
125   - <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
126   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
127   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
128   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
129   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
130   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
131   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
132   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
133   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
134   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
135   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
136   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
137   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
138   - </attributes>
139   - </connection>
140   - <connection>
141   - <name>bus_control_&#x516c;&#x53f8;_201</name>
142   - <server>localhost</server>
143   - <type>MYSQL</type>
144   - <access>Native</access>
145   - <database>control</database>
146   - <port>3306</port>
147   - <username>root</username>
148   - <password>Encrypted </password>
149   - <servername/>
150   - <data_tablespace/>
151   - <index_tablespace/>
152   - <attributes>
153   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
154   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
155   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
156   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
157   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
158   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
159   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
160   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
161   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
162   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
163   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
164   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
165   - </attributes>
166   - </connection>
167   - <connection>
168   - <name>bus_control_&#x672c;&#x673a;</name>
169   - <server>localhost</server>
170   - <type>MYSQL</type>
171   - <access>Native</access>
172   - <database>control</database>
173   - <port>3306</port>
174   - <username>root</username>
175   - <password>Encrypted </password>
176   - <servername/>
177   - <data_tablespace/>
178   - <index_tablespace/>
179   - <attributes>
180   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
181   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
182   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
183   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
184   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
185   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
186   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
187   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
188   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
189   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
190   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
191   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
192   - </attributes>
193   - </connection>
194   - <connection>
195   - <name>xlab_mysql_youle</name>
196   - <server>101.231.124.8</server>
197   - <type>MYSQL</type>
198   - <access>Native</access>
199   - <database>xlab_youle</database>
200   - <port>45687</port>
201   - <username>xlab-youle</username>
202   - <password>Encrypted 2be98afc86aa78a88aa1be369d187a3df</password>
203   - <servername/>
204   - <data_tablespace/>
205   - <index_tablespace/>
206   - <attributes>
207   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
208   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
209   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
210   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
211   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
212   - <attribute><code>PORT_NUMBER</code><attribute>45687</attribute></attribute>
213   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
214   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
215   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
216   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
217   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
218   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
219   - </attributes>
220   - </connection>
221   - <connection>
222   - <name>xlab_mysql_youle&#xff08;&#x672c;&#x673a;&#xff09;</name>
223   - <server>localhost</server>
224   - <type>MYSQL</type>
225   - <access>Native</access>
226   - <database>xlab_youle</database>
227   - <port>3306</port>
228   - <username>root</username>
229   - <password>Encrypted </password>
230   - <servername/>
231   - <data_tablespace/>
232   - <index_tablespace/>
233   - <attributes>
234   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
235   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
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>3306</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>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
243   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
244   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
245   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
246   - </attributes>
247   - </connection>
248   - <connection>
249   - <name>xlab_youle</name>
250   - <server/>
251   - <type>MYSQL</type>
252   - <access>JNDI</access>
253   - <database>xlab_youle</database>
254   - <port>1521</port>
255   - <username/>
256   - <password>Encrypted </password>
257   - <servername/>
258   - <data_tablespace/>
259   - <index_tablespace/>
260   - <attributes>
261   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
262   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
263   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
264   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
265   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
266   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
267   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
268   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
269   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
270   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
271   - </attributes>
272   - </connection>
273   - <order>
274   - <hop> <from>&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
275   - <hop> <from>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</to><enabled>Y</enabled> </hop>
276   - <hop> <from>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</from><to>&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
277   - <hop> <from>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</from><to>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</to><enabled>Y</enabled> </hop>
278   - <hop> <from>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</from><to>&#x662f;&#x5426;&#x7535;&#x8f66;</to><enabled>Y</enabled> </hop>
279   - <hop> <from>&#x662f;&#x5426;&#x7535;&#x8f66;</from><to>Excel&#x8f93;&#x51fa;</to><enabled>Y</enabled> </hop>
280   - </order>
281   - <step>
282   - <name>Excel&#x8f93;&#x51fa;</name>
283   - <type>ExcelOutput</type>
284   - <description/>
285   - <distribute>Y</distribute>
286   - <custom_distribution/>
287   - <copies>1</copies>
288   - <partitioning>
289   - <method>none</method>
290   - <schema_name/>
291   - </partitioning>
292   - <header>Y</header>
293   - <footer>N</footer>
294   - <encoding/>
295   - <append>N</append>
296   - <add_to_result_filenames>Y</add_to_result_filenames>
297   - <file>
298   - <name>&#x24;&#x7b;filepath&#x7d;</name>
299   - <extention>xls</extention>
300   - <do_not_open_newfile_init>N</do_not_open_newfile_init>
301   - <create_parent_folder>N</create_parent_folder>
302   - <split>N</split>
303   - <add_date>N</add_date>
304   - <add_time>N</add_time>
305   - <SpecifyFormat>N</SpecifyFormat>
306   - <date_time_format>yyyyMMddHHmmss</date_time_format>
307   - <sheetname>&#x5de5;&#x4f5c;&#x8868;1</sheetname>
308   - <autosizecolums>N</autosizecolums>
309   - <nullisblank>N</nullisblank>
310   - <protect_sheet>N</protect_sheet>
311   - <password>Encrypted </password>
312   - <splitevery>0</splitevery>
313   - <usetempfiles>N</usetempfiles>
314   - <tempdirectory/>
315   - </file>
316   - <template>
317   - <enabled>N</enabled>
318   - <append>N</append>
319   - <filename>template.xls</filename>
320   - </template>
321   - <fields>
322   - <field>
323   - <name>&#x8f66;&#x724c;&#x53f7;</name>
324   - <type>String</type>
325   - <format/>
326   - </field>
327   - <field>
328   - <name>&#x5185;&#x90e8;&#x7f16;&#x7801;</name>
329   - <type>String</type>
330   - <format/>
331   - </field>
332   - <field>
333   - <name>&#x6240;&#x5c5e;&#x516c;&#x53f8;</name>
334   - <type>String</type>
335   - <format/>
336   - </field>
337   - <field>
338   - <name>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</name>
339   - <type>String</type>
340   - <format/>
341   - </field>
342   - <field>
343   - <name>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</name>
344   - <type>String</type>
345   - <format/>
346   - </field>
347   - <field>
348   - <name>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</name>
349   - <type>String</type>
350   - <format/>
351   - </field>
352   - <field>
353   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
354   - <type>String</type>
355   - <format/>
356   - </field>
357   - </fields>
358   - <custom>
359   - <header_font_name>arial</header_font_name>
360   - <header_font_size>10</header_font_size>
361   - <header_font_bold>N</header_font_bold>
362   - <header_font_italic>N</header_font_italic>
363   - <header_font_underline>no</header_font_underline>
364   - <header_font_orientation>horizontal</header_font_orientation>
365   - <header_font_color>black</header_font_color>
366   - <header_background_color>none</header_background_color>
367   - <header_row_height>255</header_row_height>
368   - <header_alignment>left</header_alignment>
369   - <header_image/>
370   - <row_font_name>arial</row_font_name>
371   - <row_font_size>10</row_font_size>
372   - <row_font_color>black</row_font_color>
373   - <row_background_color>none</row_background_color>
374   - </custom>
375   - <cluster_schema/>
376   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
377   - <xloc>498</xloc>
378   - <yloc>348</yloc>
379   - <draw>Y</draw>
380   - </GUI>
381   - </step>
382   -
383   - <step>
384   - <name>&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
385   - <type>DBLookup</type>
386   - <description/>
387   - <distribute>Y</distribute>
388   - <custom_distribution/>
389   - <copies>1</copies>
390   - <partitioning>
391   - <method>none</method>
392   - <schema_name/>
393   - </partitioning>
394   - <connection>bus_control_variable</connection>
395   - <cache>N</cache>
396   - <cache_load_all>N</cache_load_all>
397   - <cache_size>0</cache_size>
398   - <lookup>
399   - <schema/>
400   - <table>bsth_c_business</table>
401   - <orderby/>
402   - <fail_on_multiple>N</fail_on_multiple>
403   - <eat_row_on_failure>N</eat_row_on_failure>
404   - <key>
405   - <name>up_code</name>
406   - <field>up_code</field>
407   - <condition>&#x3d;</condition>
408   - <name2/>
409   - </key>
410   - <key>
411   - <name>business_code</name>
412   - <field>business_code</field>
413   - <condition>&#x3d;</condition>
414   - <name2/>
415   - </key>
416   - <value>
417   - <name>business_name</name>
418   - <rename>gs</rename>
419   - <default/>
420   - <type>String</type>
421   - </value>
422   - </lookup>
423   - <cluster_schema/>
424   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
425   - <xloc>364</xloc>
426   - <yloc>60</yloc>
427   - <draw>Y</draw>
428   - </GUI>
429   - </step>
430   -
431   - <step>
432   - <name>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
433   - <type>DBLookup</type>
434   - <description/>
435   - <distribute>Y</distribute>
436   - <custom_distribution/>
437   - <copies>1</copies>
438   - <partitioning>
439   - <method>none</method>
440   - <schema_name/>
441   - </partitioning>
442   - <connection>bus_control_variable</connection>
443   - <cache>N</cache>
444   - <cache_load_all>N</cache_load_all>
445   - <cache_size>0</cache_size>
446   - <lookup>
447   - <schema/>
448   - <table>bsth_c_business</table>
449   - <orderby/>
450   - <fail_on_multiple>N</fail_on_multiple>
451   - <eat_row_on_failure>N</eat_row_on_failure>
452   - <key>
453   - <name>business_code</name>
454   - <field>up_code</field>
455   - <condition>&#x3d;</condition>
456   - <name2/>
457   - </key>
458   - <key>
459   - <name>branche_company_code</name>
460   - <field>business_code</field>
461   - <condition>&#x3d;</condition>
462   - <name2/>
463   - </key>
464   - <value>
465   - <name>business_name</name>
466   - <rename>fgs</rename>
467   - <default/>
468   - <type>String</type>
469   - </value>
470   - </lookup>
471   - <cluster_schema/>
472   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
473   - <xloc>491</xloc>
474   - <yloc>60</yloc>
475   - <draw>Y</draw>
476   - </GUI>
477   - </step>
478   -
479   - <step>
480   - <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
481   - <type>SelectValues</type>
482   - <description/>
483   - <distribute>Y</distribute>
484   - <custom_distribution/>
485   - <copies>1</copies>
486   - <partitioning>
487   - <method>none</method>
488   - <schema_name/>
489   - </partitioning>
490   - <fields> <field> <name>car_plate</name>
491   - <rename>&#x8f66;&#x724c;&#x53f7;</rename>
492   - <length>-2</length>
493   - <precision>-2</precision>
494   - </field> <field> <name>inside_code</name>
495   - <rename>&#x5185;&#x90e8;&#x7f16;&#x7801;</rename>
496   - <length>-2</length>
497   - <precision>-2</precision>
498   - </field> <field> <name>gs</name>
499   - <rename>&#x6240;&#x5c5e;&#x516c;&#x53f8;</rename>
500   - <length>-2</length>
501   - <precision>-2</precision>
502   - </field> <field> <name>fgs</name>
503   - <rename>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</rename>
504   - <length>-2</length>
505   - <precision>-2</precision>
506   - </field> <field> <name>supplier_name</name>
507   - <rename>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</rename>
508   - <length>-2</length>
509   - <precision>-2</precision>
510   - </field> <field> <name>equipment_code</name>
511   - <rename>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</rename>
512   - <length>-2</length>
513   - <precision>-2</precision>
514   - </field> <field> <name>sfdc</name>
515   - <rename>sfdc_cal</rename>
516   - <length>-2</length>
517   - <precision>-2</precision>
518   - </field> <select_unspecified>N</select_unspecified>
519   - </fields> <cluster_schema/>
520   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
521   - <xloc>495</xloc>
522   - <yloc>173</yloc>
523   - <draw>Y</draw>
524   - </GUI>
525   - </step>
526   -
527   - <step>
528   - <name>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</name>
529   - <type>ScriptValueMod</type>
530   - <description/>
531   - <distribute>Y</distribute>
532   - <custom_distribution/>
533   - <copies>1</copies>
534   - <partitioning>
535   - <method>none</method>
536   - <schema_name/>
537   - </partitioning>
538   - <compatible>N</compatible>
539   - <optimizationLevel>9</optimizationLevel>
540   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
541   - <jsScript_name>Script 1</jsScript_name>
542   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var up_code &#x3d; &#x27;88&#x27;&#x3b;</jsScript_script>
543   - </jsScript> </jsScripts> <fields> <field> <name>up_code</name>
544   - <rename>up_code</rename>
545   - <type>String</type>
546   - <length>-1</length>
547   - <precision>-1</precision>
548   - <replace>N</replace>
549   - </field> </fields> <cluster_schema/>
550   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
551   - <xloc>227</xloc>
552   - <yloc>59</yloc>
553   - <draw>Y</draw>
554   - </GUI>
555   - </step>
556   -
557   - <step>
558   - <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</name>
559   - <type>TableInput</type>
560   - <description/>
561   - <distribute>Y</distribute>
562   - <custom_distribution/>
563   - <copies>1</copies>
564   - <partitioning>
565   - <method>none</method>
566   - <schema_name/>
567   - </partitioning>
568   - <connection>bus_control_variable</connection>
569   - <sql>SELECT &#x2a; FROM bsth_c_cars&#xa;&#xa;</sql>
570   - <limit>0</limit>
571   - <lookup/>
572   - <execute_each_row>N</execute_each_row>
573   - <variables_active>Y</variables_active>
574   - <lazy_conversion_active>N</lazy_conversion_active>
575   - <cluster_schema/>
576   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
577   - <xloc>88</xloc>
578   - <yloc>59</yloc>
579   - <draw>Y</draw>
580   - </GUI>
581   - </step>
582   -
583   - <step>
584   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
585   - <type>ScriptValueMod</type>
586   - <description/>
587   - <distribute>Y</distribute>
588   - <custom_distribution/>
589   - <copies>1</copies>
590   - <partitioning>
591   - <method>none</method>
592   - <schema_name/>
593   - </partitioning>
594   - <compatible>N</compatible>
595   - <optimizationLevel>9</optimizationLevel>
596   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
597   - <jsScript_name>Script 1</jsScript_name>
598   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#xa;if&#x28;sfdc_cal&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x662f;&#x22;&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
599   - </jsScript> </jsScripts> <fields> <field> <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
600   - <rename>&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
601   - <type>String</type>
602   - <length>-1</length>
603   - <precision>-1</precision>
604   - <replace>N</replace>
605   - </field> </fields> <cluster_schema/>
606   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
607   - <xloc>695</xloc>
608   - <yloc>173</yloc>
609   - <draw>Y</draw>
610   - </GUI>
611   - </step>
612   -
613   - <step_error_handling>
614   - </step_error_handling>
615   - <slave-step-copy-partition-distribution>
616   -</slave-step-copy-partition-distribution>
617   - <slave_transformation>N</slave_transformation>
618   -
619   -</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/functions.drl deleted 100644 → 0
1   -package com.bsth.service.schedule;
2   -
3   -import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;
4   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
5   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
6   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbFcnoFunction gidfbfcno;
7   -import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
8   -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq;
9   -import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb;
10   -import accumulate com.bsth.service.schedule.rules.validate.ValidWholeRerunBcFunction vwrb;
11   -import accumulate com.bsth.service.schedule.rules.validate.ValidWantLpFunction vwlp;
src/main/resources/rules/kBase1_core_functions.drl 0 → 100644
  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/plan.drl renamed to src/main/resources/rules/kBase1_core_plan.drl
1   -package com.bsth.service.schedule.plan;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
7   -import com.bsth.service.schedule.rules.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.rules.shiftloop.ScheduleResult_output;
16   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
17   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
18   -import com.bsth.service.schedule.rules.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.rules.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/rerun.drl renamed to src/main/resources/rules/kBase1_core_rerun.drl
1   -package com.bsth.service.schedule.rerun;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
7   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
8   -
9   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
10   -import com.bsth.service.schedule.rules.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/shiftloop_fb_2.drl renamed to src/main/resources/rules/kBase1_core_shiftloop.drl
1   -package com.bsth.service.schedule.shiftloop;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
7   -
8   -import com.bsth.service.schedule.utils.Md5Util;
9   -
10   -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
11   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
12   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
13   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
14   -import com.bsth.service.schedule.rules.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.rules.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/ttinfo.drl renamed to src/main/resources/rules/kBase1_core_ttinfo.drl
1   -package com.bsth.service.schedule.ttinfo;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
7   -import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
8   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
9   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
10   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
11   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output;
12   -
13   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
14   -
15   -import com.bsth.repository.schedule.TTInfoDetailRepository;
16   -
17   -import com.bsth.entity.schedule.TTInfo;
18   -import com.bsth.entity.schedule.TTInfoDetail;
19   -
20   -import org.slf4j.Logger
21   -
22   -// 全局日志
23   -global Logger log;
24   -// repostory
25   -global TTInfoDetailRepository tTInfoDetailRepository;
26   -// return输出
27   -global TTInfoResults_output results
28   -global LpInfoResults_output lpInfoResults_output
29   -
30   -function Long ttidParams(List ttinfolist) {
31   - // 获取第一张时刻表id
32   - TTInfo_input ttInfo_input = (TTInfo_input) ttinfolist.get(0);
33   - return Long.parseLong(ttInfo_input.getTtInfoId());
34   -}
35   -
36   -/*
37   - TODO:规则说明,以后待说明
38   -*/
39   -
40   -//----------------- pre 预处理 param对象 -----------------------//
41   -
42   -rule "pre_calcu_TTInfoCalcuParam_input"
43   - no-loop
44   - salience 1000
45   - when
46   - $ttp: TTInfoCalcuParam_input($xlId : xlId)
47   - $minqyrq: DateTime() from accumulate ($sri: ScheduleRule_input(xlId == $xlId), minruleqyrq($sri))
48   - then
49   - $ttp.setFromDate($minqyrq);
50   - update($ttp);
51   -end
52   -
53   -//----------------- 第一阶段、计算规则准备数据(天数)----------------//
54   -
55   -declare Calcu_days_result
56   - calcu_day : Integer // 该计算第几天
57   - calcu_weekday : Integer // 星期几(1到7)
58   - calcu_date : DateTime // 该计算的具体日期
59   - calcu_days : Integer // 总共需要计算的天数
60   - calcu_start_date : DateTime // 开始计算日期
61   - calcu_end_date : DateTime // 结束计算日期
62   - xlId : String // 线路Id
63   -end
64   -
65   -rule "calcu_days"
66   - when
67   - TTInfoCalcuParam_input(
68   - $fromDate : fromDate,
69   - $toDate : toDate,
70   - $xlId : xlId,
71   - $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate))
72   - then
73   - // 构造Calcu_days_result对象,进行下一阶段计算
74   - Calcu_days_result cdr = new Calcu_days_result();
75   - Period p = new Period($fromDate, $toDate, PeriodType.days());
76   -
77   - cdr.setCalcu_day(1);
78   - cdr.setCalcu_date($fromDate);
79   - cdr.setCalcu_days(p.getDays() + 1);
80   - cdr.setCalcu_weekday($fromDate.getDayOfWeek());
81   - cdr.setCalcu_start_date($fromDate);
82   - cdr.setCalcu_end_date(($toDate));
83   - cdr.setXlId($xlId);
84   -
85   -// log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1);
86   -
87   - insert(cdr); // 插入fact数据,进入下一个阶段
88   -end
89   -
90   -//----------------- 第二阶段、判定时刻表是否启用 ----------------//
91   -
92   -declare Calcu_ttinfo_enable_result
93   - xlId : String // 线路id
94   - ttInfo_input_list : ArrayList // 可用时刻表列表
95   - calcu_date : DateTime // 计算日期
96   -end
97   -
98   -rule "calcu_ttinfo_enable"
99   - salience 900
100   - when
101   - $calcu_days_result : Calcu_days_result($calcu_date : calcu_date, calcu_day <= calcu_days, $xlId : xlId)
102   - $ttInfo_input_list : ArrayList(size >= 1) from collect (TTInfo_input(xlId == $xlId, isEnable == true))
103   - then
104   - // 构造Calcu_ttinfo_enable_result对象,进行下一步计算
105   - Calcu_ttinfo_enable_result cter = new Calcu_ttinfo_enable_result();
106   - cter.setXlId($xlId);
107   - cter.setTtInfo_input_list($ttInfo_input_list);
108   - cter.setCalcu_date($calcu_date);
109   -
110   -// log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size());
111   -
112   - insert (cter);
113   -
114   -end
115   -
116   -//----------------- 第三阶段、时刻表的日期匹配 -------------------//
117   -
118   -rule "calcu_ttinfo_special_day" // 特殊日期匹配
119   - salience 800
120   - when
121   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
122   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day)
123   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list)
124   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
125   - then
126   - // 更新Calcu_days_result对象
127   - int new_calcu_day = $calcu_day + 1;
128   - $calcu_days_result.setCalcu_day(new_calcu_day);
129   - DateTime new_calcu_date = $calcu_date.plusDays(1);
130   - $calcu_days_result.setCalcu_date(new_calcu_date);
131   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
132   -
133   -// log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date);
134   -
135   - // $ttinfolist按时间倒排序,result输出
136   - Collections.sort($ttinfolist);
137   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
138   -
139   - // lp输出
140   - for (int i = 0; i < $lpInfoResults.size(); i++) {
141   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
142   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
143   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
144   - }
145   -
146   - update($calcu_days_result);
147   -end
148   -
149   -rule "calcu_ttinfo_normal_day" // 平日匹配
150   - salience 700
151   - when
152   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
153   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
154   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list)
155   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
156   - then
157   - // 更新Calcu_days_result对象
158   - int new_calcu_day = $calcu_day + 1;
159   - $calcu_days_result.setCalcu_day(new_calcu_day);
160   - DateTime new_calcu_date = $calcu_date.plusDays(1);
161   - $calcu_days_result.setCalcu_date(new_calcu_date);
162   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
163   -
164   -// log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size());
165   -
166   - // $ttinfolist按时间倒排序,result输出
167   - Collections.sort($ttinfolist);
168   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
169   -
170   - // lp输出
171   - for (int i = 0; i < $lpInfoResults.size(); i++) {
172   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
173   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
174   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
175   - }
176   -
177   - update($calcu_days_result);
178   -end
179   -
180   -rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配
181   - salience 500
182   - when
183   - $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
184   - $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
185   - $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list)
186   - $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(ttidParams($ttinfolist)), lpinforesult($ttd))
187   - then
188   - // 更新Calcu_days_result对象
189   - int new_calcu_day = $calcu_day + 1;
190   - $calcu_days_result.setCalcu_day(new_calcu_day);
191   - DateTime new_calcu_date = $calcu_date.plusDays(1);
192   - $calcu_days_result.setCalcu_date(new_calcu_date);
193   - $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
194   -
195   -// log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
196   -
197   - // $ttinfolist按时间倒排序,result输出
198   - Collections.sort($ttinfolist);
199   - results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
200   -
201   - // lp输出
202   - for (int i = 0; i < $lpInfoResults.size(); i++) {
203   - LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
204   - lpInfoResult_output.setDateTime($calcu_date); // 设定时间
205   - lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
206   - }
207   -
208   - update($calcu_days_result);
209   -
  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 +
210 219 end
211 220 \ No newline at end of file
... ...
src/main/resources/rules/validplan.drl renamed to src/main/resources/rules/kBase1_core_validate.drl
1   -package com.bsth.service.schedule.rules.validate;
2   -
3   -import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
5   -import com.bsth.service.schedule.rules.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/ruleWrap.drl renamed to src/main/resources/rules/kBase2_wrap_rule.drl
1   -package com.bsth.service.schedule.rulewrap;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -import org.slf4j.Logger;
6   -
7   -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
8   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
9   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
10   -
11   -import com.bsth.repository.schedule.RerunRuleRepository;
12   -import com.bsth.repository.schedule.ScheduleRule1FlatRepository;
13   -
14   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
15   -import com.bsth.service.schedule.rules.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 0 → 100644
  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/ttinfo2.drl renamed to src/main/resources/rules/kBase3_validate_timetable.drl
1   -package com.bsth.service.schedule.ttinfo2;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -import org.apache.commons.lang3.StringUtils;
6   -
7   -import com.bsth.service.schedule.rules.ttinfo2.Result;
8   -import com.bsth.service.schedule.rules.ttinfo2.Result.StatInfo;
9   -import com.bsth.service.schedule.rules.ttinfo2.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.LineRepository;
16   -import com.bsth.repository.schedule.TTInfoDetailRepository;
17   -
18   -import org.slf4j.Logger
19   -import org.joda.time.format.DateTimeFormat
20   -import java.lang.String
21   -import java.lang.Object;
22   -
23   -
24   -// 全局日志类(一般使用调用此规则的service类)
25   -global Logger log;
26   -global LineRepository lineRepository;
27   -global TTInfoDetailRepository tTInfoDetailRepository;
28   -
29   -// 输出
30   -global Result rs;
31   -
32   -/*
33   - 规则说明:
34   - 1、找出指定线路,指定时间范围的时刻表
35   - 2、统计这些时刻表班次数据的情况
36   -*/
37   -
38   -//-------------- 第一阶段、计算规则迭代数据(天数) ------------//
39   -declare Calcu_iter_days_result
40   - xlId: Integer // 线路Id
41   - xlName: String // 线路名字
42   -
43   - // 迭代数据
44   - calcu_day: Integer // 准备计算第几天
45   - calcu_weekday: Integer // 准备计算星期几(1到7)
46   - calcu_date: DateTime // 准备计算的具体日期
47   -
48   - // 范围数据
49   - calcu_days: Integer // 总共需要计算的天数
50   - calcu_start_date: DateTime // 开始计算日期
51   - calcu_end_date: DateTime // 结束计算日期
52   -
53   - // 时刻表映射数据
54   - ttinfomap: Map // 指定时间段内,用的时刻表id映射 Map<Long, Long>
55   -end
56   -
57   -rule "calcu_iter_days"
58   - salience 1900
59   - when
60   - CalcuParam(
61   - $xlId: xlId,
62   - $fromDate: fromDate,
63   - $toDate: toDate,
64   - $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate)
65   - )
66   - then
67   - // 构造Calcu_iter_days_result对象,进行下一步计算
68   - Calcu_iter_days_result cidr = new Calcu_iter_days_result();
69   - Period p = new Period($fromDate, $toDate, PeriodType.days());
70   -
71   - Line line = (Line) lineRepository.findOne($xlId);
72   -
73   - cidr.setXlId($xlId);
74   - cidr.setXlName(line.getName());
75   -
76   - cidr.setCalcu_day(new Integer(1));
77   - cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek()));
78   - cidr.setCalcu_date($fromDate);
79   -
80   - cidr.setCalcu_days(Integer.valueOf(p.getDays() + 1));
81   - cidr.setCalcu_start_date($fromDate);
82   - cidr.setCalcu_end_date($toDate);
83   -
84   - cidr.setTtinfomap(new HashMap());
85   -
86   - log.info(
87   - "线路={}-id={},开始时间={},结束时间={},总共计算的天数={},将从开始时间迭代",
88   - cidr.getXlName(),
89   - cidr.getXlId(),
90   - cidr.getCalcu_start_date(),
91   - cidr.getCalcu_end_date(),
92   - cidr.getCalcu_days()
93   - );
94   -
95   - insert(cidr);
96   -end
97   -
98   -//-------------- 第二阶段、包装时刻表实体类到内部对象 ------------//
99   -
100   -declare TTInfo_wrap
101   - id: Long // 时刻表id
102   - name: String // 时刻表名字
103   - weekdays: List // 周一到周日是否启用 List<Boolean>
104   - specialDays: List // 特殊节假日 List<DateTime>
105   - updateDate: DateTime // 最新修改时间
106   -end
107   -
108   -rule "TTInfo_wrap_result"
109   - salience 900
110   - when
111   - CalcuParam($xlId: xlId)
112   - $ttinfo: TTInfo(
113   - xl.id == $xlId,
114   - isEnableDisTemplate == true,
115   - isCancel == false
116   - )
117   - then
118   - TTInfo_wrap ttInfo_wrap = new TTInfo_wrap();
119   - ttInfo_wrap.setId($ttinfo.getId());
120   - ttInfo_wrap.setName($ttinfo.getName());
121   - ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate()));
122   - ttInfo_wrap.setWeekdays(new ArrayList());
123   - ttInfo_wrap.setSpecialDays(new ArrayList());
124   -
125   - String[] days = $ttinfo.getRule_days().split(",");
126   - for (int i = 0; i < 7; i++) {
127   - if ("1".equals(days[i])) {
128   - ttInfo_wrap.getWeekdays().add(true);
129   - } else {
130   - ttInfo_wrap.getWeekdays().add(false);
131   - }
132   - }
133   -
134   - if (StringUtils.isNotEmpty($ttinfo.getSpecial_days())) {
135   - String[] sdays = $ttinfo.getSpecial_days().split(",");
136   - for (int i = 0; i < sdays.length; i++) {
137   - ttInfo_wrap.getSpecialDays().add(
138   - DateTimeFormat.forPattern(
139   - "yyyy-MM-dd").parseDateTime(sdays[i]));
140   - }
141   - }
142   -
143   - log.info("时刻表={},id={},常规日期={},特殊日期={}",
144   - ttInfo_wrap.getName(),
145   - ttInfo_wrap.getId(),
146   - ttInfo_wrap.getWeekdays(),
147   - ttInfo_wrap.getSpecialDays());
148   -
149   - insert(ttInfo_wrap);
150   -
151   -end
152   -
153   -//-------------- 第三阶段、时刻表的日期匹配 ------------//
154   -
155   -declare TTInfoDetails_wrap
156   - ttInfoId: Long // 时刻表id
157   - bcInfoList: List // 班次信息列表 List<TTInfoDetail>
158   -end
159   -
160   -rule "Calcu_iter_days_special_day" // 特殊日期匹配
161   - salience 800
162   - when
163   - $cid : Calcu_iter_days_result(
164   - $calcu_date: calcu_date,
165   - $calcu_day: calcu_day,
166   - calcu_day <= calcu_days
167   - )
168   - TTInfo_wrap(
169   - $tid: id,
170   - $tname: name,
171   - specialDays contains $calcu_date
172   - )
173   - then
174   - // 更新迭代对象
175   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
176   - $cid.setCalcu_day(new_calcu_day);
177   - DateTime new_calcu_date = $calcu_date.plusDays(1);
178   - $cid.setCalcu_date(new_calcu_date);
179   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
180   -
181   - log.info("启用特殊日期时刻表:" +
182   - "时刻表id={} 特殊日期={}",
183   - $tid, $calcu_date);
184   -
185   - // 判定使用的时刻表
186   - if (!$cid.getTtinfomap().containsKey($tid)) {
187   - $cid.getTtinfomap().put($tid, $tid);
188   - StatInfo statInfo = new StatInfo();
189   - statInfo.setTtid($tid);
190   - statInfo.setTtname($tname);
191   - insert(statInfo);
192   -
193   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
194   - ttInfoDetails_wrap.setTtInfoId($tid);
195   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
196   - insert(ttInfoDetails_wrap);
197   - }
198   - update($cid);
199   -
200   -end
201   -
202   -rule "Calcu_iter_days_normal_day" // 平日匹配
203   - salience 700
204   - when
205   - $cid : Calcu_iter_days_result(
206   - $calcu_date: calcu_date,
207   - $calcu_weekday: calcu_weekday,
208   - $calcu_day: calcu_day,
209   - calcu_day <= calcu_days
210   - )
211   - TTInfo_wrap(
212   - $tid: id,
213   - $tname: name,
214   - specialDays not contains $calcu_date,
215   - weekdays[$calcu_weekday - 1] == Boolean.TRUE
216   - )
217   - then
218   - // 更新迭代对象
219   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
220   - $cid.setCalcu_day(new_calcu_day);
221   - DateTime new_calcu_date = $calcu_date.plusDays(1);
222   - $cid.setCalcu_date(new_calcu_date);
223   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
224   -
225   -
226   - log.info("启用常规日期时刻表:" +
227   - "时刻表id={} 常规日期={} 星期几={}",
228   - $tid, $calcu_date, $calcu_weekday);
229   -
230   - // 判定使用的时刻表
231   - if (!$cid.getTtinfomap().containsKey($tid)) {
232   - $cid.getTtinfomap().put($tid, $tid);
233   - StatInfo statInfo = new StatInfo();
234   - statInfo.setTtid($tid);
235   - statInfo.setTtname($tname);
236   - insert(statInfo);
237   -
238   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
239   - ttInfoDetails_wrap.setTtInfoId($tid);
240   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
241   - insert(ttInfoDetails_wrap);
242   - }
243   - update($cid);
244   -
245   -end
246   -
247   -rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配
248   - salience 500
249   - when
250   - $cid : Calcu_iter_days_result(
251   - $calcu_date: calcu_date,
252   - $calcu_weekday: calcu_weekday,
253   - $calcu_day: calcu_day,
254   - calcu_day <= calcu_days
255   - )
256   - TTInfo_wrap(
257   - $tid: id,
258   - $tname: name,
259   - specialDays not contains $calcu_date,
260   - weekdays[$calcu_weekday - 1] == false
261   - )
262   - then
263   - // 更新迭代对象
264   - Integer new_calcu_day = Integer.valueOf($calcu_day + 1);
265   - $cid.setCalcu_day(new_calcu_day);
266   - DateTime new_calcu_date = $calcu_date.plusDays(1);
267   - $cid.setCalcu_date(new_calcu_date);
268   - $cid.setCalcu_weekday(Integer.valueOf(new_calcu_date.getDayOfWeek()));
269   -
270   - log.info("启用默认日期时刻表:" +
271   - "时刻表id={} 常规日期={} 星期几={}",
272   - $tid, $calcu_date, $calcu_weekday);
273   -
274   - // 判定使用的时刻表
275   - if (!$cid.getTtinfomap().containsKey($tid)) {
276   - $cid.getTtinfomap().put($tid, $tid);
277   - StatInfo statInfo = new StatInfo();
278   - statInfo.setTtid($tid);
279   - statInfo.setTtname($tname);
280   - insert(statInfo);
281   -
282   - TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
283   - ttInfoDetails_wrap.setTtInfoId($tid);
284   - Map<String, Object> param = new HashMap<String, Object>();
285   - ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
286   - insert(ttInfoDetails_wrap);
287   - }
288   - update($cid);
289   -
290   -end
291   -
292   -//-------------- 第四阶段、时刻表明细统计值 ------------//
293   -
294   -rule "statinfo_result" // 统计计算结果
295   - salience 300
296   - no-loop
297   - when
298   - $statInfo: StatInfo($tid: ttid)
299   - $ttInfoDetails_wrap: TTInfoDetails_wrap(ttInfoId == $tid)
300   - $allbc: Long() from accumulate (TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), count())
301   - $inbc: Long() from accumulate (TTInfoDetail(bcType == "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
302   - $outbc: Long() from accumulate (TTInfoDetail(bcType == "out") from $ttInfoDetails_wrap.getBcInfoList(), count())
303   - $yybc: Long() from accumulate (TTInfoDetail(bcType != "out", bcType != "in") from $ttInfoDetails_wrap.getBcInfoList(), count())
304   - $errorbc: Long() from accumulate ($ttd: TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), ecount($ttd))
305   - then
306   - log.info("时刻表={},id={},班次数={},进场={},出场={},营运={},错误={}", $statInfo.getTtname(), $statInfo.getTtid(), $allbc, $inbc, $outbc, $yybc, $errorbc);
307   -
308   - $statInfo.setAllbc($allbc);
309   - $statInfo.setInbc($inbc);
310   - $statInfo.setOutbc($outbc);
311   - $statInfo.setYybc($yybc);
312   - $statInfo.setErrorbc($errorbc);
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
... ... @@ -630,6 +630,9 @@
630 630 <script
631 631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"
632 632 data-exclude=1></script>
  633 +<!-- echarts4 误删 -->
  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>
633 636  
634 637 </body>
635 638 </html>
636 639 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/fragments/addbc.html
... ... @@ -201,7 +201,7 @@ $(&#39;#addBc_mobal&#39;).on(&#39;addBcMobal.show&#39;, function(e,lpData,lpDataCount,echartsDra
201 201 // 'dir' : {required : true},
202 202 'fcsj' : {required : true},
203 203 'bcType' : {required : true},
204   - 'bcsj' : {number : true,required : true},
  204 + 'bcsj' : {min : 1, digits : true, required : true},
205 205 'isfb' : {required : true}
206 206 },
207 207 invalidHandler : function(event, validator) {
... ... @@ -224,50 +224,54 @@ $(&#39;#addBc_mobal&#39;).on(&#39;addBcMobal.show&#39;, function(e,lpData,lpDataCount,echartsDra
224 224 var fcsj = Date.parse(DateTimeTool.getDateTime(params.fcsj));
225 225 var ARRIVALTIME = fcsj + parseInt(params.bcsj)*60000 ;
226 226  
227   - for(var i=0; i<data.length-1; i++) {
228   - if(data[i].value[0] == params.lpName) {
229   - if(data[i].value[7] < params.fcno) {
230   - prevBcObj = data[i];
231   - bcObj = $.extend(true, {}, bcObj, data[i]);
232   - index = i+1;
233   - } else {
234   - if(type) {
235   - type = false;
236   - nextBcObj = data[i];
  227 + if(params.bcsj > 0){
  228 + for(var i=0; i<data.length-1; i++) {
  229 + if(data[i].value[0] == params.lpName) {
  230 + if(data[i].value[7] < params.fcno) {
  231 + prevBcObj = data[i];
  232 + bcObj = $.extend(true, {}, bcObj, data[i]);
  233 + index = i+1;
  234 + } else {
  235 + if(type) {
  236 + type = false;
  237 + nextBcObj = data[i];
  238 + }
  239 + data[i].value[7] += 1;
237 240 }
238   - data[i].value[7] += 1;
239 241 }
240 242 }
241   - }
242   - bcObj.value[1] = fcsj;
243   - bcObj.value[2] = ARRIVALTIME;
244   - bcObj.value[3] = params.bcsj*60000;
245   - // bcObj.value[4] = lpNo;
246   - bcObj.value[6] = params.bcType;
247   - bcObj.value[7] = parseInt(params.fcno);
248   - var dir = bcObj.value[8] == 1 ? 0:1;
249   - bcObj.value[8] = dir;
250   - bcObj.itemStyle.normal.color = dir==0?"#ff2949":"#518fe3";
251   - // 起终点互换
252   - var station = bcObj.value[13];
253   - bcObj.value[13] = bcObj.value[14];
254   - bcObj.value[14] = station;
255   - bcObj.value[16] = parseInt(params.isfb);
256   - data.splice(index, 0 , bcObj);
  243 + bcObj.value[1] = fcsj;
  244 + bcObj.value[2] = ARRIVALTIME;
  245 + bcObj.value[3] = params.bcsj*60000;
  246 + // bcObj.value[4] = lpNo;
  247 + bcObj.value[6] = params.bcType;
  248 + bcObj.value[7] = parseInt(params.fcno);
  249 + var dir = bcObj.value[8] == 1 ? 0:1;
  250 + bcObj.value[8] = dir;
  251 + bcObj.itemStyle.normal.color = dir==0?"#ff2949":"#518fe3";
  252 + // 起终点互换
  253 + var station = bcObj.value[13];
  254 + bcObj.value[13] = bcObj.value[14];
  255 + bcObj.value[14] = station;
  256 + bcObj.value[16] = parseInt(params.isfb);
  257 + data.splice(index, 0 , bcObj);
257 258  
258   - if(nextBcObj != null && (nextBcObj.value[1] < ARRIVALTIME || prevBcObj.value[2] > fcsj)){
259   - layer.confirm('添加的班次与前后班次有时间冲突,是否添加?', {
260   - btn : [ '添加','取消' ], icon: 3, title:'提示'
261   - }, function(){
  259 + if(nextBcObj != null && (nextBcObj.value[1] < ARRIVALTIME || prevBcObj.value[2] > fcsj)){
  260 + layer.confirm('添加的班次与前后班次有时间冲突,是否添加?', {
  261 + btn : [ '添加','取消' ], icon: 3, title:'提示'
  262 + }, function(){
  263 + echartsDrawGTT.init(data,false,true,false);
  264 + echartsDrawGTT.refreshDrag();
  265 + layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功,注意修改冲突班次!');
  266 + });
  267 + } else {
262 268 echartsDrawGTT.init(data,false,true,false);
263 269 echartsDrawGTT.refreshDrag();
264   - layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功,注意修改冲突班次!');
265   - });
  270 + layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功!');
  271 + }
266 272 } else {
267   - echartsDrawGTT.init(data,false,true,false);
268   - echartsDrawGTT.refreshDrag();
269   - layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功!');
270   - }
  273 + layer.msg('班次时间为0分钟,为无效班次添加失败!');
  274 + }
271 275 $('#addBc_mobal').modal('hide');
272 276 }
273 277 });
... ...
src/main/resources/static/pages/base/timesmodel/fragments/editbc.html
... ... @@ -162,7 +162,7 @@ $(&#39;#editBc_mobal&#39;).on(&#39;editBcMobal.show&#39;, function(e,index,echartsDrawGTT){
162 162 // 'dir' : {required : true},
163 163 'fcsj' : {required : true},
164 164 'bcType' : {required : true},
165   - 'bcsj' : {number : true,required : true},
  165 + 'bcsj' : {min : 1, digits : true,required : true},
166 166 'isfb' : {required : true}
167 167 },
168 168 invalidHandler : function(event, validator) {
... ...
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
... ... @@ -321,7 +321,7 @@ var SKBFormWizard = function() {
321 321 tempName = 'carnum_temp';
322 322 else if(n==1)
323 323 tempName = 'bctype_temp';
324   - else if (n==2)
  324 + else if (n==2 || n==3)
325 325 tempName = 'fcjx_temp';
326 326 // 2、获参数详情模版html内容.
327 327 $.get('/pages/base/timesmodel/tepms/'+ tempName + '.html', function(html){
... ... @@ -411,7 +411,7 @@ var SKBFormWizard = function() {
411 411 // 返回参数详情模版.
412 412 return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})});
413 413 });
414   - }else if (n==2) {
  414 + }else if (n==2 || n==3) {
415 415 // 更具站点路由版本获取起点终点站
416 416 var iversion = $('#lineVersionSelect').val();
417 417 $get('/stationroute/all',{'line.id_eq':lineId,'destroy_eq':0, 'versions_eq': iversion},function(result) {
... ... @@ -1011,7 +1011,7 @@ var SKBFormWizard = function() {
1011 1011 layer.close(i);
1012 1012 });
1013 1013  
1014   - } else if (baseRes == 2) { // 发车间隔分析
  1014 + } else if (baseRes == 2 || baseRes == 3) { // 发车间隔分析
1015 1015 // 上下行首末班日期控件
1016 1016 $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
1017 1017 $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
... ...
src/main/resources/static/pages/base/timesmodel/js/gantt.js
... ... @@ -75,6 +75,10 @@
75 75 _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap);
76 76 map.clzs = _paramObj.calcuClzx();
77 77 CSMap = getMaxCarAndStopSpace1(map);
  78 + } else if (map.baseRes == '3') { // 主站停站使用v2_2版本
  79 + _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap); // TODO:暂时使用v2_1版本的方法,通用的,后续再放到v2_2版本中
  80 + map.clzs = InternalScheduleObj_v2_2.calcuClzx(_paramObj);
  81 + CSMap = getMaxCarAndStopSpace1(map);
78 82 }
79 83  
80 84 // 定义时间参数.
... ... @@ -96,6 +100,8 @@
96 100 // TODO:CSMap.maxCar 之后要设定一下的
97 101 data = Main_v2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
98 102 Main_v2.exportDataConfig(data.aInternalLpObj);
  103 + } else if (map.baseRes == '3') { // 主站停站使用v2_2版本
  104 + data = Main_v2_2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
99 105 }
100 106  
101 107 }else {
... ... @@ -125,7 +131,7 @@
125 131 data = {'json':rsjar,'bxrcgs':null};
126 132 }
127 133 echartsDrawGTT.init(data.json,true,true);
128   - console.log(data.json);
  134 + // console.log(data.json);
129 135 // 创建甘特图对象.
130 136 // var graph = d3.select('#ganttSvg').relationshipGraph(
131 137 // getGraphArgus({'ganttInitParams': map,'yAxisCarArray':CSMap.maxCar,
... ... @@ -136,7 +142,54 @@
136 142 // graph.addHistory();
137 143 // // 初始化右键菜单.
138 144 // contextInit(graph);
139   - // 关闭弹出层
  145 +
  146 + if (map.baseRes == '3' || map.baseRes == '1') {
  147 + // 导入导出设置
  148 + // Main_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
  149 +
  150 + var _dfun = function() {
  151 + // fix,从新的甘特图中获取数据
  152 + var _keyIndex = echartsDrawGTT.get_keyIndex();
  153 + var historyData = echartsDrawGTT.getHistoryData();
  154 + var _data = $.extend(true, [], data, historyData[_keyIndex]);
  155 +
  156 + var _i;
  157 + var _j;
  158 + var _gObj;
  159 +
  160 + var _rtnBcArray = [];
  161 + for (_i = 0; _i < _data.length; _i++) {
  162 + _gObj = _data[_i].value;
  163 + _rtnBcArray.push({
  164 + lpName : _gObj[0],
  165 + fcsj: moment(_gObj[1]).format("HH:mm"),
  166 + ARRIVALTIME: moment(_gObj[2]).format("HH:mm"),
  167 + bcsj: _gObj[3] / 60000,
  168 + lpNo: _gObj[4],
  169 + lpType: _gObj[5],
  170 + bcType: _gObj[6],
  171 + fcno: _gObj[7],
  172 + xlDir: (_gObj[8] == 0 ? "relationshipGraph-up" : "relationshipGraph-down"),
  173 + jhlc: _gObj[9],
  174 + tcc: _gObj[10],
  175 + ttinfo: _gObj[11],
  176 + xl: _gObj[12],
  177 + qdz: _gObj[13],
  178 + zdz: _gObj[14],
  179 + STOPTIME: _gObj[15],
  180 + isfb: _gObj[16]
  181 + });
  182 + }
  183 +
  184 + console.log("重组前数据=" + _data);
  185 + console.log("重组后数据=" + _rtnBcArray);
  186 + return _rtnBcArray;
  187 + };
  188 +
  189 + // Main_v2_2.exportExcelConfig(_dfun);
  190 + }
  191 +
  192 + // 关闭弹出层
140 193 layer.close(indexLoad);
141 194 },500);
142 195  
... ...
src/main/resources/static/pages/base/timesmodel/js/systemTools.js
... ... @@ -112,8 +112,8 @@ $(&#39;#bcAdjustListSubmit&#39;).on(&#39;click&#39;,function() {
112 112 /* 右击菜单事件
113 113 * 1.修改 update
114 114 * 2.删除 delete
115   -* 3.设为上行 setUp
116   -* 4.设为下行 setDown
  115 +* 3.班次切换上下行 dropdownMenuSwitchUpDown
  116 +* 4.路牌切换上下行 dropdownMenuLpSwitchUpDown
117 117 * 5.设为正常 setNormal
118 118 * 6.设为区间 setRegion
119 119 * 7.设为分班 setFb
... ... @@ -145,12 +145,16 @@ function dropdownMenuDelete(dataIndex) {
145 145 // 关闭弹出层.
146 146 layer.closeAll();
147 147 data.splice(dataIndex,1);
  148 + $.each(data, function () {
  149 + if(bc.value[0] == this.value[0] && bc.value[7] < this.value[7])
  150 + this.value[7] -= 1;
  151 + });
148 152 echartsDrawGTT.init(data,false,true,false);
149 153 layer.msg('删除成功!');
150 154 });
151 155 }
152 156 }
153   -// 切换上下行
  157 +// 班次切换上下行
154 158 function dropdownMenuSwitchUpDown(dataIndex) {
155 159 // 获取当前操作步数
156 160 var _keyIndex = echartsDrawGTT.get_keyIndex(),
... ... @@ -176,8 +180,17 @@ function dropdownMenuSwitchUpDown(dataIndex) {
176 180 data[dataIndex].value[3] = parseInt(dataMap.map.downInTimer)*60000;
177 181 data[dataIndex].value[2] = data[dataIndex].value[1] + data[dataIndex].value[3];
178 182 }
  183 + if(data[dataIndex].value[3] <= 0){
  184 + var bc = data[dataIndex];
  185 + data.splice(dataIndex,1);
  186 + $.each(data, function () {
  187 + if(bc.value[0] == this.value[0] && bc.value[7] < this.value[7])
  188 + this.value[7] -= 1;
  189 + });
  190 + layer.msg('班次切换上下行成功,切换后班次运送时间为0分钟,无意义所以删除改班次!',{time: 8000});
  191 + } else
  192 + layer.msg('班次切换上下行成功!');
179 193 echartsDrawGTT.init(data,false,true,false);
180   - layer.msg('设置为上行成功!');
181 194 }
182 195 // 路牌切换上下行
183 196 function dropdownMenuLpSwitchUpDown(dataIndex) {
... ... @@ -206,6 +219,13 @@ function dropdownMenuLpSwitchUpDown(dataIndex) {
206 219 data[i].value[3] = parseInt(dataMap.map.downInTimer)*60000;
207 220 data[i].value[2] = data[i].value[1] + data[i].value[3];
208 221 }
  222 + if(data[i].value[3] <= 0){
  223 + data.splice(i,1);
  224 + $.each(data, function () {
  225 + if(data[i].value[0] == this.value[0] && data[i].value[7] < this.value[7])
  226 + this.value[7] -= 1;
  227 + });
  228 + }
209 229 }
210 230 }
211 231 echartsDrawGTT.init(data,false,true,false);
... ...
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   -
889   -
890   - };
891   -
892   - /**
893   - * 计算吃饭班次。
894   - */
895   - InternalScheduleObj.prototype.fnCalcuEatBc = function() {
896   - var i;
897   - var j;
898   - var oLp;
899   - var oBc;
900   - // 1、标记吃饭班次
901   - var oEatFlag = {}; // {"路牌编号":{isLaunch: false, isDinner: false},...}
902   - for (i = 0; i < this._internalLpArray.length; i++) {
903   - oLp = this._internalLpArray[i];
904   - if (oLp.isBxLb()) { // 暂时判定只有连班吃饭
905   - oEatFlag[oLp.getLpNo()] = {};
906   - oEatFlag[oLp.getLpNo()]["isLaunch"] = false;
907   - oEatFlag[oLp.getLpNo()]["isDinner"] = false;
908   - for (j = 0; j < oLp.getBcArray().length; j++) {
909   - oBc = oLp.getBcArray()[j];
910   - // 午饭,暂时判定10:30到13:00
911   - if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
912   - oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("10:30")) &&
913   - oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("13:30"))) {
914   - if (!oEatFlag[oLp.getLpNo()]["isLaunch"]) {
915   - oBc.fnSetEatTime(this._oParam.fnGetLunchTime());
916   - oEatFlag[oLp.getLpNo()]["isLaunch"] = true;
917   - // console.log("吃饭班次时间=" + oBc.format("HH:mm"));
918   - }
919   - }
920   - // 晚饭,暂时判定17:30
921   - if (oBc.isUp() == this._oParam.isUpOneWayStop() &&
922   - oBc.getFcTimeObj().isAfter(this._oParam.toTimeObj("17:00")) &&
923   - oBc.getFcTimeObj().isBefore(this._oParam.toTimeObj("20:00"))) {
924   - if (!oEatFlag[oLp.getLpNo()]["isDinner"]) {
925   - oBc.fnSetEatTime(this._oParam.fnGetDinnerTime());
926   - oEatFlag[oLp.getLpNo()]["isDinner"] = true;
927   - // console.log("晚饭班次时间=" + oBc.format("HH:mm"));
928   - }
929   - }
930   - }
931   - }
932   - }
933   -
934   - // 2、调整吃饭需停站时间
935   - StrategyUtils_v2_2.sFn("ADJUST_HEADWAY_3_EAT")(
936   - this, this._oParam
937   - );
938   - };
939   -
940   - /**
941   - * 计算末班车。
942   - * 1、将上下行拉成上下行两个班次列表(包括标记班次)
943   - * 2、分别找出离末班车发车时间最近的班次,并替换时间
944   - * 3、删除之后的班次
945   - */
946   - InternalScheduleObj.prototype.fnCalcuLastBc = function() {
947   - var i;
948   - var iTimeDiff;
949   - var iTempTime;
950   - var aBc;
951   - var oLastBcTime;
952   - var oLastBcIsUp;
953   - var iModifyIndex;
954   -
955   - // 查找末班车早的末班车时间和方向
956   - if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
957   - oLastBcTime = this._oParam.getUpLastDtimeObj();
958   - oLastBcIsUp = true;
959   - } else {
960   - oLastBcTime = this._oParam.getDownLastDTimeObj();
961   - oLastBcIsUp = false;
962   - }
963   -
964   - // 确定早的末班车时间
965   - aBc = this.fnGetBcList(oLastBcIsUp);
966   - for (i = 0; i < aBc.length; i++) {
967   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
968   - if (iTimeDiff == undefined) {
969   - iTimeDiff = iTempTime;
970   - iModifyIndex = i;
971   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
972   - iTimeDiff = iTempTime;
973   - iModifyIndex = i;
974   - }
975   - }
976   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
977   - aBc[iModifyIndex].fnSetDelFlag(false);
978   - aBc[iModifyIndex].fnSetIsLastBc(true);
979   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
980   - this._qIsUp == oLastBcIsUp ?
981   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
982   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
983   - }
984   -
985   - // 查找末班车晚的末班车时间和方向
986   - if (this._oParam.getUpLastDtimeObj().isBefore(this._oParam.getDownLastDTimeObj())) {
987   - oLastBcTime = this._oParam.getDownLastDTimeObj();
988   - oLastBcIsUp = false;
989   - } else {
990   - oLastBcTime = this._oParam.getUpLastDtimeObj();
991   - oLastBcIsUp = true;
992   - }
993   - // 确定晚的末班车时间
994   - aBc = this.fnGetBcList(oLastBcIsUp);
995   - var oBc;
996   - var aBcIndex;
997   - var iLpIndex;
998   - var iQIndex;
999   - var iBcIndex;
1000   -
1001   - iTimeDiff = undefined;
1002   - for (i = 0; i < aBc.length; i++) {
1003   - oBc = aBc[i];
1004   - aBcIndex = this.fnGetBcIndex(oBc);
1005   -
1006   - iLpIndex = aBcIndex[0];
1007   - iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
1008   - iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
1009   -
1010   - if (!this._internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
1011   - continue;
1012   - }
1013   -
1014   - iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
1015   - if (iTimeDiff == undefined) {
1016   - iTimeDiff = iTempTime;
1017   - iModifyIndex = i;
1018   - } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
1019   - iTimeDiff = iTempTime;
1020   - iModifyIndex = i;
1021   - }
1022   - }
1023   - aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
1024   - aBc[iModifyIndex].fnSetDelFlag(false);
1025   - aBc[iModifyIndex].fnSetIsLastBc(true);
1026   - for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
1027   - this._qIsUp == oLastBcIsUp ?
1028   - aBc[i]._$$_internal_group_obj.setBc1(undefined) :
1029   - aBc[i]._$$_internal_group_obj.setBc2(undefined);
1030   - }
1031   - };
1032   -
1033   - /**
1034   - * 重新设置停站时间(发车时间减到达时间)。
1035   - */
1036   - InternalScheduleObj.prototype.fnReSetLayoverTime = function() {
1037   - for (var i = 0; i < this._internalLpArray.length; i++) {
1038   - this._internalLpArray[i].modifyLayoverTimeWithoutFcTime();
1039   - }
1040   - };
1041   -
1042   - /**
1043   - * 补进出场例保班次。
1044   - */
1045   - InternalScheduleObj.prototype.fnCalcuOtherBc = function() {
1046   - var i;
1047   - var j;
1048   - var iBcChainCount;
1049   - var oLp;
1050   - var aOtherBc;
1051   - var oStartBc;
1052   - var oEndBc;
1053   -
1054   - for (i = 0; i < this._internalLpArray.length; i++) {
1055   - aOtherBc = [];
1056   - oLp = this._internalLpArray[i];
1057   - iBcChainCount = oLp.fnGetBcChainCount();
1058   -
1059   - if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
1060   - // 头部要添加出场,例保班次
1061   - oStartBc = oLp.getBc(
1062   - oLp.fnGetBcChainInfo(0)["s_q"],
1063   - oLp.fnGetBcChainInfo(0)["s_b"]
1064   - );
1065   - aOtherBc.push(_utils.createBcObj(
1066   - oLp, "bd", oStartBc.isUp(), 1,
1067   - oStartBc.getFcTimeObj(),
1068   - this._oParam
1069   - ));
1070   - aOtherBc.push(_utils.createBcObj(
1071   - oLp, "out", oStartBc.isUp(), 1,
1072   - oStartBc.getFcTimeObj(),
1073   - this._oParam
1074   - ));
1075   -
1076   - // 尾部需添加进场,例保班次
1077   - oEndBc = oLp.getBc(
1078   - oLp.fnGetBcChainInfo(0)["e_q"],
1079   - oLp.fnGetBcChainInfo(0)["e_b"]
1080   - );
1081   - oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置
1082   - oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置
1083   - aOtherBc.push(_utils.createBcObj(
1084   - oLp, "in", !oEndBc.isUp(), 1,
1085   - oEndBc.getArrTimeObj(),
1086   - this._oParam
1087   - ));
1088   - aOtherBc.push(_utils.createBcObj(
1089   - oLp, "lc", !oEndBc.isUp(), 1,
1090   - oEndBc.getArrTimeObj(),
1091   - this._oParam
1092   - ));
1093   - } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
1094   - // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
1095   - oStartBc = oLp.getBc(
1096   - oLp.fnGetBcChainInfo(0)["s_q"],
1097   - oLp.fnGetBcChainInfo(0)["s_b"]
1098   - );
1099   - aOtherBc.push(_utils.createBcObj(
1100   - oLp, "bd", oStartBc.isUp(), 1,
1101   - oStartBc.getFcTimeObj(),
1102   - this._oParam
1103   - ));
1104   - aOtherBc.push(_utils.createBcObj(
1105   - oLp, "out", oStartBc.isUp(), 1,
1106   - oStartBc.getFcTimeObj(),
1107   - this._oParam
1108   - ));
1109   -
1110   - oEndBc = oLp.getBc(
1111   - oLp.fnGetBcChainInfo(0)["e_q"],
1112   - oLp.fnGetBcChainInfo(0)["e_b"]
1113   - );
1114   - aOtherBc.push(_utils.createBcObj(
1115   - oLp, "in", !oEndBc.isUp(), 1,
1116   - oEndBc.getArrTimeObj(),
1117   - this._oParam
1118   - ));
1119   -
1120   - // 第二个车次链开头有出场,报到班次,车次链结尾有进场,报到班次
1121   - oStartBc = oLp.getBc(
1122   - oLp.fnGetBcChainInfo(1)["s_q"],
1123   - oLp.fnGetBcChainInfo(1)["s_b"]
1124   - );
1125   - aOtherBc.push(_utils.createBcObj(
1126   - oLp, "bd", oStartBc.isUp(), 1,
1127   - oStartBc.getFcTimeObj(),
1128   - this._oParam
1129   - ));
1130   - aOtherBc.push(_utils.createBcObj(
1131   - oLp, "out", oStartBc.isUp(), 1,
1132   - oStartBc.getFcTimeObj(),
1133   - this._oParam
1134   - ));
1135   -
1136   - oEndBc = oLp.getBc(
1137   - oLp.fnGetBcChainInfo(1)["e_q"],
1138   - oLp.fnGetBcChainInfo(1)["e_b"]
1139   - );
1140   - aOtherBc.push(_utils.createBcObj(
1141   - oLp, "in", !oEndBc.isUp(), 1,
1142   - oEndBc.getArrTimeObj(),
1143   - this._oParam
1144   - ));
1145   - aOtherBc.push(_utils.createBcObj(
1146   - oLp, "lc", !oEndBc.isUp(), 1,
1147   - oEndBc.getArrTimeObj(),
1148   - this._oParam
1149   - ));
1150   -
1151   -
1152   - } else {
1153   - // 2个车次链以上,暂时没有此班型
1154   - }
1155   -
1156   - oLp.addOtherBcArray(aOtherBc);
1157   - }
1158   - };
1159   -
1160   -
1161   - //------------- 其他非业务方法方法 -------------//
1162   - /**
1163   - * 获取班次列表。
1164   - * @param isUp boolean 是否上行
1165   - * @returns [(InternalBcObj)]
1166   - */
1167   - InternalScheduleObj.prototype.fnGetBcList = function(isUp) {
1168   - var i;
1169   - var j;
1170   - var oLp;
1171   - var oBc;
1172   - var aBc = [];
1173   -
1174   - for (j = 0; j < this._qCount; j++) {
1175   - for (i = 0; i < this._internalLpArray.length; i++) {
1176   - oLp = this._internalLpArray[i];
1177   - oBc = oLp.getBc(
1178   - j,
1179   - this._qIsUp == isUp ? 0 : 1
1180   - );
1181   - if (oBc) {
1182   - aBc.push(oBc);
1183   - }
1184   - }
1185   - }
1186   -
1187   - var aBcFcTime = [];
1188   - for (i = 0; i < aBc.length; i++) {
1189   - oBc = aBc[i];
1190   - aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
1191   - }
1192   - console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
1193   -
1194   - return aBc;
1195   - };
1196   -
1197   - /**
1198   - * 获取班次索引。
1199   - * @param oBc 班次对象
1200   - * @returns [{路牌索引},{圈索引},{班次索引}]
1201   - */
1202   - InternalScheduleObj.prototype.fnGetBcIndex = function(oBc) {
1203   - // 路牌索引
1204   - var i;
1205   - var iLpIndex;
1206   - for (i = 0; i < this._internalLpArray.length; i++) {
1207   - if (this._internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
1208   - iLpIndex = i;
1209   - break;
1210   - }
1211   - }
1212   - // 圈索引
1213   - var j;
1214   - var iGroupIndex;
1215   - var bFlag = false;
1216   - for (i = 0; i < this._internalLpArray.length; i++) {
1217   - if (bFlag) {
1218   - break;
1219   - }
1220   - for (j = 0; j < this._qCount; j++) {
1221   - if (this._internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
1222   - iGroupIndex = j;
1223   - bFlag = true;
1224   - break;
1225   - }
1226   - }
1227   - }
1228   - // 班次索引
1229   - var iBcIndex = this._qIsUp == oBc.isUp() ? 0 : 1;
1230   -
1231   - if (iLpIndex == undefined) {
1232   - return null;
1233   - } else {
1234   - return [].concat(iLpIndex, iGroupIndex, iBcIndex);
1235   - }
1236   - };
1237   -
1238   - /**
1239   - * 返回内部路牌数据列表。
1240   - * @returns {Array}
1241   - */
1242   - InternalScheduleObj.prototype.fnGetLpArray = function() {
1243   - return this._internalLpArray;
1244   - };
1245   -
1246   - /**
1247   - * 获取班型描述。
1248   - * @return {*[]}
1249   - */
1250   - InternalScheduleObj.prototype.fnGetBxDesc = function() {
1251   - return this._aBxDesc;
1252   - };
1253   -
1254   - /**
1255   - * 获取圈的第一个班次是上行还是下行。
1256   - * @return {boolean|*}
1257   - */
1258   - InternalScheduleObj.prototype.fnGetGroupIsUp = function() {
1259   - return this._qIsUp;
1260   - };
1261   -
1262   - /**
1263   - * 返回内部工具对象。
1264   - * @return {{createBcObj, modifySBXMasterBc}}
1265   - */
1266   - InternalScheduleObj.prototype.fnGetUitls = function() {
1267   - return _utils;
1268   - };
1269   -
1270   - /**
1271   - * 内部数据转化成显示用的班次数组。
1272   - */
1273   - InternalScheduleObj.prototype.fnToGanttBcArray = function() {
1274   - var aAllBc = [];
1275   - var aLpBc = [];
1276   - var aEatBc = [];
1277   - var oLp;
1278   - var i;
1279   - var j;
1280   -
1281   - for (i = 0; i < this._internalLpArray.length; i++) {
1282   - oLp = this._internalLpArray[i];
1283   - aLpBc = [];
1284   - aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
1285   -
1286   - aEatBc = [];
1287   - // TODO:根据班次的吃饭时间添加吃饭班次
1288   - for (j = 0; j < aLpBc.length; j++) {
1289   - if (aLpBc[j].fnGetEatTime() > 0) {
1290   - aEatBc.push(_utils.createBcObj(
1291   - oLp,
1292   - "cf",
1293   - aLpBc[j].isUp(), // 和上一个班次方向相反
1294   - 1,
1295   - this._oParam.addMinute(aLpBc[j].getFcTimeObj(), -aLpBc[j].fnGetEatTime()),
1296   - this._oParam
1297   - ));
1298   - }
1299   - }
1300   - aLpBc = aLpBc.concat(aEatBc);
1301   -
1302   - // 按照发车时间排序
1303   - aLpBc.sort(function(o1, o2) {
1304   - if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
1305   - return -1;
1306   - } else {
1307   - return 1;
1308   - }
1309   - });
1310   -
1311   - // 重新赋值fcno
1312   - for (j = 0; j < aLpBc.length; j++) {
1313   - aLpBc[j].fnSetFcno(j + 1);
1314   - }
1315   -
1316   - aAllBc = aAllBc.concat(aLpBc);
1317   - }
1318   -
1319   - var aGanttBc = [];
1320   - for (i = 0; i < aAllBc.length; i++) {
1321   - aGanttBc.push(aAllBc[i].toGanttBcObj());
1322   - }
1323   -
1324   - return aGanttBc;
1325   - };
1326   -
1327   - /**
1328   - * 计算指定开始时间,指定方向班次执行后的最大最小停站时间。
1329   - * @param oStartFcTime 开始发车时间
1330   - * @param isUp 是否上行
1331   - * @returns array [最小值,最大值]
1332   - */
1333   - InternalScheduleObj.prototype._$calcuLayoverTime = function(oStartFcTime, isUp) {
1334   - var aRtn = [];
1335   - var _iRunningTime; // 行驶时间
1336   - var _iLayoverTime; // 停站时间
1337   -
1338   - // 最小停站时间
1339   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1340   - isUp, oStartFcTime, this._oParam);
1341   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1342   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1343   - this._oParam)[0]; // 最小停站
1344   - aRtn.push(_iLayoverTime);
1345   -
1346   - // 最大停站时间
1347   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1348   - isUp, oStartFcTime, this._oParam);
1349   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1350   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1351   - this._oParam)[1]; // 最大停站
1352   - aRtn.push(_iLayoverTime);
1353   -
1354   - return aRtn;
1355   - };
1356   -
1357   - /**
1358   - * 计算指定时间,指定方向开始的最大最小周转时间
1359   - * @param oStartFcTime 开始发车时间
1360   - * @param isUp 是否上行
1361   - * @returns array [最小值,最大值]
1362   - * @private
1363   - */
1364   - InternalScheduleObj.prototype._$calcuCycleTime = function(oStartFcTime, isUp) {
1365   - var aRtn = [];
1366   - var _iRunningTime; // 行驶时间
1367   - var _iLayoverTime; // 停站时间
1368   - var _iCycleTime; // 周转时间
1369   - var _oNextFcTime;
1370   -
1371   - // 最小周转时间
1372   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1373   - isUp, oStartFcTime, this._oParam);
1374   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1375   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1376   - this._oParam)[0]; // 最小停站
1377   - _iCycleTime = _iRunningTime + _iLayoverTime;
1378   - _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
1379   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1380   - !isUp, _oNextFcTime, this._oParam);
1381   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1382   - _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1383   - this._oParam)[0]; // 最小停站
1384   - _iCycleTime += _iRunningTime;
1385   - _iCycleTime += _iLayoverTime;
1386   -
1387   - aRtn.push(_iCycleTime);
1388   -
1389   - // 最大周转时间
1390   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1391   - isUp, oStartFcTime, this._oParam);
1392   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1393   - oStartFcTime, isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1394   - this._oParam)[1]; // 最大停站
1395   - _iCycleTime = _iRunningTime + _iLayoverTime;
1396   - _oNextFcTime = this._oParam.addMinute(oStartFcTime, (_iRunningTime + _iLayoverTime));
1397   - _iRunningTime = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(
1398   - !isUp, _oNextFcTime, this._oParam);
1399   - _iLayoverTime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1400   - _oNextFcTime, !isUp, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"),
1401   - this._oParam)[1]; // 最大停站
1402   - _iCycleTime += _iRunningTime;
1403   - _iCycleTime += _iLayoverTime;
1404   -
1405   - aRtn.push(_iCycleTime);
1406   -
1407   - return aRtn;
1408   - };
1409   -
1410   - //-------------------- static静态方法 ----------------------//
1411   -
1412   - /**
1413   - * 计算车辆数(最大周转时间/最大发车间隔)。
1414   - * @param oParam 参数对象
1415   - */
1416   - InternalScheduleObj.calcuClzx = function(oParam) {
1417   - var _iUpRT; // 上行行驶时间
1418   - var _iUpLT; // 上行停站时间
1419   - var _iDownRT; // 下行行驶时间
1420   - var _iDownLT; // 下行停站时间
1421   -
1422   - // 计算早高峰最大周转时间
1423   - _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getMPeakStartTimeObj(), oParam);
1424   - _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1425   - oParam.getMPeakStartTimeObj(), true,
1426   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1427   - _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getMPeakStartTimeObj(), oParam);
1428   - _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1429   - oParam.getMPeakStartTimeObj(), false,
1430   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1431   - var _iAMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1432   - // 早高峰预估车辆数,使用早高峰最大发车间隔
1433   - var _iAMPeakVehicleCount = _iAMPeakRCTime / oParam.getMPeakMaxFcjx();
1434   -
1435   - // 计算晚高峰最大周转时间
1436   - _iUpRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(true, oParam.getEPeakStartTimeObj(), oParam);
1437   - _iUpLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1438   - oParam.getEPeakStartTimeObj(), true,
1439   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1440   - _iDownRT = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, oParam.getEPeakStartTimeObj(), oParam);
1441   - _iDownLT = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
1442   - oParam.getEPeakStartTimeObj(), false,
1443   - StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), oParam)[1]; // 使用最大停站时间
1444   - var _iPMPeakRCTime = _iUpRT + _iUpLT + _iDownRT + _iDownLT;
1445   - // 晚高峰预估车辆数,使用晚高峰最大发车间隔
1446   - var _iPMPeakVehicleCount = _iPMPeakRCTime / oParam.getEPeakMaxFcjx();
1447   -
1448   - // 取最大值为最终车辆数
1449   - // 大于或等于的最小整数,人话就是有小数点就加1
1450   - if (_iAMPeakVehicleCount > _iPMPeakVehicleCount) {
1451   - return Math.ceil(_iAMPeakVehicleCount);
1452   - } else {
1453   - return Math.ceil(_iPMPeakVehicleCount);
1454   - }
1455   -
1456   - };
1457   -
1458   -
1459   - 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;
1460 1504 }());
1461 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   - // {"路牌名字":{"cf":吃饭班次}}
231   - this._oLpGroupCfGanttBc = {};
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   - this._aUpGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
249   - if (oParam.toTimeObj(o1.fcsj).isBefore(oParam.toTimeObj(o2.fcsj))) {
250   - return -1;
251   - } else {
252   - return 1;
253   - }
254   - });
255   - this._aDownGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
256   - if (oParam.toTimeObj(o1.fcsj).isBefore(oParam.toTimeObj(o2.fcsj))) {
257   - return -1;
258   - } else {
259   - return 1;
260   - }
261   - });
262   -
263   - }
264   -
265   - //----------------------- 外部方法 -----------------------//
266   - InternalCalcuExcelBc1.prototype.fnCalcuExcelLpBcList = function() {
267   - // 计算Excel班次
268   - this._calcuExcelBc(true); // 上行
269   - // this._calcuExcelBc(false); // 下行
270   -
271   - // 设置路牌圈数,路由id
272   - var iGroupCount = this._iUpGroupIndex > this._iDownGroupIndex ?
273   - (this._iUpGroupIndex + 1) : (this._iDownGroupIndex + 1);
274   -
275   - var i;
276   - var stationRouteId1;
277   - var stationRouteId2;
278   - var oGanttBc;
279   - for (i = 0; i < this._aUpGanttBc.length; i++) {
280   - oGanttBc = this._aUpGanttBc[i];
281   - if (oGanttBc.bcType == "normal") {
282   - if (this._bQIsUp) {
283   - stationRouteId1 = oGanttBc.qdz;
284   - break;
285   - } else {
286   - stationRouteId2 = oGanttBc.qdz;
287   - break;
288   - }
289   - }
290   - }
291   - for (i = 0; i < this._aDownGanttBc.length; i++) {
292   - oGanttBc = this._aUpGanttBc[i];
293   - if (oGanttBc.bcType == "normal") {
294   - if (!this._bQIsUp) {
295   - stationRouteId1 = oGanttBc.qdz;
296   - break;
297   - } else {
298   - stationRouteId2 = oGanttBc.qdz;
299   - break;
300   - }
301   - }
302   - }
303   -
304   - var oExcelLp;
305   - for (i = 0; i < this._aExcelLp.length; i++) {
306   - oExcelLp = this._aExcelLp[i];
307   - oExcelLp.groupCount = iGroupCount;
308   - oExcelLp.stationRouteId1 = stationRouteId1;
309   - oExcelLp.stationRouteId2 = stationRouteId2;
310   - }
311   -
312   - return this._aExcelLp;
313   - };
314   -
315   - //----------------------- 内部方法 ------------------------//
316   - /**
317   - * 重新计算Excel显示班次。
318   - * @param bIsUp 是否上行
319   - */
320   - InternalCalcuExcelBc1.prototype._calcuExcelBc = function(bIsUp) {
321   - this._oLpGroupNormalGanttBc = {};
322   - this._oLpGroupCfGanttBc = {};
323   -
324   - var i;
325   - var j = 0;
326   - var oExcelLp;
327   - var oGanttBc;
328   - var aGBc = bIsUp ? this._aUpGanttBc : this._aDownGanttBc;
329   - for (i = 0; i < aGBc.length; i++) {
330   - oGanttBc = aGBc[i];
331   - while (j < this._aExcelLp.length) {
332   - oExcelLp = this._aExcelLp[j];
333   - if (this._isResetCalcuGroup(oGanttBc)) {
334   - this._resetCalcuGroup(bIsUp);
335   - j = 0;
336   - i--;
337   - break;
338   - } else {
339   - // TODO:其他类型班次再议
340   -
341   - if (oGanttBc.bcType == "cf") {
342   - this._oLpGroupCfGanttBc[oGanttBc.lpName] = {
343   - "cf": oGanttBc
344   - };
345   - break;
346   - }
347   -
348   - if (oExcelLp.lpname == oGanttBc.lpName) {
349   - if (oGanttBc.bcType == "normal") {
350   - this._oLpGroupNormalGanttBc[oGanttBc.lpName] = {
351   - "isFlag": false, "normal": oGanttBc
352   - };
353   - }
354   - j = (j + 1) % this._aExcelLp.length;
355   - break;
356   - } else { // 当前路牌无对应班次,标记找过班次
357   - this._oLpGroupNormalGanttBc[oExcelLp.lpname] = {
358   - "isFlag": true, "normal": null
359   - };
360   - j = (j + 1) % this._aExcelLp.length;
361   - }
362   - }
363   - }
364   -
365   - }
366   -
367   - };
368   - InternalCalcuExcelBc1.prototype._resetCalcuGroup = function(bIsUp) {
369   - // 重置计算圈及班次
370   - var oExcelLp;
371   - var oGroupGanttNormalBc;
372   - var oGroupGanttEatBc;
373   - for (var i = 0; i < this._aExcelLp.length; i++) {
374   - oExcelLp = this._aExcelLp[i];
375   - if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
376   - if (!this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag) { // 非标记班次
377   - oGroupGanttNormalBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
378   - }
379   - }
380   - if (this._oLpGroupCfGanttBc[oExcelLp.lpname]) {
381   - oGroupGanttEatBc = this._oLpGroupCfGanttBc[oExcelLp.lpname].cf;
382   - }
383   - if (oGroupGanttNormalBc) {
384   - oExcelLp.bcObjList.push({
385   - "bcsj": oGroupGanttNormalBc.bcsj, // 班次时间
386   - "ssj": oGroupGanttNormalBc.STOPTIME, // 停站时间
387   - "eatsj": oGroupGanttEatBc ? oGroupGanttEatBc.bcsj : 0, // 吃饭时间
388   -
389   - "tccid": oGroupGanttNormalBc.tcc, // 停车场id
390   - "qdzid": oGroupGanttNormalBc.qdz, // 起点站id
391   - "zdzid": oGroupGanttNormalBc.zdz, // 终点站id
392   -
393   - "isUp": bIsUp, // 是否上行
394   -
395   - "bcType": oGroupGanttNormalBc.bcType, // 班次类型
396   - "fcsj": oGroupGanttEatBc ?
397   - ("*" + oGroupGanttNormalBc.fcsj) :
398   - oGroupGanttNormalBc.fcsj, // 发车时间描述
399   - "fcsjDesc": oGroupGanttEatBc ?
400   - ("(吃" + oGroupGanttNormalBc.fcsj + ")") :
401   - oGroupGanttNormalBc.fcsj, // 发车时间描述2
402   -
403   - "groupNo": bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
404   - "groupBcNo": bIsUp == this._bQIsUp ? 0 : 1 // 圈里第几个班次
405   -
406   - });
407   - }
408   - }
409   -
410   - if (bIsUp) {
411   - this._iUpGroupIndex ++;
412   - } else {
413   - this._iDownGroupIndex ++;
414   - }
415   - this._oLpGroupNormalGanttBc = {};
416   - this._oLpGroupCfGanttBc = {};
417   - };
418   - InternalCalcuExcelBc1.prototype._isResetCalcuGroup = function(oGanttBc) {
419   - // 是否重置计算圈,当oGanttBc存在相同路牌的班次或者标记班次,算下一个圈
420   - if (oGanttBc.bcType == "cf") {
421   - return false;
422   - }
423   - if (this._oLpGroupNormalGanttBc[oGanttBc.lpName]) {
424   - return true;
425   - } else {
426   - return false;
427   - }
428   -
429   - };
430   -
431   - /**
432   - * 内部Excel对象。
433   - * @param oParam 参数对象
434   - * @param fnGetGanttBcArray 返回gantt用的班次列表
435   - * @constructor
436   - */
437   - function InternalExcelObj(oParam, fnGetGanttBcArray) {
438   - this._oParam = oParam;
439   - this.aGanttBc = fnGetGanttBcArray();
440   -
441   - // 每一圈是上行开始还是下行开始
442   - this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
443   -
444   - // 构造显示用lp对象
445   - var oTempLpFlag = {};
446   - var oGanttBc;
447   - var aLp = [];
448   - var oLp;
449   - var i;
450   - for (i = 0; i < this.aGanttBc.length; i++) {
451   - oGanttBc = this.aGanttBc[i];
452   - if (oTempLpFlag[oGanttBc.lpName]) {
453   - // 已经存在路牌,不处理
454   - continue;
455   - }
456   -
457   - oLp = {
458   - "lpname": oGanttBc.lpName, // 路牌名字
459   - "isUp": this._qIsUp, // 每圈的第一个班次是否上行
460   - "bcObjList": [], // 内部班次列表(后面计算班次列表)
461   - "groupCount": 0, // 总圈数(后面计算总圈数)
462   - "zlc": 0, // 总里程
463   - "yylc": 0, // 营运里程
464   - "kslc": 0, // 空驶里程
465   - "zgs": 0, // 总工时
466   - "zbc": 0, // 总班次
467   - "yygs": 0, // 营运工时
468   - "yybc": 0, // 营运班次
469   - "stationRouteId1": 0, // 第一个班次起点站路由id
470   - "stationRouteId2": 0 // 第二个班次起点站路由id
471   - };
472   - oTempLpFlag[oGanttBc.lpName] = {"flag" : true}; // 标记一下
473   - aLp.push(oLp);
474   - }
475   -
476   - // 计算Excel班次
477   - this._celb = new InternalCalcuExcelBc1(aLp, this.aGanttBc, oParam, this._qIsUp);
478   -
479   - }
480   -
481   - // html5导出excel方法
482   - InternalExcelObj.prototype.downloadFile = function(data, mimeType, fileName) {
483   - _fnDownloadFile(data, mimeType, fileName);
484   - };
485   - /**
486   - * 获取班次统计数据。
487   - */
488   - InternalExcelObj.prototype.fnGetStatInfoList = function() {
489   - return _fnCalcuExportStatInfo_sheet(this.aGanttBc, this._oParam);
490   - };
491   - /**
492   - * 获取参数数据。
493   - */
494   - InternalExcelObj.prototype.fnGetParamInfoList = function() {
495   - return _fnCalcuExportParam_sheet(this._oParam);
496   - };
497   - /**
498   - * 获取路牌班次数据。
499   - * @return {*}
500   - */
501   - InternalExcelObj.prototype.fnGetLpBcInfoList = function() {
502   - return this._celb.fnCalcuExcelLpBcList();
503   - };
504   -
505   - return InternalExcelObj;
506   -
  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 +
507 971 } ());
508 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.fnCalcuEatBc();
44   - // 4、调整发车间隔
45   - schedule.fnAdjustHeadway();
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   - alert("dddd");
75   -
76   -
77   - var aInfos = {
78   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
79   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
80   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
81   - };
82   -
83   - console.log(aInfos);
84   -
85   - $(".exportAdd").addClass("disabled");
86   - $(".exportAddSpan").html("正在导出...");
87   -
88   - // 提交
89   - $.ajax({
90   - type: 'POST',
91   - url: "/tidc/exportDTDFile/xls",
92   - dataType: 'binary',
93   - contentType: "application/json",
94   - data: JSON.stringify(aInfos),
95   - success: function(data){
96   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
97   -
98   - $(".exportAdd").removeClass("disabled");
99   - $(".exportAddSpan").html(" 导出数据");
100   - },
101   - error: function(xhr, type){
102   - alert('错误:TODO');
103   -
104   - $(".exportAdd").removeClass("disabled");
105   - $(".exportAddSpan").html(" 导出数据");
106   - }
107   - });
108   - });
109   -
110   - $('.exportAddXlsx').on('click', function() {
111   - var aInfos = {
112   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
113   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
114   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
115   - };
116   -
117   - console.log(aInfos);
118   -
119   - $(".exportAdd").addClass("disabled");
120   - $(".exportAddSpan").html("正在导出...");
121   -
122   - // 提交
123   - $.ajax({
124   - type: 'POST',
125   - url: "/tidc/exportDTDFile/xlsx",
126   - dataType: 'binary',
127   - contentType: "application/json",
128   - data: JSON.stringify(aInfos),
129   - success: function(data){
130   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
131   -
132   - $(".exportAdd").removeClass("disabled");
133   - $(".exportAddSpan").html(" 导出数据");
134   - },
135   - error: function(xhr, type){
136   - alert('错误:TODO');
137   -
138   - $(".exportAdd").removeClass("disabled");
139   - $(".exportAddSpan").html(" 导出数据");
140   - }
141   - });
142   - });
143   - }
144   -
145   -
146   - }
  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 + }
147 145 }();
148 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   - }
86   -
87   - return true;
88   - }
89   - // // TODO:向上局部减少发车调整有问题,不能下上所有的班次都减发车时间,需要像_a_down逐步减,下次修正
90   - // function _a_up2(lpIndex, aLp,
91   - // iCurrentGroupIndex, iCurrentBcIndex, oParam) {
92   - // // 有班次的路牌索引数组(往上)
93   - // var i;
94   - // var aLpIndex = [];
95   - // for (i = lpIndex; i >= 0; i--) {
96   - // if (aLp[i].getBc(iCurrentGroupIndex, iCurrentBcIndex)) {
97   - // aLpIndex.push(i);
98   - // }
99   - // }
100   - // // 当前班次开始与下一个路牌的对应班次的发车时间间隔
101   - // var aHeadWay = [];
102   - // var oHeadWay = {};
103   - // for (i = 0; i < aLpIndex.length - 1; i++) {
104   - // oHeadWay = {};
105   - // oHeadWay.iStartLpIndex = aLpIndex[i + 1];
106   - // oHeadWay.iEndLpIndex = aLpIndex[i];
107   - // if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj())) {
108   - // oHeadWay.bMPeakBc = true;
109   - // } else {
110   - // oHeadWay.bMPeakBc = false;
111   - // }
112   - // oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj().diff(
113   - // aLp[aLpIndex[i + 1]].getBc(iCurrentGroupIndex, iCurrentBcIndex).getFcTimeObj(), "m"
114   - // );
115   - //
116   - // aHeadWay.push(oHeadWay);
117   - // }
118   - //
119   - // // 找出第一个间隔小的班次间隔
120   - // var bIsFind = false;
121   - // var iFindIndex;
122   - // for (i = 0; i < aHeadWay.length; i++) {
123   - // if (aHeadWay[i].bMPeakBc) {
124   - // if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
125   - // iFindIndex = i;
126   - // bIsFind = true;
127   - // break;
128   - // }
129   - // } else {
130   - // iFindIndex = i;
131   - // bIsFind = true;
132   - // break;
133   - // }
134   - // }
135   - //
136   - // if (!bIsFind) {
137   - // return false;
138   - // }
139   - //
140   - // // 调整间隔
141   - // var iStartLpIndex = aHeadWay[iFindIndex].iStartLpIndex;
142   - // var oLp;
143   - // var oBc;
144   - // for (i = 0; i < aLpIndex.length; i++) {
145   - // if (aLpIndex[i] <= lpIndex && aLpIndex[i] >= iStartLpIndex) {
146   - // oLp = aLp[aLpIndex[i]];
147   - // oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
148   - // oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
149   - // }
150   - // }
151   - //
152   - // return true;
153   - //
154   - // }
155   -
156   - /**
157   - * 从指定路牌的班次开始往上所有的班次发车时间尝试减一分钟。
158   - * @param lpIndex 开始路牌索引
159   - * @param aLp 路牌列表
160   - * @param iCurrentGroupIndex 当前班次圈索引
161   - * @param iCurrentBcIndex 当前班次索引
162   - * @param oParam 参数对象
163   - */
164   - function _a_up(lpIndex, aLp,
165   - iCurrentGroupIndex, iCurrentBcIndex, oParam) {
166   - var i;
167   - var oLp;
168   - var oBc;
169   - for (i = lpIndex; i > 0; i--) { // 第一个路牌的班次不能动
170   - oLp = aLp[i];
171   - oBc = oLp.getBc(iCurrentGroupIndex, iCurrentBcIndex);
172   - if (oBc) {
173   - oBc.addMinuteToFcsj(-1); // 发车时间,到达时间减1分钟
174   - }
175   -
176   - }
177   - }
178   -
179   - /**
180   - * 主函数。
181   - * @param oInternalSchedule 行车计划
182   - * @param oParam 参数对象
183   - * @param iCGIndex 圈索引
184   - * @param iCBIndex 班次索引
185   - * @param iNGIndex 同路牌下一个邻接圈索引
186   - * @param iNBIndex 同路牌下一个邻接班次索引
187   - * @param iMinLayoverTime 要求的最小停站时间
188   - */
189   - function main(oInternalSchedule, oParam,
190   - iCGIndex, iCBIndex,
191   - iNGIndex, iNBIndex,
192   - iMinLayoverTime) {
193   - var _iIterCount = 0; // 当前迭代次数
194   - var _iMaxIter = 100; // 最大迭代100次
195   -
196   - var bLpFind = false;
197   - var iLpIndex;
198   - var i;
199   - var aLp = oInternalSchedule.fnGetLpArray();
200   - var oLp;
201   - var oCBc;
202   - var oNBc;
203   - while (_iIterCount <= _iMaxIter) {
204   - // 反方向查找第一个停站时间不足的班次
205   - for (i = aLp.length - 1; i > 0; i--) {
206   - oLp = aLp[i];
207   - oCBc = oLp.getBc(iCGIndex, iCBIndex);
208   - oNBc = oLp.getBc(iNGIndex, iNBIndex);
209   - if (oCBc && oNBc) {
210   - if (oNBc.getFcTimeObj().diff(oCBc.getArrTimeObj(), "m") <= (iMinLayoverTime - 1)) {
211   - iLpIndex = i;
212   - bLpFind = true;
213   - break;
214   - }
215   - }
216   - }
217   - if (!bLpFind) {
218   - break;
219   - }
220   -
221   - if (iLpIndex == aLp.length - 1) { // 最后一个路牌的班次停站时间不足,不能调整了
222   - break;
223   - }
224   -
225   - // 如果当前班次和下一个班次的间隔是早高峰最大发车间隔,需要尝试下面的班次发车时间减1分钟
226   - if (aLp[iLpIndex + 1].getBc(iCGIndex, iCBIndex).getFcTimeObj().diff(
227   - aLp[iLpIndex].getBc(iCGIndex, iCBIndex).getFcTimeObj(), "m") == oParam.getMPeakMaxFcjx()) {
228   - if (_a_down(aLp, iLpIndex, iCGIndex, iCBIndex, oParam)) {
229   - _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
230   - } else {
231   - break;
232   - }
233   - } else {
234   - _a_up(iLpIndex, aLp,iCGIndex, iCBIndex, oParam);
235   - }
236   -
237   - bLpFind = false;
238   - _iIterCount ++;
239   - }
240   -
241   - }
242   -
243   - 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;
244 252 } ());
245 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   - if (oNextBc) {
34   - oNextBc.addMinuteToFcsj(iMinute);
35   - }
36   - }
37   -
38   - /**
39   - * 从当前班次开始向上尝试减一分钟。
40   - * @param oBcInfo 内部班次对象
41   - * @param aLp 路牌列表
42   - * @param oParam 参数对象
43   - * @private
44   - */
45   - function _headway_up(oBcInfo, aLp, oParam) {
46   - if (!oBcInfo) {
47   - return;
48   - }
49   -
50   - // 有班次的路牌索引数组(往下)
51   - var i;
52   - var aLpIndex = [];
53   - for (i = oBcInfo.iLpIndex; i >= 0; i--) {
54   - if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
55   - aLpIndex.push(i);
56   - }
57   - }
58   -
59   - // 当前班次与上一个班次之间的间隔列表
60   - var aHeadWay = [];
61   - var oHeadWay;
62   - for (i = 0; i < aLpIndex.length - 1; i++) {
63   - oHeadWay = {};
64   - oHeadWay.iStartLpIndex = aLpIndex[i + 1];
65   - oHeadWay.iEndLpIndex = aLpIndex[i];
66   - if (oParam.isMPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
67   - oHeadWay.bMPeakBc = true;
68   - } else if (oParam.isEPeakBc(aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
69   - oHeadWay.bEPeakBc = true;
70   - } else {
71   - oHeadWay.bTroughBc = true;
72   - }
73   -
74   - oHeadWay.iHeadWay = aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
75   - aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
76   - );
77   -
78   - aHeadWay.push(oHeadWay);
79   - }
80   -
81   - // 找出第一个间隔大于最小发车间隔的位置
82   - // 从当前位置往上到此位置所有班次往前减一分钟
83   - var bIsFind = false;
84   - var iFindIndex;
85   - for (i = 0; i < aHeadWay.length; i++) {
86   - if (aHeadWay[i].bMPeakBc) { // 早高峰
87   - if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
88   - iFindIndex = i;
89   - bIsFind = true;
90   - break;
91   - }
92   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
93   - if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
94   - iFindIndex = i;
95   - bIsFind = true;
96   - break;
97   - }
98   - } else { // 低谷
99   - if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
100   - iFindIndex = i;
101   - bIsFind = true;
102   - break;
103   - }
104   - }
105   - }
106   -
107   - if (!bIsFind) {
108   - return;
109   - }
110   -
111   - // 调整间隔
112   - var _oBcInfo;
113   - for (i = 0; i < iFindIndex; i++) {
114   - _oBcInfo = {};
115   - _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
116   - _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
117   - _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
118   - _modifyHeadway(_oBcInfo, aLp, -1);
119   - }
120   -
121   - }
122   -
123   - /**
124   - * 从当前班次开始向下尝试减一分钟。
125   - * @param oBcInfo 内部班次对象
126   - * @param aLp 路牌列表
127   - * @param oParam 参数对象
128   - * @private
129   - */
130   - function _headway_down(oBcInfo, aLp, oParam) {
131   - if (!oBcInfo) {
132   - return;
133   - }
134   -
135   - // 有班次的路牌索引数组(往下)
136   - var i;
137   - var aLpIndex = [];
138   - for (i = oBcInfo.iLpIndex; i < aLp.length; i++) {
139   - if (aLp[i].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex)) {
140   - aLpIndex.push(i);
141   - }
142   - }
143   -
144   - // 当前班次与下一个班次之间的间隔列表
145   - var aHeadWay = [];
146   - var oHeadWay;
147   - for (i = 0; i < aLpIndex.length - 1; i++) {
148   - oHeadWay = {};
149   - oHeadWay.iStartLpIndex = aLpIndex[i];
150   - oHeadWay.iEndLpIndex = aLpIndex[i + 1];
151   - if (oParam.isMPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
152   - oHeadWay.bMPeakBc = true;
153   - } else if (oParam.isEPeakBc(aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj())) {
154   - oHeadWay.bEPeakBc = true;
155   - } else {
156   - oHeadWay.bTroughBc = true;
157   - }
158   -
159   - oHeadWay.iHeadWay = aLp[aLpIndex[i + 1]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj().diff(
160   - aLp[aLpIndex[i]].getBc(oBcInfo.iGroupIndex, oBcInfo.iBcIndex).getFcTimeObj(), "m"
161   - );
162   -
163   - aHeadWay.push(oHeadWay);
164   - }
165   -
166   - // 找出第一个间隔小于最大发车间隔的位置
167   - // 从当前位置往下到此位置所有班次往前减一分钟
168   - var bIsFind = false;
169   - var iFindIndex;
170   - for (i = 0; i < aHeadWay.length; i++) {
171   - if (aHeadWay[i].bMPeakBc) { // 早高峰
172   - if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
173   - iFindIndex = i;
174   - bIsFind = true;
175   - break;
176   - }
177   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
178   - if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
179   - iFindIndex = i;
180   - bIsFind = true;
181   - break;
182   - }
183   - } else { // 低谷
184   - if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
185   - iFindIndex = i;
186   - bIsFind = true;
187   - break;
188   - }
189   - }
190   - }
191   -
192   - if (!bIsFind) {
193   - return;
194   - }
195   -
196   - // 调整间隔
197   - var _oBcInfo;
198   - for (i = 0; i < iFindIndex; i++) {
199   - _oBcInfo = {};
200   - _oBcInfo.iLpIndex = aHeadWay[i].iStartLpIndex;
201   - _oBcInfo.iGroupIndex = oBcInfo.iGroupIndex;
202   - _oBcInfo.iBcIndex = oBcInfo.iBcIndex;
203   - if (_oBcInfo.iLpIndex != oBcInfo.iLpIndex) {
204   - // 跳过当前班次
205   - _modifyHeadway(_oBcInfo, aLp, -1);
206   - }
207   - }
208   - }
209   -
210   - /**
211   - * 找出当前圈最大需要修正停站时间的班次对象。
212   - * @param oInternalSchedule 行车计划
213   - * @param iCGIndex 圈索引(副站班次圈)
214   - * @param iCBIndex 班次索引
215   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
216   - * @param iNBIndex 同路牌下一个邻接班次索引
217   - * @param fPercent 最大超出百分比
218   - * @return {*} {路牌索引,圈索引,班次索引}
219   - * @private
220   - */
221   - function _maxMoreLayoverBcInfo(
222   - oInternalSchedule,
223   - iCGIndex, iCBIndex,
224   - iNGIndex, iNBIndex,
225   - fPercent
226   - ) {
227   - var i;
228   - var oLp;
229   - var oBc;
230   - var oNextBc;
231   - var iMaxLayoverTime;
232   - var iActualLayoverTime;
233   - var iActualMaxLayoverTime = 0;
234   - var iActualMaxLayoverTimeLpIndex;
235   -
236   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
237   - oLp = oInternalSchedule.fnGetLpArray()[i];
238   - oBc = oLp.getBc(iCGIndex, iCBIndex);
239   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
240   - if (oBc && oNextBc) {
241   - iMaxLayoverTime = oInternalSchedule._$calcuLayoverTime(
242   - oBc.getFcTimeObj(), oBc.isUp())[1];
243   - iActualLayoverTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
244   -
245   - if (iActualLayoverTime > iMaxLayoverTime &&
246   - iActualLayoverTime > iMaxLayoverTime * (1 + fPercent) &&
247   - iActualLayoverTime > iActualMaxLayoverTime
248   - ) {
249   - iActualMaxLayoverTime = iActualLayoverTime;
250   - iActualMaxLayoverTimeLpIndex = i;
251   - }
252   - }
253   - }
254   -
255   - if (iActualMaxLayoverTimeLpIndex == undefined) {
256   - return false;
257   - } else {
258   - return {
259   - iLpIndex: iActualMaxLayoverTimeLpIndex,
260   - iGroupIndex: iNGIndex, // 主站班次圈索引
261   - iBcIndex: iNBIndex
262   - };
263   - }
264   - }
265   -
266   - /**
267   - * 计算当前圈是否需要修正layovertime。
268   - * @param oInternalSchedule 行车计划对象
269   - * @param iCGIndex 圈索引(副站班次圈)
270   - * @param iCBIndex 班次索引
271   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
272   - * @param iNBIndex 同路牌下一个邻接班次索引
273   - * @param fPercent 最大超出百分比
274   - * @return {boolean}
275   - * @private
276   - */
277   - function _isNeedModify(
278   - oInternalSchedule,
279   - iCGIndex, iCBIndex,
280   - iNGIndex, iNBIndex,
281   - fPercent
282   - ) {
283   - var i;
284   - var oLp;
285   - var oBc;
286   - var oNextBc;
287   - var iMaxLayoverTime = 0;
288   - // 计算当前圈的所有相关班次总最大标准停站时间
289   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
290   - oLp = oInternalSchedule.fnGetLpArray()[i];
291   - oBc = oLp.getBc(iCGIndex, iCBIndex);
292   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
293   - if (oBc && oNextBc) {
294   - iMaxLayoverTime += oInternalSchedule._$calcuLayoverTime(
295   - oBc.getFcTimeObj(), oBc.isUp())[1];
296   - }
297   - }
298   -
299   - var iActualLayoverTime = 0;
300   - // 计算当前圈的所有相关班次总停站时间
301   - for (i = 0; i < oInternalSchedule.fnGetLpArray().length; i++) {
302   - oLp = oInternalSchedule.fnGetLpArray()[i];
303   - oBc = oLp.getBc(iCGIndex, iCBIndex);
304   - oNextBc = oLp.getBc(iNGIndex, iNBIndex);
305   - if (oBc && oNextBc) {
306   - iActualLayoverTime += oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
307   - }
308   - }
309   -
310   - // console.log("iMaxLayoverTime=" + iMaxLayoverTime);
311   - // console.log("iActualLayoverTime=" + iActualLayoverTime);
312   -
313   - // 判定是否超出指定范围
314   - if (iActualLayoverTime > iMaxLayoverTime &&
315   - iActualLayoverTime > iMaxLayoverTime * (1 + fPercent)) {
316   - return true;
317   - } else {
318   - return false;
319   - }
320   - }
321   -
322   - /**
323   - * 主函数。
324   - * @param oInternalSchedule 行车计划
325   - * @param oParam 参数对象
326   - * @param iCGIndex 圈索引(副站班次圈)
327   - * @param iCBIndex 班次索引
328   - * @param iNGIndex 同路牌下一个邻接圈索引(主站班次圈)
329   - * @param iNBIndex 同路牌下一个邻接班次索引
330   - * @param fPercent 最大超出百分比
331   - */
332   - function main(
333   - oInternalSchedule, oParam,
334   - iCGIndex, iCBIndex,
335   - iNGIndex, iNBIndex,
336   - fPercent
337   - ) {
338   - var _iIterCount = 0; // 当前迭代次数
339   - var _iMaxIter = 100; // 最大迭代次数
340   -
341   - var oBcInfo; // 内部班次对象
342   -
343   - while (_iIterCount <= _iMaxIter) {
344   -
345   - // 判定当前圈的layovertime是否超出百分比
346   - if (_isNeedModify(oInternalSchedule,
347   - iCGIndex, iCBIndex,
348   - iNGIndex, iNBIndex, fPercent)) {
349   - // 找出超出最大的班次对象
350   - oBcInfo = _maxMoreLayoverBcInfo(
351   - oInternalSchedule,
352   - iCGIndex, iCBIndex,
353   - iNGIndex, iNBIndex, fPercent
354   - );
355   - // 尝试向上部分班次逐个调整
356   - _headway_up(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
357   - // 尝试调整当前班次
358   - _modifyHeadway(oBcInfo, oInternalSchedule.fnGetLpArray(), -1);
359   - // 尝试向下部分班次逐个调整
360   - _headway_down(oBcInfo, oInternalSchedule.fnGetLpArray(), oParam);
361   -
362   - }
363   -
364   - _iIterCount ++;
365   - }
366   -
367   - }
368   -
369   - 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;
370 374 } ());
371 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   - if (oNextBc) {
93   - oNextBc.addMinuteToFcsj(iMinute);
94   - }
95   - }
96   -
97   - /**
98   - * 从当前班次开始向上尝试加一分钟。
99   - * @param oRtnBc 内部班次对象
100   - * @param aRtnBc 内部班次列表
101   - * @param aLp 路牌列表
102   - * @param oParam 参数对象
103   - * @private
104   - */
105   - function _headway_up(oRtnBc, aRtnBc, aLp, oParam) {
106   - var i;
107   -
108   - // 当前班次与上一个班次之间的间隔列表
109   - var aHeadWay = [];
110   - var oHeadWay;
111   - for (i = oRtnBc.iBcIndex; i > 0; i--) {
112   - oHeadWay = {};
113   - oHeadWay.iStartRtnBcIndex = (i - 1);
114   - oHeadWay.iEndRtnBcIndex = i;
115   - if (oParam.isMPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
116   - oHeadWay.bMPeakBc = true;
117   - } else if (oParam.isEPeakBc(aRtnBc[i - 1].oBc.getFcTimeObj())) {
118   - oHeadWay.bEPeakBc = true;
119   - } else {
120   - oHeadWay.bTroughBc = true;
121   - }
122   -
123   - oHeadWay.iHeadWay = aRtnBc[i].oBc.getFcTimeObj().diff(
124   - aRtnBc[i - 1].oBc.getFcTimeObj(), "m"
125   - );
126   -
127   - aHeadWay.push(oHeadWay);
128   - }
129   -
130   - // 找出第一个间隔小于最大发车间隔的位置
131   - // 从当前位置往上到此位置所有班次往后加1分钟
132   - var bIsFind = false;
133   - var iFindIndex;
134   - for (i = 0; i < aHeadWay.length; i++) {
135   - if (aHeadWay[i].bMPeakBc) { // 早高峰
136   - if (aHeadWay[i].iHeadWay < oParam.getMPeakMaxFcjx()) {
137   - iFindIndex = i;
138   - bIsFind = true;
139   - break;
140   - }
141   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
142   - if (aHeadWay[i].iHeadWay < oParam.getEPeakMaxFcjx()) {
143   - iFindIndex = i;
144   - bIsFind = true;
145   - break;
146   - }
147   - } else { // 低谷
148   - if (aHeadWay[i].iHeadWay < oParam.getTroughMaxFcjx()) {
149   - iFindIndex = i;
150   - bIsFind = true;
151   - break;
152   - }
153   - }
154   - }
155   -
156   - if (!bIsFind) {
157   - return;
158   - }
159   -
160   - // 调整间隔
161   - for (i = 0; i < iFindIndex; i++) {
162   - _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
163   - }
164   -
165   - }
166   -
167   - /**
168   - * 从当前班次开始向下尝试加一分钟。
169   - * @param oRtnBc 内部班次对象
170   - * @param aRtnBc 内部班次列表
171   - * @param aLp 路牌列表
172   - * @param oParam 参数对象
173   - * @private
174   - */
175   - function _headway_down(oRtnBc, aRtnBc, aLp, oParam) {
176   - var i;
177   -
178   - // 当前班次与下一个班次之间的间隔列表
179   - var aHeadWay = [];
180   - var oHeadWay;
181   - for (i = oRtnBc.iBcIndex; i < aRtnBc.length - 1; i++) {
182   - oHeadWay = {};
183   - oHeadWay.iStartRtnBcIndex = i;
184   - oHeadWay.iEndRtnBcIndex = i + 1;
185   - if (oParam.isMPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
186   - oHeadWay.bMPeakBc = true;
187   - } else if (oParam.isEPeakBc(aRtnBc[i].oBc.getFcTimeObj())) {
188   - oHeadWay.bEPeakBc = true;
189   - } else {
190   - oHeadWay.bTroughBc = true;
191   - }
192   -
193   - oHeadWay.iHeadWay = aRtnBc[i + 1].oBc.getFcTimeObj().diff(
194   - aRtnBc[i].oBc.getFcTimeObj(), "m"
195   - );
196   -
197   - aHeadWay.push(oHeadWay);
198   - }
199   -
200   - // 找出第一个间隔大于最小发车间隔的位置
201   - // 从当前位置往上到此位置所有班次往后加1分钟
202   - var bIsFind = false;
203   - var iFindIndex;
204   - for (i = 0; i < aHeadWay.length; i++) {
205   - if (aHeadWay[i].bMPeakBc) { // 早高峰
206   - if (aHeadWay[i].iHeadWay > oParam.getMPeakMinFcjx()) {
207   - iFindIndex = i;
208   - bIsFind = true;
209   - break;
210   - }
211   - } else if (aHeadWay[i].bEPeakBc) { // 晚高峰
212   - if (aHeadWay[i].iHeadWay > oParam.getEPeakMinFcjx()) {
213   - iFindIndex = i;
214   - bIsFind = true;
215   - break;
216   - }
217   - } else { // 低谷
218   - if (aHeadWay[i].iHeadWay > oParam.getTroughMinFcjx()) {
219   - iFindIndex = i;
220   - bIsFind = true;
221   - break;
222   - }
223   - }
224   - }
225   -
226   - if (!bIsFind) {
227   - return;
228   - }
229   -
230   - // 调整间隔
231   - for (i = 0; i <= iFindIndex; i++) {
232   - _modifyHeadway(aRtnBc[aHeadWay[i].iStartRtnBcIndex], aLp, 1);
233   - }
234   - }
235   -
236   - /**
237   - * 主函数。
238   - * @param oInternalSchedule 行车计划
239   - * @param oParam 参数对象
240   - */
241   - function main(
242   - oInternalSchedule, oParam
243   - ) {
244   - var _iIterCount = 0; // 当前迭代次数
245   - var _iMaxIter = 100; // 最大迭代次数
246   -
247   - var i;
248   - var oRtnBc;
249   - var oBc;
250   -
251   - while (_iIterCount <= _iMaxIter) {
252   - // 获取主站方向班次列表
253   - var aRtnBc = _getBcList(
254   - oInternalSchedule,
255   - oParam,
256   - oParam.isUpOneWayStop());
257   -
258   - for (i = 0; i < aRtnBc.length; i++) {
259   - oRtnBc = aRtnBc[i];
260   - oBc = oRtnBc.oBc;
261   - if (oBc.fnGetEatTime() > 0) { // 标记了吃饭时间,吃饭班次
262   - if (_isNeedModifyLayoverTime(oRtnBc, oInternalSchedule.fnGetLpArray())) { // 是否需要调整停站时间满足吃饭
263   - // 尝试向上部分班次逐个调整
264   - _headway_up(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
265   - // 尝试调整本班次,以及向下部分班次逐个调整
266   - _headway_down(oRtnBc, aRtnBc, oInternalSchedule.fnGetLpArray(), oParam);
267   -
268   - break;
269   - }
270   - }
271   - }
272   -
273   -
274   - _iIterCount ++;
275   - }
276   -
277   -
278   - }
279   -
280   - return main;
281   -
  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 +
282 286 } ());
283 287 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/paramadd.html
... ... @@ -553,9 +553,50 @@
553 553  
554 554 echartsDrawGTT.init(data.json,true,true);
555 555  
556   - if (ganttMap.baseRes == "3") {
  556 + if (ganttMap.baseRes == "3" || ganttMap.baseRes == "1") {
557 557 // 导入导出设置
558   - _mainFun_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
  558 + // _mainFun_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
  559 +
  560 + var _dfun = function() {
  561 + // fix,从新的甘特图中获取数据
  562 + var _keyIndex = echartsDrawGTT.get_keyIndex();
  563 + var historyData = echartsDrawGTT.getHistoryData();
  564 + var _data = $.extend(true, [], data, historyData[_keyIndex]);
  565 +
  566 + var _i;
  567 + var _j;
  568 + var _gObj;
  569 +
  570 + var _rtnBcArray = [];
  571 + for (_i = 0; _i < _data.length; _i++) {
  572 + _gObj = _data[_i].value;
  573 + _rtnBcArray.push({
  574 + lpName : _gObj[0],
  575 + fcsj: moment(_gObj[1]).format("HH:mm"),
  576 + ARRIVALTIME: moment(_gObj[2]).format("HH:mm"),
  577 + bcsj: _gObj[3] / 60000,
  578 + lpNo: _gObj[4],
  579 + lpType: _gObj[5],
  580 + bcType: _gObj[6],
  581 + fcno: _gObj[7],
  582 + xlDir: (_gObj[8] == 0 ? "relationshipGraph-up" : "relationshipGraph-down"),
  583 + jhlc: _gObj[9],
  584 + tcc: _gObj[10],
  585 + ttinfo: _gObj[11],
  586 + xl: _gObj[12],
  587 + qdz: _gObj[13],
  588 + zdz: _gObj[14],
  589 + STOPTIME: _gObj[15],
  590 + isfb: _gObj[16]
  591 + });
  592 + }
  593 +
  594 + console.log("重组前数据=" + _data);
  595 + console.log("重组后数据=" + _rtnBcArray);
  596 + return _rtnBcArray;
  597 + };
  598 +
  599 + Main_v2_2.exportExcelConfig(_dfun);
559 600 }
560 601  
561 602 // var data = obj.getDataArray();
... ... @@ -874,7 +915,7 @@
874 915 var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap);
875 916  
876 917 if (!_paramObj.isTwoWayStop()) { // 主站停站使用v2_2版本
877   - map.clzs = _oSchedule_v2_2.calcuClzx(_paramObj);
  918 + map.clzs = InternalScheduleObj.calcuClzx(_paramObj);
878 919 } else {
879 920 map.clzs = _paramObj.calcuClzx();
880 921 }
... ...
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>
... ...
src/main/resources/static/pages/forms/mould/calcTurnoutrateZgf.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/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;
... ...
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>
... ...
src/main/resources/static/pages/permission/authorize_all/user_auth.html
... ... @@ -151,7 +151,7 @@
151 151 '22_2': '金高公司(二分公司)', '22_1': '金高公司(四分公司)', '22_3': '金高公司(三分公司)', '22_5': '金高公司(一分公司)',
152 152 '26_3': '南汇公司(三分公司)', '26_2': '南汇公司(南汇二分)', '26_1': '南汇公司(南汇一分)', '26_4': '南汇公司(南汇维修公司)', '26_5': '南汇公司(南汇公司)', '26_6': '南汇公司(南汇六分)',
153 153 '05_5': '杨高公司(杨高分公司)', '05_6': '杨高公司(周浦分公司)', '05_3': '杨高公司(芦潮港分公司)', '05_1': '杨高公司(川沙分公司)', '05_2': '杨高公司(金桥分公司)',
154   - '77_78': '闵行公司','300_301': '金球公交', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队'
  154 + '77_78': '闵行公司','300_301': '金球公交','302_303': '露虹公交', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队'
155 155 };
156 156  
157 157 var defauleConfig;
... ...
src/main/resources/static/pages/scheduleApp/Gruntfile.js
... ... @@ -89,7 +89,9 @@ module.exports = function (grunt) {
89 89 'module/common/dts2/bcGroup/saBcgroup.js', // 班次选择整合指令
90 90 'module/common/dts2/ttinfotable/saTimeTable.js', // 时刻表显示指令
91 91 'module/common/dts2/ttinfotable/saTimeTableScrolly1.js', // 时刻表滚动1显示指令
92   - 'module/common/dts2/scheduleplan/saScpdate.js', // saScpdate指令(非通用指令,只在排版计划form中使用)
  92 + 'module/common/dts2/queryOption/saOrderOption.js', // saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的)
  93 + 'module/common/dts2/scheduleplan/saScpdate.js', // saScpdate指令(非通用指令,只在排班计划form中使用)
  94 + 'module/common/dts2/scheduleplan/saSrule.js', // saSrule指令(非通用指令,只在排班计划form中使用)
93 95 'module/common/dts2/scheduleplan/saPlaninfoedit.js', // saPlaninfoedit指令(非通用指令,只在调度执勤日报中使用)
94 96 'module/common/dts2/scheduleplan/saPlaninfoedit2.js' // saPlaninfoedit2指令(非通用指令,只在调度执勤日报中使用)
95 97 ],
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="BusInfoManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">车辆信息表</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加车辆信息
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -9,11 +9,11 @@
9 9 <th style="width: 120px;">内部编号</th>
10 10 <th style="width: 120px;">设备编号</th>
11 11 <th style="width: 120px;">车牌号</th>
12   - <th style="width: 150px;">所在公司</th>
13   - <th style="width: 160px;">所在分公司</th>
  12 + <th >所在公司</th>
  13 + <th >所在分公司</th>
14 14 <th style="width: 60px">电车</th>
15 15 <th style="width: 80px;" >状态</th>
16   - <th style="width: 100%">操作</th>
  16 + <th >操作</th>
17 17 </tr>
18 18 <tr role="row" class="filter">
19 19 <td></td>
... ... @@ -68,9 +68,24 @@
68 68 </label>
69 69 </td>
70 70 <td>
71   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
72   - ng-click="ctrl.doPage()">
73   - <i class="fa fa-search"></i> 搜索</button>
  71 + <div class="btn-group">
  72 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  73 + ng-click="ctrl.doPage()">
  74 + <i class="fa fa-search"></i> 搜索</button>
  75 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  76 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  77 + <span class="caret"></span>
  78 + <span class="sr-only">dropdown</span>
  79 + </button>
  80 + <ul class="dropdown-menu pull-right">
  81 + <li>
  82 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  83 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  84 + 排序选项
  85 + </a>
  86 + </li>
  87 + </ul>
  88 + </div>
74 89  
75 90 <button class="btn btn-sm red btn-outline filter-cancel"
76 91 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
... ... @@ -26,6 +26,23 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 26 uiToRecord: 0 // 页面绑定,当前页到第几条记录
27 27 };
28 28  
  29 + // 字段描述
  30 + var columns = [
  31 + {name: "carCode", desc: "车辆编号"},
  32 + {name: "insideCode", desc: "自编号"},
  33 + {name: "equipmentCode", desc: "设备编号"},
  34 + {name: "carPlate", desc: "车牌号"},
  35 + {name: "company", desc: "所在公司"},
  36 + {name: "brancheCompany", desc: "所在分公司"},
  37 + {name: "sfdc", desc: "是否电车"},
  38 + {name: "scrapState", desc: "是否报废"}
  39 + ];
  40 + // 排序字段
  41 + var orderColumns = {
  42 + order: "carCode",
  43 + direction: "ASC"
  44 + };
  45 +
29 46 // 查询对象
30 47 var queryClass = service.rest;
31 48  
... ... @@ -33,6 +50,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
33 50 getQueryClass: function() {
34 51 return queryClass;
35 52 },
  53 + getColumns: function() {
  54 + return columns;
  55 + },
  56 + getOrderColumns: function() {
  57 + return orderColumns;
  58 + },
36 59 /**
37 60 * 获取查询条件信息,
38 61 * 用于给controller用来和页面数据绑定。
... ... @@ -44,6 +67,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
44 67 currentSearchCondition["cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
45 68 }
46 69  
  70 + // 重置排序字段条件
  71 + currentSearchCondition.order = orderColumns.order;
  72 + currentSearchCondition.direction = orderColumns.direction;
  73 +
47 74 return currentSearchCondition;
48 75 },
49 76 /**
... ... @@ -81,10 +108,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
81 108 * 数据导出。
82 109 * @returns {*|Function|promise|n}
83 110 */
84   - dataExport: function() {
  111 + dataExport: function(query) {
85 112 if (UserPrincipal.getGsStrsQuery().length > 0) {
86 113 return service.dataTools.dataExport(
87   - {'cgsbm_in': UserPrincipal.getGsStrsQuery().join(",")}
  114 + {'QUERY': query}
88 115 ).$promise;
89 116 } else {
90 117 return null;
... ... @@ -104,7 +131,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
104 131 '$state',
105 132 '$uibModal',
106 133 'FileDownload_g',
107   - function(busInfoManageService, $state, $uibModal, fileDownload) {
  134 + 'UserPrincipal',
  135 + function(busInfoManageService, $state, $uibModal, fileDownload, UserPrincipal) {
108 136 var self = this;
109 137  
110 138 // 切换到form状态
... ... @@ -141,7 +169,34 @@ angular.module(&#39;ScheduleApp&#39;).controller(
141 169  
142 170 // 导出excel
143 171 self.exportData = function() {
144   - var p = busInfoManageService.dataExport();
  172 + // 组装查询条件
  173 + var QUERY = [];
  174 + var fgs_query = [];
  175 + var i;
  176 + for (i in UserPrincipal.getGsStrs()) {
  177 + fgs_query.push("'" + UserPrincipal.getGsStrs()[i] + "'");
  178 + }
  179 + QUERY.push(" concat(business_code, '_', branche_company_code) in " + "(" + fgs_query.join(",") + ")");
  180 + var key_map = {
  181 + "car_code": "carCode_like",
  182 + "inside_code": "insideCode_like",
  183 + "equipment_code": "equipmentCode_like",
  184 + "car_plate": "carPlate_like"
  185 + };
  186 +
  187 + var key;
  188 + var value;
  189 + var field;
  190 + var condition = busInfoManageService.getSearchCondition();
  191 + for (key in key_map) {
  192 + value = condition[key_map[key]];
  193 + if (value !== undefined && value !== "") {
  194 + field = key;
  195 + QUERY.push(field + " = " + "'" + value + "'");
  196 + }
  197 + }
  198 +
  199 + var p = busInfoManageService.dataExport(QUERY.join(" and "));
145 200 if (p) {
146 201 p.then(
147 202 function(result) {
... ... @@ -208,8 +263,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
208 263 'BusInfoManageListCtrl',
209 264 [
210 265 'BusInfoManageService',
211   - '$scope',
212   - function(service, $scope) {
  266 + '$uibModal',
  267 + function(service, $uibModal) {
213 268 var self = this;
214 269 var Cars = service.getQueryClass();
215 270  
... ... @@ -248,6 +303,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
248 303 };
249 304  
250 305 self.doPage();
  306 +
  307 + self.customOrder = function() {
  308 + // large方式弹出模态对话框
  309 + var modalInstance = $uibModal.open({
  310 + templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/orderOptionOpen.html',
  311 + size: "sm",
  312 + animation: true,
  313 + backdrop: 'static',
  314 + resolve: {
  315 + },
  316 + windowClass: 'center-modal',
  317 + controller: "BusInfoManageListOrderOptionModalInstanceCtrl",
  318 + controllerAs: "$ctrl",
  319 + bindToController: true
  320 + });
  321 + modalInstance.result.then(
  322 + function(result) {
  323 + console.log("dataImport.html打开");
  324 + },
  325 + function() {
  326 + console.log("dataImport.html消失");
  327 + }
  328 + );
  329 + };
  330 + }
  331 + ]
  332 +);
  333 +
  334 +angular.module('ScheduleApp').controller(
  335 + "BusInfoManageListOrderOptionModalInstanceCtrl",
  336 + [
  337 + "BusInfoManageService",
  338 + "$modalInstance",
  339 + function(service, $modalInstance) {
  340 + var self = this;
  341 +
  342 + self.columns = service.getColumns();
  343 + self.orderColumns = service.getOrderColumns();
  344 +
  345 + self.confirm = function(result) {
  346 + // console.log(result);
  347 + // console.log(service.getOrderColumns());
  348 + $modalInstance.dismiss("cancel");
  349 +
  350 + }
251 351 }
252 352 ]
253 353 );
... ... @@ -294,11 +394,11 @@ angular.module(&#39;ScheduleApp&#39;).controller(
294 394 self.submit = function() {
295 395 console.log(self.busInfoForSave);
296 396  
297   - // 报废的车辆,修改原来的车辆终端号
298   - if (self.busInfoForSave.scrapState == true) {
299   - self.busInfoForSave.equipmentCode = "BF-" + self.busInfoForSave.equipmentCode;
300   - self.busInfoForSave.scrapCode = "BF-" + self.busInfoForSave.equipmentCode;
301   - }
  397 + // // 报废的车辆,修改原来的车辆终端号
  398 + // if (self.busInfoForSave.scrapState == true) {
  399 + // self.busInfoForSave.equipmentCode = "BF-" + self.busInfoForSave.equipmentCode;
  400 + // self.busInfoForSave.scrapCode = "BF-" + self.busInfoForSave.equipmentCode;
  401 + // }
302 402  
303 403  
304 404 // 保存或者更新
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html
... ... @@ -27,7 +27,7 @@
27 27 <span class="caption-subject bold uppercase">设备信息表</span>
28 28 </div>
29 29 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  30 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 31 <i class="fa fa-plus"></i>
32 32 添加设备信息
33 33 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
1 1 <!-- ui-route deviceInfoManage.list -->
2 2 <div ng-controller="DeviceInfoManageListCtrl as ctrl">
  3 + <style>
  4 + .dropdown-menu {
  5 + border-color: #32c5d2;
  6 + }
  7 + .btn-group > .dropdown-menu:before {
  8 + border-bottom-color: #32c5d2;
  9 + }
  10 + </style>
  11 +
  12 +
3 13 <div style="width: 100%; height: 100%; overflow: auto">
4 14 <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column">
5 15 <thead>
... ... @@ -11,7 +21,6 @@
11 21 <th>旧设备编号</th>
12 22 <th>新设备编号</th>
13 23 <th style="width: 180px;">操作人/操作时间</th>
14   - <th style="width: 80px;" >状态</th>
15 24 <th style="width: 150pt;">操作</th>
16 25 </tr>
17 26 <tr role="row" class="filter">
... ... @@ -38,14 +47,24 @@
38 47 <td></td>
39 48 <td></td>
40 49 <td>
41   - <label class="checkbox-inline input">
42   - <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />已作废
43   - </label>
44   - </td>
45   - <td>
46   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
47   - ng-click="ctrl.doPage()">
48   - <i class="fa fa-search"></i> 搜索</button>
  50 + <div class="btn-group">
  51 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  52 + ng-click="ctrl.doPage()">
  53 + <i class="fa fa-search"></i> 搜索</button>
  54 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  55 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  56 + <span class="caret"></span>
  57 + <span class="sr-only">dropdown</span>
  58 + </button>
  59 + <ul class="dropdown-menu pull-right">
  60 + <li>
  61 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  62 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  63 + 排序选项
  64 + </a>
  65 + </li>
  66 + </ul>
  67 + </div>
49 68  
50 69 <button class="btn btn-sm red btn-outline filter-cancel"
51 70 ng-click="ctrl.reset()">
... ... @@ -94,10 +113,6 @@
94 113  
95 114 </td>
96 115 <td>
97   - <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span>
98   - <span class="glyphicon glyphicon-remove" ng-if="info.isCancel == '1'"></span>
99   - </td>
100   - <td>
101 116 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
102 117 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
103 118 <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js
... ... @@ -20,6 +20,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(
20 20 uiToRecord: 0 // 页面绑定,当前页到第几条记录
21 21 };
22 22  
  23 + // 字段描述
  24 + var columns = [
  25 + {name: "xl", desc: "线路名称"},
  26 + {name: "clZbh", desc: "车辆内部编号"},
  27 + {name: "qyrq", desc: "启用日期"},
  28 + {name: "oldDeviceNo", desc: "旧设备编号"},
  29 + {name: "newDeviceNo", desc: "新终端号"}
  30 + ];
  31 + // 排序字段
  32 + var orderColumns = {
  33 + order: "xl,clZbh,qyrq",
  34 + direction: "ASC,ASC,DESC"
  35 + };
  36 +
23 37 // 查询对象
24 38 var queryClass = service;
25 39  
... ... @@ -27,6 +41,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
27 41 getQueryClass: function() {
28 42 return queryClass;
29 43 },
  44 + getColumns: function() {
  45 + return columns;
  46 + },
  47 + getOrderColumns: function() {
  48 + return orderColumns;
  49 + },
30 50 getSearchCondition: function() {
31 51 currentSearchCondition.page = currentPage.uiNumber - 1;
32 52  
... ... @@ -34,6 +54,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 54 currentSearchCondition["cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
35 55 }
36 56  
  57 + // 重置排序字段条件
  58 + currentSearchCondition.order = orderColumns.order;
  59 + currentSearchCondition.direction = orderColumns.direction;
  60 +
37 61 return currentSearchCondition;
38 62 },
39 63 getPage: function(page) {
... ... @@ -92,7 +116,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
92 116 'DeviceInfoManageListCtrl',
93 117 [
94 118 'DeviceInfoManageService',
95   - function(service) {
  119 + '$uibModal',
  120 + function(service, $uibModal) {
96 121 var self = this;
97 122 var CarDevice = service.getQueryClass();
98 123  
... ... @@ -127,11 +152,55 @@ angular.module(&#39;ScheduleApp&#39;).controller(
127 152  
128 153 self.doPage();
129 154  
  155 + self.customOrder = function() {
  156 + // large方式弹出模态对话框
  157 + var modalInstance = $uibModal.open({
  158 + templateUrl: '/pages/scheduleApp/module/basicInfo/deviceInfoManage/orderOptionOpen.html',
  159 + size: "sm",
  160 + animation: true,
  161 + backdrop: 'static',
  162 + resolve: {
  163 + },
  164 + windowClass: 'center-modal',
  165 + controller: "DeviceInfoManageListOrderOptionModalInstanceCtrl",
  166 + controllerAs: "$ctrl",
  167 + bindToController: true
  168 + });
  169 + modalInstance.result.then(
  170 + function(result) {
  171 + console.log("dataImport.html打开");
  172 + },
  173 + function() {
  174 + console.log("dataImport.html消失");
  175 + }
  176 + );
  177 + };
130 178  
131 179 }
132 180 ]
133 181 );
134 182  
  183 +angular.module('ScheduleApp').controller(
  184 + "DeviceInfoManageListOrderOptionModalInstanceCtrl",
  185 + [
  186 + "DeviceInfoManageService",
  187 + "$modalInstance",
  188 + function(service, $modalInstance) {
  189 + var self = this;
  190 +
  191 + self.columns = service.getColumns();
  192 + self.orderColumns = service.getOrderColumns();
  193 +
  194 + self.confirm = function(result) {
  195 + // console.log(result);
  196 + // console.log(service.getOrderColumns());
  197 + $modalInstance.dismiss("cancel");
  198 +
  199 + }
  200 + }
  201 + ]
  202 +);
  203 +
135 204 // form.html控制器
136 205 angular.module('ScheduleApp').controller(
137 206 'DeviceInfoManageFormCtrl',
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js
... ... @@ -2,7 +2,7 @@
2 2 angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
3 3 return $resource(
4 4 '/cde_sc/:id',
5   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id'},
  5 + {order: 'xl,clZbh,qyrq', direction: 'ASC,ASC,DESC', id: '@id'},
6 6 {
7 7 list: {
8 8 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="EmployeeInfoManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">人员信息表</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加人员信息
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
... ... @@ -12,7 +12,7 @@
12 12 <th style="width: 15%;">所在公司</th>
13 13 <th >分公司</th>
14 14 <th style="width: 20%;">工种</th>
15   - <th style="width: 21%">操作</th>
  15 + <th >操作</th>
16 16 </tr>
17 17 <tr role="row" class="filter">
18 18 <td>
... ... @@ -73,16 +73,29 @@
73 73 </sa-Select5>
74 74 </td>
75 75 <td>
76   - <div>
77   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
  76 + <div class="btn-group">
  77 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
78 78 ng-click="ctrl.doPage()">
79 79 <i class="fa fa-search"></i> 搜索</button>
80   -
81   - <button class="btn btn-sm red btn-outline filter-cancel"
82   - ng-click="ctrl.reset()">
83   - <i class="fa fa-times"></i> 重置</button>
  80 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  81 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  82 + <span class="caret"></span>
  83 + <span class="sr-only">dropdown</span>
  84 + </button>
  85 + <ul class="dropdown-menu pull-right">
  86 + <li>
  87 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  88 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  89 + 排序选项
  90 + </a>
  91 + </li>
  92 + </ul>
84 93 </div>
85 94  
  95 + <button class="btn btn-sm red btn-outline filter-cancel"
  96 + ng-click="ctrl.reset()">
  97 + <i class="fa fa-times"></i> 重置</button>
  98 +
86 99 </td>
87 100  
88 101 </tr>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
... ... @@ -26,6 +26,21 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 26 uiToRecord: 0 // 页面绑定,当前页到第几条记录
27 27 };
28 28  
  29 + // 字段描述
  30 + var columns = [
  31 + {name: "personnelName", desc: "姓名"},
  32 + {name: "jobCodeori", desc: "工号"},
  33 + {name: "personnelType", desc: "性别"},
  34 + {name: "company", desc: "所在公司"},
  35 + {name: "brancheCompany", desc: "分公司"},
  36 + {name: "posts", desc: "工种"}
  37 + ];
  38 + // 排序字段
  39 + var orderColumns = {
  40 + order: "jobCodeori",
  41 + direction: "ASC"
  42 + };
  43 +
29 44 // 查询对象
30 45 var queryClass = service.rest;
31 46  
... ... @@ -33,6 +48,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
33 48 getQueryClass: function() {
34 49 return queryClass;
35 50 },
  51 + getColumns: function() {
  52 + return columns;
  53 + },
  54 + getOrderColumns: function() {
  55 + return orderColumns;
  56 + },
36 57 /**
37 58 * 获取查询条件信息,
38 59 * 用于给controller用来和页面数据绑定。
... ... @@ -44,6 +65,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
44 65 currentSearchCondition["cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
45 66 }
46 67  
  68 + // 重置排序字段条件
  69 + currentSearchCondition.order = orderColumns.order;
  70 + currentSearchCondition.direction = orderColumns.direction;
  71 +
47 72 return currentSearchCondition;
48 73 },
49 74 /**
... ... @@ -214,7 +239,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
214 239 'EmployeeInfoManageListCtrl',
215 240 [
216 241 'EmployeeInfoManageService',
217   - function(service) {
  242 + '$uibModal',
  243 + function(service, $uibModal) {
218 244 var self = this;
219 245 var Employee = service.getQueryClass();
220 246  
... ... @@ -254,6 +280,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
254 280  
255 281 self.doPage();
256 282  
  283 + self.customOrder = function() {
  284 + // large方式弹出模态对话框
  285 + var modalInstance = $uibModal.open({
  286 + templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/orderOptionOpen.html',
  287 + size: "sm",
  288 + animation: true,
  289 + backdrop: 'static',
  290 + resolve: {
  291 + },
  292 + windowClass: 'center-modal',
  293 + controller: "EmployeeInfoManageListOrderOptionModalInstanceCtrl",
  294 + controllerAs: "$ctrl",
  295 + bindToController: true
  296 + });
  297 + modalInstance.result.then(
  298 + function(result) {
  299 + console.log("dataImport.html打开");
  300 + },
  301 + function() {
  302 + console.log("dataImport.html消失");
  303 + }
  304 + );
  305 + };
  306 +
  307 + }
  308 + ]
  309 +);
  310 +
  311 +angular.module('ScheduleApp').controller(
  312 + "EmployeeInfoManageListOrderOptionModalInstanceCtrl",
  313 + [
  314 + "EmployeeInfoManageService",
  315 + "$modalInstance",
  316 + function(service, $modalInstance) {
  317 + var self = this;
  318 +
  319 + self.columns = service.getColumns();
  320 + self.orderColumns = service.getOrderColumns();
  321 +
  322 + self.confirm = function(result) {
  323 + // console.log(result);
  324 + // console.log(service.getOrderColumns());
  325 + $modalInstance.dismiss("cancel");
  326 +
  327 + }
257 328 }
258 329 ]
259 330 );
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
... ... @@ -7,7 +7,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
7 7 return {
8 8 rest : $resource(
9 9 '/ee/:id',
10   - {order: 'jobCode', direction: 'ASC', id: '@id'},
  10 + {order: 'jobCodeori', direction: 'ASC', id: '@id'},
11 11 {
12 12 list: {
13 13 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/queryOption/saOrderOption.js 0 → 100644
  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 +);
0 173 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html 0 → 100644
  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 +</div>
0 111 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdate.js
1 1 /**
2   - * saScpdate指令(非通用指令,只在排计划form中使用)。
  2 + * saScpdate指令(非通用指令,只在排计划form中使用)。
3 3 * 属性如下:
4 4 * name(必须):控件的名字
5 5 * xlid(必须):线路id
... ... @@ -139,7 +139,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(
139 139 outbc: obj.outbc,
140 140 yybc: obj.yybc,
141 141  
142   - errorbc: obj.errorbc
  142 + errorbc: obj.errorbc,
  143 +
  144 + lineVersion: obj.lineVersion
143 145  
144 146 });
145 147  
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdateTemplate.html
... ... @@ -64,7 +64,7 @@
64 64 popover-class="increase-popover-width"
65 65 popover-trigger="mouseenter">
66 66 <h3 class="col-md-8">
67   - <a ui-sref="ttInfoDetailManage_edit3({xlid: info.xlid, ttid : info.ttid, xlname: info.xlname, ttname : info.ttname, rflag : true})">
  67 + <a ui-sref="ttInfoDetailManage_edit3({xlid: info.xlid, ttid : info.ttid, xlname: info.xlname, ttname : info.ttname, rflag : true, lineversion : info.lineVersion})">
68 68 {{info.ttname}}
69 69 </a>
70 70 </h3>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saSrule.js 0 → 100644
  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 +);
0 189 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html 0 → 100644
  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 +</div>
0 49 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -4451,8 +4451,180 @@ angular.module(&#39;ScheduleApp&#39;).directive(
4451 4451 }
4452 4452 ]
4453 4453 );
  4454 +/**
  4455 + * saOrderoption指令,搜索时的排序选项(在搜索时可以使用,通用的)
  4456 + * 属性如下:
  4457 + * name(必须):控件的名字
  4458 + * columns(必须,独立作用域):字段名字列表,格式:[{name:[字段名],desc:[字段描述]}...]
  4459 + * ordercolumns(必须,独立作用域):字段排序列表,格式:{order: '字段1,字段2',direction: 'ASC,DESC'}
  4460 + */
  4461 +angular.module('ScheduleApp').directive(
  4462 + 'saOrderoption',
  4463 + [
  4464 + function() {
  4465 + return {
  4466 + restrict: 'E',
  4467 + templateUrl: '/pages/scheduleApp/module/common/dts2/queryOption/saOrderOptionTemplate.html',
  4468 + scope: {
  4469 + columns: '=',
  4470 + ordercolumns: '='
  4471 + },
  4472 + controllerAs: '$saOrderOptionCtrl',
  4473 + bindToController: true,
  4474 + controller: function() {
  4475 + var self = this;
  4476 +
  4477 + // 字段列表是否预载入
  4478 + self.$$columns_loaded = false;
  4479 + // 字段排序是否预载入
  4480 + self.$$ordercolumns_loaded = false;
  4481 +
  4482 +
  4483 + // 每组选项内部数据源
  4484 + // 格式:[{column:[选中的字段名],dir:[ASC/DESC]}]
  4485 + self.$$selectgroupds = [];
  4486 +
  4487 + // TODO:选择事件
  4488 +
  4489 + self.$$select_column_change = function() {
  4490 + self.$$refresh_selectgroupds();
  4491 + };
  4492 +
  4493 + self.$$select_dir_change = function() {
  4494 + self.$$refresh_selectgroupds();
  4495 + };
  4496 +
  4497 + self.$$add_option_click = function(index) {
  4498 + self.$$selectgroupds.splice(index, 0, {
  4499 + column: self.columns[0].name,
  4500 + dir: "ASC"
  4501 + });
  4502 + self.$$refresh_selectgroupds();
  4503 + };
  4504 + self.$$del_option_click = function(index) {
  4505 + self.$$selectgroupds.splice(index, 1);
  4506 + self.$$refresh_selectgroupds();
  4507 + };
  4508 +
  4509 + // 刷新选项内部数据源
  4510 + self.$$refresh_selectgroupds = function() {
  4511 + if (!self.$$columns_loaded || !self.$$ordercolumns_loaded || self.columns.length == 0) {
  4512 + // 没有载入完成,或者字段列表为空
  4513 + return;
  4514 + }
  4515 +
  4516 + if (self.$$selectgroupds.length == 0) { // 默认添加一组排序
  4517 + self.$$selectgroupds.push({
  4518 + column: self.columns[0].name,
  4519 + dir: "ASC"
  4520 + });
  4521 + }
  4522 +
  4523 + // 重新计算ordercolumns
  4524 +
  4525 + var aColumn = [];
  4526 + var aDir = [];
  4527 + for (var i = 0; i < self.$$selectgroupds.length; i++) {
  4528 + aColumn.push(self.$$selectgroupds[i].column);
  4529 + aDir.push(self.$$selectgroupds[i].dir);
  4530 + }
  4531 + if (self.ordercolumns) {
  4532 + self.ordercolumns.order = aColumn.join(",");
  4533 + self.ordercolumns.direction = aDir.join(",");
  4534 + } else {
  4535 + self.ordercolumns = {order: aColumn.join(","), direction: aDir.join(",")}
  4536 + }
  4537 +
  4538 + }
  4539 + },
  4540 + compile: function(tElem, tAttrs) {
  4541 + // 获取所有属性,并验证
  4542 + var $name_attr = tAttrs['name']; // 控件的名字
  4543 + if (!$name_attr) {
  4544 + throw "必须有名称属性";
  4545 + }
  4546 +
  4547 + // controlAs名字
  4548 + var ctrlAs = '$saOrderOptionCtrl';
  4549 +
  4550 + // TODO:
  4551 +
  4552 +
  4553 +
  4554 + return {
  4555 + pre: function(scope, element, attr) {
  4556 +
  4557 + },
  4558 +
  4559 + post: function(scope, element, attr) {
  4560 +
  4561 + //--------------------- 监控属性方法 -------------------//
  4562 + // 监控字段名字列表
  4563 + scope.$watch(
  4564 + function() {
  4565 + return scope[ctrlAs].columns;
  4566 + },
  4567 + function(newValue, oldValue) {
  4568 + if (!scope[ctrlAs].$$columns_loaded) {
  4569 + // TODO:格式判定以后做,假设格式是对的
  4570 +
  4571 +
  4572 + }
  4573 +
  4574 + scope[ctrlAs].$$columns_loaded = true;
  4575 + scope[ctrlAs].$$refresh_selectgroupds();
  4576 + },
  4577 + true
  4578 + );
  4579 + // 监控字段排序列表
  4580 + scope.$watch(
  4581 + function() {
  4582 + return scope[ctrlAs].ordercolumns;
  4583 + },
  4584 + function(newValue, oldValue) {
  4585 + if (!scope[ctrlAs].$$ordercolumns_loaded) {
  4586 + if (newValue) {
  4587 + var aColumns = []; // 排序的字段
  4588 + var aDirs = []; // 排序字段对应的排序方向
  4589 +
  4590 + if (newValue.order) {
  4591 + aColumns = newValue.order.split(",");
  4592 + }
  4593 + if (newValue.direction) {
  4594 + aDirs = newValue.direction.split(",");
  4595 + }
  4596 +
  4597 + for (var i = 0; i < aColumns.length; i++) {
  4598 + if (i < aDirs.length) {
  4599 + scope[ctrlAs].$$selectgroupds.push({
  4600 + column: aColumns[i],
  4601 + dir: aDirs[i]
  4602 + });
  4603 + } else {
  4604 + scope[ctrlAs].$$selectgroupds.push({
  4605 + column: aColumns[i],
  4606 + dir: 'ASC'
  4607 + });
  4608 + }
  4609 + }
  4610 + }
  4611 + }
  4612 + scope[ctrlAs].$$ordercolumns_loaded = true;
  4613 + scope[ctrlAs].$$refresh_selectgroupds();
  4614 +
  4615 + },
  4616 + true
  4617 + );
  4618 + }
  4619 +
  4620 + };
  4621 + }
  4622 + };
  4623 + }
  4624 + ]
  4625 +);
4454 4626 /**
4455   - * saScpdate指令(非通用指令,只在排计划form中使用)。
  4627 + * saScpdate指令(非通用指令,只在排计划form中使用)。
4456 4628 * 属性如下:
4457 4629 * name(必须):控件的名字
4458 4630 * xlid(必须):线路id
... ... @@ -4592,7 +4764,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(
4592 4764 outbc: obj.outbc,
4593 4765 yybc: obj.yybc,
4594 4766  
4595   - errorbc: obj.errorbc
  4767 + errorbc: obj.errorbc,
  4768 +
  4769 + lineVersion: obj.lineVersion
4596 4770  
4597 4771 });
4598 4772  
... ... @@ -4680,6 +4854,194 @@ angular.module(&#39;ScheduleApp&#39;).directive(
4680 4854 }
4681 4855 ]
4682 4856 );
  4857 +/**
  4858 + * saSrule指令(非通用指令,只在排班计划form中使用)。
  4859 + * 属性如下:
  4860 + * name(必须):控件的名字
  4861 + * xlid(必须):线路id
  4862 + * from(必须):独立作用域-绑定的开始时间属性名
  4863 + * to(必须):独立作用域-绑定的结束时间属性名
  4864 + * error(必须):独立作用域-绑定的错误描述属性名
  4865 + */
  4866 +angular.module('ScheduleApp').directive(
  4867 + 'saSrule',
  4868 + [
  4869 + 'SchedulePlanManageService_g',
  4870 + function(service) {
  4871 + return {
  4872 + restrict: 'E',
  4873 + templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saSruleTemplate.html',
  4874 + scope: {
  4875 + from: '=',
  4876 + to: '=',
  4877 + xlid: '=',
  4878 + error: '='
  4879 + },
  4880 + controllerAs: '$saSruleCtrl',
  4881 + bindToController: true,
  4882 + controller: function() {
  4883 + var self = this;
  4884 +
  4885 + // 内部ng-model值,用于和required配对
  4886 + self.$$internalmodel = undefined;
  4887 +
  4888 + // 内部数据源(时刻表的一些信息)
  4889 + self.$$count = 0;
  4890 + self.$$qyCount = 0;
  4891 + self.$$qyErrorCount = 0;
  4892 + self.$$errorInfos = [];
  4893 +
  4894 + },
  4895 + compile: function(tElem, tAttrs) {
  4896 + // 获取所有属性,并验证
  4897 + var $name_attr = tAttrs['name']; // 控件的名字
  4898 + if (!$name_attr) {
  4899 + throw "必须有名称属性";
  4900 + }
  4901 +
  4902 + // controlAs名字
  4903 + var ctrlAs = '$saSruleCtrl';
  4904 +
  4905 + // 线路id
  4906 + var xl_id = undefined;
  4907 + // 开始时间
  4908 + var from_date = undefined;
  4909 + // 结束时间
  4910 + var to_date = undefined;
  4911 +
  4912 + // 内部添加required验证,将所有的错误应用到required验证上去
  4913 + tElem.find("div").attr("required", "");
  4914 +
  4915 + return {
  4916 + pre: function(scope, element, attr) {
  4917 +
  4918 + },
  4919 +
  4920 + post: function(scope, element, attr) {
  4921 + // 属性值
  4922 + if ($name_attr) {
  4923 + scope[ctrlAs]["$name_attr"] = $name_attr;
  4924 + }
  4925 +
  4926 + // 开始日期open属性,及方法
  4927 + scope[ctrlAs].$$fromDateOpen = false;
  4928 + scope[ctrlAs].$$fromDate_open = function() {
  4929 + scope[ctrlAs].$$fromDateOpen = true;
  4930 + };
  4931 +
  4932 + // 结束日期open属性,及方法
  4933 + scope[ctrlAs].$$toDateOpen = false;
  4934 + scope[ctrlAs].$$toDate_open = function() {
  4935 + scope[ctrlAs].$$toDateOpen = true;
  4936 + };
  4937 +
  4938 + // 内部模型刷新
  4939 + scope[ctrlAs].$$internal_model_refresh = function() {
  4940 + if (!xl_id) {
  4941 + scope[ctrlAs].$$internalmodel = undefined;
  4942 + scope[ctrlAs].error = "线路必须选择";
  4943 + return;
  4944 + }
  4945 + if (!from_date) {
  4946 + scope[ctrlAs].$$internalmodel = undefined;
  4947 + scope[ctrlAs].error = "开始日期必须选择";
  4948 + return;
  4949 + }
  4950 + if (!to_date) {
  4951 + scope[ctrlAs].$$internalmodel = undefined;
  4952 + scope[ctrlAs].error = "结束日期必须选择";
  4953 + return;
  4954 + }
  4955 + if (from_date > to_date) {
  4956 + scope[ctrlAs].$$internalmodel = undefined;
  4957 + scope[ctrlAs].error = "开始日期必须在结束日期之前";
  4958 + return;
  4959 + }
  4960 +
  4961 + scope[ctrlAs].$$count = 0;
  4962 + scope[ctrlAs].$$qyCount = 0;
  4963 + scope[ctrlAs].$$qyErrorCount = 0;
  4964 + scope[ctrlAs].$$errorInfos = [];
  4965 +
  4966 + if (scope[ctrlAs].$$qyCount == 0) {
  4967 + scope[ctrlAs].$$internalmodel = undefined;
  4968 + scope[ctrlAs].error = "无可启用的规则数";
  4969 + }
  4970 +
  4971 + var QClass = service.v_rules;
  4972 + QClass.val({xlid: xl_id, from: from_date, to: to_date},
  4973 + function(result) {
  4974 + scope[ctrlAs].$$count = result.data.count;
  4975 + scope[ctrlAs].$$qyCount = result.data.qyCount;
  4976 + scope[ctrlAs].$$qyErrorCount = result.data.qyErrorCount;
  4977 +
  4978 + angular.forEach(result.data.errorInfos, function(obj) {
  4979 + scope[ctrlAs].$$errorInfos.push({
  4980 + ruleId: obj.ruleId,
  4981 + clZbh: obj.clZbh,
  4982 + qyrq: moment(obj.qyrq).format("YYYY年MM月DD日"),
  4983 + infos: obj.errorDescList.join("")
  4984 + });
  4985 + });
  4986 +
  4987 + if (scope[ctrlAs].$$qyErrorCount > 0) {
  4988 + scope[ctrlAs].$$internalmodel = undefined;
  4989 + scope[ctrlAs].error = "有错误的规则";
  4990 + } else {
  4991 + scope[ctrlAs].$$internalmodel = "ok";
  4992 + scope[ctrlAs].$$errorInfos = [];
  4993 + }
  4994 + },
  4995 + function() {
  4996 + scope[ctrlAs].$$internalmodel = undefined;
  4997 + scope[ctrlAs].error = "获取规则数据失败!";
  4998 + }
  4999 + );
  5000 +
  5001 + scope[ctrlAs].$$internalmodel = "ok";
  5002 + };
  5003 +
  5004 + scope[ctrlAs].$$internal_model_refresh(); // 初始执行
  5005 +
  5006 + //--------------------- 监控属性方法 -------------------//
  5007 + // 监控线路id模型值变化
  5008 + scope.$watch(
  5009 + function() {
  5010 + return scope[ctrlAs].xlid;
  5011 + },
  5012 + function(newValue, oldValue) {
  5013 + xl_id = newValue;
  5014 + scope[ctrlAs].$$internal_model_refresh();
  5015 + }
  5016 + );
  5017 +
  5018 + // 监控开始时间模型值变化
  5019 + scope.$watch(
  5020 + function() {
  5021 + return scope[ctrlAs].from;
  5022 + },
  5023 + function(newValue, oldValue) {
  5024 + from_date = newValue;
  5025 + scope[ctrlAs].$$internal_model_refresh();
  5026 + }
  5027 + );
  5028 + // 监控结束时间模型值变化
  5029 + scope.$watch(
  5030 + function() {
  5031 + return scope[ctrlAs].to;
  5032 + },
  5033 + function(newValue, oldValue) {
  5034 + to_date = newValue;
  5035 + scope[ctrlAs].$$internal_model_refresh();
  5036 + }
  5037 + );
  5038 + }
  5039 + };
  5040 + }
  5041 + };
  5042 + }
  5043 + ]
  5044 +);
4683 5045 /**
4684 5046 * saPlaninfoedit指令,排班明细编辑控件,用在调度执勤日报的修改功能
4685 5047 * name(必须),控件的名字
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -447,6 +447,18 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
447 447 }
448 448 )
449 449 },
  450 + cc_cars_2: { // 车辆不能重复配置2
  451 + template: {'xlId': -1, 'clId': -1}, // 查询参数模版
  452 + remote: $resource( // $resource封装对象
  453 + '/cci/validate_cars_2',
  454 + {},
  455 + {
  456 + do: {
  457 + method: 'GET'
  458 + }
  459 + }
  460 + )
  461 + },
450 462 cc_cars_gs: { // 车辆是否属于当前用户所属公司
451 463 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
452 464 remote: $resource( // $resource封装对象
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -84,7 +84,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
84 84 angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
85 85 return $resource(
86 86 '/cde_sc/:id',
87   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id'},
  87 + {order: 'xl,clZbh,qyrq', direction: 'ASC,ASC,DESC', id: '@id'},
88 88 {
89 89 list: {
90 90 method: 'GET',
... ... @@ -129,7 +129,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
129 129 return {
130 130 rest : $resource(
131 131 '/ee/:id',
132   - {order: 'jobCode', direction: 'ASC', id: '@id'},
  132 + {order: 'jobCodeori', direction: 'ASC', id: '@id'},
133 133 {
134 134 list: {
135 135 method: 'GET',
... ... @@ -189,7 +189,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService_g&#39;, [&#39;$resource&#39;, &#39;UserP
189 189 return {
190 190 rest : $resource(
191 191 '/cci/:id',
192   - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id'},
  192 + {order: 'xl.name,cl.insideCode,isCancel', direction: 'ASC', id: '@id'},
193 193 {
194 194 list: {
195 195 method: 'GET',
... ... @@ -260,7 +260,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f
260 260 return {
261 261 rest : $resource(
262 262 '/eci/:id',
263   - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id'},
  263 + {order: 'xl.name,isCancel,dbbmFormula', direction: 'ASC', id: '@id'},
264 264 {
265 265 list: {
266 266 method: 'GET',
... ... @@ -459,7 +459,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
459 459 return {
460 460 rest : $resource(
461 461 '/spc/:id',
462   - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id'},
  462 + {order: 'xl.name,createDate', direction: 'DESC,DESC', id: '@id'},
463 463 {
464 464 list: {
465 465 method: 'GET',
... ... @@ -511,6 +511,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
511 511 method: 'GET'
512 512 }
513 513 }
  514 + ),
  515 + v_rules: $resource(
  516 + '/spc/valttrule/:xlid/:from/:to',
  517 + {xlid: '@xlid', from: '@from', to: '@to'},
  518 + {
  519 + val: {
  520 + method: 'GET'
  521 + }
  522 + }
514 523 )
515 524 };
516 525 }]);
... ... @@ -618,7 +627,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;ScheduleRuleManageService_g&#39;, [&#39;$resource
618 627 return {
619 628 rest: $resource(
620 629 '/sr1fc/:id',
621   - {order: 'xl.id,updateDate,carConfigInfo.cl.insideCode', direction: 'ASC,DESC,ASC', id: '@id'},
  630 + {order: 'xl.name,updateDate,carConfigInfo.cl.insideCode', direction: 'ASC,DESC,ASC', id: '@id'},
622 631 {
623 632 list: {
624 633 method: 'GET',
... ... @@ -681,7 +690,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
681 690 return {
682 691 rest: $resource(
683 692 '/tic_ec/:id',
684   - {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  693 + {order: 'xl.name,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
685 694 {
686 695 list: {
687 696 method: 'GET',
... ... @@ -1325,6 +1334,18 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
1325 1334 }
1326 1335 )
1327 1336 },
  1337 + cc_cars_2: { // 车辆不能重复配置2
  1338 + template: {'xlId': -1, 'clId': -1}, // 查询参数模版
  1339 + remote: $resource( // $resource封装对象
  1340 + '/cci/validate_cars_2',
  1341 + {},
  1342 + {
  1343 + do: {
  1344 + method: 'GET'
  1345 + }
  1346 + }
  1347 + )
  1348 + },
1328 1349 cc_cars_gs: { // 车辆是否属于当前用户所属公司
1329 1350 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
1330 1351 remote: $resource( // $resource封装对象
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/detail.html
... ... @@ -58,6 +58,22 @@
58 58 </div>
59 59  
60 60 <div class="form-group has-success has-feedback">
  61 + <label class="col-md-2 control-label">所在公司:</label>
  62 + <div class="col-md-3">
  63 + <input type="text" class="form-control" name="cl"
  64 + ng-model="ctrl.busConfigForDetail.cl.company" readonly/>
  65 + </div>
  66 + </div>
  67 +
  68 + <div class="form-group has-success has-feedback">
  69 + <label class="col-md-2 control-label">所在分公司:</label>
  70 + <div class="col-md-3">
  71 + <input type="text" class="form-control" name="cl"
  72 + ng-model="ctrl.busConfigForDetail.cl.brancheCompany" readonly/>
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="form-group has-success has-feedback">
61 77 <label class="col-md-2 control-label">启用日期*:</label>
62 78 <div class="col-md-4">
63 79 <input type="text" class="form-control"
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="BusConfigCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">配置表</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加配置
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
... ... @@ -6,12 +6,14 @@
6 6 <tr role="row" class="heading">
7 7 <th style="width: 70px;">序号</th>
8 8 <th style="width: 150px;">线路</th>
9   - <th style="width: 150px;">内部编号</th>
10   - <th style="width: 150px;">设备编号</th>
11   - <th style="width: 150px;">启用日期</th>
  9 + <th style="width: 150px;">所在公司</th>
  10 + <th style="width: 160px;">所在分公司</th>
  11 + <th style="width: 100px;">内部编号</th>
  12 + <th style="width: 100px;">设备编号</th>
  13 + <th style="width: 100px;">启用日期</th>
12 14 <th >停车点</th>
13 15 <th style="width: 80px;" >状态</th>
14   - <th style="width: 21%">操作</th>
  16 + <th>操作</th>
15 17 </tr>
16 18 <tr role="row" class="filter">
17 19 <td></td>
... ... @@ -32,6 +34,36 @@
32 34 </div>
33 35 </td>
34 36 <td>
  37 + <sa-Select5 name="gs"
  38 + model="ctrl.searchCondition()"
  39 + cmaps="{'cl.businessCode_eq': 'businessCode'}"
  40 + dcname="cl.businessCode_eq"
  41 + icname="businessCode"
  42 + dsparams="{{ {type: 'ajax', param:{'upCode_eq': '88' }, atype:'gs' } | json }}"
  43 + iterobjname="item"
  44 + iterobjexp="item.businessName"
  45 + searchph="请输拼音..."
  46 + searchexp="this.businessName"
  47 + required
  48 + >
  49 + </sa-Select5>
  50 + </td>
  51 + <td>
  52 + <sa-Select5 name="fgs"
  53 + model="ctrl.searchCondition()"
  54 + cmaps="{'cl.brancheCompanyCode_eq': 'businessCode'}"
  55 + dcname="cl.brancheCompanyCode_eq"
  56 + icname="businessCode"
  57 + dsparams="{{ {type: 'ajax', param:{'upCode_eq': ctrl.searchCondition()['cl.businessCode_eq'] }, atype:'gs' } | json }}"
  58 + iterobjname="item"
  59 + iterobjexp="item.businessName"
  60 + searchph="请输拼音..."
  61 + searchexp="this.businessName"
  62 + required
  63 + >
  64 + </sa-Select5>
  65 + </td>
  66 + <td>
35 67 <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['cl.insideCode_like']" placeholder="输入内部编号..."/>
36 68 </td>
37 69 <td></td>
... ... @@ -43,9 +75,24 @@
43 75 </label>
44 76 </td>
45 77 <td>
46   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
47   - ng-click="ctrl.doPage()">
48   - <i class="fa fa-search"></i> 搜索</button>
  78 + <div class="btn-group">
  79 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  80 + ng-click="ctrl.doPage()">
  81 + <i class="fa fa-search"></i> 搜索</button>
  82 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  83 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  84 + <span class="caret"></span>
  85 + <span class="sr-only">dropdown</span>
  86 + </button>
  87 + <ul class="dropdown-menu pull-right">
  88 + <li>
  89 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  90 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  91 + 排序选项
  92 + </a>
  93 + </li>
  94 + </ul>
  95 + </div>
49 96  
50 97 <button class="btn btn-sm red btn-outline filter-cancel"
51 98 ng-click="ctrl.reset()">
... ... @@ -69,6 +116,12 @@
69 116 <span ng-bind="info.xl.name"></span>
70 117 </td>
71 118 <td>
  119 + <span ng-bind="info.cl.company"></span>
  120 + </td>
  121 + <td>
  122 + <span ng-bind="info.cl.brancheCompany"></span>
  123 + </td>
  124 + <td>
72 125 <span ng-bind="info.cl.insideCode"></span>
73 126 </td>
74 127 <td>
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
... ... @@ -19,6 +19,22 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "company", desc: "所在公司"},
  26 + {name: "brancheCompany", desc: "分公司"},
  27 + {name: "cl.insideCode", desc: "内部编号"},
  28 + {name: "equipmentCode", desc: "设备编号"},
  29 + {name: "qyrq", desc: "启用日期"},
  30 + {name: "isCancel", desc: "是否作废"}
  31 + ];
  32 + // 排序字段
  33 + var orderColumns = {
  34 + order: "xl.name,cl.insideCode,isCancel",
  35 + direction: "ASC,ASC,ASC"
  36 + };
  37 +
22 38 // 查询对象
23 39 var queryClass = service.rest;
24 40  
... ... @@ -26,6 +42,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 42 getQueryClass: function() {
27 43 return queryClass;
28 44 },
  45 + getColumns: function() {
  46 + return columns;
  47 + },
  48 + getOrderColumns: function() {
  49 + return orderColumns;
  50 + },
29 51 /**
30 52 * 获取查询条件信息,
31 53 * 用于给controller用来和页面数据绑定。
... ... @@ -38,6 +60,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
38 60 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
39 61 }
40 62  
  63 + // 重置排序字段条件
  64 + currentSearchCondition.order = orderColumns.order;
  65 + currentSearchCondition.direction = orderColumns.direction;
  66 +
41 67 return currentSearchCondition;
42 68 },
43 69 /**
... ... @@ -193,7 +219,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
193 219 'BusConfigListCtrl',
194 220 [
195 221 'BusConfigService',
196   - function(service) {
  222 + '$uibModal',
  223 + function(service, $uibModal) {
197 224 var self = this;
198 225 var BusConfig = service.getQueryClass();
199 226  
... ... @@ -228,6 +255,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
228 255  
229 256 self.doPage();
230 257  
  258 + self.customOrder = function() {
  259 + // large方式弹出模态对话框
  260 + var modalInstance = $uibModal.open({
  261 + templateUrl: '/pages/scheduleApp/module/core/busConfig/orderOptionOpen.html',
  262 + size: "sm",
  263 + animation: true,
  264 + backdrop: 'static',
  265 + resolve: {
  266 + },
  267 + windowClass: 'center-modal',
  268 + controller: "BusConfigListOrderOptionModalInstanceCtrl",
  269 + controllerAs: "$ctrl",
  270 + bindToController: true
  271 + });
  272 + modalInstance.result.then(
  273 + function(result) {
  274 + console.log("dataImport.html打开");
  275 + },
  276 + function() {
  277 + console.log("dataImport.html消失");
  278 + }
  279 + );
  280 + };
  281 +
  282 + }
  283 + ]
  284 +);
  285 +
  286 +angular.module('ScheduleApp').controller(
  287 + "BusConfigListOrderOptionModalInstanceCtrl",
  288 + [
  289 + "BusConfigService",
  290 + "$modalInstance",
  291 + function(service, $modalInstance) {
  292 + var self = this;
  293 +
  294 + self.columns = service.getColumns();
  295 + self.orderColumns = service.getOrderColumns();
  296 +
  297 + self.confirm = function(result) {
  298 + // console.log(result);
  299 + // console.log(service.getOrderColumns());
  300 + $modalInstance.dismiss("cancel");
  301 +
  302 + }
231 303 }
232 304 ]
233 305 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusConfigService_g&#39;, [&#39;$resource&#39;, &#39;UserP
3 3 return {
4 4 rest : $resource(
5 5 '/cci/:id',
6   - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id'},
  6 + {order: 'xl.name,cl.insideCode,isCancel', direction: 'ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="EmployeeConfigCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">配置表</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加配置
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
... ... @@ -51,9 +51,24 @@
51 51 </label>
52 52 </td>
53 53 <td>
54   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
55   - ng-click="ctrl.doPage()">
56   - <i class="fa fa-search"></i> 搜索</button>
  54 + <div class="btn-group">
  55 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  56 + ng-click="ctrl.doPage()">
  57 + <i class="fa fa-search"></i> 搜索</button>
  58 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  59 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  60 + <span class="caret"></span>
  61 + <span class="sr-only">dropdown</span>
  62 + </button>
  63 + <ul class="dropdown-menu pull-right">
  64 + <li>
  65 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  66 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  67 + 排序选项
  68 + </a>
  69 + </li>
  70 + </ul>
  71 + </div>
57 72  
58 73 <button class="btn btn-sm red btn-outline filter-cancel"
59 74 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/module.js
... ... @@ -19,6 +19,22 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "dbbmFormula", desc: "搭班编码"},
  26 + {name: "jsy.jobCodeori", desc: "驾驶员工号"},
  27 + {name: "jsy.personnelName", desc: "驾驶员姓名"},
  28 + {name: "spy.jobCodeori", desc: "售票员工号"},
  29 + {name: "spy.personnelName", desc: "售票员姓名"},
  30 + {name: "isCancel", desc: "是否作废"}
  31 + ];
  32 + // 排序字段
  33 + var orderColumns = {
  34 + order: "xl.name,isCancel,dbbmFormula",
  35 + direction: "ASC,ASC,ASC"
  36 + };
  37 +
22 38 // 查询对象类
23 39 var queryClass = service.rest;
24 40  
... ... @@ -26,6 +42,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 42 getQueryClass: function() {
27 43 return queryClass;
28 44 },
  45 + getColumns: function() {
  46 + return columns;
  47 + },
  48 + getOrderColumns: function() {
  49 + return orderColumns;
  50 + },
29 51 /**
30 52 * 获取查询条件信息,
31 53 * 用于给controller用来和页面数据绑定。
... ... @@ -38,6 +60,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
38 60 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
39 61 }
40 62  
  63 + // 重置排序字段条件
  64 + currentSearchCondition.order = orderColumns.order;
  65 + currentSearchCondition.direction = orderColumns.direction;
  66 +
41 67 return currentSearchCondition;
42 68 },
43 69 /**
... ... @@ -198,7 +224,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
198 224 'EmployeeConfigListCtrl',
199 225 [
200 226 'EmployeeConfigService',
201   - function(service) {
  227 + '$uibModal',
  228 + function(service, $uibModal) {
202 229 var self = this;
203 230 var EmpConfig = service.getQueryClass();
204 231  
... ... @@ -232,6 +259,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
232 259 };
233 260  
234 261 self.doPage();
  262 +
  263 + self.customOrder = function() {
  264 + // large方式弹出模态对话框
  265 + var modalInstance = $uibModal.open({
  266 + templateUrl: '/pages/scheduleApp/module/core/employeeConfig/orderOptionOpen.html',
  267 + size: "sm",
  268 + animation: true,
  269 + backdrop: 'static',
  270 + resolve: {
  271 + },
  272 + windowClass: 'center-modal',
  273 + controller: "EmployeeConfigListOrderOptionModalInstanceCtrl",
  274 + controllerAs: "$ctrl",
  275 + bindToController: true
  276 + });
  277 + modalInstance.result.then(
  278 + function(result) {
  279 + console.log("dataImport.html打开");
  280 + },
  281 + function() {
  282 + console.log("dataImport.html消失");
  283 + }
  284 + );
  285 + };
  286 + }
  287 + ]
  288 +);
  289 +
  290 +angular.module('ScheduleApp').controller(
  291 + "EmployeeConfigListOrderOptionModalInstanceCtrl",
  292 + [
  293 + "EmployeeConfigService",
  294 + "$modalInstance",
  295 + function(service, $modalInstance) {
  296 + var self = this;
  297 +
  298 + self.columns = service.getColumns();
  299 + self.orderColumns = service.getOrderColumns();
  300 +
  301 + self.confirm = function(result) {
  302 + // console.log(result);
  303 + // console.log(service.getOrderColumns());
  304 + $modalInstance.dismiss("cancel");
  305 +
  306 + }
235 307 }
236 308 ]
237 309 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeConfigService_g&#39;, [&#39;$resource&#39;, f
3 3 return {
4 4 rest : $resource(
5 5 '/eci/:id',
6   - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id'},
  6 + {order: 'xl.name,isCancel,dbbmFormula', direction: 'ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="GuideboardManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">路牌表</span>
28 37 </div>
29 38 <div class="actions">
30   - <a ui-sref="guideboardManage_form" class="btn btn-circle blue">
  39 + <a ui-sref="guideboardManage_form" class="btn blue">
31 40 <i class="fa fa-plus"></i>
32 41 添加路牌
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/list.html
... ... @@ -41,9 +41,24 @@
41 41 </label>
42 42 </td>
43 43 <td>
44   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
45   - ng-click="ctrl.doPage()">
46   - <i class="fa fa-search"></i> 搜索</button>
  44 + <div class="btn-group">
  45 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  46 + ng-click="ctrl.doPage()">
  47 + <i class="fa fa-search"></i> 搜索</button>
  48 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  49 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  50 + <span class="caret"></span>
  51 + <span class="sr-only">dropdown</span>
  52 + </button>
  53 + <ul class="dropdown-menu pull-right">
  54 + <li>
  55 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  56 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  57 + 排序选项
  58 + </a>
  59 + </li>
  60 + </ul>
  61 + </div>
47 62  
48 63 <button class="btn btn-sm red btn-outline filter-cancel"
49 64 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/module.js
... ... @@ -20,6 +20,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(
20 20 uiToRecord: 0 // 页面绑定,当前页到第几条记录
21 21 };
22 22  
  23 + // 字段描述
  24 + var columns = [
  25 + {name: "xl.name", desc: "线路名称"},
  26 + {name: "lpNo", desc: "路牌编号"},
  27 + {name: "lpName", desc: "路牌名称"},
  28 + {name: "lpType", desc: "路牌类型"},
  29 + {name: "isCancel", desc: "是否作废"}
  30 + ];
  31 + // 排序字段
  32 + var orderColumns = {
  33 + order: "xl.name,isCancel,lpNo",
  34 + direction: "DESC,ASC,ASC"
  35 + };
  36 +
23 37 // 查询对象类
24 38 var queryClass = service.rest;
25 39  
... ... @@ -27,7 +41,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
27 41 getGbQueryClass: function() {
28 42 return queryClass;
29 43 },
30   -
  44 + getColumns: function() {
  45 + return columns;
  46 + },
  47 + getOrderColumns: function() {
  48 + return orderColumns;
  49 + },
31 50 /**
32 51 * 获取查询条件信息,
33 52 * 用于给controller用来和页面数据绑定。
... ... @@ -40,6 +59,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
40 59 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
41 60 }
42 61  
  62 + // 重置排序字段条件
  63 + currentSearchCondition.order = orderColumns.order;
  64 + currentSearchCondition.direction = orderColumns.direction;
  65 +
43 66 return currentSearchCondition;
44 67 },
45 68 /**
... ... @@ -201,7 +224,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
201 224 'GuideboardManageListCtrl',
202 225 [
203 226 'GuideboardManageService',
204   - function(service) {
  227 + '$uibModal',
  228 + function(service, $uibModal) {
205 229 var self = this;
206 230 var Gb = service.getGbQueryClass();
207 231  
... ... @@ -236,6 +260,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
236 260 };
237 261  
238 262 self.doPage();
  263 +
  264 + self.customOrder = function() {
  265 + // large方式弹出模态对话框
  266 + var modalInstance = $uibModal.open({
  267 + templateUrl: '/pages/scheduleApp/module/core/guideboardManage/orderOptionOpen.html',
  268 + size: "sm",
  269 + animation: true,
  270 + backdrop: 'static',
  271 + resolve: {
  272 + },
  273 + windowClass: 'center-modal',
  274 + controller: "GuideboardManageListOrderOptionModalInstanceCtrl",
  275 + controllerAs: "$ctrl",
  276 + bindToController: true
  277 + });
  278 + modalInstance.result.then(
  279 + function(result) {
  280 + console.log("dataImport.html打开");
  281 + },
  282 + function() {
  283 + console.log("dataImport.html消失");
  284 + }
  285 + );
  286 + };
  287 + }
  288 + ]
  289 +);
  290 +
  291 +angular.module('ScheduleApp').controller(
  292 + "GuideboardManageListOrderOptionModalInstanceCtrl",
  293 + [
  294 + "GuideboardManageService",
  295 + "$modalInstance",
  296 + function(service, $modalInstance) {
  297 + var self = this;
  298 +
  299 + self.columns = service.getColumns();
  300 + self.orderColumns = service.getOrderColumns();
  301 +
  302 + self.confirm = function(result) {
  303 + // console.log(result);
  304 + // console.log(service.getOrderColumns());
  305 + $modalInstance.dismiss("cancel");
  306 +
  307 + }
239 308 }
240 309 ]
241 310 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;GuideboardManageService_g&#39;, [&#39;$resource&#39;,
3 3 return {
4 4 rest: $resource(
5 5 '/gic/:id',
6   - {order: 'xl,isCancel,lpNo', direction: 'DESC,ASC,ASC', id: '@id'},
  6 + {order: 'xl.name,isCancel,lpNo', direction: 'DESC,ASC,ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="RerunManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,7 +36,7 @@
27 36 <span class="caption-subject bold uppercase">套跑信息</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加套跑
33 42 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/list.html
... ... @@ -5,13 +5,13 @@
5 5 <tr role="row" class="heading">
6 6 <th style="width: 70px;">序号</th>
7 7 <th style="width: 150px;">套跑线路</th>
8   - <th style="width: 180px">套跑时刻表/路牌</th>
  8 + <th >套跑时刻表/路牌</th>
9 9 <th style="width: 100px">套跑类型</th>
10 10 <th style="width: 150px;">线路</th>
11   - <th style="width: 50px">路牌</th>
  11 + <th style="width: 100px">路牌</th>
12 12 <th width="100px">车辆</th>
13 13 <th width="80px">状态</th>
14   - <th style="width: 21%">操作</th>
  14 + <th >操作</th>
15 15 </tr>
16 16 <tr role="row" class="filter">
17 17 <td></td>
... ... @@ -40,9 +40,24 @@
40 40 </label>
41 41 </td>
42 42 <td>
43   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
44   - ng-click="ctrl.doPage()">
45   - <i class="fa fa-search"></i> 搜索</button>
  43 + <div class="btn-group">
  44 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  45 + ng-click="ctrl.doPage()">
  46 + <i class="fa fa-search"></i> 搜索</button>
  47 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  48 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  49 + <span class="caret"></span>
  50 + <span class="sr-only">dropdown</span>
  51 + </button>
  52 + <ul class="dropdown-menu pull-right">
  53 + <li>
  54 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  55 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  56 + 排序选项
  57 + </a>
  58 + </li>
  59 + </ul>
  60 + </div>
46 61  
47 62 <button class="btn btn-sm red btn-outline filter-cancel"
48 63 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/module.js
... ... @@ -19,6 +19,21 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "rerunXl.name", desc: "套跑线路"},
  25 + {name: "rerunTtinfo.name", desc: "套跑时刻表"},
  26 + {name: "rerunLp.lpName", desc: "套跑路牌"},
  27 + {name: "rerunType", desc: "套跑类型"},
  28 + {name: "useXl.name", desc: "线路"},
  29 + {name: "isCancel", desc: "是否作废"}
  30 + ];
  31 + // 排序字段
  32 + var orderColumns = {
  33 + order: "rerunXl.name,isCancel",
  34 + direction: "ASC,ASC"
  35 + };
  36 +
22 37 // 查询对象
23 38 var queryClass = service.rest;
24 39  
... ... @@ -26,6 +41,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 41 getQueryClass: function() {
27 42 return queryClass;
28 43 },
  44 + getColumns: function() {
  45 + return columns;
  46 + },
  47 + getOrderColumns: function() {
  48 + return orderColumns;
  49 + },
29 50 getSearchCondition: function() {
30 51 currentSearchCondition.page = currentPage.uiNumber - 1;
31 52  
... ... @@ -34,6 +55,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 55 currentSearchCondition["rerunXl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
35 56 }
36 57  
  58 + // 重置排序字段条件
  59 + currentSearchCondition.order = orderColumns.order;
  60 + currentSearchCondition.direction = orderColumns.direction;
  61 +
37 62 return currentSearchCondition;
38 63 },
39 64 getPage: function(page) {
... ... @@ -91,7 +116,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
91 116 'RerunManageListCtrl',
92 117 [
93 118 'RerunManageService',
94   - function(service) {
  119 + '$uibModal',
  120 + function(service, $uibModal) {
95 121 var self = this;
96 122 var RM = service.getQueryClass();
97 123  
... ... @@ -126,11 +152,55 @@ angular.module(&#39;ScheduleApp&#39;).controller(
126 152  
127 153 self.doPage();
128 154  
  155 + self.customOrder = function() {
  156 + // large方式弹出模态对话框
  157 + var modalInstance = $uibModal.open({
  158 + templateUrl: '/pages/scheduleApp/module/core/rerunManage/orderOptionOpen.html',
  159 + size: "sm",
  160 + animation: true,
  161 + backdrop: 'static',
  162 + resolve: {
  163 + },
  164 + windowClass: 'center-modal',
  165 + controller: "RerunManageListOrderOptionModalInstanceCtrl",
  166 + controllerAs: "$ctrl",
  167 + bindToController: true
  168 + });
  169 + modalInstance.result.then(
  170 + function(result) {
  171 + console.log("dataImport.html打开");
  172 + },
  173 + function() {
  174 + console.log("dataImport.html消失");
  175 + }
  176 + );
  177 + };
129 178  
130 179 }
131 180 ]
132 181 );
133 182  
  183 +angular.module('ScheduleApp').controller(
  184 + "RerunManageListOrderOptionModalInstanceCtrl",
  185 + [
  186 + "RerunManageService",
  187 + "$modalInstance",
  188 + function(service, $modalInstance) {
  189 + var self = this;
  190 +
  191 + self.columns = service.getColumns();
  192 + self.orderColumns = service.getOrderColumns();
  193 +
  194 + self.confirm = function(result) {
  195 + // console.log(result);
  196 + // console.log(service.getOrderColumns());
  197 + $modalInstance.dismiss("cancel");
  198 +
  199 + }
  200 + }
  201 + ]
  202 +);
  203 +
134 204 // form.html控制器
135 205 angular.module('ScheduleApp').controller(
136 206 'RerunManageFormCtrl',
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;rerunManageService_g&#39;, [&#39;$resource&#39;, func
3 3 return {
4 4 rest: $resource(
5 5 '/rms/:id',
6   - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id'},
  6 + {order: 'rerunXl.name,isCancel', direction: 'ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/form.html
... ... @@ -127,6 +127,23 @@
127 127 </div>
128 128  
129 129 <div class="form-group has-success has-feedback">
  130 + <label class="col-md-2 control-label">规则信息*:</label>
  131 + <div class="col-md-6">
  132 + <sa-Srule name="s_rule_s_t_date"
  133 + xlid="ctrl.schedulePlanManageForSave.xl.id"
  134 + from="ctrl.schedulePlanManageForSave.scheduleFromTime"
  135 + to="ctrl.schedulePlanManageForSave.scheduleToTime"
  136 + error="ctrl.sruleerror"
  137 + required
  138 + >
  139 + </sa-Srule>
  140 + </div>
  141 + <div class="alert alert-danger well-sm" ng-show="myForm.s_rule_s_t_date.$error.required">
  142 + {{ctrl.sruleerror}}
  143 + </div>
  144 + </div>
  145 +
  146 + <div class="form-group has-success has-feedback">
130 147 <label class="col-md-2 control-label">模式1(历史排班优先):</label>
131 148 <div class="col-md-3">
132 149 <sa-Radiogroup model="ctrl.schedulePlanManageForSave.isHistoryPlanFirst" dicgroup="truefalseType" name="isHistoryPlanFirst"></sa-Radiogroup>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="SchedulePlanManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,7 +36,7 @@
27 36 <span class="caption-subject bold uppercase">排班计划</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 生成计划
33 42 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
... ... @@ -63,9 +63,24 @@
63 63 <td></td>
64 64 <td></td>
65 65 <td>
66   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
67   - ng-click="ctrl.doPage()">
68   - <i class="fa fa-search"></i> 搜索</button>
  66 + <div class="btn-group">
  67 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  68 + ng-click="ctrl.doPage()">
  69 + <i class="fa fa-search"></i> 搜索</button>
  70 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  71 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  72 + <span class="caret"></span>
  73 + <span class="sr-only">dropdown</span>
  74 + </button>
  75 + <ul class="dropdown-menu pull-right">
  76 + <li>
  77 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  78 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  79 + 排序选项
  80 + </a>
  81 + </li>
  82 + </ul>
  83 + </div>
69 84  
70 85 <button class="btn btn-sm red btn-outline filter-cancel"
71 86 ng-click="ctrl.reset()">
... ... @@ -93,7 +108,7 @@
93 108 tooltip-placement="top"
94 109 uib-tooltip="{{tinfo.ttInfoName}}"
95 110 tooltip-class="headClass"
96   - ui-sref="ttInfoDetailManage_edit3({xlid: info.xl.id, ttid : tinfo.ttInfoId, xlname: info.xl.name, ttname : tinfo.ttInfoName, rflag : true})">
  111 + ui-sref="ttInfoDetailManage_edit3({xlid: info.xl.id, ttid : tinfo.ttInfoId, xlname: info.xl.name, ttname : tinfo.ttInfoName, rflag : true, lineversion: tinfo.lineVersion})">
97 112 <i class="fa fa-table" aria-hidden="true"></i>
98 113 {{tinfo.ttInfoName}}
99 114 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/module.js
... ... @@ -19,6 +19,19 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "scheduleFromTime", desc: "排班开始日期"},
  26 + {name: "scheduleToTime", desc: "排班结束日期"},
  27 + {name: "createDate", desc: "操作时间"}
  28 + ];
  29 + // 排序字段
  30 + var orderColumns = {
  31 + order: "xl.name,createDate",
  32 + direction: "DESC,DESC"
  33 + };
  34 +
22 35 // 查询对象
23 36 var queryClass = service.rest;
24 37  
... ... @@ -26,6 +39,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 39 getQueryClass: function() {
27 40 return queryClass;
28 41 },
  42 + getColumns: function() {
  43 + return columns;
  44 + },
  45 + getOrderColumns: function() {
  46 + return orderColumns;
  47 + },
29 48 getSearchCondition: function() {
30 49 currentSearchCondition.page = currentPage.uiNumber - 1;
31 50  
... ... @@ -34,6 +53,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 53 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
35 54 }
36 55  
  56 + // 重置排序字段条件
  57 + currentSearchCondition.order = orderColumns.order;
  58 + currentSearchCondition.direction = orderColumns.direction;
  59 +
37 60 return currentSearchCondition;
38 61 },
39 62 getPage: function(page) {
... ... @@ -90,7 +113,9 @@ angular.module(&#39;ScheduleApp&#39;).controller(
90 113 [
91 114 'SchedulePlanManageService',
92 115 '$filter',
93   - function(service, $filter) {
  116 + 'TTInfoManageService_g',
  117 + '$uibModal',
  118 + function(service, $filter, ttInfoService, $uibModal) {
94 119 var self = this;
95 120 // 日期 日期控件开关
96 121 self.scheduleFromTime = false;
... ... @@ -118,24 +143,31 @@ angular.module(&#39;ScheduleApp&#39;).controller(
118 143 // 重新组装关联时刻表信息
119 144 if (page.content) {
120 145 angular.forEach(page.content, function(ttinfo) {
121   - var rst = [];
122   - var temp1 = [];
123   - var temp2 = [];
124   - if (ttinfo.ttInfoNames && ttinfo.ttInfoIds) {
125   - temp1 = ttinfo.ttInfoNames.split(",");
126   - temp2 = ttinfo.ttInfoIds.split(",");
127   - }
  146 + (function(obj) {
  147 + var rst = [];
  148 + var temp1 = [];
  149 + var temp2 = [];
  150 + if (obj.ttInfoNames && obj.ttInfoIds) {
  151 + temp1 = obj.ttInfoNames.split(",");
  152 + temp2 = obj.ttInfoIds.split(",");
  153 + }
128 154  
129   - if (temp1.length == temp2.length) {
130   - for (var i = 0; i < temp1.length; i++) {
131   - rst.push({
132   - ttInfoName: temp1[i],
133   - ttInfoId: temp2[i]
134   - });
  155 + if (temp1.length == temp2.length) {
  156 + for (var i = 0; i < temp1.length; i++) {
  157 + (function(index) {
  158 + ttInfoService.rest.get({id: temp2[index]}, function(value) {
  159 + rst.push({
  160 + ttInfoName: temp1[index],
  161 + ttInfoId: temp2[index],
  162 + lineVersion: value.lineVersion
  163 + });
  164 + });
  165 + })(i);
  166 + }
135 167 }
136   - }
137 168  
138   - ttinfo.rst = rst;
  169 + ttinfo.rst = rst;
  170 + })(ttinfo);
139 171 });
140 172 }
141 173 });
... ... @@ -184,6 +216,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
184 216 // 转换日期成str
185 217 self.toDateStr = function(time) {
186 218 return $filter('date')(new Date(time), 'yyyy-MM-dd');
  219 + };
  220 +
  221 + self.customOrder = function() {
  222 + // large方式弹出模态对话框
  223 + var modalInstance = $uibModal.open({
  224 + templateUrl: '/pages/scheduleApp/module/core/schedulePlanManage/orderOptionOpen.html',
  225 + size: "sm",
  226 + animation: true,
  227 + backdrop: 'static',
  228 + resolve: {
  229 + },
  230 + windowClass: 'center-modal',
  231 + controller: "SchedulePlanManageListOrderOptionModalInstanceCtrl",
  232 + controllerAs: "$ctrl",
  233 + bindToController: true
  234 + });
  235 + modalInstance.result.then(
  236 + function(result) {
  237 + console.log("dataImport.html打开");
  238 + },
  239 + function() {
  240 + console.log("dataImport.html消失");
  241 + }
  242 + );
  243 + };
  244 + }
  245 + ]
  246 +);
  247 +
  248 +angular.module('ScheduleApp').controller(
  249 + "SchedulePlanManageListOrderOptionModalInstanceCtrl",
  250 + [
  251 + "SchedulePlanManageService",
  252 + "$modalInstance",
  253 + function(service, $modalInstance) {
  254 + var self = this;
  255 +
  256 + self.columns = service.getColumns();
  257 + self.orderColumns = service.getOrderColumns();
  258 +
  259 + self.confirm = function(result) {
  260 + // console.log(result);
  261 + // console.log(service.getOrderColumns());
  262 + $modalInstance.dismiss("cancel");
  263 +
187 264 }
188 265 }
189 266 ]
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html
... ... @@ -65,6 +65,7 @@
65 65 </div>
66 66 <!-- 隐藏块,显示验证信息 -->
67 67 <div class="alert alert-danger well-sm" ng-show="myForm.ddr.$error.required">
  68 + <i class="fa fa-times-circle" aria-hidden="true"></i>
68 69 调度原因必须选择
69 70 </div>
70 71 </div>
... ... @@ -87,6 +88,7 @@
87 88 </div>
88 89 <!-- 隐藏块,显示验证信息 -->
89 90 <div class="alert alert-danger well-sm" ng-show="myForm.cl1.$error.required">
  91 + <i class="fa fa-times-circle" aria-hidden="true"></i>
90 92 车辆1必须选择
91 93 </div>
92 94  
... ... @@ -96,6 +98,7 @@
96 98 remotevtype="cc_cars_gs"
97 99 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'cl.id_eq': ctrl.formData.cl1.id} | json}}" />
98 100 <div class="alert alert-danger well-sm" ng-show="myForm.cl1_h_gs.$error.remote">
  101 + <i class="fa fa-times-circle" aria-hidden="true"></i>
99 102 {{$remote_msg}}
100 103 </div>
101 104 <!-- 分公司权限 -->
... ... @@ -109,6 +112,18 @@
109 112 <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
110 113 {{ctrl.cl1_h_fgs_warn}}
111 114 </div>
  115 +
  116 + <!-- 车辆配置判定 -->
  117 + <input type="hidden" name="cl1_h_xl" ng-model="ctrl.formData.cl1.id"
  118 + remote-Warn
  119 + remotewtype="cc_cars_2"
  120 + remotewparam="{{ {'xlId': ctrl.xlId, 'clId': ctrl.formData.cl1.id} | json}}"
  121 + remotewmsgprop="cl1_h_xl_warn" />
  122 + <div class="alert alert-warning well-sm" ng-show="ctrl.cl1_h_xl_warn">
  123 + <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
  124 + {{ctrl.cl1_h_xl_warn}}
  125 + </div>
  126 +
112 127 </div>
113 128 <div class="form-group">
114 129 <label class="col-md-5 control-label">车辆2:</label>
... ... @@ -133,6 +148,7 @@
133 148 remotevtype="cc_cars_gs"
134 149 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'cl.id_eq': ctrl.formData.cl2.id} | json}}" />
135 150 <div class="alert alert-danger well-sm" ng-show="myForm.cl2_h_gs.$error.remote">
  151 + <i class="fa fa-times-circle" aria-hidden="true"></i>
136 152 {{$remote_msg}}
137 153 </div>
138 154 <!-- 分公司权限 -->
... ... @@ -147,6 +163,17 @@
147 163 {{ctrl.cl2_h_fgs_warn}}
148 164 </div>
149 165  
  166 + <!-- 车辆配置判定 -->
  167 + <input type="hidden" name="cl2_h_xl" ng-model="ctrl.formData.cl2.id"
  168 + remote-Warn
  169 + remotewtype="cc_cars_2"
  170 + remotewparam="{{ {'xlId': ctrl.xlId, 'clId': ctrl.formData.cl2.id} | json}}"
  171 + remotewmsgprop="cl2_h_xl_warn" />
  172 + <div class="alert alert-warning well-sm" ng-show="ctrl.cl2_h_xl_warn">
  173 + <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
  174 + {{ctrl.cl2_h_xl_warn}}
  175 + </div>
  176 +
150 177 </div>
151 178  
152 179 <div class="form-group has-success has-feedback">
... ... @@ -168,6 +195,7 @@
168 195 </div>
169 196 <!-- 隐藏块,显示验证信息 -->
170 197 <div class="alert alert-danger well-sm" ng-show="myForm.j1.$error.required">
  198 + <i class="fa fa-times-circle" aria-hidden="true"></i>
171 199 驾驶员必须选择
172 200 </div>
173 201  
... ... @@ -177,6 +205,7 @@
177 205 remotevtype="ec_jsy_gs"
178 206 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'jsy.id_eq': ctrl.formData.j1.id} | json}}" />
179 207 <div class="alert alert-danger well-sm" ng-show="myForm.j1_h_gs.$error.remote">
  208 + <i class="fa fa-times-circle" aria-hidden="true"></i>
180 209 {{$remote_msg}}
181 210 </div>
182 211 <!-- 分公司权限 -->
... ... @@ -216,6 +245,7 @@
216 245 remotevtype="ec_spy_gs"
217 246 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'spy.id_eq': ctrl.formData.s1.id} | json}}" />
218 247 <div class="alert alert-danger well-sm" ng-show="myForm.s1_h_gs.$error.remote">
  248 + <i class="fa fa-times-circle" aria-hidden="true"></i>
219 249 {{$remote_msg}}
220 250 </div>
221 251 <!-- 分公司权限 -->
... ... @@ -254,6 +284,7 @@
254 284 remotevtype="ec_jsy_gs"
255 285 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'jsy.id_eq': ctrl.formData.j2.id} | json}}" />
256 286 <div class="alert alert-danger well-sm" ng-show="myForm.j2_h_gs.$error.remote">
  287 + <i class="fa fa-times-circle" aria-hidden="true"></i>
257 288 {{$remote_msg}}
258 289 </div>
259 290 <!-- 分公司权限 -->
... ... @@ -293,6 +324,7 @@
293 324 remotevtype="ec_spy_gs"
294 325 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'spy.id_eq': ctrl.formData.s2.id} | json}}" />
295 326 <div class="alert alert-danger well-sm" ng-show="myForm.s2_h_gs.$error.remote">
  327 + <i class="fa fa-times-circle" aria-hidden="true"></i>
296 328 {{$remote_msg}}
297 329 </div>
298 330 <!-- 分公司权限 -->
... ... @@ -332,6 +364,7 @@
332 364 remotevtype="ec_jsy_gs"
333 365 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'jsy.id_eq': ctrl.formData.j3.id} | json}}" />
334 366 <div class="alert alert-danger well-sm" ng-show="myForm.j3_h_gs.$error.remote">
  367 + <i class="fa fa-times-circle" aria-hidden="true"></i>
335 368 {{$remote_msg}}
336 369 </div>
337 370 <!-- 分公司权限 -->
... ... @@ -371,6 +404,7 @@
371 404 remotevtype="ec_spy_gs"
372 405 remotevparam="{{ {'xl.id_eq': ctrl.xlId, 'xl.name_eq': ctrl.xlName, 'spy.id_eq': ctrl.formData.s3.id} | json}}" />
373 406 <div class="alert alert-danger well-sm" ng-show="myForm.s3_h_gs.$error.remote">
  407 + <i class="fa fa-times-circle" aria-hidden="true"></i>
374 408 {{$remote_msg}}
375 409 </div>
376 410 <!-- 分公司权限 -->
... ... @@ -399,6 +433,7 @@
399 433 </div>
400 434 <!-- 隐藏块,显示验证信息 -->
401 435 <div class="alert alert-danger well-sm" ng-show="myForm.ddrdesc.$error.maxlength">
  436 + <i class="fa fa-times-circle" aria-hidden="true"></i>
402 437 最大100个字
403 438 </div>
404 439 </div>
... ... @@ -443,7 +478,7 @@
443 478 <div class="col-md-offset-3 col-md-4">
444 479 <button type="submit" class="btn green"
445 480 ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
446   - <a type="button" class="btn default" ui-sref="schedulePlanReportExtManage" ><i class="fa fa-times"></i> 取消</a>
  481 + <a type="button" class="btn default" ui-sref="schedulePlanReportExtManage" ><i class="fa fa-times-circle"></i> 取消</a>
447 482 </div>
448 483 </div>
449 484 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
3 3 return {
4 4 rest : $resource(
5 5 '/spc/:id',
6   - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id'},
  6 + {order: 'xl.name,createDate', direction: 'DESC,DESC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ... @@ -55,6 +55,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
55 55 method: 'GET'
56 56 }
57 57 }
  58 + ),
  59 + v_rules: $resource(
  60 + '/spc/valttrule/:xlid/:from/:to',
  61 + {xlid: '@xlid', from: '@from', to: '@to'},
  62 + {
  63 + val: {
  64 + method: 'GET'
  65 + }
  66 + }
58 67 )
59 68 };
60 69 }]);
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="ScheduleRuleManageCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -27,13 +36,13 @@
27 36 <span class="caption-subject bold uppercase">排班规则</span>
28 37 </div>
29 38 <div class="actions">
30   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
  39 + <a href="javascript:" class="btn blue" ng-click="ctrl.goForm()">
31 40 <i class="fa fa-plus"></i>
32 41 添加规则
33 42 </a>
34 43  
35 44 <div class="btn-group">
36   - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  45 + <a href="javascript:" class="btn red btn-outline" data-toggle="dropdown">
37 46 <i class="fa fa-share"></i>
38 47 <span>数据工具</span>
39 48 <i class="fa fa-angle-down"></i>
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
... ... @@ -44,9 +44,24 @@
44 44 <td></td>
45 45 <td></td>
46 46 <td>
47   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
48   - ng-click="ctrl.doPage()">
49   - <i class="fa fa-search"></i> 搜索</button>
  47 + <div class="btn-group">
  48 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  49 + ng-click="ctrl.doPage()">
  50 + <i class="fa fa-search"></i> 搜索</button>
  51 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  52 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  53 + <span class="caret"></span>
  54 + <span class="sr-only">dropdown</span>
  55 + </button>
  56 + <ul class="dropdown-menu pull-right">
  57 + <li>
  58 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  59 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  60 + 排序选项
  61 + </a>
  62 + </li>
  63 + </ul>
  64 + </div>
50 65  
51 66 <button class="btn btn-sm red btn-outline filter-cancel"
52 67 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/module.js
... ... @@ -19,6 +19,19 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "updateDate", desc: "修改时间"},
  26 + {name: "qyrq", desc: "启用日期"},
  27 + {name: "carConfigInfo.cl.insideCode", desc: "车辆"}
  28 + ];
  29 + // 排序字段
  30 + var orderColumns = {
  31 + order: "xl.name,updateDate,carConfigInfo.cl.insideCode",
  32 + direction: "ASC,DESC,ASC"
  33 + };
  34 +
22 35 // 查询对象
23 36 var queryClass = service.rest;
24 37  
... ... @@ -26,7 +39,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 39 getQueryClass: function() {
27 40 return queryClass;
28 41 },
29   -
  42 + getColumns: function() {
  43 + return columns;
  44 + },
  45 + getOrderColumns: function() {
  46 + return orderColumns;
  47 + },
30 48 /**
31 49 * 获取查询条件信息,
32 50 * 用于给controller用来和页面数据绑定。
... ... @@ -39,6 +57,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
39 57 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
40 58 }
41 59  
  60 + // 重置排序字段条件
  61 + currentSearchCondition.order = orderColumns.order;
  62 + currentSearchCondition.direction = orderColumns.direction;
  63 +
42 64 return currentSearchCondition;
43 65 },
44 66 getPage: function(page) {
... ... @@ -209,7 +231,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
209 231 'ScheduleRuleManageListCtrl',
210 232 [
211 233 'ScheduleRuleManageService',
212   - function(service) {
  234 + '$uibModal',
  235 + function(service, $uibModal) {
213 236 var self = this;
214 237 var ScheduleRuleManage = service.getQueryClass();
215 238  
... ... @@ -250,6 +273,51 @@ angular.module(&#39;ScheduleApp&#39;).controller(
250 273 return type == "FBGSMODE";
251 274 }
252 275  
  276 + self.customOrder = function() {
  277 + // large方式弹出模态对话框
  278 + var modalInstance = $uibModal.open({
  279 + templateUrl: '/pages/scheduleApp/module/core/scheduleRuleManage/orderOptionOpen.html',
  280 + size: "sm",
  281 + animation: true,
  282 + backdrop: 'static',
  283 + resolve: {
  284 + },
  285 + windowClass: 'center-modal',
  286 + controller: "ScheduleRuleManageListOrderOptionModalInstanceCtrl",
  287 + controllerAs: "$ctrl",
  288 + bindToController: true
  289 + });
  290 + modalInstance.result.then(
  291 + function(result) {
  292 + console.log("dataImport.html打开");
  293 + },
  294 + function() {
  295 + console.log("dataImport.html消失");
  296 + }
  297 + );
  298 + };
  299 +
  300 + }
  301 + ]
  302 +);
  303 +
  304 +angular.module('ScheduleApp').controller(
  305 + "ScheduleRuleManageListOrderOptionModalInstanceCtrl",
  306 + [
  307 + "ScheduleRuleManageService",
  308 + "$modalInstance",
  309 + function(service, $modalInstance) {
  310 + var self = this;
  311 +
  312 + self.columns = service.getColumns();
  313 + self.orderColumns = service.getOrderColumns();
  314 +
  315 + self.confirm = function(result) {
  316 + // console.log(result);
  317 + // console.log(service.getOrderColumns());
  318 + $modalInstance.dismiss("cancel");
  319 +
  320 + }
253 321 }
254 322 ]
255 323 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;ScheduleRuleManageService_g&#39;, [&#39;$resource
3 3 return {
4 4 rest: $resource(
5 5 '/sr1fc/:id',
6   - {order: 'xl.id,updateDate,carConfigInfo.cl.insideCode', direction: 'ASC,DESC,ASC', id: '@id'},
  6 + {order: 'xl.name,updateDate,carConfigInfo.cl.insideCode', direction: 'ASC,DESC,ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="TtInfoManageIndexCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -31,7 +40,7 @@
31 40 <!--<i class="fa fa-plus"></i>-->
32 41 <!--测试-->
33 42 <!--</a>-->
34   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()">
  43 + <a href="javascript:" class="btn blue" ng-click="ctrl.toTtInfoManageForm()">
35 44 <i class="fa fa-plus"></i>
36 45 添加时刻表
37 46 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/list.html
... ... @@ -47,9 +47,24 @@
47 47 </td>
48 48 <td></td>
49 49 <td>
50   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
51   - ng-click="ctrl.doPage()">
52   - <i class="fa fa-search"></i> 搜索</button>
  50 + <div class="btn-group">
  51 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  52 + ng-click="ctrl.doPage()">
  53 + <i class="fa fa-search"></i> 搜索</button>
  54 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  55 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  56 + <span class="caret"></span>
  57 + <span class="sr-only">dropdown</span>
  58 + </button>
  59 + <ul class="dropdown-menu pull-right">
  60 + <li>
  61 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  62 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  63 + 排序选项
  64 + </a>
  65 + </li>
  66 + </ul>
  67 + </div>
53 68  
54 69 <button class="btn btn-sm red btn-outline filter-cancel"
55 70 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/module.js
... ... @@ -19,6 +19,21 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "name", desc: "时刻表名称"},
  26 + {name: "xlDir", desc: "上下行"},
  27 + {name: "isEnableDisTemplate", desc: "是否启用"},
  28 + {name: "qyrq", desc: "启用日期"},
  29 + {name: "isCancel", desc: "是否作废"}
  30 + ];
  31 + // 排序字段
  32 + var orderColumns = {
  33 + order: "xl.name,isCancel,isEnableDisTemplate,qyrq",
  34 + direction: "DESC,ASC,DESC,DESC"
  35 + };
  36 +
22 37 // 查询对象类
23 38 var queryClass = service.rest;
24 39  
... ... @@ -26,6 +41,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 41 getTtInfoQueryClass: function() {
27 42 return queryClass;
28 43 },
  44 + getColumns: function() {
  45 + return columns;
  46 + },
  47 + getOrderColumns: function() {
  48 + return orderColumns;
  49 + },
29 50 getSearchCondition: function() {
30 51 currentSearchCondition.page = currentPage.uiNumber - 1;
31 52  
... ... @@ -34,6 +55,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 55 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
35 56 }
36 57  
  58 + // 重置排序字段条件
  59 + currentSearchCondition.order = orderColumns.order;
  60 + currentSearchCondition.direction = orderColumns.direction;
  61 +
37 62 return currentSearchCondition;
38 63 },
39 64 getPage: function(page) {
... ... @@ -125,7 +150,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
125 150 [
126 151 'TtInfoManageService',
127 152 'FileDownload_g',
128   - function(service, fileDownload) {
  153 + '$uibModal',
  154 + function(service, fileDownload, $uibModal) {
129 155 var self = this;
130 156 var TtInfo = service.getTtInfoQueryClass();
131 157  
... ... @@ -204,7 +230,50 @@ angular.module(&#39;ScheduleApp&#39;).controller(
204 230  
205 231 };
206 232  
207   - // TODO:
  233 + self.customOrder = function() {
  234 + // large方式弹出模态对话框
  235 + var modalInstance = $uibModal.open({
  236 + templateUrl: '/pages/scheduleApp/module/core/ttInfoManage/orderOptionOpen.html',
  237 + size: "sm",
  238 + animation: true,
  239 + backdrop: 'static',
  240 + resolve: {
  241 + },
  242 + windowClass: 'center-modal',
  243 + controller: "TtInfoManageListOrderOptionModalInstanceCtrl",
  244 + controllerAs: "$ctrl",
  245 + bindToController: true
  246 + });
  247 + modalInstance.result.then(
  248 + function(result) {
  249 + console.log("dataImport.html打开");
  250 + },
  251 + function() {
  252 + console.log("dataImport.html消失");
  253 + }
  254 + );
  255 + };
  256 + }
  257 + ]
  258 +);
  259 +
  260 +angular.module('ScheduleApp').controller(
  261 + "TtInfoManageListOrderOptionModalInstanceCtrl",
  262 + [
  263 + "TtInfoManageService",
  264 + "$modalInstance",
  265 + function(service, $modalInstance) {
  266 + var self = this;
  267 +
  268 + self.columns = service.getColumns();
  269 + self.orderColumns = service.getOrderColumns();
  270 +
  271 + self.confirm = function(result) {
  272 + // console.log(result);
  273 + // console.log(service.getOrderColumns());
  274 + $modalInstance.dismiss("cancel");
  275 +
  276 + }
208 277 }
209 278 ]
210 279 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/orderOptionOpen.html 0 → 100644
  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 +</div>
0 19 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
... ... @@ -7,7 +7,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(
7 7 return {
8 8 rest: $resource(
9 9 '/tic_ec/:id',
10   - {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  10 + {order: 'xl.name,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
11 11 {
12 12 list: {
13 13 method: 'GET',
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage2/index.html
... ... @@ -20,6 +20,15 @@
20 20  
21 21 <div class="row">
22 22 <div class="col-md-12" ng-controller="TtInfoManage2IndexCtrl as ctrl">
  23 + <style>
  24 + .dropdown-menu {
  25 + border-color: #32c5d2;
  26 + }
  27 + .btn-group > .dropdown-menu:before {
  28 + border-bottom-color: #32c5d2;
  29 + }
  30 + </style>
  31 +
23 32 <div class="portlet light bordered">
24 33 <div class="portlet-title">
25 34 <div class="caption font-dark">
... ... @@ -31,7 +40,7 @@
31 40 <!--<i class="fa fa-plus"></i>-->
32 41 <!--测试-->
33 42 <!--</a>-->
34   - <a href="javascript:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()">
  43 + <a href="javascript:" class="btn blue" ng-click="ctrl.toTtInfoManageForm()">
35 44 <i class="fa fa-plus"></i>
36 45 添加时刻表
37 46 </a>
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage2/list.html
... ... @@ -47,9 +47,24 @@
47 47 </td>
48 48 <td></td>
49 49 <td>
50   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
51   - ng-click="ctrl.doPage()">
52   - <i class="fa fa-search"></i> 搜索</button>
  50 + <div class="btn-group">
  51 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;"
  52 + ng-click="ctrl.doPage()">
  53 + <i class="fa fa-search"></i> 搜索</button>
  54 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom dropdown-toggle"
  55 + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  56 + <span class="caret"></span>
  57 + <span class="sr-only">dropdown</span>
  58 + </button>
  59 + <ul class="dropdown-menu pull-right">
  60 + <li>
  61 + <a href="javascript:" class="tool-action" ng-click="ctrl.customOrder()">
  62 + <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
  63 + 排序选项
  64 + </a>
  65 + </li>
  66 + </ul>
  67 + </div>
53 68  
54 69 <button class="btn btn-sm red btn-outline filter-cancel"
55 70 ng-click="ctrl.reset()">
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage2/module.js
... ... @@ -19,6 +19,21 @@ angular.module(&#39;ScheduleApp&#39;).factory(
19 19 uiToRecord: 0 // 页面绑定,当前页到第几条记录
20 20 };
21 21  
  22 + // 字段描述
  23 + var columns = [
  24 + {name: "xl.name", desc: "线路名称"},
  25 + {name: "name", desc: "时刻表名称"},
  26 + {name: "xlDir", desc: "上下行"},
  27 + {name: "isEnableDisTemplate", desc: "是否启用"},
  28 + {name: "qyrq", desc: "启用日期"},
  29 + {name: "isCancel", desc: "是否作废"}
  30 + ];
  31 + // 排序字段
  32 + var orderColumns = {
  33 + order: "xl.name,isCancel,isEnableDisTemplate,qyrq",
  34 + direction: "DESC,ASC,DESC,DESC"
  35 + };
  36 +
22 37 // 查询对象类
23 38 var queryClass = service.rest;
24 39  
... ... @@ -26,6 +41,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(
26 41 getTtInfoQueryClass: function() {
27 42 return queryClass;
28 43 },
  44 + getColumns: function() {
  45 + return columns;
  46 + },
  47 + getOrderColumns: function() {
  48 + return orderColumns;
  49 + },
29 50 getSearchCondition: function() {
30 51 currentSearchCondition.page = currentPage.uiNumber - 1;
31 52  
... ... @@ -34,6 +55,10 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 55 currentSearchCondition["xl.cgsbm_in"] = UserPrincipal.getGsStrs().join(",");
35 56 }
36 57  
  58 + // 重置排序字段条件
  59 + currentSearchCondition.order = orderColumns.order;
  60 + currentSearchCondition.direction = orderColumns.direction;
  61 +
37 62 return currentSearchCondition;
38 63 },
39 64 getPage: function(page) {
... ... @@ -125,7 +150,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
125 150 [
126 151 'TtInfoManage2Service',
127 152 'FileDownload_g',
128   - function(service, fileDownload) {
  153 + '$uibModal',
  154 + function(service, fileDownload, $uibModal) {
129 155 var self = this;
130 156 var TtInfo = service.getTtInfoQueryClass();
131 157  
... ... @@ -204,7 +230,50 @@ angular.module(&#39;ScheduleApp&#39;).controller(
204 230  
205 231 };
206 232  
207   - // TODO:
  233 + self.customOrder = function() {
  234 + // large方式弹出模态对话框
  235 + var modalInstance = $uibModal.open({
  236 + templateUrl: '/pages/scheduleApp/module/core/ttInfoManage2/orderOptionOpen.html',
  237 + size: "sm",
  238 + animation: true,
  239 + backdrop: 'static',
  240 + resolve: {
  241 + },
  242 + windowClass: 'center-modal',
  243 + controller: "TtInfoManage2ListOrderOptionModalInstanceCtrl",
  244 + controllerAs: "$ctrl",
  245 + bindToController: true
  246 + });
  247 + modalInstance.result.then(
  248 + function(result) {
  249 + console.log("dataImport.html打开");
  250 + },
  251 + function() {
  252 + console.log("dataImport.html消失");
  253 + }
  254 + );
  255 + };
  256 + }
  257 + ]
  258 +);
  259 +
  260 +angular.module('ScheduleApp').controller(
  261 + "TtInfoManage2ListOrderOptionModalInstanceCtrl",
  262 + [
  263 + "TtInfoManage2Service",
  264 + "$modalInstance",
  265 + function(service, $modalInstance) {
  266 + var self = this;
  267 +
  268 + self.columns = service.getColumns();
  269 + self.orderColumns = service.getOrderColumns();
  270 +
  271 + self.confirm = function(result) {
  272 + // console.log(result);
  273 + // console.log(service.getOrderColumns());
  274 + $modalInstance.dismiss("cancel");
  275 +
  276 + }
208 277 }
209 278 ]
210 279 );
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage2/orderOptionOpen.html 0 → 100644
  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 +</div>
0 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
... ... @@ -281,6 +281,11 @@ var gb_schedule_context_menu = (function () {
281 281 open_modal(folder + '/sub_task_v2/main.html', {
282 282 sch: sch
283 283 }, modal_opts);
  284 + },
  285 + wxsb: function (sch) {
  286 + open_modal(folder + '/wxsb.html', {
  287 + sch: sch
  288 + }, modal_opts);
284 289 }
285 290 };
286 291  
... ... @@ -339,9 +344,13 @@ var gb_schedule_context_menu = (function () {
339 344 'wdtz': {
340 345 name: '误点调整'
341 346 },
342   - 'sep4': '---------',
  347 + 'sep5': '---------',
343 348 'lp_change': {
344 349 name: '路牌对调'
  350 + },
  351 + 'sep6': '---------',
  352 + 'wxsb': {
  353 + name: '维修上报'
345 354 }
346 355 }
347 356 });
... ...