Commit a8c0675593d5cc12e2fe814bb3f0f247e65b224d

Authored by 潘钊
2 parents 0bcad6d2 9a8a3ad8

Merge branch 'minhang' into pudong

Showing 34 changed files with 3242 additions and 684 deletions
src/main/java/com/bsth/controller/realcontrol/summary/DestroySituationController.java
1   -package com.bsth.controller.realcontrol.summary;
2   -
3   -import com.bsth.controller.BaseController;
4   -import com.bsth.data.summary.entity.DestroySituation;
5   -import com.bsth.data.summary.service.DestroySituationService;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RequestParam;
9   -import org.springframework.web.bind.annotation.RestController;
10   -
11   -import javax.servlet.http.HttpServletRequest;
12   -import javax.servlet.http.HttpServletResponse;
13   -import java.util.Map;
14   -
15   -/**
16   - * Created by panzhao on 2017/11/1.
17   - */
18   -@RestController
19   -@RequestMapping("/summary/destroy_detail")
20   -public class DestroySituationController extends BaseController<DestroySituation, Long> {
21   -
22   - @Autowired
23   - DestroySituationService destroySituationService;
24   -
25   - @RequestMapping("excel")
26   - public void excel(@RequestParam Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
27   - destroySituationService.excel(map, request, response);
28   - }
29   -}
  1 +package com.bsth.controller.realcontrol.summary;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.data.summary.entity.DestroySituation;
  5 +import com.bsth.data.summary.service.DestroySituationService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import javax.servlet.http.HttpServletRequest;
  12 +import javax.servlet.http.HttpServletResponse;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * Created by panzhao on 2017/11/1.
  17 + */
  18 +@RestController
  19 +@RequestMapping("/summary/destroy_detail")
  20 +public class DestroySituationController extends BaseController<DestroySituation, Long> {
  21 +
  22 + @Autowired
  23 + DestroySituationService destroySituationService;
  24 +
  25 + @RequestMapping("excel")
  26 + public void excel(@RequestParam Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
  27 + destroySituationService.excel(map, request, response);
  28 + }
  29 +}
... ...
src/main/java/com/bsth/data/pilot80/PilotReport.java
... ... @@ -78,6 +78,12 @@ public class PilotReport {
78 78 //d80MultiMap.put(d80.getData().getLineId().toString(), d80);
79 79  
80 80 String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId());
  81 + //上报时,在执行的班次
  82 + if(StringUtils.isNotEmpty(nbbm)){
  83 + ScheduleRealInfo sch = dayOfSchedule.executeCurr(nbbm);
  84 + if(null != sch)
  85 + d80.setSchId(sch.getId());
  86 + }
81 87 //处理
82 88 switch (d80.getData().getRequestCode()) {
83 89 //出场请求
... ...
src/main/java/com/bsth/data/summary/service/DestroySituationService.java
1   -package com.bsth.data.summary.service;
2   -
3   -import com.bsth.data.summary.entity.DestroySituation;
4   -import com.bsth.service.BaseService;
5   -
6   -import javax.servlet.http.HttpServletRequest;
7   -import javax.servlet.http.HttpServletResponse;
8   -import java.util.Map;
9   -
10   -/**
11   - * Created by panzhao on 2017/11/1.
12   - */
13   -public interface DestroySituationService extends BaseService<DestroySituation, Long> {
14   - void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response);
  1 +package com.bsth.data.summary.service;
  2 +
  3 +import com.bsth.data.summary.entity.DestroySituation;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import javax.servlet.http.HttpServletRequest;
  7 +import javax.servlet.http.HttpServletResponse;
  8 +import java.util.Map;
  9 +
  10 +/**
  11 + * Created by panzhao on 2017/11/1.
  12 + */
  13 +public interface DestroySituationService extends BaseService<DestroySituation, Long> {
  14 + void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response);
15 15 }
16 16 \ No newline at end of file
... ...
src/main/java/com/bsth/data/summary/service/impl/DestroySituationServiceImpl.java
1   -package com.bsth.data.summary.service.impl;
2   -
3   -import com.bsth.data.summary.entity.DestroySituation;
4   -import com.bsth.data.summary.service.DestroySituationService;
5   -import com.bsth.data.utils.CustomStringUtils;
6   -import com.bsth.service.impl.BaseServiceImpl;
7   -import org.apache.poi.hssf.usermodel.HSSFWorkbook;
8   -import org.apache.poi.poifs.filesystem.POIFSFileSystem;
9   -import org.apache.poi.ss.usermodel.Row;
10   -import org.apache.poi.ss.usermodel.Sheet;
11   -import org.slf4j.Logger;
12   -import org.slf4j.LoggerFactory;
13   -import org.springframework.stereotype.Service;
14   -
15   -import javax.servlet.http.HttpServletRequest;
16   -import javax.servlet.http.HttpServletResponse;
17   -import java.io.FileInputStream;
18   -import java.io.OutputStream;
19   -import java.net.URLEncoder;
20   -import java.text.SimpleDateFormat;
21   -import java.util.*;
22   -
23   -/**
24   - * Created by panzhao on 2017/11/1.
25   - */
26   -@Service
27   -public class DestroySituationServiceImpl extends BaseServiceImpl<DestroySituation, Long> implements DestroySituationService {
28   -
29   - Logger logger = LoggerFactory.getLogger(this.getClass());
30   -
31   - @Override
32   - public void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
33   - try {
34   - map.put("rq_le", CustomStringUtils.maxEndTime(map.get("rq_ge").toString()
35   - , map.get("rq_le").toString(), 62));
36   -
37   - List<DestroySituation> list = (List<DestroySituation>) super.list(map);
38   -
39   - if(list.size() == 0){
40   - response.setHeader("Content-type", "text/html;charset=UTF-8");
41   - response.getWriter().print("<span style='color:red;font-size:24px;'>根据查询条件没有搜索到数据,别导了!</span>");
42   - return ;
43   - }
44   -
45   - //排序
46   - Collections.sort(list, new Comparator<DestroySituation>() {
47   - @Override
48   - public int compare(DestroySituation o1, DestroySituation o2) {
49   - return (int) (o1.getT() - o2.getT());
50   - }
51   - });
52   -
53   - //输出excel
54   - String basePath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
55   - String filePath = basePath + "/static/pages/summary/excel/烂班明细情况.xls";
56   - POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filePath));
57   - HSSFWorkbook wb = new HSSFWorkbook(fs);
58   -
59   - //写入数据
60   - Sheet sheet = wb.getSheetAt(0);
61   - Row row;
62   - DestroySituation dys;
63   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
64   - for(int i = 0; i < list.size(); i++){
65   - dys = list.get(i);
66   - row = sheet.createRow(i + 1);
67   - row.createCell(0).setCellValue(dys.getRq());
68   - row.createCell(1).setCellValue(dys.getLineName());
69   - row.createCell(2).setCellValue(dys.getNbbm());
70   - row.createCell(3).setCellValue(dys.getjGh());
71   - row.createCell(4).setCellValue(dys.getsGh());
72   - row.createCell(5).setCellValue(dys.getReason());
73   - row.createCell(6).setCellValue(dys.getSize());
74   - row.createCell(7).setCellValue(dys.getMileage());
75   - row.createCell(8).setCellValue(sdf.format(new Date(dys.getT())));
76   - row.createCell(9).setCellValue(dys.getRemark());
77   - }
78   -
79   - String name = list.get(0).getLineName();
80   - wb.setSheetName(0, name + "烂班明细");
81   - //response 输出
82   - String filename = name + map.get("rq_ge") + "至" + map.get("rq_le") + "烂班明细情况.xls";
83   - response.setContentType("application/x-msdownload");
84   - response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
85   -
86   - OutputStream os = response.getOutputStream();
87   - wb.write(os);
88   - os.flush();
89   - os.close();
90   - } catch (Exception e) {
91   - logger.error("", e);
92   - }
93   - }
94   -
  1 +package com.bsth.data.summary.service.impl;
  2 +
  3 +import com.bsth.data.summary.entity.DestroySituation;
  4 +import com.bsth.data.summary.service.DestroySituationService;
  5 +import com.bsth.data.utils.CustomStringUtils;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  8 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
  9 +import org.apache.poi.ss.usermodel.Row;
  10 +import org.apache.poi.ss.usermodel.Sheet;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import javax.servlet.http.HttpServletRequest;
  16 +import javax.servlet.http.HttpServletResponse;
  17 +import java.io.FileInputStream;
  18 +import java.io.OutputStream;
  19 +import java.net.URLEncoder;
  20 +import java.text.SimpleDateFormat;
  21 +import java.util.*;
  22 +
  23 +/**
  24 + * Created by panzhao on 2017/11/1.
  25 + */
  26 +@Service
  27 +public class DestroySituationServiceImpl extends BaseServiceImpl<DestroySituation, Long> implements DestroySituationService {
  28 +
  29 + Logger logger = LoggerFactory.getLogger(this.getClass());
  30 +
  31 + @Override
  32 + public void excel(Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) {
  33 + try {
  34 + map.put("rq_le", CustomStringUtils.maxEndTime(map.get("rq_ge").toString()
  35 + , map.get("rq_le").toString(), 62));
  36 +
  37 + List<DestroySituation> list = (List<DestroySituation>) super.list(map);
  38 +
  39 + if(list.size() == 0){
  40 + response.setHeader("Content-type", "text/html;charset=UTF-8");
  41 + response.getWriter().print("<span style='color:red;font-size:24px;'>根据查询条件没有搜索到数据,别导了!</span>");
  42 + return ;
  43 + }
  44 +
  45 + //排序
  46 + Collections.sort(list, new Comparator<DestroySituation>() {
  47 + @Override
  48 + public int compare(DestroySituation o1, DestroySituation o2) {
  49 + return (int) (o1.getT() - o2.getT());
  50 + }
  51 + });
  52 +
  53 + //输出excel
  54 + String basePath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
  55 + String filePath = basePath + "/static/pages/summary/excel/烂班明细情况.xls";
  56 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filePath));
  57 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  58 +
  59 + //写入数据
  60 + Sheet sheet = wb.getSheetAt(0);
  61 + Row row;
  62 + DestroySituation dys;
  63 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  64 + for(int i = 0; i < list.size(); i++){
  65 + dys = list.get(i);
  66 + row = sheet.createRow(i + 1);
  67 + row.createCell(0).setCellValue(dys.getRq());
  68 + row.createCell(1).setCellValue(dys.getLineName());
  69 + row.createCell(2).setCellValue(dys.getNbbm());
  70 + row.createCell(3).setCellValue(dys.getjGh());
  71 + row.createCell(4).setCellValue(dys.getsGh());
  72 + row.createCell(5).setCellValue(dys.getReason());
  73 + row.createCell(6).setCellValue(dys.getSize());
  74 + row.createCell(7).setCellValue(dys.getMileage());
  75 + row.createCell(8).setCellValue(sdf.format(new Date(dys.getT())));
  76 + row.createCell(9).setCellValue(dys.getRemark());
  77 + }
  78 +
  79 + String name = list.get(0).getLineName();
  80 + wb.setSheetName(0, name + "烂班明细");
  81 + //response 输出
  82 + String filename = name + map.get("rq_ge") + "至" + map.get("rq_le") + "烂班明细情况.xls";
  83 + response.setContentType("application/x-msdownload");
  84 + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
  85 +
  86 + OutputStream os = response.getOutputStream();
  87 + wb.write(os);
  88 + os.flush();
  89 + os.close();
  90 + } catch (Exception e) {
  91 + logger.error("", e);
  92 + }
  93 + }
  94 +
