Commit b22c208355895840594b32d1fc88ce110c317b2f

Authored by 潘钊
1 parent 06356c2b

例行更新

Showing 21 changed files with 556 additions and 131 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -5,6 +5,7 @@ import java.util.List;
5 5 import java.util.Map;
6 6  
7 7 import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.PathVariable;
8 9 import org.springframework.web.bind.annotation.RequestMapping;
9 10 import org.springframework.web.bind.annotation.RequestMethod;
10 11 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -205,6 +206,18 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
205 206 public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) {
206 207 return scheduleRealInfoService.trustStatus(lineCodes);
207 208 }
  209 +
  210 + /**
  211 + *
  212 + * @Title: outgoAdjustAll
  213 + * @Description: TODO(批量待发调整)
  214 + * @param @param list
  215 + * @throws
  216 + */
  217 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  218 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  219 + return scheduleRealInfoService.outgoAdjustAll(params);
  220 + }
208 221  
209 222 /**
210 223 *
... ... @@ -223,13 +236,23 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
223 236 * @Description: TODO(根据线路和走向获取班次)
224 237 * @param @param line
225 238 * @param @param upDown
226   - * @throws
227 239 */
228 240 @RequestMapping(value = "/findByLineAndUpDown")
229 241 public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam Integer line,@RequestParam Integer upDown){
230 242 return ScheduleBuffer.findByLineAndUpDown(line, upDown);
231 243 }
232 244  
  245 + /**
  246 + *
  247 + * @Title: findByLineCode
  248 + * @Description: TODO(根据线路获取班次信息)
  249 + * @param @param lineCode
  250 + */
  251 + @RequestMapping(value = "/lineCode/{lineCode}")
  252 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  253 + return ScheduleBuffer.schedulListMap.get(lineCode);
  254 + }
  255 +
233 256 @RequestMapping(value = "/queryUserInfo")
234 257 public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, @RequestParam String date) {
235 258 return scheduleRealInfoService.queryUserInfo(line, date);
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -482,6 +482,17 @@ public class ScheduleRealInfo {
482 482 this.dfsj = sdfHHmm.format(new Date(this.dfsjT));
483 483 }
484 484  
  485 + public void setDfsjAll(String dfsj) {
  486 +
  487 + try {
  488 + String dfsjFull = sdfyyyyMMdd.format(this.scheduleDate) + " " + dfsj;
  489 + this.dfsjT = sdfyyyyMMddHHmm.parse(dfsjFull).getTime();
  490 + this.dfsj = dfsj;
  491 + } catch (ParseException e) {
  492 + e.printStackTrace();
  493 + }
  494 + }
  495 +
485 496 @Transient
486 497 static SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
487 498 @Transient
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -78,4 +78,6 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
78 78  
79 79 Map<String, Object> schInfoFineTune(Map<String, String> map);
80 80  
  81 + Map<String, Object> outgoAdjustAll(String params);
  82 +
81 83 }
... ...
src/main/java/com/bsth/service/realcontrol/buffer/GetSchedulePlanThread.java
1 1 package com.bsth.service.realcontrol.buffer;
2 2  
  3 +import java.text.ParseException;
3 4 import java.text.SimpleDateFormat;
4 5 import java.util.Date;
5 6 import java.util.List;
... ... @@ -16,7 +17,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
16 17 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
17 18 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
18 19 import com.bsth.util.BatchSaveUtils;
19   -import com.fasterxml.jackson.databind.ObjectMapper;
  20 +import com.bsth.vehicle.directive.buffer.DirectiveBuffer;
20 21  
21 22 /**
22 23 *
... ... @@ -37,56 +38,65 @@ public class GetSchedulePlanThread extends Thread{
37 38 @Autowired
38 39 ScheduleRealInfoRepository scheduleRealInfoRepository;
39 40  
40   - @Autowired
41   - ObjectMapper objectMapper;
42   -
43 41 SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
44 42  
  43 + @Autowired
  44 + DirectiveBuffer directiveBuffer;
  45 +
45 46 @Override
46 47 public void run() {
47 48 try{
  49 + //清除缓存
48 50 ScheduleBuffer.clear();
  51 + //所有指令入库
  52 + directiveBuffer.saveAll();
  53 + DirectiveBuffer.clear();
49 54  
50   - List<ScheduleRealInfo> realList = null;
51   - String dateStr = sdfyyyyMMdd.format(new Date());
52   - Date cDate = sdfyyyyMMdd.parse(dateStr);
53   - //查询数据库是否有今日排班
54   - int size = scheduleRealInfoRepository.countByDate(cDate);
55   - if(size > 0){
56   - //从数据库恢复当日排班
57   - realList = scheduleRealInfoRepository.findByDate(cDate);
58   - logger.info("从数据库恢复当日排班 " + realList.size());
59   - //写入缓存
60   - ScheduleBuffer.init(realList);
61   - }
62   - else{
63   - List<SchedulePlanInfo> list = schedulePlanInfoRepository.findByDate(cDate);
64   -
65   - for(SchedulePlanInfo sp : list){
66   - sp.setSchedulePlan(null);
67   - }
68   -
69   - //实际排班计划
70   - realList = JSONArray.parseArray(JSON.toJSONString(list), ScheduleRealInfo.class);
71   - //查询数据库最大ID
72   - Long id = scheduleRealInfoRepository.getMaxId();
73   - if(null == id)
74   - id = 0L;
75   - id ++;
76   -
77   - for(ScheduleRealInfo item : realList){
78   - item.setSpId(item.getId());
79   - item.setId(id ++);//设置ID
80   - }
81   -
82   - //写入缓存
83   - ScheduleBuffer.init(realList);
84   - //入库
85   - new BatchSaveUtils<ScheduleRealInfo>().saveList(realList, ScheduleRealInfo.class);
86   - }
87   - logger.info("获取当天实际排班计划数量:" + realList.size());
  55 + //加载新的排班
  56 + loaSchedule();
88 57 }catch(Exception e){
89 58 logger.error("",e);
90 59 }
91 60 }
  61 +
  62 + public void loaSchedule() throws ParseException{
  63 + List<ScheduleRealInfo> realList = null;
  64 + String dateStr = sdfyyyyMMdd.format(new Date());
  65 + Date cDate = sdfyyyyMMdd.parse(dateStr);
  66 + //查询数据库是否有今日排班
  67 + int size = scheduleRealInfoRepository.countByDate(cDate);
  68 + if(size > 0){
  69 + //从数据库恢复当日排班
  70 + realList = scheduleRealInfoRepository.findByDate(cDate);
  71 + logger.info("从数据库恢复当日排班 " + realList.size());
  72 + //写入缓存
  73 + ScheduleBuffer.init(realList);
  74 + }
  75 + else{
  76 + List<SchedulePlanInfo> list = schedulePlanInfoRepository.findByDate(cDate);
  77 +
  78 + for(SchedulePlanInfo sp : list){
  79 + sp.setSchedulePlan(null);
  80 + }
  81 +
  82 + //实际排班计划
  83 + realList = JSONArray.parseArray(JSON.toJSONString(list), ScheduleRealInfo.class);
  84 + //查询数据库最大ID
  85 + Long id = scheduleRealInfoRepository.getMaxId();
  86 + if(null == id)
  87 + id = 0L;
  88 + id ++;
  89 +
  90 + for(ScheduleRealInfo item : realList){
  91 + item.setSpId(item.getId());
  92 + item.setId(id ++);//设置ID
  93 + }
  94 +
  95 + //写入缓存
  96 + ScheduleBuffer.init(realList);
  97 + //入库
  98 + new BatchSaveUtils<ScheduleRealInfo>().saveList(realList, ScheduleRealInfo.class);
  99 + }
  100 + logger.info("获取当天实际排班计划数量:" + realList.size());
  101 + }
92 102 }
... ...
src/main/java/com/bsth/service/realcontrol/buffer/ScheduleBuffer.java
... ... @@ -36,13 +36,19 @@ public class ScheduleBuffer {
36 36 /**
37 37 * K: 车辆自编号 V: 未完成班次链表
38 38 */
39   - public static Map<String, LinkedList<ScheduleRealInfo>> vehLinkedMap;
  39 + /*public static Map<String, LinkedList<ScheduleRealInfo>> vehLinkedMap;*/
  40 +
  41 + /**
  42 + * K: 车辆自编号 V: 班次链表
  43 + */
  44 + public static ArrayListMultimap<String, ScheduleRealInfo> vehSchListMap;
  45 + /*public static Map<String, LinkedList<ScheduleRealInfo>> vehSchLinkedMap;*/
