Commit 885ed4594c73cd48fc42578078012912577e4dc4
Merge branch 'minhang' into pudong
Showing
20 changed files
with
1737 additions
and
1630 deletions
Too many changes to show.
To preserve performance only 20 of 24 files are displayed.
src/main/java/com/bsth/controller/gps/GpsController.java
| @@ -91,11 +91,12 @@ public class GpsController { | @@ -91,11 +91,12 @@ public class GpsController { | ||
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| 93 | * gps补全 | 93 | * gps补全 |
| 94 | + * type 0 : 实时GPS 1:走补传 | ||
| 94 | * @return | 95 | * @return |
| 95 | */ | 96 | */ |
| 96 | @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST) | 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,7 +2,6 @@ package com.bsth.data.pilot80; | ||
| 2 | 2 | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | import com.bsth.data.LineConfigData; | 4 | import com.bsth.data.LineConfigData; |
| 5 | -import com.bsth.data.gpsdata.GpsEntity; | ||
| 6 | import com.bsth.data.gpsdata.GpsRealData; | 5 | import com.bsth.data.gpsdata.GpsRealData; |
| 7 | import com.bsth.data.msg_queue.DirectivePushQueue; | 6 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 8 | import com.bsth.data.schedule.DayOfSchedule; | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| @@ -16,7 +15,6 @@ import com.bsth.repository.directive.D80Repository; | @@ -16,7 +15,6 @@ import com.bsth.repository.directive.D80Repository; | ||
| 16 | import com.bsth.repository.directive.DC0A4Repository; | 15 | import com.bsth.repository.directive.DC0A4Repository; |
| 17 | import com.bsth.service.directive.DirectiveService; | 16 | import com.bsth.service.directive.DirectiveService; |
| 18 | import com.bsth.websocket.handler.SendUtils; | 17 | import com.bsth.websocket.handler.SendUtils; |
| 19 | -import com.google.common.collect.ArrayListMultimap; | ||
| 20 | import org.apache.commons.lang3.StringUtils; | 18 | import org.apache.commons.lang3.StringUtils; |
| 21 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
| @@ -26,289 +24,278 @@ import org.springframework.stereotype.Component; | @@ -26,289 +24,278 @@ import org.springframework.stereotype.Component; | ||
| 26 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
| 27 | import java.util.Collection; | 25 | import java.util.Collection; |
| 28 | import java.util.List; | 26 | import java.util.List; |
| 27 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 29 | 28 | ||
| 30 | /** | 29 | /** |
| 31 | - * | ||
| 32 | - * @ClassName: PilotReport | ||
| 33 | - * @Description: TODO(设备80协议上报处理) | ||
| 34 | * @author PanZhao | 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 | @Component | 35 | @Component |
| 39 | public class PilotReport { | 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 | package com.bsth.entity.directive; | 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 | import com.bsth.entity.directive.DC0.DC0Data; | 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 | * @ClassName: D80 | 10 | * @ClassName: D80 |
| @@ -92,7 +80,7 @@ public class 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,13 +104,6 @@ public class D80 { | ||
| 116 | this.requestCode = requestCode; | 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 | public String getNbbm() { | 108 | public String getNbbm() { |
| 128 | return nbbm; | 109 | return nbbm; |
| @@ -131,6 +112,14 @@ public class D80 { | @@ -131,6 +112,14 @@ public class D80 { | ||
| 131 | public void setNbbm(String nbbm) { | 112 | public void setNbbm(String nbbm) { |
| 132 | this.nbbm = nbbm; | 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 | @Transient | 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,7 +302,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 302 | 302 | ||
| 303 | Map<String, List<D80>> rs = new HashMap<>(); | 303 | Map<String, List<D80>> rs = new HashMap<>(); |
| 304 | for (String code : lineList) | 304 | for (String code : lineList) |
| 305 | - rs.put(code, pilotReport.unconfirmed80(Integer.parseInt(code))); | 305 | + rs.put(code, pilotReport.unconfirmed80(code)); |
| 306 | 306 | ||
| 307 | return rs; | 307 | return rs; |
| 308 | } | 308 | } |
src/main/java/com/bsth/service/gps/GpsService.java
| @@ -21,7 +21,7 @@ public interface GpsService { | @@ -21,7 +21,7 @@ public interface GpsService { | ||
| 21 | 21 | ||
| 22 | Map<String,Object> findRoadSpeed(String lineCode); | 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 | Map<String,Object> history_v2(String nbbm, long st, long et); | 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,7 +445,7 @@ public class GpsServiceImpl implements GpsService { | ||
| 445 | * @return | 445 | * @return |
| 446 | */ | 446 | */ |
| 447 | @Override | 447 | @Override |
| 448 | - public Map<String, Object> gpsCompletion(long schId) { | 448 | + public Map<String, Object> gpsCompletion(long schId, int type) { |
| 449 | Map<String, Object> rs = new HashMap<>(); | 449 | Map<String, Object> rs = new HashMap<>(); |
| 450 | 450 | ||
| 451 | try { | 451 | try { |
| @@ -482,9 +482,15 @@ public class GpsServiceImpl implements GpsService { | @@ -482,9 +482,15 @@ public class GpsServiceImpl implements GpsService { | ||
| 482 | long diff = ((sch.getDfsjT() - Long.parseLong(fs.get("ts").toString())) - 1000 * 70); | 482 | long diff = ((sch.getDfsjT() - Long.parseLong(fs.get("ts").toString())) - 1000 * 70); |
| 483 | 483 | ||
| 484 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); | 484 | String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); |
| 485 | + int serviceState; | ||
| 485 | for (Map<String, Object> map : list) { | 486 | for (Map<String, Object> map : list) { |
| 486 | map.put("device_id", deviceId); | 487 | map.put("device_id", deviceId); |
| 487 | map.put("ts", Long.parseLong(map.get("ts").toString()) + diff); | 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 | String sqlBefore = "insert into bsth_c_template(", sqlValues = " values("; | 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 +17,24 @@ import java.util.List; | ||
| 17 | import java.util.Map; | 17 | import java.util.Map; |
| 18 | import java.util.Set; | 18 | import java.util.Set; |
| 19 | 19 | ||
| 20 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 21 | import org.springframework.jdbc.core.JdbcTemplate; | 23 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | import org.springframework.jdbc.core.RowMapper; | 24 | import org.springframework.jdbc.core.RowMapper; |
| 23 | import org.springframework.stereotype.Service; | 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 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 31 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 26 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 27 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 33 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 28 | import com.bsth.service.BusIntervalService; | 34 | import com.bsth.service.BusIntervalService; |
| 29 | import com.bsth.service.schedule.PeopleCarPlanService; | 35 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 30 | import com.bsth.util.ReportUtils; | 36 | import com.bsth.util.ReportUtils; |
| 37 | +import com.google.gson.Gson; | ||
| 31 | 38 | ||
| 32 | 39 | ||
| 33 | @Service | 40 | @Service |
| @@ -666,10 +673,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -666,10 +673,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 666 | if(sfqr == 1){ | 673 | if(sfqr == 1){ |
| 667 | where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; | 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 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" | 679 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" |
| 674 | + " from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'" | 680 | + " from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'" |
| 675 | + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+""; | 681 | + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+""; |
| @@ -693,7 +699,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -693,7 +699,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 693 | schedule.setZdsjActual(rs.getString("zdsj_actual")); | 699 | schedule.setZdsjActual(rs.getString("zdsj_actual")); |
| 694 | schedule.setQdzName(rs.getString("qdz_name")); | 700 | schedule.setQdzName(rs.getString("qdz_name")); |
| 695 | schedule.setZdzName(rs.getString("zdz_name")); | 701 | schedule.setZdzName(rs.getString("zdz_name")); |
| 696 | - schedule.setBcType(rs.getString("bc_type")); | ||
| 697 | schedule.setXlDir(rs.getString("xl_dir")); | 702 | schedule.setXlDir(rs.getString("xl_dir")); |
| 698 | schedule.setStatus(rs.getInt("status")); | 703 | schedule.setStatus(rs.getInt("status")); |
| 699 | schedule.setRemarks(rs.getString("remarks")); | 704 | schedule.setRemarks(rs.getString("remarks")); |
| @@ -827,7 +832,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -827,7 +832,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 827 | if(model.length() != 0){ | 832 | if(model.length() != 0){ |
| 828 | sql = "select sp.id from " | 833 | sql = "select sp.id from " |
| 829 | + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'" | 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 | + " 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"; | 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 | ttList = jdbcTemplate.query(sql, | 838 | ttList = jdbcTemplate.query(sql, |
| @@ -910,7 +915,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -910,7 +915,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 910 | for(String key : keyMap.keySet()){ | 915 | for(String key : keyMap.keySet()){ |
| 911 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 916 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 912 | Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); | 917 | Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>(); |
| 913 | - Map<Long, Map<String, Object>> sortMap1 = new HashMap<Long, Map<String, Object>>(); | ||
| 914 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | 918 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 915 | List<Long> keyList = new ArrayList<Long>(); | 919 | List<Long> keyList = new ArrayList<Long>(); |
| 916 | List<Long> keyList2 = new ArrayList<Long>(); | 920 | List<Long> keyList2 = new ArrayList<Long>(); |
| @@ -942,25 +946,30 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -942,25 +946,30 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 942 | for(int i = 1; i < keyList.size(); i++){ | 946 | for(int i = 1; i < keyList.size(); i++){ |
| 943 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); | 947 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); |
| 944 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); | 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 | }else{ | 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 | long zdsj1 = schedule1.getZdsjT(); | 973 | long zdsj1 = schedule1.getZdsjT(); |
| 965 | long fcsj1 = schedule1.getFcsjT(); | 974 | long fcsj1 = schedule1.getFcsjT(); |
| 966 | if(fcsj1 > zdsj1) | 975 | if(fcsj1 > zdsj1) |
| @@ -975,27 +984,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -975,27 +984,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 975 | jhyssj1 += zdsj1 - fcsj1; | 984 | jhyssj1 += zdsj1 - fcsj1; |
| 976 | jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc(); | 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 | for(int i = 0; i < keyList.size(); i++){ | 989 | for(int i = 0; i < keyList.size(); i++){ |
| 996 | Map<String, Object> m = new HashMap<String, Object>(); | 990 | Map<String, Object> m = new HashMap<String, Object>(); |
| 997 | ScheduleRealInfo schedule = sortMap.get(keyList.get(i)); | 991 | ScheduleRealInfo schedule = sortMap.get(keyList.get(i)); |
| 998 | - | 992 | + |
| 999 | if(cMap.containsKey(schedule.getId())){ | 993 | if(cMap.containsKey(schedule.getId())){ |
| 1000 | List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); | 994 | List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); |
| 1001 | for(ChildTaskPlan childTaskPlan : cTasks){ | 995 | for(ChildTaskPlan childTaskPlan : cTasks){ |
| @@ -1018,7 +1012,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1018,7 +1012,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1018 | temp.put("fcsj", null); | 1012 | temp.put("fcsj", null); |
| 1019 | } | 1013 | } |
| 1020 | } | 1014 | } |
| 1021 | - temp.put("bcType", schedule.getBcType()); | ||
| 1022 | mapList.add(temp); | 1015 | mapList.add(temp); |
| 1023 | } | 1016 | } |
| 1024 | }else{ | 1017 | }else{ |
| @@ -1036,7 +1029,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1036,7 +1029,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1036 | m.put("zdsj", null); | 1029 | m.put("zdsj", null); |
| 1037 | m.put("fcsj", null); | 1030 | m.put("fcsj", null); |
| 1038 | } | 1031 | } |
| 1039 | - m.put("bcType", schedule.getBcType()); | ||
| 1040 | mapList.add(m); | 1032 | mapList.add(m); |
| 1041 | } | 1033 | } |
| 1042 | } | 1034 | } |
| @@ -1044,7 +1036,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1044,7 +1036,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1044 | for(Map<String, Object> m : mapList){ | 1036 | for(Map<String, Object> m : mapList){ |
| 1045 | if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){ | 1037 | if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){ |
| 1046 | keyList2.add(Long.valueOf(m.get("fcsj").toString())); | 1038 | keyList2.add(Long.valueOf(m.get("fcsj").toString())); |
| 1047 | - sortMap1.put(Long.valueOf(m.get("fcsj").toString()), m); | ||
| 1048 | } | 1039 | } |
| 1049 | } | 1040 | } |
| 1050 | Collections.sort(keyList2); | 1041 | Collections.sort(keyList2); |
| @@ -1052,31 +1043,36 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1052,31 +1043,36 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1052 | for(int i = 1; i < keyList2.size(); i++){ | 1043 | for(int i = 1; i < keyList2.size(); i++){ |
| 1053 | long fcsj1 = keyList2.get(i - 1); | 1044 | long fcsj1 = keyList2.get(i - 1); |
| 1054 | long fcsj2 = keyList2.get(i); | 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 | if(fcsj > zdsj) | 1076 | if(fcsj > zdsj) |
| 1081 | zdsj += 1440l; | 1077 | zdsj += 1440l; |
| 1082 | if(sfqr == 1 && time1 > fcsj){ | 1078 | if(sfqr == 1 && time1 > fcsj){ |
| @@ -1087,7 +1083,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1087,7 +1083,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1087 | sjyssj += zdsj - fcsj; | 1083 | sjyssj += zdsj - fcsj; |
| 1088 | } | 1084 | } |
| 1089 | sjyssj1 += zdsj - fcsj; | 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 | tempMap.put("company", companyName); | 1104 | tempMap.put("company", companyName); |
| @@ -1834,7 +1845,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1834,7 +1845,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1834 | } | 1845 | } |
| 1835 | try { | 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 | if(line.length() != 0){ | 1850 | if(line.length() != 0){ |
| 1839 | sql += " and xl_bm = '"+line+"'"; | 1851 | sql += " and xl_bm = '"+line+"'"; |
| 1840 | } | 1852 | } |
| @@ -1861,6 +1873,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1861,6 +1873,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1861 | public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | 1873 | public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 1862 | ScheduleRealInfo schedule = new ScheduleRealInfo(); | 1874 | ScheduleRealInfo schedule = new ScheduleRealInfo(); |
| 1863 | schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | 1875 | schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); |
| 1876 | + schedule.setXlBm(rs.getString("xl_bm")); | ||
| 1864 | schedule.setXlName(rs.getString("xl_name")); | 1877 | schedule.setXlName(rs.getString("xl_name")); |
| 1865 | schedule.setLpName(rs.getString("lp_name")); | 1878 | schedule.setLpName(rs.getString("lp_name")); |
| 1866 | schedule.setBcType(rs.getString("bc_type")); | 1879 | schedule.setBcType(rs.getString("bc_type")); |
| @@ -1914,7 +1927,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1914,7 +1927,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1914 | for(ScheduleRealInfo schedule : list){ | 1927 | for(ScheduleRealInfo schedule : list){ |
| 1915 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) | 1928 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) |
| 1916 | continue; | 1929 | continue; |
| 1917 | - String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); | 1930 | + String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); |
| 1918 | if(!keyMap.containsKey(key)) | 1931 | if(!keyMap.containsKey(key)) |
| 1919 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1932 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1920 | keyMap.get(key).add(schedule); | 1933 | keyMap.get(key).add(schedule); |
| @@ -1925,8 +1938,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1925,8 +1938,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1925 | int sjbc = 0, sddf = 0, zddf = 0, | 1938 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1926 | dxtz = 0, lbtz = 0; | 1939 | dxtz = 0, lbtz = 0; |
| 1927 | for(ScheduleRealInfo schedule : keyMap.get(key)){ | 1940 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 1941 | + boolean flag = false; | ||
| 1928 | if(schedule.getFcsjActual() != null && schedule.getStatus() != -1){ | 1942 | if(schedule.getFcsjActual() != null && schedule.getStatus() != -1){ |
| 1929 | - boolean flag = false; | ||
| 1930 | sjbc++; | 1943 | sjbc++; |
| 1931 | if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){ | 1944 | if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){ |
| 1932 | flag = true; | 1945 | flag = true; |
| @@ -1935,17 +1948,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1935,17 +1948,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1935 | zddf++; | 1948 | zddf++; |
| 1936 | else | 1949 | else |
| 1937 | sddf++; | 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 | tempMap.put("date", date); | 1962 | tempMap.put("date", date); |
| 1951 | String[] keys = key.split("/"); | 1963 | String[] keys = key.split("/"); |
| @@ -1956,22 +1968,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1956,22 +1968,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1956 | tempMap.put("sddf", sddf); | 1968 | tempMap.put("sddf", sddf); |
| 1957 | tempMap.put("zddf", zddf); | 1969 | tempMap.put("zddf", zddf); |
| 1958 | tempMap.put("dfhj", sddf + zddf); | 1970 | tempMap.put("dfhj", sddf + zddf); |
| 1959 | - tempMap.put("dxtz", dxtz); | 1971 | +// tempMap.put("dxtz", dxtz); |
| 1960 | tempMap.put("lbtz", lbtz); | 1972 | tempMap.put("lbtz", lbtz); |
| 1961 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | 1973 | + tempMap.put("correct", sddf + zddf + lbtz); |
| 1962 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); | 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 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); | 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 | String key0 = keys[0] + "/" + keys[1]; | 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 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1988 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1976 | int sjbc = 0, sddf = 0, zddf = 0, | 1989 | int sjbc = 0, sddf = 0, zddf = 0, |
| 1977 | dxtz = 0, lbtz = 0; | 1990 | dxtz = 0, lbtz = 0; |
| @@ -1979,7 +1992,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1979,7 +1992,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1979 | sjbc += (int)m.get("sjbc"); | 1992 | sjbc += (int)m.get("sjbc"); |
| 1980 | sddf += (int)m.get("sddf"); | 1993 | sddf += (int)m.get("sddf"); |
| 1981 | zddf += (int)m.get("zddf"); | 1994 | zddf += (int)m.get("zddf"); |
| 1982 | - dxtz += (int)m.get("dxtz"); | 1995 | +// dxtz += (int)m.get("dxtz"); |
| 1983 | lbtz += (int)m.get("lbtz"); | 1996 | lbtz += (int)m.get("lbtz"); |
| 1984 | } | 1997 | } |
| 1985 | tempMap.put("date", date); | 1998 | tempMap.put("date", date); |
| @@ -1991,22 +2004,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1991,22 +2004,22 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1991 | tempMap.put("sddf", sddf); | 2004 | tempMap.put("sddf", sddf); |
| 1992 | tempMap.put("zddf", zddf); | 2005 | tempMap.put("zddf", zddf); |
| 1993 | tempMap.put("dfhj", sddf + zddf); | 2006 | tempMap.put("dfhj", sddf + zddf); |
| 1994 | - tempMap.put("dxtz", dxtz); | 2007 | +// tempMap.put("dxtz", dxtz); |
| 1995 | tempMap.put("lbtz", lbtz); | 2008 | tempMap.put("lbtz", lbtz); |
| 1996 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); | 2009 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 1997 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); | 2010 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 1998 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | 2011 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 1999 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); | 2012 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2000 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | 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 | String key1 = keys[0]; | 2016 | String key1 = keys[0]; |
| 2004 | if(!keyMap1.containsKey(key1)) | 2017 | if(!keyMap1.containsKey(key1)) |
| 2005 | keyMap1.put(key1, new ArrayList<Map<String, Object>>()); | 2018 | keyMap1.put(key1, new ArrayList<Map<String, Object>>()); |
| 2006 | keyMap1.get(key1).add(tempMap); | 2019 | keyMap1.get(key1).add(tempMap); |
| 2007 | - } | 2020 | + }*/ |
| 2008 | 2021 | ||
| 2009 | - for(String key : keyMap1.keySet()){ | 2022 | + /*for(String key : keyMap1.keySet()){ |
| 2010 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 2023 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 2011 | int sjbc = 0, sddf = 0, zddf = 0, | 2024 | int sjbc = 0, sddf = 0, zddf = 0, |
| 2012 | dxtz = 0, lbtz = 0, lines = 0; | 2025 | dxtz = 0, lbtz = 0, lines = 0; |
| @@ -2014,7 +2027,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2014,7 +2027,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2014 | sjbc += (int)m.get("sjbc"); | 2027 | sjbc += (int)m.get("sjbc"); |
| 2015 | sddf += (int)m.get("sddf"); | 2028 | sddf += (int)m.get("sddf"); |
| 2016 | zddf += (int)m.get("zddf"); | 2029 | zddf += (int)m.get("zddf"); |
| 2017 | - dxtz += (int)m.get("dxtz"); | 2030 | +// dxtz += (int)m.get("dxtz"); |
| 2018 | lbtz += (int)m.get("lbtz"); | 2031 | lbtz += (int)m.get("lbtz"); |
| 2019 | lines += (int)m.get("lines"); | 2032 | lines += (int)m.get("lines"); |
| 2020 | } | 2033 | } |
| @@ -2025,17 +2038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2025,17 +2038,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2025 | tempMap.put("sddf", sddf); | 2038 | tempMap.put("sddf", sddf); |
| 2026 | tempMap.put("zddf", zddf); | 2039 | tempMap.put("zddf", zddf); |
| 2027 | tempMap.put("dfhj", sddf + zddf); | 2040 | tempMap.put("dfhj", sddf + zddf); |
| 2028 | - tempMap.put("dxtz", dxtz); | 2041 | +// tempMap.put("dxtz", dxtz); |
| 2029 | tempMap.put("lbtz", lbtz); | 2042 | tempMap.put("lbtz", lbtz); |
| 2030 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); | 2043 | tempMap.put("correct", sddf + zddf + dxtz + lbtz); |
| 2031 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); | 2044 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2032 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | 2045 | tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); |
| 2033 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); | 2046 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); |
| 2034 | tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | 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 | resList.add(tempMap); | 2050 | resList.add(tempMap); |
| 2038 | - } | 2051 | + }*/ |
| 2039 | 2052 | ||
| 2040 | if(resList.size() != 0){ | 2053 | if(resList.size() != 0){ |
| 2041 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 2054 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| @@ -2045,10 +2058,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2045,10 +2058,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2045 | sjbc += (int)m.get("sjbc"); | 2058 | sjbc += (int)m.get("sjbc"); |
| 2046 | sddf += (int)m.get("sddf"); | 2059 | sddf += (int)m.get("sddf"); |
| 2047 | zddf += (int)m.get("zddf"); | 2060 | zddf += (int)m.get("zddf"); |
| 2048 | - dxtz += (int)m.get("dxtz"); | 2061 | +// dxtz += (int)m.get("dxtz"); |
| 2049 | lbtz += (int)m.get("lbtz"); | 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 | Map<String, Object> temp = new HashMap<String, Object>(); | 2065 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2053 | temp.put("date", "合计"); | 2066 | temp.put("date", "合计"); |
| 2054 | temp.put("lines", m0.get("lines")); | 2067 | temp.put("lines", m0.get("lines")); |
| @@ -2056,15 +2069,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2056,15 +2069,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2056 | temp.put("sddf", m0.get("sddf")); | 2069 | temp.put("sddf", m0.get("sddf")); |
| 2057 | temp.put("zddf", m0.get("zddf")); | 2070 | temp.put("zddf", m0.get("zddf")); |
| 2058 | temp.put("dfhj", m0.get("dfhj")); | 2071 | temp.put("dfhj", m0.get("dfhj")); |
| 2059 | - temp.put("dxtz", m0.get("dxtz")); | 2072 | +// temp.put("dxtz", m0.get("dxtz")); |
| 2060 | temp.put("lbtz", m0.get("lbtz")); | 2073 | temp.put("lbtz", m0.get("lbtz")); |
| 2061 | temp.put("correct", m0.get("correct")); | 2074 | temp.put("correct", m0.get("correct")); |
| 2062 | temp.put("dfbl", m0.get("dfbl")); | 2075 | temp.put("dfbl", m0.get("dfbl")); |
| 2063 | temp.put("dxbl", m0.get("dxbl")); | 2076 | temp.put("dxbl", m0.get("dxbl")); |
| 2064 | temp.put("lbbl", m0.get("lbbl")); | 2077 | temp.put("lbbl", m0.get("lbbl")); |
| 2065 | temp.put("correctbl", m0.get("correctbl")); | 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 | Map<String, Object> temp = new HashMap<String, Object>(); | 2081 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2069 | temp.put("date", "合计"); | 2082 | temp.put("date", "合计"); |
| 2070 | temp.put("lines", m.get("lines")); | 2083 | temp.put("lines", m.get("lines")); |
| @@ -2072,14 +2085,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2072,14 +2085,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2072 | temp.put("sddf", m.get("sddf")); | 2085 | temp.put("sddf", m.get("sddf")); |
| 2073 | temp.put("zddf", m.get("zddf")); | 2086 | temp.put("zddf", m.get("zddf")); |
| 2074 | temp.put("dfhj", m.get("dfhj")); | 2087 | temp.put("dfhj", m.get("dfhj")); |
| 2075 | - temp.put("dxtz", m.get("dxtz")); | 2088 | +// temp.put("dxtz", m.get("dxtz")); |
| 2076 | temp.put("lbtz", m.get("lbtz")); | 2089 | temp.put("lbtz", m.get("lbtz")); |
| 2077 | temp.put("correct", m.get("correct")); | 2090 | temp.put("correct", m.get("correct")); |
| 2078 | temp.put("dfbl", m.get("dfbl")); | 2091 | temp.put("dfbl", m.get("dfbl")); |
| 2079 | temp.put("dxbl", m.get("dxbl")); | 2092 | temp.put("dxbl", m.get("dxbl")); |
| 2080 | temp.put("lbbl", m.get("lbbl")); | 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 | tempMap.put("date", "合计"); | 2097 | tempMap.put("date", "合计"); |
| 2085 | tempMap.put("lines", lines); | 2098 | tempMap.put("lines", lines); |
| @@ -2087,16 +2100,99 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2087,16 +2100,99 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2087 | tempMap.put("sddf", sddf); | 2100 | tempMap.put("sddf", sddf); |
| 2088 | tempMap.put("zddf", zddf); | 2101 | tempMap.put("zddf", zddf); |
| 2089 | tempMap.put("dfhj", sddf + zddf); | 2102 | tempMap.put("dfhj", sddf + zddf); |
| 2090 | - tempMap.put("dxtz", dxtz); | 2103 | +// tempMap.put("dxtz", dxtz); |
| 2091 | tempMap.put("lbtz", lbtz); | 2104 | tempMap.put("lbtz", lbtz); |
| 2092 | - tempMap.put("correct", sddf + zddf + dxtz + lbtz); | 2105 | + tempMap.put("correct", sddf + zddf + lbtz); |
| 2093 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); | 2106 | tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%"); |
| 2094 | - tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%"); | 2107 | + |
| 2095 | tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%"); | 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 | resList.add(tempMap); | 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 | return resList; | 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,25 +668,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 668 | * @return String | 668 | * @return String |
| 669 | */ | 669 | */ |
| 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 671 | - | ||
| 672 | // 返回值String | 671 | // 返回值String |
| 673 | String stationRStr = ""; | 672 | String stationRStr = ""; |
| 674 | - | ||
| 675 | // windows下的文本文件换行符 | 673 | // windows下的文本文件换行符 |
| 676 | //String enterStr = "\r\n"; | 674 | //String enterStr = "\r\n"; |
| 677 | - | ||
| 678 | // linux/unix下的文本文件换行符 | 675 | // linux/unix下的文本文件换行符 |
| 679 | String enterStr = "\r"; | 676 | String enterStr = "\r"; |
| 680 | - | 677 | + int defaultZdxh = 0; |
| 681 | if(objects.size()>0) { | 678 | if(objects.size()>0) { |
| 682 | - | ||
| 683 | for(int i = 0; i<objects.size();i++) { | 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 | lat = "\t" + lat; | 689 | lat = "\t" + lat; |
| 692 | 690 | ||
| @@ -696,23 +694,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -696,23 +694,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 696 | String stationMake = ""; | 694 | String stationMake = ""; |
| 697 | 695 | ||
| 698 | if(stationMakeStr.equals("E")) { | 696 | if(stationMakeStr.equals("E")) { |
| 699 | - | ||
| 700 | stationMake = "\t2"; | 697 | stationMake = "\t2"; |
| 701 | - | ||
| 702 | }else { | 698 | }else { |
| 703 | - | ||
| 704 | stationMake ="\t1"; | 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 | stationNo = "\t" + stationNo; | 706 | stationNo = "\t" + stationNo; |
| 712 | 707 | ||
| 713 | // 站点编码 | 708 | // 站点编码 |
| 714 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 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 | stationCode = "\t" +stationCode; | 723 | stationCode = "\t" +stationCode; |
| 717 | 724 | ||
| 718 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 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,41 +739,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 732 | 739 | ||
| 733 | // 限速 | 740 | // 限速 |
| 734 | String sleepStr = ""; | 741 | String sleepStr = ""; |
| 735 | - | ||
| 736 | // 方向 | 742 | // 方向 |
| 737 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | 743 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); |
| 738 | - | ||
| 739 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 744 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 740 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 745 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 741 | - | ||
| 742 | if(sobje.size()==1) { | 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 | }else if(sobje.size()>1){ | 749 | }else if(sobje.size()>1){ |
| 749 | - | ||
| 750 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 751 | for(int j =0;j<sobje.size();j++) { | 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 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 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,9 +784,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 785 | for(int i = 0; i<objects.size();i++) { | 784 | for(int i = 0; i<objects.size();i++) { |
| 786 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { | 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 | lat = "\t" + lat; | 793 | lat = "\t" + lat; |
| 792 | // 站点类型 | 794 | // 站点类型 |
| 793 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | 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,6 +804,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 802 | String stationNo = "\t" + xh; | 804 | String stationNo = "\t" + xh; |
| 803 | // 站点编码 | 805 | // 站点编码 |
| 804 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 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 | stationCode = "\t" +stationCode; | 818 | stationCode = "\t" +stationCode; |
| 806 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 819 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 807 | String tempDistc = String.valueOf((int) dis); | 820 | String tempDistc = String.valueOf((int) dis); |
| @@ -817,20 +830,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -817,20 +830,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 817 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 830 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 818 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 831 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 819 | if(sobje.size()==1) { | 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 | }else if(sobje.size()>1){ | 835 | }else if(sobje.size()>1){ |
| 823 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 824 | for(int j =0;j<sobje.size();j++) { | 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 | xh++; | 855 | xh++; |
| 835 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 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,6 +24,7 @@ import com.bsth.webService.trafficManage.geotool.services.Internal; | ||
| 24 | import com.bsth.webService.trafficManage.org.tempuri.Results; | 24 | import com.bsth.webService.trafficManage.org.tempuri.Results; |
| 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; | 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; |
| 26 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; | 26 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; |
| 27 | +import org.apache.commons.lang.StringUtils; | ||
| 27 | import org.apache.commons.lang.time.DateUtils; | 28 | import org.apache.commons.lang.time.DateUtils; |
| 28 | import org.slf4j.Logger; | 29 | import org.slf4j.Logger; |
| 29 | import org.slf4j.LoggerFactory; | 30 | import org.slf4j.LoggerFactory; |
| @@ -1125,11 +1126,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1125,11 +1126,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1125 | }else{ | 1126 | }else{ |
| 1126 | flag = 0; | 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 | return result; | 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,11 +2577,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2577 | if (a == 2) { | 2577 | if (a == 2) { |
| 2578 | x = b + 1; | 2578 | x = b + 1; |
| 2579 | y = x * 2; | 2579 | y = x * 2; |
| 2580 | - ; | ||
| 2581 | } else if (b == 1) { | 2580 | } else if (b == 1) { |
| 2582 | x = b + 1; | 2581 | x = b + 1; |
| 2583 | y = x * 2 - 1; | 2582 | y = x * 2 - 1; |
| 2584 | - ; | ||
| 2585 | } else { | 2583 | } else { |
| 2586 | x = b; | 2584 | x = b; |
| 2587 | y = 2 * x; | 2585 | y = 2 * x; |
src/main/resources/static/pages/forms/statement/correctStatis.html
| @@ -261,13 +261,12 @@ | @@ -261,13 +261,12 @@ | ||
| 261 | // $(".hidden").removeClass("hidden"); | 261 | // $(".hidden").removeClass("hidden"); |
| 262 | $get('/busInterval/correctStatis', params, function(result){ | 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 | tbodyHtml = template('list_company',{list:result[0].workList[0].workList, type:3}); | 266 | tbodyHtml = template('list_company',{list:result[0].workList[0].workList, type:3}); |
| 268 | }else{ | 267 | }else{ |
| 269 | tbodyHtml = template('list_company',{list:result, type:3}); | 268 | tbodyHtml = template('list_company',{list:result, type:3}); |
| 270 | - } | 269 | + } */ |
| 271 | 270 | ||
| 272 | // 把渲染好的模版html文本追加到表格中 | 271 | // 把渲染好的模版html文本追加到表格中 |
| 273 | // $('#forms').html(tbodyHtml); | 272 | // $('#forms').html(tbodyHtml); |
| @@ -281,7 +280,7 @@ | @@ -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 | if($(this).children().size() < 2){ | 284 | if($(this).children().size() < 2){ |
| 286 | return; | 285 | return; |
| 287 | } | 286 | } |
| @@ -299,9 +298,9 @@ | @@ -299,9 +298,9 @@ | ||
| 299 | subCompany = g.workList; | 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 | if($(this).children().size() < 2){ | 304 | if($(this).children().size() < 2){ |
| 306 | return; | 305 | return; |
| 307 | } | 306 | } |
| @@ -318,9 +317,9 @@ | @@ -318,9 +317,9 @@ | ||
| 318 | lines = g.workList; | 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 | if($(this).children().size() < 2){ | 323 | if($(this).children().size() < 2){ |
| 325 | return; | 324 | return; |
| 326 | } | 325 | } |
| @@ -328,13 +327,13 @@ | @@ -328,13 +327,13 @@ | ||
| 328 | $(this).children().each(function(index){ | 327 | $(this).children().each(function(index){ |
| 329 | params[index] = $(this).text(); | 328 | params[index] = $(this).text(); |
| 330 | }); | 329 | }); |
| 331 | - $.each(lines, function(i, g){ | 330 | + $.each(lines, function(i, g){ |
| 332 | if(g.company == params[1] && g.subCompany == params[2] && g.line == params[3]){ | 331 | if(g.company == params[1] && g.subCompany == params[2] && g.line == params[3]){ |
| 333 | var tbodyHtml = template('list_workList',{list:g.workList}); | 332 | var tbodyHtml = template('list_workList',{list:g.workList}); |
| 334 | $("#lines").html(tbodyHtml); | 333 | $("#lines").html(tbodyHtml); |
| 335 | } | 334 | } |
| 336 | - }); | ||
| 337 | - }); | 335 | + }); |
| 336 | + }); */ | ||
| 338 | 337 | ||
| 339 | // $("#export").on("click", function(){ | 338 | // $("#export").on("click", function(){ |
| 340 | // $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | 339 | // $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ |
| @@ -381,9 +380,8 @@ | @@ -381,9 +380,8 @@ | ||
| 381 | <th class="hidden"></th> | 380 | <th class="hidden"></th> |
| 382 | <th rowspan="2" width="120px">日期</th> | 381 | <th rowspan="2" width="120px">日期</th> |
| 383 | <th rowspan="2">公司</th> | 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 | <th rowspan="2">实际营运班次</th> | 385 | <th rowspan="2">实际营运班次</th> |
| 388 | <th colspan="3" align="center">待发调整数</th> | 386 | <th colspan="3" align="center">待发调整数</th> |
| 389 | <th rowspan="2">掉线调整数</th> | 387 | <th rowspan="2">掉线调整数</th> |
| @@ -405,18 +403,15 @@ | @@ -405,18 +403,15 @@ | ||
| 405 | {{each list as obj i}} | 403 | {{each list as obj i}} |
| 406 | <tr> | 404 | <tr> |
| 407 | {{if obj.date=='合计'}} | 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 | {{/if}} | 408 | {{/if}} |
| 412 | {{if obj.date!='合计'}} | 409 | {{if obj.date!='合计'}} |
| 413 | <td>{{obj.date}}</td> | 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 | <td>{{obj.sjbc}}</td> | 415 | <td>{{obj.sjbc}}</td> |
| 421 | <td>{{obj.sddf}}</td> | 416 | <td>{{obj.sddf}}</td> |
| 422 | <td>{{obj.zddf}}</td> | 417 | <td>{{obj.zddf}}</td> |
| @@ -432,7 +427,7 @@ | @@ -432,7 +427,7 @@ | ||
| 432 | {{/each}} | 427 | {{/each}} |
| 433 | {{if list.length == 0}} | 428 | {{if list.length == 0}} |
| 434 | <tr> | 429 | <tr> |
| 435 | - <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td> | 430 | + <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td> |
| 436 | </tr> | 431 | </tr> |
| 437 | {{/if}} | 432 | {{/if}} |
| 438 | </tbody> | 433 | </tbody> |
src/main/resources/static/real_control_v2/css/main.css
| @@ -1572,4 +1572,12 @@ ul.left_tabs_lg li{ | @@ -1572,4 +1572,12 @@ ul.left_tabs_lg li{ | ||
| 1572 | .ct_describe:before{ | 1572 | .ct_describe:before{ |
| 1573 | content: "\f059"; | 1573 | content: "\f059"; |
| 1574 | margin-right: 3px; | 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 | \ No newline at end of file | 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 | </div> | 135 | </div> |
| 136 | \ No newline at end of file | 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 | </div> | 321 | </div> |
| 320 | \ No newline at end of file | 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 | </div> | 290 | </div> |
| 291 | \ No newline at end of file | 291 | \ No newline at end of file |