95 95 }
96 96 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/directive/D80.java
... ... @@ -62,7 +62,17 @@ public class D80 {
62 62 private Date handleTime;
63 63  
64 64 private String remarks;
65   -
  65 +
  66 + private Long schId;
  67 +
  68 + public Long getSchId() {
  69 + return schId;
  70 + }
  71 +
  72 + public void setSchId(Long schId) {
  73 + this.schId = schId;
  74 + }
  75 +
66 76 @Embeddable
67 77 public static class D80Data {
68 78  
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -111,7 +111,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
111 111 return -1;
112 112 }
113 113 String text = "您已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由"
114   - + sch.getQdzName() + "发往" + sch.getZdzName() ;
  114 + + sch.getQdzName() + "发往" + sch.getZdzName() + ";应到 " + sch.getZdsj();
115 115  
116 116 if(sch.getBcType().equals("venting")){
117 117 text += " (直放)";
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -128,7 +128,8 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
128 128 Dlb t1=dlList.get(k);
129 129 if(t1.getNbbm().equals(map.get("clZbh").toString())
130 130 &&t1.getJsy().equals(map.get("jGh").toString())
131   - &&t1.getXlbm().equals(map.get("xlBm").toString()))
  131 + &&t1.getXlbm().equals(map.get("xlBm").toString())
  132 + &&t1.getLp().equals(map.get("lpName").toString()))
132 133 {
133 134 t=t1;
134 135 type="update";
... ... @@ -194,6 +195,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
194 195 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
195 196 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
196 197 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  198 + t.setLp(map.get("lpName").toString());
197 199 t.setRq(sdf.parse(rq));
198 200 t.setCreatetime(new Date());
199 201 /*if(type.equals("add")){
... ... @@ -560,9 +562,15 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
560 562 long l=Math.round(nextJzyl);
561 563 double ylxs=l*100/100;
562 564 dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
563   - t.setHd(dh);
564   - t.setCdl(dh);
565   - nextJzyl=ylxs;
  565 + if(dh<0){
  566 + t.setHd(dh);
  567 + t.setCdl(dh);
  568 + nextJzyl=Arith.add(ylxs, dh);
  569 + }else{
  570 + t.setHd(dh);
  571 + t.setCdl(dh);
  572 + nextJzyl=ylxs;
  573 + }
566 574 }else{
567 575 t.setHd(0.0);
568 576 t.setCdl(0.0);
... ... @@ -586,9 +594,15 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
586 594  
587 595 }
588 596 dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
589   - t.setHd(dh);
590   - t.setCdl(dh);
591   - nextJzyl=ylxs;
  597 + if(dh<0){
  598 + t.setHd(dh);
  599 + t.setCdl(dh);
  600 + nextJzyl=Arith.add(ylxs, dh);
  601 + }else{
  602 + t.setHd(dh);
  603 + t.setCdl(dh);
  604 + nextJzyl=ylxs;
  605 + }
592 606 }else{
593 607 t.setHd(0.0);
594 608 t.setCdl(0.0);
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -128,7 +128,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
128 128 Ylb t1=ylList.get(k);
129 129 if(t1.getNbbm().equals(map.get("clZbh").toString())
130 130 &&t1.getJsy().equals(map.get("jGh").toString())
131   - &&t1.getXlbm().equals(map.get("xlBm").toString()))
  131 + &&t1.getXlbm().equals(map.get("xlBm").toString())
  132 + &&t1.getLp().equals(map.get("lpName").toString()))
132 133 {
133 134 t=t1;
134 135 type="update";
... ... @@ -618,13 +619,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
618 619 czyl = t.getCzyl();
619 620 zyl =jzl;
620 621 Double yh=0.0;
621   - if(zlc>0){
  622 + if(zlc>0 ){
622 623 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
623 624 }
624 625 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh);
625 626 //把进场油量的小数和整数分别取出
626 627 // int ylxs=(int) nextJzyl; 10.6--11 10.3--10
627   - if(zlc>0){
  628 + if(zlc>0 && t.getZlc()>0){
628 629 long l=Math.round(nextJzyl);
629 630 double ylxs=l*100/100;
630 631 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
... ... @@ -643,14 +644,12 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
643 644 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
644 645 }
645 646 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh);
646   - if(zlc>0){
  647 + if(zlc>0 && t.getZlc()>0){
647 648 long l=0l;
648 649 double ylxs=0.0;
649 650 if(j==iterator2.size()-1){
650 651 ylxs=czyl;
651 652 }else{
652   -// l=Math.round(nextJzyl);
653   -// ylxs=l*100/100;
654 653 if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){
655 654 l=Math.round(nextJzyl);
656 655 ylxs=l*100/100;
... ... @@ -693,154 +692,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
693 692 return map2;
694 693 }
695 694  
696   - /**
697   - * 拆分
698   - */
699   - /*
700   - @Transactional
701   - @Override
702   - public Map<String, Object> sort(Map<String, Object> map) throws Exception{
703   - // TODO Auto-generated method stub
704   - Map<String, Object> newMap = new HashMap<String, Object>();
705   - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
706   - try {
707   - // 获取车辆存油信息
708   - List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
709   - int id = Integer.parseInt(map.get("id").toString());
710   - // 最后存油量
711   - Double yl = Double.parseDouble(map.get("jzyl").toString());
712   - Double sh= Double.parseDouble(map.get("sh").toString());
713   - String shyy=map.get("shyy").toString();
714   - Ylb ylb = repository.findOne(id);
715   - List<Cyl> cylListAdd=new ArrayList<Cyl>();
716   - Map<String, Object> cylMapAdd=new HashMap<String,Object>();
717   - String nbbm_eq = ylb.getNbbm();
718   - Date rq_eq = ylb.getRq();
719   - // 得到一天总的加油和里程(根据车,时间)
720   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
721   - // 保存总的加油量
722   - Double jzl = 0.0;
723   - // 保存总的里程
724   - Double zlc = 0.0;
725   - //保存总的损耗
726   - Double zsh = 0.0;
727   - for (int j = 0; j < sumList.size(); j++) {
728   - jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
729   - zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
730   - zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
731   - }
732   - jzl = Arith.sub(jzl, zsh);
733   -
734   - //新的 损耗不等于 旧的损耗 总损耗从新算
735   - if(Arith.sub(ylb.getSh(),sh )!=0){
736   - zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
737   - jzl =Arith.sub(jzl, zsh);
738   - }else{
739   - jzl =Arith.sub(jzl, zsh);
740   - }
741   - map.put("nbbm_eq", nbbm_eq);
742   - map.put("rq_eq", rq_eq);
743   - List<Ylb> iterator2=repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),ylb.getXlbm(),
744   - ylb.getNbbm(),"jcsx");
745   -// Iterator<Ylb> iterator = repository.findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx"))
746   -// .iterator();
747   - // 根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油
748   - // 保留两位小数
749   - DecimalFormat df = new DecimalFormat("#.00");
750   - Double zyl = 0.0;
751   - Double nextJzyl = 0.0;
752   - // 车的,进,出油量及耗油
753   - for (int i = 0; i < iterator2.size(); i++) {
754   - Ylb t = iterator2.get(i);
755   - if (t.getJcsx() == 1) {
756   - if(t.getId()==id){
757   - t.setSh(sh);
758   - t.setShyy(shyy);
759   - }
760   - Double jcyl = t.getCzyl();
761   - zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
762   - Double yh = 0.0;
763   - if (zlc > 0 && t.getZlc() > 0) {
764   - yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
765   - }
766   - nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
767   - long l=Math.round(nextJzyl);
768   - double ylxs=l*100/100;
769   -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
770   - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
771   - t.setJzyl(ylxs);
772   - t.setYh(yh);
773   - nextJzyl=ylxs;
774   - } else {
775   - if(t.getId()==id){
776   - t.setSh(sh);
777   - t.setShyy(shyy);
778   - }
779   - t.setCzyl(nextJzyl);
780   - Double yh =0.0;
781   - if (t.getZlc() != 0) {
782   - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
783   - }
784   - nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
785   - long l=Math.round(nextJzyl);
786   - double ylxs=l*100/100;
787   -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
788   - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
789   - t.setJzyl(ylxs);
790   - t.setYh(yh);
791   - nextJzyl=ylxs;
792   - }
793   - repository.save(t);
794   -
795   - // 设置存油量
796   - Cyl cyl = null;
797   - boolean fage = false;
798   - for (int z = 0; z < cylList.size(); z++) {
799   - cyl = cylList.get(z);
800   - if (t.getNbbm().equals(cyl.getNbbm())) {
801   - cyl.setCyl(t.getJzyl());
802   - cyl.setUpdatetime(t.getRq());
803   - fage = true;
804   - break;
805   - }
806   - }
807   - if (fage) {
808   - cylRepository.save(cyl);
809   - } else {
810   - if(cylMapAdd.get(t.getNbbm())!=null){
811   - for (int l = 0; l < cylListAdd.size(); l++) {
812   - cyl=cylListAdd.get(l);
813   - if(cyl.getNbbm().equals(t.getNbbm())){
814   - cyl.setNbbm(t.getNbbm());
815   - cyl.setCyl(t.getJzyl());
816   - cyl.setGsdm(t.getSsgsdm());
817   - cyl.setFgsdm(t.getFgsdm());
818   - cyl.setUpdatetime(t.getRq());
819   - }
820   - }
821   - }else{
822   - cyl = new Cyl();
823   - cyl.setNbbm(t.getNbbm());
824   - cyl.setCyl(t.getJzyl());
825   - cyl.setGsdm(t.getSsgsdm());
826   - cyl.setFgsdm(t.getFgsdm());
827   - cyl.setUpdatetime(t.getRq());
828   - cylListAdd.add(cyl);
829   - }
830   - }
831   -
832   - newMap.put("status", ResponseCode.SUCCESS);
833   - }
834   - for (int i = 0; i < cylListAdd.size(); i++) {
835   - cylRepository.save(cylListAdd.get(i));
836   - }
837   - } catch (Exception e) {
838   - newMap.put("status", ResponseCode.ERROR);
839   - logger.error("save erro.", e);
840   - throw e;
841   - }
842   - return newMap;
843   - }*/
844 695  
845 696 /**
846 697 * 核对,有加注没里程
... ... @@ -1315,6 +1166,9 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1315 1166 String nbbm =jsonObject.getString("nbbm");
1316 1167 String rq=jsonObject.getString("rq");
1317 1168 double yh = Arith.sub(Arith.add(czyl, jzl), jzyl);
  1169 + if(yh<0){
  1170 + yh=0.0;
  1171 + }
1318 1172 /*t.setJzyl(jzyl);
1319 1173 t.setSh(sh);
1320 1174 t.setShyy(shyy);
... ... @@ -1417,10 +1271,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1417 1271 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
1418 1272 }
1419 1273 nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
1420   - if(zlc>0){
  1274 + if(zlc>0 && t.getZlc() > 0){
1421 1275 long l=Math.round(nextJzyl);
1422 1276 double ylxs=l*100/100;
1423   -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1277 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
1424 1278 yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs));
1425 1279 t.setYh(yh);
1426 1280 t.setJzyl(ylxs);
... ... @@ -1436,11 +1290,11 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1436 1290 }
1437 1291 t.setCzyl(nextJzyl);
1438 1292 Double yh =0.0;
1439   - if (t.getZlc() != 0) {
  1293 + if (t.getZlc() >= 0) {
1440 1294 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
1441 1295 }
1442 1296 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
1443   - if(zlc>0){
  1297 + if(zlc>0 && t.getZlc() >0){
1444 1298 long l=0l;
1445 1299 double ylxs=0.0;
1446 1300 if(i==iterator2.size()-1){
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -2348,6 +2348,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2348 2348 map.put("djg_time", m.get("djgsj"));
2349 2349 map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl));
2350 2350 lMap.add(map);
  2351 +
  2352 + if(date.length() == 10){
  2353 + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59");
  2354 + String dbdp = "";
  2355 + try {
  2356 + for (int i = 0; i < list.size(); i++) {
  2357 + DutyEmployee t = list.get(i);
  2358 + if(dbdp.indexOf(t.getuName()) == -1){
  2359 + if(!(dbdp.length()>0)){
  2360 + dbdp =t.getuName();
  2361 + }else{
  2362 + dbdp +=","+t.getuName();
  2363 + }
  2364 + }
  2365 + }
  2366 + } catch (Exception e) {
  2367 + // TODO: handle exception
  2368 + e.printStackTrace();
  2369 + }
  2370 + map.put("dbdp", dbdp);
  2371 + }
  2372 +
2351 2373 return lMap;
2352 2374 }
2353 2375  
... ... @@ -3248,7 +3270,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3248 3270 ScheduleRealInfo sch = dayOfSchedule.get(id);
3249 3271 if (sch != null) {
3250 3272 sch.setBcType(bcType);
3251   - sch.addRemarks(remarks);
  3273 + sch.setRemarks(remarks);
3252 3274 rs.put("status", ResponseCode.SUCCESS);
3253 3275 rs.put("t", sch);
3254 3276  
... ... @@ -4195,8 +4217,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4195 4217 dataList3.add(tempMap);
4196 4218 }
4197 4219  
  4220 + if(date.length() == 10){
  4221 + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59");
  4222 + String dbdp = "";
  4223 + try {
  4224 + for (int i = 0; i < list.size(); i++) {
  4225 + DutyEmployee t = list.get(i);
  4226 + if(dbdp.indexOf(t.getuName()) == -1){
  4227 + if(!(dbdp.length()>0)){
  4228 + dbdp =t.getuName();
  4229 + }else{
  4230 + dbdp +=","+t.getuName();
  4231 + }
  4232 + }
  4233 + }
  4234 + } catch (Exception e) {
  4235 + // TODO: handle exception
  4236 + e.printStackTrace();
  4237 + }
  4238 + nMap.put("dbdp", dbdp);
  4239 + }
4198 4240  
4199 4241 if (type.equals("export")) {
  4242 + String lineName = "";
  4243 + if(map.containsKey("lineName"))
  4244 + lineName = "-" + map.get("lineName").toString() + "-";
4200 4245 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
4201 4246 sdfSimple = new SimpleDateFormat("yyyyMMdd");
4202 4247 Map<String, Object> m = new HashMap<String, Object>();
... ... @@ -4214,7 +4259,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4214 4259 sourcePath = path + "mould/scheduleDaily_m.xls";
4215 4260 }
4216 4261 ee.excelReplace(listI, new Object[]{nMap}, sourcePath,
4217   - path + "export/调度日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  4262 + path + "export/调度日报"+ lineName + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
4218 4263 } catch (Exception e) {
4219 4264 // TODO: handle exception
4220 4265 e.printStackTrace();
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -1929,6 +1929,9 @@ public class ReportServiceImpl implements ReportService{
1929 1929 newMap.put("jhglzgf", culateService.culateJhgl_(sList,"zgf"));
1930 1930 newMap.put("jhglwgf", culateService.culateJhgl_(sList,"wgf"));
1931 1931  
  1932 + newMap.put("lbgl", culateService.culateLbgl(sList));
  1933 + newMap.put("lbbc", culateService.culateLbbc(sList));
  1934 +
1932 1935 newMap.put("sjbc", culateService.culateSjbc(lists,""));
1933 1936 newMap.put("sjbczgf", culateService.culateSjbc(lists,"zgf"));
1934 1937 newMap.put("sjbcwgf", culateService.culateSjbc(lists,"wgf"));
... ... @@ -1936,8 +1939,7 @@ public class ReportServiceImpl implements ReportService{
1936 1939 newMap.put("sjglzgf", culateService.culateSjgl_(lists,"zgf"));
1937 1940 newMap.put("sjglwgf", culateService.culateSjgl_(lists,"wgf"));
1938 1941  
1939   - newMap.put("lbgl", culateService.culateLbgl(lists));
1940   - newMap.put("lbbc", culateService.culateLbbc(lists));
  1942 +
1941 1943 newMap.put("ljgl", culateService.culateLjgl(lists));
1942 1944 newMap.put("ljglzgf", culateService.culateLjgl_(lists,"zgf"));
1943 1945 newMap.put("ljglwgf", culateService.culateLjgl_(lists,"wgf"));
... ...
src/main/resources/static/pages/base/timesmodel/gantt.html
... ... @@ -119,10 +119,12 @@
119 119 <script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script>
120 120 <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script>
121 121 <script src="/pages/base/timesmodel/js/base-fun.js"></script>
122   -<script src="/pages/base/timesmodel/js/strategy/StrategyUtils.js"></script>
123   -<script src="/pages/base/timesmodel/js/strategy/BcObj.js"></script>
124   -<script src="/pages/base/timesmodel/js/strategy/ParameterObj.js"></script>
125   -<script src="/pages/base/timesmodel/js/strategy/strategy-headway.js"></script>
  122 +<script src="/pages/base/timesmodel/js/v2/ParameterObj.js"></script>
  123 +<script src="/pages/base/timesmodel/js/v2/core/InternalBcObj.js"></script>
  124 +<script src="/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js"></script>
  125 +<script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script>
  126 +<script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script>
  127 +<script src="/pages/base/timesmodel/js/v2/main_v2.js"></script>
126 128 <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script>
127 129 <script src="/pages/base/timesmodel/js/errorinfo.js"></script>
128 130 <script src="/pages/base/timesmodel/js/gantt.js"></script>
129 131 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
... ... @@ -400,7 +400,7 @@ $(&#39;.editlp&#39;).on(&#39;click&#39;,function() {
400 400 {'name':'营运班次总时间(包括正常、区间、放大站且班次时间大于零)','value':parseFloat((servicesj/60).toFixed(2)) + ' 小时'},
401 401 {'name':'总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)','value': parseFloat((countGs/60).toFixed(2)) + ' 小时'},
402 402 {'name':'空驶班次(包括直放班次)','value':ksBc},
403   - {'name':'营运里程(包括正常、区间、放大站里程)','value':serviceLc + ' 公里'},
  403 + {'name':'营运里程(包括正常、区间、放大站里程)','value':Number(serviceLc).toFixed(3) + ' 公里'},
404 404 {'name':'空驶里程(包括直放里程)','value':ksLc + ' 公里'},
405 405 {'name':'平均停站时间(营运班次停站时间总和/营运总班次)','value':parseInt(avgTzjx) + ' 分钟' },
406 406 {'name':'高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)','value':gfServiceBc},
... ...
src/main/resources/static/pages/base/timesmodel/js/gantt.js
... ... @@ -62,9 +62,8 @@
62 62 map.fcjx = CSMap.fcjx;
63 63 }else if (map.baseRes == '2') {
64 64 // TODO:之后可能有新的参数加入
65   - _paramObj = StrategyUtils.getFactory().createParameterObj(map, dataMap);
66   -
67   - map.clzs = StrategyUtils.calcuClzx(_paramObj);
  65 + _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap);
  66 + map.clzs = _paramObj.calcuClzx();
68 67 CSMap = getMaxCarAndStopSpace1(map);
69 68  
70 69 }
... ... @@ -84,7 +83,7 @@
84 83 // TODO:绘制gantt图表
85 84 // TODO:var seDate = getksjssj(null,seMap.s); 关联参数必须设置
86 85 // TODO:CSMap.maxCar 之后要设定一下的
87   - data = StrategyHeadway.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
  86 + data = Main_v2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
88 87 }
89 88  
90 89 }else {
... ...
src/main/resources/static/pages/base/timesmodel/js/strategy/BcObjMatrix.js 0 → 100644
  1 +/**
  2 + * 班次对象矩阵(二维数组)。
  3 + * @param paramObj 参数对象
  4 + * @constructor
  5 + */
  6 +var BcObjMatrix = function(paramObj) {
  7 + // 内部参数
  8 + var _paramObj = paramObj;
  9 +
  10 + var lpObj = function() { // 路牌对象
  11 + return {
  12 + bxType: 6, // 班型描述,默认做5休2
  13 + qArray: [] // 圈对象数组,一圈二个班次
  14 + };
  15 + }
  16 +};
0 17 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/strategy/RelatedObjes.js 0 → 100644
  1 +// 相关的内部对象
  2 +/**
  3 + * 班次类型对象(最后转换成显示用bc对象)
  4 + * @param bcType 班次类型(normal,in,out等)
  5 + * @param isUp boolean 是否上行
  6 + * @param lp 路牌编号
  7 + * @param fcno 发车编号
  8 + * @param fcTimeObj 发车时间对象
  9 + * @param paramObj 参数对象
  10 + * @returns 班次对象
  11 + */
  12 +var BcObj = function(bcType, isUp, lp, fcno, fcTimeObj, paramObj) {
  13 +
  14 + //---------- 内部属性 ----------//
  15 + var _bcType = bcType; // 班次类型(normal,in,out等)
  16 + var _isUp = isUp; // true表示上行,false表示下行
  17 + var _lp = lp; // 路牌
  18 + var _fcno = fcno; // 发车顺序号
  19 +
  20 + // 计算的属性,TODO:还有其他属性
  21 + // 上标线里属于第几圈(本班次方向和标线方向一致,才有意义)
  22 + var qCount;
  23 +
  24 + // 班次里程
  25 + var _bclc = StrategyUtils.calcuTravelLcNumber(_isUp, _bcType, paramObj);
  26 + // 发车时间
  27 + var _fcsjObj = moment(fcTimeObj);
  28 + // 班次时间
  29 + var _bcsj = StrategyUtils.calcuTravelTime(_fcsjObj, _isUp, paramObj);
  30 + // 到达时间
  31 + var _arrsj = StrategyUtils.addMinute(_fcsjObj, _bcsj);
  32 + // 到达后的停站时间(使用到达时间判定)
  33 + var _stopTime = StrategyUtils.calcuFixedStopNumber(_arrsj, !_isUp, paramObj);
  34 +
  35 + return {
  36 + /**
  37 + * 是否上行。
  38 + * @returns boolean
  39 + */
  40 + isUp: function() {
  41 + return _isUp;
  42 + },
  43 + /**
  44 + * 获取发车时间。
  45 + * @returns {*|moment.Moment}
  46 + */
  47 + getFcTimeObj: function() {
  48 + return _fcsjObj;
  49 + },
  50 + /**
  51 + * 获取班次时间。
  52 + */
  53 + getBcTime: function() {
  54 + return _bcsj;
  55 + },
  56 + /**
  57 + * 获取停站时间。
  58 + * @returns {*}
  59 + */
  60 + getStopTime: function() {
  61 + return _stopTime;
  62 + },
  63 +
  64 + /**
  65 + * 转换成显示用班次对象。
  66 + */
  67 + toGanttBcObj: function() {
  68 + var _bcObj = {
  69 + parent: _lp,
  70 + lpNo: _lp,
  71 + lp: null,
  72 + lpName: _lp,
  73 + lpType: '普通路牌',
  74 + bcType: _bcType,
  75 + fcno: _fcno,
  76 + isfb: 0,
  77 + isSwitchXl: null,
  78 + bz: null
  79 + };
  80 +
  81 + // 线路上下行
  82 + _bcObj.xlDir = _isUp ? "relationshipGraph-up" : "relationshipGraph-down";
  83 +
  84 + // 里程
  85 + _bcObj.jhlc = _bclc;
  86 +
  87 + // 停车场
  88 + _bcObj.tcc = paramObj.getTccId();
  89 +
  90 + // 时刻表
  91 + _bcObj.ttinfo = paramObj.getTTinfoId();
  92 +
  93 + // 线路
  94 + _bcObj.xl = paramObj.getXlId();
  95 +
  96 + // 起点站、终点站
  97 + _bcObj.qdz = _isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  98 + _bcObj.zdz = _isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  99 +
  100 + // 发车时间,行驶时间,到达时间,停站时间
  101 + _bcObj.fcsj = _fcsjObj.format("HH:mm");
  102 + _bcObj.bcsj = _bcsj;
  103 + _bcObj.ARRIVALTIME = _arrsj.format("HH:mm");
  104 + _bcObj.STOPTIME = _stopTime;
  105 +
  106 + return _bcObj;
  107 + }
  108 + };
  109 +};
0 110 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/strategy/StrategyUtils.js
... ... @@ -39,7 +39,32 @@ var StrategyUtils = function() {
39 39 },
40 40 // 创建班次对象
41 41 createBcObj: function(bcType, isUp, lp, fcno, fcTimeObj, paramObj) {
42   - return BcObj(bcType, isUp, lp, fcno, fcTimeObj, paramObj);
  42 + var _bclc = StrategyUtils.calcuTravelLcNumber(isUp, bcType, paramObj);
  43 + var _bcsj = StrategyUtils.calcuTravelTime(fcTimeObj, isUp, paramObj);
  44 + var _arrsj = StrategyUtils.addMinute(fcTimeObj, _bcsj);
  45 + var _stoptime = StrategyUtils.calcuFixedStopNumber(_arrsj, !isUp, paramObj);
  46 + var _tccid = paramObj.getTTinfoId();
  47 + var _ttinfoid = paramObj.getTTinfoId();
  48 + var _xl = paramObj.getXlId();
  49 + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  50 + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  51 +
  52 + return new InternalBcObj(
  53 + bcType, // 班次类型(normal,in,out等)
  54 + isUp, // boolean是否上下行
  55 + lp, // 路牌标识符
  56 + fcno, // 发车顺序号
  57 + fcTimeObj, // 发车时间对象
  58 + _bclc, // 班次里程
  59 + _bcsj, // 班次历时
  60 + _arrsj, // 到达时间对象
  61 + _stoptime, // 停站时间
  62 + _tccid, // 停车场id
  63 + _ttinfoid, // 时刻表id
  64 + _xl, // 线路id
  65 + _qdz, // 起点站id
  66 + _zdz // 终点站id
  67 + );
43 68 }
44 69 };
45 70 };
... ...
src/main/resources/static/pages/base/timesmodel/js/strategy/core/InternalBcObj.js 0 → 100644
  1 +/**
  2 + * 内部班次对象。
  3 + * @constructor
  4 + */
  5 +var InternalBcObj = function(
  6 + bcType, // 班次类型(normal,in,out等)
  7 + isUp, // boolean是否上下行
  8 + lp, // 路牌标识符
  9 + fcno, // 发车顺序号
  10 + fcTimeObj, // 发车时间对象
  11 + bclc, // 班次里程
  12 + bcsj, // 班次历时
  13 + arrtime, // 到达时间对象
  14 + stoptime, // 停站时间
  15 + tccid, // 停车场id
  16 + ttinfoid, // 时刻表id
  17 + xl, // 线路id
  18 + qdzid, // 起点站id
  19 + zdzid // 终点站id
  20 +) {
  21 + // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k
  22 + // 外部函数使用 prototype 方式
  23 + this._$_bcType = bcType;
  24 + this._$_isUp = isUp;
  25 + this._$_lp = lp;
  26 + this._$_fcno = fcno;
  27 + this._$_fcsjObj = moment(fcTimeObj);
  28 + this._$_bclc = bclc;
  29 + this._$_bcsj = bcsj;
  30 + this._$_arrtime = arrtime;
  31 + this._$_stoptime = stoptime;
  32 + this._$_tccid = tccid;
  33 + this._$_ttinfoid = ttinfoid;
  34 + this._$_xlid = xl;
  35 + this._$_qdzid = qdzid;
  36 + this._$_zdzid = zdzid;
  37 +
  38 +};
  39 +
  40 +/**
  41 + * 是否上行。
  42 + * @returns boolean
  43 + */
  44 +InternalBcObj.prototype.isUp = function() {
  45 + return this._$_isUp;
  46 +};
  47 +/**
  48 + * 获取发车时间。
  49 + * @returns {*|moment.Moment}
  50 + */
  51 +InternalBcObj.prototype.getFcTimeObj = function() {
  52 + return this._$_fcsjObj;
  53 +};
  54 +/**
  55 + * 获取班次时间。
  56 + * @returns int
  57 + */
  58 +InternalBcObj.prototype.getBcTime = function() {
  59 + return this._$_bcsj;
  60 +};
  61 +/**
  62 + * 获取停站时间。
  63 + * @returns int
  64 + */
  65 +InternalBcObj.prototype.getStopTime = function() {
  66 + return this._$_stoptime;
  67 +};
  68 +/**
  69 + * 转换成显示用班次对象。
  70 + * @returns {{}}
  71 + */
  72 +InternalBcObj.prototype.toGanttBcObj = function() {
  73 + var _bcObj = {
  74 + parent: this._$_lp,
  75 + lpNo: this._$_lp,
  76 + lp: null,
  77 + lpName: this._$_lp,
  78 + lpType: '普通路牌',
  79 + bcType: this._$_bcType,
  80 + fcno: this._$_fcno,
  81 + isfb: 0,
  82 + isSwitchXl: null,
  83 + bz: null
  84 + };
  85 +
  86 + // 线路上下行
  87 + _bcObj.xlDir = this._$_isUp ? "relationshipGraph-up" : "relationshipGraph-down";
  88 +
  89 + // 里程
  90 + _bcObj.jhlc = this._$_bclc;
  91 +
  92 + // 停车场
  93 + _bcObj.tcc = this._$_tccid;
  94 +
  95 + // 时刻表
  96 + _bcObj.ttinfo = this._$_ttinfoid;
  97 +
  98 + // 线路
  99 + _bcObj.xl = this._$_xlid;
  100 +
  101 + // 起点站、终点站
  102 + _bcObj.qdz = this._$_qdzid;
  103 + _bcObj.zdz = this._$_zdzid;
  104 +
  105 + // 发车时间,行驶时间,到达时间,停站时间
  106 + _bcObj.fcsj = this._$_fcsjObj.format("HH:mm");
  107 + _bcObj.bcsj = this._$_bcsj;
  108 + _bcObj.ARRIVALTIME = this._$_arrtime;
  109 + _bcObj.STOPTIME = this._$_stoptime;
  110 +
  111 + return _bcObj;
  112 +};
  113 +
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/ParameterObj.js 0 → 100644
  1 +/**
  2 + * 参数对象。
  3 + *
  4 + * @constructor
  5 + */
  6 +var ParameterObj = function() {
  7 + // 内部保存的form参数及其他参数
  8 + var _formMap;
  9 + var _dataMap;
  10 + var _validInternal = function() {
  11 + if (!_formMap) {
  12 + alert("formMap为空!");
  13 + throw "formMap为空!";
  14 + }
  15 + if (!_dataMap) {
  16 + alert("dataMap为空!");
  17 + throw "dataMap为空!";
  18 + }
  19 + };
  20 +
  21 + // 计算行驶时间对象
  22 + var _travelTimeObj_fun = function() {
  23 + var upMoningPeakTravelTime =
  24 + isNaN(_formMap.earlyUpTime) || parseInt(_formMap.earlyUpTime) == 0 ?
  25 + parseInt(_formMap.upTravelTime) :
  26 + parseInt(_formMap.earlyUpTime);
  27 + var downMoningPeakTravelTime =
  28 + isNaN(_formMap.earlyDownTime) || parseInt(_formMap.earlyDownTime) == 0 ?
  29 + parseInt(_formMap.downTravelTime) :
  30 + parseInt(_formMap.earlyDownTime);
  31 + var upEveningPeakTravelTime =
  32 + isNaN(_formMap.lateUpTime) || parseInt(_formMap.lateUpTime) == 0 ?
  33 + parseInt(_formMap.upTravelTime) :
  34 + parseInt(_formMap.lateUpTime);
  35 + var downEveningPeakTravelTime =
  36 + isNaN(_formMap.lateDownTime) || parseInt(_formMap.lateDownTime) == 0 ?
  37 + parseInt(_formMap.downTravelTime) :
  38 + parseInt(_formMap.lateDownTime);
  39 + var upTroughTravelTime =
  40 + isNaN(_formMap.troughUpTime) || parseInt(_formMap.troughUpTime) == 0 ?
  41 + parseInt(_formMap.upTravelTime) :
  42 + parseInt(_formMap.troughUpTime);
  43 + var downTroughTravelTime =
  44 + isNaN(_formMap.troughDownTime) || parseInt(_formMap.troughDownTime) == 0 ?
  45 + parseInt(_formMap.downTravelTime) :
  46 + parseInt(_formMap.troughDownTime);
  47 +
  48 + return { // TODO:暂时获取标准信息,之后改成历史数据,可能需要使用promise封装
  49 + "moningpeak": [
  50 + upMoningPeakTravelTime,
  51 + downMoningPeakTravelTime
  52 + ],
  53 + "eveningpeak": [
  54 + upEveningPeakTravelTime,
  55 + downEveningPeakTravelTime
  56 + ],
  57 + "trough": [
  58 + upTroughTravelTime,
  59 + downTroughTravelTime
  60 + ]
  61 + }
  62 + };
  63 + var _travelTimeObj;
  64 +
  65 + // 计算行驶里程对象
  66 + var _travelLcObj_fun = function() {
  67 + return [
  68 + { // 上行里程
  69 + "normalLc": isNaN(_formMap.upMileage) ? 0 : parseFloat(_formMap.upMileage),
  70 + "inLc": isNaN(_formMap.upInMileage) ? 0 : parseFloat(_formMap.upInMileage),
  71 + "outLc": isNaN(_formMap.upOutMileage) ? 0 : parseFloat(_formMap.upOutMileage)
  72 + },
  73 + { // 下行里程
  74 + "normalLc": isNaN(_formMap.downMileage) ? 0 : parseFloat(_formMap.downMileage),
  75 + "inLc": isNaN(_formMap.downInMileage) ? 0 : parseFloat(_formMap.downInMileage),
  76 + "outLc": isNaN(_formMap.downOutMileage) ? 0 : parseFloat(_formMap.downOutMileage)
  77 + }
  78 + ];
  79 + };
  80 + var _travelLcObj;
  81 +
  82 + // 计算首班车,末班车行驶时间字符串
  83 + var _firstLastDepartureTimeStrObj_fun = function() {
  84 + return {
  85 + up: { // 上行
  86 + firstVehicleDepartureTimeStr: _formMap.startStationFirstTime,
  87 + lastVehicleDepartureTimeStr: _formMap.startStationEndTime
  88 + },
  89 + down: { // 下行
  90 + firstVehicleDepartureTimeStr: _formMap.endStationFirstTime,
  91 + lastVehicleDepartureTimeStr: _formMap.endStationEndTime
  92 + }
  93 + };
  94 + };
  95 + var _firstLastDepartureTimeStrObj;
  96 +
  97 + // 计算时间段划分对象
  98 + var _timeIntervalObj_fun = function() {
  99 + return {
  100 + moningPeakTimeStrs: {
  101 + start: _formMap.earlyStartTime,
  102 + end: _formMap.earlyEndTime
  103 + },
  104 + eveningPeakTimeStrs: {
  105 + start: _formMap.lateStartTime,
  106 + end: _formMap.lateEndTime
  107 + }
  108 +
  109 + // TODO:其他时间段以后再加
  110 + };
  111 + };
  112 + var _timeIntervalObj;
  113 +
  114 + // 计算各个时段的发车间隙
  115 + var _fcjxIntervalObj_fun = function() {
  116 + var _rtn = {
  117 + mpeakfcjx : {}, // 早高峰
  118 + epeakfcjx : {}, // 晚高峰
  119 + troughfcjx: {} //低谷
  120 + };
  121 + var _fcjx = [];
  122 + var i = 0;
  123 +
  124 + // TODO:这里只有3个间隔,以后加其他的
  125 + // 1、早高峰间隙
  126 + // 2、晚高峰间隙
  127 + // 3、低谷
  128 +
  129 + _rtn.mpeakfcjx.min = parseInt(_formMap.zgffcjxmin);
  130 + _rtn.mpeakfcjx.max = parseInt(_formMap.zgffcjxmax);
  131 +
  132 + _rtn.epeakfcjx.min = parseInt(_formMap.wffcjxmin);
  133 + _rtn.epeakfcjx.max = parseInt(_formMap.wffcjxmax);
  134 +
  135 + _rtn.troughfcjx.min = parseInt(_formMap.dgfcjxmin);
  136 + _rtn.troughfcjx.max = parseInt(_formMap.dgfcjxmax);
  137 +
  138 + // 做一些逻辑检查
  139 + if (_rtn.mpeakfcjx.min > _rtn.mpeakfcjx.max) {
  140 + alert("早高峰最小间隔大于最大间隔");
  141 + throw "早高峰最小间隔大于最大间隔";
  142 + }
  143 + if (_rtn.epeakfcjx.min > _rtn.epeakfcjx.max) {
  144 + alert("晚高峰最小间隔大于最大间隔");
  145 + throw "晚高峰最小间隔大于最大间隔";
  146 + }
  147 + if (_rtn.troughfcjx.min > _rtn.troughfcjx.max) {
  148 + alert("低谷最小间隔大于最大间隔");
  149 + throw "低谷最小间隔大于最大间隔";
  150 + }
  151 +
  152 +
  153 + return _rtn;
  154 + };
  155 + var _fcjxIntervalObj;
  156 +
  157 + // 获取停站类型
  158 + var _stopTypeObj_fun = function() {
  159 + var isMasterStop = false; // 是否主站停
  160 + var isMasterUpStop = false; // 主站停是否上行站点
  161 + if (_formMap) {
  162 + var fm_temp = _formMap.stt.split("/");
  163 + if (fm_temp.length == 1) { // 双向停站
  164 + isMasterStop = false;
  165 + } else {
  166 + isMasterStop = true;
  167 + if (fm_temp[1] == "0") {
  168 + isMasterUpStop = true;
  169 + } else {
  170 + isMasterUpStop = false;
  171 + }
  172 + }
  173 + } else {
  174 + throw "停站类型没有选择!";
  175 + }
  176 +
  177 + return {
  178 + isMasterStop: isMasterStop,
  179 + isMasterUpStop: isMasterUpStop
  180 + }
  181 + };
  182 + var _stopTypeObj;
  183 +
  184 + // 计算线路对象
  185 + var _xlObj_fun = function() {
  186 + return { // TODO:其他属性再议
  187 + xl: {
  188 + id: _formMap.lineName.split('_')[0]
  189 + }
  190 + };
  191 + };
  192 + var _xlObj;
  193 +
  194 + // 计算停车场对象
  195 + var _parkObj_fun = function() {
  196 + return { // TODO:其他属性再议
  197 + park: {
  198 + id: _formMap.tcc_id
  199 + }
  200 + };
  201 + };
  202 + var _parkObj;
  203 +
  204 + // 计算时刻表对象
  205 + var _ttInfoObj_fun = function() {
  206 + return { // TODO:其他属性再议
  207 + ttinfo: {
  208 + id: _formMap.skbName
  209 + }
  210 + };
  211 + };
  212 + var _ttInfoObj;
  213 +
  214 + // 计算起点站终点站对象
  215 + var _startEndStopObj_fun = function() {
  216 + return { // TODO:其他属性再议
  217 + up: {
  218 + qdz: { // 起点站
  219 + id: _dataMap.qdzArr[0]
  220 + },
  221 + zdz: { // 终点站
  222 + id: _dataMap.zdzArr[0]
  223 + }
  224 + },
  225 + down: {
  226 + qdz: { // 起点站
  227 + id: _dataMap.qdzArr[1]
  228 + },
  229 + zdz: { // 终点站
  230 + id: _dataMap.zdzArr[1]
  231 + }
  232 + }
  233 +
  234 + };
  235 + };
  236 + var _startEndStopObj;
  237 +
  238 + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀
  239 + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式
  240 + /**
  241 + * 将时间包装成日期,方便计算。
  242 + * @param timeStr 时间格式,如 06:30
  243 + * @returns moment对象
  244 + */
  245 + var _wrapTimeFun = function(timeStr) {
  246 + return moment(
  247 + date_wrap_prefix + timeStr,
  248 + date_wrap_format
  249 + );
  250 + };
  251 + /**
  252 + * 添加时间(注意,返回一个新的moment对象,此方法是immutable)
  253 + * @param timeObj moment 对象
  254 + * @param time 时间
  255 + * @param type 时间单位
  256 + * @returns 重新创建一个moment返回
  257 + */
  258 + var _addTimeFun = function(timeObj, time, type) {
  259 + var _timeObj = moment(timeObj); // clone
  260 + _timeObj.add(time, type);
  261 + return _timeObj;
  262 + };
  263 +
  264 + return {
  265 +
  266 + /**
  267 + * 包装外部参数。
  268 + * @param formMap
  269 + * @param dataMap
  270 + */
  271 + wrap: function(formMap, dataMap) {
  272 + _formMap = formMap;
  273 + _dataMap = dataMap;
  274 +
  275 + _validInternal(); // 验证
  276 +
  277 + // 首班车,末班车行驶时间字符串
  278 + _firstLastDepartureTimeStrObj = _firstLastDepartureTimeStrObj_fun();
  279 + // 行驶时间对象
  280 + _travelTimeObj = _travelTimeObj_fun();
  281 + // 行驶里程对象
  282 + _travelLcObj = _travelLcObj_fun();
  283 + // 时间段划分对象
  284 + _timeIntervalObj = _timeIntervalObj_fun();
  285 + // 各个时段的发车间隙
  286 + _fcjxIntervalObj = _fcjxIntervalObj_fun();
  287 + // 停站类型
  288 + _stopTypeObj = _stopTypeObj_fun();
  289 + // 线路对象
  290 + _xlObj = _xlObj_fun();
  291 + // 停车场对象
  292 + _parkObj = _parkObj_fun();
  293 + // 时刻表对象
  294 + _ttInfoObj = _ttInfoObj_fun();
  295 + // 起点站终点站对象
  296 + _startEndStopObj = _startEndStopObj_fun();
  297 +
  298 + // TODO:其他再议
  299 +
  300 + },
  301 +
  302 + //------------ 获取首班末班时间 ------------//
  303 + /**
  304 + * 获取上行首班时间对象。
  305 + * @param sobj 策略对象(HeadwayObj)
  306 + * @return moment obj
  307 + */
  308 + getUpFirstDTimeObj: function() {
  309 + _validInternal(); // 验证
  310 + return this.toTimeObj(
  311 + _firstLastDepartureTimeStrObj.up.firstVehicleDepartureTimeStr
  312 + );
  313 + },
  314 + /**
  315 + * 获取上行末班时间对象。
  316 + * @return moment obj
  317 + */
  318 + getUpLastDtimeObj: function() {
  319 + _validInternal(); // 验证
  320 + return this.toTimeObj(
  321 + _firstLastDepartureTimeStrObj.up.lastVehicleDepartureTimeStr
  322 + );
  323 + },
  324 + /**
  325 + * 获取下行首班时间对象。
  326 + * @return moment obj
  327 + */
  328 + getDownFirstDTimeObj: function() {
  329 + _validInternal(); // 验证
  330 + return this.toTimeObj(
  331 + _firstLastDepartureTimeStrObj.down.firstVehicleDepartureTimeStr
  332 + );
  333 + },
  334 + /**
  335 + * 获取下行末班时间对象。
  336 + * @return moment obj
  337 + */
  338 + getDownLastDTimeObj: function() {
  339 + _validInternal(); // 验证
  340 + return this.toTimeObj(
  341 + _firstLastDepartureTimeStrObj.down.lastVehicleDepartureTimeStr
  342 + );
  343 + },
  344 +
  345 + //-------------- 获取行驶时间 ----------------//
  346 + /**
  347 + * 获取上行早高峰行驶时间。
  348 + * @returns int number
  349 + */
  350 + getUpMPeakTime: function() {
  351 + _validInternal(); // 验证
  352 + return _travelTimeObj.moningpeak[0];
  353 + },
  354 + /**
  355 + * 获取上行晚高峰行驶时间。
  356 + * @returns int number
  357 + */
  358 + getUpEPeakTime: function() {
  359 + _validInternal(); // 验证
  360 + return _travelTimeObj.eveningpeak[0];
  361 + },
  362 + /**
  363 + * 获取上行低谷行驶时间。
  364 + * @returns int number
  365 + */
  366 + getUpTroughTime: function() {
  367 + _validInternal(); // 验证
  368 + return _travelTimeObj.trough[0];
  369 + },
  370 + /**
  371 + * 获取下行早高峰行驶时间。
  372 + * @returns int number
  373 + */
  374 + getDownMPeakTime: function() {
  375 + _validInternal(); // 验证
  376 + return _travelTimeObj.moningpeak[1];
  377 + },
  378 + /**
  379 + * 获取下行晚高峰行驶时间。
  380 + * @returns int number
  381 + */
  382 + getDownEPeakTime: function() {
  383 + _validInternal(); // 验证
  384 + return _travelTimeObj.eveningpeak[1];
  385 + },
  386 + /**
  387 + * 获取下行低谷行驶时间。
  388 + * @returns int number
  389 + */
  390 + getDownTroughTime: function() {
  391 + _validInternal(); // 验证
  392 + return _travelTimeObj.trough[1];
  393 + },
  394 +
  395 + //---------------- 获取行驶里程 -----------------//
  396 + /**
  397 + * 获取上行normal班次里程。
  398 + * @returns number
  399 + */
  400 + getUpNormalLc: function() {
  401 + _validInternal(); // 验证
  402 + return _travelLcObj[0].normalLc;
  403 + },
  404 + /**
  405 + * 获取上行进场班次类型。
  406 + * @returns number
  407 + */
  408 + getUpInLc: function() {
  409 + _validInternal(); // 验证
  410 + return _travelLcObj[0].inLc;
  411 + },
  412 + /**
  413 + * 获取上行出场班次类型。
  414 + * @returns number
  415 + */
  416 + getUpOutLc: function() {
  417 + _validInternal(); // 验证
  418 + return _travelLcObj[0].outLc;
  419 + },
  420 + /**
  421 + * 获取下行normal班次类型。
  422 + * @returns number
  423 + */
  424 + getDownNormalLc: function() {
  425 + _validInternal(); // 验证
  426 + return _travelLcObj[1].normalLc;
  427 + },
  428 + /**
  429 + * 获取下行进场班次类型。
  430 + * @returns number
  431 + */
  432 + getDownInLc: function() {
  433 + _validInternal(); // 验证
  434 + return _travelLcObj[1].inLc;
  435 + },
  436 + /**
  437 + * 获取下行出场班次类型。
  438 + * @returns number
  439 + */
  440 + getDownOutLc: function() {
  441 + _validInternal(); // 验证
  442 + return _travelLcObj[1].outLc;
  443 + },
  444 +
  445 + //---------------- 获取时间段信息 --------------//
  446 + /**
  447 + * 获取早高峰开始时间对象。
  448 + * @returns moment obj
  449 + */
  450 + getMPeakStartTimeObj: function() {
  451 + _validInternal(); // 验证
  452 + return this.toTimeObj(
  453 + _timeIntervalObj.moningPeakTimeStrs.start
  454 + );
  455 + },
  456 + /**
  457 + * 获取早高峰结束时间对象。
  458 + * @returns moment obj
  459 + */
  460 + getMPeakEndTimeObj: function() {
  461 + _validInternal(); // 验证
  462 + return this.toTimeObj(
  463 + _timeIntervalObj.moningPeakTimeStrs.end
  464 + );
  465 + },
  466 + /**
  467 + * 获取晚高峰开始时间对象。
  468 + * @returns moment obj
  469 + */
  470 + getEPeakStartTimeObj: function() {
  471 + _validInternal(); // 验证
  472 + return this.toTimeObj(
  473 + _timeIntervalObj.eveningPeakTimeStrs.start
  474 + );
  475 + },
  476 + /**
  477 + * 获取晚高峰结束时间对象。
  478 + * @returns moment obj
  479 + */
  480 + getEPeakEndTimeObj: function() {
  481 + _validInternal(); // 验证
  482 + return this.toTimeObj(
  483 + _timeIntervalObj.eveningPeakTimeStrs.end
  484 + );
  485 + },
  486 +
  487 + //----------------- 获取发车间隙(TODO:以后通过客流估算)-----------------//
  488 + /**
  489 + * 获取早高峰最小发车间隙。
  490 + * @returns int
  491 + */
  492 + getMPeakMinFcjx: function() {
  493 + _validInternal(); // 验证
  494 + return _fcjxIntervalObj.mpeakfcjx.min;
  495 + },
  496 + /**
  497 + * 获取早高峰最大发车间隙。
  498 + * @returns int
  499 + */
  500 + getMPeakMaxFcjx: function() {
  501 + _validInternal(); // 验证
  502 + return _fcjxIntervalObj.mpeakfcjx.max;
  503 + },
  504 + /**
  505 + * 获取晚高峰最小发车间隙。
  506 + * @returns int
  507 + */
  508 + getEPeakMinFcjx: function() {
  509 + _validInternal(); // 验证
  510 + return _fcjxIntervalObj.epeakfcjx.min;
  511 + },
  512 + /**
  513 + * 获取晚高峰最小发车间隙。
  514 + * @returns int
  515 + */
  516 + getEPeakMaxFcjx: function() {
  517 + _validInternal(); // 验证
  518 + return _fcjxIntervalObj.epeakfcjx.max;
  519 + },
  520 + /**
  521 + * 获取低谷最小发车间隙。
  522 + * @returns int
  523 + */
  524 + getTroughMinFcjx: function() {
  525 + _validInternal(); // 验证
  526 + return _fcjxIntervalObj.troughfcjx.min;
  527 + },
  528 + /**
  529 + * 获取低谷最大发车间隙。
  530 + * @returns int
  531 + */
  532 + getTroughMaxFcjx: function() {
  533 + _validInternal(); // 验证
  534 + return _fcjxIntervalObj.troughfcjx.max;
  535 + },
  536 +
  537 + //----------------- 获取停站方式 -------------------//
  538 + /**
  539 + * 是否双向停站。
  540 + * @returns {boolean}
  541 + */
  542 + isTwoWayStop: function() {
  543 + _validInternal(); // 验证
  544 + return !_stopTypeObj.isMasterStop;
  545 + },
  546 + /**
  547 + * 是否上行单向停站。
  548 + * @returns {boolean}
  549 + */
  550 + isUpOneWayStop: function() {
  551 + _validInternal(); // 验证
  552 + return _stopTypeObj.isMasterStop && _stopTypeObj.isMasterUpStop;
  553 + },
  554 + /**
  555 + * 是否下行单向停站。
  556 + * @returns {boolean}
  557 + */
  558 + isDownOneWayStop: function() {
  559 + _validInternal(); // 验证
  560 + return _stopTypeObj.isMasterStop && (!_stopTypeObj.isMasterUpStop);
  561 + },
  562 +
  563 + //----------------- 获取高峰配车数、加班路牌数 ----------------//
  564 + /**
  565 + * 获取高峰建议配车数(TODO:参照一下)。
  566 + * @returns {Number|*}
  567 + */
  568 + getAdvicePeakClzs: function() {
  569 + _validInternal(); // 验证
  570 + return parseInt(_formMap.gfjypcs);
  571 + },
  572 + /**
  573 + * 获取加班路牌数(5休2路牌的个数)。
  574 + * @returns {Number|*}
  575 + */
  576 + getJBLpes: function() {
  577 + _validInternal(); // 验证
  578 + return parseInt(_formMap.jbclcount);
  579 + },
  580 +
  581 + //----------------- 获取关联数据信息 -----------------//
  582 + /**
  583 + * 获取线路id。
  584 + */
  585 + getXlId: function() {
  586 + _validInternal(); // 验证
  587 + return _xlObj.xl.id;
  588 + },
  589 + /**
  590 + * 获取停车场id。
  591 + */
  592 + getTccId: function() {
  593 + _validInternal(); // 验证
  594 + return _parkObj.park.id;
  595 + },
  596 + /**
  597 + * 获取时刻表id。
  598 + */
  599 + getTTinfoId: function() {
  600 + _validInternal(); // 验证
  601 + return _ttInfoObj.ttinfo.id;
  602 + },
  603 + /**
  604 + * 获取上行起点站对象。
  605 + * @returns {{id: *}}
  606 + */
  607 + getUpQdzObj: function() {
  608 + _validInternal(); // 验证
  609 + return {
  610 + id: _startEndStopObj.up.qdz.id
  611 + };
  612 + },
  613 + /**
  614 + * 获取上行终点站对象。
  615 + * @returns {{id: *}}
  616 + */
  617 + getUpZdzObj: function() {
  618 + _validInternal(); // 验证
  619 + return {
  620 + id: _startEndStopObj.up.zdz.id
  621 + };
  622 + },
  623 + /**
  624 + * 获取下行起点站对象。
  625 + * @returns {{id: *}}
  626 + */
  627 + getDownQdzObj: function() {
  628 + _validInternal(); // 验证
  629 + return {
  630 + id: _startEndStopObj.down.qdz.id
  631 + };
  632 + },
  633 + /**
  634 + * 获取下行终点站对象。
  635 + * @returns {{id: *}}
  636 + */
  637 + getDownZdzObj: function() {
  638 + _validInternal(); // 验证
  639 + return {
  640 + id: _startEndStopObj.down.zdz.id
  641 + };
  642 + },
  643 +
  644 + //-------------- 时间操作 ------------//
  645 + /**
  646 + * 通过字符串创建时间对象。
  647 + * @param timeStr 时间字符串
  648 + * @returns {moment对象}
  649 + */
  650 + toTimeObj: function(timeStr) {
  651 + _validInternal(); // 验证
  652 + return _wrapTimeFun(timeStr);
  653 + },
  654 + /**
  655 + * 增加分钟。
  656 + * @param timeObj 时间对象
  657 + * @param minute 分钟
  658 + * @returns {重新创建一个moment返回}
  659 + */
  660 + addMinute: function(timeObj, minute) {
  661 + _validInternal(); // 验证
  662 + return _addTimeFun(timeObj, minute, "m");
  663 + },
  664 +
  665 + //-------------- 时间业务操作 ------------//
  666 + /**
  667 + * 判定某个班次是否是早高峰班次。
  668 + * @param timeObj 班次时间
  669 + * @returns true false
  670 + */
  671 + isMPeakBc: function(timeObj) {
  672 + _validInternal(); // 验证
  673 + var paramObj = this;
  674 + // 早高峰开始时间
  675 + var st = paramObj.getMPeakStartTimeObj();
  676 + // 早高峰结束时间
  677 + var et = paramObj.getMPeakEndTimeObj();
  678 + // 包装日期
  679 + return timeObj.isBetween(st, et, null, "[]");
  680 + },
  681 + /**
  682 + * 判定某个班次是否是晚高峰班次。
  683 + * @param timeObj 班次时间
  684 + * @returns true false
  685 + */
  686 + isEPeakBc: function(timeObj) {
  687 + _validInternal(); // 验证
  688 + var paramObj = this;
  689 + // 晚高峰开始时间
  690 + var st = paramObj.getEPeakStartTimeObj();
  691 + // 晚高峰结束时间
  692 + var et = paramObj.getEPeakEndTimeObj();
  693 + // 包装日期
  694 + return timeObj.isBetween(st, et, null, "[]");
  695 + },
  696 + /**
  697 + * 判定某个班次是否是低谷班次。
  698 + * @param timeObj 班次时间
  699 + * @returns true false
  700 + */
  701 + isTroughBc: function(timeObj) {
  702 + _validInternal(); // 验证
  703 + var paramObj = this;
  704 + return (
  705 + !this.isMPeakBc(timeObj) &&
  706 + !this.isEPeakBc(timeObj)
  707 + );
  708 + },
  709 + /**
  710 + * 判定某个低谷班次是否在早高峰开始之前。
  711 + * @param timeObj 班次时间
  712 + * @returns true false
  713 + */
  714 + isTroughBeforMPeakStartBc: function(timeObj) {
  715 + _validInternal(); // 验证
  716 + var paramObj = this;
  717 + // 早高峰开始时间
  718 + var st = paramObj.getMPeakStartTimeObj();
  719 + // 包装日期
  720 + return timeObj.isBefore(st);
  721 + },
  722 + /**
  723 + * 判定某个低谷班次是否在晚高峰结束之后。
  724 + * @param timeObj 班次时间
  725 + * @returns true false
  726 + */
  727 + isTroughAfterEPeakEndBc: function(timeObj) {
  728 + _validInternal(); // 验证
  729 + var paramObj = this;
  730 + // 晚高峰结束时间
  731 + var et = paramObj.getEPeakEndTimeObj();
  732 + // 包装日期
  733 + return timeObj.isAfter(et);
  734 + },
  735 +
  736 + /**
  737 + * 获取固定的停站时间(固定停站时间都是选的最大值)
  738 + * @param timeObj 时间对象
  739 + * @param isUp 是否上行
  740 + * @returns number
  741 + */
  742 + calcuFixedStopNumber: function(timeObj, isUp) {
  743 + _validInternal(); // 验证
  744 + var paramObj = this;
  745 +
  746 + var peakStopTime; // 高峰停站时间
  747 + var troughStopTime; // 低谷停站时间
  748 + var secondaryStopTime; // 副站停站时间
  749 +
  750 + // 双向停站
  751 + if (paramObj.isTwoWayStop()) {
  752 + if (isUp) { // 上行
  753 + if (this.isMPeakBc(timeObj)) { // 早高峰
  754 + peakStopTime = Math.floor(paramObj.getUpMPeakTime() * 0.1); // 行驶时间的10%
  755 + if (peakStopTime < 3) { // 不少于3分钟
  756 + peakStopTime = 3;
  757 + }
  758 + return peakStopTime;
  759 + } else if (this.isEPeakBc(timeObj)) { // 晚高峰
  760 + peakStopTime = Math.floor(paramObj.getUpEPeakTime() * 0.1); // 行驶时间的10%
  761 + if (peakStopTime < 3) { // 不少于3分钟
  762 + peakStopTime = 3;
  763 + }
  764 + return peakStopTime;
  765 + } else { // 低谷
  766 + if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前
  767 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20%
  768 + if (troughStopTime < 10) { // 不少于10分钟
  769 + troughStopTime = 10;
  770 + }
  771 + return troughStopTime;
  772 + } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后
  773 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20%
  774 + if (troughStopTime < 10) { // 不少于10分钟
  775 + troughStopTime = 10;
  776 + }
  777 + return troughStopTime;
  778 + } else { // 早高峰,晚高峰之间
  779 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.15); // 行驶时间15%
  780 + if (troughStopTime < 10) { // 不少于10分钟
  781 + troughStopTime = 10;
  782 + }
  783 + return troughStopTime;
  784 + }
  785 + }
  786 + } else { // 下行
  787 + if (this.isMPeakBc(timeObj)) { // 早高峰
  788 + peakStopTime = Math.floor(paramObj.getDownMPeakTime() * 0.1); // 行驶时间的10%
  789 + if (peakStopTime < 3) { // 不少于3分钟
  790 + peakStopTime = 3;
  791 + }
  792 + return peakStopTime;
  793 + } else if (this.isEPeakBc(timeObj)) { // 晚高峰
  794 + peakStopTime = Math.floor(paramObj.getDownEPeakTime() * 0.1); // 行驶时间的10%
  795 + if (peakStopTime < 3) { // 不少于3分钟
  796 + peakStopTime = 3;
  797 + }
  798 + return peakStopTime;
  799 + } else { // 低谷
  800 + if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前
  801 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20%
  802 + if (troughStopTime < 10) { // 不少于10分钟
  803 + troughStopTime = 10;
  804 + }
  805 + return troughStopTime;
  806 + } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后
  807 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20%
  808 + if (troughStopTime < 10) { // 不少于10分钟
  809 + troughStopTime = 10;
  810 + }
  811 + return troughStopTime;
  812 + } else { // 早高峰,晚高峰之间
  813 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.15); // 行驶时间15%
  814 + if (troughStopTime < 10) { // 不少于10分钟
  815 + troughStopTime = 10;
  816 + }
  817 + return troughStopTime;
  818 + }
  819 + }
  820 + }
  821 + } else { // 主站停站
  822 + if (isUp == paramObj.isUpOneWayStop()) {
  823 + if (isUp) { // 上行
  824 + if (this.isMPeakBc(timeObj)) { // 早高峰
  825 + peakStopTime = Math.floor(paramObj.getUpMPeakTime() * 0.1); // 行驶时间的10%
  826 + if (peakStopTime < 3) { // 不少于3分钟
  827 + peakStopTime = 3;
  828 + }
  829 + return peakStopTime;
  830 + } else if (this.isEPeakBc(timeObj)) { // 晚高峰
  831 + peakStopTime = Math.floor(paramObj.getUpEPeakTime() * 0.1); // 行驶时间的10%
  832 + if (peakStopTime < 3) { // 不少于3分钟
  833 + peakStopTime = 3;
  834 + }
  835 + return peakStopTime;
  836 + } else { // 低谷
  837 + if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前
  838 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20%
  839 + if (troughStopTime < 10) { // 不少于10分钟
  840 + troughStopTime = 10;
  841 + }
  842 + return troughStopTime;
  843 + } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后
  844 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20%
  845 + if (troughStopTime < 10) { // 不少于10分钟
  846 + troughStopTime = 10;
  847 + }
  848 + return troughStopTime;
  849 + } else { // 早高峰,晚高峰之间
  850 + troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.15); // 行驶时间15%
  851 + if (troughStopTime < 10) { // 不少于10分钟
  852 + troughStopTime = 10;
  853 + }
  854 + return troughStopTime;
  855 + }
  856 + }
  857 + } else { // 下行
  858 + if (this.isMPeakBc(timeObj)) { // 早高峰
  859 + peakStopTime = Math.floor(paramObj.getDownMPeakTime() * 0.1); // 行驶时间的10%
  860 + if (peakStopTime < 3) { // 不少于3分钟
  861 + peakStopTime = 3;
  862 + }
  863 + return peakStopTime;
  864 + } else if (this.isEPeakBc(timeObj)) { // 晚高峰
  865 + peakStopTime = Math.floor(paramObj.getDownEPeakTime() * 0.1); // 行驶时间的10%
  866 + if (peakStopTime < 3) { // 不少于3分钟
  867 + peakStopTime = 3;
  868 + }
  869 + return peakStopTime;
  870 + } else { // 低谷
  871 + if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前
  872 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20%
  873 + if (troughStopTime < 10) { // 不少于10分钟
  874 + troughStopTime = 10;
  875 + }
  876 + return troughStopTime;
  877 + } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后
  878 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20%
  879 + if (troughStopTime < 10) { // 不少于10分钟
  880 + troughStopTime = 10;
  881 + }
  882 + return troughStopTime;
  883 + } else { // 早高峰,晚高峰之间
  884 + troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.15); // 行驶时间15%
  885 + if (troughStopTime < 10) { // 不少于10分钟
  886 + troughStopTime = 10;
  887 + }
  888 + return troughStopTime;
  889 + }
  890 + }
  891 + }
  892 + } else { // 副站停战,2到3分钟
  893 + secondaryStopTime = 3;
  894 + return secondaryStopTime; // 直接返回3分钟
  895 + }
  896 + }
  897 +
  898 + },
  899 +
  900 + /**
  901 + * 获取行驶时间。
  902 + * @param timeObj 班次时间字符串
  903 + * @param isUp 是否上行
  904 + */
  905 + calcuTravelTime: function(timeObj, isUp) {
  906 + _validInternal(); // 验证
  907 + var paramObj = this;
  908 +
  909 + if (isUp) {
  910 + if (this.isMPeakBc(timeObj)) {
  911 + return paramObj.getUpMPeakTime();
  912 + } else if (this.isEPeakBc(timeObj)) {
  913 + return paramObj.getUpEPeakTime();
  914 + } else {
  915 + return paramObj.getUpTroughTime();
  916 + }
  917 + } else {
  918 + if (this.isMPeakBc(timeObj)) {
  919 + return paramObj.getDownMPeakTime();
  920 + } else if (this.isEPeakBc(timeObj)) {
  921 + return paramObj.getDownEPeakTime();
  922 + } else {
  923 + return paramObj.getDownTroughTime();
  924 + }
  925 + }
  926 + },
  927 +
  928 + /**
  929 + * 获取行驶里程。
  930 + * @param isUp 是否上行
  931 + * @param bcType 班次类型
  932 + */
  933 + calcuTravelLcNumber: function(isUp, bcType) {
  934 + _validInternal(); // 验证
  935 + var paramObj = this;
  936 +
  937 + if (isUp) {
  938 + if (bcType == "in") {
  939 + return paramObj.getUpInLc();
  940 + } else if (bcType == "out") {
  941 + return paramObj.getUpOutLc();
  942 + } else {
  943 + // 基本班次类型,暂时不考虑区间等其他班次类型
  944 + // 暂时不考虑高峰低谷里程的区分
  945 + return paramObj.getUpNormalLc();
  946 + }
  947 + } else {
  948 + if (bcType == "in") {
  949 + return paramObj.getDownInLc();
  950 + } else if (bcType == "out") {
  951 + return paramObj.getDownOutLc();
  952 + } else {
  953 + // 基本班次类型,暂时不考虑区间等其他班次类型
  954 + // 暂时不考虑高峰低谷里程的区分
  955 + return paramObj.getDownNormalLc();
  956 + }
  957 + }
  958 + },
  959 +
  960 + /**
  961 + * 计算高峰周转时间。
  962 + * @returns 周转时间
  963 + */
  964 + calcuPeakZzsj: function() {
  965 + _validInternal(); // 验证
  966 + var paramObj = this;
  967 +
  968 + // 使用早高峰的周转时间
  969 + var _time = paramObj.getMPeakStartTimeObj();
  970 + var _zzsj = // 早高峰上行行驶时间+停站时间+早高峰下行行驶时间+停站时间
  971 + this.calcuTravelTime(_time, true) +
  972 + this.calcuFixedStopNumber(_time, true) +
  973 + this.calcuTravelTime(_time, false) +
  974 + this.calcuFixedStopNumber(_time, false);
  975 + return _zzsj;
  976 + },
  977 +
  978 + /**
  979 + * 计算低谷周转时间。
  980 + * @returns 周转时间
  981 + */
  982 + calcuTroughZzsj: function() {
  983 + _validInternal(); // 验证
  984 + var paramObj = this;
  985 +
  986 + // 使用低谷的周转时间
  987 + var _time = this.addMinute(paramObj.getMPeakStartTimeObj(), -1); // 使用任意一个低谷时间
  988 + var _zzsj = // 低谷上行行驶时间+停站时间+低谷下行行驶时间+停站时间
  989 + this.calcuTravelTime(_time, true) +
  990 + this.calcuFixedStopNumber(_time, true) +
  991 + this.calcuTravelTime(_time, false) +
  992 + this.calcuFixedStopNumber(_time, false);
  993 +
  994 + return _zzsj;
  995 + },
  996 +
  997 + /**
  998 + * 计算车辆总数。
  999 + * @returns 车辆数
  1000 + */
  1001 + calcuClzx: function() {
  1002 + _validInternal(); // 验证
  1003 + var paramObj = this;
  1004 +
  1005 + // 使用早高峰平均间隔
  1006 + var _fcjx_avg = Math.floor((paramObj.getMPeakMinFcjx() + paramObj.getMPeakMaxFcjx()) / 2);
  1007 + return Math.round(this.calcuPeakZzsj() / _fcjx_avg);
  1008 + }
  1009 +
  1010 + };
  1011 +};
