Commit 885ed4594c73cd48fc42578078012912577e4dc4
Merge branch 'minhang' into pudong
Showing
24 changed files
with
2552 additions
and
2373 deletions
src/main/java/com/bsth/controller/gps/GpsController.java
| ... | ... | @@ -91,11 +91,12 @@ public class GpsController { |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * gps补全 |
| 94 | + * type 0 : 实时GPS 1:走补传 | |
| 94 | 95 | * @return |
| 95 | 96 | */ |
| 96 | 97 | @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST) |
| 97 | - public Map<String, Object> gpsCompletion(@RequestParam long schId) { | |
| 98 | - return gpsService.gpsCompletion(schId); | |
| 98 | + public Map<String, Object> gpsCompletion(@RequestParam long schId, @RequestParam int type) { | |
| 99 | + return gpsService.gpsCompletion(schId, type); | |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | 102 | /** | ... | ... |
src/main/java/com/bsth/data/Station2ParkBuffer.java
| 1 | -package com.bsth.data; | |
| 2 | - | |
| 3 | -import com.bsth.common.ResponseCode; | |
| 4 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 5 | -import com.bsth.entity.realcontrol.StationToPark; | |
| 6 | -import com.bsth.repository.realcontrol.StationToParkRepository; | |
| 7 | -import com.bsth.util.Arith; | |
| 8 | -import com.google.common.collect.ArrayListMultimap; | |
| 9 | -import org.joda.time.format.DateTimeFormat; | |
| 10 | -import org.joda.time.format.DateTimeFormatter; | |
| 11 | -import org.slf4j.Logger; | |
| 12 | -import org.slf4j.LoggerFactory; | |
| 13 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | -import org.springframework.boot.CommandLineRunner; | |
| 15 | -import org.springframework.stereotype.Component; | |
| 16 | - | |
| 17 | -import java.util.*; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 站到场 历时、公里 数据缓存 | |
| 21 | - * Created by panzhao on 2017/7/10. | |
| 22 | - */ | |
| 23 | -@Component | |
| 24 | -public class Station2ParkBuffer implements CommandLineRunner { | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - StationToParkRepository stationToParkRepository; | |
| 28 | - | |
| 29 | - private static ArrayListMultimap listMultimap; | |
| 30 | - | |
| 31 | - private static Set<StationToPark> pstBuff; | |
| 32 | - | |
| 33 | - static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); | |
| 34 | - | |
| 35 | - @Override | |
| 36 | - public void run(String... strings) throws Exception { | |
| 37 | - listMultimap = ArrayListMultimap.create(); | |
| 38 | - pstBuff = new HashSet<>(); | |
| 39 | - Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); | |
| 40 | - StationToPark stp; | |
| 41 | - while (iterator.hasNext()) { | |
| 42 | - stp = iterator.next(); | |
| 43 | - listMultimap.put(stp.getLineCode(), stp); | |
| 44 | - } | |
| 45 | - } | |
| 46 | - | |
| 47 | - public static List<StationToPark> get(String lineCode) { | |
| 48 | - return listMultimap.get(lineCode); | |
| 49 | - } | |
| 50 | - | |
| 51 | - public static StationToPark get(String lineCode, String sName, String eName) { | |
| 52 | - List<StationToPark> list = get(lineCode); | |
| 53 | - StationToPark stp = null; | |
| 54 | - for (StationToPark s : list) { | |
| 55 | - if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { | |
| 56 | - stp = s; | |
| 57 | - break; | |
| 58 | - } | |
| 59 | - } | |
| 60 | - return stp; | |
| 61 | - } | |
| 62 | - | |
| 63 | - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 64 | - | |
| 65 | - public static void put(ChildTaskPlan ctask) { | |
| 66 | - try{ | |
| 67 | - String type2 = ctask.getType2(); | |
| 68 | - String lineCode = ctask.getSchedule().getXlBm(), sName, eName; | |
| 69 | - | |
| 70 | - if (type2.equals("2")) { | |
| 71 | - sName = ctask.getStartStationName(); | |
| 72 | - eName = ctask.getEndStationName(); | |
| 73 | - } else if (type2.equals("3")) { | |
| 74 | - eName = ctask.getStartStationName(); | |
| 75 | - sName = ctask.getEndStationName(); | |
| 76 | - } else | |
| 77 | - return; | |
| 78 | - | |
| 79 | - Float time = calcMinute(ctask); | |
| 80 | - Float mileage = ctask.getMileage(); | |
| 81 | - | |
| 82 | - StationToPark stp = get(lineCode, sName, eName); | |
| 83 | - if (stp == null) { | |
| 84 | - stp = new StationToPark(); | |
| 85 | - stp.setLineCode(lineCode); | |
| 86 | - stp.setStationName(sName); | |
| 87 | - stp.setParkName(eName); | |
| 88 | - listMultimap.put(lineCode, stp); | |
| 89 | - } | |
| 90 | - | |
| 91 | - if (type2.equals("2")) { | |
| 92 | - stp.setTime1(time); | |
| 93 | - stp.setMileage1(mileage); | |
| 94 | - } else { | |
| 95 | - stp.setTime2(time); | |
| 96 | - stp.setMileage2(mileage); | |
| 97 | - } | |
| 98 | - | |
| 99 | - pstBuff.add(stp); | |
| 100 | - }catch (Exception e){ | |
| 101 | - log.error("", e); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - | |
| 105 | - public static Float calcMinute(ChildTaskPlan ctask) { | |
| 106 | - long t = 0; | |
| 107 | - | |
| 108 | - try { | |
| 109 | - long st = fmtHHmm.parseMillis(ctask.getStartDate()); | |
| 110 | - long et = fmtHHmm.parseMillis(ctask.getEndDate()); | |
| 111 | - | |
| 112 | - t = et - st; | |
| 113 | - } catch (Exception e) { | |
| 114 | - e.printStackTrace(); | |
| 115 | - } | |
| 116 | - return Float.parseFloat(String.valueOf(Arith.div(Arith.div(t, 1000), 60))); | |
| 117 | - } | |
| 118 | - | |
| 119 | - public void saveAll(){ | |
| 120 | - if(pstBuff.size()==0) | |
| 121 | - return; | |
| 122 | - Set<StationToPark> pstBuffCopy = pstBuff; | |
| 123 | - pstBuff = new HashSet<>(); | |
| 124 | - //持久化到数据库 | |
| 125 | - stationToParkRepository.save(pstBuffCopy); | |
| 126 | - } | |
| 127 | - | |
| 128 | - public Map<String, Object> delete(String lineCode, Integer id) { | |
| 129 | - Map<String, Object> rs = new HashMap<>(); | |
| 130 | - try { | |
| 131 | - List<StationToPark> list = listMultimap.get(lineCode); | |
| 132 | - | |
| 133 | - StationToPark stp = null; | |
| 134 | - for(StationToPark temp : list){ | |
| 135 | - if(temp.getId().equals(id)){ | |
| 136 | - stp=temp; | |
| 137 | - break; | |
| 138 | - } | |
| 139 | - } | |
| 140 | - | |
| 141 | - if(stp != null){ | |
| 142 | - listMultimap.remove(lineCode, stp); | |
| 143 | - stationToParkRepository.delete(id); | |
| 144 | - rs.put("status", ResponseCode.SUCCESS); | |
| 145 | - } | |
| 146 | - else{ | |
| 147 | - rs.put("status", ResponseCode.SUCCESS); | |
| 148 | - rs.put("msg", "操作失败,可能数据已经被删除!"); | |
| 149 | - } | |
| 150 | - | |
| 151 | - }catch (Exception e){ | |
| 152 | - rs.put("status", ResponseCode.ERROR); | |
| 153 | - rs.put("msg", e.getMessage()); | |
| 154 | - log.error("", e); | |
| 155 | - } | |
| 156 | - return rs; | |
| 157 | - } | |
| 158 | -} | |
| 1 | +package com.bsth.data; | |
| 2 | + | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 4 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 5 | +import com.bsth.entity.realcontrol.StationToPark; | |
| 6 | +import com.bsth.repository.realcontrol.StationToParkRepository; | |
| 7 | +import com.bsth.util.Arith; | |
| 8 | +import com.google.common.collect.ArrayListMultimap; | |
| 9 | +import org.joda.time.format.DateTimeFormat; | |
| 10 | +import org.joda.time.format.DateTimeFormatter; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.boot.CommandLineRunner; | |
| 15 | +import org.springframework.stereotype.Component; | |
| 16 | + | |
| 17 | +import java.util.*; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * 站到场 历时、公里 数据缓存 | |
| 21 | + * Created by panzhao on 2017/7/10. | |
| 22 | + */ | |
| 23 | +@Component | |
| 24 | +public class Station2ParkBuffer implements CommandLineRunner { | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + StationToParkRepository stationToParkRepository; | |
| 28 | + | |
| 29 | + private static ArrayListMultimap listMultimap; | |
| 30 | + | |
| 31 | + private static Set<StationToPark> pstBuff; | |
| 32 | + | |
| 33 | + static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public void run(String... strings) throws Exception { | |
| 37 | + listMultimap = ArrayListMultimap.create(); | |
| 38 | + pstBuff = new HashSet<>(); | |
| 39 | + Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); | |
| 40 | + StationToPark stp; | |
| 41 | + while (iterator.hasNext()) { | |
| 42 | + stp = iterator.next(); | |
| 43 | + listMultimap.put(stp.getLineCode(), stp); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + public static List<StationToPark> get(String lineCode) { | |
| 48 | + return listMultimap.get(lineCode); | |
| 49 | + } | |
| 50 | + | |
| 51 | + public static StationToPark get(String lineCode, String sName, String eName) { | |
| 52 | + List<StationToPark> list = get(lineCode); | |
| 53 | + StationToPark stp = null; | |
| 54 | + for (StationToPark s : list) { | |
| 55 | + if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { | |
| 56 | + stp = s; | |
| 57 | + break; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + return stp; | |
| 61 | + } | |
| 62 | + | |
| 63 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 64 | + | |
| 65 | + public static void put(ChildTaskPlan ctask) { | |
| 66 | + try{ | |
| 67 | + String type2 = ctask.getType2(); | |
| 68 | + String lineCode = ctask.getSchedule().getXlBm(), sName, eName; | |
| 69 | + | |
| 70 | + if (type2.equals("2")) { | |
| 71 | + sName = ctask.getStartStationName(); | |
| 72 | + eName = ctask.getEndStationName(); | |
| 73 | + } else if (type2.equals("3")) { | |
| 74 | + eName = ctask.getStartStationName(); | |
| 75 | + sName = ctask.getEndStationName(); | |
| 76 | + } else | |
| 77 | + return; | |
| 78 | + | |
| 79 | + Float time = calcMinute(ctask); | |
| 80 | + Float mileage = ctask.getMileage(); | |
| 81 | + | |
| 82 | + StationToPark stp = get(lineCode, sName, eName); | |
| 83 | + if (stp == null) { | |
| 84 | + stp = new StationToPark(); | |
| 85 | + stp.setLineCode(lineCode); | |
| 86 | + stp.setStationName(sName); | |
| 87 | + stp.setParkName(eName); | |
| 88 | + listMultimap.put(lineCode, stp); | |
| 89 | + } | |
| 90 | + | |
| 91 | + if (type2.equals("2")) { | |
| 92 | + stp.setTime1(time); | |
| 93 | + stp.setMileage1(mileage); | |
| 94 | + } else { | |
| 95 | + stp.setTime2(time); | |
| 96 | + stp.setMileage2(mileage); | |
| 97 | + } | |
| 98 | + | |
| 99 | + pstBuff.add(stp); | |
| 100 | + }catch (Exception e){ | |
| 101 | + log.error("", e); | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + public static Float calcMinute(ChildTaskPlan ctask) { | |
| 106 | + long t = 0; | |
| 107 | + | |
| 108 | + try { | |
| 109 | + long st = fmtHHmm.parseMillis(ctask.getStartDate()); | |
| 110 | + long et = fmtHHmm.parseMillis(ctask.getEndDate()); | |
| 111 | + | |
| 112 | + t = et - st; | |
| 113 | + } catch (Exception e) { | |
| 114 | + e.printStackTrace(); | |
| 115 | + } | |
| 116 | + return Float.parseFloat(String.valueOf(Arith.div(Arith.div(t, 1000), 60))); | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void saveAll(){ | |
| 120 | + if(pstBuff.size()==0) | |
| 121 | + return; | |
| 122 | + Set<StationToPark> pstBuffCopy = pstBuff; | |
| 123 | + pstBuff = new HashSet<>(); | |
| 124 | + //持久化到数据库 | |
| 125 | + stationToParkRepository.save(pstBuffCopy); | |
| 126 | + } | |
| 127 | + | |
| 128 | + public Map<String, Object> delete(String lineCode, Integer id) { | |
| 129 | + Map<String, Object> rs = new HashMap<>(); | |
| 130 | + try { | |
| 131 | + List<StationToPark> list = listMultimap.get(lineCode); | |
| 132 | + | |
| 133 | + StationToPark stp = null; | |
| 134 | + for(StationToPark temp : list){ | |
| 135 | + if(temp.getId().equals(id)){ | |
| 136 | + stp=temp; | |
| 137 | + break; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + if(stp != null){ | |
| 142 | + listMultimap.remove(lineCode, stp); | |
| 143 | + stationToParkRepository.delete(id); | |
| 144 | + rs.put("status", ResponseCode.SUCCESS); | |
| 145 | + } | |
| 146 | + else{ | |
| 147 | + rs.put("status", ResponseCode.SUCCESS); | |
| 148 | + rs.put("msg", "操作失败,可能数据已经被删除!"); | |
| 149 | + } | |
| 150 | + | |
| 151 | + }catch (Exception e){ | |
| 152 | + rs.put("status", ResponseCode.ERROR); | |
| 153 | + rs.put("msg", e.getMessage()); | |
| 154 | + log.error("", e); | |
| 155 | + } | |
| 156 | + return rs; | |
| 157 | + } | |
| 158 | +} | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -2,7 +2,6 @@ package com.bsth.data.pilot80; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.LineConfigData; |
| 5 | -import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | 5 | import com.bsth.data.gpsdata.GpsRealData; |
| 7 | 6 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 8 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| ... | ... | @@ -16,7 +15,6 @@ import com.bsth.repository.directive.D80Repository; |
| 16 | 15 | import com.bsth.repository.directive.DC0A4Repository; |
| 17 | 16 | import com.bsth.service.directive.DirectiveService; |
| 18 | 17 | import com.bsth.websocket.handler.SendUtils; |
| 19 | -import com.google.common.collect.ArrayListMultimap; | |
| 20 | 18 | import org.apache.commons.lang3.StringUtils; |
| 21 | 19 | import org.slf4j.Logger; |
| 22 | 20 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -26,289 +24,278 @@ import org.springframework.stereotype.Component; |
| 26 | 24 | import java.util.ArrayList; |
| 27 | 25 | import java.util.Collection; |
| 28 | 26 | import java.util.List; |
| 27 | +import java.util.concurrent.ConcurrentHashMap; | |
| 29 | 28 | |
| 30 | 29 | /** |
| 31 | - * | |
| 32 | - * @ClassName: PilotReport | |
| 33 | - * @Description: TODO(设备80协议上报处理) | |
| 34 | 30 | * @author PanZhao |
| 35 | - * @date 2016年8月14日 下午11:37:51 | |
| 36 | - * | |
| 31 | + * @ClassName: PilotReport | |
| 32 | + * @Description: TODO(设备80协议上报处理) | |
| 33 | + * @date 2016年8月14日 下午11:37:51 | |
| 37 | 34 | */ |
| 38 | 35 | @Component |
| 39 | 36 | public class PilotReport { |
| 40 | - | |
| 41 | - @Autowired | |
| 42 | - D80Repository d80Repository; | |
| 43 | - @Autowired | |
| 44 | - DayOfSchedule dayOfSchedule; | |
| 45 | - @Autowired | |
| 46 | - LineConfigData lineConfigData; | |
| 47 | - @Autowired | |
| 48 | - DirectiveService directiveService; | |
| 49 | - @Autowired | |
| 50 | - GpsRealData gpsRealData; | |
| 51 | - @Autowired | |
| 52 | - SendUtils sendUtils; | |
| 53 | - | |
| 54 | - @Autowired | |
| 55 | - DC0A4Repository dc0A4Repository; | |
| 56 | - | |
| 57 | - private static ArrayListMultimap<String, D80> d80MultiMap; | |
| 58 | - | |
| 59 | - Logger logger = LoggerFactory.getLogger(PilotReport.class); | |
| 60 | - | |
| 61 | - static{ | |
| 62 | - d80MultiMap = ArrayListMultimap.create(); | |
| 63 | - } | |
| 64 | - | |
| 65 | - public void report(D80 d80){ | |
| 66 | - //入库 | |
| 67 | - d80Repository.save(d80); | |
| 68 | - //入缓存 | |
| 69 | - d80MultiMap.put(d80.getData().getLineId().toString(), d80); | |
| 70 | - | |
| 71 | - String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 72 | - //处理 | |
| 73 | - switch (d80.getData().getRequestCode()) { | |
| 74 | - case 0xA3: | |
| 75 | - //出场请求 | |
| 76 | - ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out"); | |
| 77 | - //如果有对应出场班次 | |
| 78 | - if(outSch != null){ | |
| 79 | - //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令 | |
| 80 | - if(outSch.getJhlc() == null) | |
| 81 | - outSch = dayOfSchedule.next(outSch); | |
| 82 | - | |
| 83 | - //下发调度指令 | |
| 84 | - DirectivePushQueue.put6002(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 85 | - //directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 86 | - //下发线路切换指令 | |
| 87 | - DirectivePushQueue.put64(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 88 | - //directiveService.lineChange(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 89 | - }else | |
| 90 | - d80.setRemarks("没有出场计划"); | |
| 91 | - | |
| 92 | - break; | |
| 93 | - | |
| 94 | - case 0xA5: | |
| 95 | - //进场请求 | |
| 96 | - //ScheduleRealInfo inSch = dayOfSchedule.nextByBcType(nbbm, "in"); | |
| 97 | - //如果有对应出场班次 | |
| 98 | - //if(inSch != null){ | |
| 99 | - /*d80.setRemarks("计划进场时间:" + inSch.getDfsj()); | |
| 100 | - //当前GPS位置 | |
| 101 | - GpsEntity gps = gpsRealData.get(d80.getDeviceId()); | |
| 102 | - if(null != gps) | |
| 103 | - d80.addRemarks("<br> 位置:" + coordHtmlStr(gps));*/ | |
| 104 | - //}/*else | |
| 105 | - // d80.setRemarks("没有进场计划");*/ | |
| 106 | - break; | |
| 107 | - } | |
| 108 | - | |
| 109 | - //推送到页面 | |
| 110 | - sendUtils.send80ToPage(d80); | |
| 111 | - } | |
| 112 | - | |
| 113 | - public void report(DC0_A4 c0a4){ | |
| 114 | - String deviceId = c0a4.getData().getDeviceId(); | |
| 115 | - if(StringUtils.isNotEmpty(deviceId)) | |
| 116 | - c0a4.setId(deviceId); | |
| 117 | - | |
| 118 | - //入库 | |
| 119 | - dc0A4Repository.save(c0a4); | |
| 120 | - } | |
| 121 | - | |
| 122 | - /** | |
| 123 | - * | |
| 124 | - * @Title: reply | |
| 125 | - * @Description: TODO(调度员回复) | |
| 126 | - */ | |
| 127 | - public void reply(D80 d80){ | |
| 128 | - String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 129 | - Short reqCode = d80.getData().getRequestCode(); | |
| 130 | - //默认短语回复 | |
| 131 | - //defaultReply(nbbm, reqCode, d80.getConfirmRs() == 0?true:false); | |
| 132 | - | |
| 133 | - switch (reqCode) { | |
| 134 | - case 0xA3: | |
| 135 | - //出场请求回复 | |
| 136 | - applyOutReply(d80); | |
| 137 | - break; | |
| 138 | - case 0xA5: | |
| 139 | - //进场请求回复 | |
| 140 | - applyInReply(d80); | |
| 141 | - break; | |
| 142 | - } | |
| 143 | - } | |
| 144 | - | |
| 145 | - /** | |
| 146 | - * | |
| 147 | - * @Title: applyOutReply | |
| 148 | - * @Description: TODO(出场请求回复) | |
| 149 | - */ | |
| 150 | - public void applyOutReply(D80 d80){ | |
| 151 | - //同意 | |
| 152 | - if(d80.getConfirmRs() == 0){ | |
| 153 | - String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 154 | - | |
| 155 | - ScheduleRealInfo sch = dayOfSchedule.nextByBcType(nbbm, "out"); | |
| 156 | - if(null == sch) | |
| 157 | - return; | |
| 158 | - | |
| 159 | - LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 160 | - if(conf.getOutConfig() == 1){ | |
| 161 | - //为相关班次写入请求出场时间 | |
| 162 | - sch.setFcsjActualAll(d80.getTimestamp()); | |
| 163 | - | |
| 164 | - dayOfSchedule.save(sch); | |
| 165 | - //通知页面 | |
| 166 | - sendUtils.refreshSch(sch); | |
| 167 | - } | |
| 168 | - } | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | - * | |
| 173 | - * @Title: applyInReply | |
| 174 | - * @Description: TODO(进场请求回复) | |
| 175 | - */ | |
| 176 | - public void applyInReply(D80 d80){ | |
| 177 | - //同意 | |
| 178 | - if(d80.getConfirmRs() == 0){ | |
| 179 | - String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 180 | - | |
| 181 | - ScheduleRealInfo sch = dayOfSchedule.nextByBcType(nbbm, "in"); | |
| 182 | - if(null == sch) | |
| 183 | - return; | |
| 184 | - | |
| 185 | - LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 186 | - if(conf.getOutConfig() == 1){ | |
| 187 | - //为相关班次写入进场时间 | |
| 188 | - sch.setZdsjActualAll(d80.getTimestamp()); | |
| 189 | - | |
| 190 | - //没有里程的进场班次 | |
| 191 | - if(isEmpty(sch.getBcsj()) && isEmpty(sch.getJhlc())) | |
| 192 | - sch.setFcsjActualAll(d80.getTimestamp()); | |
| 193 | - | |
| 194 | - dayOfSchedule.save(sch); | |
| 195 | - //通知页面 | |
| 196 | - sendUtils.refreshSch(sch); | |
| 197 | - } | |
| 198 | - } | |
| 199 | - } | |
| 200 | - | |
| 201 | - public boolean isEmpty(Integer v){ | |
| 202 | - return v == null || v.equals(0); | |
| 203 | - } | |
| 204 | - | |
| 205 | - public boolean isEmpty(Double v){ | |
| 206 | - return v == null || v.equals(0); | |
| 207 | - } | |
| 208 | - | |
| 209 | - public void defaultReply(String nbbm, short requestCode, boolean agree){ | |
| 210 | - Line line = BasicData.nbbm2LineMap.get(nbbm); | |
| 211 | - String lineCode = null; | |
| 212 | - | |
| 213 | - if(line != null) | |
| 214 | - lineCode = line.getLineCode(); | |
| 215 | - else{ | |
| 216 | - try{ | |
| 217 | - lineCode = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)).getLineId().toString(); | |
| 218 | - }catch(Exception e){ | |
| 219 | - logger.error("", e); | |
| 220 | - } | |
| 221 | - } | |
| 222 | - | |
| 223 | - if(null == lineCode) | |
| 224 | - return; | |
| 225 | - | |
| 226 | - LineConfig conf = lineConfigData.get(lineCode); | |
| 227 | - D80ReplyTemp temp = conf.findByCode(requestCode); | |
| 228 | - | |
| 229 | - if(null == temp) | |
| 230 | - return; | |
| 231 | - | |
| 232 | - String text; | |
| 233 | - if(agree) | |
| 234 | - text = temp.getAgreeText(); | |
| 235 | - else | |
| 236 | - text = temp.getRejectText(); | |
| 237 | - | |
| 238 | - directiveService.send60Phrase(nbbm, text, "系统"); | |
| 239 | - } | |
| 240 | - | |
| 241 | - /** | |
| 242 | - * | |
| 243 | - * @Title: resumeOperation | |
| 244 | - * @Description: TODO(恢复营运) | |
| 245 | - */ | |
| 246 | - public void resumeOperation(D80 d80){ | |
| 247 | - | |
| 248 | - } | |
| 249 | - | |
| 250 | - /** | |
| 251 | - * | |
| 252 | - * @Title: applyTiaodang | |
| 253 | - * @Description: TODO(申请调档) | |
| 254 | - */ | |
| 255 | - public void applyTiaodang(D80 d80){ | |
| 256 | - | |
| 257 | - } | |
| 258 | - | |
| 259 | - /** | |
| 260 | - * | |
| 261 | - * @Title: unconfirmed80 | |
| 262 | - * @Description: TODO(根据lineCode 获取未处理的80数据) | |
| 263 | - */ | |
| 264 | - public List<D80> unconfirmed80(Integer lineCode){ | |
| 265 | - List<D80> lineAll = d80MultiMap.get(lineCode.toString()) | |
| 266 | - ,rs = new ArrayList<>(); | |
| 267 | - | |
| 268 | - for(D80 d80 : lineAll) | |
| 269 | - if(!d80.isConfirm()) | |
| 270 | - rs.add(d80); | |
| 271 | - | |
| 272 | - return rs; | |
| 273 | - } | |
| 274 | - | |
| 275 | - public D80 findById(int id){ | |
| 276 | - Collection<D80> all = d80MultiMap.values(); | |
| 277 | - | |
| 278 | - for(D80 d80 : all){ | |
| 279 | - if(d80.getId() == id) | |
| 280 | - return d80; | |
| 281 | - } | |
| 282 | - | |
| 283 | - return null; | |
| 284 | - } | |
| 285 | - | |
| 286 | - public String coordHtmlStr(GpsEntity gps){ | |
| 287 | - | |
| 288 | - return "<span class=\"nt-coord\" data-lon=\""+gps.getLon()+"\" data-lat=\""+gps.getLat()+"\"></span>"; | |
| 289 | - } | |
| 290 | - | |
| 291 | - public Collection<D80> findAll(){ | |
| 292 | - return d80MultiMap.values(); | |
| 293 | - } | |
| 294 | - | |
| 295 | - public void clear(String lineCode){ | |
| 296 | - logger.info("清除 80数据 before: " + d80MultiMap.size()); | |
| 297 | - d80MultiMap.removeAll(lineCode); | |
| 298 | - logger.info("清除 80数据 after: " + d80MultiMap.size()); | |
| 299 | - } | |
| 300 | - | |
| 301 | - public Collection<? extends D80> findByCar(String nbbm) { | |
| 302 | - List<D80> rs = new ArrayList<>(); | |
| 303 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 304 | - if(null == deviceId) | |
| 305 | - return rs; | |
| 306 | - | |
| 307 | - Collection<D80> all = findAll(); | |
| 308 | - for(D80 d80 : all){ | |
| 309 | - if(d80.getDeviceId().equals(deviceId)) | |
| 310 | - rs.add(d80); | |
| 311 | - } | |
| 312 | - return rs; | |
| 313 | - } | |
| 37 | + | |
| 38 | + @Autowired | |
| 39 | + D80Repository d80Repository; | |
| 40 | + @Autowired | |
| 41 | + DayOfSchedule dayOfSchedule; | |
| 42 | + @Autowired | |
| 43 | + LineConfigData lineConfigData; | |
| 44 | + @Autowired | |
| 45 | + DirectiveService directiveService; | |
| 46 | + @Autowired | |
| 47 | + GpsRealData gpsRealData; | |
| 48 | + @Autowired | |
| 49 | + SendUtils sendUtils; | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + DC0A4Repository dc0A4Repository; | |
| 53 | + | |
| 54 | + //private static ArrayListMultimap<String, D80> d80MultiMap; | |
| 55 | + | |
| 56 | + private static ConcurrentHashMap<Integer, D80> d80Maps; | |
| 57 | + | |
| 58 | + Logger logger = LoggerFactory.getLogger(PilotReport.class); | |
| 59 | + | |
| 60 | + static { | |
| 61 | + //d80MultiMap = ArrayListMultimap.create(); | |
| 62 | + d80Maps = new ConcurrentHashMap<>(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void report(D80 d80) { | |
| 66 | + if (d80 == null) | |
| 67 | + return; | |
| 68 | + try { | |
| 69 | + //入库 | |
| 70 | + d80Repository.save(d80); | |
| 71 | + //入缓存 | |
| 72 | + d80Maps.put(d80.getId(), d80); | |
| 73 | + //d80MultiMap.put(d80.getData().getLineId().toString(), d80); | |
| 74 | + | |
| 75 | + String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 76 | + //处理 | |
| 77 | + switch (d80.getData().getRequestCode()) { | |
| 78 | + //出场请求 | |
| 79 | + case 0xA3: | |
| 80 | + ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out"); | |
| 81 | + //如果有对应出场班次 | |
| 82 | + if (outSch != null) { | |
| 83 | + //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令 | |
| 84 | + if (outSch.getJhlc() == null) | |
| 85 | + outSch = dayOfSchedule.next(outSch); | |
| 86 | + | |
| 87 | + //下发调度指令 | |
| 88 | + DirectivePushQueue.put6002(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 89 | + //下发线路切换指令 | |
| 90 | + DirectivePushQueue.put64(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 91 | + } | |
| 92 | + break; | |
| 93 | + } | |
| 94 | + | |
| 95 | + //推送到页面 | |
| 96 | + sendUtils.send80ToPage(d80); | |
| 97 | + } catch (Exception e) { | |
| 98 | + logger.error("", e); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void report(DC0_A4 c0a4) { | |
| 103 | + String deviceId = c0a4.getData().getDeviceId(); | |
| 104 | + if (StringUtils.isNotEmpty(deviceId)) | |
| 105 | + c0a4.setId(deviceId); | |
| 106 | + | |
| 107 | + //入库 | |
| 108 | + dc0A4Repository.save(c0a4); | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * @Title: reply | |
| 113 | + * @Description: TODO(调度员回复) | |
| 114 | + */ | |
| 115 | + public void reply(D80 d80) { | |
| 116 | + String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 117 | + Short reqCode = d80.getData().getRequestCode(); | |
| 118 | + //默认短语回复 | |
| 119 | + //defaultReply(nbbm, reqCode, d80.getConfirmRs() == 0?true:false); | |
| 120 | + | |
| 121 | + switch (reqCode) { | |
| 122 | + case 0xA3: | |
| 123 | + //出场请求回复 | |
| 124 | + applyOutReply(d80); | |
| 125 | + break; | |
| 126 | + case 0xA5: | |
| 127 | + //进场请求回复 | |
| 128 | + applyInReply(d80); | |
| 129 | + break; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * @Title: applyOutReply | |
| 135 | + * @Description: TODO(出场请求回复) | |
| 136 | + */ | |
| 137 | + public void applyOutReply(D80 d80) { | |
| 138 | + //同意 | |
| 139 | + if (d80.getConfirmRs() == 0) { | |
| 140 | + String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 141 | + | |
| 142 | + ScheduleRealInfo sch = dayOfSchedule.nextByBcType(nbbm, "out"); | |
| 143 | + if (null == sch) | |
| 144 | + return; | |
| 145 | + | |
| 146 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 147 | + if (conf.getOutConfig() == 1) { | |
| 148 | + //为相关班次写入请求出场时间 | |
| 149 | + sch.setFcsjActualAll(d80.getTimestamp()); | |
| 150 | + | |
| 151 | + dayOfSchedule.save(sch); | |
| 152 | + //通知页面 | |
| 153 | + sendUtils.refreshSch(sch); | |
| 154 | + } | |
| 155 | + } | |
| 156 | + } | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * @Title: applyInReply | |
| 160 | + * @Description: TODO(进场请求回复) | |
| 161 | + */ | |
| 162 | + public void applyInReply(D80 d80) { | |
| 163 | + //同意 | |
| 164 | + if (d80.getConfirmRs() == 0) { | |
| 165 | + String nbbm = BasicData.deviceId2NbbmMap.get(d80.getDeviceId()); | |
| 166 | + | |
| 167 | + ScheduleRealInfo sch = dayOfSchedule.nextByBcType(nbbm, "in"); | |
| 168 | + if (null == sch) | |
| 169 | + return; | |
| 170 | + | |
| 171 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 172 | + if (conf.getOutConfig() == 1) { | |
| 173 | + //为相关班次写入进场时间 | |
| 174 | + sch.setZdsjActualAll(d80.getTimestamp()); | |
| 175 | + | |
| 176 | + //没有里程的进场班次 | |
| 177 | + if (isEmpty(sch.getBcsj()) && isEmpty(sch.getJhlc())) | |
| 178 | + sch.setFcsjActualAll(d80.getTimestamp()); | |
| 179 | + | |
| 180 | + dayOfSchedule.save(sch); | |
| 181 | + //通知页面 | |
| 182 | + sendUtils.refreshSch(sch); | |
| 183 | + } | |
| 184 | + } | |
| 185 | + } | |
| 186 | + | |
| 187 | + public boolean isEmpty(Integer v) { | |
| 188 | + return v == null || v.equals(0); | |
| 189 | + } | |
| 190 | + | |
| 191 | + public boolean isEmpty(Double v) { | |
| 192 | + return v == null || v.equals(0); | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void defaultReply(String nbbm, short requestCode, boolean agree) { | |
| 196 | + Line line = BasicData.nbbm2LineMap.get(nbbm); | |
| 197 | + String lineCode = null; | |
| 198 | + | |
| 199 | + if (line != null) | |
| 200 | + lineCode = line.getLineCode(); | |
| 201 | + else { | |
| 202 | + try { | |
| 203 | + lineCode = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)).getLineId().toString(); | |
| 204 | + } catch (Exception e) { | |
| 205 | + logger.error("", e); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + | |
| 209 | + if (null == lineCode) | |
| 210 | + return; | |
| 211 | + | |
| 212 | + LineConfig conf = lineConfigData.get(lineCode); | |
| 213 | + D80ReplyTemp temp = conf.findByCode(requestCode); | |
| 214 | + | |
| 215 | + if (null == temp) | |
| 216 | + return; | |
| 217 | + | |
| 218 | + String text; | |
| 219 | + if (agree) | |
| 220 | + text = temp.getAgreeText(); | |
| 221 | + else | |
| 222 | + text = temp.getRejectText(); | |
| 223 | + | |
| 224 | + directiveService.send60Phrase(nbbm, text, "系统"); | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * @Title: resumeOperation | |
| 229 | + * @Description: TODO(恢复营运) | |
| 230 | + */ | |
| 231 | + public void resumeOperation(D80 d80) { | |
| 232 | + | |
| 233 | + } | |
| 234 | + | |
| 235 | + /** | |
| 236 | + * @Title: applyTiaodang | |
| 237 | + * @Description: TODO(申请调档) | |
| 238 | + */ | |
| 239 | + public void applyTiaodang(D80 d80) { | |
| 240 | + | |
| 241 | + } | |
| 242 | + | |
| 243 | + /** | |
| 244 | + * @Title: unconfirmed80 | |
| 245 | + * @Description: TODO(根据lineCode 获取未处理的80数据) | |
| 246 | + */ | |
| 247 | + public List<D80> unconfirmed80(String lineCode) { | |
| 248 | + List<D80> lineAll = findByLine(lineCode), rs = new ArrayList<>(); | |
| 249 | + | |
| 250 | + for (D80 d80 : lineAll) | |
| 251 | + if (!d80.isConfirm()) | |
| 252 | + rs.add(d80); | |
| 253 | + | |
| 254 | + return rs; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public List<D80> findByLine(String lineCode) { | |
| 258 | + List<D80> rs = new ArrayList<>(); | |
| 259 | + for (D80 d80 : d80Maps.values()) { | |
| 260 | + if (d80 != null && d80.getData().getLineId().equals(lineCode)) | |
| 261 | + rs.add(d80); | |
| 262 | + } | |
| 263 | + return rs; | |
| 264 | + } | |
| 265 | + | |
| 266 | + public D80 findById(int id) { | |
| 267 | + return d80Maps.get(id); | |
| 268 | + } | |
| 269 | + | |
| 270 | +/* public String coordHtmlStr(GpsEntity gps) { | |
| 271 | + | |
| 272 | + return "<span class=\"nt-coord\" data-lon=\"" + gps.getLon() + "\" data-lat=\"" + gps.getLat() + "\"></span>"; | |
| 273 | + }*/ | |
| 274 | + | |
| 275 | + public Collection<D80> findAll() { | |
| 276 | + return d80Maps.values(); | |
| 277 | + } | |
| 278 | + | |
| 279 | + public void clear(String lineCode) { | |
| 280 | + logger.info("清除 80数据 before: " + d80Maps.size()); | |
| 281 | + List<D80> rems = findByLine(lineCode); | |
| 282 | + for (D80 d80 : rems) { | |
| 283 | + d80Maps.remove(d80.getId()); | |
| 284 | + } | |
| 285 | + logger.info("清除 80数据 after: " + d80Maps.size()); | |
| 286 | + } | |
| 287 | + | |
| 288 | + public Collection<? extends D80> findByCar(String nbbm) { | |
| 289 | + List<D80> rs = new ArrayList<>(); | |
| 290 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 291 | + if (null == deviceId) | |
| 292 | + return rs; | |
| 293 | + | |
| 294 | + Collection<D80> all = findAll(); | |
| 295 | + for (D80 d80 : all) { | |
| 296 | + if (d80.getDeviceId().equals(deviceId)) | |
| 297 | + rs.add(d80); | |
| 298 | + } | |
| 299 | + return rs; | |
| 300 | + } | |
| 314 | 301 | } | ... | ... |
src/main/java/com/bsth/data/schedule/edit_logs/loggers/AfterwardsLogger.java
| 1 | -package com.bsth.data.schedule.edit_logs.loggers; | |
| 2 | - | |
| 3 | -import com.alibaba.fastjson.JSONArray; | |
| 4 | -import com.alibaba.fastjson.JSONObject; | |
| 5 | -import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | |
| 6 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 7 | -import org.slf4j.Logger; | |
| 8 | -import org.slf4j.LoggerFactory; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 事后历史班次编辑 | |
| 12 | - * Created by panzhao on 2017/5/19. | |
| 13 | - */ | |
| 14 | -public class AfterwardsLogger { | |
| 15 | - | |
| 16 | - static Logger log = LoggerFactory.getLogger(AfterwardsLogger.class); | |
| 17 | - | |
| 18 | - private JSONArray jsonArray = new JSONArray(); | |
| 19 | - private String remarks; | |
| 20 | - private ScheduleRealInfo sch; | |
| 21 | - | |
| 22 | - public void log(String title, Object old, Object now){ | |
| 23 | - try { | |
| 24 | - | |
| 25 | - JSONObject jsonObject = new JSONObject(); | |
| 26 | - jsonObject.put("title", title); | |
| 27 | - jsonObject.put("old", old); | |
| 28 | - jsonObject.put("now", now); | |
| 29 | - | |
| 30 | - jsonArray.add(jsonObject); | |
| 31 | - }catch (Exception e){ | |
| 32 | - log.error("", e); | |
| 33 | - } | |
| 34 | - } | |
| 35 | - | |
| 36 | - public void log(String text){ | |
| 37 | - try { | |
| 38 | - JSONObject jsonObject = new JSONObject(); | |
| 39 | - jsonObject.put("title", text); | |
| 40 | - | |
| 41 | - jsonArray.add(jsonObject); | |
| 42 | - }catch (Exception e){ | |
| 43 | - log.error("", e); | |
| 44 | - } | |
| 45 | - } | |
| 46 | - | |
| 47 | - public static AfterwardsLogger start(ScheduleRealInfo sch, String remarks){ | |
| 48 | - AfterwardsLogger fLog = new AfterwardsLogger(); | |
| 49 | - fLog.setSch(sch); | |
| 50 | - fLog.setRemarks(remarks); | |
| 51 | - return fLog; | |
| 52 | - } | |
| 53 | - | |
| 54 | - public void end(){ | |
| 55 | - ScheduleModifyLogger.afterEdit(sch, this.remarks, jsonArray); | |
| 56 | - } | |
| 57 | - | |
| 58 | - public String getRemarks() { | |
| 59 | - return remarks; | |
| 60 | - } | |
| 61 | - | |
| 62 | - public void setRemarks(String remarks) { | |
| 63 | - this.remarks = remarks; | |
| 64 | - } | |
| 65 | - | |
| 66 | - public ScheduleRealInfo getSch() { | |
| 67 | - return sch; | |
| 68 | - } | |
| 69 | - | |
| 70 | - public void setSch(ScheduleRealInfo sch) { | |
| 71 | - this.sch = sch; | |
| 72 | - } | |
| 73 | -} | |
| 1 | +package com.bsth.data.schedule.edit_logs.loggers; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | |
| 6 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 事后历史班次编辑 | |
| 12 | + * Created by panzhao on 2017/5/19. | |
| 13 | + */ | |
| 14 | +public class AfterwardsLogger { | |
| 15 | + | |
| 16 | + static Logger log = LoggerFactory.getLogger(AfterwardsLogger.class); | |
| 17 | + | |
| 18 | + private JSONArray jsonArray = new JSONArray(); | |
| 19 | + private String remarks; | |
| 20 | + private ScheduleRealInfo sch; | |
| 21 | + | |
| 22 | + public void log(String title, Object old, Object now){ | |
| 23 | + try { | |
| 24 | + | |
| 25 | + JSONObject jsonObject = new JSONObject(); | |
| 26 | + jsonObject.put("title", title); | |
| 27 | + jsonObject.put("old", old); | |
| 28 | + jsonObject.put("now", now); | |
| 29 | + | |
| 30 | + jsonArray.add(jsonObject); | |
| 31 | + }catch (Exception e){ | |
| 32 | + log.error("", e); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void log(String text){ | |
| 37 | + try { | |
| 38 | + JSONObject jsonObject = new JSONObject(); | |
| 39 | + jsonObject.put("title", text); | |
| 40 | + | |
| 41 | + jsonArray.add(jsonObject); | |
| 42 | + }catch (Exception e){ | |
| 43 | + log.error("", e); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + public static AfterwardsLogger start(ScheduleRealInfo sch, String remarks){ | |
| 48 | + AfterwardsLogger fLog = new AfterwardsLogger(); | |
| 49 | + fLog.setSch(sch); | |
| 50 | + fLog.setRemarks(remarks); | |
| 51 | + return fLog; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void end(){ | |
| 55 | + ScheduleModifyLogger.afterEdit(sch, this.remarks, jsonArray); | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getRemarks() { | |
| 59 | + return remarks; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setRemarks(String remarks) { | |
| 63 | + this.remarks = remarks; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public ScheduleRealInfo getSch() { | |
| 67 | + return sch; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setSch(ScheduleRealInfo sch) { | |
| 71 | + this.sch = sch; | |
| 72 | + } | |
| 73 | +} | ... | ... |
src/main/java/com/bsth/data/utils/CustomStringUtils.java
| 1 | -package com.bsth.data.utils; | |
| 2 | - | |
| 3 | -import org.apache.commons.lang3.StringUtils; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * Created by panzhao on 2017/7/10. | |
| 7 | - */ | |
| 8 | -public class CustomStringUtils { | |
| 9 | - | |
| 10 | - public static boolean equals(String s1, String s2){ | |
| 11 | - if(s1 == null){ | |
| 12 | - if(StringUtils.isNotEmpty(s2)) | |
| 13 | - return false; | |
| 14 | - else | |
| 15 | - return true; | |
| 16 | - } | |
| 17 | - return s1.equals(s2); | |
| 18 | - } | |
| 19 | -} | |
| 1 | +package com.bsth.data.utils; | |
| 2 | + | |
| 3 | +import org.apache.commons.lang3.StringUtils; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by panzhao on 2017/7/10. | |
| 7 | + */ | |
| 8 | +public class CustomStringUtils { | |
| 9 | + | |
| 10 | + public static boolean equals(String s1, String s2){ | |
| 11 | + if(s1 == null){ | |
| 12 | + if(StringUtils.isNotEmpty(s2)) | |
| 13 | + return false; | |
| 14 | + else | |
| 15 | + return true; | |
| 16 | + } | |
| 17 | + return s1.equals(s2); | |
| 18 | + } | |
| 19 | +} | ... | ... |
src/main/java/com/bsth/entity/directive/D80.java
| 1 | 1 | package com.bsth.entity.directive; |
| 2 | 2 | |
| 3 | -import java.util.Date; | |
| 4 | - | |
| 5 | -import javax.persistence.CascadeType; | |
| 6 | -import javax.persistence.Embeddable; | |
| 7 | -import javax.persistence.Entity; | |
| 8 | -import javax.persistence.FetchType; | |
| 9 | -import javax.persistence.GeneratedValue; | |
| 10 | -import javax.persistence.Id; | |
| 11 | -import javax.persistence.NamedAttributeNode; | |
| 12 | -import javax.persistence.NamedEntityGraph; | |
| 13 | -import javax.persistence.NamedEntityGraphs; | |
| 14 | -import javax.persistence.OneToOne; | |
| 15 | -import javax.persistence.Table; | |
| 16 | -import javax.persistence.Transient; | |
| 17 | - | |
| 18 | 3 | import com.bsth.entity.directive.DC0.DC0Data; |
| 19 | 4 | |
| 5 | +import javax.persistence.*; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 20 | 8 | /** |
| 21 | 9 | * |
| 22 | 10 | * @ClassName: D80 |
| ... | ... | @@ -92,7 +80,7 @@ public class D80 { |
| 92 | 80 | /** |
| 93 | 81 | * 线路编码 |
| 94 | 82 | */ |
| 95 | - private Integer lineId; | |
| 83 | + private String lineId; | |
| 96 | 84 | |
| 97 | 85 | /** |
| 98 | 86 | * 车辆内部编码 |
| ... | ... | @@ -116,13 +104,6 @@ public class D80 { |
| 116 | 104 | this.requestCode = requestCode; |
| 117 | 105 | } |
| 118 | 106 | |
| 119 | - public Integer getLineId() { | |
| 120 | - return lineId; | |
| 121 | - } | |
| 122 | - | |
| 123 | - public void setLineId(Integer lineId) { | |
| 124 | - this.lineId = lineId; | |
| 125 | - } | |
| 126 | 107 | |
| 127 | 108 | public String getNbbm() { |
| 128 | 109 | return nbbm; |
| ... | ... | @@ -131,6 +112,14 @@ public class D80 { |
| 131 | 112 | public void setNbbm(String nbbm) { |
| 132 | 113 | this.nbbm = nbbm; |
| 133 | 114 | } |
| 115 | + | |
| 116 | + public String getLineId() { | |
| 117 | + return lineId; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setLineId(String lineId) { | |
| 121 | + this.lineId = lineId; | |
| 122 | + } | |
| 134 | 123 | } |
| 135 | 124 | |
| 136 | 125 | @Transient | ... | ... |
src/main/java/com/bsth/entity/realcontrol/StationToPark.java
| 1 | -package com.bsth.entity.realcontrol; | |
| 2 | - | |
| 3 | -import javax.persistence.Entity; | |
| 4 | -import javax.persistence.GeneratedValue; | |
| 5 | -import javax.persistence.Id; | |
| 6 | -import javax.persistence.Table; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 站 到 场 | |
| 10 | - * Created by panzhao on 2017/7/10. | |
| 11 | - */ | |
| 12 | -@Entity | |
| 13 | -@Table(name = "bsth_c_station_to_park") | |
| 14 | -public class StationToPark { | |
| 15 | - | |
| 16 | - @Id | |
| 17 | - @GeneratedValue | |
| 18 | - private Integer id; | |
| 19 | - | |
| 20 | - /** 线路编码 */ | |
| 21 | - private String lineCode; | |
| 22 | - | |
| 23 | - /** 站点名称 */ | |
| 24 | - private String stationName; | |
| 25 | - | |
| 26 | - /** 停车场编码 */ | |
| 27 | - private String parkName; | |
| 28 | - | |
| 29 | - /** 站到场时间(分钟) */ | |
| 30 | - private Float time1; | |
| 31 | - | |
| 32 | - /** 站到场公里 */ | |
| 33 | - private Float mileage1; | |
| 34 | - | |
| 35 | - /** 场到站时间(分钟) */ | |
| 36 | - private Float time2; | |
| 37 | - | |
| 38 | - /** 场到站公里 */ | |
| 39 | - private Float mileage2; | |
| 40 | - | |
| 41 | - /** 排序字段 */ | |
| 42 | - private int orderNo; | |
| 43 | - | |
| 44 | - public String getLineCode() { | |
| 45 | - return lineCode; | |
| 46 | - } | |
| 47 | - | |
| 48 | - public void setLineCode(String lineCode) { | |
| 49 | - this.lineCode = lineCode; | |
| 50 | - } | |
| 51 | - | |
| 52 | - public String getStationName() { | |
| 53 | - return stationName; | |
| 54 | - } | |
| 55 | - | |
| 56 | - public void setStationName(String stationName) { | |
| 57 | - this.stationName = stationName; | |
| 58 | - } | |
| 59 | - | |
| 60 | - | |
| 61 | - public Float getTime1() { | |
| 62 | - return time1; | |
| 63 | - } | |
| 64 | - | |
| 65 | - public void setTime1(Float time1) { | |
| 66 | - this.time1 = time1; | |
| 67 | - } | |
| 68 | - | |
| 69 | - public Float getMileage1() { | |
| 70 | - return mileage1; | |
| 71 | - } | |
| 72 | - | |
| 73 | - public void setMileage1(Float mileage1) { | |
| 74 | - this.mileage1 = mileage1; | |
| 75 | - } | |
| 76 | - | |
| 77 | - public Float getTime2() { | |
| 78 | - return time2; | |
| 79 | - } | |
| 80 | - | |
| 81 | - public void setTime2(Float time2) { | |
| 82 | - this.time2 = time2; | |
| 83 | - } | |
| 84 | - | |
| 85 | - public Float getMileage2() { | |
| 86 | - return mileage2; | |
| 87 | - } | |
| 88 | - | |
| 89 | - public void setMileage2(Float mileage2) { | |
| 90 | - this.mileage2 = mileage2; | |
| 91 | - } | |
| 92 | - | |
| 93 | - public Integer getId() { | |
| 94 | - return id; | |
| 95 | - } | |
| 96 | - | |
| 97 | - public void setId(Integer id) { | |
| 98 | - this.id = id; | |
| 99 | - } | |
| 100 | - | |
| 101 | - public int getOrderNo() { | |
| 102 | - return orderNo; | |
| 103 | - } | |
| 104 | - | |
| 105 | - public void setOrderNo(int orderNo) { | |
| 106 | - this.orderNo = orderNo; | |
| 107 | - } | |
| 108 | - | |
| 109 | - public String getParkName() { | |
| 110 | - return parkName; | |
| 111 | - } | |
| 112 | - | |
| 113 | - public void setParkName(String parkName) { | |
| 114 | - this.parkName = parkName; | |
| 115 | - } | |
| 116 | - | |
| 117 | - @Override | |
| 118 | - public int hashCode() { | |
| 119 | - return ("stp_" + this.toString()).hashCode(); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Override | |
| 123 | - public boolean equals(Object obj) { | |
| 124 | - return this.toString().equals(((StationToPark)obj).toString()); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - public String toString() { | |
| 129 | - return this.lineCode + "_" + this.getStationName() + "_" + this.getParkName(); | |
| 130 | - } | |
| 131 | -} | |
| 1 | +package com.bsth.entity.realcontrol; | |
| 2 | + | |
| 3 | +import javax.persistence.Entity; | |
| 4 | +import javax.persistence.GeneratedValue; | |
| 5 | +import javax.persistence.Id; | |
| 6 | +import javax.persistence.Table; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 站 到 场 | |
| 10 | + * Created by panzhao on 2017/7/10. | |
| 11 | + */ | |
| 12 | +@Entity | |
| 13 | +@Table(name = "bsth_c_station_to_park") | |
| 14 | +public class StationToPark { | |
| 15 | + | |
| 16 | + @Id | |
| 17 | + @GeneratedValue | |
| 18 | + private Integer id; | |
| 19 | + | |
| 20 | + /** 线路编码 */ | |
| 21 | + private String lineCode; | |
| 22 | + | |
| 23 | + /** 站点名称 */ | |
| 24 | + private String stationName; | |
| 25 | + | |
| 26 | + /** 停车场编码 */ | |
| 27 | + private String parkName; | |
| 28 | + | |
| 29 | + /** 站到场时间(分钟) */ | |
| 30 | + private Float time1; | |
| 31 | + | |
| 32 | + /** 站到场公里 */ | |
| 33 | + private Float mileage1; | |
| 34 | + | |
| 35 | + /** 场到站时间(分钟) */ | |
| 36 | + private Float time2; | |
| 37 | + | |
| 38 | + /** 场到站公里 */ | |
| 39 | + private Float mileage2; | |
| 40 | + | |
| 41 | + /** 排序字段 */ | |
| 42 | + private int orderNo; | |
| 43 | + | |
| 44 | + public String getLineCode() { | |
| 45 | + return lineCode; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setLineCode(String lineCode) { | |
| 49 | + this.lineCode = lineCode; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getStationName() { | |
| 53 | + return stationName; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setStationName(String stationName) { | |
| 57 | + this.stationName = stationName; | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + public Float getTime1() { | |
| 62 | + return time1; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setTime1(Float time1) { | |
| 66 | + this.time1 = time1; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public Float getMileage1() { | |
| 70 | + return mileage1; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setMileage1(Float mileage1) { | |
| 74 | + this.mileage1 = mileage1; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public Float getTime2() { | |
| 78 | + return time2; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setTime2(Float time2) { | |
| 82 | + this.time2 = time2; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public Float getMileage2() { | |
| 86 | + return mileage2; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setMileage2(Float mileage2) { | |
| 90 | + this.mileage2 = mileage2; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public Integer getId() { | |
| 94 | + return id; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setId(Integer id) { | |
| 98 | + this.id = id; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public int getOrderNo() { | |
| 102 | + return orderNo; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setOrderNo(int orderNo) { | |
| 106 | + this.orderNo = orderNo; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public String getParkName() { | |
| 110 | + return parkName; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setParkName(String parkName) { | |
| 114 | + this.parkName = parkName; | |
| 115 | + } | |
| 116 | + | |
| 117 | + @Override | |
| 118 | + public int hashCode() { | |
| 119 | + return ("stp_" + this.toString()).hashCode(); | |
| 120 | + } | |
| 121 | + | |
| 122 | + @Override | |
| 123 | + public boolean equals(Object obj) { | |
| 124 | + return this.toString().equals(((StationToPark)obj).toString()); | |
| 125 | + } | |
| 126 | + | |
| 127 | + @Override | |
| 128 | + public String toString() { | |
| 129 | + return this.lineCode + "_" + this.getStationName() + "_" + this.getParkName(); | |
| 130 | + } | |
| 131 | +} | ... | ... |
src/main/java/com/bsth/repository/realcontrol/StationToParkRepository.java
| 1 | -package com.bsth.repository.realcontrol; | |
| 2 | - | |
| 3 | -import com.bsth.entity.realcontrol.StationToPark; | |
| 4 | -import com.bsth.repository.BaseRepository; | |
| 5 | -import org.springframework.stereotype.Repository; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * Created by panzhao on 2017/7/10. | |
| 9 | - */ | |
| 10 | -@Repository | |
| 11 | -public interface StationToParkRepository extends BaseRepository<StationToPark, Integer>{ | |
| 12 | -} | |
| 1 | +package com.bsth.repository.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.entity.realcontrol.StationToPark; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by panzhao on 2017/7/10. | |
| 9 | + */ | |
| 10 | +@Repository | |
| 11 | +public interface StationToParkRepository extends BaseRepository<StationToPark, Integer>{ | |
| 12 | +} | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -302,7 +302,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 302 | 302 | |
| 303 | 303 | Map<String, List<D80>> rs = new HashMap<>(); |
| 304 | 304 | for (String code : lineList) |
| 305 | - rs.put(code, pilotReport.unconfirmed80(Integer.parseInt(code))); | |
| 305 | + rs.put(code, pilotReport.unconfirmed80(code)); | |
| 306 | 306 | |
| 307 | 307 | return rs; |
| 308 | 308 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsService.java
| ... | ... | @@ -21,7 +21,7 @@ public interface GpsService { |
| 21 | 21 | |
| 22 | 22 | Map<String,Object> findRoadSpeed(String lineCode); |
| 23 | 23 | |
| 24 | - Map<String,Object> gpsCompletion(long schId); | |
| 24 | + Map<String,Object> gpsCompletion(long schId, int type); | |
| 25 | 25 | |
| 26 | 26 | Map<String,Object> history_v2(String nbbm, long st, long et); |
| 27 | 27 | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -445,7 +445,7 @@ public class GpsServiceImpl implements GpsService { |
| 445 | 445 | * @return |
| 446 | 446 | */ |
| 447 | 447 | @Override |
| 448 | - public Map<String, Object> gpsCompletion(long schId) { | |
| 448 | + public Map<String, Object> gpsCompletion(long schId, int type) { | |
| 449 | 449 | Map<String, Object> rs = new HashMap<>(); |
| 450 | 450 | |
| 451 | 451 | try { |
| ... | ... | @@ -482,9 +482,15 @@ public class GpsServiceImpl implements GpsService { |
| 482 | 482 | long diff = ((sch.getDfsjT() - Long.parseLong(fs.get("ts").toString())) - 1000 * 70); |
| 483 | 483 | |
| 484 | 484 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); |
| 485 | + int serviceState; | |
| 485 | 486 | for (Map<String, Object> map : list) { |
| 486 | 487 | map.put("device_id", deviceId); |
| 487 | 488 | map.put("ts", Long.parseLong(map.get("ts").toString()) + diff); |
| 489 | + if(type==1){ | |
| 490 | + //走补传协议 | |
| 491 | + serviceState = Integer.parseInt(map.get("service_state").toString()); | |
| 492 | + map.put("service_state", serviceState |= 0x00100000); | |
| 493 | + } | |
| 488 | 494 | } |
| 489 | 495 | |
| 490 | 496 | String sqlBefore = "insert into bsth_c_template(", sqlValues = " values("; | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -17,17 +17,24 @@ import java.util.List; |
| 17 | 17 | import java.util.Map; |
| 18 | 18 | import java.util.Set; |
| 19 | 19 | |
| 20 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 20 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 21 | 23 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | 24 | import org.springframework.jdbc.core.RowMapper; |
| 23 | 25 | import org.springframework.stereotype.Service; |
| 24 | 26 | |
| 27 | +import com.alibaba.fastjson.JSONArray; | |
| 28 | +import com.alibaba.fastjson.JSONObject; | |
| 29 | +import com.bsth.data.BasicData; | |
| 30 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 25 | 31 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 26 | 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 27 | 33 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 28 | 34 | import com.bsth.service.BusIntervalService; |
| 29 | 35 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 30 | 36 | import com.bsth.util.ReportUtils; |
| 37 | +import com.google.gson.Gson; | |
| 31 | 38 | |
| 32 | 39 | |
| 33 | 40 | @Service |
| ... | ... | @@ -666,10 +673,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 666 | 673 | if(sfqr == 1){ |
| 667 | 674 | where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; |
| 668 | 675 | } |
| 669 | -// where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 670 | - where += " and bc_type != 'ldks'"; | |
| 676 | + where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 671 | 677 | |
| 672 | - String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type," | |
| 678 | + String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc," | |
| 673 | 679 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" |
| 674 | 680 | + " from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'" |
| 675 | 681 | + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+""; |
| ... | ... | @@ -693,7 +699,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 693 | 699 | schedule.setZdsjActual(rs.getString("zdsj_actual")); |
| 694 | 700 | schedule.setQdzName(rs.getString("qdz_name")); |
| 695 | 701 | schedule.setZdzName(rs.getString("zdz_name")); |
| 696 | - schedule.setBcType(rs.getString("bc_type")); | |
| 697 | 702 | schedule.setXlDir(rs.getString("xl_dir")); |
| 698 | 703 | schedule.setStatus(rs.getInt("status")); |
| 699 | 704 | schedule.setRemarks(rs.getString("remarks")); |
| ... | ... | @@ -827,7 +832,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 827 | 832 | if(model.length() != 0){ |
| 828 | 833 | sql = "select sp.id from " |
| 829 | 834 | + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'" |
| 830 | - + " and tt_info = '" + model + "' and bc_type != 'ldks') sp" | |
| 835 | + + " and tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks') sp" | |
| 831 | 836 | + " left join bsth_c_s_ttinfo_detail tt on sp.tt_info = tt.ttinfo and sp.xl_bm = tt.xl and sp.lp = tt.lp and sp.fcsj = tt.fcsj"; |
| 832 | 837 | |
| 833 | 838 | ttList = jdbcTemplate.query(sql, |
| ... | ... | @@ -910,7 +915,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 910 | 915 | for(String key : keyMap.keySet()){ |
| 911 | 916 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 912 | 917 | Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); |
| 913 | - Map<Long, Map<String, Object>> sortMap1 = new HashMap<Long, Map<String, Object>>(); | |
| 914 | 918 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 915 | 919 | List<Long> keyList = new ArrayList<Long>(); |
| 916 | 920 | List<Long> keyList2 = new ArrayList<Long>(); |
| ... | ... | @@ -942,25 +946,30 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 942 | 946 | for(int i = 1; i < keyList.size(); i++){ |
| 943 | 947 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); |
| 944 | 948 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); |
| 945 | - if(!tsSet.contains(schedule1.getId()) && !schedule1.getBcType().toString().equals("in") && !schedule1.getBcType().toString().equals("out")){ | |
| 946 | - long fcsj1 = schedule1.getFcsjT(); | |
| 947 | - long fcsj2 = schedule2.getFcsjT(); | |
| 948 | - if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){ | |
| 949 | - fcsj2 = schedule1.getZdsjT(); | |
| 950 | - } | |
| 951 | - if(sfqr == 1 && time1 > fcsj1){ | |
| 952 | - jhyysj += fcsj2 - time1; | |
| 953 | - }else if(sfqr == 1 && time2 < fcsj2){ | |
| 954 | - jhyysj += time2 - fcsj1; | |
| 949 | + if(!tsSet.contains(schedule1.getId())){ | |
| 950 | + if(sfqr == 1 && time1 > schedule1.getFcsjT()){ | |
| 951 | + jhyysj += schedule2.getFcsjT() - time1; | |
| 952 | + }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){ | |
| 953 | + jhyysj += time2 - schedule1.getFcsjT(); | |
| 955 | 954 | }else{ |
| 956 | - jhyysj += fcsj2 - fcsj1; | |
| 957 | - } | |
| 958 | - if(jhyysj < 0){ | |
| 959 | - System.out.println(fcsj2 + " - " + fcsj1); | |
| 955 | + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | |
| 960 | 956 | } |
| 961 | - jhyysj1 += fcsj2 - fcsj1; | |
| 957 | + jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT(); | |
| 958 | + } | |
| 959 | + long zdsj2 = schedule2.getZdsjT(); | |
| 960 | + long fcsj2 = schedule2.getFcsjT(); | |
| 961 | + if(fcsj2 > zdsj2) | |
| 962 | + zdsj2 += 1440l; | |
| 963 | + if(sfqr == 1 && time1 > fcsj2){ | |
| 964 | + jhyssj += zdsj2 - time1; | |
| 965 | + }else if(sfqr == 1 && time2 < zdsj2){ | |
| 966 | + jhyssj += time2 - fcsj2; | |
| 967 | + }else{ | |
| 968 | + jhyssj += zdsj2 - fcsj2; | |
| 962 | 969 | } |
| 963 | - if(i == 1 && schedule1.getBcType().toString().equals("normal")){ | |
| 970 | + jhyssj1 += zdsj2 - fcsj2; | |
| 971 | + jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); | |
| 972 | + if(i == 1){ | |
| 964 | 973 | long zdsj1 = schedule1.getZdsjT(); |
| 965 | 974 | long fcsj1 = schedule1.getFcsjT(); |
| 966 | 975 | if(fcsj1 > zdsj1) |
| ... | ... | @@ -975,27 +984,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 975 | 984 | jhyssj1 += zdsj1 - fcsj1; |
| 976 | 985 | jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc(); |
| 977 | 986 | } |
| 978 | - if(schedule2.getBcType().toString().equals("normal")){ | |
| 979 | - long zdsj2 = schedule2.getZdsjT(); | |
| 980 | - long fcsj2 = schedule2.getFcsjT(); | |
| 981 | - if(fcsj2 > zdsj2) | |
| 982 | - zdsj2 += 1440l; | |
| 983 | - if(sfqr == 1 && time1 > fcsj2){ | |
| 984 | - jhyssj += zdsj2 - time1; | |
| 985 | - }else if(sfqr == 1 && time2 < zdsj2){ | |
| 986 | - jhyssj += time2 - fcsj2; | |
| 987 | - }else{ | |
| 988 | - jhyssj += zdsj2 - fcsj2; | |
| 989 | - } | |
| 990 | - jhyssj1 += zdsj2 - fcsj2; | |
| 991 | - jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); | |
| 992 | - } | |
| 993 | 987 | } |
| 994 | 988 | |
| 995 | 989 | for(int i = 0; i < keyList.size(); i++){ |
| 996 | 990 | Map<String, Object> m = new HashMap<String, Object>(); |
| 997 | 991 | ScheduleRealInfo schedule = sortMap.get(keyList.get(i)); |
| 998 | - | |
| 992 | + | |
| 999 | 993 | if(cMap.containsKey(schedule.getId())){ |
| 1000 | 994 | List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); |
| 1001 | 995 | for(ChildTaskPlan childTaskPlan : cTasks){ |
| ... | ... | @@ -1018,7 +1012,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1018 | 1012 | temp.put("fcsj", null); |
| 1019 | 1013 | } |
| 1020 | 1014 | } |
| 1021 | - temp.put("bcType", schedule.getBcType()); | |
| 1022 | 1015 | mapList.add(temp); |
| 1023 | 1016 | } |
| 1024 | 1017 | }else{ |
| ... | ... | @@ -1036,7 +1029,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1036 | 1029 | m.put("zdsj", null); |
| 1037 | 1030 | m.put("fcsj", null); |
| 1038 | 1031 | } |
| 1039 | - m.put("bcType", schedule.getBcType()); | |
| 1040 | 1032 | mapList.add(m); |
| 1041 | 1033 | } |
| 1042 | 1034 | } |
| ... | ... | @@ -1044,7 +1036,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1044 | 1036 | for(Map<String, Object> m : mapList){ |
| 1045 | 1037 | if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){ |
| 1046 | 1038 | keyList2.add(Long.valueOf(m.get("fcsj").toString())); |
| 1047 | - sortMap1.put(Long.valueOf(m.get("fcsj").toString()), m); | |
| 1048 | 1039 | } |
| 1049 | 1040 | } |
| 1050 | 1041 | Collections.sort(keyList2); |
| ... | ... | @@ -1052,31 +1043,36 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1052 | 1043 | for(int i = 1; i < keyList2.size(); i++){ |
| 1053 | 1044 | long fcsj1 = keyList2.get(i - 1); |
| 1054 | 1045 | long fcsj2 = keyList2.get(i); |
| 1055 | - Map<String, Object> m1 = sortMap1.get(fcsj1); | |
| 1056 | - Map<String, Object> m2 = sortMap1.get(fcsj2); | |
| 1057 | - if(m1.get("bcType").toString().equals("in") || m1.get("bcType").toString().equals("out")) | |
| 1058 | - continue; | |
| 1059 | - if(m2.get("bcType").toString().equals("in") || m2.get("bcType").toString().equals("out")){ | |
| 1060 | - fcsj2 = Long.valueOf(m1.get("zdsj").toString()); | |
| 1061 | - } else if(i == keyList.size() - 1){ | |
| 1062 | - fcsj2 = Long.valueOf(m2.get("zdsj").toString()); | |
| 1063 | - } | |
| 1064 | - if(sfqr == 1 && time1 > fcsj1){ | |
| 1065 | - sjyysj += fcsj2 - time1; | |
| 1066 | - }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1067 | - sjyysj += time2 - fcsj1; | |
| 1068 | - }else{ | |
| 1069 | - sjyysj += fcsj2 - fcsj1; | |
| 1046 | + if(fcsj2 - fcsj1 < 90){ | |
| 1047 | + if(sfqr == 1 && time1 > fcsj1){ | |
| 1048 | + sjyysj += fcsj2 - time1; | |
| 1049 | + }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1050 | + sjyysj += time2 - fcsj1; | |
| 1051 | + }else{ | |
| 1052 | + sjyysj += fcsj2 - fcsj1; | |
| 1053 | + } | |
| 1054 | + sjyysj1 += fcsj2 - fcsj1; | |
| 1070 | 1055 | } |
| 1071 | - sjyysj1 += fcsj2 - fcsj1; | |
| 1072 | 1056 | } |
| 1073 | 1057 | |
| 1074 | - for(int i = 0; i < mapList.size(); i++){ | |
| 1075 | - Map<String, Object> m = mapList.get(i); | |
| 1076 | - if(m.get("fcsj") != null && m.get("zdsj") != null && | |
| 1077 | - !m.get("bcType").toString().equals("in") && !m.get("bcType").toString().equals("out")){ | |
| 1078 | - long zdsj = Long.valueOf(m.get("zdsj").toString()); | |
| 1079 | - long fcsj = Long.valueOf(m.get("fcsj").toString()); | |
| 1058 | + for(int i = 1; i < mapList.size(); i++){ | |
| 1059 | + Map<String, Object> m1 = mapList.get(i - 1); | |
| 1060 | + Map<String, Object> m2 = mapList.get(i); | |
| 1061 | +// if(m1.get("fcsj") != null && m2.get("fcsj") != null){ | |
| 1062 | +// long fcsj2 = Long.valueOf(m2.get("fcsj").toString()); | |
| 1063 | +// long fcsj1 = Long.valueOf(m1.get("fcsj").toString()); | |
| 1064 | +// if(sfqr == 1 && time1 > fcsj1){ | |
| 1065 | +// sjyysj += fcsj2 - time1; | |
| 1066 | +// }else if(sfqr == 1 && time2 < fcsj2){ | |
| 1067 | +// sjyysj += time2 - fcsj1; | |
| 1068 | +// }else{ | |
| 1069 | +// sjyysj += fcsj2 - fcsj1; | |
| 1070 | +// } | |
| 1071 | +// sjyysj1 += fcsj2 - fcsj1; | |
| 1072 | +// } | |
| 1073 | + if(m2.get("fcsj") != null && m2.get("zdsj") != null){ | |
| 1074 | + long zdsj = Long.valueOf(m2.get("zdsj").toString()); | |
| 1075 | + long fcsj = Long.valueOf(m2.get("fcsj").toString()); | |
| 1080 | 1076 | if(fcsj > zdsj) |
| 1081 | 1077 | zdsj += 1440l; |
| 1082 | 1078 | if(sfqr == 1 && time1 > fcsj){ |
| ... | ... | @@ -1087,7 +1083,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1087 | 1083 | sjyssj += zdsj - fcsj; |
| 1088 | 1084 | } |
| 1089 | 1085 | sjyssj1 += zdsj - fcsj; |
| 1090 | - sjlc += Double.valueOf(m.get("lc").toString()); | |
| 1086 | + sjlc += Double.valueOf(m2.get("lc").toString()); | |
| 1087 | + } | |
| 1088 | + if(i == 1 && m1.get("fcsj") != null && m1.get("zdsj") != null){ | |
| 1089 | + long zdsj = Long.valueOf(m1.get("zdsj").toString()); | |
| 1090 | + long fcsj = Long.valueOf(m1.get("fcsj").toString()); | |
| 1091 | + if(fcsj > zdsj) | |
| 1092 | + zdsj += 1440l; | |
| 1093 | + if(sfqr == 1 && time1 > fcsj){ | |
| 1094 | + sjyssj += zdsj - time1; | |
| 1095 | + }else if(sfqr == 1 && time2 < zdsj){ | |
| 1096 | + sjyssj += time2 - fcsj; | |
| 1097 | + }else{ | |
| 1098 | + sjyssj += zdsj - fcsj; | |
| 1099 | + } | |
| 1100 | + sjyssj1 += zdsj - fcsj; | |
| 1101 | + sjlc += Double.valueOf(m1.get("lc").toString()); | |
| 1091 | 1102 | } |
| 1092 | 1103 | } |
| 1093 | 1104 | tempMap.put("company", companyName); |
| ... | ... | @@ -1834,7 +1845,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1834 | 1845 | } |
| 1835 | 1846 | try { |
| 1836 | 1847 | |
| 1837 | - String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"' and fcsj_actual is not null"; | |
| 1848 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d')" | |
| 1849 | + + " >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"; | |
| 1838 | 1850 | if(line.length() != 0){ |
| 1839 | 1851 | sql += " and xl_bm = '"+line+"'"; |
| 1840 | 1852 | } |
| ... | ... | @@ -1861,6 +1873,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1861 | 1873 | public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 1862 | 1874 | ScheduleRealInfo schedule = new ScheduleRealInfo(); |
| 1863 | 1875 | schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); |
| 1876 | + schedule.setXlBm(rs.getString("xl_bm")); | |
| 1864 | 1877 | schedule.setXlName(rs.getString("xl_name")); |
| 1865 | 1878 | schedule.setLpName(rs.getString("lp_name")); |
| 1866 | 1879 | schedule.setBcType(rs.getString("bc_type")); |
| ... | ... | @@ -1914,7 +1927,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1914 | 1927 | for(ScheduleRealInfo schedule : list){ |
| 1915 | 1928 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) |
| 1916 | 1929 | continue; |
| 1917 | - String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); | |
| 1930 | + String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); | |
| 1918 | 1931 | if(!keyMap.containsKey(key)) |
| 1919 | 1932 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1920 | 1933 | keyMap.get(key).add(schedule); |
| ... | ... | @@ -1925,8 +1938,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1925 | 1938 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1926 | 1939 | dxtz = 0, lbtz = 0; |
| 1927 | 1940 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 1941 | + boolean flag = false; | |
| 1928 | 1942 | if(schedule.getFcsjActual() != null && schedule.getStatus() != -1){ |
| 1929 | - boolean flag = false; | |
| 1930 | 1943 | sjbc++; |
| 1931 | 1944 | if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){ |
| 1932 | 1945 | flag = true; |
| ... | ... | @@ -1935,17 +1948,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1935 | 1948 | zddf++; |
| 1936 | 1949 | else |
| 1937 | 1950 | sddf++; |
| 1938 | - }else if(!schedule.isOnline()){ | |
| 1939 | - flag = true; | |
| 1940 | - schedule.setRemarks("掉线调整"); | |
| 1941 | - dxtz++; | |
| 1942 | - }else if(schedule.getStatus() == 2){ | |
| 1943 | - flag = true; | |
| 1944 | - lbtz++; | |
| 1945 | 1951 | } |
| 1946 | - if(flag) | |
| 1947 | - tempList.add(schedule); | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + } | |
| 1955 | + if(schedule.getStatus() == -1){ | |
| 1956 | + flag = true; | |
| 1957 | + lbtz++; | |
| 1948 | 1958 | } |
| 1959 | + if(flag) | |
| 1960 | + tempList.add(schedule); | |
| 1949 | 1961 | } |
| 1950 | 1962 | tempMap.put("date", date); |
| 1951 | 1963 | String[] keys = key.split("/"); |
| ... | ... | @@ -1956,22 +1968,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1956 | 1968 | tempMap.put("sddf", sddf); |
| 1957 | 1969 | tempMap.put("zddf", zddf); |
| 1958 | 1970 | tempMap.put("dfhj", sddf + zddf); |
| 1959 | - tempMap.put("dxtz", dxtz); | |
| 1971 | +// tempMap.put("dxtz", dxtz); | |
| 1960 | 1972 | tempMap.put("lbtz", lbtz); |
| 1961 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | |
| 1973 | + tempMap.put("correct", sddf + zddf + lbtz); | |
| 1962 | 1974 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 1963 | - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 1975 | +// tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 1964 | 1976 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 1965 | - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 1966 | - tempMap.put("workList", tempList); | |
| 1977 | +// tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 1978 | +// tempMap.put("workList", tempList); | |
| 1967 | 1979 | |
| 1968 | 1980 | String key0 = keys[0] + "/" + keys[1]; |
| 1969 | - if(!keyMap0.containsKey(key0)) | |
| 1970 | - keyMap0.put(key0, new ArrayList<Map<String, Object>>()); | |
| 1971 | - keyMap0.get(key0).add(tempMap); | |
| 1981 | + /*if(!keyMap0.containsKey(key0)) | |
| 1982 | + keyMap0.put(key0, new ArrayList<Map<String, Object>>());*/ | |
| 1983 | +// keyMap0.get(key0).add(tempMap); | |
| 1984 | + resList.add(tempMap); | |
| 1972 | 1985 | } |
| 1973 | 1986 | |
| 1974 | - for(String key : keyMap0.keySet()){ | |
| 1987 | + /*for(String key : keyMap0.keySet()){ | |
| 1975 | 1988 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1976 | 1989 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1977 | 1990 | dxtz = 0, lbtz = 0; |
| ... | ... | @@ -1979,7 +1992,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1979 | 1992 | sjbc += (int)m.get("sjbc"); |
| 1980 | 1993 | sddf += (int)m.get("sddf"); |
| 1981 | 1994 | zddf += (int)m.get("zddf"); |
| 1982 | - dxtz += (int)m.get("dxtz"); | |
| 1995 | +// dxtz += (int)m.get("dxtz"); | |
| 1983 | 1996 | lbtz += (int)m.get("lbtz"); |
| 1984 | 1997 | } |
| 1985 | 1998 | tempMap.put("date", date); |
| ... | ... | @@ -1991,22 +2004,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1991 | 2004 | tempMap.put("sddf", sddf); |
| 1992 | 2005 | tempMap.put("zddf", zddf); |
| 1993 | 2006 | tempMap.put("dfhj", sddf + zddf); |
| 1994 | - tempMap.put("dxtz", dxtz); | |
| 2007 | +// tempMap.put("dxtz", dxtz); | |
| 1995 | 2008 | tempMap.put("lbtz", lbtz); |
| 1996 | 2009 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 1997 | 2010 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 1998 | 2011 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 1999 | 2012 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2000 | 2013 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); |
| 2001 | - tempMap.put("workList", keyMap0.get(key)); | |
| 2014 | +// tempMap.put("workList", keyMap0.get(key)); | |
| 2002 | 2015 | |
| 2003 | 2016 | String key1 = keys[0]; |
| 2004 | 2017 | if(!keyMap1.containsKey(key1)) |
| 2005 | 2018 | keyMap1.put(key1, new ArrayList<Map<String, Object>>()); |
| 2006 | 2019 | keyMap1.get(key1).add(tempMap); |
| 2007 | - } | |
| 2020 | + }*/ | |
| 2008 | 2021 | |
| 2009 | - for(String key : keyMap1.keySet()){ | |
| 2022 | + /*for(String key : keyMap1.keySet()){ | |
| 2010 | 2023 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2011 | 2024 | int sjbc = 0, sddf = 0, zddf = 0, |
| 2012 | 2025 | dxtz = 0, lbtz = 0, lines = 0; |
| ... | ... | @@ -2014,7 +2027,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2014 | 2027 | sjbc += (int)m.get("sjbc"); |
| 2015 | 2028 | sddf += (int)m.get("sddf"); |
| 2016 | 2029 | zddf += (int)m.get("zddf"); |
| 2017 | - dxtz += (int)m.get("dxtz"); | |
| 2030 | +// dxtz += (int)m.get("dxtz"); | |
| 2018 | 2031 | lbtz += (int)m.get("lbtz"); |
| 2019 | 2032 | lines += (int)m.get("lines"); |
| 2020 | 2033 | } |
| ... | ... | @@ -2025,17 +2038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2025 | 2038 | tempMap.put("sddf", sddf); |
| 2026 | 2039 | tempMap.put("zddf", zddf); |
| 2027 | 2040 | tempMap.put("dfhj", sddf + zddf); |
| 2028 | - tempMap.put("dxtz", dxtz); | |
| 2041 | +// tempMap.put("dxtz", dxtz); | |
| 2029 | 2042 | tempMap.put("lbtz", lbtz); |
| 2030 | 2043 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 2031 | 2044 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2032 | 2045 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 2033 | 2046 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2034 | 2047 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); |
| 2035 | - tempMap.put("workList", keyMap1.get(key)); | |
| 2048 | +// tempMap.put("workList", keyMap1.get(key)); | |
| 2036 | 2049 | |
| 2037 | 2050 | resList.add(tempMap); |
| 2038 | - } | |
| 2051 | + }*/ | |
| 2039 | 2052 | |
| 2040 | 2053 | if(resList.size() != 0){ |
| 2041 | 2054 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| ... | ... | @@ -2045,10 +2058,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2045 | 2058 | sjbc += (int)m.get("sjbc"); |
| 2046 | 2059 | sddf += (int)m.get("sddf"); |
| 2047 | 2060 | zddf += (int)m.get("zddf"); |
| 2048 | - dxtz += (int)m.get("dxtz"); | |
| 2061 | +// dxtz += (int)m.get("dxtz"); | |
| 2049 | 2062 | lbtz += (int)m.get("lbtz"); |
| 2050 | - lines += (int)m.get("lines"); | |
| 2051 | - for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){ | |
| 2063 | +// lines += (int)m.get("lines"); | |
| 2064 | + /*for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){ | |
| 2052 | 2065 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2053 | 2066 | temp.put("date", "合计"); |
| 2054 | 2067 | temp.put("lines", m0.get("lines")); |
| ... | ... | @@ -2056,15 +2069,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2056 | 2069 | temp.put("sddf", m0.get("sddf")); |
| 2057 | 2070 | temp.put("zddf", m0.get("zddf")); |
| 2058 | 2071 | temp.put("dfhj", m0.get("dfhj")); |
| 2059 | - temp.put("dxtz", m0.get("dxtz")); | |
| 2072 | +// temp.put("dxtz", m0.get("dxtz")); | |
| 2060 | 2073 | temp.put("lbtz", m0.get("lbtz")); |
| 2061 | 2074 | temp.put("correct", m0.get("correct")); |
| 2062 | 2075 | temp.put("dfbl", m0.get("dfbl")); |
| 2063 | 2076 | temp.put("dxbl", m0.get("dxbl")); |
| 2064 | 2077 | temp.put("lbbl", m0.get("lbbl")); |
| 2065 | 2078 | temp.put("correctbl", m0.get("correctbl")); |
| 2066 | - ((List<Map<String, Object>>)m0.get("workList")).add(temp); | |
| 2067 | - } | |
| 2079 | +// ((List<Map<String, Object>>)m0.get("workList")).add(temp); | |
| 2080 | + }*/ | |
| 2068 | 2081 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2069 | 2082 | temp.put("date", "合计"); |
| 2070 | 2083 | temp.put("lines", m.get("lines")); |
| ... | ... | @@ -2072,14 +2085,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2072 | 2085 | temp.put("sddf", m.get("sddf")); |
| 2073 | 2086 | temp.put("zddf", m.get("zddf")); |
| 2074 | 2087 | temp.put("dfhj", m.get("dfhj")); |
| 2075 | - temp.put("dxtz", m.get("dxtz")); | |
| 2088 | +// temp.put("dxtz", m.get("dxtz")); | |
| 2076 | 2089 | temp.put("lbtz", m.get("lbtz")); |
| 2077 | 2090 | temp.put("correct", m.get("correct")); |
| 2078 | 2091 | temp.put("dfbl", m.get("dfbl")); |
| 2079 | 2092 | temp.put("dxbl", m.get("dxbl")); |
| 2080 | 2093 | temp.put("lbbl", m.get("lbbl")); |
| 2081 | - temp.put("correctbl", m.get("correctbl")); | |
| 2082 | - ((List<Map<String, Object>>)m.get("workList")).add(temp); | |
| 2094 | +// temp.put("correctbl", m.get("correctbl")); | |
| 2095 | +// ((List<Map<String, Object>>)m.get("workList")).add(temp); | |
| 2083 | 2096 | } |
| 2084 | 2097 | tempMap.put("date", "合计"); |
| 2085 | 2098 | tempMap.put("lines", lines); |
| ... | ... | @@ -2087,16 +2100,99 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2087 | 2100 | tempMap.put("sddf", sddf); |
| 2088 | 2101 | tempMap.put("zddf", zddf); |
| 2089 | 2102 | tempMap.put("dfhj", sddf + zddf); |
| 2090 | - tempMap.put("dxtz", dxtz); | |
| 2103 | +// tempMap.put("dxtz", dxtz); | |
| 2091 | 2104 | tempMap.put("lbtz", lbtz); |
| 2092 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | |
| 2105 | + tempMap.put("correct", sddf + zddf + lbtz); | |
| 2093 | 2106 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2094 | - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | |
| 2107 | + | |
| 2095 | 2108 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2096 | - tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 2109 | +// tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | |
| 2097 | 2110 | resList.add(tempMap); |
| 2098 | 2111 | } |
| 2099 | - | |
| 2112 | + //计算掉线调整 | |
| 2113 | + String sqldot = "select * from " | |
| 2114 | + + "logger_sch_modify where gsbm =? and fgsbm=? and rq BETWEEN ? and ? order by line_code,sch_id"; | |
| 2115 | + | |
| 2116 | + ; | |
| 2117 | + List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, | |
| 2118 | + new BeanPropertyRowMapper(SchEditInfoDto.class),company,subCompany,map.get("startDate").toString(),map.get("endDate").toString()); | |
| 2119 | + int dxtzz=0; | |
| 2120 | + Map<String, Object> mapSchId=new HashMap<String,Object>(); | |
| 2121 | + for (int i = 0; i < resList.size(); i++) { | |
| 2122 | + Map<String, Object> resMap=resList.get(i); | |
| 2123 | + String date_1=resMap.get("date").toString(); | |
| 2124 | + int sjbc=Integer.parseInt(resMap.get("sjbc").toString()); | |
| 2125 | + int correct=Integer.parseInt(resMap.get("correct").toString()); | |
| 2126 | + | |
| 2127 | + if(date_1.equals("合计")){ | |
| 2128 | + resMap.put("dxtz", dxtzz); | |
| 2129 | + resMap.put("correct",correct+dxtzz); | |
| 2130 | + if(sjbc<=0){ | |
| 2131 | + resMap.put("dxbl", "0"); | |
| 2132 | + resMap.put("correctbl", "0"); | |
| 2133 | + }else{ | |
| 2134 | + resMap.put("dxbl", df.format((double)(dxtzz)/sjbc*100) + "%"); | |
| 2135 | + resMap.put("correctbl", df.format((double)(correct+dxtzz)/sjbc*100) + "%"); | |
| 2136 | + } | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + }else{ | |
| 2140 | + String xlbm=resMap.get("line").toString(); | |
| 2141 | + int dxtzf=0; | |
| 2142 | + for (int j = 0; j < listDot.size(); j++) { | |
| 2143 | + SchEditInfoDto seid=listDot.get(j); | |
| 2144 | + if(seid.getLineCode().equals(xlbm)){ | |
| 2145 | + String jstype=seid.getType(); | |
| 2146 | + String json=""; | |
| 2147 | + if(seid.getJsonArray()!=null){ | |
| 2148 | + json =seid.getJsonArray().toString(); | |
| 2149 | + } | |
| 2150 | + if(!json.equals("")){ | |
| 2151 | + if(jstype.equals("FCXXWT")){ | |
| 2152 | + JSONArray jsonArray = JSONArray.parseArray(json); | |
| 2153 | + for (int x = 0; x < jsonArray.size(); x++) { | |
| 2154 | + Map<String, Object> jsonObject=jsonArray.getJSONObject(x); | |
| 2155 | + String title=jsonObject.get("title")==null?"":jsonObject.get("title").toString(); | |
| 2156 | + if(mapSchId.get(String.valueOf(seid.getSchId()))==null){ | |
| 2157 | + if(title.equals("调整实发时间") || title.equals("调整实达时间")){ | |
| 2158 | + if(jsonObject.get("old")==null){ | |
| 2159 | + dxtzf++; | |
| 2160 | + dxtzz++; | |
| 2161 | + mapSchId.put(String.valueOf(seid.getSchId()), seid.getSchId()); | |
| 2162 | + } | |
| 2163 | + } | |
| 2164 | + } | |
| 2165 | + | |
| 2166 | + } | |
| 2167 | + } | |
| 2168 | + if(jstype.equals("SFTZ")){ | |
| 2169 | + Gson gson = new Gson(); | |
| 2170 | + Map<String, Object> map_js = new HashMap<String, Object>(); | |
| 2171 | + map_js = gson.fromJson(json, map.getClass()); | |
| 2172 | + if(mapSchId.get(String.valueOf(seid.getSchId()))==null){ | |
| 2173 | + if(map_js.get("old")==null){ | |
| 2174 | + dxtzf++; | |
| 2175 | + dxtzz++; | |
| 2176 | + mapSchId.put(String.valueOf(seid.getSchId()), seid.getSchId()); | |
| 2177 | + } | |
| 2178 | + } | |
| 2179 | + } | |
| 2180 | + } | |
| 2181 | + } | |
| 2182 | + } | |
| 2183 | + resMap.put("dxtz", dxtzf); | |
| 2184 | + resMap.put("correct",correct+dxtzf); | |
| 2185 | + if(sjbc<=0){ | |
| 2186 | + resMap.put("dxbl", "0"); | |
| 2187 | + resMap.put("correctbl", "0"); | |
| 2188 | + }else{ | |
| 2189 | + resMap.put("dxbl", df.format((double)(dxtzf)/sjbc*100) + "%"); | |
| 2190 | + resMap.put("correctbl", df.format((double)(correct+dxtzf)/sjbc*100) + "%"); | |
| 2191 | + } | |
| 2192 | + resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); | |
| 2193 | + } | |
| 2194 | + } | |
| 2195 | + | |
| 2100 | 2196 | return resList; |
| 2101 | 2197 | } |
| 2102 | 2198 | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -668,25 +668,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 668 | 668 | * @return String |
| 669 | 669 | */ |
| 670 | 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 671 | - | |
| 672 | 671 | // 返回值String |
| 673 | 672 | String stationRStr = ""; |
| 674 | - | |
| 675 | 673 | // windows下的文本文件换行符 |
| 676 | 674 | //String enterStr = "\r\n"; |
| 677 | - | |
| 678 | 675 | // linux/unix下的文本文件换行符 |
| 679 | 676 | String enterStr = "\r"; |
| 680 | - | |
| 677 | + int defaultZdxh = 0; | |
| 681 | 678 | if(objects.size()>0) { |
| 682 | - | |
| 683 | 679 | for(int i = 0; i<objects.size();i++) { |
| 684 | - | |
| 680 | + defaultZdxh ++ ; | |
| 685 | 681 | // 经度 |
| 686 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | |
| 682 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | |
| 687 | 683 | |
| 688 | 684 | // 纬度 |
| 689 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | |
| 685 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | |
| 686 | + | |
| 687 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | |
| 690 | 688 | |
| 691 | 689 | lat = "\t" + lat; |
| 692 | 690 | |
| ... | ... | @@ -696,23 +694,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 696 | 694 | String stationMake = ""; |
| 697 | 695 | |
| 698 | 696 | if(stationMakeStr.equals("E")) { |
| 699 | - | |
| 700 | 697 | stationMake = "\t2"; |
| 701 | - | |
| 702 | 698 | }else { |
| 703 | - | |
| 704 | 699 | stationMake ="\t1"; |
| 705 | - | |
| 706 | 700 | } |
| 707 | 701 | |
| 708 | 702 | // 站点序号 |
| 709 | - String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | |
| 703 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | |
| 704 | + String stationNo = String.valueOf(defaultZdxh); | |
| 710 | 705 | |
| 711 | 706 | stationNo = "\t" + stationNo; |
| 712 | 707 | |
| 713 | 708 | // 站点编码 |
| 714 | 709 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 715 | 710 | |
| 711 | + int len = stationCode.length(); | |
| 712 | + if(len<8) { | |
| 713 | + int dx = 8 - len; | |
| 714 | + String addStr = ""; | |
| 715 | + for(int p =0;p<dx;p++) { | |
| 716 | + addStr = addStr + "0"; | |
| 717 | + } | |
| 718 | + stationCode = addStr + stationCode; | |
| 719 | + }else if(len>8){ | |
| 720 | + stationCode = stationCode.substring(8); | |
| 721 | + } | |
| 722 | + | |
| 716 | 723 | stationCode = "\t" +stationCode; |
| 717 | 724 | |
| 718 | 725 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| ... | ... | @@ -732,41 +739,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 732 | 739 | |
| 733 | 740 | // 限速 |
| 734 | 741 | String sleepStr = ""; |
| 735 | - | |
| 736 | 742 | // 方向 |
| 737 | 743 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); |
| 738 | - | |
| 739 | 744 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 740 | 745 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 741 | - | |
| 742 | 746 | if(sobje.size()==1) { |
| 743 | - | |
| 744 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | |
| 745 | - | |
| 746 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | |
| 747 | - | |
| 747 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | |
| 748 | + sleepStr = "\t" + String.valueOf(dsleepStr); | |
| 748 | 749 | }else if(sobje.size()>1){ |
| 749 | - | |
| 750 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | |
| 751 | 750 | for(int j =0;j<sobje.size();j++) { |
| 752 | - | |
| 753 | - String sectionName = sobje.get(j)[3].toString(); | |
| 754 | - | |
| 755 | - String sectionNameA[] = sectionName.split("至"); | |
| 756 | - | |
| 757 | - if(stationName.equals(sectionNameA[0])){ | |
| 758 | - | |
| 759 | - /*sleepStr = sobje.get(j)[2].toString();*/ | |
| 760 | - | |
| 761 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | |
| 762 | - | |
| 763 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | |
| 764 | - | |
| 751 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | |
| 752 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | |
| 753 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | |
| 754 | + List<Point> ps = new ArrayList<>(); | |
| 755 | + String[] pArray = pointsStr.split(","); | |
| 756 | + for(int a = 0; a <pArray.length; a++) { | |
| 757 | + String[] tmepA = pArray[a].split(" "); | |
| 758 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | |
| 759 | + ps.add(temp); | |
| 760 | + } | |
| 761 | + if(GeoUtils.isInSection(ps, point)) { | |
| 762 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | |
| 763 | + break; | |
| 765 | 764 | } |
| 766 | - | |
| 767 | 765 | } |
| 768 | 766 | } |
| 769 | - | |
| 767 | + if(sleepStr.equals("")) | |
| 768 | + sleepStr = "\t" + "60"; | |
| 770 | 769 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 771 | 770 | } |
| 772 | 771 | |
| ... | ... | @@ -785,9 +784,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 785 | 784 | for(int i = 0; i<objects.size();i++) { |
| 786 | 785 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { |
| 787 | 786 | // 经度 |
| 788 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | |
| 787 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | |
| 788 | + | |
| 789 | 789 | // 纬度 |
| 790 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | |
| 790 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | |
| 791 | + | |
| 792 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | |
| 791 | 793 | lat = "\t" + lat; |
| 792 | 794 | // 站点类型 |
| 793 | 795 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| ... | ... | @@ -802,6 +804,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 802 | 804 | String stationNo = "\t" + xh; |
| 803 | 805 | // 站点编码 |
| 804 | 806 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 807 | + int len = stationCode.length(); | |
| 808 | + if(len<8) { | |
| 809 | + int dx = 8 - len; | |
| 810 | + String addStr = ""; | |
| 811 | + for(int p =0;p<dx;p++) { | |
| 812 | + addStr = addStr + "0"; | |
| 813 | + } | |
| 814 | + stationCode = addStr + stationCode; | |
| 815 | + }else if(len>8){ | |
| 816 | + stationCode = stationCode.substring(8); | |
| 817 | + } | |
| 805 | 818 | stationCode = "\t" +stationCode; |
| 806 | 819 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 807 | 820 | String tempDistc = String.valueOf((int) dis); |
| ... | ... | @@ -817,20 +830,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 817 | 830 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 818 | 831 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 819 | 832 | if(sobje.size()==1) { |
| 820 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | |
| 821 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | |
| 833 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | |
| 834 | + sleepStr = "\t" + String.valueOf(dsleepStr); | |
| 822 | 835 | }else if(sobje.size()>1){ |
| 823 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | |
| 824 | 836 | for(int j =0;j<sobje.size();j++) { |
| 825 | - String sectionName = sobje.get(j)[3].toString(); | |
| 826 | - String sectionNameA[] = sectionName.split("至"); | |
| 827 | - if(stationName.equals(sectionNameA[0])){ | |
| 828 | - /*sleepStr = sobje.get(j)[2].toString();*/ | |
| 829 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | |
| 830 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | |
| 837 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | |
| 838 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | |
| 839 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | |
| 840 | + List<Point> ps = new ArrayList<>(); | |
| 841 | + String[] pArray = pointsStr.split(","); | |
| 842 | + for(int a = 0; a <pArray.length; a++) { | |
| 843 | + String[] tmepA = pArray[a].split(" "); | |
| 844 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | |
| 845 | + ps.add(temp); | |
| 846 | + } | |
| 847 | + if(GeoUtils.isInSection(ps, point)) { | |
| 848 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | |
| 849 | + break; | |
| 831 | 850 | } |
| 832 | 851 | } |
| 833 | 852 | } |
| 853 | + if(sleepStr.equals("")) | |
| 854 | + sleepStr = "\t" + "60"; | |
| 834 | 855 | xh++; |
| 835 | 856 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 836 | 857 | } | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -24,6 +24,7 @@ import com.bsth.webService.trafficManage.geotool.services.Internal; |
| 24 | 24 | import com.bsth.webService.trafficManage.org.tempuri.Results; |
| 25 | 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; |
| 26 | 26 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; |
| 27 | +import org.apache.commons.lang.StringUtils; | |
| 27 | 28 | import org.apache.commons.lang.time.DateUtils; |
| 28 | 29 | import org.slf4j.Logger; |
| 29 | 30 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -1125,11 +1126,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1125 | 1126 | }else{ |
| 1126 | 1127 | flag = 0; |
| 1127 | 1128 | } |
| 1128 | - result += flag; | |
| 1129 | - if(i !=ruleDayArray.length -1){ | |
| 1130 | - result +=","; | |
| 1129 | + if(flag > 0){ | |
| 1130 | + result += flag + ","; | |
| 1131 | 1131 | } |
| 1132 | 1132 | } |
| 1133 | + // 去掉最后一个字符 | |
| 1134 | + if(StringUtils.endsWith(result,",")){ | |
| 1135 | + result = StringUtils.removeEnd(result,","); | |
| 1136 | + } | |
| 1133 | 1137 | return result; |
| 1134 | 1138 | } |
| 1135 | 1139 | /** | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -2577,11 +2577,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2577 | 2577 | if (a == 2) { |
| 2578 | 2578 | x = b + 1; |
| 2579 | 2579 | y = x * 2; |
| 2580 | - ; | |
| 2581 | 2580 | } else if (b == 1) { |
| 2582 | 2581 | x = b + 1; |
| 2583 | 2582 | y = x * 2 - 1; |
| 2584 | - ; | |
| 2585 | 2583 | } else { |
| 2586 | 2584 | x = b; |
| 2587 | 2585 | y = 2 * x; | ... | ... |
src/main/resources/static/pages/forms/statement/correctStatis.html
| ... | ... | @@ -261,13 +261,12 @@ |
| 261 | 261 | // $(".hidden").removeClass("hidden"); |
| 262 | 262 | $get('/busInterval/correctStatis', params, function(result){ |
| 263 | 263 | // 把数据填充到模版中 |
| 264 | -// var tbodyHtml = template('list_company',{list:result, type:1}); | |
| 265 | - var tbodyHtml = ""; | |
| 266 | - if(result.length != 0){ | |
| 264 | + var tbodyHtml = template('list_company',{list:result});; | |
| 265 | + /* if(result.length != 0){ | |
| 267 | 266 | tbodyHtml = template('list_company',{list:result[0].workList[0].workList, type:3}); |
| 268 | 267 | }else{ |
| 269 | 268 | tbodyHtml = template('list_company',{list:result, type:3}); |
| 270 | - } | |
| 269 | + } */ | |
| 271 | 270 | |
| 272 | 271 | // 把渲染好的模版html文本追加到表格中 |
| 273 | 272 | // $('#forms').html(tbodyHtml); |
| ... | ... | @@ -281,7 +280,7 @@ |
| 281 | 280 | }); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $("#forms").on("click","tbody tr",function(){ | |
| 283 | + /* $("#forms").on("click","tbody tr",function(){ | |
| 285 | 284 | if($(this).children().size() < 2){ |
| 286 | 285 | return; |
| 287 | 286 | } |
| ... | ... | @@ -299,9 +298,9 @@ |
| 299 | 298 | subCompany = g.workList; |
| 300 | 299 | } |
| 301 | 300 | }); |
| 302 | - }); | |
| 301 | + }); */ | |
| 303 | 302 | |
| 304 | - $("#subinfo").on("click","tbody tr",function(){ | |
| 303 | + /* $("#subinfo").on("click","tbody tr",function(){ | |
| 305 | 304 | if($(this).children().size() < 2){ |
| 306 | 305 | return; |
| 307 | 306 | } |
| ... | ... | @@ -318,9 +317,9 @@ |
| 318 | 317 | lines = g.workList; |
| 319 | 318 | } |
| 320 | 319 | }); |
| 321 | - }); | |
| 320 | + }); */ | |
| 322 | 321 | |
| 323 | - $("#lineinfo").on("click","tbody tr",function(){ | |
| 322 | + /* $("#lineinfo").on("click","tbody tr",function(){ | |
| 324 | 323 | if($(this).children().size() < 2){ |
| 325 | 324 | return; |
| 326 | 325 | } |
| ... | ... | @@ -328,13 +327,13 @@ |
| 328 | 327 | $(this).children().each(function(index){ |
| 329 | 328 | params[index] = $(this).text(); |
| 330 | 329 | }); |
| 331 | - $.each(lines, function(i, g){ | |
| 330 | + $.each(lines, function(i, g){ | |
| 332 | 331 | if(g.company == params[1] && g.subCompany == params[2] && g.line == params[3]){ |
| 333 | 332 | var tbodyHtml = template('list_workList',{list:g.workList}); |
| 334 | 333 | $("#lines").html(tbodyHtml); |
| 335 | 334 | } |
| 336 | - }); | |
| 337 | - }); | |
| 335 | + }); | |
| 336 | + }); */ | |
| 338 | 337 | |
| 339 | 338 | // $("#export").on("click", function(){ |
| 340 | 339 | // $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ |
| ... | ... | @@ -381,9 +380,8 @@ |
| 381 | 380 | <th class="hidden"></th> |
| 382 | 381 | <th rowspan="2" width="120px">日期</th> |
| 383 | 382 | <th rowspan="2">公司</th> |
| 384 | - {{if type>1}}<th rowspan="2">分公司</th>{{/if}} | |
| 385 | - {{if type<3}}<th rowspan="2">线路条数</th>{{/if}} | |
| 386 | - {{if type==3}}<th rowspan="2">线路</th>{{/if}} | |
| 383 | + <th rowspan="2">分公司</th> | |
| 384 | + <th rowspan="2">线路</th> | |
| 387 | 385 | <th rowspan="2">实际营运班次</th> |
| 388 | 386 | <th colspan="3" align="center">待发调整数</th> |
| 389 | 387 | <th rowspan="2">掉线调整数</th> |
| ... | ... | @@ -405,18 +403,15 @@ |
| 405 | 403 | {{each list as obj i}} |
| 406 | 404 | <tr> |
| 407 | 405 | {{if obj.date=='合计'}} |
| 408 | - {{if type==1}}<td colspan="2">{{obj.date}}</td>{{/if}} | |
| 409 | - {{if type==2}}<td colspan="3">{{obj.date}}</td>{{/if}} | |
| 410 | - {{if type==3}}<td colspan="4">{{obj.date}}</td>{{/if}} | |
| 406 | + | |
| 407 | + <td colspan="4">{{obj.date}}</td> | |
| 411 | 408 | {{/if}} |
| 412 | 409 | {{if obj.date!='合计'}} |
| 413 | 410 | <td>{{obj.date}}</td> |
| 414 | - | |
| 415 | - {{/if}} | |
| 416 | - {{if obj.date!='合计'}}<td>{{obj.company}}</td>{{/if}} | |
| 417 | - {{if type>1 && obj.date!='合计'}}<td>{{obj.subCompany}}</td>{{/if}} | |
| 418 | - {{if type<3}}<td>{{obj.lines}}</td>{{/if}} | |
| 419 | - {{if type==3 && obj.date!='合计'}}<td>{{obj.line}}</td>{{/if}} | |
| 411 | + <td>{{obj.company}}</td> | |
| 412 | + <td>{{obj.subCompany}}</td> | |
| 413 | + <td>{{obj.xlname}}</td> | |
| 414 | + {{/if}} | |
| 420 | 415 | <td>{{obj.sjbc}}</td> |
| 421 | 416 | <td>{{obj.sddf}}</td> |
| 422 | 417 | <td>{{obj.zddf}}</td> |
| ... | ... | @@ -432,7 +427,7 @@ |
| 432 | 427 | {{/each}} |
| 433 | 428 | {{if list.length == 0}} |
| 434 | 429 | <tr> |
| 435 | - <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td> | |
| 430 | + <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td> | |
| 436 | 431 | </tr> |
| 437 | 432 | {{/if}} |
| 438 | 433 | </tbody> | ... | ... |
src/main/resources/static/real_control_v2/css/main.css
| ... | ... | @@ -1572,4 +1572,12 @@ ul.left_tabs_lg li{ |
| 1572 | 1572 | .ct_describe:before{ |
| 1573 | 1573 | content: "\f059"; |
| 1574 | 1574 | margin-right: 3px; |
| 1575 | +} | |
| 1576 | + | |
| 1577 | +#add-sub-task-main-modal abbr{ | |
| 1578 | + display: inline-block; | |
| 1579 | + font-size: 12px; | |
| 1580 | + margin-left: 25px; | |
| 1581 | + vertical-align: bottom; | |
| 1582 | + color: #929292; | |
| 1575 | 1583 | } |
| 1576 | 1584 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_custom.html
| 1 | -<div class="add_custom_wrap"> | |
| 2 | - <div class="forms"></div> | |
| 3 | - <span class="plus_icon_span"> | |
| 4 | - <i class="uk-icon-plus"></i> | |
| 5 | - </span> | |
| 6 | - <form class="uk-form remarks_form"> | |
| 7 | - <div class="uk-grid"> | |
| 8 | - <div class="uk-width-1-1"> | |
| 9 | - <div class="uk-form-row ct-stacked"> | |
| 10 | - <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 11 | - <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 12 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 13 | - </div> | |
| 14 | - </div> | |
| 15 | - </div> | |
| 16 | - </div> | |
| 17 | - </form> | |
| 18 | - <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 19 | - <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 20 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 21 | - </div> | |
| 22 | - | |
| 23 | - <script> | |
| 24 | - (function () { | |
| 25 | - var wrap = '#add-sub-task-main-modal .add_custom_wrap', | |
| 26 | - sch, fs=[]; | |
| 27 | - | |
| 28 | - $(wrap).on('init', function (e, data) { | |
| 29 | - e.stopPropagation(); | |
| 30 | - sch = data.sch; | |
| 31 | - $('.plus_icon_span', wrap).trigger('click'); | |
| 32 | - }); | |
| 33 | - | |
| 34 | - //plsu icon | |
| 35 | - $('.plus_icon_span', wrap).on('click', addTaskForm); | |
| 36 | - | |
| 37 | - var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1}; | |
| 38 | - function addTaskForm() { | |
| 39 | - var htmlStr = template('sub-task-v2-form-temp', {sch: sch}) | |
| 40 | - var f = $(htmlStr); | |
| 41 | - $('.forms', wrap).append(f); | |
| 42 | - //字典转换 | |
| 43 | - dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 44 | - | |
| 45 | - //班次类型切换 | |
| 46 | - if(bcTypeMap[sch.bcType]) | |
| 47 | - $('[name=type2]', f).val(bcTypeMap[sch.bcType]) | |
| 48 | - $('[name=type2]', f).trigger('change'); | |
| 49 | - | |
| 50 | - //滚动条到底 | |
| 51 | - $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 52 | - | |
| 53 | - //起点站trigger change | |
| 54 | - $('[name=startStation]',f).trigger('change'); | |
| 55 | - | |
| 56 | - f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input'); | |
| 57 | - | |
| 58 | - f.formValidation({ | |
| 59 | - framework: 'uikit', | |
| 60 | - locale: 'zh_CN' | |
| 61 | - }).on('add_reason_field', function () { | |
| 62 | - $(this).formValidation('addField', 'reason'); | |
| 63 | - }); | |
| 64 | - } | |
| 65 | - | |
| 66 | - //提交 | |
| 67 | - $('button[type=submit]', wrap).on('click', function () { | |
| 68 | - $(this).addClass('disabled').attr('disabled','disabled'); | |
| 69 | - dataArray = []; | |
| 70 | - $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 71 | - .formValidation('validate'); | |
| 72 | - }); | |
| 73 | - | |
| 74 | - var dataArray = []; | |
| 75 | - $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 76 | - e.preventDefault(); | |
| 77 | - | |
| 78 | - dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 79 | - , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | |
| 80 | - $(this).data('valid', true); | |
| 81 | - | |
| 82 | - if(allValidSuccess()){ | |
| 83 | - var i = 0, rst; | |
| 84 | - (function () { | |
| 85 | - var f = arguments.callee; | |
| 86 | - if(i >= dataArray.length){ | |
| 87 | - //完成后更新前端数据 | |
| 88 | - gb_schedule_table.updateSchedule(rst); | |
| 89 | - UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 90 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 91 | - gb_data_basic.reload_stat_park_data(); | |
| 92 | - return; | |
| 93 | - } | |
| 94 | - var data = dataArray[i]; | |
| 95 | - //里程为0的不保存 | |
| 96 | - if(data.mileage==0){ | |
| 97 | - i++; | |
| 98 | - f(); | |
| 99 | - } | |
| 100 | - else{ | |
| 101 | - //营运子任务不写备注 | |
| 102 | - if(data.mileageType == 'service' && !data.destroy) | |
| 103 | - data.remarks = ''; | |
| 104 | - gb_common.$post('/childTask', data, function (rs) { | |
| 105 | - notify_succ('子任务添加成功'); | |
| 106 | - rst = rs.t; | |
| 107 | - i++; | |
| 108 | - f(); | |
| 109 | - }); | |
| 110 | - } | |
| 111 | - })(); | |
| 112 | - } | |
| 113 | - }); | |
| 114 | - //校验不过 | |
| 115 | - $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 116 | - $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 117 | - }); | |
| 118 | - | |
| 119 | - function allValidSuccess() { | |
| 120 | - var flag = true; | |
| 121 | - $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 122 | - if(!$(f).data('valid')){ | |
| 123 | - flag = false; | |
| 124 | - return false; | |
| 125 | - } | |
| 126 | - }); | |
| 127 | - return flag; | |
| 128 | - } | |
| 129 | - | |
| 130 | - function $f(name, f) { | |
| 131 | - return $('[name=' + name + ']', f); | |
| 132 | - } | |
| 133 | - })(); | |
| 134 | - </script> | |
| 1 | +<div class="add_custom_wrap"> | |
| 2 | + <div class="forms"></div> | |
| 3 | + <span class="plus_icon_span"> | |
| 4 | + <i class="uk-icon-plus"></i> | |
| 5 | + </span> | |
| 6 | + <form class="uk-form remarks_form"> | |
| 7 | + <div class="uk-grid"> | |
| 8 | + <div class="uk-width-1-1"> | |
| 9 | + <div class="uk-form-row ct-stacked"> | |
| 10 | + <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 11 | + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 12 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + </form> | |
| 18 | + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 19 | + <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 20 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 21 | + </div> | |
| 22 | + | |
| 23 | + <script> | |
| 24 | + (function () { | |
| 25 | + var wrap = '#add-sub-task-main-modal .add_custom_wrap', | |
| 26 | + sch, fs=[]; | |
| 27 | + | |
| 28 | + $(wrap).on('init', function (e, data) { | |
| 29 | + e.stopPropagation(); | |
| 30 | + sch = data.sch; | |
| 31 | + $('.plus_icon_span', wrap).trigger('click'); | |
| 32 | + }); | |
| 33 | + | |
| 34 | + //plsu icon | |
| 35 | + $('.plus_icon_span', wrap).on('click', addTaskForm); | |
| 36 | + | |
| 37 | + var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1}; | |
| 38 | + function addTaskForm() { | |
| 39 | + var htmlStr = template('sub-task-v2-form-temp', {sch: sch}) | |
| 40 | + var f = $(htmlStr); | |
| 41 | + $('.forms', wrap).append(f); | |
| 42 | + //字典转换 | |
| 43 | + dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 44 | + | |
| 45 | + //班次类型切换 | |
| 46 | + if(bcTypeMap[sch.bcType]) | |
| 47 | + $('[name=type2]', f).val(bcTypeMap[sch.bcType]) | |
| 48 | + $('[name=type2]', f).trigger('change'); | |
| 49 | + | |
| 50 | + //滚动条到底 | |
| 51 | + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 52 | + | |
| 53 | + //起点站trigger change | |
| 54 | + $('[name=startStation]',f).trigger('change'); | |
| 55 | + | |
| 56 | + f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input'); | |
| 57 | + | |
| 58 | + f.formValidation({ | |
| 59 | + framework: 'uikit', | |
| 60 | + locale: 'zh_CN' | |
| 61 | + }).on('add_reason_field', function () { | |
| 62 | + $(this).formValidation('addField', 'reason'); | |
| 63 | + }); | |
| 64 | + } | |
| 65 | + | |
| 66 | + //提交 | |
| 67 | + $('button[type=submit]', wrap).on('click', function () { | |
| 68 | + $(this).addClass('disabled').attr('disabled','disabled'); | |
| 69 | + dataArray = []; | |
| 70 | + $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 71 | + .formValidation('validate'); | |
| 72 | + }); | |
| 73 | + | |
| 74 | + var dataArray = []; | |
| 75 | + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 76 | + e.preventDefault(); | |
| 77 | + | |
| 78 | + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 79 | + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | |
| 80 | + $(this).data('valid', true); | |
| 81 | + | |
| 82 | + if(allValidSuccess()){ | |
| 83 | + var i = 0, rst; | |
| 84 | + (function () { | |
| 85 | + var f = arguments.callee; | |
| 86 | + if(i >= dataArray.length){ | |
| 87 | + //完成后更新前端数据 | |
| 88 | + gb_schedule_table.updateSchedule(rst); | |
| 89 | + UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 90 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 91 | + gb_data_basic.reload_stat_park_data(); | |
| 92 | + return; | |
| 93 | + } | |
| 94 | + var data = dataArray[i]; | |
| 95 | + //里程为0的不保存 | |
| 96 | + if(data.mileage==0){ | |
| 97 | + i++; | |
| 98 | + f(); | |
| 99 | + } | |
| 100 | + else{ | |
| 101 | + //营运子任务不写备注 | |
| 102 | + if(data.mileageType == 'service' && !data.destroy) | |
| 103 | + data.remarks = ''; | |
| 104 | + gb_common.$post('/childTask', data, function (rs) { | |
| 105 | + notify_succ('子任务添加成功'); | |
| 106 | + rst = rs.t; | |
| 107 | + i++; | |
| 108 | + f(); | |
| 109 | + }); | |
| 110 | + } | |
| 111 | + })(); | |
| 112 | + } | |
| 113 | + }); | |
| 114 | + //校验不过 | |
| 115 | + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 116 | + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 117 | + }); | |
| 118 | + | |
| 119 | + function allValidSuccess() { | |
| 120 | + var flag = true; | |
| 121 | + $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 122 | + if(!$(f).data('valid')){ | |
| 123 | + flag = false; | |
| 124 | + return false; | |
| 125 | + } | |
| 126 | + }); | |
| 127 | + return flag; | |
| 128 | + } | |
| 129 | + | |
| 130 | + function $f(name, f) { | |
| 131 | + return $('[name=' + name + ']', f); | |
| 132 | + } | |
| 133 | + })(); | |
| 134 | + </script> | |
| 135 | 135 | </div> |
| 136 | 136 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_in_out.html
| 1 | -<div class="add_inOut_wrap"> | |
| 2 | - <div class="forms"></div> | |
| 3 | - <form class="uk-form remarks_form"> | |
| 4 | - <div class="uk-grid"> | |
| 5 | - <div class="uk-width-1-1"> | |
| 6 | - <div class="uk-form-row ct-stacked"> | |
| 7 | - <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 8 | - <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 9 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 10 | - </div> | |
| 11 | - </div> | |
| 12 | - </div> | |
| 13 | - </div> | |
| 14 | - </form> | |
| 15 | - <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 16 | - <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 17 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 18 | - </div> | |
| 19 | - | |
| 20 | - <script> | |
| 21 | - (function () { | |
| 22 | - var wrap = '#add-sub-task-main-modal .add_inOut_wrap', | |
| 23 | - sch, sf, inf, outf, destroyf; | |
| 24 | - | |
| 25 | - $(wrap).on('init', function (e, data) { | |
| 26 | - e.stopPropagation(); | |
| 27 | - sch = data.sch; | |
| 28 | - | |
| 29 | - //线路上 | |
| 30 | - sf = addTaskForm(); | |
| 31 | - //进场 | |
| 32 | - inf = addTaskForm(); | |
| 33 | - //出场 | |
| 34 | - outf = addTaskForm(); | |
| 35 | - | |
| 36 | - setTimeout(function () { | |
| 37 | - //复主任务 | |
| 38 | - repeat_main(sf); | |
| 39 | - //进场子任务 | |
| 40 | - repeat_In(inf); | |
| 41 | - //出场子任务 | |
| 42 | - repeat_Out(outf); | |
| 43 | - | |
| 44 | - //进场终点改变事件 | |
| 45 | - $f('endStation', inf).on('change', function () { | |
| 46 | - $f('startStation',outf).val($(this).val()).trigger('change'); | |
| 47 | - }); | |
| 48 | - | |
| 49 | - }, 500); | |
| 50 | - | |
| 51 | - //营运终点改变事件 | |
| 52 | - $f('endStation', sf).on('change', changeServiceEnd); | |
| 53 | - //进场公里改变 | |
| 54 | - $f('mileage',inf).on('input', function () { | |
| 55 | - $f('mileage',outf).val($(this).val()); | |
| 56 | - }); | |
| 57 | - //$f('startStation', inf).on('change', changeServiceEnd); | |
| 58 | - }); | |
| 59 | - | |
| 60 | - function addTaskForm() { | |
| 61 | - var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | |
| 62 | - var f = $(htmlStr); | |
| 63 | - $('.forms', wrap).append(f); | |
| 64 | - //字典转换 | |
| 65 | - dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 66 | - | |
| 67 | - //班次类型切换 | |
| 68 | - $('select[name=type2]', f).trigger('change'); | |
| 69 | - | |
| 70 | - //滚动条到底 | |
| 71 | - $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 72 | - | |
| 73 | - f.formValidation({ | |
| 74 | - framework: 'uikit', | |
| 75 | - locale: 'zh_CN' | |
| 76 | - }).on('add_reason_field', function () { | |
| 77 | - $(this).formValidation('addField', 'reason'); | |
| 78 | - }); | |
| 79 | - return f; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * 复主任务 | |
| 84 | - * @param f | |
| 85 | - */ | |
| 86 | - function repeat_main(f) { | |
| 87 | - f.addClass('repeat_main'); | |
| 88 | - $f('type2', f).html('<option value="1">线路上站点间</option>'); | |
| 89 | - $f('mileage', f).val(sch.jhlc).trigger('input'); | |
| 90 | - $f('mileageType', f).val('service').attr('disabled', 'disabled'); | |
| 91 | - //主任务是烂班 | |
| 92 | - if (sch.status == -1) { | |
| 93 | - $f('destroy', f)[0].checked = true; | |
| 94 | - $f('reason', f).val(sch.adjustExps); | |
| 95 | - $('.destroy_reason_wrap', f).show(); | |
| 96 | - $f('mileage', f).val(sch.jhlcOrig); | |
| 97 | - $('input,select', f).attr('disabled', 'disabled'); | |
| 98 | - f.addClass('destroy_form'); | |
| 99 | - } | |
| 100 | - else if (sch.status == 2) { | |
| 101 | - $f('destroy', f).parents('label').remove(); | |
| 102 | - $f('endDate', f).val(sch.zdsjActual); | |
| 103 | - $('input,select', f).attr('disabled', 'disabled'); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | - function repeat_In(f) { | |
| 108 | - $f('type2', f).html('<option value="2">进场</option>').trigger('change'); | |
| 109 | - if (sch.status != -1) | |
| 110 | - $f('startStation', f).val(sch.zdzCode);//主任务终点进场 | |
| 111 | - | |
| 112 | - //起点改变 | |
| 113 | - $f('startStation', f).on('change', function () { | |
| 114 | - $f('endStation', outf).val($(this).val());//.trigger('change'); | |
| 115 | - }).trigger('change'); | |
| 116 | - | |
| 117 | - //烂班原因 | |
| 118 | - if(sch.status == -1 && | |
| 119 | - gb_common.inOutExps.indexOf(sch.adjustExps)!=-1) | |
| 120 | - $f('inOutReason',inf).val(sch.adjustExps).trigger('change'); | |
| 121 | - } | |
| 122 | - | |
| 123 | - function repeat_Out(f) { | |
| 124 | - $f('type2', f).html('<option value="3">出场</option>').trigger('change'); | |
| 125 | - | |
| 126 | - var code; | |
| 127 | - if (sch.status != -1) | |
| 128 | - code=sch.zdzCode; | |
| 129 | - else | |
| 130 | - code=sch.qdzCode; | |
| 131 | - $f('endStation', f).val(code).trigger('change'); //出场到主任务终点 | |
| 132 | - $f('startDate', f).val($f('endDate', inf).val()).trigger('input');//开始时间 | |
| 133 | - } | |
| 134 | - | |
| 135 | - function $f(name, f) { | |
| 136 | - return $('[name=' + name + ']', f); | |
| 137 | - } | |
| 138 | - | |
| 139 | - /** | |
| 140 | - * 切换营运终点 | |
| 141 | - */ | |
| 142 | - function changeServiceEnd() { | |
| 143 | - var eCode = $(this).val(); | |
| 144 | - if(half_form){ | |
| 145 | - half_form.remove(); | |
| 146 | - changeCarBox.remove(); | |
| 147 | - } | |
| 148 | - if(eCode==sch.qdzCode || eCode==sch.zdzCode){ | |
| 149 | - $f('startStation',inf).val(eCode).trigger('change'); | |
| 150 | - $f('type2',outf).trigger('change'); | |
| 151 | - return; | |
| 152 | - } | |
| 153 | - | |
| 154 | - //进场起点 | |
| 155 | - $f('startStation',inf).val(eCode);//.trigger('change'); | |
| 156 | - //终点trigger change 出发重计算 | |
| 157 | - $f('endStation',inf).trigger('change'); | |
| 158 | - | |
| 159 | - //中途进场 | |
| 160 | - showHalfPanel(eCode); | |
| 161 | - } | |
| 162 | - | |
| 163 | - var half_form, changeCarBox; | |
| 164 | - function showHalfPanel(station) { | |
| 165 | - half_form = $(template('sub-task-v2-form-temp', {sch: sch})); | |
| 166 | - half_form.addClass('repeat_main destroy_form'); | |
| 167 | - //字典转换 | |
| 168 | - dictionaryUtils.transformDom($('.nt-dictionary', half_form)); | |
| 169 | - sf.after(half_form); | |
| 170 | - | |
| 171 | - | |
| 172 | - //班次类型切换 | |
| 173 | - $f('type2', half_form).trigger('change'); | |
| 174 | - //设置起点 | |
| 175 | - $f('startStation',half_form).val(station).trigger('change'); | |
| 176 | - //烂班 | |
| 177 | - $f('destroy',half_form)[0].checked=true; | |
| 178 | - $f('mileageType',half_form).attr('disabled','disabled'); | |
| 179 | - $f('type2',half_form).html('<option value="1">线路上站点间</option>'); | |
| 180 | - $('.destroy_reason_wrap',half_form).show(); | |
| 181 | - half_form.attr('destroy', true); | |
| 182 | - | |
| 183 | - setTimeout(function () { | |
| 184 | - //烂班开始时间 | |
| 185 | - $f('startDate',half_form).val($f('endDate',sf).val()).trigger('input'); | |
| 186 | - }, 300); | |
| 187 | - | |
| 188 | - //换车营运 | |
| 189 | - var se = $f('startStation',half_form)[0], | |
| 190 | - sname = se.options[se.options.selectedIndex].text; | |
| 191 | - changeCarBox = $('<form class="uk-form"><label class="half_change_car_box"><input type="checkbox"> 换车出场至【'+sname+'】继续营运</label></form>'); | |
| 192 | - half_form.after(changeCarBox); | |
| 193 | - | |
| 194 | - //删除 | |
| 195 | - $('.task_form_close_icon', half_form).on('click', function () { | |
| 196 | - changeCarBox.remove(); | |
| 197 | - $f('type2',outf).trigger('change'); | |
| 198 | - }); | |
| 199 | - | |
| 200 | - //校验 | |
| 201 | - half_form.formValidation({ | |
| 202 | - framework: 'uikit', | |
| 203 | - locale: 'zh_CN' | |
| 204 | - }).on('add_reason_field', function () { | |
| 205 | - $(this).formValidation('addField', 'reason'); | |
| 206 | - }); | |
| 207 | - } | |
| 208 | - | |
| 209 | - $(wrap).on('click', '.half_change_car_box>input[type=checkbox]', function () { | |
| 210 | - var box=$(this).parents('.half_change_car_box'); | |
| 211 | - if(this.checked){ | |
| 212 | - box.addClass('active'); | |
| 213 | - enableChangeCar(); | |
| 214 | - } | |
| 215 | - else{ | |
| 216 | - box.removeClass('active'); | |
| 217 | - disabledChangeCar(); | |
| 218 | - } | |
| 219 | - }); | |
| 220 | - | |
| 221 | - /** | |
| 222 | - * 换车出场 | |
| 223 | - */ | |
| 224 | - function enableChangeCar() { | |
| 225 | - var htmlStr = template('st-v2-domains-changecar-form-temp', {inOutExps: gb_common.inOutExps}); | |
| 226 | - $('.domains', half_form).html(htmlStr); | |
| 227 | - $('.domains', outf).html(htmlStr); | |
| 228 | - half_form.css('z-index', 99).formValidation('addField', 'reason').formValidation('addField', 'nbbm'); | |
| 229 | - outf.trigger('add_reason_field'); | |
| 230 | - | |
| 231 | - //车辆 autocomplete | |
| 232 | - var data = gb_data_basic.carsArray(); | |
| 233 | - gb_common.carAutocomplete($('.autocomplete-cars', half_form), data); | |
| 234 | - | |
| 235 | - //同步车辆编码 | |
| 236 | - $f('nbbm', half_form).on('input change', function () { | |
| 237 | - $f('nbbm', outf).val($(this).val()); | |
| 238 | - }); | |
| 239 | - | |
| 240 | - half_form.removeClass('destroy_form'); | |
| 241 | - | |
| 242 | - //出场终点 | |
| 243 | - $f('endStation',outf).val($f('endStation',sf).val()).trigger('change'); | |
| 244 | - //出发合计公里重新计算 | |
| 245 | - $f('mileage', half_form).trigger('input'); | |
| 246 | - } | |
| 247 | - | |
| 248 | - function disabledChangeCar() { | |
| 249 | - $f('type2',outf).trigger('change'); | |
| 250 | - $f('endStation',sf).trigger('change'); | |
| 251 | - } | |
| 252 | - | |
| 253 | - | |
| 254 | - //提交 | |
| 255 | - $('button[type=submit]', wrap).on('click', function () { | |
| 256 | - $(this).addClass('disabled').attr('disabled','disabled'); | |
| 257 | - dataArray = []; | |
| 258 | - $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 259 | - .formValidation('validate'); | |
| 260 | - }); | |
| 261 | - | |
| 262 | - var dataArray = []; | |
| 263 | - $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 264 | - e.preventDefault(); | |
| 265 | - | |
| 266 | - dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 267 | - , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | |
| 268 | - $(this).data('valid', true); | |
| 269 | - | |
| 270 | - if(allValidSuccess()){ | |
| 271 | - var i = 0, rst; | |
| 272 | - (function () { | |
| 273 | - var f = arguments.callee; | |
| 274 | - if(i >= dataArray.length){ | |
| 275 | - //完成后更新前端数据 | |
| 276 | - gb_schedule_table.updateSchedule(rst); | |
| 277 | - UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 278 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 279 | - gb_data_basic.reload_stat_park_data(); | |
| 280 | - return; | |
| 281 | - } | |
| 282 | - var data = dataArray[i]; | |
| 283 | - //里程为0的不保存 | |
| 284 | - if(data.mileage==0){ | |
| 285 | - i++; | |
| 286 | - f(); | |
| 287 | - } | |
| 288 | - else{ | |
| 289 | - //营运子任务不写备注 | |
| 290 | - if(data.mileageType == 'service' && !data.destroy) | |
| 291 | - data.remarks = ''; | |
| 292 | - gb_common.$post('/childTask', data, function (rs) { | |
| 293 | - notify_succ('子任务添加成功'); | |
| 294 | - rst = rs.t; | |
| 295 | - i++; | |
| 296 | - f(); | |
| 297 | - }); | |
| 298 | - } | |
| 299 | - })(); | |
| 300 | - } | |
| 301 | - }); | |
| 302 | - //校验不过 | |
| 303 | - $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 304 | - $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 305 | - }); | |
| 306 | - | |
| 307 | - function allValidSuccess() { | |
| 308 | - var flag = true; | |
| 309 | - $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 310 | - if(!$(f).data('valid')){ | |
| 311 | - flag = false; | |
| 312 | - return false; | |
| 313 | - } | |
| 314 | - }); | |
| 315 | - return flag; | |
| 316 | - } | |
| 317 | - })(); | |
| 318 | - </script> | |
| 1 | +<div class="add_inOut_wrap"> | |
| 2 | + <div class="forms"></div> | |
| 3 | + <form class="uk-form remarks_form"> | |
| 4 | + <div class="uk-grid"> | |
| 5 | + <div class="uk-width-1-1"> | |
| 6 | + <div class="uk-form-row ct-stacked"> | |
| 7 | + <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 8 | + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 9 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 10 | + </div> | |
| 11 | + </div> | |
| 12 | + </div> | |
| 13 | + </div> | |
| 14 | + </form> | |
| 15 | + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 16 | + <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 17 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 18 | + </div> | |
| 19 | + | |
| 20 | + <script> | |
| 21 | + (function () { | |
| 22 | + var wrap = '#add-sub-task-main-modal .add_inOut_wrap', | |
| 23 | + sch, sf, inf, outf, destroyf; | |
| 24 | + | |
| 25 | + $(wrap).on('init', function (e, data) { | |
| 26 | + e.stopPropagation(); | |
| 27 | + sch = data.sch; | |
| 28 | + | |
| 29 | + //线路上 | |
| 30 | + sf = addTaskForm(); | |
| 31 | + //进场 | |
| 32 | + inf = addTaskForm(); | |
| 33 | + //出场 | |
| 34 | + outf = addTaskForm(); | |
| 35 | + | |
| 36 | + setTimeout(function () { | |
| 37 | + //复主任务 | |
| 38 | + repeat_main(sf); | |
| 39 | + //进场子任务 | |
| 40 | + repeat_In(inf); | |
| 41 | + //出场子任务 | |
| 42 | + repeat_Out(outf); | |
| 43 | + | |
| 44 | + //进场终点改变事件 | |
| 45 | + $f('endStation', inf).on('change', function () { | |
| 46 | + $f('startStation',outf).val($(this).val()).trigger('change'); | |
| 47 | + }); | |
| 48 | + | |
| 49 | + }, 500); | |
| 50 | + | |
| 51 | + //营运终点改变事件 | |
| 52 | + $f('endStation', sf).on('change', changeServiceEnd); | |
| 53 | + //进场公里改变 | |
| 54 | + $f('mileage',inf).on('input', function () { | |
| 55 | + $f('mileage',outf).val($(this).val()); | |
| 56 | + }); | |
| 57 | + //$f('startStation', inf).on('change', changeServiceEnd); | |
| 58 | + }); | |
| 59 | + | |
| 60 | + function addTaskForm() { | |
| 61 | + var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | |
| 62 | + var f = $(htmlStr); | |
| 63 | + $('.forms', wrap).append(f); | |
| 64 | + //字典转换 | |
| 65 | + dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 66 | + | |
| 67 | + //班次类型切换 | |
| 68 | + $('select[name=type2]', f).trigger('change'); | |
| 69 | + | |
| 70 | + //滚动条到底 | |
| 71 | + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 72 | + | |
| 73 | + f.formValidation({ | |
| 74 | + framework: 'uikit', | |
| 75 | + locale: 'zh_CN' | |
| 76 | + }).on('add_reason_field', function () { | |
| 77 | + $(this).formValidation('addField', 'reason'); | |
| 78 | + }); | |
| 79 | + return f; | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 复主任务 | |
| 84 | + * @param f | |
| 85 | + */ | |
| 86 | + function repeat_main(f) { | |
| 87 | + f.addClass('repeat_main'); | |
| 88 | + $f('type2', f).html('<option value="1">线路上站点间</option>'); | |
| 89 | + $f('mileage', f).val(sch.jhlc).trigger('input'); | |
| 90 | + $f('mileageType', f).val('service').attr('disabled', 'disabled'); | |
| 91 | + //主任务是烂班 | |
| 92 | + if (sch.status == -1) { | |
| 93 | + $f('destroy', f)[0].checked = true; | |
| 94 | + $f('reason', f).val(sch.adjustExps); | |
| 95 | + $('.destroy_reason_wrap', f).show(); | |
| 96 | + $f('mileage', f).val(sch.jhlcOrig); | |
| 97 | + $('input,select', f).attr('disabled', 'disabled'); | |
| 98 | + f.addClass('destroy_form'); | |
| 99 | + } | |
| 100 | + else if (sch.status == 2) { | |
| 101 | + $f('destroy', f).parents('label').remove(); | |
| 102 | + $f('endDate', f).val(sch.zdsjActual); | |
| 103 | + $('input,select', f).attr('disabled', 'disabled'); | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | + function repeat_In(f) { | |
| 108 | + $f('type2', f).html('<option value="2">进场</option>').trigger('change'); | |
| 109 | + if (sch.status != -1) | |
| 110 | + $f('startStation', f).val(sch.zdzCode);//主任务终点进场 | |
| 111 | + | |
| 112 | + //起点改变 | |
| 113 | + $f('startStation', f).on('change', function () { | |
| 114 | + $f('endStation', outf).val($(this).val());//.trigger('change'); | |
| 115 | + }).trigger('change'); | |
| 116 | + } | |
| 117 | + | |
| 118 | + function repeat_Out(f) { | |
| 119 | + $f('type2', f).html('<option value="3">出场</option>').trigger('change'); | |
| 120 | + | |
| 121 | + var code; | |
| 122 | + if (sch.status != -1) | |
| 123 | + code=sch.zdzCode; | |
| 124 | + else | |
| 125 | + code=sch.qdzCode; | |
| 126 | + $f('endStation', f).val(code).trigger('change'); //出场到主任务终点 | |
| 127 | + $f('startDate', f).val($f('endDate', inf).val()).trigger('input');//开始时间 | |
| 128 | + | |
| 129 | + //烂班原因 | |
| 130 | + if(sch.status == -1 && | |
| 131 | + gb_common.inOutExps.indexOf(sch.adjustExps)!=-1){ | |
| 132 | + $f('reason',inf).val(sch.adjustExps); | |
| 133 | + $f('reason',outf).val(sch.adjustExps).trigger('change'); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + function $f(name, f) { | |
| 138 | + return $('[name=' + name + ']', f); | |
| 139 | + } | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * 切换营运终点 | |
| 143 | + */ | |
| 144 | + function changeServiceEnd() { | |
| 145 | + var eCode = $(this).val(); | |
| 146 | + if(half_form){ | |
| 147 | + half_form.remove(); | |
| 148 | + changeCarBox.remove(); | |
| 149 | + } | |
| 150 | + if(eCode==sch.qdzCode || eCode==sch.zdzCode){ | |
| 151 | + $f('startStation',inf).val(eCode).trigger('change'); | |
| 152 | + $f('type2',outf).trigger('change'); | |
| 153 | + return; | |
| 154 | + } | |
| 155 | + | |
| 156 | + //进场起点 | |
| 157 | + $f('startStation',inf).val(eCode);//.trigger('change'); | |
| 158 | + //终点trigger change 出发重计算 | |
| 159 | + $f('endStation',inf).trigger('change'); | |
| 160 | + | |
| 161 | + //中途进场 | |
| 162 | + showHalfPanel(eCode); | |
| 163 | + } | |
| 164 | + | |
| 165 | + var half_form, changeCarBox; | |
| 166 | + function showHalfPanel(station) { | |
| 167 | + half_form = $(template('sub-task-v2-form-temp', {sch: sch})); | |
| 168 | + half_form.addClass('repeat_main destroy_form'); | |
| 169 | + //字典转换 | |
| 170 | + dictionaryUtils.transformDom($('.nt-dictionary', half_form)); | |
| 171 | + sf.after(half_form); | |
| 172 | + | |
| 173 | + | |
| 174 | + //班次类型切换 | |
| 175 | + $f('type2', half_form).trigger('change'); | |
| 176 | + //设置起点 | |
| 177 | + $f('startStation',half_form).val(station).trigger('change'); | |
| 178 | + //烂班 | |
| 179 | + $f('destroy',half_form)[0].checked=true; | |
| 180 | + $f('mileageType',half_form).attr('disabled','disabled'); | |
| 181 | + $f('type2',half_form).html('<option value="1">线路上站点间</option>'); | |
| 182 | + $('.destroy_reason_wrap',half_form).show(); | |
| 183 | + half_form.attr('destroy', true); | |
| 184 | + | |
| 185 | + setTimeout(function () { | |
| 186 | + //烂班开始时间 | |
| 187 | + $f('startDate',half_form).val($f('endDate',sf).val()).trigger('input'); | |
| 188 | + }, 300); | |
| 189 | + | |
| 190 | + //换车营运 | |
| 191 | + var se = $f('startStation',half_form)[0], | |
| 192 | + sname = se.options[se.options.selectedIndex].text; | |
| 193 | + changeCarBox = $('<form class="uk-form"><label class="half_change_car_box"><input type="checkbox"> 换车出场至【'+sname+'】继续营运</label></form>'); | |
| 194 | + half_form.after(changeCarBox); | |
| 195 | + | |
| 196 | + //删除 | |
| 197 | + $('.task_form_close_icon', half_form).on('click', function () { | |
| 198 | + changeCarBox.remove(); | |
| 199 | + $f('type2',outf).trigger('change'); | |
| 200 | + }); | |
| 201 | + | |
| 202 | + //校验 | |
| 203 | + half_form.formValidation({ | |
| 204 | + framework: 'uikit', | |
| 205 | + locale: 'zh_CN' | |
| 206 | + }).on('add_reason_field', function () { | |
| 207 | + $(this).formValidation('addField', 'reason'); | |
| 208 | + }); | |
| 209 | + } | |
| 210 | + | |
| 211 | + $(wrap).on('click', '.half_change_car_box>input[type=checkbox]', function () { | |
| 212 | + var box=$(this).parents('.half_change_car_box'); | |
| 213 | + if(this.checked){ | |
| 214 | + box.addClass('active'); | |
| 215 | + enableChangeCar(); | |
| 216 | + } | |
| 217 | + else{ | |
| 218 | + box.removeClass('active'); | |
| 219 | + disabledChangeCar(); | |
| 220 | + } | |
| 221 | + }); | |
| 222 | + | |
| 223 | + /** | |
| 224 | + * 换车出场 | |
| 225 | + */ | |
| 226 | + function enableChangeCar() { | |
| 227 | + var htmlStr = template('st-v2-domains-changecar-form-temp', {inOutExps: gb_common.inOutExps}); | |
| 228 | + $('.domains', half_form).html(htmlStr); | |
| 229 | + $('.domains', outf).html(htmlStr); | |
| 230 | + half_form.css('z-index', 99).formValidation('addField', 'reason').formValidation('addField', 'nbbm'); | |
| 231 | + outf.trigger('add_reason_field'); | |
| 232 | + | |
| 233 | + //车辆 autocomplete | |
| 234 | + var data = gb_data_basic.carsArray(); | |
| 235 | + gb_common.carAutocomplete($('.autocomplete-cars', half_form), data); | |
| 236 | + | |
| 237 | + //同步车辆编码 | |
| 238 | + $f('nbbm', half_form).on('input change', function () { | |
| 239 | + $f('nbbm', outf).val($(this).val()); | |
| 240 | + }); | |
| 241 | + | |
| 242 | + half_form.removeClass('destroy_form'); | |
| 243 | + | |
| 244 | + //出场终点 | |
| 245 | + $f('endStation',outf).val($f('endStation',sf).val()).trigger('change'); | |
| 246 | + //出发合计公里重新计算 | |
| 247 | + $f('mileage', half_form).trigger('input'); | |
| 248 | + } | |
| 249 | + | |
| 250 | + function disabledChangeCar() { | |
| 251 | + $f('type2',outf).trigger('change'); | |
| 252 | + $f('endStation',sf).trigger('change'); | |
| 253 | + } | |
| 254 | + | |
| 255 | + | |
| 256 | + //提交 | |
| 257 | + $('button[type=submit]', wrap).on('click', function () { | |
| 258 | + $(this).addClass('disabled').attr('disabled','disabled'); | |
| 259 | + dataArray = []; | |
| 260 | + $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 261 | + .formValidation('validate'); | |
| 262 | + }); | |
| 263 | + | |
| 264 | + var dataArray = []; | |
| 265 | + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 266 | + e.preventDefault(); | |
| 267 | + | |
| 268 | + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 269 | + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | |
| 270 | + $(this).data('valid', true); | |
| 271 | + | |
| 272 | + if(allValidSuccess()){ | |
| 273 | + var i = 0, rst; | |
| 274 | + (function () { | |
| 275 | + var f = arguments.callee; | |
| 276 | + if(i >= dataArray.length){ | |
| 277 | + //完成后更新前端数据 | |
| 278 | + gb_schedule_table.updateSchedule(rst); | |
| 279 | + UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 280 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 281 | + gb_data_basic.reload_stat_park_data(); | |
| 282 | + return; | |
| 283 | + } | |
| 284 | + var data = dataArray[i]; | |
| 285 | + //里程为0的不保存 | |
| 286 | + if(data.mileage==0){ | |
| 287 | + i++; | |
| 288 | + f(); | |
| 289 | + } | |
| 290 | + else{ | |
| 291 | + //营运子任务不写备注 | |
| 292 | + if(data.mileageType == 'service' && !data.destroy) | |
| 293 | + data.remarks = ''; | |
| 294 | + gb_common.$post('/childTask', data, function (rs) { | |
| 295 | + notify_succ('子任务添加成功'); | |
| 296 | + rst = rs.t; | |
| 297 | + i++; | |
| 298 | + f(); | |
| 299 | + }); | |
| 300 | + } | |
| 301 | + })(); | |
| 302 | + } | |
| 303 | + }); | |
| 304 | + //校验不过 | |
| 305 | + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 306 | + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 307 | + }); | |
| 308 | + | |
| 309 | + function allValidSuccess() { | |
| 310 | + var flag = true; | |
| 311 | + $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 312 | + if(!$(f).data('valid')){ | |
| 313 | + flag = false; | |
| 314 | + return false; | |
| 315 | + } | |
| 316 | + }); | |
| 317 | + return flag; | |
| 318 | + } | |
| 319 | + })(); | |
| 320 | + </script> | |
| 319 | 321 | </div> |
| 320 | 322 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_range_turn.html
| 1 | -<div class="add_range_wrap"> | |
| 2 | - <div> | |
| 3 | - <form class="uk-form uk-form-horizontal st_range_top_form"> | |
| 4 | - <div class="uk-grid"> | |
| 5 | - <div class="uk-width-1-3"> | |
| 6 | - <div class="uk-form-row" style="padding-left: 10px;"> | |
| 7 | - <label class="uk-form-label">调头站点</label> | |
| 8 | - <div class="uk-form-controls"> | |
| 9 | - <select id="turnStationSelect"> | |
| 10 | - <option value="">请选择...</option> | |
| 11 | - </select> | |
| 12 | - </div> | |
| 13 | - </div> | |
| 14 | - </div> | |
| 15 | - <div class="uk-width-1-3"> | |
| 16 | - <div class="uk-form-row"> | |
| 17 | - <label class="uk-form-label">调头原因</label> | |
| 18 | - <div class="uk-form-controls"> | |
| 19 | - <select id="turnReason" style="width: calc(100% - 13px);"> | |
| 20 | - <option value="">请选择...</option> | |
| 21 | - </select> | |
| 22 | - </div> | |
| 23 | - </div> | |
| 24 | - </div> | |
| 25 | - <div class="uk-width-1-3" style="padding: 28px 0 0 28px;"> | |
| 26 | - <label id="emptyTurnCbox"></label> | |
| 27 | - </div> | |
| 28 | - </div> | |
| 29 | - </form> | |
| 30 | - </div> | |
| 31 | - | |
| 32 | - <div class="forms"></div> | |
| 33 | - <form class="uk-form remarks_form"> | |
| 34 | - <div class="uk-grid"> | |
| 35 | - <div class="uk-width-1-1"> | |
| 36 | - <div class="uk-form-row ct-stacked"> | |
| 37 | - <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 38 | - <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 39 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 40 | - </div> | |
| 41 | - </div> | |
| 42 | - </div> | |
| 43 | - </div> | |
| 44 | - </form> | |
| 45 | - <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 46 | - <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 47 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 48 | - </div> | |
| 49 | - | |
| 50 | - <script> | |
| 51 | - (function () { | |
| 52 | - var wrap = '#add-sub-task-main-modal .add_range_wrap', | |
| 53 | - sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap); | |
| 54 | - | |
| 55 | - $(wrap).on('init', function (e, data) { | |
| 56 | - e.stopPropagation(); | |
| 57 | - sch = data.sch; | |
| 58 | - nextSch = gb_schedule_table.getNextNormalSch(sch); | |
| 59 | - if(!nextSch || nextSch.bcType!='normal'){ | |
| 60 | - $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>'); | |
| 61 | - return; | |
| 62 | - } | |
| 63 | - | |
| 64 | - //站点路由 | |
| 65 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | |
| 66 | - return a.stationRouteCode - b.stationRouteCode; | |
| 67 | - }), 'directions'); | |
| 68 | - //第一段营运 | |
| 69 | - f1 = addTaskForm(); | |
| 70 | - $f('startStation', f1).trigger('change'); | |
| 71 | - | |
| 72 | - disabled_form(f1); | |
| 73 | - $('.domains', f1).empty(); | |
| 74 | - //top form 站点select | |
| 75 | - $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation); | |
| 76 | - //top form 原因select | |
| 77 | - var opts = ''; | |
| 78 | - $.each(gb_common.adjustExps, function () { | |
| 79 | - opts += '<option value="' + this + '">' + this + '</option>'; | |
| 80 | - }); | |
| 81 | - $('#turnReason', topf).append(opts).on('change', changeTurnReason); | |
| 82 | - //调头空驶 | |
| 83 | - $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName); | |
| 84 | - $('#emptyTurnCbox input',topf).on('click', emptyTurn); | |
| 85 | - }); | |
| 86 | - | |
| 87 | - | |
| 88 | - function addTaskForm() { | |
| 89 | - var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | |
| 90 | - var f = $(htmlStr); | |
| 91 | - $('.forms', wrap).append(f); | |
| 92 | - //字典转换 | |
| 93 | - dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 94 | - | |
| 95 | - //班次类型切换 | |
| 96 | - $('select[name=type2]', f).trigger('change'); | |
| 97 | - | |
| 98 | - //滚动条到底 | |
| 99 | - //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 100 | - | |
| 101 | - f.formValidation({ | |
| 102 | - framework: 'uikit', | |
| 103 | - locale: 'zh_CN' | |
| 104 | - }).on('add_reason_field', function () { | |
| 105 | - $(this).formValidation('addField', 'reason'); | |
| 106 | - }); | |
| 107 | - return f; | |
| 108 | - } | |
| 109 | - | |
| 110 | - function disabled_form(f) { | |
| 111 | - //$('input,select',f).attr('disabled', 'disabled'); | |
| 112 | - $f('type2', f).attr('disabled', 'disabled'); | |
| 113 | - $f('startStation', f).attr('disabled', 'disabled'); | |
| 114 | - $f('endStation', f).attr('disabled', 'disabled'); | |
| 115 | - $f('mileageType', f).attr('disabled', 'disabled'); | |
| 116 | - $f('destroy', f).attr('disabled', 'disabled'); | |
| 117 | - return f; | |
| 118 | - } | |
| 119 | - | |
| 120 | - function $f(name, f) { | |
| 121 | - return $('[name=' + name + ']', f); | |
| 122 | - } | |
| 123 | - | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * 切换调头站点 | |
| 127 | - */ | |
| 128 | - function changeTurnStation() { | |
| 129 | - f1.nextAll('.sub_task_form_v2').remove(); | |
| 130 | - //掉头站点编码 | |
| 131 | - var eCode = $('#turnStationSelect', topf).val(); | |
| 132 | - if(!eCode){ | |
| 133 | - //$('.footer_mileage_count', '#add-sub-task-main-modal').trigger('refresh'); | |
| 134 | - $f('endStation', f1).val(sch.zdzCode).trigger('change'); | |
| 135 | - $('#emptyTurnCbox input')[0].checked=false; | |
| 136 | - return; | |
| 137 | - } | |
| 138 | - | |
| 139 | - //烂班1 | |
| 140 | - df1 = destroyForm(disabled_form(addTaskForm())); | |
| 141 | - //烂班2 | |
| 142 | - df2 = destroyForm(disabled_form(addTaskForm())); | |
| 143 | - //营运2 | |
| 144 | - f2 = disabled_form(addTaskForm()); | |
| 145 | - $('.domains', f2).empty(); | |
| 146 | - | |
| 147 | - | |
| 148 | - //营运1终点 | |
| 149 | - $f('endStation', f1).val(eCode).trigger('change'); | |
| 150 | - //烂班1起点 | |
| 151 | - $f('startStation', df1).val(eCode).trigger('change'); | |
| 152 | - //烂班2 | |
| 153 | - $f('startStation', df2).val(sch.zdzCode); | |
| 154 | - $f('endStation', df2).val(eCode); | |
| 155 | - $f('mileage', df2).val($f('mileage', df1).val()).trigger('input'); | |
| 156 | - $('[sch_id_inp]', df2).val(nextSch.id); | |
| 157 | - //营运2 | |
| 158 | - $f('startStation', f2).val(eCode); | |
| 159 | - $f('endStation', f2).val(sch.qdzCode); | |
| 160 | - $f('startDate',f2).val($f('endDate',f1).val()); | |
| 161 | - $f('mileage', f2).val($f('mileage', f1).val()).trigger('input'); | |
| 162 | - $('[sch_id_inp]', f2).val(nextSch.id); | |
| 163 | - | |
| 164 | - //set css | |
| 165 | - //setCss(); | |
| 166 | - //reason | |
| 167 | - changeTurnReason(); | |
| 168 | - } | |
| 169 | - | |
| 170 | - /** | |
| 171 | - * 切换调头原因 | |
| 172 | - */ | |
| 173 | - function changeTurnReason() { | |
| 174 | - var reason = $('#turnReason',topf).val(); | |
| 175 | - if(reason){ | |
| 176 | - $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change'); | |
| 177 | - //var reInput=$('.remarks_form [name=remarks]', wrap); | |
| 178 | - //reInput.val(reInput.val() + reason + ','); | |
| 179 | - } | |
| 180 | - } | |
| 181 | - | |
| 182 | - function destroyForm(f) { | |
| 183 | - $f('destroy', f)[0].checked = true; | |
| 184 | - $('.destroy_reason_wrap', f).show(); | |
| 185 | - f.addClass('destroy_form'); | |
| 186 | - f.attr('destroy', true); | |
| 187 | - return f; | |
| 188 | - } | |
| 189 | - | |
| 190 | - /*function setCss() { | |
| 191 | - $('.sub_task_form_v2', wrap).each(function () { | |
| 192 | - if($(this).hasClass('destroy_form')) | |
| 193 | - return true; | |
| 194 | - | |
| 195 | - if($f('mileageType', this).val()=='service') | |
| 196 | - $(this).addClass('service_st_form'); | |
| 197 | - else | |
| 198 | - $(this).removeClass('service_st_form'); | |
| 199 | - }); | |
| 200 | - }*/ | |
| 201 | - | |
| 202 | - /** | |
| 203 | - * 空驶调头 | |
| 204 | - */ | |
| 205 | - function emptyTurn() { | |
| 206 | - if($('#turnStationSelect', topf).val()==''){ | |
| 207 | - notify_err('你必须先选择调头站点!'); | |
| 208 | - this.checked=false; | |
| 209 | - return; | |
| 210 | - } | |
| 211 | - if(this.checked){ | |
| 212 | - //烂班2 烂全程 | |
| 213 | - $f('startStation', df2).val(sch.zdzCode); | |
| 214 | - $f('endStation', df2).val(sch.qdzCode); | |
| 215 | - $f('mileage', df2).val(nextSch.jhlcOrig); | |
| 216 | - $f('startDate', df2).val(nextSch.dfsj); | |
| 217 | - $f('endDate', df2).val(nextSch.zdsj); | |
| 218 | - //营运2 变空驶 | |
| 219 | - //f2.removeClass('service_st_form'); | |
| 220 | - $f('mileageType',f2).val('empty').trigger('change'); | |
| 221 | - } | |
| 222 | - else{ | |
| 223 | - changeTurnStation(); | |
| 224 | - } | |
| 225 | - | |
| 226 | - //$f('mileage', df2).trigger('input'); | |
| 227 | - } | |
| 228 | - | |
| 229 | - //提交 | |
| 230 | - $('button[type=submit]', wrap).on('click', function () { | |
| 231 | - $(this).addClass('disabled').attr('disabled','disabled'); | |
| 232 | - dataArray = []; | |
| 233 | - $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 234 | - .formValidation('validate'); | |
| 235 | - }); | |
| 236 | - | |
| 237 | - var dataArray = []; | |
| 238 | - $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 239 | - e.preventDefault(); | |
| 240 | - | |
| 241 | - dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 242 | - , {remarks: $('#form-s-t',wrap).val()})); | |
| 243 | - $(this).data('valid', true); | |
| 244 | - | |
| 245 | - if (allValidSuccess()) { | |
| 246 | - var i = 0; | |
| 247 | - (function () { | |
| 248 | - var f = arguments.callee; | |
| 249 | - if (i >= dataArray.length) { | |
| 250 | - /** | |
| 251 | - * 为班次添加备注 | |
| 252 | - */ | |
| 253 | - //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | |
| 254 | - //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | |
| 255 | - UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 256 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 257 | - gb_data_basic.reload_stat_park_data(); | |
| 258 | - return; | |
| 259 | - } | |
| 260 | - var data = dataArray[i]; | |
| 261 | - //营运子任务不写备注 | |
| 262 | - if(data.mileageType == 'service' && !data.destroy) | |
| 263 | - data.remarks = ''; | |
| 264 | - gb_common.$post('/childTask', data, function (rs) { | |
| 265 | - notify_succ('子任务添加成功'); | |
| 266 | - gb_schedule_table.updateSchedule(rs.t); | |
| 267 | - i++; | |
| 268 | - f(); | |
| 269 | - }); | |
| 270 | - })(); | |
| 271 | - } | |
| 272 | - }); | |
| 273 | - //校验不过 | |
| 274 | - $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 275 | - $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 276 | - }); | |
| 277 | - | |
| 278 | - function allValidSuccess() { | |
| 279 | - var flag = true; | |
| 280 | - $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 281 | - if(!$(f).data('valid')){ | |
| 282 | - flag = false; | |
| 283 | - return false; | |
| 284 | - } | |
| 285 | - }); | |
| 286 | - return flag; | |
| 287 | - } | |
| 288 | - })(); | |
| 289 | - </script> | |
| 1 | +<div class="add_range_wrap"> | |
| 2 | + <div> | |
| 3 | + <form class="uk-form uk-form-horizontal st_range_top_form"> | |
| 4 | + <div class="uk-grid"> | |
| 5 | + <div class="uk-width-1-3"> | |
| 6 | + <div class="uk-form-row" style="padding-left: 10px;"> | |
| 7 | + <label class="uk-form-label">调头站点</label> | |
| 8 | + <div class="uk-form-controls"> | |
| 9 | + <select id="turnStationSelect"> | |
| 10 | + <option value="">请选择...</option> | |
| 11 | + </select> | |
| 12 | + </div> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + <div class="uk-width-1-3"> | |
| 16 | + <div class="uk-form-row"> | |
| 17 | + <label class="uk-form-label">调头原因</label> | |
| 18 | + <div class="uk-form-controls"> | |
| 19 | + <select id="turnReason" style="width: calc(100% - 13px);"> | |
| 20 | + <option value="">请选择...</option> | |
| 21 | + </select> | |
| 22 | + </div> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + <div class="uk-width-1-3" style="padding: 28px 0 0 28px;"> | |
| 26 | + <label id="emptyTurnCbox"></label> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 29 | + </form> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + <div class="forms"></div> | |
| 33 | + <form class="uk-form remarks_form"> | |
| 34 | + <div class="uk-grid"> | |
| 35 | + <div class="uk-width-1-1"> | |
| 36 | + <div class="uk-form-row ct-stacked"> | |
| 37 | + <div class="uk-form-controls" style="margin-top: 5px;"> | |
| 38 | + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | |
| 39 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | |
| 40 | + </div> | |
| 41 | + </div> | |
| 42 | + </div> | |
| 43 | + </div> | |
| 44 | + </form> | |
| 45 | + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | |
| 46 | + <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 47 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 48 | + </div> | |
| 49 | + | |
| 50 | + <script> | |
| 51 | + (function () { | |
| 52 | + var wrap = '#add-sub-task-main-modal .add_range_wrap', | |
| 53 | + sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap); | |
| 54 | + | |
| 55 | + $(wrap).on('init', function (e, data) { | |
| 56 | + e.stopPropagation(); | |
| 57 | + sch = data.sch; | |
| 58 | + nextSch = gb_schedule_table.getNextNormalSch(sch); | |
| 59 | + if(!nextSch || nextSch.bcType!='normal'){ | |
| 60 | + $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>'); | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + | |
| 64 | + //站点路由 | |
| 65 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | |
| 66 | + return a.stationRouteCode - b.stationRouteCode; | |
| 67 | + }), 'directions'); | |
| 68 | + //第一段营运 | |
| 69 | + f1 = addTaskForm(); | |
| 70 | + $f('startStation', f1).trigger('change'); | |
| 71 | + | |
| 72 | + disabled_form(f1); | |
| 73 | + $('.domains', f1).empty(); | |
| 74 | + //top form 站点select | |
| 75 | + $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation); | |
| 76 | + //top form 原因select | |
| 77 | + var opts = ''; | |
| 78 | + $.each(gb_common.adjustExps, function () { | |
| 79 | + opts += '<option value="' + this + '">' + this + '</option>'; | |
| 80 | + }); | |
| 81 | + $('#turnReason', topf).append(opts).on('change', changeTurnReason); | |
| 82 | + //调头空驶 | |
| 83 | + $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName); | |
| 84 | + $('#emptyTurnCbox input',topf).on('click', emptyTurn); | |
| 85 | + }); | |
| 86 | + | |
| 87 | + | |
| 88 | + function addTaskForm() { | |
| 89 | + var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | |
| 90 | + var f = $(htmlStr); | |
| 91 | + $('.forms', wrap).append(f); | |
| 92 | + //字典转换 | |
| 93 | + dictionaryUtils.transformDom($('.nt-dictionary', f)); | |
| 94 | + | |
| 95 | + //班次类型切换 | |
| 96 | + $('select[name=type2]', f).trigger('change'); | |
| 97 | + | |
| 98 | + //滚动条到底 | |
| 99 | + //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | |
| 100 | + | |
| 101 | + f.formValidation({ | |
| 102 | + framework: 'uikit', | |
| 103 | + locale: 'zh_CN' | |
| 104 | + }).on('add_reason_field', function () { | |
| 105 | + $(this).formValidation('addField', 'reason'); | |
| 106 | + }); | |
| 107 | + return f; | |
| 108 | + } | |
| 109 | + | |
| 110 | + function disabled_form(f) { | |
| 111 | + //$('input,select',f).attr('disabled', 'disabled'); | |
| 112 | + $f('type2', f).attr('disabled', 'disabled'); | |
| 113 | + $f('startStation', f).attr('disabled', 'disabled'); | |
| 114 | + $f('endStation', f).attr('disabled', 'disabled'); | |
| 115 | + $f('mileageType', f).attr('disabled', 'disabled'); | |
| 116 | + $f('destroy', f).attr('disabled', 'disabled'); | |
| 117 | + return f; | |
| 118 | + } | |
| 119 | + | |
| 120 | + function $f(name, f) { | |
| 121 | + return $('[name=' + name + ']', f); | |
| 122 | + } | |
| 123 | + | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 切换调头站点 | |
| 127 | + */ | |
| 128 | + function changeTurnStation() { | |
| 129 | + f1.nextAll('.sub_task_form_v2').remove(); | |
| 130 | + //掉头站点编码 | |
| 131 | + var eCode = $('#turnStationSelect', topf).val(); | |
| 132 | + if(!eCode){ | |
| 133 | + //$('.footer_mileage_count', '#add-sub-task-main-modal').trigger('refresh'); | |
| 134 | + $f('endStation', f1).val(sch.zdzCode).trigger('change'); | |
| 135 | + $('#emptyTurnCbox input')[0].checked=false; | |
| 136 | + return; | |
| 137 | + } | |
| 138 | + | |
| 139 | + //烂班1 | |
| 140 | + df1 = destroyForm(disabled_form(addTaskForm())); | |
| 141 | + //烂班2 | |
| 142 | + df2 = destroyForm(disabled_form(addTaskForm())); | |
| 143 | + //营运2 | |
| 144 | + f2 = disabled_form(addTaskForm()); | |
| 145 | + $('.domains', f2).empty(); | |
| 146 | + | |
| 147 | + | |
| 148 | + //营运1终点 | |
| 149 | + $f('endStation', f1).val(eCode).trigger('change'); | |
| 150 | + //烂班1起点 | |
| 151 | + $f('startStation', df1).val(eCode).trigger('change'); | |
| 152 | + //烂班2 | |
| 153 | + $f('startStation', df2).val(sch.zdzCode); | |
| 154 | + $f('endStation', df2).val(eCode); | |
| 155 | + $f('mileage', df2).val($f('mileage', df1).val()).trigger('input'); | |
| 156 | + $('[sch_id_inp]', df2).val(nextSch.id); | |
| 157 | + //营运2 | |
| 158 | + $f('startStation', f2).val(eCode); | |
| 159 | + $f('endStation', f2).val(sch.qdzCode); | |
| 160 | + $f('startDate',f2).val($f('endDate',f1).val()); | |
| 161 | + $f('mileage', f2).val($f('mileage', f1).val()).trigger('input'); | |
| 162 | + $('[sch_id_inp]', f2).val(nextSch.id); | |
| 163 | + | |
| 164 | + //set css | |
| 165 | + //setCss(); | |
| 166 | + //reason | |
| 167 | + changeTurnReason(); | |
| 168 | + } | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 切换调头原因 | |
| 172 | + */ | |
| 173 | + function changeTurnReason() { | |
| 174 | + var reason = $('#turnReason',topf).val(); | |
| 175 | + if(reason){ | |
| 176 | + $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change'); | |
| 177 | + //var reInput=$('.remarks_form [name=remarks]', wrap); | |
| 178 | + //reInput.val(reInput.val() + reason + ','); | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + function destroyForm(f) { | |
| 183 | + $f('destroy', f)[0].checked = true; | |
| 184 | + $('.destroy_reason_wrap', f).show(); | |
| 185 | + f.addClass('destroy_form'); | |
| 186 | + f.attr('destroy', true); | |
| 187 | + return f; | |
| 188 | + } | |
| 189 | + | |
| 190 | + /*function setCss() { | |
| 191 | + $('.sub_task_form_v2', wrap).each(function () { | |
| 192 | + if($(this).hasClass('destroy_form')) | |
| 193 | + return true; | |
| 194 | + | |
| 195 | + if($f('mileageType', this).val()=='service') | |
| 196 | + $(this).addClass('service_st_form'); | |
| 197 | + else | |
| 198 | + $(this).removeClass('service_st_form'); | |
| 199 | + }); | |
| 200 | + }*/ | |
| 201 | + | |
| 202 | + /** | |
| 203 | + * 空驶调头 | |
| 204 | + */ | |
| 205 | + function emptyTurn() { | |
| 206 | + if($('#turnStationSelect', topf).val()==''){ | |
| 207 | + notify_err('你必须先选择调头站点!'); | |
| 208 | + this.checked=false; | |
| 209 | + return; | |
| 210 | + } | |
| 211 | + if(this.checked){ | |
| 212 | + //烂班2 烂全程 | |
| 213 | + $f('startStation', df2).val(sch.zdzCode); | |
| 214 | + $f('endStation', df2).val(sch.qdzCode); | |
| 215 | + $f('mileage', df2).val(nextSch.jhlcOrig); | |
| 216 | + $f('startDate', df2).val(nextSch.dfsj); | |
| 217 | + $f('endDate', df2).val(nextSch.zdsj); | |
| 218 | + //营运2 变空驶 | |
| 219 | + //f2.removeClass('service_st_form'); | |
| 220 | + $f('mileageType',f2).val('empty').trigger('change'); | |
| 221 | + } | |
| 222 | + else{ | |
| 223 | + changeTurnStation(); | |
| 224 | + } | |
| 225 | + | |
| 226 | + //$f('mileage', df2).trigger('input'); | |
| 227 | + } | |
| 228 | + | |
| 229 | + //提交 | |
| 230 | + $('button[type=submit]', wrap).on('click', function () { | |
| 231 | + $(this).addClass('disabled').attr('disabled','disabled'); | |
| 232 | + dataArray = []; | |
| 233 | + $('form.sub_task_form_v2', wrap).data('valid', false) | |
| 234 | + .formValidation('validate'); | |
| 235 | + }); | |
| 236 | + | |
| 237 | + var dataArray = []; | |
| 238 | + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | |
| 239 | + e.preventDefault(); | |
| 240 | + | |
| 241 | + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | |
| 242 | + , {remarks: $('#form-s-t',wrap).val()})); | |
| 243 | + $(this).data('valid', true); | |
| 244 | + | |
| 245 | + if (allValidSuccess()) { | |
| 246 | + var i = 0; | |
| 247 | + (function () { | |
| 248 | + var f = arguments.callee; | |
| 249 | + if (i >= dataArray.length) { | |
| 250 | + /** | |
| 251 | + * 为班次添加备注 | |
| 252 | + */ | |
| 253 | + //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | |
| 254 | + //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | |
| 255 | + UIkit.modal('#add-sub-task-main-modal').hide(); | |
| 256 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | |
| 257 | + gb_data_basic.reload_stat_park_data(); | |
| 258 | + return; | |
| 259 | + } | |
| 260 | + var data = dataArray[i]; | |
| 261 | + //营运子任务不写备注 | |
| 262 | + if(data.mileageType == 'service' && !data.destroy) | |
| 263 | + data.remarks = ''; | |
| 264 | + gb_common.$post('/childTask', data, function (rs) { | |
| 265 | + notify_succ('子任务添加成功'); | |
| 266 | + gb_schedule_table.updateSchedule(rs.t); | |
| 267 | + i++; | |
| 268 | + f(); | |
| 269 | + }); | |
| 270 | + })(); | |
| 271 | + } | |
| 272 | + }); | |
| 273 | + //校验不过 | |
| 274 | + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | |
| 275 | + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | |
| 276 | + }); | |
| 277 | + | |
| 278 | + function allValidSuccess() { | |
| 279 | + var flag = true; | |
| 280 | + $('form.sub_task_form_v2', wrap).each(function (i, f) { | |
| 281 | + if(!$(f).data('valid')){ | |
| 282 | + flag = false; | |
| 283 | + return false; | |
| 284 | + } | |
| 285 | + }); | |
| 286 | + return flag; | |
| 287 | + } | |
| 288 | + })(); | |
| 289 | + </script> | |
| 290 | 290 | </div> |
| 291 | 291 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html
| 1 | -<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal"> | |
| 2 | - <div class="uk-modal-dialog" style="width: 1100px;"> | |
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | - <div class="uk-modal-header"> | |
| 5 | - <h2>添加子任务</h2></div> | |
| 6 | - | |
| 7 | - <div class="uk-grid uk-grid-small"> | |
| 8 | - <div class="uk-width-2-10"> | |
| 9 | - <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg"> | |
| 10 | - <li name="normal"><a>1、子任务</a></li> | |
| 11 | - <li name="in_out"><a>2、进出场</a></li> | |
| 12 | - <li name="range_turn"><a>3、区间调头</a></li> | |
| 13 | - </ul> | |
| 14 | - </div> | |
| 15 | - <div class="uk-width-8-10"> | |
| 16 | - <ul id="tempScheduleContent" class="uk-switcher"> | |
| 17 | - <li class="tab_cont normalCont"></li> | |
| 18 | - <li class="tab_cont inOutCont"></li> | |
| 19 | - <li class="tab_cont rangeTurnCont"></li> | |
| 20 | - </ul> | |
| 21 | - </div> | |
| 22 | - </div> | |
| 23 | - | |
| 24 | - <div class="footer_tools"> | |
| 25 | - <!-- 底部公里统计栏 --> | |
| 26 | - <div class="footer_mileage_count"> | |
| 27 | - 合计 | |
| 28 | - <span class="service_sum"></span> | |
| 29 | - <span class="destroy_sum"></span> | |
| 30 | - <span class="empty_sum"></span> | |
| 31 | - </div> | |
| 32 | - <!-- 站到场 链接 --> | |
| 33 | - <div class="station_to_park_link"> | |
| 34 | - <a>站 <i class="uk-icon-exchange"></i> 场</a> | |
| 35 | - </div> | |
| 36 | - </div> | |
| 37 | - </div> | |
| 38 | - | |
| 39 | - <script id="sub-task-v2-form-temp" type="text/html"> | |
| 40 | - <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2"> | |
| 41 | - <span class="task_form_close_icon"> | |
| 42 | - <i class="uk-icon-times"></i> | |
| 43 | - </span> | |
| 44 | - <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp> | |
| 45 | - <input type="hidden" value="正常" name="type1"> | |
| 46 | - <div class="uk-grid"> | |
| 47 | - <div class="uk-width-1-3"> | |
| 48 | - <div class="uk-form-row"> | |
| 49 | - <label class="uk-form-label">班次类型</label> | |
| 50 | - <div class="uk-form-controls"> | |
| 51 | - <select class="form-control nt-dictionary" data-code="-100" name="type2" | |
| 52 | - data-group=ChildTaskType></select> | |
| 53 | - </div> | |
| 54 | - </div> | |
| 55 | - </div> | |
| 56 | - <div class="uk-width-1-3"> | |
| 57 | - <div class="uk-form-row"> | |
| 58 | - <label class="uk-form-label">起点 </label> | |
| 59 | - <div class="uk-form-controls"> | |
| 60 | - <select name="startStation" required></select> | |
| 61 | - </div> | |
| 62 | - </div> | |
| 63 | - </div> | |
| 64 | - <div class="uk-width-1-3"> | |
| 65 | - <div class="uk-form-row"> | |
| 66 | - <label class="uk-form-label">终点</label> | |
| 67 | - <div class="uk-form-controls"> | |
| 68 | - <select name="endStation" required></select> | |
| 69 | - </div> | |
| 70 | - </div> | |
| 71 | - </div> | |
| 72 | - </div> | |
| 73 | - | |
| 74 | - <div class="uk-grid"> | |
| 75 | - <div class="uk-width-1-3"> | |
| 76 | - <div class="uk-form-row"> | |
| 77 | - <label class="uk-form-label">开始时间</label> | |
| 78 | - <div class="uk-form-controls"> | |
| 79 | - <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time" | |
| 80 | - required> | |
| 81 | - </div> | |
| 82 | - </div> | |
| 83 | - </div> | |
| 84 | - <div class="uk-width-1-3"> | |
| 85 | - <div class="uk-form-row"> | |
| 86 | - <label class="uk-form-label">结束时间</label> | |
| 87 | - <div class="uk-form-controls"> | |
| 88 | - <input name="endDate" type="time" required> | |
| 89 | - </div> | |
| 90 | - </div> | |
| 91 | - </div> | |
| 92 | - <div class="uk-width-1-3"> | |
| 93 | - <div class="uk-form-row"> | |
| 94 | - <label class="uk-form-label">公里数</label> | |
| 95 | - <div class="uk-form-controls"> | |
| 96 | - <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" | |
| 97 | - required> | |
| 98 | - </div> | |
| 99 | - </div> | |
| 100 | - </div> | |
| 101 | - </div> | |
| 102 | - | |
| 103 | - <div class="uk-grid"> | |
| 104 | - <div class="uk-width-2-3 domains"></div> | |
| 105 | - <div class="uk-width-1-3"> | |
| 106 | - <div class="uk-form-row"> | |
| 107 | - <label class="uk-form-label">里程类型</label> | |
| 108 | - <div class="uk-form-controls"> | |
| 109 | - <select class="form-control nt-dictionary" required name="mileageType" | |
| 110 | - data-group="MileageType"></select> | |
| 111 | - </div> | |
| 112 | - </div> | |
| 113 | - </div> | |
| 114 | - </div> | |
| 115 | - </form> | |
| 116 | - </script> | |
| 117 | - | |
| 118 | - <script id="st-v2-domains-changecar-form-temp" type="text/html"> | |
| 119 | - <div class="uk-grid"> | |
| 120 | - <div class="uk-width-1-2"> | |
| 121 | - <div class="uk-form-row"> | |
| 122 | - <label class="uk-form-label">车辆编码</label> | |
| 123 | - <div class="uk-form-controls"> | |
| 124 | - <div class="uk-autocomplete autocomplete-cars"> | |
| 125 | - <input type="text" name="nbbm" placeholder="车辆自编号" required> | |
| 126 | - </div> | |
| 127 | - </div> | |
| 128 | - </div> | |
| 129 | - </div> | |
| 130 | - <div class="uk-width-1-2 destroy_reason_wrap"> | |
| 131 | - <div class="uk-form-row"> | |
| 132 | - <label class="uk-form-label">换车原因</label> | |
| 133 | - <div class="uk-form-controls"> | |
| 134 | - <select class="form-control" name="reason" required> | |
| 135 | - <option value="">请选择...</option> | |
| 136 | - {{each inOutExps as exp i}} | |
| 137 | - <option value="{{exp}}">{{exp}}</option> | |
| 138 | - {{/each}} | |
| 139 | - </select> | |
| 140 | - </div> | |
| 141 | - </div> | |
| 142 | - </div> | |
| 143 | - </div> | |
| 144 | - </script> | |
| 145 | - | |
| 146 | - <script id="st-v2-domains-inout-form-temp" type="text/html"> | |
| 147 | - <div class="uk-grid"> | |
| 148 | - <div class="uk-width-1-2"> | |
| 149 | - <div class="uk-form-row" style="padding-top: 5px;"> | |
| 150 | - <label class="uk-form-label"></label> | |
| 151 | - <div class="uk-form-controls"> | |
| 152 | - <label data-uk-tooltip title="如是无人售票线路,忽略这个选项"> | |
| 153 | - <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员 | |
| 154 | - </label> | |
| 155 | - </div> | |
| 156 | - </div> | |
| 157 | - </div> | |
| 158 | - <div class="uk-width-1-2 destroy_reason_wrap"> | |
| 159 | - <div class="uk-form-row"> | |
| 160 | - <label class="uk-form-label">进出场原因</label> | |
| 161 | - <div class="uk-form-controls"> | |
| 162 | - <select class="form-control" name="reason" required> | |
| 163 | - <option value="">请选择...</option> | |
| 164 | - {{each inOutExps as exp i}} | |
| 165 | - <option value="{{exp}}">{{exp}}</option> | |
| 166 | - {{/each}} | |
| 167 | - </select> | |
| 168 | - </div> | |
| 169 | - </div> | |
| 170 | - </div> | |
| 171 | - </div> | |
| 172 | - </script> | |
| 173 | - | |
| 174 | - <script id="st-v2-domains-service-form-temp" type="text/html"> | |
| 175 | - <div class="uk-grid"> | |
| 176 | - <div class="uk-width-1-2"> | |
| 177 | - <div class="uk-form-row" style="padding-top: 5px;"> | |
| 178 | - <label class="uk-form-label"></label> | |
| 179 | - <div class="uk-form-controls"> | |
| 180 | - <label> | |
| 181 | - <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | |
| 182 | - </label> | |
| 183 | - </div> | |
| 184 | - </div> | |
| 185 | - </div> | |
| 186 | - <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | |
| 187 | - <div class="uk-form-row"> | |
| 188 | - <label class="uk-form-label">烂班原因</label> | |
| 189 | - <div class="uk-form-controls"> | |
| 190 | - <select class="form-control" name="reason" required> | |
| 191 | - <option value="">请选择...</option> | |
| 192 | - {{each adjustExps as exp i}} | |
| 193 | - <option value="{{exp}}">{{exp}}</option> | |
| 194 | - {{/each}} | |
| 195 | - </select> | |
| 196 | - </div> | |
| 197 | - </div> | |
| 198 | - </div> | |
| 199 | - </div> | |
| 200 | - </script> | |
| 201 | - <script> | |
| 202 | - (function () { | |
| 203 | - var modal = '#add-sub-task-main-modal', sch, | |
| 204 | - stationRoutes, | |
| 205 | - parks, | |
| 206 | - information, | |
| 207 | - st_park_data; | |
| 208 | - | |
| 209 | - $(modal).on('init', function (e, data) { | |
| 210 | - e.stopPropagation(); | |
| 211 | - sch = data.sch; | |
| 212 | - | |
| 213 | - //站到场数据 | |
| 214 | - st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm]; | |
| 215 | - //站点路由 | |
| 216 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | |
| 217 | - return a.stationRouteCode - b.stationRouteCode; | |
| 218 | - }), 'directions'); | |
| 219 | - //停车场 | |
| 220 | - parks = gb_data_basic.simpleParksArray(); | |
| 221 | - //线路标准 | |
| 222 | - information = gb_data_basic.getLineInformation(sch.xlBm); | |
| 223 | - | |
| 224 | - var st_doms = gb_schedule_context_menu.get_st_doms(); | |
| 225 | - //普通 | |
| 226 | - $('.normalCont', modal).html(st_doms.custom_dom); | |
| 227 | - $('.add_custom_wrap', modal).trigger('init', data); | |
| 228 | - | |
| 229 | - //进出场班次 | |
| 230 | - if(sch.bcType=='in'||sch.bcType=='out'){ | |
| 231 | - $('.left_tabs_lg li[name=in_out]').remove(); | |
| 232 | - $('.left_tabs_lg li[name=range_turn]').remove(); | |
| 233 | - } | |
| 234 | - else{ | |
| 235 | - //进出场 | |
| 236 | - $('.inOutCont', modal).html(st_doms.inout_dom); | |
| 237 | - $('.add_inOut_wrap', modal).trigger('init', data); | |
| 238 | - //区间调头 | |
| 239 | - $('.rangeTurnCont', modal).html(st_doms.range_dom); | |
| 240 | - $('.add_range_wrap', modal).trigger('init', data); | |
| 241 | - } | |
| 242 | - }); | |
| 243 | - | |
| 244 | - //班次类型切换事件 | |
| 245 | - $(modal).on('change', 'select[name=type2]', reCalcInputs_type); | |
| 246 | - //烂班选项点击事件 | |
| 247 | - $(modal).on('change', 'input[name=destroy]', destroyClick); | |
| 248 | - //起终点站切换事件 | |
| 249 | - $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station); | |
| 250 | - //开始时间改变 | |
| 251 | - $(modal).on('input', 'input[name=startDate]', reCalcEndTime); | |
| 252 | - //公里数改变 | |
| 253 | - $(modal).on('input', 'input[name=mileage]', reCalcMileageCount); | |
| 254 | - //终点时间改变 | |
| 255 | - $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time); | |
| 256 | - //进出场原因切换 | |
| 257 | - $(modal).on('change', 'select[name=reason]', reSynchroReason); | |
| 258 | - //里程类型改变 | |
| 259 | - $(modal).on('change', 'select[name=mileageType]', changeMileageType); | |
| 260 | - //关闭 | |
| 261 | - $(modal).on('click', '.task_form_close_icon', closeTaskForm); | |
| 262 | - | |
| 263 | - //公里合计footer | |
| 264 | - var re_count; | |
| 265 | - $('.footer_mileage_count', modal).on('refresh', function () { | |
| 266 | - if(re_count) | |
| 267 | - return; | |
| 268 | - re_count = true; | |
| 269 | - var that=this; | |
| 270 | - setTimeout(function () { | |
| 271 | - var fs = $('#tempScheduleContent li.uk-active form.sub_task_form_v2', modal); | |
| 272 | - var s=0,e=0,d=0,mileage; | |
| 273 | - $.each(fs, function () { | |
| 274 | - mileage = parseFloat($f('mileage',this).val()); | |
| 275 | - if($(this).hasClass('destroy_form')) | |
| 276 | - d = gb_common.accAdd(d, mileage); | |
| 277 | - else if($(this).hasClass('service_form')) | |
| 278 | - s = gb_common.accAdd(s, mileage); | |
| 279 | - else if($(this).hasClass('empty_form')) | |
| 280 | - e = gb_common.accAdd(e, mileage); | |
| 281 | - }); | |
| 282 | - | |
| 283 | - $('span',that).hide(); | |
| 284 | - if(s>0) | |
| 285 | - $('span.service_sum',that).html('营运: ' + s).show(); | |
| 286 | - if(e>0) | |
| 287 | - $('span.empty_sum',that).html('空驶: ' + e).show(); | |
| 288 | - if(d>0) | |
| 289 | - $('span.destroy_sum',that).html('烂班: ' + d).show(); | |
| 290 | - re_count=false; | |
| 291 | - }, 200); | |
| 292 | - }); | |
| 293 | - | |
| 294 | - /** | |
| 295 | - * 根据班次类型切换起终点下拉框 | |
| 296 | - */ | |
| 297 | - function reCalcInputs_type() { | |
| 298 | - var f = $(this).parents('.sub_task_form_v2'); | |
| 299 | - | |
| 300 | - var routes = stationRoutes[sch.xlDir] | |
| 301 | - , lastCode = routes[routes.length - 1].stationCode | |
| 302 | - , opts = '', park_opts = ''; | |
| 303 | - //station options | |
| 304 | - $.each(routes, function () { | |
| 305 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | |
| 306 | - }); | |
| 307 | - //park options | |
| 308 | - for (var code in parks) | |
| 309 | - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | |
| 310 | - | |
| 311 | - var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f); | |
| 312 | - var domainsTemp; | |
| 313 | - switch ($(this).val()) { | |
| 314 | - case '3'://出场 | |
| 315 | - qdz.html(park_opts).val(information.carPark); | |
| 316 | - zdz.html(opts).trigger('change'); | |
| 317 | - mType.val('empty').attr('disabled', 'disabled').trigger('change'); | |
| 318 | - domainsTemp = 'st-v2-domains-inout-form-temp'; | |
| 319 | - /*//如果上一个form是进场 | |
| 320 | - try { | |
| 321 | - var prev_f = f.prev('.sub_task_form_v2'); | |
| 322 | - if ($f('type2', prev_f).val() == 2) | |
| 323 | - zdz.val($f('startStation', prev_f).val()); | |
| 324 | - } catch (e) { | |
| 325 | - console.log(e); | |
| 326 | - }*/ | |
| 327 | - break; | |
| 328 | - case '2'://进场 | |
| 329 | - qdz.html(opts) | |
| 330 | - zdz.html(park_opts).val(information.carPark).trigger('change'); | |
| 331 | - mType.val('empty').attr('disabled', 'disabled').trigger('change'); | |
| 332 | - domainsTemp = 'st-v2-domains-inout-form-temp'; | |
| 333 | - break; | |
| 334 | - default: | |
| 335 | - qdz.html(opts); | |
| 336 | - zdz.html(opts).val(lastCode).trigger('change'); | |
| 337 | - mType.val('service').removeAttr('disabled').trigger('change'); | |
| 338 | - domainsTemp = 'st-v2-domains-service-form-temp'; | |
| 339 | - } | |
| 340 | - | |
| 341 | - //可变选项区域 | |
| 342 | - $('.domains', f).html(template(domainsTemp, { | |
| 343 | - adjustExps: gb_common.adjustExps, | |
| 344 | - inOutExps: gb_common.inOutExps | |
| 345 | - })); | |
| 346 | - | |
| 347 | - //校验reason | |
| 348 | - f.trigger('add_reason_field'); | |
| 349 | - //qdz.trigger('change'); | |
| 350 | - //zdz.trigger('change'); | |
| 351 | - } | |
| 352 | - | |
| 353 | - /** | |
| 354 | - * 根据站位站距计算公里和时间 | |
| 355 | - */ | |
| 356 | - function reCalcInputs_station() { | |
| 357 | - var f = $(this).parents('.sub_task_form_v2') | |
| 358 | - , type2 = $f('type2', f).val()//班次类型 | |
| 359 | - , qdzCode = $f('startStation', f).val()//起点站 | |
| 360 | - , zdzCode = $f('endStation', f).val()//终点站 | |
| 361 | - , startDate = $f('startDate', f).val();//开始时间 | |
| 362 | - var mileage, time, upDown; | |
| 363 | - switch (type2) { | |
| 364 | - case '2': | |
| 365 | - upDown = inout_updown(qdzCode, sch); | |
| 366 | - break; | |
| 367 | - case '3': | |
| 368 | - upDown = inout_updown(zdzCode, sch); | |
| 369 | - break; | |
| 370 | - default: | |
| 371 | - upDown = sch.xlDir | |
| 372 | - } | |
| 373 | - | |
| 374 | - //从站到场里获取数据 | |
| 375 | - var stp = search_st_park(f); | |
| 376 | - if(stp){ | |
| 377 | - mileage=type2==2?stp['mileage1']:stp['mileage2']; | |
| 378 | - time=type2==2?stp['time1']:stp['time2']; | |
| 379 | - } | |
| 380 | - else{ | |
| 381 | - if(upDown==-1) | |
| 382 | - return; | |
| 383 | - switch (upDown + '_' + type2) { | |
| 384 | - case '0_3'://上行出场 | |
| 385 | - mileage = information.upOutMileage; | |
| 386 | - time = information.upOutTimer; | |
| 387 | - break; | |
| 388 | - case '1_3'://下行出场 | |
| 389 | - mileage = information.downOutMileage; | |
| 390 | - time = information.downOutTimer; | |
| 391 | - break; | |
| 392 | - case '0_2'://上行进场 | |
| 393 | - mileage = information.upInMileage; | |
| 394 | - time = information.upInTimer; | |
| 395 | - break; | |
| 396 | - case '1_2'://下行进场 | |
| 397 | - mileage = information.downInMileage; | |
| 398 | - time = information.downInTimer; | |
| 399 | - break; | |
| 400 | - default: | |
| 401 | - //线路上站点间 | |
| 402 | - mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode); | |
| 403 | - time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | |
| 404 | - } | |
| 405 | - } | |
| 406 | - | |
| 407 | - $f('mileage', f).val(mileage); | |
| 408 | - var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | |
| 409 | - $f('endDate', f).val(et.format('HH:mm')); | |
| 410 | - | |
| 411 | - if (type2 != 1) { | |
| 412 | - reCalcEndTime.call(this); | |
| 413 | - } | |
| 414 | - reCalcMileageCount(); | |
| 415 | - } | |
| 416 | - | |
| 417 | - /** | |
| 418 | - * 计算结束时间 | |
| 419 | - */ | |
| 420 | - function reCalcEndTime() { | |
| 421 | - var f = $(this).parents('.sub_task_form_v2') | |
| 422 | - , startDate = $f('startDate', f).val()//开始时间 | |
| 423 | - , mileage = $f('mileage', f).val()//公里 | |
| 424 | - , type2 = $f('type2', f).val();//班次类型 | |
| 425 | - if (!startDate || !mileage) | |
| 426 | - return; | |
| 427 | - | |
| 428 | - var time; | |
| 429 | - //从站到场里获取数据 | |
| 430 | - var stp = search_st_park(f); | |
| 431 | - if(stp){ | |
| 432 | - mileage=type2==2?stp['mileage1']:stp['mileage2']; | |
| 433 | - time=type2==2?stp['time1']:stp['time2']; | |
| 434 | - } | |
| 435 | - else{ | |
| 436 | - if (type2 == 1) { | |
| 437 | - time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | |
| 438 | - } | |
| 439 | - else if (type2 == 2) { | |
| 440 | - //进场 | |
| 441 | - var qdzCode = $f('startStation', f).val(), | |
| 442 | - updown = inout_updown(qdzCode, sch); | |
| 443 | - | |
| 444 | - if (updown == -1) | |
| 445 | - return; | |
| 446 | - time = updown == 0 ? information.upInTimer : information.downInTimer; | |
| 447 | - } | |
| 448 | - else if (type2 == 3) { | |
| 449 | - //出场 | |
| 450 | - var zdzCode = $f('endStation', f).val(), | |
| 451 | - updown = inout_updown(zdzCode, sch); | |
| 452 | - | |
| 453 | - if (updown == -1) | |
| 454 | - return; | |
| 455 | - time = updown == 0 ? information.upOutTimer : information.downOutTimer; | |
| 456 | - } | |
| 457 | - } | |
| 458 | - | |
| 459 | - var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | |
| 460 | - $f('endDate', f).val(et.format('HH:mm')).trigger('input'); | |
| 461 | - } | |
| 462 | - | |
| 463 | - /** | |
| 464 | - * 将结束时间写入下一个表单的开始时间 | |
| 465 | - */ | |
| 466 | - function reCalcNext_s_time() { | |
| 467 | - var f = $(this).parents('.sub_task_form_v2'), | |
| 468 | - et = $f('endDate', f).val(); | |
| 469 | - | |
| 470 | - var nf = gb_common.next_elem('sub_task_form_v2', f); | |
| 471 | - | |
| 472 | - if (f.attr('destroy')) | |
| 473 | - et = $f('startDate', f).val(); | |
| 474 | - | |
| 475 | - if (nf.length > 0) { | |
| 476 | - $f('startDate', nf).val(et).trigger('input'); | |
| 477 | - } | |
| 478 | - } | |
| 479 | - | |
| 480 | - /** | |
| 481 | - * 切换原因 | |
| 482 | - */ | |
| 483 | - function reSynchroReason() { | |
| 484 | - var f = $(this).parents('.sub_task_form_v2'), | |
| 485 | - reason = $(this).val(); | |
| 486 | - | |
| 487 | - var nf = gb_common.next_elem('sub_task_form_v2', f), | |
| 488 | - nInput = $f('reason', nf); | |
| 489 | - | |
| 490 | - if (nf.length > 0 && nInput.length > 0) { | |
| 491 | - nInput.val(reason).trigger('change'); | |
| 492 | - } | |
| 493 | - else { | |
| 494 | - var cont = f.parents('li.tab_cont'), | |
| 495 | - remInput = $('.remarks_form [name=remarks]', cont); | |
| 496 | - | |
| 497 | - if(remInput.val()==reason + ',') | |
| 498 | - return; | |
| 499 | - remInput.val(remInput.val() + reason + ','); | |
| 500 | - } | |
| 501 | - } | |
| 502 | - | |
| 503 | - function calcMileageByRoutes(routes, s, e) { | |
| 504 | - var code, flag, mileage = 0; | |
| 505 | - $.each(routes, function () { | |
| 506 | - code = this['stationCode']; | |
| 507 | - if (flag) { | |
| 508 | - if (!this.distances) | |
| 509 | - this.distances = 0; | |
| 510 | - mileage = gb_common.accAdd(mileage, this.distances); | |
| 511 | - } | |
| 512 | - if (code == s) | |
| 513 | - flag = true; | |
| 514 | - if (code == e) | |
| 515 | - return false; | |
| 516 | - }); | |
| 517 | - return mileage; | |
| 518 | - } | |
| 519 | - | |
| 520 | - function destroyClick() { | |
| 521 | - var f = $(this).parents('.sub_task_form_v2'); | |
| 522 | - if (this.checked) { | |
| 523 | - $('.destroy_reason_wrap', f).show(); | |
| 524 | - f.attr('destroy', true).addClass('destroy_form'); | |
| 525 | - } | |
| 526 | - else { | |
| 527 | - $('.destroy_reason_wrap', f).hide(); | |
| 528 | - f.removeAttr('destroy').removeClass('destroy_form'); | |
| 529 | - } | |
| 530 | - reCalcMileageCount(); | |
| 531 | - } | |
| 532 | - | |
| 533 | - function changeMileageType() { | |
| 534 | - var f = $(this).parents('.sub_task_form_v2'), | |
| 535 | - mileageType = $(this).val(); | |
| 536 | - if (mileageType) { | |
| 537 | - f.removeClass('service_form empty_form').addClass(mileageType + '_form'); | |
| 538 | - reCalcMileageCount(); | |
| 539 | - } | |
| 540 | - } | |
| 541 | - | |
| 542 | - function $f(name, f) { | |
| 543 | - return $('[name=' + name + ']', f); | |
| 544 | - } | |
| 545 | - | |
| 546 | - function closeTaskForm() { | |
| 547 | - $(this).parents('.sub_task_form_v2').remove(); | |
| 548 | - reCalcMileageCount(); | |
| 549 | - } | |
| 550 | - | |
| 551 | - /** | |
| 552 | - * 进出场上下行 | |
| 553 | - * @param qdzCode | |
| 554 | - * @param sch | |
| 555 | - */ | |
| 556 | - function inout_updown(station, sch) { | |
| 557 | - if (station == sch.qdzCode) | |
| 558 | - return sch.xlDir; | |
| 559 | - else if (station == sch.zdzCode) | |
| 560 | - return sch.xlDir == 0 ? 1 : 0; | |
| 561 | - else | |
| 562 | - return -1; | |
| 563 | - } | |
| 564 | - | |
| 565 | - function search_st_park(f) { | |
| 566 | - if(!st_park_data) | |
| 567 | - return; | |
| 568 | - var stp; | |
| 569 | - var qdSelect=$f('startStation', f)[0],zdSelect=$f('endStation', f)[0]; | |
| 570 | - | |
| 571 | - var qdzName=qdSelect.options[qdSelect.options.selectedIndex].text, | |
| 572 | - zdzName=zdSelect.options[zdSelect.options.selectedIndex].text, | |
| 573 | - type2 = $f('type2', f).val(); | |
| 574 | - | |
| 575 | - if(type2!=2 && type2!=3) | |
| 576 | - return; | |
| 577 | - | |
| 578 | - $.each(st_park_data, function () { | |
| 579 | - if((type2==2 && this.stationName==qdzName && this.parkName==zdzName) | |
| 580 | - || (type2==3 && this.stationName==zdzName && this.parkName==qdzName)){ | |
| 581 | - stp = this; | |
| 582 | - return false; | |
| 583 | - } | |
| 584 | - }); | |
| 585 | - | |
| 586 | - return stp; | |
| 587 | - } | |
| 588 | - | |
| 589 | - $('.left_tabs_lg', modal).on('show.uk.switcher', reCalcMileageCount); | |
| 590 | - | |
| 591 | - function reCalcMileageCount() { | |
| 592 | - $('.footer_mileage_count', modal).trigger('refresh'); | |
| 593 | - var f = $(this).parents('.sub_task_form_v2'); | |
| 594 | - if($f('type2',f).val()==1) | |
| 595 | - reCalcEndTime.call(this); | |
| 596 | - } | |
| 597 | - | |
| 598 | - | |
| 599 | - var folder = '/real_control_v2/fragments/line_schedule/context_menu'; | |
| 600 | - /** | |
| 601 | - * 弹出站 到 场对照表 | |
| 602 | - */ | |
| 603 | - $('.station_to_park_link', modal).on('click', function () { | |
| 604 | - open_modal(folder + '/utils/station_to_park.html', { | |
| 605 | - sch: sch | |
| 606 | - }, {center: false, bgclose: false, modal: false}); | |
| 607 | - }); | |
| 608 | - })(); | |
| 609 | - </script> | |
| 1 | +<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal"> | |
| 2 | + <div class="uk-modal-dialog" style="width: 1100px;"> | |
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | + <div class="uk-modal-header"> | |
| 5 | + <h2>添加子任务</h2></div> | |
| 6 | + | |
| 7 | + <div class="uk-grid uk-grid-small"> | |
| 8 | + <div class="uk-width-2-10"> | |
| 9 | + <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg"> | |
| 10 | + <li name="normal"><a>1、子任务</a></li> | |
| 11 | + <li name="in_out"><a>2、进出场</a></li> | |
| 12 | + <li name="range_turn"><a>3、区间调头</a></li> | |
| 13 | + </ul> | |
| 14 | + </div> | |
| 15 | + <div class="uk-width-8-10"> | |
| 16 | + <ul id="tempScheduleContent" class="uk-switcher"> | |
| 17 | + <li class="tab_cont normalCont"></li> | |
| 18 | + <li class="tab_cont inOutCont"></li> | |
| 19 | + <li class="tab_cont rangeTurnCont"></li> | |
| 20 | + </ul> | |
| 21 | + </div> | |
| 22 | + </div> | |
| 23 | + | |
| 24 | + <div class="footer_tools"> | |
| 25 | + <!-- 底部公里统计栏 --> | |
| 26 | + <div class="footer_mileage_count"> | |
| 27 | + 合计 | |
| 28 | + <span class="service_sum"></span> | |
| 29 | + <span class="destroy_sum"></span> | |
| 30 | + <span class="empty_sum"></span> | |
| 31 | + </div> | |
| 32 | + <!-- 站到场 链接 --> | |
| 33 | + <div class="station_to_park_link"> | |
| 34 | + <a>站 <i class="uk-icon-exchange"></i> 场</a> | |
| 35 | + </div> | |
| 36 | + | |
| 37 | + <abbr title="系统基础信息录入的停车场,必须绘制闭合多边形地理位置,才会纳入选项">缺少停车场选项?</abbr> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + | |
| 41 | + <script id="sub-task-v2-form-temp" type="text/html"> | |
| 42 | + <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2"> | |
| 43 | + <span class="task_form_close_icon"> | |
| 44 | + <i class="uk-icon-times"></i> | |
| 45 | + </span> | |
| 46 | + <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp> | |
| 47 | + <input type="hidden" value="正常" name="type1"> | |
| 48 | + <div class="uk-grid"> | |
| 49 | + <div class="uk-width-1-3"> | |
| 50 | + <div class="uk-form-row"> | |
| 51 | + <label class="uk-form-label">班次类型</label> | |
| 52 | + <div class="uk-form-controls"> | |
| 53 | + <select class="form-control nt-dictionary" data-code="-100" name="type2" | |
| 54 | + data-group=ChildTaskType></select> | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | + </div> | |
| 58 | + <div class="uk-width-1-3"> | |
| 59 | + <div class="uk-form-row"> | |
| 60 | + <label class="uk-form-label">起点 </label> | |
| 61 | + <div class="uk-form-controls"> | |
| 62 | + <select name="startStation" ></select> | |
| 63 | + </div> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + <div class="uk-width-1-3"> | |
| 67 | + <div class="uk-form-row"> | |
| 68 | + <label class="uk-form-label">终点</label> | |
| 69 | + <div class="uk-form-controls"> | |
| 70 | + <select name="endStation" ></select> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + | |
| 76 | + <div class="uk-grid"> | |
| 77 | + <div class="uk-width-1-3"> | |
| 78 | + <div class="uk-form-row"> | |
| 79 | + <label class="uk-form-label">开始时间</label> | |
| 80 | + <div class="uk-form-controls"> | |
| 81 | + <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time" | |
| 82 | + required> | |
| 83 | + </div> | |
| 84 | + </div> | |
| 85 | + </div> | |
| 86 | + <div class="uk-width-1-3"> | |
| 87 | + <div class="uk-form-row"> | |
| 88 | + <label class="uk-form-label">结束时间</label> | |
| 89 | + <div class="uk-form-controls"> | |
| 90 | + <input name="endDate" type="time" required> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | + </div> | |
| 94 | + <div class="uk-width-1-3"> | |
| 95 | + <div class="uk-form-row"> | |
| 96 | + <label class="uk-form-label">公里数</label> | |
| 97 | + <div class="uk-form-controls"> | |
| 98 | + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" | |
| 99 | + required> | |
| 100 | + </div> | |
| 101 | + </div> | |
| 102 | + </div> | |
| 103 | + </div> | |
| 104 | + | |
| 105 | + <div class="uk-grid"> | |
| 106 | + <div class="uk-width-2-3 domains"></div> | |
| 107 | + <div class="uk-width-1-3"> | |
| 108 | + <div class="uk-form-row"> | |
| 109 | + <label class="uk-form-label">里程类型</label> | |
| 110 | + <div class="uk-form-controls"> | |
| 111 | + <select class="form-control nt-dictionary" required name="mileageType" | |
| 112 | + data-group="MileageType"></select> | |
| 113 | + </div> | |
| 114 | + </div> | |
| 115 | + </div> | |
| 116 | + </div> | |
| 117 | + </form> | |
| 118 | + </script> | |
| 119 | + | |
| 120 | + <script id="st-v2-domains-changecar-form-temp" type="text/html"> | |
| 121 | + <div class="uk-grid"> | |
| 122 | + <div class="uk-width-1-2"> | |
| 123 | + <div class="uk-form-row"> | |
| 124 | + <label class="uk-form-label">车辆编码</label> | |
| 125 | + <div class="uk-form-controls"> | |
| 126 | + <div class="uk-autocomplete autocomplete-cars"> | |
| 127 | + <input type="text" name="nbbm" placeholder="车辆自编号" required> | |
| 128 | + </div> | |
| 129 | + </div> | |
| 130 | + </div> | |
| 131 | + </div> | |
| 132 | + <div class="uk-width-1-2 destroy_reason_wrap"> | |
| 133 | + <div class="uk-form-row"> | |
| 134 | + <label class="uk-form-label">换车原因</label> | |
| 135 | + <div class="uk-form-controls"> | |
| 136 | + <select class="form-control" name="reason" required> | |
| 137 | + <option value="">请选择...</option> | |
| 138 | + {{each inOutExps as exp i}} | |
| 139 | + <option value="{{exp}}">{{exp}}</option> | |
| 140 | + {{/each}} | |
| 141 | + </select> | |
| 142 | + </div> | |
| 143 | + </div> | |
| 144 | + </div> | |
| 145 | + </div> | |
| 146 | + </script> | |
| 147 | + | |
| 148 | + <script id="st-v2-domains-inout-form-temp" type="text/html"> | |
| 149 | + <div class="uk-grid"> | |
| 150 | + <div class="uk-width-1-2"> | |
| 151 | + <div class="uk-form-row" style="padding-top: 5px;"> | |
| 152 | + <label class="uk-form-label"></label> | |
| 153 | + <div class="uk-form-controls"> | |
| 154 | + <label data-uk-tooltip title="如是无人售票线路,忽略这个选项"> | |
| 155 | + <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员 | |
| 156 | + </label> | |
| 157 | + </div> | |
| 158 | + </div> | |
| 159 | + </div> | |
| 160 | + <div class="uk-width-1-2 destroy_reason_wrap"> | |
| 161 | + <div class="uk-form-row"> | |
| 162 | + <label class="uk-form-label">进出场原因</label> | |
| 163 | + <div class="uk-form-controls"> | |
| 164 | + <select class="form-control" name="reason" required> | |
| 165 | + <option value="">请选择...</option> | |
| 166 | + {{each inOutExps as exp i}} | |
| 167 | + <option value="{{exp}}">{{exp}}</option> | |
| 168 | + {{/each}} | |
| 169 | + </select> | |
| 170 | + </div> | |
| 171 | + </div> | |
| 172 | + </div> | |
| 173 | + </div> | |
| 174 | + </script> | |
| 175 | + | |
| 176 | + <script id="st-v2-domains-service-form-temp" type="text/html"> | |
| 177 | + <div class="uk-grid"> | |
| 178 | + <div class="uk-width-1-2"> | |
| 179 | + <div class="uk-form-row" style="padding-top: 5px;"> | |
| 180 | + <label class="uk-form-label"></label> | |
| 181 | + <div class="uk-form-controls"> | |
| 182 | + <label> | |
| 183 | + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | |
| 184 | + </label> | |
| 185 | + </div> | |
| 186 | + </div> | |
| 187 | + </div> | |
| 188 | + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | |
| 189 | + <div class="uk-form-row"> | |
| 190 | + <label class="uk-form-label">烂班原因</label> | |
| 191 | + <div class="uk-form-controls"> | |
| 192 | + <select class="form-control" name="reason" required> | |
| 193 | + <option value="">请选择...</option> | |
| 194 | + {{each adjustExps as exp i}} | |
| 195 | + <option value="{{exp}}">{{exp}}</option> | |
| 196 | + {{/each}} | |
| 197 | + </select> | |
| 198 | + </div> | |
| 199 | + </div> | |
| 200 | + </div> | |
| 201 | + </div> | |
| 202 | + </script> | |
| 203 | + <script> | |
| 204 | + (function () { | |
| 205 | + var modal = '#add-sub-task-main-modal', sch, | |
| 206 | + stationRoutes, | |
| 207 | + parks, | |
| 208 | + information, | |
| 209 | + st_park_data; | |
| 210 | + | |
| 211 | + $(modal).on('init', function (e, data) { | |
| 212 | + e.stopPropagation(); | |
| 213 | + sch = data.sch; | |
| 214 | + | |
| 215 | + //站到场数据 | |
| 216 | + st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm]; | |
| 217 | + //站点路由 | |
| 218 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | |
| 219 | + return a.stationRouteCode - b.stationRouteCode; | |
| 220 | + }), 'directions'); | |
| 221 | + //停车场 | |
| 222 | + parks = gb_data_basic.simpleParksArray(); | |
| 223 | + //线路标准 | |
| 224 | + information = gb_data_basic.getLineInformation(sch.xlBm); | |
| 225 | + //停车场排序,常用的放前面 | |
| 226 | + parks = sort_parks(parks, information, st_park_data); | |
| 227 | + | |
| 228 | + var st_doms = gb_schedule_context_menu.get_st_doms(); | |
| 229 | + //普通 | |
| 230 | + $('.normalCont', modal).html(st_doms.custom_dom); | |
| 231 | + $('.add_custom_wrap', modal).trigger('init', data); | |
| 232 | + | |
| 233 | + //进出场班次 | |
| 234 | + if(sch.bcType=='in'||sch.bcType=='out'){ | |
| 235 | + $('.left_tabs_lg li[name=in_out]').remove(); | |
| 236 | + $('.left_tabs_lg li[name=range_turn]').remove(); | |
| 237 | + } | |
| 238 | + else{ | |
| 239 | + //进出场 | |
| 240 | + $('.inOutCont', modal).html(st_doms.inout_dom); | |
| 241 | + $('.add_inOut_wrap', modal).trigger('init', data); | |
| 242 | + //区间调头 | |
| 243 | + $('.rangeTurnCont', modal).html(st_doms.range_dom); | |
| 244 | + $('.add_range_wrap', modal).trigger('init', data); | |
| 245 | + } | |
| 246 | + }); | |
| 247 | + | |
| 248 | + //班次类型切换事件 | |
| 249 | + $(modal).on('change', 'select[name=type2]', reCalcInputs_type); | |
| 250 | + //烂班选项点击事件 | |
| 251 | + $(modal).on('change', 'input[name=destroy]', destroyClick); | |
| 252 | + //起终点站切换事件 | |
| 253 | + $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station); | |
| 254 | + //开始时间改变 | |
| 255 | + $(modal).on('input', 'input[name=startDate]', reCalcEndTime); | |
| 256 | + //公里数改变 | |
| 257 | + $(modal).on('input', 'input[name=mileage]', reCalcMileageCount); | |
| 258 | + //终点时间改变 | |
| 259 | + $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time); | |
| 260 | + //进出场原因切换 | |
| 261 | + $(modal).on('change', 'select[name=reason]', reSynchroReason); | |
| 262 | + //里程类型改变 | |
| 263 | + $(modal).on('change', 'select[name=mileageType]', changeMileageType); | |
| 264 | + //关闭 | |
| 265 | + $(modal).on('click', '.task_form_close_icon', closeTaskForm); | |
| 266 | + | |
| 267 | + //公里合计footer | |
| 268 | + var re_count; | |
| 269 | + $('.footer_mileage_count', modal).on('refresh', function () { | |
| 270 | + if(re_count) | |
| 271 | + return; | |
| 272 | + re_count = true; | |
| 273 | + var that=this; | |
| 274 | + setTimeout(function () { | |
| 275 | + var fs = $('#tempScheduleContent li.uk-active form.sub_task_form_v2', modal); | |
| 276 | + var s=0,e=0,d=0,mileage; | |
| 277 | + $.each(fs, function () { | |
| 278 | + mileage = parseFloat($f('mileage',this).val()); | |
| 279 | + if($(this).hasClass('destroy_form')) | |
| 280 | + d = gb_common.accAdd(d, mileage); | |
| 281 | + else if($(this).hasClass('service_form')) | |
| 282 | + s = gb_common.accAdd(s, mileage); | |
| 283 | + else if($(this).hasClass('empty_form')) | |
| 284 | + e = gb_common.accAdd(e, mileage); | |
| 285 | + }); | |
| 286 | + | |
| 287 | + $('span',that).hide(); | |
| 288 | + if(s>0) | |
| 289 | + $('span.service_sum',that).html('营运: ' + s).show(); | |
| 290 | + if(e>0) | |
| 291 | + $('span.empty_sum',that).html('空驶: ' + e).show(); | |
| 292 | + if(d>0) | |
| 293 | + $('span.destroy_sum',that).html('烂班: ' + d).show(); | |
| 294 | + re_count=false; | |
| 295 | + }, 200); | |
| 296 | + }); | |
| 297 | + | |
| 298 | + /** | |
| 299 | + * 根据班次类型切换起终点下拉框 | |
| 300 | + */ | |
| 301 | + function reCalcInputs_type() { | |
| 302 | + var f = $(this).parents('.sub_task_form_v2'); | |
| 303 | + | |
| 304 | + var routes = stationRoutes[sch.xlDir] | |
| 305 | + , lastCode = routes[routes.length - 1].stationCode | |
| 306 | + , opts = '', park_opts = ''; | |
| 307 | + //station options | |
| 308 | + $.each(routes, function () { | |
| 309 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | |
| 310 | + }); | |
| 311 | + //park options | |
| 312 | + for(var i=0,p;p=parks[i++];) | |
| 313 | + park_opts += '<option value="' + p.code + '">' + p.name + '</option>'; | |
| 314 | + /*for (var code in parks) | |
| 315 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>';*/ | |
| 316 | + | |
| 317 | + var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f); | |
| 318 | + var domainsTemp; | |
| 319 | + switch ($(this).val()) { | |
| 320 | + case '3'://出场 | |
| 321 | + qdz.html(park_opts).val(information.carPark); | |
| 322 | + zdz.html(opts).trigger('change'); | |
| 323 | + mType.val('empty').attr('disabled', 'disabled').trigger('change'); | |
| 324 | + domainsTemp = 'st-v2-domains-inout-form-temp'; | |
| 325 | + /*//如果上一个form是进场 | |
| 326 | + try { | |
| 327 | + var prev_f = f.prev('.sub_task_form_v2'); | |
| 328 | + if ($f('type2', prev_f).val() == 2) | |
| 329 | + zdz.val($f('startStation', prev_f).val()); | |
| 330 | + } catch (e) { | |
| 331 | + console.log(e); | |
| 332 | + }*/ | |
| 333 | + break; | |
| 334 | + case '2'://进场 | |
| 335 | + qdz.html(opts) | |
| 336 | + zdz.html(park_opts).val(information.carPark).trigger('change'); | |
| 337 | + mType.val('empty').attr('disabled', 'disabled').trigger('change'); | |
| 338 | + domainsTemp = 'st-v2-domains-inout-form-temp'; | |
| 339 | + break; | |
| 340 | + default: | |
| 341 | + qdz.html(opts); | |
| 342 | + zdz.html(opts).val(lastCode).trigger('change'); | |
| 343 | + mType.val('service').removeAttr('disabled').trigger('change'); | |
| 344 | + domainsTemp = 'st-v2-domains-service-form-temp'; | |
| 345 | + } | |
| 346 | + | |
| 347 | + //可变选项区域 | |
| 348 | + $('.domains', f).html(template(domainsTemp, { | |
| 349 | + adjustExps: gb_common.adjustExps, | |
| 350 | + inOutExps: gb_common.inOutExps | |
| 351 | + })); | |
| 352 | + | |
| 353 | + //校验reason | |
| 354 | + f.trigger('add_reason_field'); | |
| 355 | + //qdz.trigger('change'); | |
| 356 | + //zdz.trigger('change'); | |
| 357 | + } | |
| 358 | + | |
| 359 | + /** | |
| 360 | + * 根据站位站距计算公里和时间 | |
| 361 | + */ | |
| 362 | + function reCalcInputs_station() { | |
| 363 | + var f = $(this).parents('.sub_task_form_v2') | |
| 364 | + , type2 = $f('type2', f).val()//班次类型 | |
| 365 | + , qdzCode = $f('startStation', f).val()//起点站 | |
| 366 | + , zdzCode = $f('endStation', f).val()//终点站 | |
| 367 | + , startDate = $f('startDate', f).val();//开始时间 | |
| 368 | + var mileage, time, upDown; | |
| 369 | + switch (type2) { | |
| 370 | + case '2': | |
| 371 | + upDown = inout_updown(qdzCode, sch); | |
| 372 | + break; | |
| 373 | + case '3': | |
| 374 | + upDown = inout_updown(zdzCode, sch); | |
| 375 | + break; | |
| 376 | + default: | |
| 377 | + upDown = sch.xlDir | |
| 378 | + } | |
| 379 | + | |
| 380 | + //从站到场里获取数据 | |
| 381 | + var stp = search_st_park(f); | |
| 382 | + if(stp){ | |
| 383 | + mileage=type2==2?stp['mileage1']:stp['mileage2']; | |
| 384 | + time=type2==2?stp['time1']:stp['time2']; | |
| 385 | + } | |
| 386 | + else{ | |
| 387 | + if(upDown==-1) | |
| 388 | + return; | |
| 389 | + switch (upDown + '_' + type2) { | |
| 390 | + case '0_3'://上行出场 | |
| 391 | + mileage = information.upOutMileage; | |
| 392 | + time = information.upOutTimer; | |
| 393 | + break; | |
| 394 | + case '1_3'://下行出场 | |
| 395 | + mileage = information.downOutMileage; | |
| 396 | + time = information.downOutTimer; | |
| 397 | + break; | |
| 398 | + case '0_2'://上行进场 | |
| 399 | + mileage = information.upInMileage; | |
| 400 | + time = information.upInTimer; | |
| 401 | + break; | |
| 402 | + case '1_2'://下行进场 | |
| 403 | + mileage = information.downInMileage; | |
| 404 | + time = information.downInTimer; | |
| 405 | + break; | |
| 406 | + default: | |
| 407 | + //线路上站点间 | |
| 408 | + mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode); | |
| 409 | + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | |
| 410 | + } | |
| 411 | + } | |
| 412 | + | |
| 413 | + $f('mileage', f).val(mileage); | |
| 414 | + var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | |
| 415 | + $f('endDate', f).val(et.format('HH:mm')); | |
| 416 | + | |
| 417 | + if (type2 != 1) { | |
| 418 | + reCalcEndTime.call(this); | |
| 419 | + } | |
| 420 | + reCalcMileageCount(); | |
| 421 | + } | |
| 422 | + | |
| 423 | + /** | |
| 424 | + * 计算结束时间 | |
| 425 | + */ | |
| 426 | + function reCalcEndTime() { | |
| 427 | + var f = $(this).parents('.sub_task_form_v2') | |
| 428 | + , startDate = $f('startDate', f).val()//开始时间 | |
| 429 | + , mileage = $f('mileage', f).val()//公里 | |
| 430 | + , type2 = $f('type2', f).val();//班次类型 | |
| 431 | + if (!startDate || !mileage) | |
| 432 | + return; | |
| 433 | + | |
| 434 | + var time; | |
| 435 | + //从站到场里获取数据 | |
| 436 | + var stp = search_st_park(f); | |
| 437 | + if(stp){ | |
| 438 | + mileage=type2==2?stp['mileage1']:stp['mileage2']; | |
| 439 | + time=type2==2?stp['time1']:stp['time2']; | |
| 440 | + } | |
| 441 | + else{ | |
| 442 | + if (type2 == 1) { | |
| 443 | + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | |
| 444 | + } | |
| 445 | + else if (type2 == 2) { | |
| 446 | + //进场 | |
| 447 | + var qdzCode = $f('startStation', f).val(), | |
| 448 | + updown = inout_updown(qdzCode, sch); | |
| 449 | + | |
| 450 | + if (updown == -1) | |
| 451 | + return; | |
| 452 | + time = updown == 0 ? information.upInTimer : information.downInTimer; | |
| 453 | + } | |
| 454 | + else if (type2 == 3) { | |
| 455 | + //出场 | |
| 456 | + var zdzCode = $f('endStation', f).val(), | |
| 457 | + updown = inout_updown(zdzCode, sch); | |
| 458 | + | |
| 459 | + if (updown == -1) | |
| 460 | + return; | |
| 461 | + time = updown == 0 ? information.upOutTimer : information.downOutTimer; | |
| 462 | + } | |
| 463 | + } | |
| 464 | + | |
| 465 | + var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | |
| 466 | + $f('endDate', f).val(et.format('HH:mm')).trigger('input'); | |
| 467 | + } | |
| 468 | + | |
| 469 | + /** | |
| 470 | + * 将结束时间写入下一个表单的开始时间 | |
| 471 | + */ | |
| 472 | + function reCalcNext_s_time() { | |
| 473 | + var f = $(this).parents('.sub_task_form_v2'), | |
| 474 | + et = $f('endDate', f).val(); | |
| 475 | + | |
| 476 | + var nf = gb_common.next_elem('sub_task_form_v2', f); | |
| 477 | + | |
| 478 | + if (f.attr('destroy')) | |
| 479 | + et = $f('startDate', f).val(); | |
| 480 | + | |
| 481 | + if (nf.length > 0) { | |
| 482 | + $f('startDate', nf).val(et).trigger('input'); | |
| 483 | + } | |
| 484 | + } | |
| 485 | + | |
| 486 | + /** | |
| 487 | + * 切换原因 | |
| 488 | + */ | |
| 489 | + function reSynchroReason() { | |
| 490 | + var f = $(this).parents('.sub_task_form_v2'), | |
| 491 | + reason = $(this).val(); | |
| 492 | + | |
| 493 | + var nf = gb_common.next_elem('sub_task_form_v2', f), | |
| 494 | + nInput = $f('reason', nf); | |
| 495 | + | |
| 496 | + if (nf.length > 0 && nInput.length > 0) { | |
| 497 | + nInput.val(reason).trigger('change'); | |
| 498 | + } | |
| 499 | + else { | |
| 500 | + var cont = f.parents('li.tab_cont'), | |
| 501 | + remInput = $('.remarks_form [name=remarks]', cont); | |
| 502 | + | |
| 503 | + if(remInput.val()==reason + ',') | |
| 504 | + return; | |
| 505 | + remInput.val(remInput.val() + reason + ','); | |
| 506 | + } | |
| 507 | + } | |
| 508 | + | |
| 509 | + function calcMileageByRoutes(routes, s, e) { | |
| 510 | + var code, flag, mileage = 0; | |
| 511 | + $.each(routes, function () { | |
| 512 | + code = this['stationCode']; | |
| 513 | + if (flag) { | |
| 514 | + if (!this.distances) | |
| 515 | + this.distances = 0; | |
| 516 | + mileage = gb_common.accAdd(mileage, this.distances); | |
| 517 | + } | |
| 518 | + if (code == s) | |
| 519 | + flag = true; | |
| 520 | + if (code == e) | |
| 521 | + return false; | |
| 522 | + }); | |
| 523 | + return mileage; | |
| 524 | + } | |
| 525 | + | |
| 526 | + function destroyClick() { | |
| 527 | + var f = $(this).parents('.sub_task_form_v2'); | |
| 528 | + if (this.checked) { | |
| 529 | + $('.destroy_reason_wrap', f).show(); | |
| 530 | + f.attr('destroy', true).addClass('destroy_form'); | |
| 531 | + } | |
| 532 | + else { | |
| 533 | + $('.destroy_reason_wrap', f).hide(); | |
| 534 | + f.removeAttr('destroy').removeClass('destroy_form'); | |
| 535 | + } | |
| 536 | + reCalcMileageCount(); | |
| 537 | + } | |
| 538 | + | |
| 539 | + function changeMileageType() { | |
| 540 | + var f = $(this).parents('.sub_task_form_v2'), | |
| 541 | + mileageType = $(this).val(); | |
| 542 | + if (mileageType) { | |
| 543 | + f.removeClass('service_form empty_form').addClass(mileageType + '_form'); | |
| 544 | + reCalcMileageCount(); | |
| 545 | + } | |
| 546 | + } | |
| 547 | + | |
| 548 | + function $f(name, f) { | |
| 549 | + return $('[name=' + name + ']', f); | |
| 550 | + } | |
| 551 | + | |
| 552 | + function closeTaskForm() { | |
| 553 | + $(this).parents('.sub_task_form_v2').remove(); | |
| 554 | + reCalcMileageCount(); | |
| 555 | + } | |
| 556 | + | |
| 557 | + /** | |
| 558 | + * 进出场上下行 | |
| 559 | + * @param qdzCode | |
| 560 | + * @param sch | |
| 561 | + */ | |
| 562 | + function inout_updown(station, sch) { | |
| 563 | + if (station == sch.qdzCode) | |
| 564 | + return sch.xlDir; | |
| 565 | + else if (station == sch.zdzCode) | |
| 566 | + return sch.xlDir == 0 ? 1 : 0; | |
| 567 | + else | |
| 568 | + return -1; | |
| 569 | + } | |
| 570 | + | |
| 571 | + function search_st_park(f) { | |
| 572 | + if(!st_park_data) | |
| 573 | + return; | |
| 574 | + var stp; | |
| 575 | + var qdSelect=$f('startStation', f)[0],zdSelect=$f('endStation', f)[0]; | |
| 576 | + | |
| 577 | + var qdzName=qdSelect.options[qdSelect.options.selectedIndex].text, | |
| 578 | + zdzName=zdSelect.options[zdSelect.options.selectedIndex].text, | |
| 579 | + type2 = $f('type2', f).val(); | |
| 580 | + | |
| 581 | + if(type2!=2 && type2!=3) | |
| 582 | + return; | |
| 583 | + | |
| 584 | + $.each(st_park_data, function () { | |
| 585 | + if((type2==2 && this.stationName==qdzName && this.parkName==zdzName) | |
| 586 | + || (type2==3 && this.stationName==zdzName && this.parkName==qdzName)){ | |
| 587 | + stp = this; | |
| 588 | + return false; | |
| 589 | + } | |
| 590 | + }); | |
| 591 | + | |
| 592 | + return stp; | |
| 593 | + } | |
| 594 | + | |
| 595 | + $('.left_tabs_lg', modal).on('show.uk.switcher', reCalcMileageCount); | |
| 596 | + | |
| 597 | + function reCalcMileageCount() { | |
| 598 | + $('.footer_mileage_count', modal).trigger('refresh'); | |
| 599 | + var f = $(this).parents('.sub_task_form_v2'); | |
| 600 | + if($f('type2',f).val()==1) | |
| 601 | + reCalcEndTime.call(this); | |
| 602 | + } | |
| 603 | + | |
| 604 | + | |
| 605 | + var folder = '/real_control_v2/fragments/line_schedule/context_menu'; | |
| 606 | + /** | |
| 607 | + * 弹出站 到 场对照表 | |
| 608 | + */ | |
| 609 | + $('.station_to_park_link', modal).on('click', function () { | |
| 610 | + open_modal(folder + '/utils/station_to_park.html', { | |
| 611 | + sch: sch | |
| 612 | + }, {center: false, bgclose: false, modal: false}); | |
| 613 | + }); | |
| 614 | + | |
| 615 | + /** | |
| 616 | + * 停车场排序 | |
| 617 | + * @param parks 停车场 code 2 name | |
| 618 | + * @param information 线路标准 | |
| 619 | + * @param st_park_data 站到场 | |
| 620 | + */ | |
| 621 | + function sort_parks(parks, information, st_park_data) { | |
| 622 | + var array = [], names=[]; | |
| 623 | + for(var code in parks){ | |
| 624 | + array.push({code: code, name: parks[code]}); | |
| 625 | + } | |
| 626 | + | |
| 627 | + if(st_park_data && st_park_data.length > 0){ | |
| 628 | + $.each(st_park_data, function () { | |
| 629 | + names.push(this.parkName); | |
| 630 | + }); | |
| 631 | + } | |
| 632 | + | |
| 633 | + //debugger | |
| 634 | + array.sort(function (a, b) { | |
| 635 | + if(a.code==information.carPark) | |
| 636 | + return -1; | |
| 637 | + if(b.code==information.carPark) | |
| 638 | + return 1; | |
| 639 | + | |
| 640 | + var ai = names.indexOf(a.name), | |
| 641 | + bi = names.indexOf(b.name); | |
| 642 | + | |
| 643 | + if(ai!=-1 && bi==-1) | |
| 644 | + return -1; | |
| 645 | + else if(ai==-1 && bi!=-1) | |
| 646 | + return 1; | |
| 647 | + else | |
| 648 | + return a.name.localeCompare(b.name); | |
| 649 | + }); | |
| 650 | + | |
| 651 | + /*var rs = {}; | |
| 652 | + $.each(array, function () { | |
| 653 | + rs[this.code]=this.name; | |
| 654 | + });*/ | |
| 655 | + | |
| 656 | + return array; | |
| 657 | + } | |
| 658 | + })(); | |
| 659 | + </script> | |
| 610 | 660 | </div> |
| 611 | 661 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/utils/station_to_park.html
| 1 | -<div class="uk-modal ct-form-modal" id="station_to_park-modal"> | |
| 2 | - <div class="uk-modal-dialog" style="width: 780px;"> | |
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | - <div class="uk-modal-header"> | |
| 5 | - <h2>站到场历时、公里对照表</h2></div> | |
| 6 | - | |
| 7 | - <div class="ct_lists"> | |
| 8 | - </div> | |
| 9 | - | |
| 10 | - <div class="ct_describe" >从历史的子任务、临加里采集进出场历时和公里</div> | |
| 11 | - </div> | |
| 12 | - | |
| 13 | - <script id="station_park_list-temp" type="text/html"> | |
| 14 | - {{each list as obj i}} | |
| 15 | - {{if obj.mileage1 != obj.mileage2}} | |
| 16 | - <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | |
| 17 | - <span class="ct_close"><i class="uk-icon-times"></i></span> | |
| 18 | - <form class="uk-form"> | |
| 19 | - {{if obj.time1!=null && obj.mileage1!=null}} | |
| 20 | - <div class="uk-grid"> | |
| 21 | - <div class="uk-width-1-4"> | |
| 22 | - <label class="">起点:</label> | |
| 23 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 24 | - </div> | |
| 25 | - <div class="uk-width-1-4"> | |
| 26 | - <label>终点:</label> | |
| 27 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 28 | - </div> | |
| 29 | - <div class="uk-width-2-4 uk-grid"> | |
| 30 | - <div class="uk-width-1-3"> | |
| 31 | - <label>历时:</label> | |
| 32 | - <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | |
| 33 | - </div> | |
| 34 | - <div class="uk-width-1-3"> | |
| 35 | - <label>公里:</label> | |
| 36 | - <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | |
| 37 | - </div> | |
| 38 | - <div class="uk-width-1-3"> | |
| 39 | - <label class="bottom_label">进场</label> | |
| 40 | - </div> | |
| 41 | - </div> | |
| 42 | - </div> | |
| 43 | - {{/if}} | |
| 44 | - {{if obj.time2!=null && obj.mileage2!=null}} | |
| 45 | - <div class="uk-grid"> | |
| 46 | - <div class="uk-width-1-4"> | |
| 47 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 48 | - </div> | |
| 49 | - <div class="uk-width-1-4"> | |
| 50 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 51 | - </div> | |
| 52 | - <div class="uk-width-2-4 uk-grid"> | |
| 53 | - <div class="uk-width-1-3"> | |
| 54 | - <input type="text" value="{{obj.time2}}" class="uk-width-1-1" readonly> | |
| 55 | - </div> | |
| 56 | - <div class="uk-width-1-3"> | |
| 57 | - <input type="text" value="{{obj.mileage2}}" class="uk-width-1-1" readonly> | |
| 58 | - </div> | |
| 59 | - <div class="uk-width-1-3"> | |
| 60 | - <label class="bottom_label_2">出场</label> | |
| 61 | - </div> | |
| 62 | - </div> | |
| 63 | - </div> | |
| 64 | - {{/if}} | |
| 65 | - </form> | |
| 66 | - </div> | |
| 67 | - {{else}} | |
| 68 | - <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | |
| 69 | - <span class="ct_close"><i class="uk-icon-times"></i></span> | |
| 70 | - <form class="uk-form"> | |
| 71 | - <div class="uk-grid"> | |
| 72 | - <div class="uk-width-1-4"> | |
| 73 | - <label class="">起点:</label> | |
| 74 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 75 | - </div> | |
| 76 | - <div class="uk-width-1-4"> | |
| 77 | - <label>终点:</label> | |
| 78 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 79 | - </div> | |
| 80 | - <div class="uk-width-2-4 uk-grid"> | |
| 81 | - <div class="uk-width-1-3"> | |
| 82 | - <label>历时:</label> | |
| 83 | - <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | |
| 84 | - </div> | |
| 85 | - <div class="uk-width-1-3"> | |
| 86 | - <label>公里:</label> | |
| 87 | - <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | |
| 88 | - </div> | |
| 89 | - <div class="uk-width-1-3"> | |
| 90 | - <label class="bottom_label"><input type="checkbox" disabled checked> 进=出 </label> | |
| 91 | - </div> | |
| 92 | - </div> | |
| 93 | - </div> | |
| 94 | - </form> | |
| 95 | - </div> | |
| 96 | - {{/if}} | |
| 97 | - {{/each}} | |
| 98 | - </script> | |
| 99 | - | |
| 100 | - <script> | |
| 101 | - (function () { | |
| 102 | - var modal = '#station_to_park-modal', sch; | |
| 103 | - | |
| 104 | - $(modal).on('init', function (e, data) { | |
| 105 | - e.stopPropagation(); | |
| 106 | - sch = data.sch; | |
| 107 | - | |
| 108 | - var list = gb_data_basic.get_stat_park_data()[sch.xlBm]; | |
| 109 | - if(!list) | |
| 110 | - return; | |
| 111 | - list.sort(function (a, b) { | |
| 112 | - return a.stationName.localeCompare(b.stationName); | |
| 113 | - }); | |
| 114 | - | |
| 115 | - var htmlStr = template('station_park_list-temp', {list: list}); | |
| 116 | - $('.ct_lists', modal).html(htmlStr); | |
| 117 | - }); | |
| 118 | - | |
| 119 | - $(modal).on('click', '.s_2_park_form_wrap>.ct_close', function () { | |
| 120 | - var wrap=$(this).parent(), | |
| 121 | - id=wrap.data('id'); | |
| 122 | - | |
| 123 | - gb_common.$post('/basic/deleteStation2Park', {lineCode: sch.xlBm, id: id}, function () { | |
| 124 | - gb_data_basic.reload_stat_park_data(); | |
| 125 | - wrap.remove(); | |
| 126 | - }); | |
| 127 | - }); | |
| 128 | - })(); | |
| 129 | - </script> | |
| 130 | -</div> | |
| 1 | +<div class="uk-modal ct-form-modal" id="station_to_park-modal"> | |
| 2 | + <div class="uk-modal-dialog" style="width: 780px;"> | |
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | + <div class="uk-modal-header"> | |
| 5 | + <h2>站到场历时、公里对照表</h2></div> | |
| 6 | + | |
| 7 | + <div class="ct_lists"> | |
| 8 | + </div> | |
| 9 | + | |
| 10 | + <div class="ct_describe" >从历史的子任务、临加里采集进出场历时和公里</div> | |
| 11 | + </div> | |
| 12 | + | |
| 13 | + <script id="station_park_list-temp" type="text/html"> | |
| 14 | + {{each list as obj i}} | |
| 15 | + {{if obj.mileage1 != obj.mileage2}} | |
| 16 | + <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | |
| 17 | + <span class="ct_close"><i class="uk-icon-times"></i></span> | |
| 18 | + <form class="uk-form"> | |
| 19 | + {{if obj.time1!=null && obj.mileage1!=null}} | |
| 20 | + <div class="uk-grid"> | |
| 21 | + <div class="uk-width-1-4"> | |
| 22 | + <label class="">起点:</label> | |
| 23 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 24 | + </div> | |
| 25 | + <div class="uk-width-1-4"> | |
| 26 | + <label>终点:</label> | |
| 27 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 28 | + </div> | |
| 29 | + <div class="uk-width-2-4 uk-grid"> | |
| 30 | + <div class="uk-width-1-3"> | |
| 31 | + <label>历时:</label> | |
| 32 | + <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | |
| 33 | + </div> | |
| 34 | + <div class="uk-width-1-3"> | |
| 35 | + <label>公里:</label> | |
| 36 | + <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | |
| 37 | + </div> | |
| 38 | + <div class="uk-width-1-3"> | |
| 39 | + <label class="bottom_label">进场</label> | |
| 40 | + </div> | |
| 41 | + </div> | |
| 42 | + </div> | |
| 43 | + {{/if}} | |
| 44 | + {{if obj.time2!=null && obj.mileage2!=null}} | |
| 45 | + <div class="uk-grid"> | |
| 46 | + <div class="uk-width-1-4"> | |
| 47 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 48 | + </div> | |
| 49 | + <div class="uk-width-1-4"> | |
| 50 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 51 | + </div> | |
| 52 | + <div class="uk-width-2-4 uk-grid"> | |
| 53 | + <div class="uk-width-1-3"> | |
| 54 | + <input type="text" value="{{obj.time2}}" class="uk-width-1-1" readonly> | |
| 55 | + </div> | |
| 56 | + <div class="uk-width-1-3"> | |
| 57 | + <input type="text" value="{{obj.mileage2}}" class="uk-width-1-1" readonly> | |
| 58 | + </div> | |
| 59 | + <div class="uk-width-1-3"> | |
| 60 | + <label class="bottom_label_2">出场</label> | |
| 61 | + </div> | |
| 62 | + </div> | |
| 63 | + </div> | |
| 64 | + {{/if}} | |
| 65 | + </form> | |
| 66 | + </div> | |
| 67 | + {{else}} | |
| 68 | + <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | |
| 69 | + <span class="ct_close"><i class="uk-icon-times"></i></span> | |
| 70 | + <form class="uk-form"> | |
| 71 | + <div class="uk-grid"> | |
| 72 | + <div class="uk-width-1-4"> | |
| 73 | + <label class="">起点:</label> | |
| 74 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | |
| 75 | + </div> | |
| 76 | + <div class="uk-width-1-4"> | |
| 77 | + <label>终点:</label> | |
| 78 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | |
| 79 | + </div> | |
| 80 | + <div class="uk-width-2-4 uk-grid"> | |
| 81 | + <div class="uk-width-1-3"> | |
| 82 | + <label>历时:</label> | |
| 83 | + <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | |
| 84 | + </div> | |
| 85 | + <div class="uk-width-1-3"> | |
| 86 | + <label>公里:</label> | |
| 87 | + <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | |
| 88 | + </div> | |
| 89 | + <div class="uk-width-1-3"> | |
| 90 | + <label class="bottom_label"><input type="checkbox" disabled checked> 进=出 </label> | |
| 91 | + </div> | |
| 92 | + </div> | |
| 93 | + </div> | |
| 94 | + </form> | |
| 95 | + </div> | |
| 96 | + {{/if}} | |
| 97 | + {{/each}} | |
| 98 | + </script> | |
| 99 | + | |
| 100 | + <script> | |
| 101 | + (function () { | |
| 102 | + var modal = '#station_to_park-modal', sch; | |
| 103 | + | |
| 104 | + $(modal).on('init', function (e, data) { | |
| 105 | + e.stopPropagation(); | |
| 106 | + sch = data.sch; | |
| 107 | + | |
| 108 | + var list = gb_data_basic.get_stat_park_data()[sch.xlBm]; | |
| 109 | + if(!list) | |
| 110 | + return; | |
| 111 | + list.sort(function (a, b) { | |
| 112 | + return a.stationName.localeCompare(b.stationName); | |
| 113 | + }); | |
| 114 | + | |
| 115 | + var htmlStr = template('station_park_list-temp', {list: list}); | |
| 116 | + $('.ct_lists', modal).html(htmlStr); | |
| 117 | + }); | |
| 118 | + | |
| 119 | + $(modal).on('click', '.s_2_park_form_wrap>.ct_close', function () { | |
| 120 | + var wrap=$(this).parent(), | |
| 121 | + id=wrap.data('id'); | |
| 122 | + | |
| 123 | + gb_common.$post('/basic/deleteStation2Park', {lineCode: sch.xlBm, id: id}, function () { | |
| 124 | + gb_data_basic.reload_stat_park_data(); | |
| 125 | + wrap.remove(); | |
| 126 | + }); | |
| 127 | + }); | |
| 128 | + })(); | |
| 129 | + </script> | |
| 130 | +</div> | ... | ... |
src/main/resources/static/real_control_v2/js/common.js
| ... | ... | @@ -22,7 +22,7 @@ var gb_common = (function () { |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; |
| 25 | - var inOutExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | |
| 25 | + var inOutExps = ['故障', '肇事', '纠纷', '其他']; | |
| 26 | 26 | |
| 27 | 27 | var groupBy = function (list, field) { |
| 28 | 28 | var rs = {}, | ... | ... |
src/main/resources/static/real_control_v2/sch_manage/sch_imitate.html
| ... | ... | @@ -379,15 +379,33 @@ |
| 379 | 379 | } |
| 380 | 380 | alt_confirm('确定班次信息? ' + sch.xlName + '、起点 ' + sch.qdzName + ' , 终点 ' + sch.zdzName + ' 、待发 ' + sch.dfsj, function () { |
| 381 | 381 | $('.shade-loading').show(); |
| 382 | - gb_common.$post('/gps/gpsCompletion', {schId: schId}, function (rs) { | |
| 382 | + gb_common.$post('/gps/gpsCompletion', {schId: schId, type: 0}, function (rs) { | |
| 383 | 383 | $('.shade-loading').hide(); |
| 384 | 384 | $('.search-form').trigger('submit'); |
| 385 | 385 | }); |
| 386 | 386 | }, '我确定是这个班次'); |
| 387 | 387 | }; |
| 388 | 388 | |
| 389 | + var gps_imitate_after = function (schId) { | |
| 390 | + var sch = schArray[schId]; | |
| 391 | + if(sch.reissue){ | |
| 392 | + UIkit.notify("<i class='uk-icon-times'></i> 你不能对一个班次重复操作!", { | |
| 393 | + status: 'danger' | |
| 394 | + }); | |
| 395 | + return; | |
| 396 | + } | |
| 397 | + alt_confirm('确定补传班次信息? ' + sch.xlName + '、起点 ' + sch.qdzName + ' , 终点 ' + sch.zdzName + ' 、待发 ' + sch.dfsj, function () { | |
| 398 | + $('.shade-loading').show(); | |
| 399 | + gb_common.$post('/gps/gpsCompletion', {schId: schId, type: 1}, function (rs) { | |
| 400 | + $('.shade-loading').hide(); | |
| 401 | + $('.search-form').trigger('submit'); | |
| 402 | + }); | |
| 403 | + }, '我确定补传这个班次'); | |
| 404 | + } | |
| 405 | + | |
| 389 | 406 | var callbackHandler = { |
| 390 | - gps_imitate: gps_imitate | |
| 407 | + gps_imitate: gps_imitate, | |
| 408 | + gps_imitate_after: gps_imitate_after | |
| 391 | 409 | } |
| 392 | 410 | |
| 393 | 411 | $.contextMenu({ |
| ... | ... | @@ -399,7 +417,11 @@ |
| 399 | 417 | }, |
| 400 | 418 | items: { |
| 401 | 419 | 'gps_imitate': { |
| 402 | - name: '模拟轨迹' | |
| 420 | + name: '模拟轨迹(事前)' | |
| 421 | + | |
| 422 | + }, | |
| 423 | + 'gps_imitate_after':{ | |
| 424 | + name: '模拟轨迹(事后补传)' | |
| 403 | 425 | } |
| 404 | 426 | } |
| 405 | 427 | }); | ... | ... |