40 46  
41 47  
42 48 /**
43 49 * K: 车辆自编号 V: 已执行班次链表
44 50 */
45   - public static LinkedListMultimap<String, ScheduleRealInfo> finishLinkedMap;
  51 + /*public static LinkedListMultimap<String, ScheduleRealInfo> finishLinkedMap;*/
46 52  
47 53  
48 54 /**
... ... @@ -73,8 +79,9 @@ public class ScheduleBuffer {
73 79 schedulListMap = ArrayListMultimap.create();
74 80 pkSchedulMap = new HashMap<>();
75 81 persistentList = new LinkedList<>();
76   - vehLinkedMap = new HashMap<>();
77   - finishLinkedMap = LinkedListMultimap.create();
  82 + /*vehLinkedMap = new HashMap<>();
  83 + finishLinkedMap = LinkedListMultimap.create();*/
  84 + vehSchListMap = ArrayListMultimap.create();
78 85 trustMap = new HashMap<>();
79 86 }
80 87  
... ... @@ -96,10 +103,11 @@ public class ScheduleBuffer {
96 103  
97 104 //初始化车辆和班次列表对照
98 105 zbh = schedul.getClZbh();
99   - if(!vehLinkedMap.containsKey(zbh))
  106 + vehSchListMap.put(zbh, schedul);
  107 + /*if(!vehLinkedMap.containsKey(zbh))
100 108 vehLinkedMap.put(zbh, new LinkedList<ScheduleRealInfo>());
101 109  
102   - vehLinkedMap.get(zbh).add(schedul);
  110 + vehLinkedMap.get(zbh).add(schedul);*/
103 111 }
104 112  
105 113 //计算起点应到时间
... ... @@ -152,18 +160,23 @@ public class ScheduleBuffer {
152 160  
153 161 public static int put(ScheduleRealInfo sch){
154 162 schedulListMap.put(sch.getXlBm(), sch);
155   - pkSchedulMap.put(sch.getId(), sch);
156 163  
  164 + pkSchedulMap.put(sch.getId(), sch);
157 165 String zbh = sch.getClZbh();
158   - if(!vehLinkedMap.containsKey(zbh))
  166 + vehSchListMap.put(zbh, sch);
  167 +
  168 + //List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh());
  169 +
  170 + /*if(!vehLinkedMap.containsKey(zbh))
159 171 vehLinkedMap.put(zbh, new LinkedList<ScheduleRealInfo>());
160   - vehLinkedMap.get(zbh).add(sch);
  172 + vehLinkedMap.get(zbh).add(sch);*/
161 173  
162 174 //重新排序
163   - //Collections.sort(vehLinkedMap.get(zbh), scheduleComparator);
  175 + Collections.sort(schedulListMap.get(sch.getXlBm()), scheduleComparator);
164 176  
165 177 //重新计算应到时间
166   - calcArrDateQd(vehLinkedMap.get(zbh));
  178 + //calcArrDateQd(vehLinkedMap.get(zbh));
  179 + calcArrDateQd(vehSchListMap.get(zbh));
167 180 return 0;
168 181 }
169 182  
... ... @@ -184,12 +197,15 @@ public class ScheduleBuffer {
184 197 * @throws
185 198 */
186 199 public static ScheduleRealInfo finishSch(ScheduleRealInfo sch){
187   - LinkedList<ScheduleRealInfo> list = vehLinkedMap.get(sch.getClZbh());
  200 + //LinkedList<ScheduleRealInfo> list = vehLinkedMap.get(sch.getClZbh());
188 201 //状态修改为已执行
189 202 sch.setStatus(2);
190 203 persistentList.add(sch);
191 204  
192   - ScheduleRealInfo temp;
  205 + //下一个班次
  206 + ScheduleRealInfo next = getNext(sch);
  207 + next.setQdzArrDateSJ(sch.getZdsjActual());
  208 + /*ScheduleRealInfo temp;
193 209 int len = list.size();
194 210 for(int i = 0; i < len; i ++){
195 211 temp = list.poll();
... ... @@ -199,8 +215,41 @@ public class ScheduleBuffer {
199 215 break;
200 216 }
201 217 }
202   - ScheduleRealInfo next = list.getFirst();
203   - next.setQdzArrDateSJ(sch.getZdsjActual());
  218 + ScheduleRealInfo next = list.getFirst();*/
  219 + //next.setQdzArrDateSJ(sch.getZdsjActual());
  220 + return next;
  221 + }
  222 +
  223 + public static ScheduleRealInfo getNext(ScheduleRealInfo sch){
  224 + List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh());
  225 +
  226 + boolean flag = false;
  227 + ScheduleRealInfo next = null;
  228 + for(ScheduleRealInfo temp : list){
  229 + if(temp.getId() == sch.getId()){
  230 + flag = true;
  231 + continue;
  232 + }
  233 + //忽略烂班
  234 + if(temp.getStatus() == -1)
  235 + continue;
  236 +
  237 + if(flag){
  238 + next = temp;
  239 + break;
  240 + }
  241 + }
  242 +
  243 +
  244 + /*int size = list.size();
  245 + for(int i = 0; i < size; i ++){
  246 + current = list.get(i);
  247 + if(current.getId() == sch.getId()
  248 + && i < (size - 1)){
  249 + next = list.get(i + 1);
  250 + break;
  251 + }
  252 + }*/
204 253 return next;
205 254 }
206 255  
... ... @@ -212,7 +261,56 @@ public class ScheduleBuffer {
212 261 * @throws
213 262 */
214 263 public static int getFinishSchNo(String nbbm){
215   - return finishLinkedMap.get(nbbm) == null ? 0 : finishLinkedMap.get(nbbm).size();
  264 + List<ScheduleRealInfo> list = vehSchListMap.get(nbbm);
  265 + int no = 0;
  266 + for(ScheduleRealInfo sch : list){
  267 + if(sch.getStatus() == 2)
  268 + no ++;
  269 + }
  270 + return no;
  271 + //return finishLinkedMap.get(nbbm) == null ? 0 : finishLinkedMap.get(nbbm).size();
  272 + }
  273 +
  274 + /**
  275 + *
  276 + * @Title: findCurrent
  277 + * @Description: TODO(获取车辆当前正在执行的班次)
  278 + * @param @param nbbm
  279 + * @throws
  280 + */
  281 + public static ScheduleRealInfo findCurrent(String nbbm){
  282 + List<ScheduleRealInfo> list = ScheduleBuffer.vehSchListMap.get(nbbm);
  283 +
  284 + int size = list.size();
  285 + ScheduleRealInfo sch;
  286 + //最后一个状态为 正在执行的班次
  287 + for(int i = size - 1; i > 0; i --){
  288 + sch = list.get(i);
  289 + if(sch.getStatus() == 1)
  290 + return sch;
  291 + }
  292 + return null;
  293 + }
  294 +
  295 + /**
  296 + *
  297 + * @Title: findNextList
  298 + * @Description: TODO(获取后续班次)
  299 + * @param @param sch
  300 + * @throws
  301 + */
  302 + public static List<ScheduleRealInfo> findNextList(ScheduleRealInfo sch){
  303 + List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh()),
  304 + rs = null;
  305 +
  306 + for(ScheduleRealInfo temp : list){
  307 + if(temp.getId() == sch.getId())
  308 + rs = new ArrayList<>();
  309 +
  310 + if(rs != null)
  311 + rs.add(temp);
  312 + }
  313 + return rs == null?new ArrayList<ScheduleRealInfo>():rs;
216 314 }
217 315  
218 316 public static void calcArrDateQd(List<ScheduleRealInfo> list){
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -19,6 +19,8 @@ import org.slf4j.LoggerFactory;
19 19 import org.springframework.beans.factory.annotation.Autowired;
20 20 import org.springframework.stereotype.Service;
21 21  
  22 +import com.alibaba.fastjson.JSONArray;
  23 +import com.alibaba.fastjson.JSONObject;
22 24 import com.bsth.common.ResponseCode;
23 25 import com.bsth.entity.Cars;
24 26 import com.bsth.entity.Line;
... ... @@ -121,6 +123,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
121 123 ScheduleRealInfo schedule = null;
122 124 for (String id : idList) {
123 125 schedule = ScheduleBuffer.pkSchedulMap.get(Long.parseLong(id));
  126 + /*if(schedule.getStatus() == -1){
  127 + map.put("status", ResponseCode.ERROR);
  128 + map.put("msg", value)
  129 + }*/
124 130 if (null != schedule) {
125 131 schedule.setStatus(-1);
126 132 schedule.addRemarks(remarks);
... ... @@ -264,7 +270,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
264 270 // 加入缓存
265 271 ScheduleBuffer.put(t);
266 272 //将该临加之后的班次作为更新返回页面
267   - List<ScheduleRealInfo> list = ScheduleBuffer.vehLinkedMap.get(t.getClZbh())
  273 + List<ScheduleRealInfo> list = ScheduleBuffer.findNextList(t)
268 274 ,rsList = null;
269 275  
270 276 for(ScheduleRealInfo sch : list){
... ... @@ -492,8 +498,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
492 498 rs.put("msg", "无实发时间,无法撤销!");
493 499 } else {
494 500 sch.setStatus(0);
495   - sch.setFcsjActual("");
496   - sch.setFcsjActualTime(0L);
  501 + sch.setFcsjActual(null);
  502 + sch.setFcsjActualTime(null);
497 503 rs.put("status", ResponseCode.SUCCESS);
498 504 rs.put("t", sch);
499 505  
... ... @@ -564,10 +570,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
564 570 String fcsj = map.get("fcsj");
565 571 //实际发车时间
566 572 String fcsjActual = map.get("fcsjActual");
567   - //驾驶员
568   - String[] jsy = map.get("jsy").split("/");
569   - //售票员
570   - String[] spy = map.get("spy").split("/");
  573 +
571 574 //实际终点时间
572 575 String zdsjActual = map.get("zdsjActual");
573 576 //备注
... ... @@ -575,27 +578,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
575 578  
576 579 ScheduleRealInfo sch = ScheduleBuffer.findOne(id);
577 580 if(null != sch){
  581 + //驾驶员
  582 + if(StringUtils.isNotBlank(map.get("jsy"))){
  583 + String[] jsy = map.get("jsy").split("/");
  584 + sch.setjGh(jsy[0]);
  585 + sch.setjName(jsy[1]);
  586 + }
  587 +
  588 + //售票员
  589 + if(StringUtils.isNotBlank(map.get("spy"))){
  590 + String[] spy = map.get("spy").split("/");
  591 + sch.setsGh(spy[0]);
  592 + sch.setsName(spy[1]);
  593 + }
  594 +
578 595 sch.setBcType(bcType);
579 596 sch.setClZbh(clZbh);
580 597 sch.setFcsjAll(fcsj);
581   - if(null == fcsjActual){
  598 + if(StringUtils.isNotBlank(fcsjActual)){
  599 + //调整实发
  600 + sch.setFcsjActualAll(fcsjActual);
  601 + sch.setStatus(1);
  602 + }
  603 + else{
582 604 sch.setFcsjActual(null);
583 605 sch.setFcsjActualTime(null);
584 606 }
585   - else
586   - sch.setFcsjActualAll(fcsjActual);
587 607  
588   - if(null == zdsjActual){
  608 + if(StringUtils.isNotBlank(zdsjActual)){
  609 + //调整实达
  610 + sch.setZdsjActualAll(zdsjActual);
  611 + sch.setStatus(2);
  612 + //下一班次起点到达
  613 + ScheduleRealInfo next = ScheduleBuffer.getNext(sch);
  614 + next.setQdzArrDateSJ(zdsjActual);
  615 + rs.put("nextSch", next);
  616 + }
  617 + else{
589 618 sch.setZdsjActual(null);
590 619 sch.setZdsjActualTime(null);
591 620 }
592   - else
593   - sch.setZdsjActualAll(zdsjActual);
594 621  
595   - sch.setjGh(jsy[0]);
596   - sch.setjName(jsy[1]);
597   - sch.setsGh(spy[0]);
598   - sch.setsName(spy[1]);
599 622 sch.setRemarks(remarks);
600 623 }
601 624  
... ... @@ -609,4 +632,32 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
609 632 }
610 633 return rs;
611 634 }
  635 +
  636 + @Override
  637 + public Map<String, Object> outgoAdjustAll(String params) {
  638 + Map<String, Object> rs = new HashMap<>();
  639 + try{
  640 + JSONArray jsonArray = JSONArray.parseArray(params);
  641 +
  642 + ScheduleRealInfo schedule = null;
  643 + JSONObject jsonObj;
  644 + String dfsj;
  645 + for(int i = 0; i < jsonArray.size(); i ++){
  646 + jsonObj = jsonArray.getJSONObject(i);
  647 + dfsj = jsonObj.getString("t");
  648 + schedule = ScheduleBuffer.findOne(jsonObj.getLong("id"));
  649 + //设置待发时间
  650 + schedule.setDfsjAll(dfsj);
  651 + ScheduleBuffer.persistentList.add(schedule);
  652 + }
  653 +
  654 + rs.put("status", ResponseCode.SUCCESS);
  655 + //将更新的最后一个班次返回
  656 + rs.put("t", schedule);
  657 + }catch(Exception e){
  658 + logger.error("", e);
  659 + rs.put("status", ResponseCode.ERROR);
  660 + }
  661 + return rs;
  662 + }
612 663 }
... ...
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
1 1 package com.bsth.vehicle.directive.buffer;
2 2  
  3 +import java.util.ArrayList;
3 4 import java.util.HashMap;
  5 +import java.util.Iterator;
4 6 import java.util.LinkedList;
  7 +import java.util.List;
5 8 import java.util.Map;
6 9  
7 10 import org.slf4j.Logger;
... ... @@ -19,6 +22,7 @@ import com.bsth.vehicle.directive.entity.Directive80;
19 22 import com.bsth.vehicle.directive.entity.DirectiveC0;
20 23 import com.bsth.vehicle.directive.entity.DirectiveC0.DirectiveC0Data;
21 24 import com.bsth.vehicle.directive.entity.LineChange;
  25 +import com.bsth.vehicle.directive.repository.Directive60Repository;
22 26 import com.bsth.vehicle.directive.repository.Directive80Repository;
23 27 import com.bsth.vehicle.directive.repository.LineChangeRepository;
24 28 import com.bsth.vehicle.directive.util.HttpUtils;
... ... @@ -61,6 +65,9 @@ public class DirectiveBuffer {
61 65 */
62 66 private static Map<Integer, Directive60> directiveMap;
63 67  
  68 + @Autowired
  69 + Directive60Repository d60Repository;
  70 +
64 71 /**
65 72 * 驾驶员上报数据
66 73 * {K: 线路编码}
... ... @@ -71,10 +78,7 @@ public class DirectiveBuffer {
71 78 RealControlSocketHandler socketHandler;
72 79  
73 80 static{
74   - transientList = new LinkedList<>();
75   - directiveMap = new HashMap<>();
76   - reportMultiMap = ArrayListMultimap.create();
77   - changeMap = new HashMap<>();
  81 + clear();
78 82 }
79 83  
80 84 public static void put(Directive60 directive){
... ... @@ -205,4 +209,34 @@ public class DirectiveBuffer {
205 209 c0.setData(data);
206 210 return c0;
207 211 }
  212 +
  213 + /**
  214 + *
  215 + * @Title: saveAll
  216 + * @Description: TODO(所有缓存里的指令全部入库)
  217 + */
  218 + public void saveAll(){
  219 + Iterator<Directive60> iterator = directiveMap.values().iterator();
  220 + List<Directive60> pList = new ArrayList<>();
  221 + Directive60 d60;
  222 + while(iterator.hasNext()){
  223 + d60 = iterator.next();
  224 + if(!d60.isPersistent())
  225 + pList.add(d60);
  226 + }
  227 + d60Repository.save(pList);
  228 + }
  229 +
  230 + /**
  231 + *
  232 + * @Title: clear
  233 + * @Description: TODO(清理缓存)
  234 + * @throws
  235 + */
  236 + public static void clear(){
  237 + transientList = new LinkedList<>();
  238 + directiveMap = new HashMap<>();
  239 + reportMultiMap = ArrayListMultimap.create();
  240 + changeMap = new HashMap<>();
  241 + }
208 242 }
... ...
src/main/java/com/bsth/vehicle/directive/entity/Directive60.java
... ... @@ -84,6 +84,9 @@ public class Directive60 {
84 84 @ManyToOne
85 85 private SysUser sender;
86 86  
  87 + @Transient
  88 + private boolean persistent;
  89 +
87 90 @Embeddable
88 91 public static class DirectiveData {
89 92 // 公司代码
... ... @@ -280,4 +283,12 @@ public class Directive60 {
280 283 public void setSender(SysUser sender) {
281 284 this.sender = sender;
282 285 }
  286 +
  287 + public boolean isPersistent() {
  288 + return persistent;
  289 + }
  290 +
  291 + public void setPersistent(boolean persistent) {
  292 + this.persistent = persistent;
  293 + }
283 294 }
... ...
src/main/java/com/bsth/vehicle/directive/thread/DirectivePersistenceThread.java
... ... @@ -38,6 +38,7 @@ public class DirectivePersistenceThread extends Thread{
38 38 if(null == directive)
39 39 break;
40 40  
  41 + directive.setPersistent(true);
41 42 directiveRepository.save(directive);
42 43 }
43 44 }
... ...
src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
1 1 package com.bsth.vehicle.directive.thread;
2 2  
3 3 import java.util.LinkedList;
  4 +import java.util.List;
4 5 import java.util.Set;
5 6  
6 7 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -27,7 +28,25 @@ public class FirstScheduleIssuedThread extends Thread{
27 28 @Override
28 29 public void run() {
29 30  
30   - Set<String> keys = ScheduleBuffer.vehLinkedMap.keySet();
  31 + Set<String> keys = ScheduleBuffer.vehSchListMap.keySet();
  32 + List<ScheduleRealInfo> list;
  33 +
  34 + Long t = System.currentTimeMillis();
  35 + ScheduleRealInfo sch;
  36 + for(String nbbm : keys){
  37 + list = ScheduleBuffer.vehSchListMap.get(nbbm);
  38 +
  39 + if(list.size() == 0)
  40 + continue;
  41 +
  42 + sch = list.get(0);
  43 +
  44 + if(sch.getStatus() == 0 && sch.getFcsjT() > t){
  45 + directiveService.send60Dispatch(sch, 0);
  46 + }
  47 + }
  48 +
  49 + /*Set<String> keys = ScheduleBuffer.vehLinkedMap.keySet();
31 50 LinkedList<ScheduleRealInfo> linkedList;
32 51 ScheduleRealInfo sch;
33 52 for(String nbbm : keys){
... ... @@ -39,6 +58,6 @@ public class FirstScheduleIssuedThread extends Thread{
39 58 if(!ScheduleBuffer.finishLinkedMap.containsKey(nbbm)
40 59 && sch.getFcsjActual() == null)
41 60 directiveService.send60Dispatch(sch, 0);
42   - }
  61 + }*/
43 62 }
44 63 }
... ...
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread.java
... ... @@ -9,7 +9,6 @@ import java.util.ArrayList;
9 9 import java.util.Calendar;
10 10 import java.util.Date;
11 11 import java.util.HashSet;
12   -import java.util.LinkedList;
13 12 import java.util.List;
14 13 import java.util.Set;
15 14  
... ... @@ -68,18 +67,18 @@ public class GpsArrivalStationThread extends Thread{
68 67 set.add(CommonMapped.vehicDeviceBiMap.get(arr.getDeviceId()));
69 68  
70 69 List<ArrivalInfo> rsList = null;
71   - LinkedList<ScheduleRealInfo> linked = null;
  70 + List<ScheduleRealInfo> subList = null;
72 71 ArrivalInfo[] status;
73 72 for(String nbbm : set){
74 73 rsList = GpsArrivalDataBuffer.pops(nbbm);
75   - //和该车辆未执行班次进行匹配
76   - linked = ScheduleBuffer.vehLinkedMap.get(nbbm);
  74 + //和该车辆班次进行匹配
  75 + subList = ScheduleBuffer.vehSchListMap.get(nbbm);
77 76  
78   - if(null == linked || linked.size() == 0)
  77 + if(null == subList || subList.size() == 0)
79 78 continue;
80 79  
81 80 try{
82   - for(ScheduleRealInfo schedule : linked){
  81 + for(ScheduleRealInfo schedule : subList){
83 82 //匹配结果
84 83 status = match(rsList, schedule);
85 84  
... ...
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread_old.java
... ... @@ -64,7 +64,7 @@ public class GpsArrivalStationThread_old extends Thread{
64 64 System.out.println("开始...");
65 65 List<ScheduleRealInfo> schList;
66 66 for(String key : keySet){
67   - schList = extractSched(ScheduleBuffer.vehLinkedMap.get(key));
  67 + schList = extractSched(ScheduleBuffer.vehSchListMap.get(key));
68 68 if(null != schList)
69 69 match(GpsArrivalDataBuffer.allMap.get(key), schList);
70 70 }
... ... @@ -221,8 +221,8 @@ public class GpsArrivalStationThread_old extends Thread{
221 221 try {
222 222 conn = DBUtils_MS.getConnection();
223 223 ps = conn.prepareStatement(sql);
224   - ps.setInt(1, /*weeks_year*/28);
225   - ps.setLong(2, /*GpsArrivalDataBuffer.markTime*/1467853749000L);
  224 + ps.setInt(1, weeks_year);
  225 + ps.setLong(2, GpsArrivalDataBuffer.markTime);
226 226  
227 227 Long t = System.currentTimeMillis();
228 228 rs = ps.executeQuery();
... ...
src/main/java/com/bsth/vehicle/gpsdata/buffer/GpsRealDataBuffer.java
... ... @@ -3,7 +3,6 @@ package com.bsth.vehicle.gpsdata.buffer;
3 3 import java.util.ArrayList;
4 4 import java.util.HashMap;
5 5 import java.util.Iterator;
6   -import java.util.LinkedList;
7 6 import java.util.List;
8 7 import java.util.Map;
9 8 import java.util.Set;
... ... @@ -136,15 +135,27 @@ public class GpsRealDataBuffer {
136 135  
137 136 //写入车辆自编号
138 137 String nbbm;
139   - LinkedList<ScheduleRealInfo> linkedList;
140   - int size;
  138 + ScheduleRealInfo current, next;
141 139 for(GpsRealData gpsData : list){
142 140 nbbm = CommonMapped.vehicDeviceBiMap.get(gpsData.getDeviceId());
143 141 if(null != nbbm){
144 142 gpsData.setNbbm(nbbm);
145 143 gpsData.setStationName(CommonMapped.stationCodeMap.get(gpsData.getStopNo()));
146 144  
147   - linkedList = ScheduleBuffer.vehLinkedMap.get(nbbm);
  145 + current = ScheduleBuffer.findCurrent(nbbm);
  146 + next = ScheduleBuffer.getNext(current);
  147 +
  148 + if(current != null)
  149 + gpsData.setCurrSchId(current.getId());
  150 + if(next != null)
  151 + gpsData.setNextSchId(next.getId());
  152 + //gpsData.setCurrSchId(ScheduleBuffer.findCurrent(nbbm));
  153 + /*subList = ScheduleBuffer.vehSchListMap.get(nbbm);
  154 + if(subList.size() == 0)
  155 + continue;*/
  156 +
  157 +
  158 + /*linkedList = ScheduleBuffer.vehLinkedMap.get(nbbm);
148 159 if(null != linkedList){
149 160 //为GPS点附加班次信息
150 161 size = linkedList.size();
... ... @@ -152,7 +163,7 @@ public class GpsRealDataBuffer {
152 163 gpsData.setCurrSchId(linkedList.peekFirst().getId());
153 164 if(size > 1)
154 165 gpsData.setNextSchId(linkedList.get(1).getId());
155   - }
  166 + }*/
156 167 resList.add(gpsData);
157 168 }
158 169 }
... ...
src/main/resources/static/pages/control/line/child_pages/child_task.html
... ... @@ -189,7 +189,7 @@ $(function(){
189 189  
190 190 //显示班次详细
191 191 $.each(this.cells, function(i,cell){
192   - $('#mainDetailPabel input[data-cell='+i+']').val($(cell).text());
  192 + $('#mainDetailPabel input[data-cell='+i+']').val($.trim($(cell).text()));
193 193 });
194 194 if(!changeHandlerPanel(this))
195 195 return;
... ... @@ -284,7 +284,7 @@ $(function(){
284 284 var cont = $('.custom-table-panel');
285 285 cont.animate({
286 286 scrollTop: $tr.offset().top - cont.offset().top + $tr.scrollTop() - 36 * 4
287   - }, 500);
  287 + }, 500);
288 288  
289 289 }, 100);
290 290 });
... ... @@ -381,6 +381,18 @@ $(function(){
381 381 $(this).show();
382 382 $('input.no', schAddPanel).val($(tr.cells[0]).text());
383 383 $('select[name=xlDir]', schAddPanel).trigger('change');
  384 + //当前表格第一条数据 data-type="empty"
  385 + var $tr = $('.mainTable tr[data-id]', '#childTaskDiv').eq(0);
  386 + if($tr.length > 0){
  387 + var sch = _data.getSchedulById($tr.data('id'));
  388 + console.log(sch);
  389 + //默认车辆
  390 + $('select[name=clZbh]', schAddPanel).val(sch.clZbh).trigger('change');
  391 + //默认驾驶员
  392 + $('select[name=jGh]', schAddPanel).val(sch.jGh + '/' + sch.jName).trigger('change');
  393 + //默认售票员
  394 + $('select[name=sGh]', schAddPanel).val(sch.sGh + '/' + sch.sName).trigger('change');
  395 + }
384 396 });
385 397 //切换上下行
386 398 $(schAddPanel).on('change', 'select[name=xlDir]', function(){
... ... @@ -454,7 +466,8 @@ $(function(){
454 466 _data.updateSchedule(ups[i]);
455 467 } */
456 468 //刷新表格
457   - _alone.addScheduleToTable(sch);
  469 + //_alone.updateTableBySch(sch);
  470 + _alone.update2Table(sch.xlBm, sch);
458 471  
459 472 //关闭弹出层
460 473 layer.closeAll();
... ...
src/main/resources/static/pages/control/line/child_pages/outgo_adjust_all.html
... ... @@ -122,7 +122,6 @@
122 122 //线路下拉框
123 123 var data = [];
124 124 lineCodeMaps = _data.getLineIds();
125   - console.log(lineCodeMaps);
126 125 for(var line in lineCodeMaps){
127 126 data.push({id: line, text: lineCodeMaps[line]});
128 127 }
... ... @@ -196,17 +195,35 @@
196 195 $(e).removeClass('custom-val-error');
197 196  
198 197 if(old != t)
199   - changes.push({old: old, t: t});
  198 + changes.push({old: old, t: t, id: $(e).parents('tr').data('id')});
200 199 }
201 200  
202 201 var text = template('outgo_adjust_change_text_temp', {list: changes});
203 202 layer.confirm(text, {
204 203 btn: ['确认调整','取消'],title:'待发调整确认'
205 204 }, function(){
206   - layer.msg('确认调整', {icon: 1});
  205 + $.ajax({
  206 + url: '/realSchedule/outgoAdjustAll',
  207 + type: 'post',
  208 + data: {params: JSON.stringify(changes)},
  209 + success:function(rs){
  210 + if(rs.status == 'SUCCESS' && rs.t){
  211 + layer.closeAll();
  212 + layer.msg('调整成功!', {icon: 1});
  213 + //刷新表格
  214 + _alone.update2Table(rs.t.xlBm);
  215 + }
  216 + },
  217 + error: errorHandle
  218 + });
207 219 });
208 220 });
209 221 });
  222 +
  223 +
  224 + function errorHandle(){
  225 + layer.alert('服务器出现异常!', {icon: 2, title: '操作失败'});
  226 + }
210 227 }();
211 228 </script>
212 229 </div>
213 230 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/css/lineControl.css
... ... @@ -2009,7 +2009,8 @@ span.log-item-handle a {
2009 2009 .log-item.fache {
2010 2010 }
2011 2011  
2012   -.in-badge, .out-badge {
  2012 +.in-badge, .out-badge,
  2013 +span.blue-badge {
2013 2014 font-size: 13px;
2014 2015 margin-left: 2px;
2015 2016 padding: 2px 4px;
... ... @@ -2017,6 +2018,16 @@ span.log-item-handle a {
2017 2018 display: inline-block;
2018 2019 }
2019 2020  
  2021 +span.blue-badge{
  2022 + background: #7cccaa;
  2023 + color: white;
  2024 +}
  2025 +
  2026 +tr._active .blue-badge{
  2027 + background: #ffffff;
  2028 + color: #3c973c;
  2029 +}
  2030 +
2020 2031 .out-badge{
2021 2032 background: #59d8e3;
2022 2033 color: white;
... ... @@ -2125,37 +2136,51 @@ span.log-item-handle a {
2125 2136 color: white;
2126 2137 }
2127 2138  
2128   -.tab_line .panel-wrap ._panel ._body .pb-table tr._tr_active.active-line-no a{
2129   - color: #afafaf;
  2139 +.tab_line .panel-wrap ._panel ._body .pb-table tr._tr_active.active-line-no a,
  2140 +.pb-table tr.selected.dir_0 a,
  2141 +.pb-table tr.selected.dir_1 a{
  2142 + color: #afafaf !important;
2130 2143 }
2131 2144  
2132 2145 .tab_line .pb-table tr._tr_active.active-line-no a.remarks-popover{
2133 2146 color: #bebebe;
2134 2147 }
2135 2148  
2136   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-qrlb{
  2149 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-qrlb,
  2150 +.pb-table tr.selected.dir_0 td.tl-qrlb,
  2151 +.pb-table tr.selected.dir_1 td.tl-qrlb{
2137 2152 background: none;
2138 2153 color: #ff796a;
2139 2154 }
2140   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-zzzx{
  2155 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-zzzx,
  2156 +.pb-table tr.selected.dir_0 td.tl-zzzx,
  2157 +.pb-table tr.selected.dir_1 td.tl-zzzx{
2141 2158 background: none;
2142 2159 color: #5ae35a;
2143 2160 }
2144   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-yzx{
  2161 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-yzx,
  2162 +.pb-table tr.selected.dir_0 td.tl-yzx,
  2163 +.pb-table tr.selected.dir_1 td.tl-yzx{
2145 2164 background: none;
2146 2165 color: #80c8fa;
2147 2166 }
2148   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxfc{
  2167 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxfc,
  2168 +.pb-table tr.selected.dir_0 td.tl-xxfc,
  2169 +.pb-table tr.selected.dir_1 td.tl-xxfc{
2149 2170 background: none;
2150 2171 color: #a16dff;
2151 2172 }
2152 2173  
2153   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxsd{
  2174 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxsd,
  2175 +.pb-table tr.selected.dir_0 td.tl-xxsd,
  2176 +.pb-table tr.selected.dir_1 td.tl-xxsd{
2154 2177 background: none;
2155 2178 color: #ffb193;
2156 2179 }
2157 2180  
2158   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxrd{
  2181 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxrd,
  2182 +.pb-table tr.selected.dir_0 td.tl-xxrd,
  2183 +.pb-table tr.selected.dir_1 td.tl-xxrd{
2159 2184 background: none;
2160 2185 color: #5cb0e9;
2161 2186 }
... ... @@ -2250,3 +2275,11 @@ tr._tr_active.active-line-no .out-badge{
2250 2275 .change-confirm-text i{
2251 2276 color: #46c146;
2252 2277 }
  2278 +
  2279 +.pb-table tr.selected.dir_0{
  2280 + background-color: #5d5da9 !important;
  2281 +}
  2282 +
  2283 +.pb-table tr.selected.dir_1{
  2284 + background-color: #dc5a5a !important;
  2285 +}
2253 2286 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/js/alone.js
... ... @@ -73,8 +73,8 @@ var _alone = (function(){
73 73 var table = $('tr[data-id='+array[0].id+']').parents('table')[0];
74 74 calculateLineNo(table);
75 75 },
76   - //添加一个班次到表格
77   - addScheduleToTable: function(schedule){
  76 + //将班次所在的表格做全量更新
  77 + updateTableBySch: function(schedule){
78 78 //将该线路走向班次 全部从服务器同步一次
79 79 var xlDir = schedule.xlDir, xlBm = schedule.xlBm;
80 80 $.get('/realSchedule/findByLineAndUpDown', {line: xlBm, upDown: xlDir}
... ... @@ -103,6 +103,35 @@ var _alone = (function(){
103 103 currTr.parents('._body').slimScroll({ scrollTo: top + 'px' });
104 104 });
105 105 },
  106 + update2Table: function(xlBm, schedule){
  107 + //上行
  108 + $.get('/realSchedule/lineCode/' + xlBm, function(array){
  109 + //加入_data缓存
  110 + $.each(array, function(){
  111 + _data.pushSchedule(this);
  112 + });
  113 +
  114 + var rs = splitDir(array)
  115 + ,tab = $('#tab_line_' + xlBm)
  116 + ,half = tab.find('._body').height() / 2;
  117 + //填充表格数据
  118 + calculateLineNo(
  119 + //上行
  120 + tab.find('table[data-type=up] tbody').html(template('alone_plan_table_temp', {list: rs.up}))[0]
  121 + );
  122 + calculateLineNo(
  123 + //下行
  124 + tab.find('table[data-type=down] tbody').html(template('alone_plan_table_temp', {list: rs.down}))[0]
  125 + );
  126 + //定位到指定的班次
  127 + var currTr = tab.find('tr[data-id='+schedule.id+']')
  128 + ,top = parseInt(currTr.find('td[name=lineNo]').text()) * 37 - half;
  129 +
  130 + top = top>0?top:0;
  131 + currTr.addClass('anim-delay animated flash');
  132 + currTr.parents('._body').slimScroll({ scrollTo: top + 'px' });
  133 + });
  134 + },
106 135 //重新计算行号
107 136 calculateLineNo: calculateLineNo
108 137 }
... ...
src/main/resources/static/pages/control/line/js/data.js
... ... @@ -23,17 +23,36 @@ var _data = (function(){
23 23 //线路标准信息
24 24 var lineInformations = {};
25 25 //车辆和班次数组映射
26   - var clSchMap = {};
  26 + //var clSchMap = {};
27 27  
28 28 //车辆自编号和设备号对照
29 29 var carDeviceIdMapp = {};
30 30  
  31 + var fcsjSort = function(a, b){
  32 + return a.fcsjT - b.fcsjT;
  33 + }
  34 +
31 35 var dataObject = {
32 36 /*//班次发车
33 37 setFcsj: function(schId, fcsj, fcsjT){
34 38 schedules[schId].fcsjActual = fcsj;
35 39 schedules[schId].fcsjActualTime = fcsjT;
36 40 },*/
  41 + //根据线路编码获取上行和下行班次
  42 + /*findByLineAll: function(xlbm){
  43 + var array = [],sch;
  44 + for(var id in schedules){
  45 + sch = schedules[id];
  46 + if(sch.xlBm == xlbm)
  47 + array.push(e);
  48 + }
  49 + //排序
  50 + array.sort(function(a, b){
  51 + return a.fcsjT - b.fcsjT;
  52 + });
  53 +
  54 + return array;
  55 + },*/
37 56 //根据线路和上下行获取计划排班
38 57 findSchByLine: function(xlbm, upDown){
39 58 var array = [];
... ... @@ -46,15 +65,22 @@ var _data = (function(){
46 65 }
47 66 }
48 67 //排序
49   - array.sort(function(a, b){
50   - return a.fcsjT - b.fcsjT;
51   - });
  68 + array.sort(fcsjSort);
52 69  
53 70 return array;
54 71 },
55 72 //根据车辆获取班次数组
56 73 findByCl: function(nbbm){
57   - return clSchMap[nbbm];
  74 + var array = [];
  75 + for(var id in schedules){
  76 + sch = schedules[id];
  77 + if(sch.clZbh == nbbm)
  78 + array.push(sch);
  79 + }
  80 +
  81 + //排序
  82 + array.sort(fcsjSort);
  83 + return array;
58 84 },
59 85 //添加一个班次
60 86 pushSchedule: function(sch){
... ... @@ -133,9 +159,9 @@ var _data = (function(){
133 159 lineLpMap[lineCode][this.lpName] = [];
134 160 lineLpMap[lineCode][this.lpName].push(this);
135 161 //车辆 ——> 班次数组
136   - if(!clSchMap[this.clZbh])
  162 + /*if(!clSchMap[this.clZbh])
137 163 clSchMap[this.clZbh] = [];
138   - clSchMap[this.clZbh].push(this);
  164 + clSchMap[this.clZbh].push(this);*/
139 165 });
140 166  
141 167 //按发车时间排序
... ... @@ -161,9 +187,7 @@ var _data = (function(){
161 187 }
162 188  
163 189 //排序
164   - array.sort(function(a, b){
165   - return a.fcsjT - b.fcsjT;
166   - });
  190 + array.sort(fcsjSort);
167 191 return array;
168 192 },
169 193 //根据设备号获取GPS
... ...
src/main/resources/static/pages/control/line/js/rightMenu.js
... ... @@ -31,7 +31,7 @@ var _menu = (function() {
31 31  
32 32 // 表格右键呼出菜单
33 33 var ac = 'active-menu'
34   - ,items = '.pb-table.data tr td[name!=lineNo]';
  34 + ,items = '.pb-table.data tr td[name!=lineNo][data-name!=lpName]';
35 35 $('.portlet-fullscreen').on('contextmenu', items,
36 36 function(e) {
37 37 e.preventDefault();
... ... @@ -83,6 +83,20 @@ var _menu = (function() {
83 83  
84 84 });
85 85  
  86 + //点击路牌
  87 + var lps = '.pb-table.data tr td[data-name=lpName]';
  88 + $('.portlet-fullscreen').on('click', lps, function(e){
  89 + var lp = $(this).text();
  90 + layer.msg('高亮路牌:' + lp + '',{offset: 'ct', shift : 5});
  91 + var lineCode = $(this).parents('.tab-pane').data('id');
  92 + var schArray = _data.getLineLpMap()[lineCode][lp];
  93 +
  94 + resetAllState();
  95 + $.each(schArray, function(){
  96 + $('.pb-table tr[data-id='+this.id+']').addClass('selected dir_' + this.xlDir);
  97 + });
  98 + });
  99 +
86 100 function selectOneRow(firstCell){
87 101 return $(firstCell).addClass('selected').parent().addClass('_tr_active active-line-no');
88 102 }
... ... @@ -97,11 +111,11 @@ var _menu = (function() {
97 111 tips: [2, '#709d94'],shift:5, time: 5000
98 112 });
99 113 });
100   -
  114 +/*
101 115 $('.portlet-fullscreen').on('dbclick', 'table.pb-table .sfsj-item', function(){
102 116 alert(11);
103 117 });
104   -
  118 +*/
105 119 //选中关联班次
106 120 function selCognateSch($ctr){
107 121 //选中关联班次
... ... @@ -110,6 +124,7 @@ var _menu = (function() {
110 124 ,sch = _data.getSchedulById(schId);
111 125  
112 126 var scroll = false;
  127 + console.log(_data.findByCl(clnbbm));
113 128 $.each(_data.findByCl(clnbbm), function(){
114 129 if(scroll){
115 130 var nextTr = $('tr[data-id='+this.id+']');
... ... @@ -122,8 +137,11 @@ var _menu = (function() {
122 137 }
123 138 scroll = false;
124 139 nextTr.addClass('next-sch');
  140 +
  141 + $('.pb-table tr[data-id='+this.id+']').addClass('selected');
  142 + return false;
125 143 }
126   - $('.pb-table tr[data-id='+this.id+']').addClass('selected');
  144 + //$('.pb-table tr[data-id='+this.id+']').addClass('selected');
127 145 if(this.id == schId)
128 146 scroll = true;
129 147 });
... ... @@ -134,6 +152,8 @@ var _menu = (function() {
134 152 $('.pb-table tr td.' + ac).removeClass(ac);
135 153 $('.pb-table tr.selected').removeClass('selected');
136 154 $('.pb-table tr.next-sch').removeClass('next-sch');
  155 + $('.pb-table tr.dir_0').removeClass('dir_0');
  156 + $('.pb-table tr.dir_1').removeClass('dir_1');
137 157 if(layerTip){
138 158 layer.close(layerTip);
139 159 layerTip = null;
... ... @@ -142,6 +162,8 @@ var _menu = (function() {
142 162 function resetAllState(){
143 163 $('.pb-table tr td.' + ac).removeClass(ac);
144 164 $('.pb-table tr.selected').removeClass('selected');
  165 + $('.pb-table tr.dir_0').removeClass('dir_0');
  166 + $('.pb-table tr.dir_1').removeClass('dir_1');
145 167 $('.pb-table tr._tr_active').removeClass('_tr_active active-line-no');
146 168 $('.pb-table tr.next-sch').removeClass('next-sch');
147 169 $('.pb-table.data tr td.selected[name=lineNo]').removeClass('selected');
... ... @@ -223,7 +245,18 @@ var _menu = (function() {
223 245 },
224 246 //计划烂班
225 247 planDestroy: function(schedul){
226   - var data = {item: schedul, array : _data.getSchedulByVeh(schedul.clZbh)}
  248 + /*if(schedul.status == -1){
  249 + layer.alert('不能重复烂班!', {icon: 2, title: '提示', shift: 5});
  250 + return;
  251 + }*/
  252 + var array = [];
  253 + //获取未烂班的班次
  254 + $.each(_data.getSchedulByVeh(schedul.clZbh),function(){
  255 + if(this.status != -1)
  256 + array.push(this);
  257 + });
  258 +
  259 + var data = {item: schedul, array : array}
227 260 var index = layer.open({
228 261 type: 1,
229 262 area: ['370px', '645px'],
... ... @@ -507,6 +540,9 @@ var _menu = (function() {
507 540 layer.close(index);
508 541 if(rs.t)
509 542 _alone.refreshSchedule(rs.t);
  543 +
  544 + if(rs.nextSch)
  545 + _alone.refreshSchedule(rs.nextSch);
510 546 });
511 547 });
512 548 }
... ...
src/main/resources/static/pages/control/line/temps/alone_tp.html
... ... @@ -293,7 +293,7 @@
293 293 {{each array as obj i}}
294 294 <label>
295 295 <div class="checker">
296   - <span><input type="checkbox" value={{obj.id}} name="ids[]" class="icheck" {{if obj.dfsj==item.dfsj}}checked{{/if}}></span></div> {{obj.dfsj}}
  296 + <span><input type="checkbox" value={{obj.id}} name="ids[]" class="icheck" {{if obj.id==item.id}}checked{{/if}}></span></div> {{obj.dfsj}}
297 297 </label>
298 298 {{/each}}
299 299 </div>
... ...
src/main/resources/static/pages/control/line/temps/child_task_case_tp.html
... ... @@ -3,7 +3,7 @@
3 3 <script id="child_task_main_table_temp" type="text/html">
4 4 {{each list as item i}}
5 5 {{if item == null}}
6   - <tr class="empty">
  6 + <tr class="empty" data-type="empty">
7 7 <td width="5%" >{{i + 1}}</td>
8 8 <td width="9%" ></td>
9 9 <td width="9%" ></td>
... ... @@ -17,7 +17,10 @@
17 17 {{else}}
18 18 <tr data-id="{{item.id}}" >
19 19 <td width="5%" >{{i + 1}}</td>
20   - <td width="9%" >{{item.fcsj}}</td>
  20 + <td width="9%" >
  21 + {{if item.fcsjActual != null}}{{item.fcsjActual}}<span class="blue-badge">实</span>{{else}}{{item.dfsj}}
  22 + {{/if}}
  23 + </td>
21 24 <td width="9%" >{{item.zdsj}}</td>
22 25 <td width="14%" >{{item.qdzName}}</td>
23 26 <td width="14%" >{{item.zdzName}}</td>
... ...