0 1012 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js 0 → 100644
  1 +/**
  2 + * 内部班次对象。
  3 + * @constructor
  4 + */
  5 +var InternalBcObj = function(
  6 + bcType, // 班次类型(normal,in,out等)
  7 + isUp, // boolean是否上下行
  8 + lp, // 路牌标识符
  9 + fcno, // 发车顺序号
  10 + fcTimeObj, // 发车时间对象
  11 + bclc, // 班次里程
  12 + bcsj, // 班次历时
  13 + arrtime, // 到达时间对象
  14 + stoptime, // 停站时间
  15 + tccid, // 停车场id
  16 + ttinfoid, // 时刻表id
  17 + xl, // 线路id
  18 + qdzid, // 起点站id
  19 + zdzid // 终点站id
  20 +) {
  21 + // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k
  22 + // 外部函数使用 prototype 方式
  23 + this._$_bcType = bcType;
  24 + this._$_isUp = isUp;
  25 + this._$_lp = lp;
  26 + this._$_fcno = fcno;
  27 + this._$_fcsjObj = moment(fcTimeObj);
  28 + this._$_bclc = bclc;
  29 + this._$_bcsj = bcsj;
  30 + this._$_arrtime = arrtime;
  31 + this._$_stoptime = stoptime;
  32 + this._$_tccid = tccid;
  33 + this._$_ttinfoid = ttinfoid;
  34 + this._$_xlid = xl;
  35 + this._$_qdzid = qdzid;
  36 + this._$_zdzid = zdzid;
  37 +
  38 +};
  39 +
  40 +/**
  41 + * 设置路牌标号。
  42 + * @param lpNo
  43 + */
  44 +InternalBcObj.prototype.setLp = function(lpNo) {
  45 + this._$_lp = lpNo;
  46 +};
  47 +
  48 +/**
  49 + * 是否上行。
  50 + * @returns boolean
  51 + */
  52 +InternalBcObj.prototype.isUp = function() {
  53 + return this._$_isUp;
  54 +};
  55 +/**
  56 + * 获取发车时间。
  57 + * @returns {*|moment.Moment}
  58 + */
  59 +InternalBcObj.prototype.getFcTimeObj = function() {
  60 + return this._$_fcsjObj;
  61 +};
  62 +/**
  63 + * 获取到达时间。
  64 + * @returns {*|moment.Moment}
  65 + */
  66 +InternalBcObj.prototype.getArrTimeObj = function() {
  67 + return this._$_arrtime;
  68 +};
  69 +/**
  70 + * 获取班次时间。
  71 + * @returns int
  72 + */
  73 +InternalBcObj.prototype.getBcTime = function() {
  74 + return this._$_bcsj;
  75 +};
  76 +/**
  77 + * 获取停站时间。
  78 + * @returns int
  79 + */
  80 +InternalBcObj.prototype.getStopTime = function() {
  81 + return this._$_stoptime;
  82 +};
  83 +/**
  84 + * 转换成显示用班次对象。
  85 + * @returns {{}}
  86 + */
  87 +InternalBcObj.prototype.toGanttBcObj = function() {
  88 + var _bcObj = {
  89 + parent: this._$_lp,
  90 + lpNo: this._$_lp,
  91 + lp: null,
  92 + lpName: this._$_lp,
  93 + lpType: '普通路牌',
  94 + bcType: this._$_bcType,
  95 + fcno: this._$_fcno,
  96 + isfb: 0,
  97 + isSwitchXl: null,
  98 + bz: null
  99 + };
  100 +
  101 + // 线路上下行
  102 + _bcObj.xlDir = this._$_isUp ? "relationshipGraph-up" : "relationshipGraph-down";
  103 +
  104 + // 里程
  105 + _bcObj.jhlc = this._$_bclc;
  106 +
  107 + // 停车场
  108 + _bcObj.tcc = this._$_tccid;
  109 +
  110 + // 时刻表
  111 + _bcObj.ttinfo = this._$_ttinfoid;
  112 +
  113 + // 线路
  114 + _bcObj.xl = this._$_xlid;
  115 +
  116 + // 起点站、终点站
  117 + _bcObj.qdz = this._$_qdzid;
  118 + _bcObj.zdz = this._$_zdzid;
  119 +
  120 + // 发车时间,行驶时间,到达时间,停站时间
  121 + _bcObj.fcsj = this._$_fcsjObj.format("HH:mm");
  122 + _bcObj.bcsj = this._$_bcsj;
  123 + _bcObj.ARRIVALTIME = this._$_arrtime.format("HH:mm");
  124 + _bcObj.STOPTIME = this._$_stoptime;
  125 +
  126 + return _bcObj;
  127 +};
  128 +
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js 0 → 100644
  1 +/**
  2 + * 内部圈对象(一圈2个班次),圈是以上行计算,还是下行计算,由上标线决定
  3 + * 如果上标线是上行开始,则圈的第一个班次是上行,第二个班次是下行
  4 + * 一定是从第1圈开始,第0圈表示中标线的第一个班次,是下行班次,则第0圈的上行班次就是空的。
  5 + * @constructor
  6 + */
  7 +var InternalGroupBcObj = function(
  8 + isUp, // 是否上行,就是圈以上行开始,还是下行开始
  9 + bc1, // 第一班次
  10 + bc2 // 第二个班次
  11 +) {
  12 + this._$_isUp = isUp;
  13 +
  14 + this._$_internalBcArray = [];
  15 + this._$_internalBcArray.push(bc1);
  16 + this._$_internalBcArray.push(bc2);
  17 +};
  18 +
  19 +InternalGroupBcObj.prototype.getBc1 = function() {
  20 + return this._$_internalBcArray[0];
  21 +};
  22 +InternalGroupBcObj.prototype.getBc2 = function() {
  23 + return this._$_internalBcArray[1];
  24 +};
  25 +
  26 +InternalGroupBcObj.prototype.setBc1 = function(bc) {
  27 + this._$_internalBcArray[0] = bc;
  28 +};
  29 +InternalGroupBcObj.prototype.setBc2 = function(bc) {
  30 + this._$_internalBcArray[1] = bc;
  31 +};
  32 +InternalGroupBcObj.prototype.setLp = function(lp) {
  33 + var bc1 = this._$_internalBcArray[0];
  34 + var bc2 = this._$_internalBcArray[1];
  35 + if (bc1) {
  36 + bc1.setLp(lp);
  37 + }
  38 + if (bc2) {
  39 + bc2.setLp(lp);
  40 + }
  41 +};
0 42 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js 0 → 100644
  1 +/**
  2 + * 内部路牌对象。
  3 + * @constructor
  4 + */
  5 +var InternalLpObj = function(
  6 + lp, // 路牌编号
  7 + qCount, // 总共多少圈
  8 + isUp // 圈是以上行开始还是下行开始
  9 +) {
  10 + this._$_lp = lp;
  11 + this._$_isUp = isUp;
  12 +
  13 + // 距离上一个路牌的最小发车间隔时间
  14 + // 用于纵向添加班次的时候使用
  15 + // 默认第一个路牌为0
  16 + this._$_minVerticalIntervalTime = 0;
  17 +
  18 + // 路牌的圈数,注意每个路牌的圈数都是一致的,
  19 + // 但并不是每一圈都有值
  20 + // 第1圈从上标线开始
  21 + // 第0圈表示中标线的第一个班次组成的半圈
  22 + // 有多少圈根据最终迭代的结果来看
  23 + this._$_qCount = qCount;
  24 + // 保存的是 InternalGroupBcObj 对象
  25 + this._$_groupBcArray = new Array(qCount);
  26 +
  27 + var i;
  28 + for (i = 0; i < this._$_qCount; i++) {
  29 + this._$_groupBcArray[i] = new InternalGroupBcObj(
  30 + this._$_isUp, undefined, undefined);
  31 + }
  32 +
  33 + // 班型的相关变量
  34 + this._$_bx_isLb = false; // 是否连班
  35 + this._$_bx_isfb = false; // 是否分班
  36 + this._$_bx_isfb_5_2 = false; // 是否5休2分班
  37 +
  38 + // TODO:
  39 +
  40 +};
  41 +
  42 +InternalLpObj.prototype.setBxFb5_2 = function(fb) {
  43 + this._$_bx_isfb_5_2 = fb;
  44 +};
  45 +InternalLpObj.prototype.isBxFb5_2 = function() {
  46 + return this._$_bx_isfb_5_2;
  47 +};
  48 +InternalLpObj.prototype.setBxLb = function(lb) {
  49 + this._$_bx_isLb = lb;
  50 +};
  51 +InternalLpObj.prototype.isBxLb = function() {
  52 + return this._$_bx_isLb;
  53 +};
  54 +
  55 +InternalLpObj.prototype.setBxFb = function(fb) {
  56 + this._$_bx_isfb = fb;
  57 +};
  58 +InternalLpObj.prototype.isBxFb = function() {
  59 + return this._$_bx_isfb;
  60 +};
  61 +
  62 +/**
  63 + * 设置纵向最小发车间隔时间。
  64 + * @param v
  65 + */
  66 +InternalLpObj.prototype.setVerticalMinIntervalTime = function(v) {
  67 + // 第一个路牌,都为0
  68 + this._$_minVerticalIntervalTime = v;
  69 +};
  70 +/**
  71 + * 获取纵向最小发车间隔时间。
  72 + * @returns {number|*}
  73 + */
  74 +InternalLpObj.prototype.getVerticalMinIntervalTime = function() {
  75 + return this._$_minVerticalIntervalTime;
  76 +};
  77 +
  78 +/**
  79 + * 返回总共班次数。
  80 + */
  81 +InternalLpObj.prototype.getBcCount = function() {
  82 + var i;
  83 + var group;
  84 + var bccount = 0;
  85 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  86 + group = this._$_groupBcArray[i];
  87 + if (group) {
  88 + if (group.getBc1()) {
  89 + bccount += 1;
  90 + }
  91 + if (group.getBc2()) {
  92 + bccount += 1;
  93 + }
  94 + }
  95 + }
  96 +
  97 + return bccount;
  98 +};
  99 +
  100 +/**
  101 + * 获取最小(最早)班次对象。
  102 + * @return [{圈index},{班次index}]
  103 + */
  104 +InternalLpObj.prototype.getMinBcObjPosition = function() {
  105 + var i;
  106 + var bIndex = [];
  107 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  108 + if (this._$_groupBcArray[i].getBc1()) {
  109 + bIndex.push(i);
  110 + bIndex.push(0);
  111 + break;
  112 + }
  113 + if (this._$_groupBcArray[i].getBc2()) {
  114 + bIndex.push(i);
  115 + bIndex.push(1);
  116 + break;
  117 + }
  118 + }
  119 + return bIndex;
  120 +};
  121 +
  122 +// TODO
  123 +
  124 +/**
  125 + *
  126 + *
  127 + */
  128 +InternalLpObj.prototype.calcuLpBx = function() {
  129 +
  130 +};
  131 +
  132 +/**
  133 + * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。
  134 + * @returns arrays (InternalBcObj)
  135 + */
  136 +InternalLpObj.prototype.getBcArray = function() {
  137 + var bcArray = [];
  138 + var i;
  139 + var group;
  140 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  141 + group = this._$_groupBcArray[i];
  142 + if (group) {
  143 + group.getBc1() ? bcArray.push(group.getBc1()) : "";
  144 + group.getBc2() ? bcArray.push(group.getBc2()) : "";
  145 + }
  146 + }
  147 +
  148 + return bcArray;
  149 +};
  150 +
  151 +/**
  152 + * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌
  153 + * 注意,之前有班次会删除后再创建。
  154 + * @param startTime 开始时间
  155 + * @param endTime 结束时间
  156 + * @param isUp 第一个班次是上行还是下行
  157 + * @param fromQ 从第几圈开始加入
  158 + * @param paramObj 参数对象
  159 + * @param factory 工厂对象
  160 + */
  161 +InternalLpObj.prototype.initDataFromTimeToTime = function(
  162 + startTime,
  163 + endTime,
  164 + isUp,
  165 + fromQ,
  166 + paramObj,
  167 + factory) {
  168 +
  169 + var bcData = []; // 班次数组
  170 + var bcObj;
  171 + var kssj = startTime;
  172 + var fcno = 1; // 发车顺序号
  173 + var bcCount = 1; // 班次数
  174 + do {
  175 + bcObj = factory.createBcObj(
  176 + "normal", isUp, this._$_lp, fcno, kssj, paramObj);
  177 + bcData.push(bcObj);
  178 +
  179 + kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());
  180 + fcno ++;
  181 + bcCount ++;
  182 + isUp = !isUp;
  183 + } while(kssj.isBefore(endTime));
  184 + bcCount--;
  185 +
  186 + if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {
  187 + // 如果最后一个班次的到达时间超过结束时间,也要去除
  188 + bcData.splice(bcCount - 1, 1);
  189 + }
  190 +
  191 + this.initDataFromLbBcArray(bcData, fromQ);
  192 +
  193 +};
  194 +
  195 +/**
  196 + * 使用连班的班次数组初始化路牌。
  197 + * @param bcArray 连班班次数组
  198 + * @param fromQ 从第几圈开始加入
  199 + */
  200 +InternalLpObj.prototype.initDataFromLbBcArray = function(
  201 + bcArray,
  202 + fromQ
  203 +) {
  204 + // 第一班次是上行还是下行
  205 + var isUp = bcArray[0].isUp();
  206 +
  207 + if (bcArray.length > 0 && fromQ < this._$_qCount) {
  208 + // 构造圈数
  209 + if (isUp != this._$_isUp) {
  210 + // 如果方向不一致,意味着第一个班次是半圈
  211 + // 加半圈,并加在bc2上
  212 + this._$_groupBcArray[fromQ] =
  213 + new InternalGroupBcObj(
  214 + this._$_isUp,
  215 + undefined,
  216 + bcArray.slice(0, 1)[0]
  217 + );
  218 + bcArray.splice(0, 1);
  219 + fromQ ++;
  220 + }
  221 +
  222 + var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈
  223 + var qCount2 = bcArray.length % 2; // 最后是否有半圈
  224 +
  225 + while (fromQ < this._$_qCount) {
  226 + if (qCount1 > 0) {
  227 + this._$_groupBcArray[fromQ] =
  228 + new InternalGroupBcObj(
  229 + this._$_isUp,
  230 + bcArray.slice(0, 1)[0],
  231 + bcArray.slice(1, 2)[0]
  232 + );
  233 + bcArray.splice(0, 2);
  234 + qCount1 --;
  235 + } else if (qCount2 > 0) {
  236 + // 加半圈,并加在bc1上
  237 + this._$_groupBcArray[fromQ] =
  238 + new InternalGroupBcObj(
  239 + this._$_isUp,
  240 + bcArray.slice(0, 1)[0],
  241 + undefined
  242 + );
  243 + } else {
  244 + break;
  245 + }
  246 +
  247 + fromQ ++;
  248 + }
  249 + }
  250 +};
  251 +
  252 +/**
  253 + * 获取班次。
  254 + * @param qIndex 第几圈
  255 + * @param bcIndex 第几个班次
  256 + */
  257 +InternalLpObj.prototype.getBc = function(qIndex, bcIndex) {
  258 + var group = this._$_groupBcArray[qIndex];
  259 + var bc;
  260 + if (bcIndex == 0) {
  261 + bc = group.getBc1();
  262 + } else if (bcIndex == 1) {
  263 + bc = group.getBc2();
  264 + }
  265 + return bc;
  266 +};
  267 +
  268 +/**
  269 + * 再具体位置设置班次。
  270 + * @param qIndex 第几圈
  271 + * @param bcIndex 第几个班次
  272 + * @param bc 班次对象
  273 + */
  274 +InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) {
  275 + var group = this._$_groupBcArray[qIndex];
  276 + if (bcIndex == 0) {
  277 + group.setBc1(bc);
  278 + } else if (bcIndex == 1) {
  279 + group.setBc2(bc);
  280 + }
  281 +};
  282 +
  283 +/**
  284 + * 设置班次的路牌编号。
  285 + * @param lpNo
  286 + */
  287 +InternalLpObj.prototype.setLp = function(lpNo) {
  288 + var i;
  289 + var group;
  290 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  291 + group = this._$_groupBcArray[i];
  292 + if (group) {
  293 + group.setLp(lpNo);
  294 + }
  295 + }
  296 +};
  297 +
  298 +/**
  299 + * 使用指定时间匹配返回离之最近的第几圈第几个班次,
  300 + * 使用时间差的绝度值,比较,取最小的
  301 + * 如果有两个一样的时间差,取比fctime大的时间
  302 + * @param fctime 比较用时间
  303 + * @param groupArray 圈数组
  304 + * @returns [{第几圈},{第几个班次}]
  305 + */
  306 +InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
  307 + fctime, groupArray
  308 +) {
  309 + var i;
  310 + var timediff; // 时间差取绝对值
  311 + var qIndex;
  312 + var bcIndex;
  313 +
  314 + var group;
  315 + var bc1time;
  316 + var bc2time;
  317 +
  318 + var tempdiff;
  319 + for (i = 0; i < this._$_qCount; i++) {
  320 + group = groupArray[i];
  321 + if (group) {
  322 + if (group.getBc1()) {
  323 + bc1time = group.getBc1().getFcTimeObj();
  324 + tempdiff = Math.abs(bc1time.diff(fctime));
  325 +
  326 + if (!timediff) {
  327 + timediff = Math.abs(tempdiff);
  328 + qIndex = i;
  329 + bcIndex = 0;
  330 + } else {
  331 + if (tempdiff < timediff) {
  332 + timediff = tempdiff;
  333 + qIndex = i;
  334 + bcIndex = 0;
  335 + } if (Math.abs(tempdiff) == timediff) {
  336 + if (bc1time.isBefore(fctime)) {
  337 + timediff = tempdiff;
  338 + qIndex = i;
  339 + bcIndex = 0;
  340 + }
  341 +
  342 + }
  343 + }
  344 + }
  345 +
  346 + if (group.getBc2()) {
  347 + bc2time = group.getBc2().getFcTimeObj();
  348 + tempdiff = Math.abs(bc2time.diff(fctime));
  349 +
  350 + if (!timediff) {
  351 + timediff = Math.abs(tempdiff);
  352 + qIndex = i;
  353 + bcIndex = 1;
  354 + } else {
  355 + if (tempdiff < timediff) {
  356 + timediff = tempdiff;
  357 + qIndex = i;
  358 + bcIndex = 1;
  359 + } if (Math.abs(tempdiff) == timediff) {
  360 + if (bc2time.isBefore(fctime)) {
  361 + timediff = tempdiff;
  362 + qIndex = i;
  363 + bcIndex = 1;
  364 + }
  365 +
  366 + }
  367 + }
  368 + }
  369 + }
  370 + }
  371 +
  372 + var rst = [];
  373 + rst.push(qIndex);
  374 + rst.push(bcIndex);
  375 +
  376 + return rst;
  377 +};
  378 +
  379 +/**
  380 + * 使用指定时间匹配返回离之最近的第几圈第几个班次,
  381 + * 使用时间差的绝度值,比较,取最小的
  382 + * 如果有两个一样的时间差,取比fctime大的时间
  383 + * @param fctime 比较用时间
  384 + * @returns [{第几圈},{第几个班次}]
  385 + */
  386 +InternalLpObj.prototype.getQBcIndexWithFcTime = function(
  387 + fctime
  388 +) {
  389 + return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray);
  390 +};
  391 +
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js 0 → 100644
  1 +/**
  2 + * 内部行车计划对象。
  3 + * @constructor
  4 + */
  5 +var InternalScheduleObj = function(paramObj, lpArray, factory) {
  6 + // 参数对象
  7 + var _paramObj = paramObj;
  8 + // 外部的路牌数组
  9 + var _lpArray = lpArray;
  10 + // 工厂对象
  11 + var _factory = factory;
  12 +
  13 + //------------------ 初始化方法1,以及计算关联的内部变量 -----------------//
  14 + var _qIsUp; // 每一圈是上行开始还是下行开始
  15 + var _qCount = 0; // 总的圈数
  16 + var _internalLpArray = []; // 内部对象数组
  17 +
  18 + var _initFun1 = function() { // 初始化方法1
  19 + // 确定_qIsUp,哪个方向的首班车晚就用哪个
  20 + _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(
  21 + _paramObj.getDownFirstDTimeObj()) ? false : true;
  22 + // 上标线开始时间,就是方向的首班车时间
  23 + var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  24 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  25 + var et;
  26 + var et_IsUp;
  27 + if (_paramObj.getUpLastDtimeObj().isBefore(
  28 + _paramObj.getDownLastDTimeObj())) {
  29 + et = _paramObj.getDownLastDTimeObj();
  30 + et_IsUp = false;
  31 + } else {
  32 + et = _paramObj.getUpLastDtimeObj();
  33 + et_IsUp = true;
  34 + }
  35 +
  36 + // 以开始时间,结束时间,构造上标线用连班班次
  37 + var bcData = []; // 班次数组
  38 + var bcObj;
  39 + var isUp = _qIsUp; // 方向
  40 + var kssj = st;
  41 + var fcno = 1; // 发车顺序号
  42 + var bcCount = 1; // 班次数
  43 + do {
  44 + bcObj = _factory.createBcObj(
  45 + "normal", isUp, _lpArray[0].lpNo, fcno, kssj, paramObj);
  46 + bcData.push(bcObj);
  47 +
  48 + kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());
  49 + fcno ++;
  50 + bcCount ++;
  51 + isUp = !isUp;
  52 + } while(kssj.isBefore(et));
  53 + bcCount--; // 因为先做do,所以总的班次要减1
  54 + if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(et)) {
  55 + // 如果最后一个班次的到达时间超过结束时间,也要去除
  56 + bcData.splice(bcCount - 1, 1);
  57 + bcCount--;
  58 + }
  59 + var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
  60 + var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
  61 +
  62 + // 利用连班数组计算圈数
  63 + _qCount = 1; // 前面加1圈,补中标线的班次
  64 + _qCount += _qCount_p1;
  65 + _qCount += _qCount_p2;
  66 +
  67 + // 计算最后是不是还要补一圈
  68 + if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
  69 + if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
  70 + // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
  71 + // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
  72 + if (!_qIsUp == et_IsUp) {
  73 + // 一致不用加圈数
  74 + } else {
  75 + // 不一致需要加圈补最后一个结束时间班次
  76 + _qCount ++;
  77 + }
  78 + } else {
  79 + // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
  80 + // 不需要在补圈数了
  81 + }
  82 + }
  83 +
  84 + // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中
  85 + var i;
  86 + for (i = 0; i < _lpArray.length; i++) {
  87 + _internalLpArray.push(
  88 + new InternalLpObj(_lpArray[i].lpNo, _qCount, _qIsUp));
  89 + }
  90 + _internalLpArray[0].initDataFromLbBcArray(bcData, 1); // 上标线从第1圈开始放班次
  91 +
  92 + console.log("//---------------- 行车计划,初始化方法1 start ----------------//");
  93 + console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +
  94 + "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm"));
  95 + console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") +
  96 + "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm"));
  97 + console.log("总共计算的圈数:" + _qCount);
  98 + console.log("圈的方向isUP:" + _qIsUp);
  99 + console.log("//---------------- 行车计划,初始化方法1 end ----------------//");
  100 +
  101 + };
  102 +
  103 + //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//
  104 + var _zgfQIndex; // 早高峰车辆从第几圈开始全部发出
  105 + var _zgfBIndex; // 早高峰车辆从第几圈第几个班次全部发出
  106 + var _wgfQIndex; // 晚高峰车辆从第几圈开始全部发出
  107 + var _wgfBIndex; // 晚高峰车辆从第几圈第几个班次全部发出
  108 +
  109 + // 同一圈同一方向班次发车间隔的最小值
  110 + // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明
  111 + var _qbcMinIntervalValue;
  112 +
  113 + var _initFun2 = function() { // 初始化方法2
  114 + // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次
  115 + // 以这个班次为早高峰起点,全部出车策略
  116 + var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  117 + _paramObj.getMPeakStartTimeObj());
  118 + var qIndex = qbcIndexArray[0]; // 第几圈
  119 + var bIndex = qbcIndexArray[1]; // 第几个班次
  120 + var startbc = _internalLpArray[0].getBc(qIndex, bIndex);
  121 +
  122 + // 计算早高峰
  123 + var _clCount = _paramObj.calcuClzx();
  124 + var _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);
  125 + var _c2 = _paramObj.calcuPeakZzsj() % _clCount;
  126 + var _kssj = startbc.getFcTimeObj();
  127 +
  128 + var i;
  129 + for (i = 2; i <= _clCount - _c2; i++) {
  130 + _kssj = _paramObj.addMinute(_kssj, _c1);
  131 + _internalLpArray[i - 1].setBc(
  132 + qIndex,
  133 + bIndex,
  134 + _factory.createBcObj(
  135 + "normal", startbc.isUp(),
  136 + _lpArray[i - 1].lpNo,
  137 + 1, _kssj, paramObj)
  138 + );
  139 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔
  140 + _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1);
  141 + }
  142 + for (i = 1; i <= _c2; i++) {
  143 + _kssj = _paramObj.addMinute(_kssj, _c1 + 1);
  144 + _internalLpArray[_clCount - _c2 + i - 1].setBc(
  145 + qIndex,
  146 + bIndex,
  147 + _factory.createBcObj(
  148 + "normal", startbc.isUp(),
  149 + _lpArray[_clCount - _c2 + i - 1].lpNo,
  150 + 1, _kssj, paramObj)
  151 + );
  152 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔
  153 + _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1);
  154 + }
  155 +
  156 + _zgfQIndex = qIndex;
  157 + _zgfBIndex = bIndex;
  158 +
  159 + // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次
  160 + // 以这个班次为早高峰起点,全部出车策略
  161 + qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  162 + _paramObj.getEPeakStartTimeObj());
  163 + qIndex = qbcIndexArray[0]; // 第几圈
  164 + bIndex = qbcIndexArray[1]; // 第几个班次
  165 + startbc = _internalLpArray[0].getBc(qIndex, bIndex);
  166 +
  167 + // 计算晚高峰
  168 + _clCount = _paramObj.calcuClzx();
  169 + _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);
  170 + _c2 = _paramObj.calcuPeakZzsj() % _clCount;
  171 + _kssj = startbc.getFcTimeObj();
  172 +
  173 + for (i = 2; i <= _clCount - _c2; i++) {
  174 + _kssj = _paramObj.addMinute(_kssj, _c1);
  175 + _internalLpArray[i - 1].setBc(
  176 + qIndex,
  177 + bIndex,
  178 + _factory.createBcObj(
  179 + "normal", startbc.isUp(),
  180 + _lpArray[i - 1].lpNo,
  181 + 1, _kssj, _paramObj)
  182 + );
  183 + }
  184 + for (i = 1; i <= _c2; i++) {
  185 + _kssj = _paramObj.addMinute(_kssj, _c1 + 1);
  186 + _internalLpArray[_clCount - _c2 + i - 1].setBc(
  187 + qIndex,
  188 + bIndex,
  189 + _factory.createBcObj(
  190 + "normal", startbc.isUp(),
  191 + _lpArray[_clCount - _c2 + i - 1].lpNo,
  192 + 1, _kssj, _paramObj)
  193 + );
  194 + }
  195 +
  196 + _wgfQIndex = qIndex;
  197 + _wgfBIndex = bIndex;
  198 + _qbcMinIntervalValue = _c1;
  199 +
  200 + console.log("//---------------- 行车计划,初始化方法2 start ----------------//");
  201 + console.log("早高峰第" + _zgfQIndex + "(index)圈,第" + _zgfBIndex + "(index)班次车辆全部发出");
  202 + console.log("晚高峰第" + _wgfQIndex + "(index)圈,第" + _wgfBIndex + "(index)班次车辆全部发出");
  203 + console.log("同圈同方向班次最小间隔(分钟):" + _qbcMinIntervalValue);
  204 + console.log("//---------------- 行车计划,初始化方法2 end ----------------//");
  205 + };
  206 +
  207 + //----------------------- 初始化方法3,以及计算关联的内部变量 ----------------//
  208 + var _zbx_lpIndex; // 中标线对应第几个路牌
  209 +
  210 + var _initFun3 = function() { // 初始化方法3
  211 + // 构造中标线
  212 + // 中标线开始时间,就是方向的首班车时间
  213 + var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  214 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  215 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  216 + var et;
  217 + if (_paramObj.getUpLastDtimeObj().isBefore(
  218 + _paramObj.getDownLastDTimeObj())) {
  219 + et = _paramObj.getDownLastDTimeObj();
  220 + } else {
  221 + et = _paramObj.getUpLastDtimeObj();
  222 + }
  223 +
  224 + var tempLpObj = new InternalLpObj(-999, _qCount, _qIsUp);
  225 + tempLpObj.initDataFromTimeToTime(
  226 + st,
  227 + et,
  228 + !_qIsUp,
  229 + 0,
  230 + _paramObj,
  231 + _factory
  232 + );
  233 +
  234 + // 找出中标线对应的早高峰的班次对象
  235 + var _zb_bcobj = tempLpObj.getBc(_zgfQIndex, _zgfBIndex);
  236 +
  237 + // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
  238 + var _tempq_array = [];
  239 + var _temp_group;
  240 + var _temp_bc;
  241 + var i;
  242 + for (i = 0; i < _internalLpArray.length; i++) {
  243 + _temp_bc = _internalLpArray[i].getBc(_zgfQIndex, _zgfBIndex);
  244 + if (_temp_bc.isUp() == _qIsUp) {
  245 + _temp_group = new InternalGroupBcObj(_qIsUp, _temp_bc, undefined);
  246 + } else {
  247 + _temp_group = new InternalGroupBcObj(_qIsUp, undefined, _temp_bc);
  248 + }
  249 + _tempq_array.push(_temp_group);
  250 + }
  251 +
  252 + var _ttindex_ = tempLpObj.getgetQBcIndexWithFcTimeFromGroupArray(
  253 + _zb_bcobj.getFcTimeObj(),
  254 + _tempq_array
  255 + );
  256 + _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌
  257 + tempLpObj.setLp(_lpArray[_zbx_lpIndex].lpNo);
  258 + tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔
  259 + _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime()
  260 + );
  261 +
  262 + // 注意:这里直接把中标线数据替换到指定路牌位置
  263 + // TODO:由初始化方法1,初始化方法2得到的2个高峰的班次会被中标线对应班次覆盖
  264 + // TODO:目前使用中标线的班次覆盖,以后相互动态调整
  265 +
  266 + _internalLpArray[_zbx_lpIndex] = tempLpObj;
  267 +
  268 + console.log("//---------------- 行车计划,初始化方法3 start ----------------//");
  269 + console.log("中标线对应第" + (_zbx_lpIndex + 1) + "个路牌");
  270 + console.log("//---------------- 行车计划,初始化方法3 end ----------------//");
  271 +
  272 + };
  273 +
  274 + //----------------------- 初始化方法4,以及计算关联的内部变量 ----------------//
  275 + var _bx_lb_lpcount; // 连班路牌数
  276 + var _bx_5_2_fb_lpcount; // 5休2分班路牌数
  277 + var _bx_other_fb_lpcount; // 其他分班路牌数
  278 +
  279 + var _initFun4 = function() { // 初始化方法4
  280 + // 总共车辆数(高峰最大车辆数)
  281 + var cls = _paramObj.calcuClzx();
  282 + // 低谷最少配车(连班车数量)
  283 + var dgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx());
  284 + // 加班车路牌数(做5休2的路牌数)
  285 + var _5_2_lpes = _paramObj.getJBLpes();
  286 +
  287 + // 做些简单的验证
  288 + if (cls < dgminpc) {
  289 + alert("总配车数小于低谷最小配车");
  290 + throw "总配车数小于低谷最小配车";
  291 + }
  292 + if (dgminpc < 2) {
  293 + alert("连班路牌小于2,办不到啊");
  294 + throw "连班路牌小于2,办不到啊";
  295 + }
  296 + if (cls - dgminpc < _5_2_lpes) {
  297 + alert("总分班路牌数小于加班路牌数");
  298 + throw "总分班路牌数小于加班路牌数";
  299 + }
  300 +
  301 + _bx_lb_lpcount = dgminpc;
  302 + _bx_5_2_fb_lpcount = _5_2_lpes;
  303 + _bx_other_fb_lpcount = cls - dgminpc - _5_2_lpes;
  304 +
  305 + console.log("//---------------- 行车计划,初始化方法4 start ----------------//");
  306 + console.log("连班路牌数:" + _bx_lb_lpcount);
  307 + console.log("5休2分班路牌数:" + _bx_5_2_fb_lpcount);
  308 + console.log("其他分班路牌数:" + _bx_other_fb_lpcount);
  309 + console.log("//---------------- 行车计划,初始化方法4 end ----------------//");
  310 + };
  311 +
  312 +
  313 + return {
  314 + //------------- 布局初始化方法 ------------//
  315 + /**
  316 + * 初始化数据,使用标线初始化
  317 + */
  318 + initDataWithBxLayout: function() {
  319 + // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中
  320 + _initFun1();
  321 + // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次
  322 + _initFun2();
  323 + // 初始化布局3,构造中标线,根据高峰班次,将中标线放入合适的路牌中
  324 + _initFun3();
  325 + // 初始化4,计算连班,分班相关路牌数
  326 + _initFun4();
  327 +
  328 + // 测试添加班次
  329 + //this._generateBc(8, 1, 0);
  330 + //this._generateBc(10, 1, 0);
  331 + //this._generateBc(11, 1, 0);
  332 + //this._generateBc(12, 1, 0);
  333 + //this._generateBc(13, 1, 0);
  334 + //this._generateBc(14, 1, 0);
  335 + //this._generateBc(15, 1, 0);
  336 + //this._generateBc(16, 1, 0);
  337 + //this._generateBc(17, 1, 0);
  338 + //this._generateBc(18, 1, 0);
  339 + //
  340 + //this._generateBc(10, 1, 1);
  341 + //this._generateBc(11, 1, 1);
  342 + //this._generateBc(12, 1, 1);
  343 + //this._generateBc(13, 1, 1);
  344 + //this._generateBc(14, 1, 1);
  345 + //this._generateBc(15, 1, 1);
  346 + //this._generateBc(16, 1, 1);
  347 + //this._generateBc(17, 1, 1);
  348 + //this._generateBc(18, 1, 1);
  349 +
  350 + // TODO:
  351 +
  352 + // 测试时间判定
  353 + //console.log("班次出车时间:" + _internalLpArray[0].getQBcIndexWithFcTime(
  354 + // _paramObj.getMPeakStartTimeObj()
  355 + // ));
  356 +
  357 + //// 测试画中标线,第6个路牌的位置,下行中标
  358 + //_internalLpArray[7].initDataFromTimeToTime(
  359 + // _paramObj.getDownFirstDTimeObj(),
  360 + // _paramObj.getUpLastDtimeObj(),
  361 + // false,
  362 + // 0,
  363 + // _paramObj,
  364 + // _factory
  365 + //);
  366 +
  367 + },
  368 +
  369 + // TODO:
  370 +
  371 + /**
  372 + * 根据每个路牌的连班班型补充班次。
  373 + * 补充连班的班次,参照上标线,中标线补充不足的班次
  374 + */
  375 + calcuLpBx_lb: function() {
  376 + // 补充连班的班次,参照上标线,中标线补充不足的班次
  377 + var _zgffcsj; // 早高峰发车时间
  378 + var _etsj = // 结束时间
  379 + _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ?
  380 + _paramObj.getDownLastDTimeObj() :
  381 + _paramObj.getUpLastDtimeObj();
  382 +
  383 + var _lp;
  384 + var _minbcPos;
  385 + var _bcObj;
  386 + var i;
  387 + for (i = 0; i < _internalLpArray.length; i++) {
  388 + _lp = _internalLpArray[i];
  389 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  390 + _minbcPos = _lp.getMinBcObjPosition();
  391 + _bcObj = _lp.getBc(_minbcPos[0], _minbcPos[1]);
  392 + _zgffcsj = _bcObj.getFcTimeObj();
  393 + // 重新初始化连班班型班次
  394 + _lp.initDataFromTimeToTime(
  395 + _zgffcsj,
  396 + _etsj,
  397 + _bcObj.isUp(),
  398 + _minbcPos[0],
  399 + _paramObj,
  400 + _factory
  401 + );
  402 + }
  403 + }
  404 +
  405 + // 还要补充缺失的班次,差上标线几个班次要往前补上
  406 + var _bccount;
  407 + var j;
  408 + var _qIndex;
  409 + var _bIndex;
  410 + // 补上标线到中标线之间的连班路牌的班次
  411 + for (i = 0; i < _zbx_lpIndex; i++) {
  412 + _lp = _internalLpArray[i];
  413 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  414 + _minbcPos = _lp.getMinBcObjPosition();
  415 + _qIndex = _minbcPos[0];
  416 + _bIndex = _minbcPos[1];
  417 + _bccount = (_qIndex - 1) * 2 + _bIndex; // 距离上标线起始站点差几个班次
  418 + for (j = 0; j < _bccount; j++) {
  419 + if (_bIndex == 0) {
  420 + _qIndex --;
  421 + _bIndex = 1;
  422 + this._generateBc(i, _qIndex, _bIndex);
  423 + } else if (_bIndex == 1) {
  424 + _bIndex --;
  425 + this._generateBc(i, _qIndex, _bIndex);
  426 + }
  427 + }
  428 + }
  429 + }
  430 + // 补中标线以下的连班路牌的班次
  431 + for (i = _zbx_lpIndex; i < _internalLpArray.length; i++) {
  432 + _lp = _internalLpArray[i];
  433 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  434 + _minbcPos = _lp.getMinBcObjPosition();
  435 + _qIndex = _minbcPos[0];
  436 + _bIndex = _minbcPos[1];
  437 + _bccount = (_qIndex - 0) * 2 + _bIndex - 1; // 距离上标线起始站点差几个班次
  438 + for (j = 0; j < _bccount; j++) {
  439 + if (_bIndex == 0) {
  440 + _qIndex --;
  441 + _bIndex = 1;
  442 + this._generateBc(i, _qIndex, _bIndex);
  443 + } else if (_bIndex == 1) {
  444 + _bIndex --;
  445 + this._generateBc(i, _qIndex, _bIndex);
  446 + }
  447 + }
  448 + }
  449 + }
  450 +
  451 + },
  452 +
  453 + /**
  454 + * 计算每个路牌的班型及工时对应的圈数。
  455 + * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌
  456 + * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了,
  457 + * 其余分班路牌的工时由高峰低谷最大,最小发车间隔计算
  458 + */
  459 + calcuLpBx_fg: function() {
  460 + // 间隔法
  461 + // 除去上标线,中标线的连班路牌个数
  462 + var _lblbcount = _bx_lb_lpcount - 2;
  463 + // 计算由标线隔开的两个区域的路牌数比率
  464 + var _p1 = (_zbx_lpIndex + 1) / (_internalLpArray.length + 1);
  465 + var _p2 = (_internalLpArray.length - _zbx_lpIndex) / (_internalLpArray.length + 1);
  466 + var _p1_lpcount = _lblbcount * _p1;
  467 + var _p2_lpcount = _lblbcount * _p2;
  468 + if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除
  469 + _p1_lpcount = Math.floor(_p1_lpcount);
  470 + _p2_lpcount = Math.floor(_p2_lpcount) + 1;
  471 + }
  472 +
  473 + // 设定第一个区域的连班路牌
  474 + var i;
  475 + var _count = _p1_lpcount + 1;
  476 + var _c1 = Math.floor(_zbx_lpIndex / _count);
  477 + var _c2 = _zbx_lpIndex % _count;
  478 + var _c2_start_index;
  479 + for (i = 1; i <= _count - _c2; i++) {
  480 + _internalLpArray[(i - 1) * _c1].setBxLb(true);
  481 + _c2_start_index = (i - 1) * _c1;
  482 + }
  483 + for (i = 1; i <= _c2; i++) {
  484 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
  485 + }
  486 +
  487 + // 设定第二个区域的连班路牌
  488 + _count = _p2_lpcount + 1;
  489 + _c1 = Math.floor((_internalLpArray.length - _zbx_lpIndex - 1) / _count);
  490 + _c2 = (_internalLpArray.length - _zbx_lpIndex - 1) % _count;
  491 + for (i = 1; i <= _count - _c2; i++) {
  492 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true);
  493 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false);
  494 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false);
  495 + _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex;
  496 + }
  497 + for (i = 1; i <= _c2; i++) {
  498 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
  499 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false);
  500 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false);
  501 + }
  502 +
  503 + // 设定分班路牌
  504 + var notlbIndexes = []; // 去除连班的路牌index列表
  505 + for (i = 0; i < _internalLpArray.length; i++) {
  506 + if (!_internalLpArray[i].isBxLb()) {
  507 + notlbIndexes.push(i);
  508 + }
  509 + }
  510 + // 先把全部放置分班路牌,在全部放置5休2路牌
  511 + for (i = 0; i < _bx_other_fb_lpcount; i++) {
  512 + _internalLpArray[notlbIndexes[i]].setBxFb(false);
  513 + _internalLpArray[notlbIndexes[i]].setBxFb(true);
  514 + _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);
  515 + }
  516 + while (i < _bx_other_fb_lpcount + _bx_5_2_fb_lpcount) {
  517 + _internalLpArray[notlbIndexes[i]].setBxFb(false);
  518 + _internalLpArray[notlbIndexes[i]].setBxFb(true);
  519 + _internalLpArray[notlbIndexes[i]].setBxFb5_2(true);
  520 +
  521 + i++;
  522 + }
  523 +
  524 + // 测试打印
  525 + var lbIndexes = [];
  526 + for (i = 0; i < _internalLpArray.length; i++) {
  527 + if (_internalLpArray[i].isBxLb()) {
  528 + lbIndexes.push(i);
  529 + }
  530 + }
  531 + console.log("连班路牌indexes=" + lbIndexes);
  532 +
  533 + var _other_fbIndexes = [];
  534 + for (i = 0; i < _internalLpArray.length; i++) {
  535 + if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) {
  536 + _other_fbIndexes.push(i);
  537 + }
  538 + }
  539 + console.log("其他分班路牌indexes=" + _other_fbIndexes);
  540 +
  541 + var _5_2_fbIndexes = [];
  542 + for (i = 0; i < _internalLpArray.length; i++) {
  543 + if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) {
  544 + _5_2_fbIndexes.push(i);
  545 + }
  546 + }
  547 + console.log("5休2分班路牌indexes=" + _5_2_fbIndexes);
  548 + },
  549 +
  550 + /**
  551 + * 在指定位置生成班次(内部重要方法)。
  552 + * @param lpIndex 第几个路牌
  553 + * @param qIndex 第几圈
  554 + * @param bcIndex 第几个班次
  555 + */
  556 + _generateBc: function(lpIndex, qIndex, bcIndex) {
  557 + // 在初始化布局后使用,否则没有参照班次加不了
  558 + // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数
  559 + // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次
  560 +
  561 + // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加
  562 + // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加
  563 +
  564 + // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础
  565 + // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔
  566 + // 3、如果班次发车时间越界不管,有其余方法排除这种情况
  567 +
  568 + // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)
  569 + var _i;
  570 + var _bcObj;
  571 + for (_i = lpIndex - 1; _i >= 0; _i--) {
  572 + _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);
  573 + if (_bcObj) {
  574 + break;
  575 + }
  576 + }
  577 + if (!_bcObj) {
  578 + alert("无法在指定位置生成班次");
  579 + throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";
  580 + }
  581 +
  582 + // 2、计算发车间隔
  583 + var _intervalTime = 0;
  584 + for (_i = _i + 1; _i <= lpIndex; _i++) {
  585 + _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();
  586 + }
  587 +
  588 + // 3、计算班次并添加班次
  589 + var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);
  590 + _bcObj = _factory.createBcObj(
  591 + "normal", _bcObj.isUp(),
  592 + _lpArray[lpIndex].lpNo,
  593 + 1, _kssj, _paramObj);
  594 +
  595 + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
  596 +
  597 + // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题
  598 + // TODO:主要是由于中标线的问题,但是误差不会很大,
  599 + // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)
  600 + },
  601 +
  602 + //------------- 其他方法 -------------//
  603 + /**
  604 + * 内部数据转化成显示用的班次数组。
  605 + */
  606 + toGanttBcArray: function() {
  607 + var bcData = [];
  608 + var i;
  609 + var lpObj;
  610 + for (i = 0; i < _internalLpArray.length; i++) {
  611 + lpObj = _internalLpArray[i];
  612 + bcData = bcData.concat(lpObj.getBcArray());
  613 + }
  614 +
  615 + var ganttBcData = [];
  616 + for (i = 0; i < bcData.length; i++) {
  617 + ganttBcData.push(bcData[i].toGanttBcObj());
  618 + }
  619 +
  620 + return ganttBcData;
  621 + }
  622 +
  623 + // TODO:
  624 + };
  625 +};
0 626 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js 0 → 100644
  1 +/**
  2 + * 主类。
  3 + */
  4 +var Main_v2 = function() {
  5 + // 内部工厂类
  6 + var _factoryFun = function() {
  7 + return {
  8 + // 创建参数
  9 + createParameterObj: function(formMap, dataMap) {
  10 + var paramObj = ParameterObj();
  11 + paramObj.wrap(formMap, dataMap);
  12 + return paramObj;
  13 + },
  14 + // 创建班次对象
  15 + createBcObj: function(bcType, isUp, lp, fcno, fcTimeObj, paramObj) {
  16 + var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);
  17 + var _bcsj = paramObj.calcuTravelTime(fcTimeObj, isUp);
  18 + var _arrsj = paramObj.addMinute(fcTimeObj, _bcsj);
  19 + var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp);
  20 + var _tccid = paramObj.getTTinfoId();
  21 + var _ttinfoid = paramObj.getTTinfoId();
  22 + var _xl = paramObj.getXlId();
  23 + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  24 + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  25 +
  26 + return new InternalBcObj(
  27 + bcType, // 班次类型(normal,in,out等)
  28 + isUp, // boolean是否上下行
  29 + lp, // 路牌标识符
  30 + fcno, // 发车顺序号
  31 + fcTimeObj, // 发车时间对象
  32 + _bclc, // 班次里程
  33 + _bcsj, // 班次历时
  34 + _arrsj, // 到达时间对象
  35 + _stoptime, // 停站时间
  36 + _tccid, // 停车场id
  37 + _ttinfoid, // 时刻表id
  38 + _xl, // 线路id
  39 + _qdz, // 起点站id
  40 + _zdz // 终点站id
  41 + );
  42 + }
  43 + };
  44 + };
  45 + var _factory = _factoryFun();
  46 +
  47 + // 所有的时间使用moment.js计算
  48 +
  49 + var _paramObj; // 参数对象
  50 +
  51 + var _bxDesc = [ // 班型描述
  52 + {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0},
  53 + {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0},
  54 + {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0},
  55 + {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0},
  56 + {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0},
  57 + {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0},
  58 + {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0},
  59 + {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0}
  60 + ];
  61 +
  62 + return {
  63 + /**
  64 + * 工厂对象,创建不同的对象。
  65 + * @returns {{createParameterObj, createBcObj}}
  66 + */
  67 + getFactory: function() {
  68 + return _factory;
  69 + },
  70 +
  71 + /**
  72 + * 使用发车间隔策略生成时刻表。
  73 + * @param paramObj 参数对象
  74 + * @param lpArray 路牌数组
  75 + * @constructor
  76 + */
  77 + BXPplaceClassesTime03 : function(paramObj, lpArray) {
  78 + // 参数对象
  79 + _paramObj = paramObj;
  80 +
  81 + // 1、初始化行车计划
  82 + var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);
  83 + schedule.initDataWithBxLayout();
  84 +
  85 + // 2、计算每个路牌的班型及对应工时
  86 + schedule.calcuLpBx_fg();
  87 +
  88 + // 3、根据班型补充所有的不足班次
  89 + schedule.calcuLpBx_lb();
  90 +
  91 + // TODO:4、确定末班车
  92 +
  93 + // TODO:5、补进出场班次
  94 +
  95 +
  96 + //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
  97 + var gBcData = schedule.toGanttBcArray();
  98 + // TODO:班型再议
  99 + return {'json':gBcData,'bxrcgs':null};
  100 +
  101 + }
  102 +
  103 + };
  104 +
  105 +}();
0 106 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/tepms/fcjx_temp.html
... ... @@ -184,10 +184,10 @@
184 184 </div>
185 185 </div>
186 186 <div class="col-md-6">
187   - <label class="control-label col-md-5"><span class="required"> * </span>建议加班数 :</label>
  187 + <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label>
188 188 <div class="col-md-5">
189 189 <input type="text" class="form-control" name="jbclcount" id="jbclcount_id"
190   - placeholder="间隔">
  190 + placeholder="为0表示是周末时刻表">
191 191 </div>
192 192 </div>
193 193 </div>
... ... @@ -458,7 +458,7 @@
458 458 <div class="form-group">
459 459 <div class="col-md-6">
460 460 <label class="control-label col-md-5">
461   - <span class="required"> * </span> 建议加班数 :
  461 + <span class="required"> * </span> 建议加班路牌数 :
462 462 </label>
463 463 <div class="col-md-4">
464 464 <p class="form-control-static" data-display="jbclcount"> </p>
... ...
src/main/resources/static/pages/forms/mould/scheduleDaily.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -47,8 +47,8 @@
47 47 <span class="item-label" style="width: 80px;margin-left: 33px;">线路: </span>
48 48 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
49 49 </div>
50   - <div style="display: inline-block;margin-left: 24px;">
51   - <span class="item-label" style="width: 80px;">&nbsp;&nbsp;&nbsp;时间: </span>
  50 + <div style="display: inline-block;margin-left: 38px;">
  51 + <span class="item-label" style="width: 80px;">时间: </span>
52 52 <input class="form-control" type="text" id="date" style="width: 180px;"/>
53 53 </div>
54 54 <div class="form-group">
... ... @@ -62,6 +62,7 @@
62 62 <div class="table-container" style="margin-top: 10px;min-width: 906px">
63 63 <label>日期:<span id="rqxs"></span>&nbsp;&nbsp;&nbsp;&nbsp;早高峰:6:31~8:30&nbsp;&nbsp;&nbsp;&nbsp;晚高峰:16:01~18:00</label>
64 64 <br/><label>计划+临加-少驶=<span id="jls"></span>&nbsp;&nbsp;计算机实驶:<span id="jsjss"></span></label>
  65 + &nbsp;&nbsp;当班调派:<span id="dbdp"></span></label>
65 66 <table class="table table-bordered table-hover table-checkable" id="forms">
66 67 <thead>
67 68 <tr>
... ... @@ -434,6 +435,7 @@
434 435 var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
435 436 $("#jls").html(result[0].jls);
436 437 $("#jsjss").html(result[0].sjgl);
  438 + $("#dbdp").html(result[0].dbdp);
437 439 $('#forms .scheduleDaily_1').html(scheduleDaily_1);
438 440 });
439 441 $.get('/realSchedule/queryUserInfo',{line:line,date:date,state:2,type:"query"},function(result){
... ... @@ -481,14 +483,16 @@
481 483 layer.msg("请选择时间");
482 484 return;
483 485 }
  486 + var lineName = $('#line option:selected').text();
484 487 params['line'] = line;
  488 + params['lineName'] = lineName;
485 489 params['date'] = date;
486 490 params['xlName'] = xlName;
487 491 params['type'] = "export";
488 492 params['state'] = '2';
489 493 $get('/realSchedule/scheduleDailyExport', params, function(result){
490 494 if(date.length == 10)
491   - window.open("/downloadFile/download?fileName=调度日报"+moment(date).format("YYYYMMDD"));
  495 + window.open("/downloadFile/download?fileName=调度日报-"+lineName+"-"+moment(date).format("YYYYMMDD"));
492 496 else
493 497 window.open("/downloadFile/download?fileName=调度日报"+moment(date).format("YYYYMM"));
494 498 });
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -674,7 +674,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
674 674  
675 675 var l = layer.load(2);
676 676 $get('/ylb/ylbList', params, function (data) {
677   -
  677 + console.log(data);
678 678 for(var i=1;i<data.length;i++){
679 679 moveArray[i]=new Array();
680 680 for(var j=1;j<6;j++){
... ...
src/main/resources/static/pages/summary/destory_sch_detail/list.html
1   -<!DOCTYPE html>
2   -<html lang="zh-cn">
3   -
4   -<head>
5   - <meta charset="UTF-8">
6   - <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
7   - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
8   - <!-- flatpickr -->
9   - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">
10   - <style>
11   - html,body{
12   - height: 100%;
13   - }
14   - .ct_page{
15   - padding: 25px 15px;
16   - height: 100%;
17   - height: calc(100% - 50px);
18   - }
19   -
20   - .ct_cont{
21   - height: calc(100% - 35px);
22   - }
23   -
24   - .ct_cont>div>div.uk-card{
25   - height: 99%;
26   - }
27   -
28   - .loading{
29   - height: 100%;
30   - text-align: center;
31   - }
32   - .loading .uk-spinner{
33   - margin-top: 200px;
34   - }
35   - .loading circle{
36   - stroke: red;
37   - }
38   -
39   - .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
40   - opacity: 0.6 !important;
41   - padding: 0 !important;
42   - }
43   -
44   - .ct_destroy_sch_table_width th:nth-of-type(1),.ct_destroy_sch_table_width td:nth-of-type(1){
45   - width: 9%;
46   - }
47   - .ct_destroy_sch_table_width th:nth-of-type(2),.ct_destroy_sch_table_width td:nth-of-type(2){
48   - width: 9%;
49   - }
50   - .ct_destroy_sch_table_width th:nth-of-type(3),.ct_destroy_sch_table_width td:nth-of-type(3){
51   - width: 9%;
52   - }
53   - .ct_destroy_sch_table_width th:nth-of-type(4),.ct_destroy_sch_table_width td:nth-of-type(4){
54   - width: 9%;
55   - }
56   - .ct_destroy_sch_table_width th:nth-of-type(5),.ct_destroy_sch_table_width td:nth-of-type(5){
57   - width: 9%;
58   - }
59   - .ct_destroy_sch_table_width th:nth-of-type(6),.ct_destroy_sch_table_width td:nth-of-type(6){
60   - width: 9%;
61   - }
62   - .ct_destroy_sch_table_width th:nth-of-type(7),.ct_destroy_sch_table_width td:nth-of-type(7){
63   - width: 8%;
64   - }
65   - .ct_destroy_sch_table_width th:nth-of-type(8),.ct_destroy_sch_table_width td:nth-of-type(8){
66   - width: 8%;
67   - }
68   - .ct_destroy_sch_table_width th:nth-of-type(9),.ct_destroy_sch_table_width td:nth-of-type(9){
69   - width: 8%;
70   - }
71   - .ct_destroy_sch_table_width th:nth-of-type(10),.ct_destroy_sch_table_width td:nth-of-type(10){
72   - }
73   -
74   - .ct_search_form_wrap{
75   - border-bottom: 1px solid #e5e5e5;
76   - padding: 10px 0 25px 10px;
77   - }
78   - .ct_search_form_wrap .ct_field{
79   - display: inline-block;
80   - margin: 0 5px;
81   - }
82   -
83   - .ct_search_form_wrap .ct_field label{
84   - font-size: 14px;
85   - }
86   -
87   - .ct_search_form_wrap .ct_field input{
88   - width: 110px;
89   - }
90   -
91   - .ct_search_form_wrap .ct_field select{
92   - width: auto;
93   - min-width: 100px;
94   - }
95   -
96   - .ct_search_form_wrap .uk-button{
97   - padding: 0 14px;
98   - }
99   -
100   - .ct_search_form_wrap .uk-button i{
101   - vertical-align: middle;
102   - margin-top: -2px;
103   - margin-right: 7px;
104   - }
105   -
106   - .ct_table_wrap{
107   - font-size: 14px;
108   - height: calc(100% - 77px);
109   - }
110   -
111   - .t_body_wrap{
112   - height: calc(100% - 41px);
113   - overflow: auto;
114   - position: relative;
115   - }
116   -
117   - .ct_field.ct_field_bottom{
118   - vertical-align: bottom;
119   - font-size: 12px;
120   - margin-left: 0;
121   - }
122   - </style>
123   -</head>
124   -
125   -<body>
126   -<div class="loading">
127   - <div uk-spinner></div>
128   -</div>
129   -<div class="ct_page" style="display: none;">
130   - <h3 class="uk-heading-line uk-heading-bullet"><span>烂班明细统计</span></h3>
131   - <div class="ct_cont" >
132   - <div class="ct_search_form_wrap">
133   - <form>
134   - <div class="ct_field">
135   - <label>公司:
136   - <select class="uk-select" name="gsBm_eq">
137   - </select>
138   - </label>
139   - </div>
140   - <div class="ct_field">
141   - <label>分公司:
142   - <select class="uk-select" name="fgsBm_eq">
143   - </select>
144   - </label>
145   - </div>
146   - <div class="ct_field">
147   - <label>线路:
148   - <select class="uk-select" name="lineCode_eq">
149   - </select>
150   - </label>
151   - </div>
152   - <div class="ct_field">
153   - <label>日期:
154   - <input class="uk-input" name="rq" style="width: 220px;">
155   - </label>
156   - </div>
157   - <div class="ct_field">
158   - <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>
159   - </div>
160   - <div class="ct_field ct_field_bottom">
161   - <button class="uk-button uk-button-text export_excel" style="padding: 0 5px;">导出数据</button>
162   - </div>
163   - <div class="ct_field ct_field_bottom">
164   - <span uk-icon="icon: question" title="不统计进出场和子任务" uk-tooltip="pos: bottom"></span>
165   - </div>
166   - </form>
167   - </div>
168   - <div class="ct_table_wrap day">
169   - <table class="uk-table uk-table-small ct_destroy_sch_table_width" style="margin-bottom: 0;">
170   - <thead>
171   - <tr>
172   - <th>日期</th>
173   - <th>线路</th>
174   - <th>车号</th>
175   - <th>司机</th>
176   - <th>售票员</th>
177   - <th>原因</th>
178   - <th>班次</th>
179   - <th>烂班公里</th>
180   - <th>烂班时间</th>
181   - <th>备注</th>
182   - </tr>
183   - </thead>
184   - </table>
185   - <div class="t_body_wrap">
186   - <table class="uk-table uk-table-divider uk-table-hover uk-table-small ct_destroy_sch_table ct_destroy_sch_table_width">
187   - <tbody>
188   - </tbody>
189   - </table>
190   - </div>
191   - </div>
192   - </div>
193   -</div>
194   -
195   -<script id="destroy_sch_list_temp" type="text/html">
196   - {{each list as obj i}}
197   - <tr>
198   - <td>{{obj.rq}}</td>
199   - <td>{{obj.lineName}}</td>
200   - <td>{{obj.nbbm}}</td>
201   - <td>{{obj.jGh}}</td>
202   - <td>{{obj.sGh}}</td>
203   - <td>{{obj.reason}}</td>
204   - <td><a style="text-decoration: underline;">{{obj.size}}</a></td>
205   - <td>{{obj.mileage}}</td>
206   - <td>{{obj.timeStr}}</td>
207   - <td>{{obj.remark}}</td>
208   - </tr>
209   - {{/each}}
210   -</script>
211   -
212   -<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
213   -<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
214   -<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
215   -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
216   -<!-- EventProxy -->
217   -<script src="/assets/js/eventproxy.js"></script>
218   -<!-- art-template 模版引擎 -->
219   -<script src="/assets/plugins/template.js"></script>
220   -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
221   -<!-- jquery.serializejson JSON序列化插件 -->
222   -<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
223   -<!-- flatpickr -->
224   -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>
225   -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>
226   -<script>
227   -
228   - var f = $('form', '');
229   - //var page=0, pageSize=120;
230   -
231   - var ep = EventProxy.create('query_comps', 'query_lines', function () {
232   - $('[name=gsBm_eq]', f).trigger('change');//公司change
233   - query();
234   -
235   - $('.loading').remove();
236   - $('.ct_page').show();
237   - });
238   -
239   - //点击搜索
240   - $('button.search', f).on('click', query);
241   -
242   - function query() {
243   - $('button.search', f).attr('disabled', 'disabled');
244   - var data = f.serializeJSON();
245   - $('.ct_destroy_sch_table tbody').html('');
246   - //开始结束时间
247   - data.rq_ge = data.rq.substr(0, 10);
248   - data.rq_le = data.rq.substr(13);
249   - data.order='t';
250   - delete data.rq;
251   -
252   - $.get('/summary/destroy_detail/all', data, function (rs) {
253   - $('button.search', f).removeAttr('disabled');
254   - if(!rs || rs.length==0)
255   - return UIkit.notification('没有搜索到相关数据!!', 'danger');
256   - $.each(rs, function () {
257   - this.timeStr=moment(this.t).format('HH:mm')
258   - });
259   -
260   - var htmlStr = template('destroy_sch_list_temp', {list: rs});
261   - $('.ct_destroy_sch_table tbody').html(htmlStr);
262   - $('.t_body_wrap').perfectScrollbar('update');
263   - });
264   - }
265   -
266   -
267   - //日期选择框
268   - var fs='YYYY-MM-DD'
269   - , ets=moment().subtract(1, 'days').format(fs)
270   - , sts=moment().subtract(3, 'days').format(fs);
271   - flatpickr('.ct_search_form_wrap [name=rq]', {
272   - mode: "range", dateFormat: "Y-m-d","locale": "zh", defaultDate: [sts, ets]
273   - });
274   - var comps;
275   - //构建公司级联下拉框
276   - $.get('/user/companyData', function (rs) {
277   - comps = rs;
278   - var opts = '';
279   - for(var i=0,obj;obj=comps[i++];){
280   - opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>';
281   - }
282   - $('[name=gsBm_eq]', f).html(opts);
283   - ep.emit('query_comps');
284   - });
285   -
286   - var lineMapps;
287   - //加载线路信息
288   - $.get('/line/all', {'destroy_eq': 0}, function (rs) {
289   - rs.sort(function (a, b) {
290   - return a.name.localeCompare(b.name);
291   - });
292   - lineMapps={};
293   - var k;
294   - $.each(rs, function () {
295   - k = this.company+'_'+this.brancheCompany;
296   - if(!lineMapps[k])
297   - lineMapps[k]=[];
298   - lineMapps[k].push(this);
299   - });
300   -
301   - ep.emit('query_lines');
302   - });
303   -
304   - $('[name=gsBm_eq]', f).on('change', function () {
305   - var code = $(this).val(), subs=[];
306   - $.each(comps, function () {
307   - if(this.companyCode==code)
308   - subs=this.children;
309   - });
310   -
311   - var opts='';
312   - $.each(subs, function () {
313   - opts += '<option value="'+this.code+'">'+this.name+'</option>';
314   - });
315   - $('[name=fgsBm_eq]', f).html(opts).trigger('change');
316   - });
317   -
318   - $('[name=fgsBm_eq]', f).on('change', function () {
319   - var k = $('[name=gsBm_eq]', f).val() + '_' + $(this).val();
320   - var array = lineMapps[k];
321   - var opts = '<option value="">全部</option>';
322   - if(array){
323   - $.each(array, function () {
324   - opts += '<option value="'+this.lineCode+'">'+this.name+'</option>';
325   - });
326   - }
327   - $('[name=lineCode_eq]', f).html(opts);
328   - });
329   -
330   - //
331   - //滚动条
332   - $('.t_body_wrap').perfectScrollbar({suppressScrollX: true});
333   -
334   - $(document).on('submit', 'form', function () {
335   - return false;
336   - });
337   -
338   - /**
339   - * 导出
340   - */
341   - $('.export_excel').on('click', function () {
342   - var data = f.serializeJSON();
343   - data.rq_ge = data.rq.substr(0, 10);
344   - data.rq_le = data.rq.substr(13);
345   - data.order='t';
346   - delete data.rq;
347   -
348   - window.open('/summary/destroy_detail/excel?' + $.param(data));
349   - });
350   -
351   -</script>
352   -</body>
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <!-- flatpickr -->
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">
  10 + <style>
  11 + html,body{
  12 + height: 100%;
  13 + }
  14 + .ct_page{
  15 + padding: 25px 15px;
  16 + height: 100%;
  17 + height: calc(100% - 50px);
  18 + }
  19 +
  20 + .ct_cont{
  21 + height: calc(100% - 35px);
  22 + }
  23 +
  24 + .ct_cont>div>div.uk-card{
  25 + height: 99%;
  26 + }
  27 +
  28 + .loading{
  29 + height: 100%;
  30 + text-align: center;
  31 + }
  32 + .loading .uk-spinner{
  33 + margin-top: 200px;
  34 + }
  35 + .loading circle{
  36 + stroke: red;
  37 + }
  38 +
  39 + .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
  40 + opacity: 0.6 !important;
  41 + padding: 0 !important;
  42 + }
  43 +
  44 + .ct_destroy_sch_table_width th:nth-of-type(1),.ct_destroy_sch_table_width td:nth-of-type(1){
  45 + width: 9%;
  46 + }
  47 + .ct_destroy_sch_table_width th:nth-of-type(2),.ct_destroy_sch_table_width td:nth-of-type(2){
  48 + width: 9%;
  49 + }
  50 + .ct_destroy_sch_table_width th:nth-of-type(3),.ct_destroy_sch_table_width td:nth-of-type(3){
  51 + width: 9%;
  52 + }
  53 + .ct_destroy_sch_table_width th:nth-of-type(4),.ct_destroy_sch_table_width td:nth-of-type(4){
  54 + width: 9%;
  55 + }
  56 + .ct_destroy_sch_table_width th:nth-of-type(5),.ct_destroy_sch_table_width td:nth-of-type(5){
  57 + width: 9%;
  58 + }
  59 + .ct_destroy_sch_table_width th:nth-of-type(6),.ct_destroy_sch_table_width td:nth-of-type(6){
  60 + width: 9%;
  61 + }
  62 + .ct_destroy_sch_table_width th:nth-of-type(7),.ct_destroy_sch_table_width td:nth-of-type(7){
  63 + width: 8%;
  64 + }
  65 + .ct_destroy_sch_table_width th:nth-of-type(8),.ct_destroy_sch_table_width td:nth-of-type(8){
  66 + width: 8%;
  67 + }
  68 + .ct_destroy_sch_table_width th:nth-of-type(9),.ct_destroy_sch_table_width td:nth-of-type(9){
  69 + width: 8%;
  70 + }
  71 + .ct_destroy_sch_table_width th:nth-of-type(10),.ct_destroy_sch_table_width td:nth-of-type(10){
  72 + }
  73 +
  74 + .ct_search_form_wrap{
  75 + border-bottom: 1px solid #e5e5e5;
  76 + padding: 10px 0 25px 10px;
  77 + }
  78 + .ct_search_form_wrap .ct_field{
  79 + display: inline-block;
  80 + margin: 0 5px;
  81 + }
  82 +
  83 + .ct_search_form_wrap .ct_field label{
  84 + font-size: 14px;
  85 + }
  86 +
  87 + .ct_search_form_wrap .ct_field input{
  88 + width: 110px;
  89 + }
  90 +
  91 + .ct_search_form_wrap .ct_field select{
  92 + width: auto;
  93 + min-width: 100px;
  94 + }
  95 +
  96 + .ct_search_form_wrap .uk-button{
  97 + padding: 0 14px;
  98 + }
  99 +
  100 + .ct_search_form_wrap .uk-button i{
  101 + vertical-align: middle;
  102 + margin-top: -2px;
  103 + margin-right: 7px;
  104 + }
  105 +
  106 + .ct_table_wrap{
  107 + font-size: 14px;
  108 + height: calc(100% - 77px);
  109 + }
  110 +
  111 + .t_body_wrap{
  112 + height: calc(100% - 41px);
  113 + overflow: auto;
  114 + position: relative;
  115 + }
  116 +
  117 + .ct_field.ct_field_bottom{
  118 + vertical-align: bottom;
  119 + font-size: 12px;
  120 + margin-left: 0;
  121 + }
  122 + </style>
  123 +</head>
  124 +
  125 +<body>
  126 +<div class="loading">
  127 + <div uk-spinner></div>
  128 +</div>
  129 +<div class="ct_page" style="display: none;">
  130 + <h3 class="uk-heading-line uk-heading-bullet"><span>烂班明细统计</span></h3>
  131 + <div class="ct_cont" >
  132 + <div class="ct_search_form_wrap">
  133 + <form>
  134 + <div class="ct_field">
  135 + <label>公司:
  136 + <select class="uk-select" name="gsBm_eq">
  137 + </select>
  138 + </label>
  139 + </div>
  140 + <div class="ct_field">
  141 + <label>分公司:
  142 + <select class="uk-select" name="fgsBm_eq">
  143 + </select>
  144 + </label>
  145 + </div>
  146 + <div class="ct_field">
  147 + <label>线路:
  148 + <select class="uk-select" name="lineCode_eq">
  149 + </select>
  150 + </label>
  151 + </div>
  152 + <div class="ct_field">
  153 + <label>日期:
  154 + <input class="uk-input" name="rq" style="width: 220px;">
  155 + </label>
  156 + </div>
  157 + <div class="ct_field">
  158 + <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>
  159 + </div>
  160 + <div class="ct_field ct_field_bottom">
  161 + <button class="uk-button uk-button-text export_excel" style="padding: 0 5px;">导出数据</button>
  162 + </div>
  163 + <div class="ct_field ct_field_bottom">
  164 + <span uk-icon="icon: question" title="不统计进出场和子任务" uk-tooltip="pos: bottom"></span>
  165 + </div>
  166 + </form>
  167 + </div>
  168 + <div class="ct_table_wrap day">
  169 + <table class="uk-table uk-table-small ct_destroy_sch_table_width" style="margin-bottom: 0;">
  170 + <thead>
  171 + <tr>
  172 + <th>日期</th>
  173 + <th>线路</th>
  174 + <th>车号</th>
  175 + <th>司机</th>
  176 + <th>售票员</th>
  177 + <th>原因</th>
  178 + <th>班次</th>
  179 + <th>烂班公里</th>
  180 + <th>烂班时间</th>
  181 + <th>备注</th>
  182 + </tr>
  183 + </thead>
  184 + </table>
  185 + <div class="t_body_wrap">
  186 + <table class="uk-table uk-table-divider uk-table-hover uk-table-small ct_destroy_sch_table ct_destroy_sch_table_width">
  187 + <tbody>
  188 + </tbody>
  189 + </table>
  190 + </div>
  191 + </div>
  192 + </div>
  193 +</div>
  194 +
  195 +<script id="destroy_sch_list_temp" type="text/html">
  196 + {{each list as obj i}}
  197 + <tr>
  198 + <td>{{obj.rq}}</td>
  199 + <td>{{obj.lineName}}</td>
  200 + <td>{{obj.nbbm}}</td>
  201 + <td>{{obj.jGh}}</td>
  202 + <td>{{obj.sGh}}</td>
  203 + <td>{{obj.reason}}</td>
  204 + <td><a style="text-decoration: underline;">{{obj.size}}</a></td>
  205 + <td>{{obj.mileage}}</td>
  206 + <td>{{obj.timeStr}}</td>
  207 + <td>{{obj.remark}}</td>
  208 + </tr>
  209 + {{/each}}
  210 +</script>
  211 +
  212 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  213 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  214 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  215 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  216 +<!-- EventProxy -->
  217 +<script src="/assets/js/eventproxy.js"></script>
  218 +<!-- art-template 模版引擎 -->
  219 +<script src="/assets/plugins/template.js"></script>
  220 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  221 +<!-- jquery.serializejson JSON序列化插件 -->
  222 +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
  223 +<!-- flatpickr -->
  224 +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>
  225 +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>
  226 +<script>
  227 +
  228 + var f = $('form', '');
  229 + //var page=0, pageSize=120;
  230 +
  231 + var ep = EventProxy.create('query_comps', 'query_lines', function () {
  232 + $('[name=gsBm_eq]', f).trigger('change');//公司change
  233 + query();
  234 +
  235 + $('.loading').remove();
  236 + $('.ct_page').show();
  237 + });
  238 +
  239 + //点击搜索
  240 + $('button.search', f).on('click', query);
  241 +
  242 + function query() {
  243 + $('button.search', f).attr('disabled', 'disabled');
  244 + var data = f.serializeJSON();
  245 + $('.ct_destroy_sch_table tbody').html('');
  246 + //开始结束时间
  247 + data.rq_ge = data.rq.substr(0, 10);
  248 + data.rq_le = data.rq.substr(13);
  249 + data.order='t';
  250 + delete data.rq;
  251 +
  252 + $.get('/summary/destroy_detail/all', data, function (rs) {
  253 + $('button.search', f).removeAttr('disabled');
  254 + if(!rs || rs.length==0)
  255 + return UIkit.notification('没有搜索到相关数据!!', 'danger');
  256 + $.each(rs, function () {
  257 + this.timeStr=moment(this.t).format('HH:mm')
  258 + });
  259 +
  260 + var htmlStr = template('destroy_sch_list_temp', {list: rs});
  261 + $('.ct_destroy_sch_table tbody').html(htmlStr);
  262 + $('.t_body_wrap').perfectScrollbar('update');
  263 + });
  264 + }
  265 +
  266 +
  267 + //日期选择框
  268 + var fs='YYYY-MM-DD'
  269 + , ets=moment().subtract(1, 'days').format(fs)
  270 + , sts=moment().subtract(3, 'days').format(fs);
  271 + flatpickr('.ct_search_form_wrap [name=rq]', {
  272 + mode: "range", dateFormat: "Y-m-d","locale": "zh", defaultDate: [sts, ets]
  273 + });
  274 + var comps;
  275 + //构建公司级联下拉框
  276 + $.get('/user/companyData', function (rs) {
  277 + comps = rs;
  278 + var opts = '';
  279 + for(var i=0,obj;obj=comps[i++];){
  280 + opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>';
  281 + }
  282 + $('[name=gsBm_eq]', f).html(opts);
  283 + ep.emit('query_comps');
  284 + });
  285 +
  286 + var lineMapps;
  287 + //加载线路信息
  288 + $.get('/line/all', {'destroy_eq': 0}, function (rs) {
  289 + rs.sort(function (a, b) {
  290 + return a.name.localeCompare(b.name);
  291 + });
  292 + lineMapps={};
  293 + var k;
  294 + $.each(rs, function () {
  295 + k = this.company+'_'+this.brancheCompany;
  296 + if(!lineMapps[k])
  297 + lineMapps[k]=[];
  298 + lineMapps[k].push(this);
  299 + });
  300 +
  301 + ep.emit('query_lines');
  302 + });
  303 +
  304 + $('[name=gsBm_eq]', f).on('change', function () {
  305 + var code = $(this).val(), subs=[];
  306 + $.each(comps, function () {
  307 + if(this.companyCode==code)
  308 + subs=this.children;
  309 + });
  310 +
  311 + var opts='';
  312 + $.each(subs, function () {
  313 + opts += '<option value="'+this.code+'">'+this.name+'</option>';
  314 + });
  315 + $('[name=fgsBm_eq]', f).html(opts).trigger('change');
  316 + });
  317 +
  318 + $('[name=fgsBm_eq]', f).on('change', function () {
  319 + var k = $('[name=gsBm_eq]', f).val() + '_' + $(this).val();
  320 + var array = lineMapps[k];
  321 + var opts = '<option value="">全部</option>';
  322 + if(array){
  323 + $.each(array, function () {
  324 + opts += '<option value="'+this.lineCode+'">'+this.name+'</option>';
  325 + });
  326 + }
  327 + $('[name=lineCode_eq]', f).html(opts);
  328 + });
  329 +
  330 + //
  331 + //滚动条
  332 + $('.t_body_wrap').perfectScrollbar({suppressScrollX: true});
  333 +
  334 + $(document).on('submit', 'form', function () {
  335 + return false;
  336 + });
  337 +
  338 + /**
  339 + * 导出
  340 + */
  341 + $('.export_excel').on('click', function () {
  342 + var data = f.serializeJSON();
  343 + data.rq_ge = data.rq.substr(0, 10);
  344 + data.rq_le = data.rq.substr(13);
  345 + data.order='t';
  346 + delete data.rq;
  347 +
  348 + window.open('/summary/destroy_detail/excel?' + $.param(data));
  349 + });
  350 +
  351 +</script>
  352 +</body>
353 353 </html>
354 354 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/alone_page/map/alone_wrap.html
... ... @@ -42,13 +42,23 @@
42 42 <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"/>
43 43  
44 44 <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/>
  45 +
  46 + <style>
  47 + .main-container .map-panel{
  48 + position: absolute;
  49 + top:0;
  50 + left: 0;
  51 + width: 20px;
  52 + z-index: 999;
  53 + height: 20px;
  54 + }
  55 + </style>
45 56 </head>
46 57  
47 58 <body>
48 59 <div class="main-container" style="height: 100%;">
49 60 <span style="position: absolute;left: calc(50% - 35px);top: calc(45% - 35px);">加载中...</span>
50 61 </div>
51   -
52 62 <!-- 地图相关 -->
53 63 <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
54 64 <script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script>
... ... @@ -108,6 +118,8 @@
108 118 //嵌入地图页面
109 119 $('.main-container').load('/real_control_v2/mapmonitor/real.html', function () {
110 120 $('.map-system-msg.flex-left').remove();
  121 +
  122 + $(this).append('<span class="map-panel"></span>');//判断里有JS判定这个容器是否显示
111 123 });
112 124 });
113 125  
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/dftz.html
... ... @@ -164,7 +164,7 @@
164 164  
165 165 $('[name=bcType]', modal).on('change', function(){
166 166 var type = $(this).val();
167   - if(sch.bcType != 'normal')
  167 + if(sch.bcType == 'in' || sch.bcType == 'out')
168 168 return;
169 169  
170 170 //重置类型,等待调整界面触发刷新事件
... ... @@ -188,6 +188,18 @@
188 188 $(detailModal).trigger('init', {sch: sch, parentModal: modal, _dfsj: $('[name=dfsj]', modal).val()});
189 189 })
190 190 });
  191 +
  192 + /**
  193 + * 相同选项 也触发 onchange
  194 + */
  195 + $('[name=bcType]', modal).mousedown(function () {
  196 + this.sindex = $(this)[0].selectedIndex;
  197 + $(this)[0].selectedIndex = 0;
  198 + }).mouseout(function () {
  199 + if ($(this)[0].selectedIndex === 0) {
  200 + $(this)[0].selectedIndex = this.sindex;
  201 + }
  202 + });
191 203 });
192 204 })();
193 205 </script>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -267,7 +267,7 @@
267 267  
268 268 $('select[name=bcType]', modal).on('change', function(){
269 269 var type = $(this).val();
270   - if(sch.bcType != 'normal')
  270 + if(sch.bcType == 'in' || sch.bcType == 'out')
271 271 return;
272 272  
273 273 //重置类型,等待调整界面触发刷新事件
... ... @@ -289,6 +289,18 @@
289 289 $(detailModal).trigger('init', {sch: sch, parentModal: modal});
290 290 })
291 291 });
  292 +
  293 + /**
  294 + * 相同选项 也触发 onchange
  295 + */
  296 + $('select[name=bcType]', modal).mousedown(function () {
  297 + this.sindex = $(this)[0].selectedIndex;
  298 + $(this)[0].selectedIndex = 0;
  299 + }).mouseout(function () {
  300 + if ($(this)[0].selectedIndex === 0) {
  301 + $(this)[0].selectedIndex = this.sindex;
  302 + }
  303 + });
292 304 });
293 305  
294 306 function validation_s_e_Time(data) {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/sys_mailbox.html
... ... @@ -5,8 +5,9 @@
5 5 <h4 class="uk-panel-title">{{data.nbbm}} {{text}}</h4>
6 6 <code>{{dateStr}}</code>
7 7 <div class="uk-button-group">
8   - <a class="uk-button uk-button-mini uk-button-primary">同意</a>
9   - <a class="uk-button uk-button-mini reject">不同意</a>
  8 + <button class="uk-button uk-button-mini uk-button-primary">同意</button>
  9 + <button class="uk-button uk-button-mini reject">不同意</button>
  10 + <a class="edit_link" data-id="{{schId}}" data-line="{{data.lineId}}" >编辑</a>
10 11 </div>
11 12 </div>
12 13 </div>
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -168,8 +168,8 @@ var disabled_submit_btn = function (form) {
168 168 function showUpdateDescription() {
169 169 //更新说明
170 170 var updateDescription = {
171   - date: '2017-11-01',
172   - text: '<h5>1、修正了XP系统下主页滚动条的显示问题(Windows XP sp3 + chrome 49.0.2623.112)。</h5>'
  171 + date: '2017-11-02',
  172 + text: '<h5>1、修正二次放站时,需要先将班次切回正常班次的问题。</h5><h5>2、驾驶员请求信使上,添加“编辑”链接,可弹出对应班次的发车信息微调框。</h5>'
173 173 };
174 174  
175 175 var storage = window.localStorage
... ...
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
... ... @@ -235,8 +235,10 @@ var gb_sch_websocket = (function () {
235 235 dl.addClass('relevance-active intimity').find('dd:eq(5)').trigger('click');
236 236 });
237 237  
  238 +
238 239 //80同意
239 240 $(document).on('click', '.sys-mailbox .sys-note-80 .uk-button-primary', function () {
  241 + $(this).attr('disabled', 'disabled');
240 242 var panel = $(this).parents('.sys-note-80')
241 243 , id = panel.data('id');
242 244  
... ... @@ -245,6 +247,7 @@ var gb_sch_websocket = (function () {
245 247  
246 248 //80不同意
247 249 $(document).on('click', '.sys-mailbox .sys-note-80 .uk-button.reject', function () {
  250 + $(this).attr('disabled', 'disabled');
248 251 var panel = $(this).parents('.sys-note-80')
249 252 , id = panel.data('id');
250 253  
... ... @@ -329,6 +332,24 @@ var gb_sch_websocket = (function () {
329 332 gb_schedule_context_menu.dftz(nextSch);
330 333 });
331 334  
  335 + /**
  336 + * 信使 sys-note-80 编辑
  337 + */
  338 + $(document).on('click', '.sys-note-80 .edit_link', function () {
  339 + var id = $(this).data('id'),
  340 + lineCode = $(this).data('line');
  341 +
  342 + var sch = gb_schedule_table.findScheduleByLine(lineCode)[id];
  343 + if(!sch)
  344 + return;
  345 +
  346 + gb_schedule_context_menu.fcxxwt(sch);
  347 + var dl = gb_schedule_table.scroToDl(sch);
  348 + //高亮
  349 + gb_schedule_table.reset_drag_active_all(dl);
  350 + dl.addClass('relevance-active intimity').find('dd:eq(5)').trigger('click');
  351 + });
  352 +
332 353 return {
333 354 sock: function () {
334 355 return schSock;
... ...