Commit 56780f35967031efcd898e2bf7c14ff686e90d8e
Merge branch 'pudong' into minhang
# Conflicts: # src/main/resources/application-prod.properties
Showing
89 changed files
with
2611 additions
and
585 deletions
Too many changes to show.
To preserve performance only 89 of 179 files are displayed.
src/main/java/com/bsth/controller/StationController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | -import java.util.Map; | ||
| 4 | - | 3 | +import com.bsth.entity.Station; |
| 4 | +import com.bsth.service.StationService; | ||
| 5 | +import com.bsth.util.GetUIDAndCode; | ||
| 5 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -10,9 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -10,9 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | import org.springframework.web.bind.annotation.RequestParam; | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | import org.springframework.web.bind.annotation.RestController; | 12 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 13 | ||
| 13 | -import com.bsth.entity.Station; | ||
| 14 | -import com.bsth.service.StationService; | ||
| 15 | -import com.bsth.util.GetUIDAndCode; | 14 | +import java.util.Map; |
| 16 | 15 | ||
| 17 | /** | 16 | /** |
| 18 | * | 17 | * |
| @@ -160,11 +159,11 @@ public class StationController extends BaseController<Station, Integer> { | @@ -160,11 +159,11 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 160 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { | 159 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 161 | System.out.println(stationCount+" _ "+ sectionCount ); | 160 | System.out.println(stationCount+" _ "+ sectionCount ); |
| 162 | for(int i = 0; i < stationCount; i++) { | 161 | for(int i = 0; i < stationCount; i++) { |
| 163 | - System.out.println(stationCount); | 162 | + System.out.println(i); |
| 164 | GetUIDAndCode.getStationId(); | 163 | GetUIDAndCode.getStationId(); |
| 165 | } | 164 | } |
| 166 | - for(int i = 0; i < sectionCount; i++) { | ||
| 167 | - System.out.println(sectionCount); | 165 | + for(int j = 0; j < sectionCount; j++) { |
| 166 | + System.out.println(j); | ||
| 168 | GetUIDAndCode.getSectionId(); | 167 | GetUIDAndCode.getSectionId(); |
| 169 | } | 168 | } |
| 170 | return 1; | 169 | return 1; |
src/main/java/com/bsth/controller/StationRouteController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | -import com.bsth.entity.Station; | ||
| 4 | import com.bsth.entity.StationRoute; | 3 | import com.bsth.entity.StationRoute; |
| 5 | import com.bsth.entity.StationRouteCache; | 4 | import com.bsth.entity.StationRouteCache; |
| 6 | import com.bsth.repository.StationRouteCacheRepository; | 5 | import com.bsth.repository.StationRouteCacheRepository; |
| @@ -12,11 +11,10 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -12,11 +11,10 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 12 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 13 | ||
| 14 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | import java.util.List; | 15 | import java.util.List; |
| 16 | import java.util.Map; | 16 | import java.util.Map; |
| 17 | 17 | ||
| 18 | -import javax.servlet.http.HttpServletResponse; | ||
| 19 | - | ||
| 20 | /** | 18 | /** |
| 21 | * | 19 | * |
| 22 | * @ClassName: StationRouteController(站点路由控制器) | 20 | * @ClassName: StationRouteController(站点路由控制器) |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import java.io.ByteArrayOutputStream; | ||
| 4 | +import java.io.IOException; | ||
| 5 | +import java.io.InputStream; | ||
| 6 | +import java.io.OutputStream; | ||
| 7 | +import java.net.HttpURLConnection; | ||
| 8 | +import java.net.URL; | ||
| 9 | +import java.util.ArrayList; | ||
| 10 | +import java.util.Collection; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +import org.apache.commons.io.IOUtils; | ||
| 16 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 17 | +import org.joda.time.format.DateTimeFormat; | ||
| 18 | +import org.joda.time.format.DateTimeFormatter; | ||
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 23 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 24 | +import org.springframework.web.bind.annotation.RestController; | ||
| 25 | + | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 26 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.bsth.common.ResponseCode; | 27 | import com.bsth.common.ResponseCode; |
| 5 | import com.bsth.controller.BaseController; | 28 | import com.bsth.controller.BaseController; |
| @@ -10,14 +33,11 @@ import com.bsth.data.schedule.DayOfSchedule; | @@ -10,14 +33,11 @@ import com.bsth.data.schedule.DayOfSchedule; | ||
| 10 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | 33 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 34 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | import com.bsth.entity.schedule.SchedulePlanInfo; | 35 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 36 | +import com.bsth.entity.sys.SysUser; | ||
| 37 | +import com.bsth.security.util.SecurityUtils; | ||
| 13 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 38 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 14 | -import org.apache.commons.lang3.StringEscapeUtils; | ||
| 15 | -import org.joda.time.format.DateTimeFormat; | ||
| 16 | -import org.joda.time.format.DateTimeFormatter; | ||
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | -import org.springframework.web.bind.annotation.*; | ||
| 19 | - | ||
| 20 | -import java.util.*; | 39 | +import com.bsth.util.ConfigUtil; |
| 40 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 21 | 41 | ||
| 22 | @RestController | 42 | @RestController |
| 23 | @RequestMapping("/realSchedule") | 43 | @RequestMapping("/realSchedule") |
| @@ -515,6 +535,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -515,6 +535,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 515 | return scheduleRealInfoService.realScheduleList(line,date); | 535 | return scheduleRealInfoService.realScheduleList(line,date); |
| 516 | } | 536 | } |
| 517 | 537 | ||
| 538 | + @RequestMapping(value="/realScheduleList_zrw") | ||
| 539 | + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){ | ||
| 540 | + return scheduleRealInfoService.realScheduleList_zrw(line,date); | ||
| 541 | + } | ||
| 542 | + | ||
| 518 | @RequestMapping(value="/realScheduleList_mh_2") | 543 | @RequestMapping(value="/realScheduleList_mh_2") |
| 519 | public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ | 544 | public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ |
| 520 | return scheduleRealInfoService.realScheduleList_mh_2(line,date); | 545 | return scheduleRealInfoService.realScheduleList_mh_2(line,date); |
| @@ -686,4 +711,74 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -686,4 +711,74 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 686 | public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | 711 | public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ |
| 687 | return scheduleRealInfoService.deleteToHistory(id); | 712 | return scheduleRealInfoService.deleteToHistory(id); |
| 688 | } | 713 | } |
| 714 | + | ||
| 715 | + /** | ||
| 716 | + * 从历史库里删除临加班次 | ||
| 717 | + * @param sch | ||
| 718 | + * @return | ||
| 719 | + */ | ||
| 720 | + @RequestMapping(value = "wxsb", method = RequestMethod.POST) | ||
| 721 | + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){ | ||
| 722 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 723 | + String uname = user.getUserName(); | ||
| 724 | + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url")); | ||
| 725 | + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType")); | ||
| 726 | + // 分公司保存格式 分公司编码_公司编码 | ||
| 727 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm")); | ||
| 728 | + String[] arr = val.split("_"); | ||
| 729 | + if (!"22".equals(arr[1])) { | ||
| 730 | + Map<String, Object> res = new HashMap<String, Object>(); | ||
| 731 | + res.put("status", ResponseCode.ERROR); | ||
| 732 | + res.put("msg", "除金高公司外暂未开通此功能"); | ||
| 733 | + | ||
| 734 | + return res; | ||
| 735 | + } | ||
| 736 | + url.append("&fgs=").append(arr[0]); | ||
| 737 | + | ||
| 738 | + return request(url.toString()); | ||
| 739 | + } | ||
| 740 | + | ||
| 741 | + @SuppressWarnings("unchecked") | ||
| 742 | + private static Map<String, Object> request(String url) { | ||
| 743 | + Map<String, Object> res = new HashMap<String, Object>(); | ||
| 744 | + res.put("status", ResponseCode.SUCCESS); | ||
| 745 | + InputStream in = null; | ||
| 746 | + HttpURLConnection con = null; | ||
| 747 | + try { | ||
| 748 | + con = (HttpURLConnection)new URL(url).openConnection(); | ||
| 749 | + con.setRequestMethod("POST"); | ||
| 750 | + con.setRequestProperty("keep-alive", "true"); | ||
| 751 | + con.setRequestProperty("accept", "application/json"); | ||
| 752 | + con.setRequestProperty("content-type", "application/json"); | ||
| 753 | + con.setDoInput(true); | ||
| 754 | + con.setReadTimeout(2500); | ||
| 755 | + con.setConnectTimeout(2500); | ||
| 756 | + | ||
| 757 | + con.connect(); | ||
| 758 | + if (con.getResponseCode() == 200) { | ||
| 759 | + in = con.getInputStream(); | ||
| 760 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
| 761 | + IOUtils.copy(in, bout); bout.close(); | ||
| 762 | + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | ||
| 763 | + if (!"报修成功".equals(response.get("msg"))) { | ||
| 764 | + res.put("status", ResponseCode.ERROR); | ||
| 765 | + res.putAll(response); | ||
| 766 | + } | ||
| 767 | + } | ||
| 768 | + } catch (IOException e) { | ||
| 769 | + // TODO Auto-generated catch block | ||
| 770 | + res.put("status", ResponseCode.ERROR); | ||
| 771 | + res.put("msg", "调用上报接口异常"); | ||
| 772 | + } finally { | ||
| 773 | + try { | ||
| 774 | + if (in != null) in.close(); | ||
| 775 | + if (con != null) con.disconnect(); | ||
| 776 | + } catch (IOException e) { | ||
| 777 | + // TODO Auto-generated catch block | ||
| 778 | + e.printStackTrace(); | ||
| 779 | + } | ||
| 780 | + } | ||
| 781 | + | ||
| 782 | + return res; | ||
| 783 | + } | ||
| 689 | } | 784 | } |
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| @@ -63,6 +63,20 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | @@ -63,6 +63,20 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | ||
| 63 | return rtn; | 63 | return rtn; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET) | ||
| 67 | + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) { | ||
| 68 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 69 | + try { | ||
| 70 | + carConfigInfoService.validate_cars(xlId, clId); | ||
| 71 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 72 | + } catch (ScheduleException exp) { | ||
| 73 | + rtn.put("status", ResponseCode.ERROR); | ||
| 74 | + rtn.put("msg", exp.getMessage()); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + return rtn; | ||
| 78 | + } | ||
| 79 | + | ||
| 66 | @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET) | 80 | @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET) |
| 67 | public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | 81 | public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { |
| 68 | HttpSession session = request.getSession(); | 82 | HttpSession session = request.getSession(); |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
| @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { | @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { | ||
| 57 | return rtn; | 57 | return rtn; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | + /** | ||
| 61 | + * 验证排班计划时间范围内规则的正确性。 | ||
| 62 | + * @return | ||
| 63 | + * @throws Exception | ||
| 64 | + */ | ||
| 65 | + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET) | ||
| 66 | + public Map<String, Object> validateRule( | ||
| 67 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 68 | + @PathVariable(value = "from") Date from, | ||
| 69 | + @PathVariable(value = "to") Date to | ||
| 70 | + ) throws Exception { | ||
| 71 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 72 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 73 | + rtn.put("data", schedulePlanService.validateRule(xlid, from, to)); | ||
| 74 | + return rtn; | ||
| 75 | + } | ||
| 76 | + | ||
| 60 | } | 77 | } |
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| @@ -121,7 +121,7 @@ public class InStationProcess { | @@ -121,7 +121,7 @@ public class InStationProcess { | ||
| 121 | private void inEndStation(ScheduleRealInfo sch, GpsEntity gps) { | 121 | private void inEndStation(ScheduleRealInfo sch, GpsEntity gps) { |
| 122 | String nbbm = sch.getClZbh(); | 122 | String nbbm = sch.getClZbh(); |
| 123 | //校验进站前置约束 | 123 | //校验进站前置约束 |
| 124 | - if (!validInPremise(gps)) | 124 | + if (!validInPremise(gps) && isNormalSch(sch)) |
| 125 | return; | 125 | return; |
| 126 | 126 | ||
| 127 | //实达时间不覆盖 | 127 | //实达时间不覆盖 |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| @@ -74,7 +74,7 @@ public class OutStationProcess { | @@ -74,7 +74,7 @@ public class OutStationProcess { | ||
| 74 | * @param gps | 74 | * @param gps |
| 75 | */ | 75 | */ |
| 76 | private void outStation(GpsEntity gps, GpsEntity prev) { | 76 | private void outStation(GpsEntity gps, GpsEntity prev) { |
| 77 | - logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); | 77 | + logger.info("出站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); |
| 78 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | 78 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 79 | 79 | ||
| 80 | //起点发车 | 80 | //起点发车 |
src/main/java/com/bsth/entity/mcy_forms/Shifday.java
| @@ -35,6 +35,8 @@ public class Shifday { | @@ -35,6 +35,8 @@ public class Shifday { | ||
| 35 | private String sjbc;//实际班次 | 35 | private String sjbc;//实际班次 |
| 36 | 36 | ||
| 37 | private String jgh; | 37 | private String jgh; |
| 38 | + | ||
| 39 | + private String sgh; | ||
| 38 | 40 | ||
| 39 | private String zbh; | 41 | private String zbh; |
| 40 | 42 | ||
| @@ -56,6 +58,14 @@ public class Shifday { | @@ -56,6 +58,14 @@ public class Shifday { | ||
| 56 | this.jgh = jgh; | 58 | this.jgh = jgh; |
| 57 | } | 59 | } |
| 58 | 60 | ||
| 61 | + public String getSgh() { | ||
| 62 | + return sgh; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setSgh(String sgh) { | ||
| 66 | + this.sgh = sgh; | ||
| 67 | + } | ||
| 68 | + | ||
| 59 | public String getZbh() { | 69 | public String getZbh() { |
| 60 | return zbh; | 70 | return zbh; |
| 61 | } | 71 | } |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| 1 | package com.bsth.entity.schedule; | 1 | package com.bsth.entity.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 5 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | ||
| 6 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; |
| 5 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output; | ||
| 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | ||
| 7 | 7 | ||
| 8 | import javax.persistence.*; | 8 | import javax.persistence.*; |
| 9 | import java.sql.PreparedStatement; | 9 | import java.sql.PreparedStatement; |
src/main/java/com/bsth/filter/AccessLogFilter.java
| @@ -58,9 +58,11 @@ public class AccessLogFilter extends BaseFilter { | @@ -58,9 +58,11 @@ public class AccessLogFilter extends BaseFilter { | ||
| 58 | s.append(getBlock(params)); | 58 | s.append(getBlock(params)); |
| 59 | s.append(getBlock(headers)); | 59 | s.append(getBlock(headers)); |
| 60 | s.append(getBlock(request.getHeader("Referer"))); | 60 | s.append(getBlock(request.getHeader("Referer"))); |
| 61 | - | ||
| 62 | - logger.info(s.toString()); | 61 | + |
| 62 | + long now = System.currentTimeMillis(); | ||
| 63 | chain.doFilter(request, response); | 63 | chain.doFilter(request, response); |
| 64 | + s.append("<cost time:").append(System.currentTimeMillis() - now).append(">"); | ||
| 65 | + logger.info(s.toString()); | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | private static String getParams(HttpServletRequest request) { | 68 | private static String getParams(HttpServletRequest request) { |
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
| @@ -50,4 +50,7 @@ public interface CarConfigInfoRepository extends BaseRepository<CarConfigInfo, L | @@ -50,4 +50,7 @@ public interface CarConfigInfoRepository extends BaseRepository<CarConfigInfo, L | ||
| 50 | 50 | ||
| 51 | @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH) | 51 | @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH) |
| 52 | List<CarConfigInfo> findByXlId(Integer xlid); | 52 | List<CarConfigInfo> findByXlId(Integer xlid); |
| 53 | + | ||
| 54 | + @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH) | ||
| 55 | + List<CarConfigInfo> findByClId(Integer clid); | ||
| 53 | } | 56 | } |
| 54 | \ No newline at end of file | 57 | \ No newline at end of file |
src/main/java/com/bsth/repository/schedule/GuideboardInfoRepository.java
| @@ -43,5 +43,7 @@ public interface GuideboardInfoRepository extends BaseRepository<GuideboardInfo, | @@ -43,5 +43,7 @@ public interface GuideboardInfoRepository extends BaseRepository<GuideboardInfo, | ||
| 43 | 43 | ||
| 44 | @Query(value = "SELECT g FROM GuideboardInfo g where g.xl =?1 and g.lpName = ?2 and g.lpNo = ?3 and lpType =?4 and isCancel = 0") | 44 | @Query(value = "SELECT g FROM GuideboardInfo g where g.xl =?1 and g.lpName = ?2 and g.lpNo = ?3 and lpType =?4 and isCancel = 0") |
| 45 | List<GuideboardInfo> validateLp(Line xl,String lpName , int lpNo,String lpType); | 45 | List<GuideboardInfo> validateLp(Line xl,String lpName , int lpNo,String lpType); |
| 46 | + | ||
| 47 | + List<GuideboardInfo> findByXlId(Integer id); | ||
| 46 | 48 | ||
| 47 | } | 49 | } |
src/main/java/com/bsth/repository/schedule/TTInfoRepository.java
| @@ -48,4 +48,6 @@ public interface TTInfoRepository extends BaseRepository<TTInfo, Long> { | @@ -48,4 +48,6 @@ public interface TTInfoRepository extends BaseRepository<TTInfo, Long> { | ||
| 48 | "from LineVersions lv where lv.line.id = ?1 and lv.status = ?2 ") | 48 | "from LineVersions lv where lv.line.id = ?1 and lv.status = ?2 ") |
| 49 | List<Map<String, Object>> findLineVersionDescs3(Integer lineId, Integer status); | 49 | List<Map<String, Object>> findLineVersionDescs3(Integer lineId, Integer status); |
| 50 | 50 | ||
| 51 | + List<TTInfo> findByXlId(Integer xlId); | ||
| 52 | + | ||
| 51 | } | 53 | } |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -596,7 +596,7 @@ public class FormsServiceImpl implements FormsService { | @@ -596,7 +596,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 596 | @Override | 596 | @Override |
| 597 | public List<Shifday> shifday(Map<String, Object> map) { | 597 | public List<Shifday> shifday(Map<String, Object> map) { |
| 598 | 598 | ||
| 599 | - String line=""; | 599 | + String line=""; |
| 600 | String date=""; | 600 | String date=""; |
| 601 | String gsdmShif=""; | 601 | String gsdmShif=""; |
| 602 | String fgsdmShif=""; | 602 | String fgsdmShif=""; |
| @@ -624,18 +624,17 @@ public class FormsServiceImpl implements FormsService { | @@ -624,18 +624,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 624 | if(!type.equals("") && !statue.equals("")){ | 624 | if(!type.equals("") && !statue.equals("")){ |
| 625 | sql_ +=" order by "+statue+" "+type; | 625 | sql_ +=" order by "+statue+" "+type; |
| 626 | } | 626 | } |
| 627 | - String sql ="select t.* from (select r.schedule_date,r.j_name," | ||
| 628 | - + "IFNULL(r.s_name,'')as s_name," | ||
| 629 | - + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name " | ||
| 630 | - + "FROM bsth_c_s_sp_info_real r where 1=1 " | ||
| 631 | - + " and r.schedule_date_str='"+date + "' " | 627 | + String sql ="select t.* from (select r.schedule_date," |
| 628 | + + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh," | ||
| 629 | + + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name" | ||
| 630 | + + " FROM bsth_c_s_sp_info_real r where 1=1 " | ||
| 631 | + + " and r.schedule_date_str='"+date + "' " | ||
| 632 | + " and r.xl_bm = '"+line+"' " | 632 | + " and r.xl_bm = '"+line+"' " |
| 633 | + " and r.gs_bm like '%"+gsdmShif+"%' " | 633 | + " and r.gs_bm like '%"+gsdmShif+"%' " |
| 634 | - + " and r.fgs_bm like '%"+fgsdmShif+"%' ) t" | ||
| 635 | - + " GROUP BY t.schedule_date,t.j_name,t.s_name, " | ||
| 636 | - + "t.cl_zbh,t.xl_bm,t.j_gh,t.gs_bm,t.fgs_bm,t.lp_name " | ||
| 637 | - + sql_; | ||
| 638 | - | 634 | + + " and r.fgs_bm like '%"+fgsdmShif+"%' "+sql_+") t" |
| 635 | + + " GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name," | ||
| 636 | + + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm "; | ||
| 637 | + | ||
| 639 | 638 | ||
| 640 | List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { | 639 | List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { |
| 641 | 640 | ||
| @@ -643,15 +642,16 @@ public class FormsServiceImpl implements FormsService { | @@ -643,15 +642,16 @@ public class FormsServiceImpl implements FormsService { | ||
| 643 | public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { | 642 | public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 644 | Shifday shifday = new Shifday(); | 643 | Shifday shifday = new Shifday(); |
| 645 | shifday.setRq(arg0.getString("schedule_date")); | 644 | shifday.setRq(arg0.getString("schedule_date")); |
| 646 | - shifday.setjName(arg0.getString("j_name").toString()); | ||
| 647 | - shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString()); | 645 | +// shifday.setjName(arg0.getString("j_name").toString()); |
| 646 | +// shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString()); | ||
| 648 | shifday.setCarPlate(arg0.getString("cl_zbh").toString()); | 647 | shifday.setCarPlate(arg0.getString("cl_zbh").toString()); |
| 649 | shifday.setJgh(arg0.getString("j_gh")); | 648 | shifday.setJgh(arg0.getString("j_gh")); |
| 649 | + shifday.setSgh(arg0.getString("s_gh") == null ? "" : arg0.getString("s_gh").toString()); | ||
| 650 | shifday.setLpName(arg0.getString("lp_name")== null ? "" : arg0.getString("lp_name").toString()); | 650 | shifday.setLpName(arg0.getString("lp_name")== null ? "" : arg0.getString("lp_name").toString()); |
| 651 | return shifday; | 651 | return shifday; |
| 652 | } | 652 | } |
| 653 | - | ||
| 654 | }); | 653 | }); |
| 654 | + | ||
| 655 | List<ScheduleRealInfo> sList; | 655 | List<ScheduleRealInfo> sList; |
| 656 | List<ScheduleRealInfo> list_s; | 656 | List<ScheduleRealInfo> list_s; |
| 657 | List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString()); | 657 | List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString()); |
| @@ -661,8 +661,9 @@ public class FormsServiceImpl implements FormsService { | @@ -661,8 +661,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 661 | Shifday d=list.get(i); | 661 | Shifday d=list.get(i); |
| 662 | for (int j = 0; j < lists.size(); j++) { | 662 | for (int j = 0; j < lists.size(); j++) { |
| 663 | ScheduleRealInfo s=lists.get(j); | 663 | ScheduleRealInfo s=lists.get(j); |
| 664 | - if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh()) | ||
| 665 | - &&d.getLpName().equals(s.getLpName())){ | 664 | + if(d.getJgh().equals(s.getjGh()) && d.getSgh().equals(s.getsGh()) |
| 665 | + && d.getCarPlate().equals(s.getClZbh()) | ||
| 666 | + && d.getLpName().equals(s.getLpName())){ | ||
| 666 | sList.add(s); | 667 | sList.add(s); |
| 667 | Set<ChildTaskPlan> cts = s.getcTasks(); | 668 | Set<ChildTaskPlan> cts = s.getcTasks(); |
| 668 | if(cts != null && cts.size() > 0){ | 669 | if(cts != null && cts.size() > 0){ |
| @@ -674,7 +675,10 @@ public class FormsServiceImpl implements FormsService { | @@ -674,7 +675,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 674 | } | 675 | } |
| 675 | } | 676 | } |
| 676 | } | 677 | } |
| 677 | - | 678 | + if(sList.size()>0){ |
| 679 | + d.setjName(sList.get(0).getjName()); | ||
| 680 | + d.setsName(sList.get(0).getsName() == null ? "":sList.get(0).getsName()); | ||
| 681 | + } | ||
| 678 | double ksgl=culateMileageService.culateKsgl(list_s); | 682 | double ksgl=culateMileageService.culateKsgl(list_s); |
| 679 | double jccgl=culateMileageService.culateJccgl(list_s); | 683 | double jccgl=culateMileageService.culateJccgl(list_s); |
| 680 | double zksgl=Arith.add(ksgl, jccgl); | 684 | double zksgl=Arith.add(ksgl, jccgl); |
| @@ -893,7 +897,8 @@ public class FormsServiceImpl implements FormsService { | @@ -893,7 +897,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 893 | if(fgsdm.length() != 0){ | 897 | if(fgsdm.length() != 0){ |
| 894 | sql += " and r.fgs_bm ='"+fgsdm+"'"; | 898 | sql += " and r.fgs_bm ='"+fgsdm+"'"; |
| 895 | } | 899 | } |
| 896 | - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; | 900 | + sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh,r.j_name " + |
| 901 | + "order by r.xl_bm,r.cl_zbh"; | ||
| 897 | 902 | ||
| 898 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 903 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 899 | @Override | 904 | @Override |
| @@ -924,7 +929,7 @@ public class FormsServiceImpl implements FormsService { | @@ -924,7 +929,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 924 | + " WHERE rq = '"+startDate+"'" | 929 | + " WHERE rq = '"+startDate+"'" |
| 925 | + linesql | 930 | + linesql |
| 926 | + " union" | 931 | + " union" |
| 927 | - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | 932 | + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" |
| 928 | + " WHERE rq = '"+startDate+"'" | 933 | + " WHERE rq = '"+startDate+"'" |
| 929 | + linesql; | 934 | + linesql; |
| 930 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | 935 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -400,7 +400,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -400,7 +400,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 400 | sql += " and cl.line_code = '"+line+"'"; | 400 | sql += " and cl.line_code = '"+line+"'"; |
| 401 | if(ttId.length() != 0) | 401 | if(ttId.length() != 0) |
| 402 | sql += " and td.ttinfo = '"+ttId+"'"; | 402 | sql += " and td.ttinfo = '"+ttId+"'"; |
| 403 | - sql += " group by td.lp"; | 403 | + sql += " group by td.lp, lp.lp_name"; |
| 404 | 404 | ||
| 405 | list = jdbcTemplate.query(sql, | 405 | list = jdbcTemplate.query(sql, |
| 406 | new RowMapper<Map<String, Object>>(){ | 406 | new RowMapper<Map<String, Object>>(){ |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -132,8 +132,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -132,8 +132,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 132 | 132 | ||
| 133 | Long getMaxId(); | 133 | Long getMaxId(); |
| 134 | Map<String,Object> scheduleDaily(String line,String date); | 134 | Map<String,Object> scheduleDaily(String line,String date); |
| 135 | - | ||
| 136 | List<ScheduleRealInfo> realScheduleList(String line,String date); | 135 | List<ScheduleRealInfo> realScheduleList(String line,String date); |
| 136 | + List<ScheduleRealInfo> realScheduleList_zrw(String line,String date); | ||
| 137 | List<ScheduleRealInfo> realScheduleListQp(String line,String date); | 137 | List<ScheduleRealInfo> realScheduleListQp(String line,String date); |
| 138 | 138 | ||
| 139 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm); | 139 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm); |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -611,111 +611,119 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -611,111 +611,119 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 611 | * 临加班次 | 611 | * 临加班次 |
| 612 | */ | 612 | */ |
| 613 | @Override | 613 | @Override |
| 614 | - public Map<String, Object> save(ScheduleRealInfo t) { | 614 | + public Map<String, Object> save(ScheduleRealInfo sch) { |
| 615 | Map<String, Object> rs = new HashMap<>(); | 615 | Map<String, Object> rs = new HashMap<>(); |
| 616 | try { | 616 | try { |
| 617 | - if (!carExist(t.getGsBm(), t.getClZbh())) { | ||
| 618 | - rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | ||
| 619 | - rs.put("status", ResponseCode.ERROR); | ||
| 620 | - return rs; | 617 | + String clZbh = sch.getClZbh(); |
| 618 | + if (StringUtils.isNotEmpty(clZbh)) { | ||
| 619 | + //检测 | ||
| 620 | + if (!carExist(sch.getGsBm(), clZbh)) { | ||
| 621 | + rs.put("status", ResponseCode.ERROR); | ||
| 622 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | ||
| 623 | + return rs; | ||
| 624 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | ||
| 625 | + rs.put("status", ResponseCode.ERROR); | ||
| 626 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | ||
| 627 | + return rs; | ||
| 628 | + } | ||
| 621 | } | 629 | } |
| 622 | 630 | ||
| 623 | SysUser user = SecurityUtils.getCurrentUser(); | 631 | SysUser user = SecurityUtils.getCurrentUser(); |
| 624 | - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | 632 | + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); |
| 625 | 633 | ||
| 626 | SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | 634 | SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 627 | 635 | ||
| 628 | - if (StringUtils.isEmpty(t.getjGh())) { | 636 | + if (StringUtils.isEmpty(sch.getjGh())) { |
| 629 | rs.put("status", ResponseCode.ERROR); | 637 | rs.put("status", ResponseCode.ERROR); |
| 630 | rs.put("msg", "驾驶员工号不能为空!"); | 638 | rs.put("msg", "驾驶员工号不能为空!"); |
| 631 | return rs; | 639 | return rs; |
| 632 | } | 640 | } |
| 633 | //截取驾驶员工号 | 641 | //截取驾驶员工号 |
| 634 | - if (t.getjGh().indexOf("-") != -1) { | ||
| 635 | - t.setjGh(t.getjGh().split("-")[1]); | 642 | + if (sch.getjGh().indexOf("-") != -1) { |
| 643 | + sch.setjGh(sch.getjGh().split("-")[1]); | ||
| 636 | } | 644 | } |
| 637 | //检查驾驶员工号 | 645 | //检查驾驶员工号 |
| 638 | - String jName = getPersonName(t.getGsBm(), t.getjGh()); | 646 | + String jName = getPersonName(sch.getGsBm(), sch.getjGh()); |
| 639 | if (StringUtils.isEmpty(jName)) { | 647 | if (StringUtils.isEmpty(jName)) { |
| 640 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | 648 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); |
| 641 | rs.put("status", ResponseCode.ERROR); | 649 | rs.put("status", ResponseCode.ERROR); |
| 642 | return rs; | 650 | return rs; |
| 643 | - } else if (StringUtils.isEmpty(t.getjName())) { | ||
| 644 | - t.setjName(jName);//补上驾驶员名称 | 651 | + } else if (StringUtils.isEmpty(sch.getjName())) { |
| 652 | + sch.setjName(jName);//补上驾驶员名称 | ||
| 645 | } | 653 | } |
| 646 | 654 | ||
| 647 | //有售票员 | 655 | //有售票员 |
| 648 | - if (StringUtils.isNotEmpty(t.getsGh())) { | ||
| 649 | - String sName = getPersonName(t.getGsBm(), t.getsGh()); | 656 | + if (StringUtils.isNotEmpty(sch.getsGh())) { |
| 657 | + String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | ||
| 650 | if (StringUtils.isEmpty(sName)) { | 658 | if (StringUtils.isEmpty(sName)) { |
| 651 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | 659 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); |
| 652 | rs.put("status", ResponseCode.ERROR); | 660 | rs.put("status", ResponseCode.ERROR); |
| 653 | return rs; | 661 | return rs; |
| 654 | - } else if (StringUtils.isEmpty(t.getsName())) { | ||
| 655 | - t.setsName(sName);//补上售票员名称 | 662 | + } else if (StringUtils.isEmpty(sch.getsName())) { |
| 663 | + sch.setsName(sName);//补上售票员名称 | ||
| 656 | } | 664 | } |
| 657 | } else { | 665 | } else { |
| 658 | - t.setsGh(""); | ||
| 659 | - t.setsName(""); | 666 | + sch.setsGh(""); |
| 667 | + sch.setsName(""); | ||
| 660 | } | 668 | } |
| 661 | 669 | ||
| 662 | //公司 和 分公司名称 | 670 | //公司 和 分公司名称 |
| 663 | - t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | ||
| 664 | - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm() + "_" + t.getGsBm())); | ||
| 665 | - t.setCreateDate(new Date()); | ||
| 666 | - t.setScheduleDateStr(schDate); | ||
| 667 | - t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | ||
| 668 | - t.setRealExecDate(schDate); | ||
| 669 | - | ||
| 670 | - t.setCreateBy(user); | ||
| 671 | - t.setSflj(true); | ||
| 672 | - t.setLate(false); | ||
| 673 | - t.setDfsj(t.getFcsj()); | ||
| 674 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime()); | ||
| 675 | - t.setJhlcOrig(t.getJhlc()); | ||
| 676 | - t.setCreateDate(new Date()); | ||
| 677 | - t.setUpdateDate(new Date()); | ||
| 678 | - t.setSpId(-1L); | 671 | + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); |
| 672 | + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | ||
| 673 | + sch.setCreateDate(new Date()); | ||
| 674 | + sch.setScheduleDateStr(schDate); | ||
| 675 | + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | ||
| 676 | + sch.setRealExecDate(schDate); | ||
| 677 | + | ||
| 678 | + sch.setCreateBy(user); | ||
| 679 | + sch.setSflj(true); | ||
| 680 | + sch.setLate(false); | ||
| 681 | + sch.setDfsj(sch.getFcsj()); | ||
| 682 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | ||
| 683 | + sch.setJhlcOrig(sch.getJhlc()); | ||
| 684 | + sch.setCreateDate(new Date()); | ||
| 685 | + sch.setUpdateDate(new Date()); | ||
| 686 | + sch.setSpId(-1L); | ||
| 679 | //起终点名称 | 687 | //起终点名称 |
| 680 | - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | ||
| 681 | - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | ||
| 682 | - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | 688 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; |
| 689 | + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | ||
| 690 | + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | ||
| 683 | 691 | ||
| 684 | //计算班次实际执行时间 | 692 | //计算班次实际执行时间 |
| 685 | - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | 693 | + schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch); |
| 686 | 694 | ||
| 687 | //处理计达跨24点 | 695 | //处理计达跨24点 |
| 688 | - LineConfig conf = lineConfigData.get(t.getXlBm()); | ||
| 689 | - if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | ||
| 690 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | 696 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); |
| 697 | + if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) { | ||
| 698 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | ||
| 691 | } | 699 | } |
| 692 | 700 | ||
| 693 | //班次历时 | 701 | //班次历时 |
| 694 | - t.setBcsj((int) ((t.getZdsjT() - t.getDfsjT()) / 1000 / 60)); | ||
| 695 | - if (t.getZdsjT() < t.getFcsjT()) { | 702 | + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); |
| 703 | + if (sch.getZdsjT() < sch.getFcsjT()) { | ||
| 696 | rs.put("status", ResponseCode.ERROR); | 704 | rs.put("status", ResponseCode.ERROR); |
| 697 | rs.put("msg", "起终点时间异常!"); | 705 | rs.put("msg", "起终点时间异常!"); |
| 698 | return rs; | 706 | return rs; |
| 699 | } | 707 | } |
| 700 | 708 | ||
| 701 | - t.setId(dayOfSchedule.getId()); | 709 | + sch.setId(dayOfSchedule.getId()); |
| 702 | //实时入库 | 710 | //实时入库 |
| 703 | - super.save(t); | 711 | + super.save(sch); |
| 704 | 712 | ||
| 705 | // 加入缓存 | 713 | // 加入缓存 |
| 706 | - dayOfSchedule.put(t); | 714 | + dayOfSchedule.put(sch); |
| 707 | 715 | ||
| 708 | //更新起点应到时间 | 716 | //更新起点应到时间 |
| 709 | - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t); | 717 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); |
| 710 | 718 | ||
| 711 | //重新计算车辆当前执行班次 | 719 | //重新计算车辆当前执行班次 |
| 712 | - dayOfSchedule.reCalcExecPlan(t.getClZbh()); | 720 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); |
| 713 | 721 | ||
| 714 | //记录站到场历时数据 | 722 | //记录站到场历时数据 |
| 715 | - Station2ParkBuffer.put(t); | 723 | + Station2ParkBuffer.put(sch); |
| 716 | 724 | ||
| 717 | rs.put("ts", ts); | 725 | rs.put("ts", ts); |
| 718 | - rs.put("t", t); | 726 | + rs.put("t", sch); |
| 719 | } catch (Exception e) { | 727 | } catch (Exception e) { |
| 720 | logger.error("", e); | 728 | logger.error("", e); |
| 721 | rs.put("status", ResponseCode.ERROR); | 729 | rs.put("status", ResponseCode.ERROR); |
| @@ -3433,6 +3441,195 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3433,6 +3441,195 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3433 | } | 3441 | } |
| 3434 | 3442 | ||
| 3435 | @Override | 3443 | @Override |
| 3444 | + public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) { | ||
| 3445 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 3446 | + String lpName = "lpName"; | ||
| 3447 | + String zdsj = ""; | ||
| 3448 | + String zdsjActual = ""; | ||
| 3449 | + String zdsj1 = ""; | ||
| 3450 | + String zdsjActual1 = ""; | ||
| 3451 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | ||
| 3452 | + | ||
| 3453 | + /* | ||
| 3454 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | ||
| 3455 | + */ | ||
| 3456 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 3457 | + String minfcsj = "02:00"; | ||
| 3458 | + List<Line> lineList = lineRepository.findLineByCode(line); | ||
| 3459 | + if (lineList.size() > 0) { | ||
| 3460 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | ||
| 3461 | + + " id = (" | ||
| 3462 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | ||
| 3463 | + + ")"; | ||
| 3464 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 3465 | + } | ||
| 3466 | + String[] minSjs = minfcsj.split(":"); | ||
| 3467 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | ||
| 3468 | + for (int i = 0; i < listInfo.size(); i++) { | ||
| 3469 | + ScheduleRealInfo s = listInfo.get(i); | ||
| 3470 | + if (s.getBcType().equals("out")) { | ||
| 3471 | + s.setRemark("1"); | ||
| 3472 | + } else if (s.getBcType().equals("in")) { | ||
| 3473 | + s.setRemark("3"); | ||
| 3474 | + } else { | ||
| 3475 | + s.setRemark("2"); | ||
| 3476 | + } | ||
| 3477 | + String[] fcsj = s.getFcsj().split(":"); | ||
| 3478 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | ||
| 3479 | + | ||
| 3480 | + Long fscjT = 0L; | ||
| 3481 | + if (fcsjL < minSj) { | ||
| 3482 | + Calendar calendar = new GregorianCalendar(); | ||
| 3483 | + calendar.setTime(s.getScheduleDate()); | ||
| 3484 | + calendar.add(calendar.DATE, 1); | ||
| 3485 | + s.setScheduleDate(calendar.getTime()); | ||
| 3486 | + try { | ||
| 3487 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | ||
| 3488 | + } catch (ParseException e) { | ||
| 3489 | + // TODO Auto-generated catch block | ||
| 3490 | + e.printStackTrace(); | ||
| 3491 | + } | ||
| 3492 | + | ||
| 3493 | + } else { | ||
| 3494 | + try { | ||
| 3495 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | ||
| 3496 | + } catch (ParseException e) { | ||
| 3497 | + // TODO Auto-generated catch block | ||
| 3498 | + e.printStackTrace(); | ||
| 3499 | + } | ||
| 3500 | + ; | ||
| 3501 | + } | ||
| 3502 | + s.setFcsjT(fscjT); | ||
| 3503 | + } | ||
| 3504 | + | ||
| 3505 | +// Collections.sort(listInfo, new compareLpFcsjType()); | ||
| 3506 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | ||
| 3507 | + | ||
| 3508 | + Collections.sort(listInfo, new compareLpFcsjType()); | ||
| 3509 | + for (int i = 0; i < listInfo.size(); i++) { | ||
| 3510 | + ScheduleRealInfo t = listInfo.get(i); | ||
| 3511 | + if (!lpName.equals(t.getLpName())) { | ||
| 3512 | + zdsjActual = t.getZdsjActual(); | ||
| 3513 | + zdsj = t.getZdsj(); | ||
| 3514 | + t.setZdsjActual(""); | ||
| 3515 | + t.setZdsj(""); | ||
| 3516 | + } else { | ||
| 3517 | + zdsj1 = t.getZdsj(); | ||
| 3518 | + zdsjActual1 = t.getZdsjActual(); | ||
| 3519 | + t.setZdsjActual(zdsjActual); | ||
| 3520 | + t.setZdsj(zdsj); | ||
| 3521 | + zdsj = zdsj1; | ||
| 3522 | + zdsjActual = zdsjActual1; | ||
| 3523 | + } | ||
| 3524 | + | ||
| 3525 | + | ||
| 3526 | + | ||
| 3527 | + lpName = t.getLpName(); | ||
| 3528 | + listInfo2.add(t); | ||
| 3529 | + | ||
| 3530 | + } | ||
| 3531 | + | ||
| 3532 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | ||
| 3533 | + for (int i = 0; i < listInfo2.size(); i++) { | ||
| 3534 | + ScheduleRealInfo t=listInfo2.get(i); | ||
| 3535 | + list.add(t); | ||
| 3536 | + Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); | ||
| 3537 | + //计算营运里程,空驶里程 | ||
| 3538 | + if (!childTaskPlans.isEmpty()) { | ||
| 3539 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 3540 | + Collections.sort(listit, new ComparableChild()); | ||
| 3541 | + for (int j = 0; j < listit.size(); j++) { | ||
| 3542 | + ScheduleRealInfo s = new ScheduleRealInfo(); | ||
| 3543 | + ChildTaskPlan childTaskPlan = listit.get(j); | ||
| 3544 | + if (childTaskPlan.getCcId() == null) { | ||
| 3545 | + if (childTaskPlan.isDestroy()) { | ||
| 3546 | + s.setFcsjActual(""); | ||
| 3547 | + s.setZdsjActual(""); | ||
| 3548 | + } else { | ||
| 3549 | + s.setFcsjActual(childTaskPlan.getStartDate()); | ||
| 3550 | + s.setZdsjActual(""); | ||
| 3551 | + s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | ||
| 3552 | + } | ||
| 3553 | + s.setFcsj(childTaskPlan.getStartDate()); | ||
| 3554 | + s.setZdsj(""); | ||
| 3555 | + s.setQdzName(childTaskPlan.getStartStationName()); | ||
| 3556 | + s.setZdzName(childTaskPlan.getEndStationName()); | ||
| 3557 | + s.setRemarks(childTaskPlan.getRemarks()); | ||
| 3558 | + s.setAdjustExps("子"); | ||
| 3559 | + s.setLpName(""); | ||
| 3560 | + list.add(s); | ||
| 3561 | + } | ||
| 3562 | + } | ||
| 3563 | + } | ||
| 3564 | + } | ||
| 3565 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | ||
| 3566 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | ||
| 3567 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | ||
| 3568 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | ||
| 3569 | + if (list.size() > 0) { | ||
| 3570 | + int a = list.size() % 3; | ||
| 3571 | + int b = list.size() / 3; | ||
| 3572 | + int x = 0, y = 0; | ||
| 3573 | + if (a == 2) { | ||
| 3574 | + x = b + 1; | ||
| 3575 | + y = x * 2; | ||
| 3576 | + } else if (a == 1) { | ||
| 3577 | + x = b + 1; | ||
| 3578 | + y = x * 2 - 1; | ||
| 3579 | + } else { | ||
| 3580 | + x = b; | ||
| 3581 | + y = 2 * x; | ||
| 3582 | + | ||
| 3583 | + } | ||
| 3584 | + for (int i = 0; i < list.size(); i++) { | ||
| 3585 | + ScheduleRealInfo s = list.get(i); | ||
| 3586 | + if (i + 1 <= x) { | ||
| 3587 | + xList.add(s); | ||
| 3588 | + } else if ((i + 1) > x && (i + 1) <= y) { | ||
| 3589 | + yList.add(s); | ||
| 3590 | + } else { | ||
| 3591 | + zList.add(s); | ||
| 3592 | + } | ||
| 3593 | + } | ||
| 3594 | + for (int i = 0; i < x; i++) { | ||
| 3595 | + newList.add(xList.get(i)); | ||
| 3596 | + if (yList.size() > i) { | ||
| 3597 | + newList.add(yList.get(i)); | ||
| 3598 | + } else { | ||
| 3599 | + newList.add(new ScheduleRealInfo()); | ||
| 3600 | + } | ||
| 3601 | + if (zList.size() > i) { | ||
| 3602 | + newList.add(zList.get(i)); | ||
| 3603 | + } else { | ||
| 3604 | + newList.add(new ScheduleRealInfo()); | ||
| 3605 | + } | ||
| 3606 | + | ||
| 3607 | + } | ||
| 3608 | + } | ||
| 3609 | + /* for (int i = 0; i < newList.size(); i++) { | ||
| 3610 | + ScheduleRealInfo t1 = newList.get(i); | ||
| 3611 | + for (int j = 0; j < list.size(); j++) { | ||
| 3612 | + ScheduleRealInfo t2 = list.get(j); | ||
| 3613 | + if (t1.getId() == t2.getId()) { | ||
| 3614 | + t1 = t2; | ||
| 3615 | + } | ||
| 3616 | + } | ||
| 3617 | + }*/ | ||
| 3618 | + | ||
| 3619 | + for (int i = 0; i < newList.size(); i++) { | ||
| 3620 | + ScheduleRealInfo t1 = newList.get(i); | ||
| 3621 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | ||
| 3622 | + if (reamrks1.length() > 4) { | ||
| 3623 | + t1.setRemarks(reamrks1.substring(0, 4)); | ||
| 3624 | + t1.setRemark(reamrks1); | ||
| 3625 | + } else { | ||
| 3626 | + t1.setRemark(reamrks1); | ||
| 3627 | + } | ||
| 3628 | + } | ||
| 3629 | + return newList; | ||
| 3630 | + } | ||
| 3631 | + | ||
| 3632 | + @Override | ||
| 3436 | public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { | 3633 | public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { |
| 3437 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 3634 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 3438 | String lpName = "lpName"; | 3635 | String lpName = "lpName"; |
| @@ -4774,13 +4971,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4774,13 +4971,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4774 | String xlName = map.get("xlName").toString(); | 4971 | String xlName = map.get("xlName").toString(); |
| 4775 | String state = map.get("state").toString(); | 4972 | String state = map.get("state").toString(); |
| 4776 | String type = map.get("type").toString(); | 4973 | String type = map.get("type").toString(); |
| 4777 | - | 4974 | + String genre =map.get("genre").toString(); |
| 4778 | List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); | 4975 | List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); |
| 4779 | List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); | 4976 | List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); |
| 4780 | List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); | 4977 | List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); |
| 4781 | List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); | 4978 | List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); |
| 4782 | - List<ScheduleRealInfo> list3 = this.realScheduleList(line, date); | ||
| 4783 | - | 4979 | + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>(); |
| 4980 | + if(genre.equals("qp")) | ||
| 4981 | + list3=this.realScheduleListQp(line, date); | ||
| 4982 | + else if(genre.equals("zrw")) | ||
| 4983 | + list3=this.realScheduleList_zrw(line, date); | ||
| 4984 | + else | ||
| 4985 | + list3=this.realScheduleList(line, date); | ||
| 4784 | Map<String, Object> nMap = new HashMap<String, Object>(); | 4986 | Map<String, Object> nMap = new HashMap<String, Object>(); |
| 4785 | nMap.put("date", xlName + date); | 4987 | nMap.put("date", xlName + date); |
| 4786 | nMap.put("jls", list1.get(0).get("jls")); | 4988 | nMap.put("jls", list1.get(0).get("jls")); |
| @@ -4908,7 +5110,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4908,7 +5110,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4908 | } | 5110 | } |
| 4909 | } | 5111 | } |
| 4910 | tempMap.put("zdsjk" + x, zdsjk); | 5112 | tempMap.put("zdsjk" + x, zdsjk); |
| 4911 | - tempMap.put("zdsjm" + x, zdsjm); | 5113 | + tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm); |
| 4912 | tempMap.put("fcsj" + x, schedule.getFcsj()); | 5114 | tempMap.put("fcsj" + x, schedule.getFcsj()); |
| 4913 | String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; | 5115 | String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; |
| 4914 | String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; | 5116 | String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; |
| @@ -4935,7 +5137,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4935,7 +5137,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4935 | } | 5137 | } |
| 4936 | } | 5138 | } |
| 4937 | tempMap.put("fcsjk" + x, fcsjk); | 5139 | tempMap.put("fcsjk" + x, fcsjk); |
| 4938 | - tempMap.put("fcsjm" + x, fcsjm); | 5140 | + tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm); |
| 4939 | tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); | 5141 | tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); |
| 4940 | 5142 | ||
| 4941 | size++; | 5143 | size++; |
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
| @@ -10,7 +10,10 @@ import java.util.List; | @@ -10,7 +10,10 @@ import java.util.List; | ||
| 10 | * Created by xu on 16/5/9. | 10 | * Created by xu on 16/5/9. |
| 11 | */ | 11 | */ |
| 12 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { | 12 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { |
| 13 | + // 判定车辆是否配置在其他线路上 | ||
| 13 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; | 14 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; |
| 15 | + // 判定车辆是否配置在其他线路上2 | ||
| 16 | + void validate_cars(Integer xlId, Integer clId) throws ScheduleException; | ||
| 14 | // 判定车辆是否配置在当前线路中 | 17 | // 判定车辆是否配置在当前线路中 |
| 15 | void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException; | 18 | void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException; |
| 16 | // 判定车辆所属公司和当前用户的所属公司 | 19 | // 判定车辆所属公司和当前用户的所属公司 |
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | -import com.bsth.service.schedule.rules.ttinfo2.Result; | 4 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult; |
| 5 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result; | ||
| 5 | 6 | ||
| 6 | import java.util.Date; | 7 | import java.util.Date; |
| 7 | 8 | ||
| @@ -26,4 +27,13 @@ public interface SchedulePlanService extends BService<SchedulePlan, Long> { | @@ -26,4 +27,13 @@ public interface SchedulePlanService extends BService<SchedulePlan, Long> { | ||
| 26 | * @return | 27 | * @return |
| 27 | */ | 28 | */ |
| 28 | Result validateTTInfo(Integer xlid, Date from, Date to); | 29 | Result validateTTInfo(Integer xlid, Date from, Date to); |
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 验证规则。 | ||
| 33 | + * @param xlId 线路id | ||
| 34 | + * @param from 排班计划开始时间 | ||
| 35 | + * @param to 排班计划结束时间 | ||
| 36 | + * @return | ||
| 37 | + */ | ||
| 38 | + ValidateRuleResult validateRule(Integer xlId, Date from, Date to); | ||
| 29 | } | 39 | } |
| 30 | \ No newline at end of file | 40 | \ No newline at end of file |
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
| @@ -130,6 +130,18 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | @@ -130,6 +130,18 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | ||
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | @Override | 132 | @Override |
| 133 | + public void validate_cars(Integer xlId, Integer clId) throws ScheduleException { | ||
| 134 | + Map<String, Object> param = new HashMap<>(); | ||
| 135 | + param.put("cl.id_eq", clId); | ||
| 136 | + List<CarConfigInfo> carConfigInfos = list(param); | ||
| 137 | + for (CarConfigInfo carConfigInfo : carConfigInfos) { | ||
| 138 | + if (!carConfigInfo.getXl().getId().equals(xlId)) { | ||
| 139 | + throw new ScheduleException("车辆不配置在当前线路下,配置在" + carConfigInfo.getXl().getName() + "线路中!"); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + @Override | ||
| 133 | public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException { | 145 | public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException { |
| 134 | Map<String, Object> param = new HashMap<>(); | 146 | Map<String, Object> param = new HashMap<>(); |
| 135 | param.put("xl.id_eq", carConfigInfo.getXl().getId()); | 147 | param.put("xl.id_eq", carConfigInfo.getXl().getId()); |
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.CarDevice; | ||
| 3 | import com.bsth.entity.Cars; | 4 | import com.bsth.entity.Cars; |
| 5 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 6 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 7 | +import com.bsth.service.schedule.CarDeviceService; | ||
| 4 | import com.bsth.service.schedule.CarsService; | 8 | import com.bsth.service.schedule.CarsService; |
| 5 | import com.bsth.service.schedule.exception.ScheduleException; | 9 | import com.bsth.service.schedule.exception.ScheduleException; |
| 6 | import com.bsth.service.schedule.utils.DataToolsFile; | 10 | import com.bsth.service.schedule.utils.DataToolsFile; |
| @@ -12,7 +16,9 @@ import org.springframework.transaction.annotation.Transactional; | @@ -12,7 +16,9 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 12 | import org.springframework.util.CollectionUtils; | 16 | import org.springframework.util.CollectionUtils; |
| 13 | 17 | ||
| 14 | import java.io.File; | 18 | import java.io.File; |
| 19 | +import java.util.Date; | ||
| 15 | import java.util.HashMap; | 20 | import java.util.HashMap; |
| 21 | +import java.util.List; | ||
| 16 | import java.util.Map; | 22 | import java.util.Map; |
| 17 | 23 | ||
| 18 | /** | 24 | /** |
| @@ -24,6 +30,48 @@ public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements Cars | @@ -24,6 +30,48 @@ public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements Cars | ||
| 24 | @Qualifier(value = "cars_dataTool") | 30 | @Qualifier(value = "cars_dataTool") |
| 25 | private DataToolsService dataToolsService; | 31 | private DataToolsService dataToolsService; |
| 26 | 32 | ||
| 33 | + @Autowired | ||
| 34 | + @Qualifier(value = "carDeviceServiceImpl_sc") | ||
| 35 | + private CarDeviceService carDeviceService; | ||
| 36 | + | ||
| 37 | + @Autowired | ||
| 38 | + private CarConfigInfoRepository carConfigInfoRepository; | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public Cars save(Cars cars) { | ||
| 42 | + if (cars.getId() != null && cars.getScrapState()) { // 更新车辆信息,报废车辆 | ||
| 43 | + // 1、作废的车辆,修改报废号 | ||
| 44 | + String eCode = cars.getEquipmentCode(); | ||
| 45 | + cars.setEquipmentCode("BF-" + eCode); | ||
| 46 | + cars.setScrapCode("BF-" + cars.getEquipmentCode()); | ||
| 47 | + // 2、添加一条相关的设备替换记录 | ||
| 48 | + // 查找在哪条线路上 | ||
| 49 | + List<CarConfigInfo> carConfigInfoList = carConfigInfoRepository.findByClId(cars.getId()); | ||
| 50 | + for (CarConfigInfo carConfigInfo : carConfigInfoList) { | ||
| 51 | + CarDevice carDevice = new CarDevice(); | ||
| 52 | + carDevice.setGsName(cars.getCompany()); | ||
| 53 | + carDevice.setCompany(cars.getBusinessCode()); | ||
| 54 | + carDevice.setBrancheCompany(cars.getBrancheCompanyCode()); | ||
| 55 | + carDevice.setCl(cars.getId()); | ||
| 56 | + carDevice.setClZbh(cars.getInsideCode()); | ||
| 57 | + carDevice.setXl(carConfigInfo.getXl().getId()); | ||
| 58 | + carDevice.setXlName(carConfigInfo.getXl().getName()); | ||
| 59 | + carDevice.setXlBm(carConfigInfo.getXl().getLineCode()); | ||
| 60 | + carDevice.setOldDeviceNo(eCode); | ||
| 61 | + carDevice.setNewDeviceNo("BF-" + eCode); | ||
| 62 | + carDevice.setIsCancel(false); | ||
| 63 | + | ||
| 64 | + carDevice.setCreateBy(cars.getCreateBy()); | ||
| 65 | + carDevice.setUpdateBy(cars.getUpdateBy()); | ||
| 66 | + carDevice.setCreateDate(new Date()); | ||
| 67 | + carDevice.setUpdateDate(new Date()); | ||
| 68 | + carDeviceService.save(carDevice); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return super.save(cars); | ||
| 73 | + } | ||
| 74 | + | ||
| 27 | @Override | 75 | @Override |
| 28 | public void importData(File file, Map<String, Object> params) throws ScheduleException { | 76 | public void importData(File file, Map<String, Object> params) throws ScheduleException { |
| 29 | dataToolsService.importData(file, params); | 77 | dataToolsService.importData(file, params); |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Line; | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | import com.bsth.entity.schedule.TTInfo; | 5 | import com.bsth.entity.schedule.TTInfo; |
| 5 | import com.bsth.repository.BusinessRepository; | 6 | import com.bsth.repository.BusinessRepository; |
| @@ -7,10 +8,11 @@ import com.bsth.repository.LineRepository; | @@ -7,10 +8,11 @@ import com.bsth.repository.LineRepository; | ||
| 7 | import com.bsth.repository.schedule.*; | 8 | import com.bsth.repository.schedule.*; |
| 8 | import com.bsth.service.schedule.SchedulePlanService; | 9 | import com.bsth.service.schedule.SchedulePlanService; |
| 9 | import com.bsth.service.schedule.exception.ScheduleException; | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 10 | -import com.bsth.service.schedule.plan.DroolsSchedulePlan; | ||
| 11 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | ||
| 12 | -import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; | ||
| 13 | -import com.bsth.service.schedule.rules.ttinfo2.Result; | 11 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult; |
| 12 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam; | ||
| 13 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result; | ||
| 14 | +import com.bsth.service.schedule.impl.plan.DroolsSchedulePlan; | ||
| 15 | +import com.bsth.service.schedule.impl.plan.ScheduleRuleService; | ||
| 14 | import org.joda.time.DateTime; | 16 | import org.joda.time.DateTime; |
| 15 | import org.kie.api.KieBase; | 17 | import org.kie.api.KieBase; |
| 16 | import org.kie.api.runtime.KieSession; | 18 | import org.kie.api.runtime.KieSession; |
| @@ -42,6 +44,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -42,6 +44,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 42 | private KieBase preKBase; | 44 | private KieBase preKBase; |
| 43 | 45 | ||
| 44 | @Autowired | 46 | @Autowired |
| 47 | + @Qualifier("KBase3") | ||
| 48 | + private KieBase validateKBase; | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 45 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; | 51 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; |
| 46 | @Autowired | 52 | @Autowired |
| 47 | private TTInfoRepository ttInfoRepository; | 53 | private TTInfoRepository ttInfoRepository; |
| @@ -52,6 +58,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -52,6 +58,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 52 | @Autowired | 58 | @Autowired |
| 53 | private CarConfigInfoRepository carConfigInfoRepository; | 59 | private CarConfigInfoRepository carConfigInfoRepository; |
| 54 | @Autowired | 60 | @Autowired |
| 61 | + private GuideboardInfoRepository guideboardInfoRepository; | ||
| 62 | + @Autowired | ||
| 55 | private EmployeeConfigInfoRepository employeeConfigInfoRepository; | 63 | private EmployeeConfigInfoRepository employeeConfigInfoRepository; |
| 56 | @Autowired | 64 | @Autowired |
| 57 | private BusinessRepository businessRepository; | 65 | private BusinessRepository businessRepository; |
| @@ -146,22 +154,25 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -146,22 +154,25 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 146 | public Result validateTTInfo(Integer xlid, Date from, Date to) { | 154 | public Result validateTTInfo(Integer xlid, Date from, Date to) { |
| 147 | // 构造drools session->载入数据->启动规则->计算->销毁session | 155 | // 构造drools session->载入数据->启动规则->计算->销毁session |
| 148 | // 创建session,内部配置的是stateful | 156 | // 创建session,内部配置的是stateful |
| 149 | - KieSession session = coreKBase.newKieSession(); | 157 | + KieSession session = validateKBase.newKieSession(); |
| 150 | // 设置gloable对象,在drl中通过别名使用 | 158 | // 设置gloable对象,在drl中通过别名使用 |
| 151 | session.setGlobal("log", logger); | 159 | session.setGlobal("log", logger); |
| 152 | - session.setGlobal("lineRepository", lineRepository); | ||
| 153 | session.setGlobal("tTInfoDetailRepository", ttInfoDetailRepository); | 160 | session.setGlobal("tTInfoDetailRepository", ttInfoDetailRepository); |
| 154 | 161 | ||
| 155 | Result rs = new Result(); // 输出gloable对象 | 162 | Result rs = new Result(); // 输出gloable对象 |
| 156 | session.setGlobal("rs", rs); | 163 | session.setGlobal("rs", rs); |
| 157 | 164 | ||
| 158 | // 载入数据 | 165 | // 载入数据 |
| 166 | + Line line = lineRepository.findOne(xlid); | ||
| 167 | + session.insert(line); | ||
| 168 | + | ||
| 159 | CalcuParam calcuParam = new CalcuParam( | 169 | CalcuParam calcuParam = new CalcuParam( |
| 160 | new DateTime(from), new DateTime(to), xlid); | 170 | new DateTime(from), new DateTime(to), xlid); |
| 161 | session.insert(calcuParam); | 171 | session.insert(calcuParam); |
| 162 | - List<TTInfo> ttInfos = (List<TTInfo>) ttInfoRepository.findAll(); | ||
| 163 | - for (TTInfo ttInfo: ttInfos) | ||
| 164 | - session.insert(ttInfo); | 172 | + List<TTInfo> ttInfos = ttInfoRepository.findByXlId(xlid); |
| 173 | + for (TTInfo ttInfo: ttInfos) { | ||
| 174 | + session.insert(ttInfo); | ||
| 175 | + } | ||
| 165 | 176 | ||
| 166 | // 执行rule | 177 | // 执行rule |
| 167 | session.fireAllRules(); | 178 | session.fireAllRules(); |
| @@ -171,4 +182,30 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -171,4 +182,30 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 171 | 182 | ||
| 172 | return rs; | 183 | return rs; |
| 173 | } | 184 | } |
| 185 | + | ||
| 186 | + @Override | ||
| 187 | + public ValidateRuleResult validateRule(Integer xlId, Date from, Date to) { | ||
| 188 | + KieSession session = validateKBase.newKieSession(); | ||
| 189 | + session.setGlobal("LOG", logger); | ||
| 190 | + session.setGlobal("ccRepo", carConfigInfoRepository); | ||
| 191 | + session.setGlobal("lpRepo", guideboardInfoRepository); | ||
| 192 | + session.setGlobal("ecRepo", employeeConfigInfoRepository); | ||
| 193 | + session.setGlobal("ruleRepo", scheduleRule1FlatRepository); | ||
| 194 | + | ||
| 195 | + ValidateRuleResult result = new ValidateRuleResult(); | ||
| 196 | + session.setGlobal("result", result); | ||
| 197 | + | ||
| 198 | + com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam calcuParam = | ||
| 199 | + new com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam(); | ||
| 200 | + calcuParam.setXlId(xlId); | ||
| 201 | + calcuParam.setFromDate(new DateTime(from)); | ||
| 202 | + calcuParam.setToDate(new DateTime(to)); | ||
| 203 | + session.insert(calcuParam); | ||
| 204 | + | ||
| 205 | + session.fireAllRules(); | ||
| 206 | + | ||
| 207 | + session.dispose();; | ||
| 208 | + | ||
| 209 | + return result; | ||
| 210 | + } | ||
| 174 | } | 211 | } |
src/main/java/com/bsth/service/schedule/plan/DroolsSchedulePlan.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/DroolsSchedulePlan.java
| 1 | -package com.bsth.service.schedule.plan; | 1 | +package com.bsth.service.schedule.impl.plan; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.schedule.SchedulePlan; | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| @@ -8,17 +8,16 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | @@ -8,17 +8,16 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 8 | import com.bsth.repository.BusinessRepository; | 8 | import com.bsth.repository.BusinessRepository; |
| 9 | import com.bsth.repository.LineRepository; | 9 | import com.bsth.repository.LineRepository; |
| 10 | import com.bsth.repository.schedule.*; | 10 | import com.bsth.repository.schedule.*; |
| 11 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | ||
| 12 | -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | ||
| 13 | -import com.bsth.service.schedule.rules.plan.PlanResult; | ||
| 14 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 15 | -import com.bsth.service.schedule.rules.rerun.RerunRule_param; | ||
| 16 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | ||
| 17 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | ||
| 18 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | ||
| 19 | -import com.bsth.service.schedule.rules.ttinfo.*; | ||
| 20 | -import com.bsth.service.schedule.rules.validate.ValidateParam; | ||
| 21 | -import com.bsth.service.schedule.rules.validate.ValidateResults_output; | 11 | +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input; |
| 12 | +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult; | ||
| 13 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; | ||
| 14 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param; | ||
| 15 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input; | ||
| 16 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; | ||
| 17 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | ||
| 18 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.*; | ||
| 19 | +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateParam; | ||
| 20 | +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResults_output; | ||
| 22 | import org.apache.commons.lang3.StringUtils; | 21 | import org.apache.commons.lang3.StringUtils; |
| 23 | import org.joda.time.DateTime; | 22 | import org.joda.time.DateTime; |
| 24 | import org.kie.api.KieBase; | 23 | import org.kie.api.KieBase; |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/MyDroolsConfiguration.java
| 1 | -package com.bsth.service.schedule.rules; | 1 | +package com.bsth.service.schedule.impl.plan; |
| 2 | 2 | ||
| 3 | import org.kie.api.KieBase; | 3 | import org.kie.api.KieBase; |
| 4 | import org.kie.api.KieBaseConfiguration; | 4 | import org.kie.api.KieBaseConfiguration; |
| @@ -56,27 +56,24 @@ public class MyDroolsConfiguration { | @@ -56,27 +56,24 @@ public class MyDroolsConfiguration { | ||
| 56 | // 3.2、写入drl(写法超多,有点混乱) | 56 | // 3.2、写入drl(写法超多,有点混乱) |
| 57 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 | 57 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 |
| 58 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 | 58 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 |
| 59 | - kfs.write("src/main/resources/functions.drl", kieServices.getResources() | 59 | + kfs.write("src/main/resources/kBase1_core_shiftloop.drl", kieServices.getResources() |
| 60 | .newInputStreamResource(this.getClass().getResourceAsStream( | 60 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 61 | - "/rules/functions.drl"), "UTF-8")); | ||
| 62 | - kfs.write("src/main/resources/shiftloop_fb_2.drl", kieServices.getResources() | 61 | + "/rules/kBase1_core_shiftloop.drl"), "UTF-8")); |
| 62 | + kfs.write("src/main/resources/kBase1_core_ttinfo.drl", kieServices.getResources() | ||
| 63 | .newInputStreamResource(this.getClass().getResourceAsStream( | 63 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 64 | - "/rules/shiftloop_fb_2.drl"), "UTF-8")); | ||
| 65 | - kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() | 64 | + "/rules/kBase1_core_ttinfo.drl"), "UTF-8")); |
| 65 | + kfs.write("src/main/resources/kBase1_core_plan.drl", kieServices.getResources() | ||
| 66 | .newInputStreamResource(this.getClass().getResourceAsStream( | 66 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 67 | - "/rules/ttinfo.drl"), "UTF-8")); | ||
| 68 | - kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() | 67 | + "/rules/kBase1_core_plan.drl"), "UTF-8")); |
| 68 | + kfs.write("src/main/resources/kBase1_core_rerun.drl", kieServices.getResources() | ||
| 69 | .newInputStreamResource(this.getClass().getResourceAsStream( | 69 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 70 | - "/rules/ttinfo2.drl"), "UTF-8")); | ||
| 71 | - kfs.write("src/main/resources/plan.drl", kieServices.getResources() | 70 | + "/rules/kBase1_core_rerun.drl"), "UTF-8")); |
| 71 | + kfs.write("src/main/resources/kBase1_core_validate.drl", kieServices.getResources() | ||
| 72 | .newInputStreamResource(this.getClass().getResourceAsStream( | 72 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 73 | - "/rules/plan.drl"), "UTF-8")); | ||
| 74 | - kfs.write("src/main/resources/rerun.drl", kieServices.getResources() | 73 | + "/rules/kBase1_core_validate.drl"), "UTF-8")); |
| 74 | + kfs.write("src/main/resources/kBase1_core_functions.drl", kieServices.getResources() | ||
| 75 | .newInputStreamResource(this.getClass().getResourceAsStream( | 75 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 76 | - "/rules/rerun.drl"), "UTF-8")); | ||
| 77 | - kfs.write("src/main/resources/validplan.drl", kieServices.getResources() | ||
| 78 | - .newInputStreamResource(this.getClass().getResourceAsStream( | ||
| 79 | - "/rules/validplan.drl"), "UTF-8")); | 76 | + "/rules/kBase1_core_functions.drl"), "UTF-8")); |
| 80 | // TODO:还有其他drl.... | 77 | // TODO:还有其他drl.... |
| 81 | 78 | ||
| 82 | // 4、创建KieBuilder,使用KieFileSystem构建 | 79 | // 4、创建KieBuilder,使用KieFileSystem构建 |
| @@ -134,9 +131,9 @@ public class MyDroolsConfiguration { | @@ -134,9 +131,9 @@ public class MyDroolsConfiguration { | ||
| 134 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 | 131 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 |
| 135 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 | 132 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 |
| 136 | 133 | ||
| 137 | - kfs.write("src/main/resources/ruleWrap.drl", kieServices.getResources() | 134 | + kfs.write("src/main/resources/kBase2_wrap_rule.drl", kieServices.getResources() |
| 138 | .newInputStreamResource(this.getClass().getResourceAsStream( | 135 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 139 | - "/rules/ruleWrap.drl"), "UTF-8")); | 136 | + "/rules/kBase2_wrap_rule.drl"), "UTF-8")); |
| 140 | 137 | ||
| 141 | // TODO:还有其他drl.... | 138 | // TODO:还有其他drl.... |
| 142 | 139 | ||
| @@ -161,4 +158,52 @@ public class MyDroolsConfiguration { | @@ -161,4 +158,52 @@ public class MyDroolsConfiguration { | ||
| 161 | 158 | ||
| 162 | return kieBase; | 159 | return kieBase; |
| 163 | } | 160 | } |
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * 验证相关的drl知识库。 | ||
| 164 | + * @return | ||
| 165 | + */ | ||
| 166 | + @Bean(name = "KBase3") | ||
| 167 | + public KieBase myKieBase3() { | ||
| 168 | + KieServices kieServices = KieServices.Factory.get(); | ||
| 169 | + KieModuleModel kieModuleModel = kieServices.newKieModuleModel(); | ||
| 170 | + KieBaseModel kieBaseModel = kieModuleModel.newKieBaseModel("KBase3") | ||
| 171 | + .setDefault(true) | ||
| 172 | + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY) | ||
| 173 | + .setEventProcessingMode(EventProcessingOption.STREAM); | ||
| 174 | + kieBaseModel.newKieSessionModel("KSession1") | ||
| 175 | + .setDefault(true) | ||
| 176 | + .setType(KieSessionModel.KieSessionType.STATEFUL) | ||
| 177 | + .setClockType(ClockTypeOption.get("realtime")); | ||
| 178 | + | ||
| 179 | + KieFileSystem kieFileSystem = kieServices.newKieFileSystem(); | ||
| 180 | + kieFileSystem.writeKModuleXML(kieModuleModel.toXML()); | ||
| 181 | + | ||
| 182 | + kieFileSystem.write( | ||
| 183 | + "src/main/resources/kBase3_validate_timetable.drl", | ||
| 184 | + kieServices.getResources().newInputStreamResource( | ||
| 185 | + this.getClass().getResourceAsStream("/rules/kBase3_validate_timetable.drl"), | ||
| 186 | + "UTF-8")); | ||
| 187 | + kieFileSystem.write( | ||
| 188 | + "src/main/resources/kbase3_validate_rule.drl", | ||
| 189 | + kieServices.getResources().newInputStreamResource( | ||
| 190 | + this.getClass().getResourceAsStream("/rules/kBase3_validate_rule.drl"), | ||
| 191 | + "UTF-8")); | ||
| 192 | + | ||
| 193 | + KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll(); | ||
| 194 | + Results results = kieBuilder.getResults(); | ||
| 195 | + if (results.hasMessages(Message.Level.ERROR)) { | ||
| 196 | + throw new IllegalStateException("构建drools6错误:" + results.getMessages()); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId(); | ||
| 200 | + KieContainer kieContainer = kieServices.newKieContainer(releaseId); | ||
| 201 | + | ||
| 202 | + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration(); | ||
| 203 | + KieBase kieBase = kieContainer.newKieBase("KBase3", kieBaseConfiguration); | ||
| 204 | + | ||
| 205 | + return kieBase; | ||
| 206 | + | ||
| 207 | + } | ||
| 208 | + | ||
| 164 | } | 209 | } |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleService.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleService.java
| 1 | -package com.bsth.service.schedule.rules; | 1 | +package com.bsth.service.schedule.impl.plan; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | import com.bsth.entity.schedule.SchedulePlanInfo; | 4 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 6 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; |
| 7 | 7 | ||
| 8 | import java.util.Date; | 8 | import java.util.Date; |
| 9 | import java.util.List; | 9 | import java.util.List; |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleServiceImpl.java
| 1 | -package com.bsth.service.schedule.rules; | 1 | +package com.bsth.service.schedule.impl.plan; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | import com.bsth.entity.schedule.SchedulePlanInfo; | 4 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 6 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanCalcuParam_input.java
| 1 | -package com.bsth.service.schedule.rules.plan; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.plan; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | ||
| 5 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; |
| 5 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output; | ||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * 排班规则-规则输入参数。 | 8 | * 排班规则-规则输入参数。 |
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanResult.java
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/readme.txt
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_input.java
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_param.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_param.java
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbFcnoFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbFcnoFunction.java
| 1 | -package com.bsth.service.schedule.rules.shiftloop; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.TTInfoDetail; | 3 | import com.bsth.entity.schedule.TTInfoDetail; |
| 4 | import org.kie.api.runtime.rule.AccumulateFunction; | 4 | import org.kie.api.runtime.rule.AccumulateFunction; |
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbTimeFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbTimeFunction.java
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidsCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidsCountFunction.java
| 1 | -package com.bsth.service.schedule.rules.shiftloop; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.TTInfoDetail; | 3 | import com.bsth.entity.schedule.TTInfoDetail; |
| 4 | import org.kie.api.runtime.rule.AccumulateFunction; | 4 | import org.kie.api.runtime.rule.AccumulateFunction; |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleCalcuParam_input.java
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResult_output.java
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResults_output.java
| 1 | -package com.bsth.service.schedule.rules.shiftloop; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 3 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 4 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_Type.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_Type.java
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_input.java
| 1 | -package com.bsth.service.schedule.rules.shiftloop; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 4 | import com.google.common.base.Splitter; | 4 | import com.google.common.base.Splitter; |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResult_output.java
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResultsFunction.java
| 1 | -package com.bsth.service.schedule.rules.ttinfo; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.TTInfoDetail; | 3 | import com.bsth.entity.schedule.TTInfoDetail; |
| 4 | import org.kie.api.runtime.rule.AccumulateFunction; | 4 | import org.kie.api.runtime.rule.AccumulateFunction; |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResults_output.java
src/main/java/com/bsth/service/schedule/rules/ttinfo/MinRuleQyrqFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/MinRuleQyrqFunction.java
| 1 | -package com.bsth.service.schedule.rules.ttinfo; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo; |
| 2 | 2 | ||
| 3 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | 3 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; |
| 4 | import org.joda.time.DateTime; | 4 | import org.joda.time.DateTime; |
| 5 | import org.kie.api.runtime.rule.AccumulateFunction; | 5 | import org.kie.api.runtime.rule.AccumulateFunction; |
| 6 | 6 |
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoCalcuParam_input.java
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResult_output.java
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResults_output.java
| 1 | -package com.bsth.service.schedule.rules.ttinfo; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo; |
| 2 | 2 | ||
| 3 | import com.google.common.collect.ArrayListMultimap; | 3 | import com.google.common.collect.ArrayListMultimap; |
| 4 | import com.google.common.collect.Multimap; | 4 | import com.google.common.collect.Multimap; |
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfo_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfo_input.java
src/main/java/com/bsth/service/schedule/rules/ttinfo/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/readme.txt
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidRepeatBcFunction.java
| 1 | -package com.bsth.service.schedule.rules.validate; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | import org.kie.api.runtime.rule.AccumulateFunction; | 4 | import org.kie.api.runtime.rule.AccumulateFunction; |
src/main/java/com/bsth/service/schedule/rules/validate/ValidWantLpFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWantLpFunction.java
| 1 | -package com.bsth.service.schedule.rules.validate; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; |
| 5 | import org.kie.api.runtime.rule.AccumulateFunction; | 5 | import org.kie.api.runtime.rule.AccumulateFunction; |
| 6 | 6 | ||
| 7 | import java.io.*; | 7 | import java.io.*; |
src/main/java/com/bsth/service/schedule/rules/validate/ValidWholeRerunBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWholeRerunBcFunction.java
| 1 | -package com.bsth.service.schedule.rules.validate; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | import org.kie.api.runtime.rule.AccumulateFunction; | 4 | import org.kie.api.runtime.rule.AccumulateFunction; |
src/main/java/com/bsth/service/schedule/rules/validate/ValidateParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateParam.java
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResource.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResource.java
| 1 | -package com.bsth.service.schedule.rules.validate; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; |
| 5 | 5 | ||
| 6 | import java.util.Date; | 6 | import java.util.Date; |
| 7 | import java.util.List; | 7 | import java.util.List; |
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResults_output.java
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/CalcuParam.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | ||
| 2 | + | ||
| 3 | +import org.joda.time.DateTime; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 计算用参数。 | ||
| 7 | + */ | ||
| 8 | +public class CalcuParam { | ||
| 9 | + /** 线路Id */ | ||
| 10 | + private Integer xlId; | ||
| 11 | + | ||
| 12 | + /** 计划开始计算日期 */ | ||
| 13 | + private DateTime fromDate; | ||
| 14 | + /** 计划结束计算日期 */ | ||
| 15 | + private DateTime toDate; | ||
| 16 | + | ||
| 17 | + public Integer getXlId() { | ||
| 18 | + return xlId; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setXlId(Integer xlId) { | ||
| 22 | + this.xlId = xlId; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public DateTime getFromDate() { | ||
| 26 | + return fromDate; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setFromDate(DateTime fromDate) { | ||
| 30 | + this.fromDate = fromDate; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public DateTime getToDate() { | ||
| 34 | + return toDate; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public void setToDate(DateTime toDate) { | ||
| 38 | + this.toDate = toDate; | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ErrorInfoFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 5 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 6 | +import org.apache.commons.lang3.StringUtils; | ||
| 7 | +import org.apache.commons.lang3.math.NumberUtils; | ||
| 8 | +import org.kie.api.runtime.rule.AccumulateFunction; | ||
| 9 | + | ||
| 10 | +import java.io.*; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 查找错误函数。 | ||
| 16 | + */ | ||
| 17 | +public class ErrorInfoFunction implements AccumulateFunction { | ||
| 18 | + @Override | ||
| 19 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 20 | + | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + protected static class ErrorInfoContext implements Externalizable { | ||
| 29 | + /** 错误数量 */ | ||
| 30 | + public Integer errorCount = 0; | ||
| 31 | + /** 错误Map,Map<规则id,errorInfo> */ | ||
| 32 | + public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>(); | ||
| 33 | + | ||
| 34 | + public ErrorInfoContext() { | ||
| 35 | + | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 40 | + errorCount = in.readInt(); | ||
| 41 | + errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject(); | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 47 | + out.writeInt(errorCount); | ||
| 48 | + out.writeObject(errorInfoMap); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public Serializable createContext() { | ||
| 55 | + return new ErrorInfoContext(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public void init(Serializable serializable) throws Exception { | ||
| 60 | + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable; | ||
| 61 | + errorInfoContext.errorCount = 0; | ||
| 62 | + errorInfoContext.errorInfoMap = new HashMap<>(); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public void accumulate(Serializable serializable, Object o) { | ||
| 67 | + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable; | ||
| 68 | + WrapInput wrapInput = (WrapInput) o; | ||
| 69 | + | ||
| 70 | + ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo(); | ||
| 71 | + errorInfo.setRuleId(wrapInput.getRuleId()); | ||
| 72 | + errorInfo.setClZbh(wrapInput.getClZbh()); | ||
| 73 | + errorInfo.setQyrq(wrapInput.getQyrq()); | ||
| 74 | + | ||
| 75 | + // 1、车辆配置验证 | ||
| 76 | + if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空 | ||
| 77 | + if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上 | ||
| 78 | + errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!"); | ||
| 79 | + } | ||
| 80 | + } else { | ||
| 81 | + errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!"); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + // 2、路牌id,路牌名字,路牌起始索引验证 | ||
| 85 | + if (StringUtils.isNotEmpty(wrapInput.getLpIds()) && | ||
| 86 | + StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空 | ||
| 87 | + String[] lpIds = wrapInput.getLpIds().split(","); | ||
| 88 | + String[] lpNames = wrapInput.getLpNames().split(","); | ||
| 89 | + if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致 | ||
| 90 | + for (int i = 0; i < lpIds.length; i++) { | ||
| 91 | + if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字 | ||
| 92 | + errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!"); | ||
| 93 | + break; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i])); | ||
| 97 | + if (lpInfo == null) { // 路牌不在当前线路上 | ||
| 98 | + errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!"); | ||
| 99 | + } else { | ||
| 100 | + if (StringUtils.isEmpty(lpNames[i]) || | ||
| 101 | + !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应 | ||
| 102 | + errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!"); | ||
| 103 | + break; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + if (wrapInput.getLpStartIndex() < 1 || | ||
| 109 | + wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出 | ||
| 110 | + errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!"); | ||
| 111 | + } | ||
| 112 | + } else { | ||
| 113 | + errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!"); | ||
| 114 | + } | ||
| 115 | + } else { | ||
| 116 | + errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!"); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + // 3、人员配置,搭班编码,人员起始索引验证 | ||
| 120 | + if (StringUtils.isNotEmpty(wrapInput.getEcIds()) && | ||
| 121 | + StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空 | ||
| 122 | + String[] ecIds = wrapInput.getEcIds().split(","); | ||
| 123 | + String[] ecDbbms = wrapInput.getEcDbbms().split(","); | ||
| 124 | + if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致 | ||
| 125 | + for (int i = 0; i < ecIds.length; i++) { | ||
| 126 | + if (ecIds[i].contains("-")) { // 分班标识 | ||
| 127 | + String[] fb_ecIds = ecIds[i].split("-"); | ||
| 128 | + String[] fb_ecDbbms = ecDbbms[i].split("-"); | ||
| 129 | + if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班 | ||
| 130 | + errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!"); | ||
| 131 | + break; | ||
| 132 | + } else { | ||
| 133 | + EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0])); | ||
| 134 | + EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1])); | ||
| 135 | + if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路 | ||
| 136 | + errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!"); | ||
| 137 | + break; | ||
| 138 | + } else { | ||
| 139 | + if (StringUtils.isEmpty(fb_ecDbbms[0]) || | ||
| 140 | + StringUtils.isEmpty(fb_ecDbbms[1]) || | ||
| 141 | + !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) || | ||
| 142 | + !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应 | ||
| 143 | + errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!"); | ||
| 144 | + break; | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + } else { | ||
| 150 | + if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字 | ||
| 151 | + errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!"); | ||
| 152 | + break; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i])); | ||
| 156 | + if (ecInfo == null) { // 人员配置不在当前线路 | ||
| 157 | + errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!"); | ||
| 158 | + break; | ||
| 159 | + } else { | ||
| 160 | + if (StringUtils.isEmpty(ecDbbms[i]) || | ||
| 161 | + !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应 | ||
| 162 | + errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!"); | ||
| 163 | + break; | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + if (wrapInput.getEcStartIndex() < 1 || | ||
| 170 | + wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出 | ||
| 171 | + errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!"); | ||
| 172 | + } | ||
| 173 | + } else { | ||
| 174 | + errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!"); | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + if (errorInfo.getErrorDescList().size() > 0) { | ||
| 179 | + errorInfoContext.errorCount ++; | ||
| 180 | + errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + @Override | ||
| 186 | + public void reverse(Serializable serializable, Object o) throws Exception { | ||
| 187 | + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable; | ||
| 188 | + WrapInput wrapInput = (WrapInput) o; | ||
| 189 | + | ||
| 190 | + if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) { | ||
| 191 | + errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId()); | ||
| 192 | + errorInfoContext.errorCount --; | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + @Override | ||
| 197 | + public Object getResult(Serializable serializable) throws Exception { | ||
| 198 | + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable; | ||
| 199 | + return errorInfoContext.errorInfoMap; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + @Override | ||
| 203 | + public boolean supportsReverse() { | ||
| 204 | + return true; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + @Override | ||
| 208 | + public Class<?> getResultType() { | ||
| 209 | + return Map.class; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | +} |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ValidateRuleResult.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.Date; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 输出结果值。 | ||
| 9 | + */ | ||
| 10 | +public class ValidateRuleResult { | ||
| 11 | + /** 线路id */ | ||
| 12 | + private Integer xlId; | ||
| 13 | + /** 规则总数量 */ | ||
| 14 | + private Integer count; | ||
| 15 | + /** 启用的规则数量 */ | ||
| 16 | + private Integer qyCount; | ||
| 17 | + /** 启用规则中的错误数量 */ | ||
| 18 | + private Integer qyErrorCount; | ||
| 19 | + /** 错误列表 */ | ||
| 20 | + private List<ErrorInfo> errorInfos = new ArrayList<>(); | ||
| 21 | + | ||
| 22 | + public Integer getXlId() { | ||
| 23 | + return xlId; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setXlId(Integer xlId) { | ||
| 27 | + this.xlId = xlId; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public Integer getCount() { | ||
| 31 | + return count; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setCount(Integer count) { | ||
| 35 | + this.count = count; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public Integer getQyCount() { | ||
| 39 | + return qyCount; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setQyCount(Integer qyCount) { | ||
| 43 | + this.qyCount = qyCount; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public Integer getQyErrorCount() { | ||
| 47 | + return qyErrorCount; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setQyErrorCount(Integer qyErrorCount) { | ||
| 51 | + this.qyErrorCount = qyErrorCount; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public List<ErrorInfo> getErrorInfos() { | ||
| 55 | + return errorInfos; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public void setErrorInfos(List<ErrorInfo> errorInfos) { | ||
| 59 | + this.errorInfos = errorInfos; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public static class ErrorInfo { | ||
| 63 | + /** 规则id */ | ||
| 64 | + private Long ruleId; | ||
| 65 | + /** 车辆自编号 */ | ||
| 66 | + private String clZbh; | ||
| 67 | + /** 启用日期 */ | ||
| 68 | + private Date qyrq; | ||
| 69 | + /** 错误描述 */ | ||
| 70 | + private List<String> errorDescList = new ArrayList<>(); | ||
| 71 | + | ||
| 72 | + public Long getRuleId() { | ||
| 73 | + return ruleId; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setRuleId(Long ruleId) { | ||
| 77 | + this.ruleId = ruleId; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getClZbh() { | ||
| 81 | + return clZbh; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setClZbh(String clZbh) { | ||
| 85 | + this.clZbh = clZbh; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public Date getQyrq() { | ||
| 89 | + return qyrq; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setQyrq(Date qyrq) { | ||
| 93 | + this.qyrq = qyrq; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public List<String> getErrorDescList() { | ||
| 97 | + return errorDescList; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setErrorDescList(List<String> errorDescList) { | ||
| 101 | + this.errorDescList = errorDescList; | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | +} |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/WrapInput.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 4 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 5 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 6 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 7 | +import org.springframework.util.CollectionUtils; | ||
| 8 | + | ||
| 9 | +import java.util.*; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 聚合输入的待判定数据。 | ||
| 13 | + */ | ||
| 14 | +public class WrapInput { | ||
| 15 | + /** 线路Id */ | ||
| 16 | + private Integer xlId; | ||
| 17 | + /** 车辆自编号 */ | ||
| 18 | + private String clZbh; | ||
| 19 | + /** 路牌id列表 */ | ||
| 20 | + private String lpIds; | ||
| 21 | + /** 路牌名字列表 */ | ||
| 22 | + private String lpNames; | ||
| 23 | + /** 人员配置列表 */ | ||
| 24 | + private String ecIds; | ||
| 25 | + /** 人员搭班编码列表 */ | ||
| 26 | + private String ecDbbms; | ||
| 27 | + /** 路牌循环起始索引 */ | ||
| 28 | + private Integer lpStartIndex; | ||
| 29 | + /** 人员循环起始索引 */ | ||
| 30 | + private Integer ecStartIndex; | ||
| 31 | + /** 规则id */ | ||
| 32 | + private Long ruleId; | ||
| 33 | + /** 启用日期 */ | ||
| 34 | + private Date qyrq; | ||
| 35 | + | ||
| 36 | + private Map<String, CarConfigInfo> ccInfos = new HashMap<>(); | ||
| 37 | + private Map<Long, GuideboardInfo> lpInfos = new HashMap<>(); | ||
| 38 | + private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>(); | ||
| 39 | + | ||
| 40 | + public WrapInput(ScheduleRule1Flat r, | ||
| 41 | + Map<String, CarConfigInfo> cc, | ||
| 42 | + Map<Long, GuideboardInfo> lp, | ||
| 43 | + Map<Long, EmployeeConfigInfo> ec) { | ||
| 44 | + this.xlId = r.getXl().getId(); | ||
| 45 | + this.clZbh = r.getCarConfigInfo().getCl().getInsideCode(); | ||
| 46 | + this.lpIds = r.getLpIds(); | ||
| 47 | + this.lpNames = r.getLpNames(); | ||
| 48 | + this.ecIds = r.getRyConfigIds(); | ||
| 49 | + this.ecDbbms = r.getRyDbbms(); | ||
| 50 | + this.lpStartIndex = r.getLpStart(); | ||
| 51 | + this.ecStartIndex = r.getRyStart(); | ||
| 52 | + this.ruleId = r.getId(); | ||
| 53 | + this.qyrq = r.getQyrq(); | ||
| 54 | + | ||
| 55 | + if (!CollectionUtils.isEmpty(cc)) { | ||
| 56 | + this.ccInfos.putAll(cc); | ||
| 57 | + } | ||
| 58 | + if (!CollectionUtils.isEmpty(lp)) { | ||
| 59 | + this.lpInfos.putAll(lp); | ||
| 60 | + } | ||
| 61 | + if (!CollectionUtils.isEmpty(ec)) { | ||
| 62 | + this.ecInfos.putAll(ec); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public Integer getXlId() { | ||
| 68 | + return xlId; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setXlId(Integer xlId) { | ||
| 72 | + this.xlId = xlId; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getClZbh() { | ||
| 76 | + return clZbh; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setClZbh(String clZbh) { | ||
| 80 | + this.clZbh = clZbh; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getLpIds() { | ||
| 84 | + return lpIds; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setLpIds(String lpIds) { | ||
| 88 | + this.lpIds = lpIds; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public String getLpNames() { | ||
| 92 | + return lpNames; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setLpNames(String lpNames) { | ||
| 96 | + this.lpNames = lpNames; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public String getEcIds() { | ||
| 100 | + return ecIds; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setEcIds(String ecIds) { | ||
| 104 | + this.ecIds = ecIds; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getEcDbbms() { | ||
| 108 | + return ecDbbms; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setEcDbbms(String ecDbbms) { | ||
| 112 | + this.ecDbbms = ecDbbms; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public Integer getLpStartIndex() { | ||
| 116 | + return lpStartIndex; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setLpStartIndex(Integer lpStartIndex) { | ||
| 120 | + this.lpStartIndex = lpStartIndex; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Integer getEcStartIndex() { | ||
| 124 | + return ecStartIndex; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setEcStartIndex(Integer ecStartIndex) { | ||
| 128 | + this.ecStartIndex = ecStartIndex; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public Long getRuleId() { | ||
| 132 | + return ruleId; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setRuleId(Long ruleId) { | ||
| 136 | + this.ruleId = ruleId; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public Date getQyrq() { | ||
| 140 | + return qyrq; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public void setQyrq(Date qyrq) { | ||
| 144 | + this.qyrq = qyrq; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public Map<String, CarConfigInfo> getCcInfos() { | ||
| 148 | + return ccInfos; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setCcInfos(Map<String, CarConfigInfo> ccInfos) { | ||
| 152 | + this.ccInfos = ccInfos; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public Map<Long, GuideboardInfo> getLpInfos() { | ||
| 156 | + return lpInfos; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) { | ||
| 160 | + this.lpInfos = lpInfos; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public Map<Long, EmployeeConfigInfo> getEcInfos() { | ||
| 164 | + return ecInfos; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) { | ||
| 168 | + this.ecInfos = ecInfos; | ||
| 169 | + } | ||
| 170 | +} |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/CalcuParam.java
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/ErrorBcCountFunction.java
| 1 | -package com.bsth.service.schedule.rules.ttinfo2; | 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.TTInfoDetail; | 3 | import com.bsth.entity.schedule.TTInfoDetail; |
| 4 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/Result.java
| 1 | -package com.bsth.service.schedule.rules.ttinfo2; | 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable; |
| 2 | 2 | ||
| 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
| 4 | import java.util.List; | 4 | import java.util.List; |
| @@ -22,6 +22,8 @@ public class Result { | @@ -22,6 +22,8 @@ public class Result { | ||
| 22 | private Long ttid; | 22 | private Long ttid; |
| 23 | /** 时刻表名字 */ | 23 | /** 时刻表名字 */ |
| 24 | private String ttname; | 24 | private String ttname; |
| 25 | + /** 线路版本 */ | ||
| 26 | + private Integer lineVersion; | ||
| 25 | 27 | ||
| 26 | /** 所有班次数 */ | 28 | /** 所有班次数 */ |
| 27 | private Long allbc; | 29 | private Long allbc; |
| @@ -90,5 +92,13 @@ public class Result { | @@ -90,5 +92,13 @@ public class Result { | ||
| 90 | public void setErrorbc(Long errorbc) { | 92 | public void setErrorbc(Long errorbc) { |
| 91 | this.errorbc = errorbc; | 93 | this.errorbc = errorbc; |
| 92 | } | 94 | } |
| 95 | + | ||
| 96 | + public Integer getLineVersion() { | ||
| 97 | + return lineVersion; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setLineVersion(Integer lineVersion) { | ||
| 101 | + this.lineVersion = lineVersion; | ||
| 102 | + } | ||
| 93 | } | 103 | } |
| 94 | } | 104 | } |
src/main/resources/datatools/ktrs/carsDataOutput.ktr
| @@ -10,13 +10,18 @@ | @@ -10,13 +10,18 @@ | ||
| 10 | <directory>/</directory> | 10 | <directory>/</directory> |
| 11 | <parameters> | 11 | <parameters> |
| 12 | <parameter> | 12 | <parameter> |
| 13 | + <name>QUERY</name> | ||
| 14 | + <default_value/> | ||
| 15 | + <description>查询</description> | ||
| 16 | + </parameter> | ||
| 17 | + <parameter> | ||
| 13 | <name>cgsbm_in</name> | 18 | <name>cgsbm_in</name> |
| 14 | <default_value/> | 19 | <default_value/> |
| 15 | <description>分公司编码</description> | 20 | <description>分公司编码</description> |
| 16 | </parameter> | 21 | </parameter> |
| 17 | <parameter> | 22 | <parameter> |
| 18 | <name>filepath</name> | 23 | <name>filepath</name> |
| 19 | - <default_value/> | 24 | + <default_value>1=1</default_value> |
| 20 | <description>excel文件路径</description> | 25 | <description>excel文件路径</description> |
| 21 | </parameter> | 26 | </parameter> |
| 22 | </parameters> | 27 | </parameters> |
| @@ -192,6 +197,102 @@ | @@ -192,6 +197,102 @@ | ||
| 192 | </attributes> | 197 | </attributes> |
| 193 | </connection> | 198 | </connection> |
| 194 | <connection> | 199 | <connection> |
| 200 | + <name>JGJW_VM</name> | ||
| 201 | + <server>192.168.198.240</server> | ||
| 202 | + <type>ORACLE</type> | ||
| 203 | + <access>Native</access> | ||
| 204 | + <database>orcl</database> | ||
| 205 | + <port>1521</port> | ||
| 206 | + <username>jwgl</username> | ||
| 207 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password> | ||
| 208 | + <servername/> | ||
| 209 | + <data_tablespace/> | ||
| 210 | + <index_tablespace/> | ||
| 211 | + <attributes> | ||
| 212 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 213 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 214 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 215 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 216 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 217 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 218 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 219 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 220 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 221 | + </attributes> | ||
| 222 | + </connection> | ||
| 223 | + <connection> | ||
| 224 | + <name>NHJW_VM</name> | ||
| 225 | + <server>192.168.198.240</server> | ||
| 226 | + <type>ORACLE</type> | ||
| 227 | + <access>Native</access> | ||
| 228 | + <database>orcl</database> | ||
| 229 | + <port>1521</port> | ||
| 230 | + <username>nhjw</username> | ||
| 231 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d09aa5cd</password> | ||
| 232 | + <servername/> | ||
| 233 | + <data_tablespace/> | ||
| 234 | + <index_tablespace/> | ||
| 235 | + <attributes> | ||
| 236 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 237 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 238 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 239 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 240 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 241 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 242 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 243 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 244 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 245 | + </attributes> | ||
| 246 | + </connection> | ||
| 247 | + <connection> | ||
| 248 | + <name>PDGJ_VM</name> | ||
| 249 | + <server>192.168.198.240</server> | ||
| 250 | + <type>ORACLE</type> | ||
| 251 | + <access>Native</access> | ||
| 252 | + <database>orcl</database> | ||
| 253 | + <port>1521</port> | ||
| 254 | + <username>pdgj</username> | ||
| 255 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10ce96a8d0</password> | ||
| 256 | + <servername/> | ||
| 257 | + <data_tablespace/> | ||
| 258 | + <index_tablespace/> | ||
| 259 | + <attributes> | ||
| 260 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 261 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 262 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 263 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 264 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 265 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 266 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 267 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 268 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 269 | + </attributes> | ||
| 270 | + </connection> | ||
| 271 | + <connection> | ||
| 272 | + <name>SNJW_VM</name> | ||
| 273 | + <server>192.168.198.240</server> | ||
| 274 | + <type>ORACLE</type> | ||
| 275 | + <access>Native</access> | ||
| 276 | + <database>orcl</database> | ||
| 277 | + <port>1521</port> | ||
| 278 | + <username>snjw</username> | ||
| 279 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password> | ||
| 280 | + <servername/> | ||
| 281 | + <data_tablespace/> | ||
| 282 | + <index_tablespace/> | ||
| 283 | + <attributes> | ||
| 284 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 285 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 286 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 287 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 288 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 289 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 290 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 291 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 292 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 293 | + </attributes> | ||
| 294 | + </connection> | ||
| 295 | + <connection> | ||
| 195 | <name>xlab_mysql_youle</name> | 296 | <name>xlab_mysql_youle</name> |
| 196 | <server>101.231.124.8</server> | 297 | <server>101.231.124.8</server> |
| 197 | <type>MYSQL</type> | 298 | <type>MYSQL</type> |
| @@ -270,6 +371,102 @@ | @@ -270,6 +371,102 @@ | ||
| 270 | <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | 371 | <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> |
| 271 | </attributes> | 372 | </attributes> |
| 272 | </connection> | 373 | </connection> |
| 374 | + <connection> | ||
| 375 | + <name>YGJW_VM</name> | ||
| 376 | + <server>192.168.198.240</server> | ||
| 377 | + <type>ORACLE</type> | ||
| 378 | + <access>Native</access> | ||
| 379 | + <database>orcl</database> | ||
| 380 | + <port>1521</port> | ||
| 381 | + <username>ygjw</username> | ||
| 382 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password> | ||
| 383 | + <servername/> | ||
| 384 | + <data_tablespace/> | ||
| 385 | + <index_tablespace/> | ||
| 386 | + <attributes> | ||
| 387 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 388 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 389 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 390 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 391 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 392 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 393 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 394 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 395 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 396 | + </attributes> | ||
| 397 | + </connection> | ||
| 398 | + <connection> | ||
| 399 | + <name>公司jgjw</name> | ||
| 400 | + <server>192.168.168.1</server> | ||
| 401 | + <type>ORACLE</type> | ||
| 402 | + <access>Native</access> | ||
| 403 | + <database>orcl</database> | ||
| 404 | + <port>1521</port> | ||
| 405 | + <username>jwgl</username> | ||
| 406 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password> | ||
| 407 | + <servername/> | ||
| 408 | + <data_tablespace/> | ||
| 409 | + <index_tablespace/> | ||
| 410 | + <attributes> | ||
| 411 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 412 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 413 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 414 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 415 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 416 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 417 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 418 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 419 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 420 | + </attributes> | ||
| 421 | + </connection> | ||
| 422 | + <connection> | ||
| 423 | + <name>公司snjw</name> | ||
| 424 | + <server>192.168.168.1</server> | ||
| 425 | + <type>ORACLE</type> | ||
| 426 | + <access>Native</access> | ||
| 427 | + <database>orcl</database> | ||
| 428 | + <port>1521</port> | ||
| 429 | + <username>snjw</username> | ||
| 430 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password> | ||
| 431 | + <servername/> | ||
| 432 | + <data_tablespace/> | ||
| 433 | + <index_tablespace/> | ||
| 434 | + <attributes> | ||
| 435 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 436 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 437 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 438 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 439 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 440 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 441 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 442 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 443 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 444 | + </attributes> | ||
| 445 | + </connection> | ||
| 446 | + <connection> | ||
| 447 | + <name>公司ygjw</name> | ||
| 448 | + <server>192.168.168.1</server> | ||
| 449 | + <type>ORACLE</type> | ||
| 450 | + <access>Native</access> | ||
| 451 | + <database>orcl</database> | ||
| 452 | + <port>1521</port> | ||
| 453 | + <username>ygjw</username> | ||
| 454 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password> | ||
| 455 | + <servername/> | ||
| 456 | + <data_tablespace/> | ||
| 457 | + <index_tablespace/> | ||
| 458 | + <attributes> | ||
| 459 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 460 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 461 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 462 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | ||
| 463 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 464 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 465 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 466 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 467 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 468 | + </attributes> | ||
| 469 | + </connection> | ||
| 273 | <order> | 470 | <order> |
| 274 | <hop> <from>公司查询</from><to>分公司查询</to><enabled>Y</enabled> </hop> | 471 | <hop> <from>公司查询</from><to>分公司查询</to><enabled>Y</enabled> </hop> |
| 275 | <hop> <from>分公司查询</from><to>字段选择</to><enabled>Y</enabled> </hop> | 472 | <hop> <from>分公司查询</from><to>字段选择</to><enabled>Y</enabled> </hop> |
| @@ -480,7 +677,7 @@ | @@ -480,7 +677,7 @@ | ||
| 480 | <name>字段选择</name> | 677 | <name>字段选择</name> |
| 481 | <type>SelectValues</type> | 678 | <type>SelectValues</type> |
| 482 | <description/> | 679 | <description/> |
| 483 | - <distribute>Y</distribute> | 680 | + <distribute>N</distribute> |
| 484 | <custom_distribution/> | 681 | <custom_distribution/> |
| 485 | <copies>1</copies> | 682 | <copies>1</copies> |
| 486 | <partitioning> | 683 | <partitioning> |
| @@ -525,6 +722,36 @@ | @@ -525,6 +722,36 @@ | ||
| 525 | </step> | 722 | </step> |
| 526 | 723 | ||
| 527 | <step> | 724 | <step> |
| 725 | + <name>是否电车</name> | ||
| 726 | + <type>ScriptValueMod</type> | ||
| 727 | + <description/> | ||
| 728 | + <distribute>Y</distribute> | ||
| 729 | + <custom_distribution/> | ||
| 730 | + <copies>1</copies> | ||
| 731 | + <partitioning> | ||
| 732 | + <method>none</method> | ||
| 733 | + <schema_name/> | ||
| 734 | + </partitioning> | ||
| 735 | + <compatible>N</compatible> | ||
| 736 | + <optimizationLevel>9</optimizationLevel> | ||
| 737 | + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> | ||
| 738 | + <jsScript_name>Script 1</jsScript_name> | ||
| 739 | + <jsScript_script>//Script here

var 是否电车 = "否";

if(sfdc_cal == 0) {
 是否电车 = "否";
} else if (sfdc_cal == 1) {
 是否电车 = "是";
} else {
 是否电车 = "否";
}
</jsScript_script> | ||
| 740 | + </jsScript> </jsScripts> <fields> <field> <name>是否电车</name> | ||
| 741 | + <rename>是否电车</rename> | ||
| 742 | + <type>String</type> | ||
| 743 | + <length>-1</length> | ||
| 744 | + <precision>-1</precision> | ||
| 745 | + <replace>N</replace> | ||
| 746 | + </field> </fields> <cluster_schema/> | ||
| 747 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 748 | + <xloc>695</xloc> | ||
| 749 | + <yloc>173</yloc> | ||
| 750 | + <draw>Y</draw> | ||
| 751 | + </GUI> | ||
| 752 | + </step> | ||
| 753 | + | ||
| 754 | + <step> | ||
| 528 | <name>添加查询常量</name> | 755 | <name>添加查询常量</name> |
| 529 | <type>ScriptValueMod</type> | 756 | <type>ScriptValueMod</type> |
| 530 | <description/> | 757 | <description/> |
| @@ -566,7 +793,7 @@ | @@ -566,7 +793,7 @@ | ||
| 566 | <schema_name/> | 793 | <schema_name/> |
| 567 | </partitioning> | 794 | </partitioning> |
| 568 | <connection>bus_control_variable</connection> | 795 | <connection>bus_control_variable</connection> |
| 569 | - <sql>SELECT * FROM bsth_c_cars

</sql> | 796 | + <sql>SELECT * FROM bsth_c_cars
where ${QUERY}</sql> |
| 570 | <limit>0</limit> | 797 | <limit>0</limit> |
| 571 | <lookup/> | 798 | <lookup/> |
| 572 | <execute_each_row>N</execute_each_row> | 799 | <execute_each_row>N</execute_each_row> |
| @@ -580,36 +807,6 @@ | @@ -580,36 +807,6 @@ | ||
| 580 | </GUI> | 807 | </GUI> |
| 581 | </step> | 808 | </step> |
| 582 | 809 | ||
| 583 | - <step> | ||
| 584 | - <name>是否电车</name> | ||
| 585 | - <type>ScriptValueMod</type> | ||
| 586 | - <description/> | ||
| 587 | - <distribute>Y</distribute> | ||
| 588 | - <custom_distribution/> | ||
| 589 | - <copies>1</copies> | ||
| 590 | - <partitioning> | ||
| 591 | - <method>none</method> | ||
| 592 | - <schema_name/> | ||
| 593 | - </partitioning> | ||
| 594 | - <compatible>N</compatible> | ||
| 595 | - <optimizationLevel>9</optimizationLevel> | ||
| 596 | - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> | ||
| 597 | - <jsScript_name>Script 1</jsScript_name> | ||
| 598 | - <jsScript_script>//Script here

var 是否电车 = "否";

if(sfdc_cal) {
 是否电车 = "是";
}
</jsScript_script> | ||
| 599 | - </jsScript> </jsScripts> <fields> <field> <name>是否电车</name> | ||
| 600 | - <rename>是否电车</rename> | ||
| 601 | - <type>String</type> | ||
| 602 | - <length>-1</length> | ||
| 603 | - <precision>-1</precision> | ||
| 604 | - <replace>N</replace> | ||
| 605 | - </field> </fields> <cluster_schema/> | ||
| 606 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 607 | - <xloc>695</xloc> | ||
| 608 | - <yloc>173</yloc> | ||
| 609 | - <draw>Y</draw> | ||
| 610 | - </GUI> | ||
| 611 | - </step> | ||
| 612 | - | ||
| 613 | <step_error_handling> | 810 | <step_error_handling> |
| 614 | </step_error_handling> | 811 | </step_error_handling> |
| 615 | <slave-step-copy-partition-distribution> | 812 | <slave-step-copy-partition-distribution> |
src/main/resources/rules/functions.drl deleted
100644 → 0
| 1 | -package com.bsth.service.schedule; | ||
| 2 | - | ||
| 3 | -import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; | ||
| 4 | -import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; | ||
| 5 | -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; | ||
| 6 | -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbFcnoFunction gidfbfcno; | ||
| 7 | -import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult; | ||
| 8 | -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq; | ||
| 9 | -import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb; | ||
| 10 | -import accumulate com.bsth.service.schedule.rules.validate.ValidWholeRerunBcFunction vwrb; | ||
| 11 | -import accumulate com.bsth.service.schedule.rules.validate.ValidWantLpFunction vwlp; |
src/main/resources/rules/kBase1_core_functions.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core; | ||
| 2 | + | ||
| 3 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount; | ||
| 4 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime; | ||
| 5 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno; | ||
| 6 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult; | ||
| 7 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq; | ||
| 8 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb; | ||
| 9 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb; | ||
| 10 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp; |
src/main/resources/rules/plan.drl renamed to src/main/resources/rules/kBase1_core_plan.drl
| 1 | -package com.bsth.service.schedule.plan; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.plan; |
| 2 | 2 | ||
| 3 | import org.joda.time.*; | 3 | import org.joda.time.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | 5 | ||
| 6 | -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | ||
| 7 | -import com.bsth.service.schedule.rules.plan.PlanResult; | 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input; |
| 7 | +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult; | ||
| 8 | 8 | ||
| 9 | import com.bsth.repository.schedule.TTInfoDetailRepository; | 9 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 10 | import com.bsth.repository.schedule.CarConfigInfoRepository; | 10 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| @@ -12,10 +12,10 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | @@ -12,10 +12,10 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | ||
| 12 | import com.bsth.repository.LineRepository; | 12 | import com.bsth.repository.LineRepository; |
| 13 | import com.bsth.repository.BusinessRepository; | 13 | import com.bsth.repository.BusinessRepository; |
| 14 | 14 | ||
| 15 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | ||
| 16 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | ||
| 17 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; | ||
| 18 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | 15 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output; |
| 16 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; | ||
| 17 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output; | ||
| 18 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output; | ||
| 19 | import com.bsth.entity.Line; | 19 | import com.bsth.entity.Line; |
| 20 | import com.bsth.entity.Business; | 20 | import com.bsth.entity.Business; |
| 21 | 21 | ||
| @@ -28,7 +28,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; | @@ -28,7 +28,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 28 | import org.slf4j.Logger | 28 | import org.slf4j.Logger |
| 29 | import org.joda.time.format.DateTimeFormat | 29 | import org.joda.time.format.DateTimeFormat |
| 30 | import org.apache.commons.lang3.StringUtils | 30 | import org.apache.commons.lang3.StringUtils |
| 31 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | 31 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | // 全局日志类(一般使用调用此规则的service类) | 34 | // 全局日志类(一般使用调用此规则的service类) |
src/main/resources/rules/rerun.drl renamed to src/main/resources/rules/kBase1_core_rerun.drl
| 1 | -package com.bsth.service.schedule.rerun; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun; |
| 2 | 2 | ||
| 3 | import org.joda.time.*; | 3 | import org.joda.time.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | 5 | ||
| 6 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | ||
| 7 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output; |
| 7 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; | ||
| 8 | 8 | ||
| 9 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 10 | -import com.bsth.service.schedule.rules.rerun.RerunRule_param; | 9 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; |
| 10 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param; | ||
| 11 | 11 | ||
| 12 | import com.bsth.repository.schedule.CarConfigInfoRepository; | 12 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 13 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | 13 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 14 | 14 | ||
| 15 | -import org.slf4j.Logger | ||
| 16 | -import com.bsth.entity.schedule.CarConfigInfo | ||
| 17 | -import java.util.HashMap | ||
| 18 | -import com.bsth.entity.schedule.EmployeeConfigInfo | 15 | +import org.slf4j.Logger; |
| 16 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 19 | import com.bsth.entity.schedule.SchedulePlanInfo; | 19 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 20 | 20 | ||
| 21 | // 全局日志类(一般使用调用此规则的service类) | 21 | // 全局日志类(一般使用调用此规则的service类) |
src/main/resources/rules/shiftloop_fb_2.drl renamed to src/main/resources/rules/kBase1_core_shiftloop.drl
| 1 | -package com.bsth.service.schedule.shiftloop; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; |
| 2 | 2 | ||
| 3 | import org.joda.time.*; | 3 | import org.joda.time.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | 5 | ||
| 6 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; |
| 7 | 7 | ||
| 8 | import com.bsth.service.schedule.utils.Md5Util; | 8 | import com.bsth.service.schedule.utils.Md5Util; |
| 9 | 9 | ||
| 10 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | ||
| 11 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | ||
| 12 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | ||
| 13 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | ||
| 14 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | 10 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input; |
| 11 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | ||
| 12 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | ||
| 13 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output; | ||
| 14 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; | ||
| 15 | 15 | ||
| 16 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 16 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 17 | 17 | ||
| 18 | import com.bsth.entity.schedule.SchedulePlan; | 18 | import com.bsth.entity.schedule.SchedulePlan; |
| 19 | 19 | ||
| 20 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | 20 | +import com.bsth.service.schedule.impl.plan.ScheduleRuleService; |
| 21 | 21 | ||
| 22 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
| 23 | 23 |
src/main/resources/rules/ttinfo.drl renamed to src/main/resources/rules/kBase1_core_ttinfo.drl
| 1 | -package com.bsth.service.schedule.ttinfo; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo; |
| 2 | + | ||
| 3 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount; | ||
| 4 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime; | ||
| 5 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno; | ||
| 6 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult; | ||
| 7 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq; | ||
| 8 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb; | ||
| 9 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb; | ||
| 10 | +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp; | ||
| 2 | 11 | ||
| 3 | import org.joda.time.*; | 12 | import org.joda.time.*; |
| 4 | import java.util.*; | 13 | import java.util.*; |
| 5 | 14 | ||
| 6 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | ||
| 7 | -import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | ||
| 8 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; | ||
| 9 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | ||
| 10 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | ||
| 11 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output; | 15 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoCalcuParam_input; |
| 16 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfo_input; | ||
| 17 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output; | ||
| 18 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output; | ||
| 19 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | ||
| 20 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResults_output; | ||
| 12 | 21 | ||
| 13 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | 22 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; |
| 14 | 23 | ||
| 15 | import com.bsth.repository.schedule.TTInfoDetailRepository; | 24 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 16 | 25 |
src/main/resources/rules/validplan.drl renamed to src/main/resources/rules/kBase1_core_validate.drl
| 1 | -package com.bsth.service.schedule.rules.validate; | 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | ||
| 5 | -import com.bsth.service.schedule.rules.validate.ValidateResource; | 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; |
| 5 | +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResource; | ||
| 6 | 6 | ||
| 7 | import org.joda.time.*; | 7 | import org.joda.time.*; |
| 8 | import java.util.*; | 8 | import java.util.*; |
src/main/resources/rules/ruleWrap.drl renamed to src/main/resources/rules/kBase2_wrap_rule.drl
| 1 | -package com.bsth.service.schedule.rulewrap; | 1 | +package com.bsth.service.schedule.impl.plan.kBase2.wrap.rule; |
| 2 | 2 | ||
| 3 | import org.joda.time.*; | 3 | import org.joda.time.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | 6 | ||
| 7 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | ||
| 8 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | ||
| 9 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | 7 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input; |
| 8 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | ||
| 9 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | ||
| 10 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; | ||
| 10 | 11 | ||
| 11 | import com.bsth.repository.schedule.RerunRuleRepository; | 12 | import com.bsth.repository.schedule.RerunRuleRepository; |
| 12 | import com.bsth.repository.schedule.ScheduleRule1FlatRepository; | 13 | import com.bsth.repository.schedule.ScheduleRule1FlatRepository; |
| 13 | 14 | ||
| 14 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 15 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | 15 | +import com.bsth.service.schedule.impl.plan.ScheduleRuleService; |
| 16 | 16 | ||
| 17 | import com.bsth.entity.Line; | 17 | import com.bsth.entity.Line; |
| 18 | import com.bsth.entity.schedule.CarConfigInfo | 18 | import com.bsth.entity.schedule.CarConfigInfo |
src/main/resources/rules/kBase3_validate_rule.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | ||
| 2 | + | ||
| 3 | +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ErrorInfoFunction srif; | ||
| 4 | +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.ErrorBcCountFunction ecount; | ||
| 5 | + | ||
| 6 | +import org.joda.time.*; | ||
| 7 | +import java.util.*; | ||
| 8 | + | ||
| 9 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam; | ||
| 10 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult; | ||
| 11 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult.ErrorInfo; | ||
| 12 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.WrapInput; | ||
| 13 | + | ||
| 14 | +import com.bsth.repository.schedule.ScheduleRule1FlatRepository | ||
| 15 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 16 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | ||
| 17 | +import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | ||
| 18 | + | ||
| 19 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 20 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 21 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 22 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 23 | + | ||
| 24 | +import org.slf4j.Logger | ||
| 25 | + | ||
| 26 | +// 全局日志 | ||
| 27 | +global Logger LOG; | ||
| 28 | + | ||
| 29 | +// repository查询 | ||
| 30 | +global CarConfigInfoRepository ccRepo; | ||
| 31 | +global GuideboardInfoRepository lpRepo; | ||
| 32 | +global EmployeeConfigInfoRepository ecRepo; | ||
| 33 | +global ScheduleRule1FlatRepository ruleRepo; | ||
| 34 | + | ||
| 35 | +// return输出 | ||
| 36 | +global ValidateRuleResult result; | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +//------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------// | ||
| 40 | + | ||
| 41 | +// 1、车辆信息载入 | ||
| 42 | +declare CarConfig_Wraps | ||
| 43 | + xlId: Integer // 线路Id | ||
| 44 | + ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo> | ||
| 45 | +end | ||
| 46 | + | ||
| 47 | +rule "calcu_CarConfig_Wraps" | ||
| 48 | + salience 800 | ||
| 49 | + when | ||
| 50 | + $param: CalcuParam($xlId: xlId) | ||
| 51 | + then | ||
| 52 | + List ccInfos = ccRepo.findByXlId($xlId); | ||
| 53 | + | ||
| 54 | + CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps(); | ||
| 55 | + carConfig_wraps.setXlId($xlId); | ||
| 56 | + carConfig_wraps.setCcMap(new HashMap()); | ||
| 57 | + | ||
| 58 | + for (int i = 0; i < ccInfos.size(); i++) { | ||
| 59 | + CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i); | ||
| 60 | + if (!ccInfo.getIsCancel()) { | ||
| 61 | + carConfig_wraps.getCcMap().put(ccInfo.getCl().getInsideCode(), ccInfo); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + insert(carConfig_wraps); | ||
| 66 | + | ||
| 67 | + LOG.info("第一阶段 --> 1、车辆信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size()); | ||
| 68 | +end | ||
| 69 | + | ||
| 70 | +// 2、路牌信息载入 | ||
| 71 | +declare Lp_Wraps | ||
| 72 | + xlId: Integer // 线路Id | ||
| 73 | + lpMap: Map // 路牌Map Map<id, GuideboardInfo> | ||
| 74 | +end | ||
| 75 | + | ||
| 76 | +rule "calcu_Lp_Wraps" | ||
| 77 | + salience 800 | ||
| 78 | + when | ||
| 79 | + $param: CalcuParam($xlId: xlId) | ||
| 80 | + then | ||
| 81 | + List lpInfos = lpRepo.findByXlId($xlId); | ||
| 82 | + Lp_Wraps lp_wraps = new Lp_Wraps(); | ||
| 83 | + lp_wraps.setXlId($xlId); | ||
| 84 | + lp_wraps.setLpMap(new HashMap()); | ||
| 85 | + | ||
| 86 | + for (int i = 0; i < lpInfos.size(); i++) { | ||
| 87 | + GuideboardInfo lpInfo = (GuideboardInfo) lpInfos.get(i); | ||
| 88 | + if (!lpInfo.getIsCancel()) { | ||
| 89 | + lp_wraps.getLpMap().put(lpInfo.getId(), lpInfo); | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + insert(lp_wraps); | ||
| 94 | + | ||
| 95 | + LOG.info("第一阶段 --> 2、路牌信息载入 calcu_Lp_Wraps 有效路牌数={}", lpInfos.size()); | ||
| 96 | + | ||
| 97 | +end | ||
| 98 | + | ||
| 99 | +// 3、人员信息载入 | ||
| 100 | +declare EmployeeConfig_Wraps | ||
| 101 | + xlId: Integer // 线路Id | ||
| 102 | + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo> | ||
| 103 | +end | ||
| 104 | + | ||
| 105 | +rule "calcu_EmployeeConfig_Wraps" | ||
| 106 | + salience 800 | ||
| 107 | + when | ||
| 108 | + $param: CalcuParam($xlId: xlId) | ||
| 109 | + then | ||
| 110 | + List ecInfos = ecRepo.findByXlId($xlId); | ||
| 111 | + | ||
| 112 | + EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps(); | ||
| 113 | + employeeConfig_wraps.setXlId($xlId); | ||
| 114 | + employeeConfig_wraps.setEcMap(new HashMap()); | ||
| 115 | + | ||
| 116 | + for (int i = 0; i < ecInfos.size(); i++) { | ||
| 117 | + EmployeeConfigInfo ecInfo = (EmployeeConfigInfo) ecInfos.get(i); | ||
| 118 | + if (!ecInfo.getIsCancel()) { | ||
| 119 | + employeeConfig_wraps.getEcMap().put(ecInfo.getId(), ecInfo); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + insert(employeeConfig_wraps); | ||
| 124 | + | ||
| 125 | + LOG.info("第一阶段 --> 3、人员信息载入 calcu_EmployeeConfig_Wraps 有效人员配置数={}", ecInfos.size()); | ||
| 126 | +end | ||
| 127 | + | ||
| 128 | +//------------------ 第二阶段、规则载入,计算相关数量 -----------------// | ||
| 129 | + | ||
| 130 | +declare Rule_Wraps | ||
| 131 | + xlId: Integer // 线路Id | ||
| 132 | + qyrq: Date // 启用日期 | ||
| 133 | + rule: ScheduleRule1Flat // ScheduleRule1Flat规则 | ||
| 134 | +end | ||
| 135 | + | ||
| 136 | +rule "calcu_schedule_rule_wrap" | ||
| 137 | + salience 700 | ||
| 138 | + when | ||
| 139 | + $param: CalcuParam($xlId: xlId) | ||
| 140 | + $rule: ScheduleRule1Flat($qyrq: qyrq) from ruleRepo.findByXlId($xlId) | ||
| 141 | + then | ||
| 142 | + Rule_Wraps rw = new Rule_Wraps(); | ||
| 143 | + rw.setXlId($xlId); | ||
| 144 | + rw.setQyrq($qyrq); | ||
| 145 | + rw.setRule($rule); | ||
| 146 | + insert(rw); | ||
| 147 | +end | ||
| 148 | + | ||
| 149 | +rule "calcu_all_rule_count" | ||
| 150 | + salience 600 | ||
| 151 | + when | ||
| 152 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | ||
| 153 | + $allList: ArrayList() from collect(Rule_Wraps(xlId == $xlId)) | ||
| 154 | + then | ||
| 155 | + result.setXlId($xlId); | ||
| 156 | + result.setCount($allList.size()); | ||
| 157 | + | ||
| 158 | + LOG.info("第二阶段 --> 规则总数={}", $allList.size()); | ||
| 159 | +end | ||
| 160 | + | ||
| 161 | +rule "calcu_all_qy_rule_count" | ||
| 162 | + salience 500 | ||
| 163 | + when | ||
| 164 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | ||
| 165 | + $qyList: ArrayList() from collect( | ||
| 166 | + Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis())) | ||
| 167 | + then | ||
| 168 | + result.setXlId($xlId); | ||
| 169 | + result.setQyCount($qyList.size()); | ||
| 170 | + | ||
| 171 | + LOG.info("第二阶段 --> 启用规则数={}", $qyList.size()); | ||
| 172 | + | ||
| 173 | +end | ||
| 174 | + | ||
| 175 | +//------------------ 第三阶段、规则判定 -----------------// | ||
| 176 | + | ||
| 177 | +rule "calcu_Wrap_input" | ||
| 178 | + salience 400 | ||
| 179 | + when | ||
| 180 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | ||
| 181 | + $qy_rule: Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis()) | ||
| 182 | + $cc: CarConfig_Wraps(xlId == $xlId) | ||
| 183 | + $lp: Lp_Wraps(xlId == $xlId) | ||
| 184 | + $ec: EmployeeConfig_Wraps(xlId == $xlId) | ||
| 185 | + then | ||
| 186 | + WrapInput wr = new WrapInput( | ||
| 187 | + $qy_rule.getRule(), | ||
| 188 | + $cc.getCcMap(), | ||
| 189 | + $lp.getLpMap(), | ||
| 190 | + $ec.getEcMap() | ||
| 191 | + ); | ||
| 192 | + insert(wr); | ||
| 193 | +end | ||
| 194 | + | ||
| 195 | +rule "calcu_error_info" | ||
| 196 | + salience 300 | ||
| 197 | + when | ||
| 198 | + $param: CalcuParam($xlId: xlId) | ||
| 199 | + $errorMap: Map() from accumulate ($wr: WrapInput(xlId == $xlId), srif($wr)) | ||
| 200 | + then | ||
| 201 | + result.setQyErrorCount($errorMap.size()); | ||
| 202 | + result.getErrorInfos().addAll($errorMap.values()); | ||
| 203 | + | ||
| 204 | + LOG.info("第三阶段 --> 规则总数={}, 启用规则数={}, 错误的启用规则数={}", | ||
| 205 | + result.getCount(), result.getQyCount(), result.getQyErrorCount()); | ||
| 206 | + | ||
| 207 | +end | ||
| 208 | + | ||
| 209 | + |
src/main/resources/rules/ttinfo2.drl renamed to src/main/resources/rules/kBase3_validate_timetable.drl
| 1 | -package com.bsth.service.schedule.ttinfo2; | 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable; |
| 2 | 2 | ||
| 3 | import org.joda.time.*; | 3 | import org.joda.time.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | import org.apache.commons.lang3.StringUtils; | 5 | import org.apache.commons.lang3.StringUtils; |
| 6 | 6 | ||
| 7 | -import com.bsth.service.schedule.rules.ttinfo2.Result; | ||
| 8 | -import com.bsth.service.schedule.rules.ttinfo2.Result.StatInfo; | ||
| 9 | -import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; | 7 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result; |
| 8 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result.StatInfo; | ||
| 9 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam; | ||
| 10 | 10 | ||
| 11 | import com.bsth.entity.schedule.TTInfo; | 11 | import com.bsth.entity.schedule.TTInfo; |
| 12 | import com.bsth.entity.schedule.TTInfoDetail; | 12 | import com.bsth.entity.schedule.TTInfoDetail; |
| 13 | import com.bsth.entity.Line; | 13 | import com.bsth.entity.Line; |
| 14 | 14 | ||
| 15 | -import com.bsth.repository.LineRepository; | ||
| 16 | import com.bsth.repository.schedule.TTInfoDetailRepository; | 15 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 17 | 16 | ||
| 18 | import org.slf4j.Logger | 17 | import org.slf4j.Logger |
| @@ -23,7 +22,6 @@ import java.lang.Object; | @@ -23,7 +22,6 @@ import java.lang.Object; | ||
| 23 | 22 | ||
| 24 | // 全局日志类(一般使用调用此规则的service类) | 23 | // 全局日志类(一般使用调用此规则的service类) |
| 25 | global Logger log; | 24 | global Logger log; |
| 26 | -global LineRepository lineRepository; | ||
| 27 | global TTInfoDetailRepository tTInfoDetailRepository; | 25 | global TTInfoDetailRepository tTInfoDetailRepository; |
| 28 | 26 | ||
| 29 | // 输出 | 27 | // 输出 |
| @@ -63,15 +61,14 @@ rule "calcu_iter_days" | @@ -63,15 +61,14 @@ rule "calcu_iter_days" | ||
| 63 | $toDate: toDate, | 61 | $toDate: toDate, |
| 64 | $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate) | 62 | $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate) |
| 65 | ) | 63 | ) |
| 64 | + $line: Line(id == $xlId) | ||
| 66 | then | 65 | then |
| 67 | // 构造Calcu_iter_days_result对象,进行下一步计算 | 66 | // 构造Calcu_iter_days_result对象,进行下一步计算 |
| 68 | Calcu_iter_days_result cidr = new Calcu_iter_days_result(); | 67 | Calcu_iter_days_result cidr = new Calcu_iter_days_result(); |
| 69 | Period p = new Period($fromDate, $toDate, PeriodType.days()); | 68 | Period p = new Period($fromDate, $toDate, PeriodType.days()); |
| 70 | 69 | ||
| 71 | - Line line = (Line) lineRepository.findOne($xlId); | ||
| 72 | - | ||
| 73 | cidr.setXlId($xlId); | 70 | cidr.setXlId($xlId); |
| 74 | - cidr.setXlName(line.getName()); | 71 | + cidr.setXlName($line.getName()); |
| 75 | 72 | ||
| 76 | cidr.setCalcu_day(new Integer(1)); | 73 | cidr.setCalcu_day(new Integer(1)); |
| 77 | cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek())); | 74 | cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek())); |
| @@ -311,6 +308,9 @@ rule "statinfo_result" // 统计计算结果 | @@ -311,6 +308,9 @@ rule "statinfo_result" // 统计计算结果 | ||
| 311 | $statInfo.setYybc($yybc); | 308 | $statInfo.setYybc($yybc); |
| 312 | $statInfo.setErrorbc($errorbc); | 309 | $statInfo.setErrorbc($errorbc); |
| 313 | 310 | ||
| 311 | + int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion(); | ||
| 312 | + $statInfo.setLineVersion(lineVersion); | ||
| 313 | + | ||
| 314 | rs.getInfos().add($statInfo); | 314 | rs.getInfos().add($statInfo); |
| 315 | 315 | ||
| 316 | end | 316 | end |
src/main/resources/static/index.html
| @@ -632,7 +632,6 @@ | @@ -632,7 +632,6 @@ | ||
| 632 | data-exclude=1></script> | 632 | data-exclude=1></script> |
| 633 | <!-- echarts4 误删 --> | 633 | <!-- echarts4 误删 --> |
| 634 | <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | 634 | <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> |
| 635 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | ||
| 636 | 635 | ||
| 637 | </body> | 636 | </body> |
| 638 | </html> | 637 | </html> |
| 639 | \ No newline at end of file | 638 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-table.js
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| @@ -58,15 +58,17 @@ window.WorldsBMap = function () { | @@ -58,15 +58,17 @@ window.WorldsBMap = function () { | ||
| 58 | marker.enableDragging(); | 58 | marker.enableDragging(); |
| 59 | dragMarker = marker; | 59 | dragMarker = marker; |
| 60 | dragMarker._old_point = dragMarker._position; | 60 | dragMarker._old_point = dragMarker._position; |
| 61 | + centerPoint = dragMarker._position; | ||
| 61 | //监听拖拽事件 dragging | 62 | //监听拖拽事件 dragging |
| 62 | dragMarker.addEventListener('dragging', dragMarkerDragEvent); | 63 | dragMarker.addEventListener('dragging', dragMarkerDragEvent); |
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 65 | var dragMarkerDragEvent = function (e) { | 66 | var dragMarkerDragEvent = function (e) { |
| 66 | if (editPolygon) { | 67 | if (editPolygon) { |
| 67 | - if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) | 68 | + // 中心点是否超出多边形 |
| 69 | + if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) { | ||
| 68 | dragMarker.setPosition(dragMarker._old_point);//还原位置 | 70 | dragMarker.setPosition(dragMarker._old_point);//还原位置 |
| 69 | - | 71 | + } |
| 70 | centerPoint = e.target._position; | 72 | centerPoint = e.target._position; |
| 71 | } | 73 | } |
| 72 | else if (editCircle) { | 74 | else if (editCircle) { |
src/main/resources/static/pages/base/timesmodel/add.html
| @@ -21,10 +21,10 @@ | @@ -21,10 +21,10 @@ | ||
| 21 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | 21 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> |
| 22 | <li><span class="active">运营计划管理</span> <i class="fa fa-circle"></i></li> | 22 | <li><span class="active">运营计划管理</span> <i class="fa fa-circle"></i></li> |
| 23 | <li> | 23 | <li> |
| 24 | - <a href="/#/ttInfoManage">时刻表管理</a> | 24 | + <a href="/#/ttInfoManage2">智能时刻表管理</a> |
| 25 | <i class="fa fa-circle"></i> | 25 | <i class="fa fa-circle"></i> |
| 26 | </li> | 26 | </li> |
| 27 | - <li><span class="active">时刻表明细制作建模</span></li> | 27 | + <li><span class="active">智能时刻表明细制作建模</span></li> |
| 28 | </ul> | 28 | </ul> |
| 29 | <!-- 线路信息导航栏组件 END --> | 29 | <!-- 线路信息导航栏组件 END --> |
| 30 | <div class="portlet light bordered" id="form-wizard-info"> | 30 | <div class="portlet light bordered" id="form-wizard-info"> |
| @@ -152,7 +152,7 @@ | @@ -152,7 +152,7 @@ | ||
| 152 | <input type="radio" class="icheck" name="baseRes" value=2 > 发车间隔分析(旧:一步调整) | 152 | <input type="radio" class="icheck" name="baseRes" value=2 > 发车间隔分析(旧:一步调整) |
| 153 | </label> | 153 | </label> |
| 154 | <label> | 154 | <label> |
| 155 | - <input type="radio" class="icheck" name="baseRes" value=3 checked> 发车间隔分析(新:增量调整-单向进出场) | 155 | + <input type="radio" class="icheck" name="baseRes" value=3 checked> 发车间隔分析(新:增量调整-单向进场) |
| 156 | </label> | 156 | </label> |
| 157 | <label> | 157 | <label> |
| 158 | <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 | 158 | <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 |
src/main/resources/static/pages/base/timesmodel/css/index.css
| @@ -217,11 +217,11 @@ text.alert-danger { | @@ -217,11 +217,11 @@ text.alert-danger { | ||
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | .sx { | 219 | .sx { |
| 220 | - background-color: #233f5d; | 220 | + background-color: #ff2949; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | .xx { | 223 | .xx { |
| 224 | - background-color: #31394a; | 224 | + background-color: #518fe3; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | .tipso_bubble { | 227 | .tipso_bubble { |
src/main/resources/static/pages/base/timesmodel/fragments/addbc.html
| @@ -201,7 +201,7 @@ $('#addBc_mobal').on('addBcMobal.show', function(e,lpData,lpDataCount,echartsDra | @@ -201,7 +201,7 @@ $('#addBc_mobal').on('addBcMobal.show', function(e,lpData,lpDataCount,echartsDra | ||
| 201 | // 'dir' : {required : true}, | 201 | // 'dir' : {required : true}, |
| 202 | 'fcsj' : {required : true}, | 202 | 'fcsj' : {required : true}, |
| 203 | 'bcType' : {required : true}, | 203 | 'bcType' : {required : true}, |
| 204 | - 'bcsj' : {number : true,required : true}, | 204 | + 'bcsj' : {min : 1, digits : true, required : true}, |
| 205 | 'isfb' : {required : true} | 205 | 'isfb' : {required : true} |
| 206 | }, | 206 | }, |
| 207 | invalidHandler : function(event, validator) { | 207 | invalidHandler : function(event, validator) { |
| @@ -224,50 +224,54 @@ $('#addBc_mobal').on('addBcMobal.show', function(e,lpData,lpDataCount,echartsDra | @@ -224,50 +224,54 @@ $('#addBc_mobal').on('addBcMobal.show', function(e,lpData,lpDataCount,echartsDra | ||
| 224 | var fcsj = Date.parse(DateTimeTool.getDateTime(params.fcsj)); | 224 | var fcsj = Date.parse(DateTimeTool.getDateTime(params.fcsj)); |
| 225 | var ARRIVALTIME = fcsj + parseInt(params.bcsj)*60000 ; | 225 | var ARRIVALTIME = fcsj + parseInt(params.bcsj)*60000 ; |
| 226 | 226 | ||
| 227 | - for(var i=0; i<data.length-1; i++) { | ||
| 228 | - if(data[i].value[0] == params.lpName) { | ||
| 229 | - if(data[i].value[7] < params.fcno) { | ||
| 230 | - prevBcObj = data[i]; | ||
| 231 | - bcObj = $.extend(true, {}, bcObj, data[i]); | ||
| 232 | - index = i+1; | ||
| 233 | - } else { | ||
| 234 | - if(type) { | ||
| 235 | - type = false; | ||
| 236 | - nextBcObj = data[i]; | 227 | + if(params.bcsj > 0){ |
| 228 | + for(var i=0; i<data.length-1; i++) { | ||
| 229 | + if(data[i].value[0] == params.lpName) { | ||
| 230 | + if(data[i].value[7] < params.fcno) { | ||
| 231 | + prevBcObj = data[i]; | ||
| 232 | + bcObj = $.extend(true, {}, bcObj, data[i]); | ||
| 233 | + index = i+1; | ||
| 234 | + } else { | ||
| 235 | + if(type) { | ||
| 236 | + type = false; | ||
| 237 | + nextBcObj = data[i]; | ||
| 238 | + } | ||
| 239 | + data[i].value[7] += 1; | ||
| 237 | } | 240 | } |
| 238 | - data[i].value[7] += 1; | ||
| 239 | } | 241 | } |
| 240 | } | 242 | } |
| 241 | - } | ||
| 242 | - bcObj.value[1] = fcsj; | ||
| 243 | - bcObj.value[2] = ARRIVALTIME; | ||
| 244 | - bcObj.value[3] = params.bcsj*60000; | ||
| 245 | - // bcObj.value[4] = lpNo; | ||
| 246 | - bcObj.value[6] = params.bcType; | ||
| 247 | - bcObj.value[7] = parseInt(params.fcno); | ||
| 248 | - var dir = bcObj.value[8] == 1 ? 0:1; | ||
| 249 | - bcObj.value[8] = dir; | ||
| 250 | - bcObj.itemStyle.normal.color = dir==0?"#ff2949":"#518fe3"; | ||
| 251 | - // 起终点互换 | ||
| 252 | - var station = bcObj.value[13]; | ||
| 253 | - bcObj.value[13] = bcObj.value[14]; | ||
| 254 | - bcObj.value[14] = station; | ||
| 255 | - bcObj.value[16] = parseInt(params.isfb); | ||
| 256 | - data.splice(index, 0 , bcObj); | 243 | + bcObj.value[1] = fcsj; |
| 244 | + bcObj.value[2] = ARRIVALTIME; | ||
| 245 | + bcObj.value[3] = params.bcsj*60000; | ||
| 246 | + // bcObj.value[4] = lpNo; | ||
| 247 | + bcObj.value[6] = params.bcType; | ||
| 248 | + bcObj.value[7] = parseInt(params.fcno); | ||
| 249 | + var dir = bcObj.value[8] == 1 ? 0:1; | ||
| 250 | + bcObj.value[8] = dir; | ||
| 251 | + bcObj.itemStyle.normal.color = dir==0?"#ff2949":"#518fe3"; | ||
| 252 | + // 起终点互换 | ||
| 253 | + var station = bcObj.value[13]; | ||
| 254 | + bcObj.value[13] = bcObj.value[14]; | ||
| 255 | + bcObj.value[14] = station; | ||
| 256 | + bcObj.value[16] = parseInt(params.isfb); | ||
| 257 | + data.splice(index, 0 , bcObj); | ||
| 257 | 258 | ||
| 258 | - if(nextBcObj != null && (nextBcObj.value[1] < ARRIVALTIME || prevBcObj.value[2] > fcsj)){ | ||
| 259 | - layer.confirm('添加的班次与前后班次有时间冲突,是否添加?', { | ||
| 260 | - btn : [ '添加','取消' ], icon: 3, title:'提示' | ||
| 261 | - }, function(){ | ||
| 262 | - echartsDrawGTT.init(data,false,true); | 259 | + if(nextBcObj != null && (nextBcObj.value[1] < ARRIVALTIME || prevBcObj.value[2] > fcsj)){ |
| 260 | + layer.confirm('添加的班次与前后班次有时间冲突,是否添加?', { | ||
| 261 | + btn : [ '添加','取消' ], icon: 3, title:'提示' | ||
| 262 | + }, function(){ | ||
| 263 | + echartsDrawGTT.init(data,false,true,false); | ||
| 264 | + echartsDrawGTT.refreshDrag(); | ||
| 265 | + layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功,注意修改冲突班次!'); | ||
| 266 | + }); | ||
| 267 | + } else { | ||
| 268 | + echartsDrawGTT.init(data,false,true,false); | ||
| 263 | echartsDrawGTT.refreshDrag(); | 269 | echartsDrawGTT.refreshDrag(); |
| 264 | - layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功,注意修改冲突班次!'); | ||
| 265 | - }); | 270 | + layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功!'); |
| 271 | + } | ||
| 266 | } else { | 272 | } else { |
| 267 | - echartsDrawGTT.init(data,false,true); | ||
| 268 | - echartsDrawGTT.refreshDrag(); | ||
| 269 | - layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次添加成功!'); | ||
| 270 | - } | 273 | + layer.msg('班次时间为0分钟,为无效班次添加失败!'); |
| 274 | + } | ||
| 271 | $('#addBc_mobal').modal('hide'); | 275 | $('#addBc_mobal').modal('hide'); |
| 272 | } | 276 | } |
| 273 | }); | 277 | }); |
src/main/resources/static/pages/base/timesmodel/fragments/deletelp.html
| @@ -104,7 +104,7 @@ $('#deletelp_mobal').on('deletelpMobal.show', function(e,lpData,echartsDrawGTT){ | @@ -104,7 +104,7 @@ $('#deletelp_mobal').on('deletelpMobal.show', function(e,lpData,echartsDrawGTT){ | ||
| 104 | lpData.splice(index,1); | 104 | lpData.splice(index,1); |
| 105 | }); | 105 | }); |
| 106 | echartsDrawGTT.setLpData(lpData); | 106 | echartsDrawGTT.setLpData(lpData); |
| 107 | - echartsDrawGTT.init(data,false,true); | 107 | + echartsDrawGTT.init(data,false,true,false); |
| 108 | echartsDrawGTT.refreshDrag(); | 108 | echartsDrawGTT.refreshDrag(); |
| 109 | $('#deletelp_mobal').modal('hide'); | 109 | $('#deletelp_mobal').modal('hide'); |
| 110 | layer.msg('删除路牌【'+ params.lpName +'】成功!'); | 110 | layer.msg('删除路牌【'+ params.lpName +'】成功!'); |
src/main/resources/static/pages/base/timesmodel/fragments/editbc.html
| @@ -162,7 +162,7 @@ $('#editBc_mobal').on('editBcMobal.show', function(e,index,echartsDrawGTT){ | @@ -162,7 +162,7 @@ $('#editBc_mobal').on('editBcMobal.show', function(e,index,echartsDrawGTT){ | ||
| 162 | // 'dir' : {required : true}, | 162 | // 'dir' : {required : true}, |
| 163 | 'fcsj' : {required : true}, | 163 | 'fcsj' : {required : true}, |
| 164 | 'bcType' : {required : true}, | 164 | 'bcType' : {required : true}, |
| 165 | - 'bcsj' : {number : true,required : true}, | 165 | + 'bcsj' : {min : 1, digits : true,required : true}, |
| 166 | 'isfb' : {required : true} | 166 | 'isfb' : {required : true} |
| 167 | }, | 167 | }, |
| 168 | invalidHandler : function(event, validator) { | 168 | invalidHandler : function(event, validator) { |
| @@ -192,7 +192,7 @@ $('#editBc_mobal').on('editBcMobal.show', function(e,index,echartsDrawGTT){ | @@ -192,7 +192,7 @@ $('#editBc_mobal').on('editBcMobal.show', function(e,index,echartsDrawGTT){ | ||
| 192 | bcObj.value[7] = parseInt(params.fcno); | 192 | bcObj.value[7] = parseInt(params.fcno); |
| 193 | bcObj.value[16] = parseInt(params.isfb); | 193 | bcObj.value[16] = parseInt(params.isfb); |
| 194 | 194 | ||
| 195 | - echartsDrawGTT.init(data,false,true); | 195 | + echartsDrawGTT.init(data,false,true,false); |
| 196 | echartsDrawGTT.refreshDrag(); | 196 | echartsDrawGTT.refreshDrag(); |
| 197 | layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次修改成功!'); | 197 | layer.msg('路牌:'+params.lpName+' fnco:'+params.fcno+' 班次修改成功!'); |
| 198 | $('#editBc_mobal').modal('hide'); | 198 | $('#editBc_mobal').modal('hide'); |
src/main/resources/static/pages/base/timesmodel/gantt.html
| @@ -14,10 +14,10 @@ | @@ -14,10 +14,10 @@ | ||
| 14 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | 14 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> |
| 15 | <li><span class="active">运营计划管理</span> <i class="fa fa-circle"></i></li> | 15 | <li><span class="active">运营计划管理</span> <i class="fa fa-circle"></i></li> |
| 16 | <li> | 16 | <li> |
| 17 | - <a href="/#/ttInfoManage">时刻表管理</a> | 17 | + <a href="/#/ttInfoManage2">智能时刻表管理</a> |
| 18 | <i class="fa fa-circle"></i> | 18 | <i class="fa fa-circle"></i> |
| 19 | </li> | 19 | </li> |
| 20 | - <li><span class="active">时刻表明细模型</span></li> | 20 | + <li><span class="active">智能时刻表明细模型</span></li> |
| 21 | </ul> | 21 | </ul> |
| 22 | <!-- 线路信息导航栏组件 END --> | 22 | <!-- 线路信息导航栏组件 END --> |
| 23 | 23 | ||
| @@ -160,6 +160,11 @@ | @@ -160,6 +160,11 @@ | ||
| 160 | </div> | 160 | </div> |
| 161 | <!-- col-md-12 组件END --> | 161 | <!-- col-md-12 组件END --> |
| 162 | </div> | 162 | </div> |
| 163 | + | ||
| 164 | + | ||
| 165 | +<!-- echarts4 误删 --> | ||
| 166 | +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | ||
| 167 | + | ||
| 163 | <!-- row 组件END --> | 168 | <!-- row 组件END --> |
| 164 | <script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script> | 169 | <script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script> |
| 165 | <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script> | 170 | <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script> |
| @@ -186,8 +191,8 @@ | @@ -186,8 +191,8 @@ | ||
| 186 | --> | 191 | --> |
| 187 | 192 | ||
| 188 | <script src="/pages/base/timesmodel/js/v2_2/InternalScheduleObj.js"></script> | 193 | <script src="/pages/base/timesmodel/js/v2_2/InternalScheduleObj.js"></script> |
| 189 | -<script src="/pages/base/timesmodel/js/v2_2/main_v2_2_excel.js"></script> | ||
| 190 | <script src="/pages/base/timesmodel/js/v2_2/main_v2_2.js"></script> | 194 | <script src="/pages/base/timesmodel/js/v2_2/main_v2_2.js"></script> |
| 195 | +<script src="/pages/base/timesmodel/js/v2_2/Main_v2_2_ExcelObj.js"></script> | ||
| 191 | <script src="/pages/base/timesmodel/js/v2_2/strategy/workhours/ModifyBcTripWHS1.js"></script> | 196 | <script src="/pages/base/timesmodel/js/v2_2/strategy/workhours/ModifyBcTripWHS1.js"></script> |
| 192 | <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS1.js"></script> | 197 | <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS1.js"></script> |
| 193 | <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS2.js"></script> | 198 | <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS2.js"></script> |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| 1 | - | ||
| 2 | /** | 1 | /** |
| 3 | * @description : (TODO) 表单的导航向导、验证、提交 | 2 | * @description : (TODO) 表单的导航向导、验证、提交 |
| 4 | */ | 3 | */ |
| @@ -288,12 +287,12 @@ var SKBFormWizard = function() { | @@ -288,12 +287,12 @@ var SKBFormWizard = function() { | ||
| 288 | // 4、返回判断结果布尔值. | 287 | // 4、返回判断结果布尔值. |
| 289 | return tag; | 288 | return tag; |
| 290 | } | 289 | } |
| 291 | - | 290 | + |
| 292 | /** | 291 | /** |
| 293 | * @description : (TODO) 获取客流数据. | 292 | * @description : (TODO) 获取客流数据. |
| 294 | - * | 293 | + * |
| 295 | * @params [url--请求地址;data--请求参数;cb--回调函数] | 294 | * @params [url--请求地址;data--请求参数;cb--回调函数] |
| 296 | - * | 295 | + * |
| 297 | * */ | 296 | * */ |
| 298 | function getJSONP(url, data, cb) { | 297 | function getJSONP(url, data, cb) { |
| 299 | $.ajax({ | 298 | $.ajax({ |
| @@ -305,24 +304,24 @@ var SKBFormWizard = function() { | @@ -305,24 +304,24 @@ var SKBFormWizard = function() { | ||
| 305 | success : cb | 304 | success : cb |
| 306 | }); | 305 | }); |
| 307 | } | 306 | } |
| 308 | - | 307 | + |
| 309 | /** | 308 | /** |
| 310 | * @description : (TODO) 根据获取参数方式来获取表单参数详情html模版页. | 309 | * @description : (TODO) 根据获取参数方式来获取表单参数详情html模版页. |
| 311 | - * | 310 | + * |
| 312 | * @param [n--获取参数方式;map--表单参数;lineId--线路ID;krl--客容量;cb--回调函数] | 311 | * @param [n--获取参数方式;map--表单参数;lineId--线路ID;krl--客容量;cb--回调函数] |
| 313 | - * | 312 | + * |
| 314 | * @return 返回表单参数详情html模版页. | 313 | * @return 返回表单参数详情html模版页. |
| 315 | - * | 314 | + * |
| 316 | * @status OK. | 315 | * @status OK. |
| 317 | * */ | 316 | * */ |
| 318 | var getHtmlTemp = function(n,map,lineId,krl,cb) { | 317 | var getHtmlTemp = function(n,map,lineId,krl,cb) { |
| 319 | // 1、定义模版名称. | 318 | // 1、定义模版名称. |
| 320 | var tempName = ''; | 319 | var tempName = ''; |
| 321 | - if(n==0) | 320 | + if(n==0) |
| 322 | tempName = 'carnum_temp'; | 321 | tempName = 'carnum_temp'; |
| 323 | else if(n==1) | 322 | else if(n==1) |
| 324 | tempName = 'bctype_temp'; | 323 | tempName = 'bctype_temp'; |
| 325 | - else if (n==2 || n == 3) | 324 | + else if (n==2 || n==3) |
| 326 | tempName = 'fcjx_temp'; | 325 | tempName = 'fcjx_temp'; |
| 327 | // 2、获参数详情模版html内容. | 326 | // 2、获参数详情模版html内容. |
| 328 | $.get('/pages/base/timesmodel/tepms/'+ tempName + '.html', function(html){ | 327 | $.get('/pages/base/timesmodel/tepms/'+ tempName + '.html', function(html){ |
| @@ -348,9 +347,9 @@ var SKBFormWizard = function() { | @@ -348,9 +347,9 @@ var SKBFormWizard = function() { | ||
| 348 | var params = {'xlid':lineId,'startDateTime':startDateTime,'endDateTime':endDateTime,'zzsj':zzsj}; | 347 | var params = {'xlid':lineId,'startDateTime':startDateTime,'endDateTime':endDateTime,'zzsj':zzsj}; |
| 349 | /** | 348 | /** |
| 350 | * getJSONP请求获取客流数据. | 349 | * getJSONP请求获取客流数据. |
| 351 | - * | 350 | + * |
| 352 | * 返回的是一个每次以半小时为间隔作为开始时间点, 在加上周转时间作为结束时间点的 时段段内的客流最大通过量. | 351 | * 返回的是一个每次以半小时为间隔作为开始时间点, 在加上周转时间作为结束时间点的 时段段内的客流最大通过量. |
| 353 | - * */ | 352 | + * */ |
| 354 | getJSONP("http://139.196.13.237:8080/bsth-busfareflow-gj/Crlcxb/selectsjbctgl.do",params,function(json){ | 353 | getJSONP("http://139.196.13.237:8080/bsth-busfareflow-gj/Crlcxb/selectsjbctgl.do",params,function(json){ |
| 355 | // 定义时段集合,可容量. | 354 | // 定义时段集合,可容量. |
| 356 | var sjdArr = getsjdArr(map),krlInt = parseInt(krl); | 355 | var sjdArr = getsjdArr(map),krlInt = parseInt(krl); |
| @@ -390,11 +389,29 @@ var SKBFormWizard = function() { | @@ -390,11 +389,29 @@ var SKBFormWizard = function() { | ||
| 390 | 389 | ||
| 391 | // 返回参数详情模版. | 390 | // 返回参数详情模版. |
| 392 | return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); | 391 | return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); |
| 393 | - }); | 392 | + }); |
| 394 | }else if(n==1) { | 393 | }else if(n==1) { |
| 395 | - // 返回参数详情模版. | ||
| 396 | - return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); | ||
| 397 | - }else if (n==2 || n == 3) { | 394 | + // 更具站点路由版本获取起点终点站 |
| 395 | + var iversion = $('#lineVersionSelect').val(); | ||
| 396 | + $get('/stationroute/all',{'line.id_eq':lineId,'destroy_eq':0, 'versions_eq': iversion},function(result) { | ||
| 397 | + $.each(result, function(i, d) { | ||
| 398 | + if (d.stationMark == 'B' && d.directions == 0) { | ||
| 399 | + // alert(d.stationName); | ||
| 400 | + map.line.startStationName = d.stationName; | ||
| 401 | + } else if (d.stationMark == 'E' && d.directions == 0) { | ||
| 402 | + // alert(d.stationName); | ||
| 403 | + map.line.endStationName = d.stationName; | ||
| 404 | + } | ||
| 405 | + }); | ||
| 406 | + | ||
| 407 | + // return cb && cb({ | ||
| 408 | + // 'forminput': template(tempName, {map: map}), | ||
| 409 | + // 'datadisplay': template(tempName + '_config', {map: null}) | ||
| 410 | + // }); | ||
| 411 | + // 返回参数详情模版. | ||
| 412 | + return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); | ||
| 413 | + }); | ||
| 414 | + }else if (n==2 || n==3) { | ||
| 398 | // 更具站点路由版本获取起点终点站 | 415 | // 更具站点路由版本获取起点终点站 |
| 399 | var iversion = $('#lineVersionSelect').val(); | 416 | var iversion = $('#lineVersionSelect').val(); |
| 400 | $get('/stationroute/all',{'line.id_eq':lineId,'destroy_eq':0, 'versions_eq': iversion},function(result) { | 417 | $get('/stationroute/all',{'line.id_eq':lineId,'destroy_eq':0, 'versions_eq': iversion},function(result) { |
| @@ -417,8 +434,8 @@ var SKBFormWizard = function() { | @@ -417,8 +434,8 @@ var SKBFormWizard = function() { | ||
| 417 | 434 | ||
| 418 | } | 435 | } |
| 419 | }); | 436 | }); |
| 420 | - } | ||
| 421 | - | 437 | + }; |
| 438 | + | ||
| 422 | /** | 439 | /** |
| 423 | * @description (TODO) 格式化成渲染图形数据格式. | 440 | * @description (TODO) 格式化成渲染图形数据格式. |
| 424 | * | 441 | * |
| @@ -540,7 +557,17 @@ var SKBFormWizard = function() { | @@ -540,7 +557,17 @@ var SKBFormWizard = function() { | ||
| 540 | 'bxrc' : {required : true},// 班型人次,必填项 | 557 | 'bxrc' : {required : true},// 班型人次,必填项 |
| 541 | 'linePlayType' : {required : true},// 线路规划类型,必填项 | 558 | 'linePlayType' : {required : true},// 线路规划类型,必填项 |
| 542 | 'zdzcrl' : {number : true,digits : true}, | 559 | 'zdzcrl' : {number : true,digits : true}, |
| 543 | - | 560 | + // 新增时间段字段 |
| 561 | + 'start1' : {required : true}, | ||
| 562 | + 'end1' : {required : true}, | ||
| 563 | + 'start2' : {required : true}, | ||
| 564 | + 'end2' : {required : true}, | ||
| 565 | + 'start3' : {required : true}, | ||
| 566 | + 'end3' : {required : true}, | ||
| 567 | + 'start4' : {required : true}, | ||
| 568 | + 'end4' : {required : true}, | ||
| 569 | + 'start5' : {required : true}, | ||
| 570 | + 'end5' : {required : true}, | ||
| 544 | 571 | ||
| 545 | 'gfupStopTime' : {required : true,number : true}, // 高峰上行停站时间,必填项、必须为整数. | 572 | 'gfupStopTime' : {required : true,number : true}, // 高峰上行停站时间,必填项、必须为整数. |
| 546 | 'gfdownStopTime' : {required : true,number : true}, // 高峰下行停站时间,必填项、必须为整数. | 573 | 'gfdownStopTime' : {required : true,number : true}, // 高峰下行停站时间,必填项、必须为整数. |
| @@ -957,6 +984,16 @@ var SKBFormWizard = function() { | @@ -957,6 +984,16 @@ var SKBFormWizard = function() { | ||
| 957 | $('#zgfjssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 早高峰结束时间 | 984 | $('#zgfjssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 早高峰结束时间 |
| 958 | $('#wgfkssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 晚高峰开始时间 | 985 | $('#wgfkssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 晚高峰开始时间 |
| 959 | $('#wgfjssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 晚高峰结束时间 | 986 | $('#wgfjssjInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});// 晚高峰结束时间 |
| 987 | + $('#startInput1').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 988 | + $('#endInput1').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 989 | + $('#startInput2').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 990 | + $('#endInput2').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 991 | + $('#startInput3').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 992 | + $('#endInput3').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 993 | + $('#startInput4').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 994 | + $('#endInput4').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 995 | + $('#startInput5').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 996 | + $('#endInput5').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); | ||
| 960 | // 初始化停车场下拉框. | 997 | // 初始化停车场下拉框. |
| 961 | gettccInfo(function(cd) { | 998 | gettccInfo(function(cd) { |
| 962 | var options = '<option value="">请选择...</option><optgroup label="停车场">'; | 999 | var options = '<option value="">请选择...</option><optgroup label="停车场">'; |
src/main/resources/static/pages/base/timesmodel/js/dateTimeTool.js
| 1 | /** 时间工具类*/ | 1 | /** 时间工具类*/ |
| 2 | var DateTimeTool = function () { | 2 | var DateTimeTool = function () { |
| 3 | + var jsd = []; | ||
| 4 | + var initSJD = function (map) { | ||
| 5 | + jsd = map; | ||
| 6 | + }; | ||
| 3 | // 数字格式转化为时间格式 | 7 | // 数字格式转化为时间格式 |
| 4 | var calculateHours = function (time) { | 8 | var calculateHours = function (time) { |
| 5 | if(!time) | 9 | if(!time) |
| @@ -44,9 +48,38 @@ var DateTimeTool = function () { | @@ -44,9 +48,38 @@ var DateTimeTool = function () { | ||
| 44 | +':' | 48 | +':' |
| 45 | +(date.getMinutes()<10? '0' + date.getMinutes() : date.getMinutes()); | 49 | +(date.getMinutes()<10? '0' + date.getMinutes() : date.getMinutes()); |
| 46 | }; | 50 | }; |
| 51 | + // 判断时间在什么时间段段内 | ||
| 52 | + var judgmentTimeQuantum = function (t) { | ||
| 53 | + if(t <= getDateTime(jsd[0].end)) | ||
| 54 | + return 0; | ||
| 55 | + else if(t > getDateTime(jsd[1].start) && t <= getDateTime(jsd[1].end)) | ||
| 56 | + return 1; | ||
| 57 | + else if(t > getDateTime(jsd[2].start) && t <= getDateTime(jsd[2].end)) | ||
| 58 | + return 2; | ||
| 59 | + else if(t > getDateTime(jsd[3].start) && t <= getDateTime(jsd[3].end)) | ||
| 60 | + return 3; | ||
| 61 | + else if(t > getDateTime(jsd[4].start)) | ||
| 62 | + return 4; | ||
| 63 | + }; | ||
| 64 | + | ||
| 65 | + // 8:31-16:00专用 | ||
| 66 | + var judgmentTimeQuantum1 = function (t) { | ||
| 67 | + var start = DateTimeTool.getDateTime(jsd[2].start); | ||
| 68 | + if(t > start && t <= start.setHours(start.getHours() + 2)) | ||
| 69 | + return 1; | ||
| 70 | + else if(t > start.setHours(start.getHours() + 2) && t <= start.setHours(start.getHours() + 4)) | ||
| 71 | + return 2; | ||
| 72 | + else if(t > start.setHours(start.getHours() + 4) && t <= start.setHours(start.getHours() + 6)) | ||
| 73 | + return 2; | ||
| 74 | + else if(t > start.setHours(start.getHours() + 6) && t <= DateTimeTool.getDateTime(jsd[2].end)) | ||
| 75 | + return 1; | ||
| 76 | + }; | ||
| 47 | return{ | 77 | return{ |
| 78 | + initSJD : initSJD, | ||
| 48 | calculateHours : calculateHours, | 79 | calculateHours : calculateHours, |
| 49 | getDateTime : getDateTime, | 80 | getDateTime : getDateTime, |
| 50 | - getHHmmStr : getHHmmStr | 81 | + getHHmmStr : getHHmmStr, |
| 82 | + judgmentTimeQuantum : judgmentTimeQuantum, | ||
| 83 | + judgmentTimeQuantum1 : judgmentTimeQuantum1 | ||
| 51 | } | 84 | } |
| 52 | }(); | 85 | }(); |
src/main/resources/static/pages/base/timesmodel/js/echartsDrawGanTT.js
| @@ -5,7 +5,7 @@ var echartsDrawGTT = function () { | @@ -5,7 +5,7 @@ var echartsDrawGTT = function () { | ||
| 5 | var upDowndom = document.getElementById("upDownContainer"); | 5 | var upDowndom = document.getElementById("upDownContainer"); |
| 6 | var upDownChart = echarts.init(upDowndom); | 6 | var upDownChart = echarts.init(upDowndom); |
| 7 | // upDowndom.style.height = '200px'; | 7 | // upDowndom.style.height = '200px'; |
| 8 | - var option,upDownOption,dataZoomStart = 0,dataZoomEnd = 80;//图层对象 | 8 | + var option,upDownOption,dataZoomStart = 0,dataZoomEnd = 70;//图层对象 |
| 9 | var historyData = [],// 保存操作图形后的数据集合(撤销与恢复操作) | 9 | var historyData = [],// 保存操作图形后的数据集合(撤销与恢复操作) |
| 10 | _keyIndex = -1,// 记录当前操作步骤 (在撤销与恢复操作时) | 10 | _keyIndex = -1,// 记录当前操作步骤 (在撤销与恢复操作时) |
| 11 | dataUp = [],// (上/下)行发车时刻表数据 | 11 | dataUp = [],// (上/下)行发车时刻表数据 |
| @@ -107,7 +107,8 @@ var echartsDrawGTT = function () { | @@ -107,7 +107,8 @@ var echartsDrawGTT = function () { | ||
| 107 | bcObj.qdz, | 107 | bcObj.qdz, |
| 108 | bcObj.zdz, | 108 | bcObj.zdz, |
| 109 | bcObj.STOPTIME, | 109 | bcObj.STOPTIME, |
| 110 | - bcObj.isfb = 0 | 110 | + bcObj.isfb ? 1:0, |
| 111 | + bcObj.qs | ||
| 111 | //bcObj.isSwitchXl, | 112 | //bcObj.isSwitchXl, |
| 112 | //bcObj.bz, | 113 | //bcObj.bz, |
| 113 | ], | 114 | ], |
| @@ -329,7 +330,7 @@ var echartsDrawGTT = function () { | @@ -329,7 +330,7 @@ var echartsDrawGTT = function () { | ||
| 329 | bcTypeStr = bcType[type]; | 330 | bcTypeStr = bcType[type]; |
| 330 | 331 | ||
| 331 | var arr = [ | 332 | var arr = [ |
| 332 | - '{left|' + timeStr + '}{type|' + bcTypeStr +'}', | 333 | + '{left|' + timeStr + '}{type|'+ ((dataZoomEnd - dataZoomStart) <= 70 ? bcType[type] : '') +'}', |
| 333 | '{left|' + lastStr + '}{left|' + stayStr + '}' | 334 | '{left|' + lastStr + '}{left|' + stayStr + '}' |
| 334 | ]; | 335 | ]; |
| 335 | return arr.join('\n'); | 336 | return arr.join('\n'); |
| @@ -601,11 +602,17 @@ var echartsDrawGTT = function () { | @@ -601,11 +602,17 @@ var echartsDrawGTT = function () { | ||
| 601 | lastStr = "行:" + last; | 602 | lastStr = "行:" + last; |
| 602 | } | 603 | } |
| 603 | 604 | ||
| 605 | + // 分班显示‘分’ | ||
| 606 | + if(params.data.value[16] == 1) | ||
| 607 | + bcTypeStr = "分"; | ||
| 608 | + else | ||
| 609 | + bcTypeStr = bcType[type]; | ||
| 610 | + | ||
| 604 | if(type == 'normal') { | 611 | if(type == 'normal') { |
| 605 | stayStr = "停:" + params.data.value[15]; | 612 | stayStr = "停:" + params.data.value[15]; |
| 606 | } | 613 | } |
| 607 | var arr = [ | 614 | var arr = [ |
| 608 | - '{left|' + timeStr + '}{type|'+ ((e.end - e.start) < 80 ? bcType[type] : '') +'}', | 615 | + '{left|' + timeStr + '}{type|'+ ((dataZoomEnd - dataZoomStart) <= 70 ? bcType[type] : '') +'}', |
| 609 | '{left|' + lastStr + '}{left|' + stayStr + '}' | 616 | '{left|' + lastStr + '}{left|' + stayStr + '}' |
| 610 | ]; | 617 | ]; |
| 611 | 618 | ||
| @@ -895,14 +902,15 @@ var echartsDrawGTT = function () { | @@ -895,14 +902,15 @@ var echartsDrawGTT = function () { | ||
| 895 | data[dataIndex].value[2] = xMax; | 902 | data[dataIndex].value[2] = xMax; |
| 896 | data[dataIndex].value[1] = data[dataIndex].value[2] - data[dataIndex].value[3]; | 903 | data[dataIndex].value[1] = data[dataIndex].value[2] - data[dataIndex].value[3]; |
| 897 | } | 904 | } |
| 898 | - | ||
| 899 | } | 905 | } |
| 900 | - _keyIndex++; | 906 | + |
| 907 | + set_keyIndex(++_keyIndex); | ||
| 901 | 908 | ||
| 902 | historyData[_keyIndex] = $.extend(true, [], historyData[_keyIndex], data);// 历史数组增加一次数据 | 909 | historyData[_keyIndex] = $.extend(true, [], historyData[_keyIndex], data);// 历史数组增加一次数据 |
| 903 | refreshDrag(); | 910 | refreshDrag(); |
| 904 | refreshUpDownData(); | 911 | refreshUpDownData(); |
| 905 | historyData.splice(_keyIndex + 1, historyData.length);// 数据改变后过后清除多余的历史数据 | 912 | historyData.splice(_keyIndex + 1, historyData.length);// 数据改变后过后清除多余的历史数据 |
| 913 | + init(historyData[_keyIndex],false,false); | ||
| 906 | } else { | 914 | } else { |
| 907 | refreshDrag(); | 915 | refreshDrag(); |
| 908 | } | 916 | } |
| @@ -936,7 +944,12 @@ var echartsDrawGTT = function () { | @@ -936,7 +944,12 @@ var echartsDrawGTT = function () { | ||
| 936 | color: '#333' | 944 | color: '#333' |
| 937 | }, | 945 | }, |
| 938 | min: 0, | 946 | min: 0, |
| 939 | - max: 30, | 947 | + max: function(value) { |
| 948 | + if(value.max < 30) | ||
| 949 | + return 30; | ||
| 950 | + else | ||
| 951 | + return value.max + 5; | ||
| 952 | + }, | ||
| 940 | axisTick: {show: false}, | 953 | axisTick: {show: false}, |
| 941 | //axisLine: {lineStyle: {color: '#ccc'}}, | 954 | //axisLine: {lineStyle: {color: '#ccc'}}, |
| 942 | axisLabel: {show: false}, | 955 | axisLabel: {show: false}, |
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| 1 | (function() { | 1 | (function() { |
| 2 | + var indexLoad = layer.load(0, {content:'拼命计算中...',time: 10*1000,success: function(layero){ | ||
| 3 | + layero.find('.layui-layer-content').css('padding-top', '40px'); | ||
| 4 | + }}); | ||
| 2 | // 全屏模式点击事件. | 5 | // 全屏模式点击事件. |
| 3 | // $(document).on('click','.fullscreen',function() { | 6 | // $(document).on('click','.fullscreen',function() { |
| 4 | // if($('.ganttSvgContainer').height()>400) | 7 | // if($('.ganttSvgContainer').height()>400) |
| @@ -34,7 +37,7 @@ | @@ -34,7 +37,7 @@ | ||
| 34 | offsetX : offsetX, | 37 | offsetX : offsetX, |
| 35 | offsetY : offsetY, | 38 | offsetY : offsetY, |
| 36 | content :'<div class="tipsdscontinue"> <span>图例:</span> <div class="dscrp sx"></div><span>:上行</span> <div class="dscrp xx"></div> <span>:下行</span></br><div/></br>' + | 39 | content :'<div class="tipsdscontinue"> <span>图例:</span> <div class="dscrp sx"></div><span>:上行</span> <div class="dscrp xx"></div> <span>:下行</span></br><div/></br>' + |
| 37 | - '<div class="tipsdscontinue"> <span>该模块支持鼠标拖拽、鼠标绘制(鼠标右键按下3S开始)框选功能.</span> <div/>' | 40 | + '<div class="tipsdscontinue"> <span>该模块支持鼠标拖拽功能.</span> <div/>' |
| 38 | 41 | ||
| 39 | }); | 42 | }); |
| 40 | $('.tipso-animation').tipso('show'); | 43 | $('.tipso-animation').tipso('show'); |
| @@ -99,7 +102,6 @@ | @@ -99,7 +102,6 @@ | ||
| 99 | Main_v2.exportDataConfig(data.aInternalLpObj); | 102 | Main_v2.exportDataConfig(data.aInternalLpObj); |
| 100 | } else if (map.baseRes == '3') { // 主站停站使用v2_2版本 | 103 | } else if (map.baseRes == '3') { // 主站停站使用v2_2版本 |
| 101 | data = Main_v2_2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar); | 104 | data = Main_v2_2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar); |
| 102 | - Main_v2_2.exportDataConfig(data.aInternalLpObj); | ||
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | }else { | 107 | }else { |
| @@ -124,12 +126,12 @@ | @@ -124,12 +126,12 @@ | ||
| 124 | } | 126 | } |
| 125 | // 按照发车序号顺序排序. | 127 | // 按照发车序号顺序排序. |
| 126 | lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | 128 | lpbc_.sort(function(a,b){return a.fcno-b.fcno}); |
| 127 | - resultJA = resultJA.concat(BaseFun.addjclbbc01(lpbc_,dataMap,stopAraay[0].lbsj,map)); | 129 | + resultJA = resultJA.concat(BaseFun.addjclbbc01(lpbc_,dataMap,stopArray[0].lbsj,map)); |
| 128 | } | 130 | } |
| 129 | data = {'json':rsjar,'bxrcgs':null}; | 131 | data = {'json':rsjar,'bxrcgs':null}; |
| 130 | } | 132 | } |
| 131 | echartsDrawGTT.init(data.json,true,true); | 133 | echartsDrawGTT.init(data.json,true,true); |
| 132 | - console.log(data.json); | 134 | + // console.log(data.json); |
| 133 | // 创建甘特图对象. | 135 | // 创建甘特图对象. |
| 134 | // var graph = d3.select('#ganttSvg').relationshipGraph( | 136 | // var graph = d3.select('#ganttSvg').relationshipGraph( |
| 135 | // getGraphArgus({'ganttInitParams': map,'yAxisCarArray':CSMap.maxCar, | 137 | // getGraphArgus({'ganttInitParams': map,'yAxisCarArray':CSMap.maxCar, |
| @@ -140,6 +142,55 @@ | @@ -140,6 +142,55 @@ | ||
| 140 | // graph.addHistory(); | 142 | // graph.addHistory(); |
| 141 | // // 初始化右键菜单. | 143 | // // 初始化右键菜单. |
| 142 | // contextInit(graph); | 144 | // contextInit(graph); |
| 145 | + | ||
| 146 | + if (map.baseRes == '3' || map.baseRes == '1') { | ||
| 147 | + // 导入导出设置 | ||
| 148 | + // Main_v2_2.exportExcelConfig($_GlobalGraph.getDataArray); | ||
| 149 | + | ||
| 150 | + var _dfun = function() { | ||
| 151 | + // fix,从新的甘特图中获取数据 | ||
| 152 | + var _keyIndex = echartsDrawGTT.get_keyIndex(); | ||
| 153 | + var historyData = echartsDrawGTT.getHistoryData(); | ||
| 154 | + var _data = $.extend(true, [], data, historyData[_keyIndex]); | ||
| 155 | + | ||
| 156 | + var _i; | ||
| 157 | + var _j; | ||
| 158 | + var _gObj; | ||
| 159 | + | ||
| 160 | + var _rtnBcArray = []; | ||
| 161 | + for (_i = 0; _i < _data.length; _i++) { | ||
| 162 | + _gObj = _data[_i].value; | ||
| 163 | + _rtnBcArray.push({ | ||
| 164 | + lpName : _gObj[0], | ||
| 165 | + fcsj: moment(_gObj[1]).format("HH:mm"), | ||
| 166 | + ARRIVALTIME: moment(_gObj[2]).format("HH:mm"), | ||
| 167 | + bcsj: _gObj[3] / 60000, | ||
| 168 | + lpNo: _gObj[4], | ||
| 169 | + lpType: _gObj[5], | ||
| 170 | + bcType: _gObj[6], | ||
| 171 | + fcno: _gObj[7], | ||
| 172 | + xlDir: (_gObj[8] == 0 ? "relationshipGraph-up" : "relationshipGraph-down"), | ||
| 173 | + jhlc: _gObj[9], | ||
| 174 | + tcc: _gObj[10], | ||
| 175 | + ttinfo: _gObj[11], | ||
| 176 | + xl: _gObj[12], | ||
| 177 | + qdz: _gObj[13], | ||
| 178 | + zdz: _gObj[14], | ||
| 179 | + STOPTIME: _gObj[15], | ||
| 180 | + isfb: _gObj[16] | ||
| 181 | + }); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + console.log("重组前数据=" + _data); | ||
| 185 | + console.log("重组后数据=" + _rtnBcArray); | ||
| 186 | + return _rtnBcArray; | ||
| 187 | + }; | ||
| 188 | + | ||
| 189 | + // Main_v2_2.exportExcelConfig(_dfun); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + // 关闭弹出层 | ||
| 193 | + layer.close(indexLoad); | ||
| 143 | },500); | 194 | },500); |
| 144 | 195 | ||
| 145 | /** | 196 | /** |
| @@ -214,9 +265,10 @@ | @@ -214,9 +265,10 @@ | ||
| 214 | 'gftzsj': BaseFun.formatPairing(gatps.gfupStopTime,gatps.gfdownStopTime),// 高峰停站时间. | 265 | 'gftzsj': BaseFun.formatPairing(gatps.gfupStopTime,gatps.gfdownStopTime),// 高峰停站时间. |
| 215 | 'dgtzsj' : BaseFun.formatPairing(gatps.dgupStopTime,gatps.dgdownStopTime),// 低谷停站时间. | 266 | 'dgtzsj' : BaseFun.formatPairing(gatps.dgupStopTime,gatps.dgdownStopTime),// 低谷停站时间. |
| 216 | 'dgmaxtzsj' : parseInt(gatps.dgmaxtzsj),// 低谷最大停站时间. | 267 | 'dgmaxtzsj' : parseInt(gatps.dgmaxtzsj),// 低谷最大停站时间. |
| 217 | - 'dgmaxfcjx' : parseInt(gatps.dgmaxfcjx),// 低谷最大发车间隙. | 268 | + // 'dgmaxfcjx' : parseInt(gatps.dgmaxfcjx),// 低谷最大发车间隙. |
| 269 | + 'dgmaxfcjx' : 20,// 低谷最大发车间隙. | ||
| 218 | 'map' : gatps, | 270 | 'map' : gatps, |
| 219 | - 'zzsj':gatps.zzsj,// 周转时间. | 271 | + 'zzsj':gatps.zzsj// 周转时间. |
| 220 | }; | 272 | }; |
| 221 | } | 273 | } |
| 222 | 274 |
src/main/resources/static/pages/base/timesmodel/js/systemTools.js
| @@ -13,8 +13,7 @@ $('.recover').on('click',function() { | @@ -13,8 +13,7 @@ $('.recover').on('click',function() { | ||
| 13 | echartsDrawGTT.set_keyIndex(++_keyIndex); | 13 | echartsDrawGTT.set_keyIndex(++_keyIndex); |
| 14 | var historyData = echartsDrawGTT.getHistoryData(); | 14 | var historyData = echartsDrawGTT.getHistoryData(); |
| 15 | var data = $.extend(true, [], data, historyData[_keyIndex]); | 15 | var data = $.extend(true, [], data, historyData[_keyIndex]); |
| 16 | - echartsDrawGTT.init(data,false,false); | ||
| 17 | - echartsDrawGTT.refreshDrag(); | 16 | + echartsDrawGTT.init(data,false,false,false); |
| 18 | layer.msg('恢复到操作记录的【第'+(_keyIndex+1)+'步】了!'); | 17 | layer.msg('恢复到操作记录的【第'+(_keyIndex+1)+'步】了!'); |
| 19 | } | 18 | } |
| 20 | }); | 19 | }); |
| @@ -33,8 +32,7 @@ $(".revoke").on("click",function(){ | @@ -33,8 +32,7 @@ $(".revoke").on("click",function(){ | ||
| 33 | echartsDrawGTT.set_keyIndex(--_keyIndex); | 32 | echartsDrawGTT.set_keyIndex(--_keyIndex); |
| 34 | var historyData = echartsDrawGTT.getHistoryData(); | 33 | var historyData = echartsDrawGTT.getHistoryData(); |
| 35 | var data = $.extend(true, [], data, historyData[_keyIndex]); | 34 | var data = $.extend(true, [], data, historyData[_keyIndex]); |
| 36 | - echartsDrawGTT.init(data,false,false); | ||
| 37 | - echartsDrawGTT.refreshDrag(); | 35 | + echartsDrawGTT.init(data,false,false,false); |
| 38 | layer.msg('撤销到操作记录的【第'+(_keyIndex+1)+'步】了!'); | 36 | layer.msg('撤销到操作记录的【第'+(_keyIndex+1)+'步】了!'); |
| 39 | } | 37 | } |
| 40 | }); | 38 | }); |
| @@ -101,8 +99,7 @@ $('#bcAdjustListSubmit').on('click',function() { | @@ -101,8 +99,7 @@ $('#bcAdjustListSubmit').on('click',function() { | ||
| 101 | data[bcAdjustList[i]].value[0] = lpName; | 99 | data[bcAdjustList[i]].value[0] = lpName; |
| 102 | data[bcAdjustList[i]].value[4] = lpDataCount[lpName][2]; | 100 | data[bcAdjustList[i]].value[4] = lpDataCount[lpName][2]; |
| 103 | } | 101 | } |
| 104 | - echartsDrawGTT.init(data,false,true); | ||
| 105 | - echartsDrawGTT.refreshDrag(); | 102 | + echartsDrawGTT.init(data,false,true,false); |
| 106 | } else | 103 | } else |
| 107 | layer.msg('没有找到目标路牌,请重新选择!'); | 104 | layer.msg('没有找到目标路牌,请重新选择!'); |
| 108 | $('.bc-adjust-list').addClass('hidden'); | 105 | $('.bc-adjust-list').addClass('hidden'); |
| @@ -115,8 +112,8 @@ $('#bcAdjustListSubmit').on('click',function() { | @@ -115,8 +112,8 @@ $('#bcAdjustListSubmit').on('click',function() { | ||
| 115 | /* 右击菜单事件 | 112 | /* 右击菜单事件 |
| 116 | * 1.修改 update | 113 | * 1.修改 update |
| 117 | * 2.删除 delete | 114 | * 2.删除 delete |
| 118 | -* 3.设为上行 setUp | ||
| 119 | -* 4.设为下行 setDown | 115 | +* 3.班次切换上下行 dropdownMenuSwitchUpDown |
| 116 | +* 4.路牌切换上下行 dropdownMenuLpSwitchUpDown | ||
| 120 | * 5.设为正常 setNormal | 117 | * 5.设为正常 setNormal |
| 121 | * 6.设为区间 setRegion | 118 | * 6.设为区间 setRegion |
| 122 | * 7.设为分班 setFb | 119 | * 7.设为分班 setFb |
| @@ -148,13 +145,16 @@ function dropdownMenuDelete(dataIndex) { | @@ -148,13 +145,16 @@ function dropdownMenuDelete(dataIndex) { | ||
| 148 | // 关闭弹出层. | 145 | // 关闭弹出层. |
| 149 | layer.closeAll(); | 146 | layer.closeAll(); |
| 150 | data.splice(dataIndex,1); | 147 | data.splice(dataIndex,1); |
| 151 | - echartsDrawGTT.init(data,false,true); | ||
| 152 | - echartsDrawGTT.refreshDrag(); | 148 | + $.each(data, function () { |
| 149 | + if(bc.value[0] == this.value[0] && bc.value[7] < this.value[7]) | ||
| 150 | + this.value[7] -= 1; | ||
| 151 | + }); | ||
| 152 | + echartsDrawGTT.init(data,false,true,false); | ||
| 153 | layer.msg('删除成功!'); | 153 | layer.msg('删除成功!'); |
| 154 | }); | 154 | }); |
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| 157 | -// 切换上下行 | 157 | +// 班次切换上下行 |
| 158 | function dropdownMenuSwitchUpDown(dataIndex) { | 158 | function dropdownMenuSwitchUpDown(dataIndex) { |
| 159 | // 获取当前操作步数 | 159 | // 获取当前操作步数 |
| 160 | var _keyIndex = echartsDrawGTT.get_keyIndex(), | 160 | var _keyIndex = echartsDrawGTT.get_keyIndex(), |
| @@ -180,9 +180,17 @@ function dropdownMenuSwitchUpDown(dataIndex) { | @@ -180,9 +180,17 @@ function dropdownMenuSwitchUpDown(dataIndex) { | ||
| 180 | data[dataIndex].value[3] = parseInt(dataMap.map.downInTimer)*60000; | 180 | data[dataIndex].value[3] = parseInt(dataMap.map.downInTimer)*60000; |
| 181 | data[dataIndex].value[2] = data[dataIndex].value[1] + data[dataIndex].value[3]; | 181 | data[dataIndex].value[2] = data[dataIndex].value[1] + data[dataIndex].value[3]; |
| 182 | } | 182 | } |
| 183 | - echartsDrawGTT.init(data,false,true); | ||
| 184 | - echartsDrawGTT.refreshDrag(); | ||
| 185 | - layer.msg('设置为上行成功!'); | 183 | + if(data[dataIndex].value[3] <= 0){ |
| 184 | + var bc = data[dataIndex]; | ||
| 185 | + data.splice(dataIndex,1); | ||
| 186 | + $.each(data, function () { | ||
| 187 | + if(bc.value[0] == this.value[0] && bc.value[7] < this.value[7]) | ||
| 188 | + this.value[7] -= 1; | ||
| 189 | + }); | ||
| 190 | + layer.msg('班次切换上下行成功,切换后班次运送时间为0分钟,无意义所以删除改班次!',{time: 8000}); | ||
| 191 | + } else | ||
| 192 | + layer.msg('班次切换上下行成功!'); | ||
| 193 | + echartsDrawGTT.init(data,false,true,false); | ||
| 186 | } | 194 | } |
| 187 | // 路牌切换上下行 | 195 | // 路牌切换上下行 |
| 188 | function dropdownMenuLpSwitchUpDown(dataIndex) { | 196 | function dropdownMenuLpSwitchUpDown(dataIndex) { |
| @@ -211,10 +219,16 @@ function dropdownMenuLpSwitchUpDown(dataIndex) { | @@ -211,10 +219,16 @@ function dropdownMenuLpSwitchUpDown(dataIndex) { | ||
| 211 | data[i].value[3] = parseInt(dataMap.map.downInTimer)*60000; | 219 | data[i].value[3] = parseInt(dataMap.map.downInTimer)*60000; |
| 212 | data[i].value[2] = data[i].value[1] + data[i].value[3]; | 220 | data[i].value[2] = data[i].value[1] + data[i].value[3]; |
| 213 | } | 221 | } |
| 222 | + if(data[i].value[3] <= 0){ | ||
| 223 | + data.splice(i,1); | ||
| 224 | + $.each(data, function () { | ||
| 225 | + if(data[i].value[0] == this.value[0] && data[i].value[7] < this.value[7]) | ||
| 226 | + this.value[7] -= 1; | ||
| 227 | + }); | ||
| 228 | + } | ||
| 214 | } | 229 | } |
| 215 | } | 230 | } |
| 216 | - echartsDrawGTT.init(data,false,true); | ||
| 217 | - echartsDrawGTT.refreshDrag(); | 231 | + echartsDrawGTT.init(data,false,true,false); |
| 218 | layer.msg('路牌切换上下行成功!'); | 232 | layer.msg('路牌切换上下行成功!'); |
| 219 | } | 233 | } |
| 220 | // 设为正常 | 234 | // 设为正常 |
| @@ -226,11 +240,7 @@ function dropdownMenuSetNormal(dataIndex) { | @@ -226,11 +240,7 @@ function dropdownMenuSetNormal(dataIndex) { | ||
| 226 | 240 | ||
| 227 | if(!isType(data[dataIndex].value[6],'设置为正常班次','normal','正常班次')) { | 241 | if(!isType(data[dataIndex].value[6],'设置为正常班次','normal','正常班次')) { |
| 228 | data[dataIndex].value[6] = 'normal'; | 242 | data[dataIndex].value[6] = 'normal'; |
| 229 | - historyData.push(data); | ||
| 230 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 231 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 232 | - echartsDrawGTT.refreshDrag(); | ||
| 233 | - echartsDrawGTT.refreshUpDownData(); | 243 | + echartsDrawGTT.init(data,false,true,false); |
| 234 | layer.msg('设置为正常成功!'); | 244 | layer.msg('设置为正常成功!'); |
| 235 | } | 245 | } |
| 236 | } | 246 | } |
| @@ -242,11 +252,7 @@ function dropdownMenuSetRegion(dataIndex) { | @@ -242,11 +252,7 @@ function dropdownMenuSetRegion(dataIndex) { | ||
| 242 | data = $.extend(true, [], data, historyData[_keyIndex]); | 252 | data = $.extend(true, [], data, historyData[_keyIndex]); |
| 243 | if(!isType(data[dataIndex].value[6],'设置为区间班次','region','区间班次')) { | 253 | if(!isType(data[dataIndex].value[6],'设置为区间班次','region','区间班次')) { |
| 244 | data[dataIndex].value[6] = 'region'; | 254 | data[dataIndex].value[6] = 'region'; |
| 245 | - historyData.push(data); | ||
| 246 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 247 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 248 | - echartsDrawGTT.refreshDrag(); | ||
| 249 | - echartsDrawGTT.refreshUpDownData(); | 255 | + echartsDrawGTT.init(data,false,true,false); |
| 250 | layer.msg('设置为区间成功!'); | 256 | layer.msg('设置为区间成功!'); |
| 251 | } | 257 | } |
| 252 | } | 258 | } |
| @@ -258,11 +264,7 @@ function dropdownMenuSetFb(dataIndex) { | @@ -258,11 +264,7 @@ function dropdownMenuSetFb(dataIndex) { | ||
| 258 | data = $.extend(true, [], data, historyData[_keyIndex]); | 264 | data = $.extend(true, [], data, historyData[_keyIndex]); |
| 259 | if(!isType(data[dataIndex].value[6],'设置为分班班次') && !isType(data[dataIndex].value[16],'设置为分班班次',1,'分班班次')) { | 265 | if(!isType(data[dataIndex].value[6],'设置为分班班次') && !isType(data[dataIndex].value[16],'设置为分班班次',1,'分班班次')) { |
| 260 | data[dataIndex].value[16] = 1; | 266 | data[dataIndex].value[16] = 1; |
| 261 | - historyData.push(data); | ||
| 262 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 263 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 264 | - echartsDrawGTT.refreshDrag(); | ||
| 265 | - echartsDrawGTT.refreshUpDownData(); | 267 | + echartsDrawGTT.init(data,false,true,false); |
| 266 | layer.msg('设置为分班成功!'); | 268 | layer.msg('设置为分班成功!'); |
| 267 | } | 269 | } |
| 268 | } | 270 | } |
| @@ -274,11 +276,7 @@ function dropdownMenuSetNoFb(dataIndex) { | @@ -274,11 +276,7 @@ function dropdownMenuSetNoFb(dataIndex) { | ||
| 274 | data = $.extend(true, [], data, historyData[_keyIndex]); | 276 | data = $.extend(true, [], data, historyData[_keyIndex]); |
| 275 | if(!isType(data[dataIndex].value[6],'取消分班') && !isType(data[dataIndex].value[16],0,'不是分班班次')) { | 277 | if(!isType(data[dataIndex].value[6],'取消分班') && !isType(data[dataIndex].value[16],0,'不是分班班次')) { |
| 276 | data[dataIndex].value[16] = 0; | 278 | data[dataIndex].value[16] = 0; |
| 277 | - historyData.push(data); | ||
| 278 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 279 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 280 | - echartsDrawGTT.refreshDrag(); | ||
| 281 | - echartsDrawGTT.refreshUpDownData(); | 279 | + echartsDrawGTT.init(data,false,true,false); |
| 282 | layer.msg('取消分班成功!'); | 280 | layer.msg('取消分班成功!'); |
| 283 | } | 281 | } |
| 284 | } | 282 | } |
| @@ -290,11 +288,7 @@ function dropdownMenuSetVenting(dataIndex) { | @@ -290,11 +288,7 @@ function dropdownMenuSetVenting(dataIndex) { | ||
| 290 | data = $.extend(true, [], data, historyData[_keyIndex]); | 288 | data = $.extend(true, [], data, historyData[_keyIndex]); |
| 291 | if(!isType(data[dataIndex].value[6],'设置为直放班次','venting','直放班次')) { | 289 | if(!isType(data[dataIndex].value[6],'设置为直放班次','venting','直放班次')) { |
| 292 | data[dataIndex].value[6] = 'venting'; | 290 | data[dataIndex].value[6] = 'venting'; |
| 293 | - historyData.push(data); | ||
| 294 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 295 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 296 | - echartsDrawGTT.refreshDrag(); | ||
| 297 | - echartsDrawGTT.refreshUpDownData(); | 291 | + echartsDrawGTT.init(data,false,true,false); |
| 298 | layer.msg('设置为直放成功!'); | 292 | layer.msg('设置为直放成功!'); |
| 299 | } | 293 | } |
| 300 | } | 294 | } |
| @@ -306,11 +300,7 @@ function dropdownMenuSetMajor(dataIndex) { | @@ -306,11 +300,7 @@ function dropdownMenuSetMajor(dataIndex) { | ||
| 306 | data = $.extend(true, [], data, historyData[_keyIndex]); | 300 | data = $.extend(true, [], data, historyData[_keyIndex]); |
| 307 | if(!isType(data[dataIndex].value[6],'设置为放站班次','major','放站班次')){ | 301 | if(!isType(data[dataIndex].value[6],'设置为放站班次','major','放站班次')){ |
| 308 | data[dataIndex].value[6] = 'major' ; | 302 | data[dataIndex].value[6] = 'major' ; |
| 309 | - historyData.push(data); | ||
| 310 | - echartsDrawGTT.set_keyIndex(++_keyIndex); | ||
| 311 | - echartsDrawGTT.setHistoryData(historyData); | ||
| 312 | - echartsDrawGTT.refreshDrag(); | ||
| 313 | - echartsDrawGTT.refreshUpDownData(); | 303 | + echartsDrawGTT.init(data,false,true,false); |
| 314 | layer.msg('设置为放站成功!'); | 304 | layer.msg('设置为放站成功!'); |
| 315 | } | 305 | } |
| 316 | } | 306 | } |
| @@ -460,6 +450,6 @@ $('.parambtn').on('click', function() { | @@ -460,6 +450,6 @@ $('.parambtn').on('click', function() { | ||
| 460 | $.get('/pages/base/timesmodel/paramadd.html', function(m){ | 450 | $.get('/pages/base/timesmodel/paramadd.html', function(m){ |
| 461 | $(pjaxContainer).append(m); | 451 | $(pjaxContainer).append(m); |
| 462 | // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。 | 452 | // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。 |
| 463 | - $('#paramadd_mobal').trigger('paramAddMobal.show', [Main_v2, Main_v2_2, InternalScheduleObj_v2_2]); | 453 | + $('#paramadd_mobal').trigger('paramAddMobal.show', Main_v2); |
| 464 | }); | 454 | }); |
| 465 | }); | 455 | }); |
| 466 | \ No newline at end of file | 456 | \ No newline at end of file |
src/main/resources/static/pages/base/timesmodel/js/v1/AdjustTrip.js
| @@ -15,26 +15,47 @@ | @@ -15,26 +15,47 @@ | ||
| 15 | */ | 15 | */ |
| 16 | var AdjustTrip = function () { | 16 | var AdjustTrip = function () { |
| 17 | var departureClearanceAdjust = function (bcList, dataMap) { | 17 | var departureClearanceAdjust = function (bcList, dataMap) { |
| 18 | - var upBc = new Array(), downBc = new Array(); | ||
| 19 | - // 取出上下行班次,并按发车时间排序 | ||
| 20 | - $.each(bcList, function () { | ||
| 21 | - if(this.bcType == "normal"){ | ||
| 22 | - if(this.xlDir == "relationshipGraph-up") | ||
| 23 | - upBc.push(this); | ||
| 24 | - if(this.xlDir == "relationshipGraph-down") | ||
| 25 | - downBc.push(this); | 18 | + var upDownbc = bcFun.getUpAndDownBc(bcList, dataMap); |
| 19 | + | ||
| 20 | + // 升序排序 | ||
| 21 | + // upDownbc[0].sort(function(a,b){return DateTimeTool.getDateTime(a.fcsj)-DateTimeTool.getDateTime(b.fcsj)}); | ||
| 22 | + // upDownbc[1].sort(function(a,b){return DateTimeTool.getDateTime(a.fcsj)-DateTimeTool.getDateTime(b.fcsj)}); | ||
| 23 | + for(var i=1; i<20; i++) { | ||
| 24 | + if(i%2 == 0) { | ||
| 25 | + calculate(upDownbc[1], bcList, dataMap, 5); | ||
| 26 | + calculate(upDownbc[0], bcList, dataMap, 5); | ||
| 27 | + } else { | ||
| 28 | + calculate(upDownbc[0], bcList, dataMap, 5); | ||
| 29 | + calculate(upDownbc[1], bcList, dataMap, 5); | ||
| 30 | + | ||
| 26 | } | 31 | } |
| 27 | - }); | ||
| 28 | - // upBc.sort(function(a,b){return a.fcint-b.fcint}); | ||
| 29 | - // downBc.sort(function(a,b){return a.fcint-b.fcint}); | ||
| 30 | - calculate(upBc, bcList, dataMap, 11); | ||
| 31 | - calculate(downBc, bcList, dataMap, 11); | 32 | + } |
| 33 | + for(var i=1; i<20; i++) { | ||
| 34 | + if(i%2 == 0) { | ||
| 35 | + calculateReverse(upDownbc[1], bcList, dataMap, 5); | ||
| 36 | + calculateReverse(upDownbc[0], bcList, dataMap, 5); | ||
| 37 | + } else { | ||
| 38 | + calculateReverse(upDownbc[0], bcList, dataMap, 5); | ||
| 39 | + calculateReverse(upDownbc[1], bcList, dataMap, 5); | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + for(var i=1; i<10; i++) { | ||
| 44 | + if(i%2 == 0) { | ||
| 45 | + calculate(upDownbc[1], bcList, dataMap, 5); | ||
| 46 | + calculate(upDownbc[0], bcList, dataMap, 5); | ||
| 47 | + } else { | ||
| 48 | + calculate(upDownbc[0], bcList, dataMap, 5); | ||
| 49 | + calculate(upDownbc[1], bcList, dataMap, 5); | ||
| 50 | + | ||
| 51 | + } | ||
| 52 | + } | ||
| 32 | }; | 53 | }; |
| 33 | 54 | ||
| 34 | var iBcCountOfGroup = 3; // 3个班次一次参与计算 | 55 | var iBcCountOfGroup = 3; // 3个班次一次参与计算 |
| 35 | var dirBcOfGroup = []; | 56 | var dirBcOfGroup = []; |
| 36 | var dirBcIntervalOfGroup = []; // 班次间隔列表,3个班次,2个间隔 | 57 | var dirBcIntervalOfGroup = []; // 班次间隔列表,3个班次,2个间隔 |
| 37 | - var oBcFcTime; // 班次发车时间 | 58 | + var oBcFcTime = null; // 班次发车时间 |
| 38 | /** | 59 | /** |
| 39 | * 平衡车距内部方法。 | 60 | * 平衡车距内部方法。 |
| 40 | * @param dirBc {array} 单方向班次列表 | 61 | * @param dirBc {array} 单方向班次列表 |
| @@ -46,19 +67,20 @@ var AdjustTrip = function () { | @@ -46,19 +67,20 @@ var AdjustTrip = function () { | ||
| 46 | var calculate = function (dirBc, bcList, dataMap, iFre) { | 67 | var calculate = function (dirBc, bcList, dataMap, iFre) { |
| 47 | if(iFre > 0){ | 68 | if(iFre > 0){ |
| 48 | // 升序排序 | 69 | // 升序排序 |
| 49 | - dirBc.sort(function(a,b){return a.fcint-b.fcint}); | 70 | + dirBc.sort(function(a,b){return DateTimeTool.getDateTime(a.fcsj)-DateTimeTool.getDateTime(b.fcsj)}); |
| 50 | 71 | ||
| 51 | for (var i = 0; i <= dirBc.length; i++) { | 72 | for (var i = 0; i <= dirBc.length; i++) { |
| 52 | // 获取班次列表 | 73 | // 获取班次列表 |
| 53 | _calcuBcGroup(i, dirBc); | 74 | _calcuBcGroup(i, dirBc); |
| 54 | 75 | ||
| 55 | - if (dirBcOfGroup.length > 0) { | 76 | + if (dirBcOfGroup.length > 2) { |
| 56 | // 获取中间预调整的班次时间 | 77 | // 获取中间预调整的班次时间 |
| 57 | - oBcFcTime = dirBcOfGroup[1].fcint; | 78 | + oBcFcTime = dirBcOfGroup[1].fcsj; |
| 58 | // 获取发车间隙:用发车时间判断 | 79 | // 获取发车间隙:用发车时间判断 |
| 59 | - var fcjx = dataMap.fcjx[judgmentTimeQuantum(oBcFcTime)]; | 80 | + var fcjx = dataMap.fcjx[DateTimeTool.judgmentTimeQuantum(DateTimeTool.getDateTime(oBcFcTime))]; |
| 60 | // 发车时间所在时间段 | 81 | // 发车时间所在时间段 |
| 61 | - // var timeQuantum = judgmentTimeQuantum(oBcFcTime); | 82 | + // var timeQuantum = DateTimeTool.judgmentTimeQuantum(oBcFcTime); |
| 83 | + | ||
| 62 | if (dirBcIntervalOfGroup[0] < fcjx.min) { | 84 | if (dirBcIntervalOfGroup[0] < fcjx.min) { |
| 63 | // 发车间隙调整为高峰发车间隙 +时间 | 85 | // 发车间隙调整为高峰发车间隙 +时间 |
| 64 | if (_isModifyBcFcsj( | 86 | if (_isModifyBcFcsj( |
| @@ -73,6 +95,21 @@ var AdjustTrip = function () { | @@ -73,6 +95,21 @@ var AdjustTrip = function () { | ||
| 73 | dataMap, | 95 | dataMap, |
| 74 | 1 | 96 | 1 |
| 75 | ); | 97 | ); |
| 98 | + } else { | ||
| 99 | + // 最后一个班次不能为末班车 中间班次不能调整,就调整后一个的班次 | ||
| 100 | + if (!bcFun.lpBcIsHaveLast(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 101 | + bcList, | ||
| 102 | + dirBcOfGroup[2], | ||
| 103 | + dataMap, | ||
| 104 | + -1 | ||
| 105 | + )) { | ||
| 106 | + _modifyFcsj( | ||
| 107 | + bcList, | ||
| 108 | + dirBcOfGroup[2], | ||
| 109 | + dataMap, | ||
| 110 | + -1 | ||
| 111 | + ); | ||
| 112 | + } | ||
| 76 | } | 113 | } |
| 77 | } else if (dirBcIntervalOfGroup[0] > fcjx.max) { | 114 | } else if (dirBcIntervalOfGroup[0] > fcjx.max) { |
| 78 | // 发车间隙调整为高峰发车间隙 -时间 | 115 | // 发车间隙调整为高峰发车间隙 -时间 |
| @@ -81,17 +118,35 @@ var AdjustTrip = function () { | @@ -81,17 +118,35 @@ var AdjustTrip = function () { | ||
| 81 | dirBcOfGroup[1], | 118 | dirBcOfGroup[1], |
| 82 | dataMap, | 119 | dataMap, |
| 83 | -1 | 120 | -1 |
| 121 | + // fcjx.max - dirBcIntervalOfGroup[0] | ||
| 84 | )) { | 122 | )) { |
| 85 | _modifyFcsj( | 123 | _modifyFcsj( |
| 86 | bcList, | 124 | bcList, |
| 87 | dirBcOfGroup[1], | 125 | dirBcOfGroup[1], |
| 88 | dataMap, | 126 | dataMap, |
| 89 | -1 | 127 | -1 |
| 128 | + // fcjx.max - dirBcIntervalOfGroup[0] | ||
| 90 | ); | 129 | ); |
| 130 | + } else { | ||
| 131 | + // 下一个班次不能为首班车 中间班次不能调整,就调整下一个的班次 | ||
| 132 | + if (!bcFun.lpBcIsHaveLast(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 133 | + bcList, | ||
| 134 | + dirBcOfGroup[2], | ||
| 135 | + dataMap, | ||
| 136 | + fcjx.max - dirBcIntervalOfGroup[0] | ||
| 137 | + )) { | ||
| 138 | + _modifyFcsj( | ||
| 139 | + bcList, | ||
| 140 | + dirBcOfGroup[2], | ||
| 141 | + dataMap, | ||
| 142 | + fcjx.max - dirBcIntervalOfGroup[0] | ||
| 143 | + ); | ||
| 144 | + } | ||
| 91 | } | 145 | } |
| 92 | } else { | 146 | } else { |
| 93 | // -1或+1分钟 | 147 | // -1或+1分钟 |
| 94 | if (Math.abs(dirBcIntervalOfGroup[0] - dirBcIntervalOfGroup[1]) <= 1) { | 148 | if (Math.abs(dirBcIntervalOfGroup[0] - dirBcIntervalOfGroup[1]) <= 1) { |
| 149 | + continue; | ||
| 95 | // 两个间隔相差1分钟,不处理 | 150 | // 两个间隔相差1分钟,不处理 |
| 96 | } else if (dirBcIntervalOfGroup[0] > dirBcIntervalOfGroup[1]) { | 151 | } else if (dirBcIntervalOfGroup[0] > dirBcIntervalOfGroup[1]) { |
| 97 | if (_isModifyBcFcsj( | 152 | if (_isModifyBcFcsj( |
| @@ -106,6 +161,21 @@ var AdjustTrip = function () { | @@ -106,6 +161,21 @@ var AdjustTrip = function () { | ||
| 106 | dataMap, | 161 | dataMap, |
| 107 | -1 | 162 | -1 |
| 108 | ); | 163 | ); |
| 164 | + } else { | ||
| 165 | + // 前一个班次不能为首班车 中间班次不能调整,就调整前一个的班次 | ||
| 166 | + if (!bcFun.lpBcIsHaveFirst(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 167 | + bcList, | ||
| 168 | + dirBcOfGroup[0], | ||
| 169 | + dataMap, | ||
| 170 | + 1 | ||
| 171 | + )) { | ||
| 172 | + _modifyFcsj( | ||
| 173 | + bcList, | ||
| 174 | + dirBcOfGroup[0], | ||
| 175 | + dataMap, | ||
| 176 | + 1 | ||
| 177 | + ); | ||
| 178 | + } | ||
| 109 | } | 179 | } |
| 110 | } else { | 180 | } else { |
| 111 | if (_isModifyBcFcsj( | 181 | if (_isModifyBcFcsj( |
| @@ -120,6 +190,21 @@ var AdjustTrip = function () { | @@ -120,6 +190,21 @@ var AdjustTrip = function () { | ||
| 120 | dataMap, | 190 | dataMap, |
| 121 | 1 | 191 | 1 |
| 122 | ); | 192 | ); |
| 193 | + } else { | ||
| 194 | + // 最后一个班次不能为末班车 中间班次不能调整,就调整后一个的班次 | ||
| 195 | + if (!bcFun.lpBcIsHaveLast(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 196 | + bcList, | ||
| 197 | + dirBcOfGroup[2], | ||
| 198 | + dataMap, | ||
| 199 | + -1 | ||
| 200 | + )) { | ||
| 201 | + _modifyFcsj( | ||
| 202 | + bcList, | ||
| 203 | + dirBcOfGroup[2], | ||
| 204 | + dataMap, | ||
| 205 | + -1 | ||
| 206 | + ); | ||
| 207 | + } | ||
| 123 | } | 208 | } |
| 124 | } | 209 | } |
| 125 | } | 210 | } |
| @@ -140,7 +225,10 @@ var AdjustTrip = function () { | @@ -140,7 +225,10 @@ var AdjustTrip = function () { | ||
| 140 | dirBcOfGroup = []; | 225 | dirBcOfGroup = []; |
| 141 | dirBcIntervalOfGroup = []; | 226 | dirBcIntervalOfGroup = []; |
| 142 | for (var i = iStartIndex; i < iStartIndex + iBcCountOfGroup && iStartIndex < dirBc.length - 2; i++) { | 227 | for (var i = iStartIndex; i < iStartIndex + iBcCountOfGroup && iStartIndex < dirBc.length - 2; i++) { |
| 143 | - dirBcOfGroup.push(dirBc[i]); | 228 | + if(dirBc[i].bcType == 'cf') |
| 229 | + iStartIndex++; | ||
| 230 | + else | ||
| 231 | + dirBcOfGroup.push(dirBc[i]); | ||
| 144 | } | 232 | } |
| 145 | for (var j = 0; j < dirBcOfGroup.length - 1; j++) { | 233 | for (var j = 0; j < dirBcOfGroup.length - 1; j++) { |
| 146 | dirBcIntervalOfGroup.push((DateTimeTool.getDateTime(dirBcOfGroup[j + 1].fcsj).getTime() - DateTimeTool.getDateTime(dirBcOfGroup[j].fcsj).getTime())/60000); | 234 | dirBcIntervalOfGroup.push((DateTimeTool.getDateTime(dirBcOfGroup[j + 1].fcsj).getTime() - DateTimeTool.getDateTime(dirBcOfGroup[j].fcsj).getTime())/60000); |
| @@ -149,6 +237,201 @@ var AdjustTrip = function () { | @@ -149,6 +237,201 @@ var AdjustTrip = function () { | ||
| 149 | }; | 237 | }; |
| 150 | 238 | ||
| 151 | /** | 239 | /** |
| 240 | + * 平衡车距内部方法(反方向)。 | ||
| 241 | + * @param dirBc {array} 单方向班次列表 | ||
| 242 | + * @param bcList {array} 所有班次列表对象 | ||
| 243 | + * @param dataMap {array} 参数对象 | ||
| 244 | + * @param iFre {int} 递归次数 | ||
| 245 | + * @private | ||
| 246 | + */ | ||
| 247 | + var calculateReverse = function (dirBc, bcList, dataMap, iFre) { | ||
| 248 | + if(iFre > 0){ | ||
| 249 | + // 降序排序 | ||
| 250 | + dirBc.sort(function(a,b){return DateTimeTool.getDateTime(b.fcsj)-DateTimeTool.getDateTime(a.fcsj)}); | ||
| 251 | + | ||
| 252 | + for (var i = 0; i <= dirBc.length; i++) { | ||
| 253 | + // 获取班次列表 | ||
| 254 | + _calcuReverseBcGroup(i, dirBc); | ||
| 255 | + | ||
| 256 | + if (dirBcOfGroup.length > 2) { | ||
| 257 | + // 获取中间预调整的班次时间 | ||
| 258 | + oBcFcTime = dirBcOfGroup[1].fcsj; | ||
| 259 | + // 获取发车间隙:用发车时间判断 | ||
| 260 | + var fcjx = dataMap.fcjx[DateTimeTool.judgmentTimeQuantum(DateTimeTool.getDateTime(oBcFcTime))]; | ||
| 261 | + // 发车时间所在时间段 | ||
| 262 | + // var timeQuantum = DateTimeTool.judgmentTimeQuantum(oBcFcTime); | ||
| 263 | + | ||
| 264 | + if (dirBcIntervalOfGroup[0] < fcjx.min) { | ||
| 265 | + // 发车间隙调整为高峰发车间隙 +时间 | ||
| 266 | + if (_isModifyBcFcsj( | ||
| 267 | + bcList, | ||
| 268 | + dirBcOfGroup[1], | ||
| 269 | + dataMap, | ||
| 270 | + -1 | ||
| 271 | + )) { | ||
| 272 | + _modifyFcsj( | ||
| 273 | + bcList, | ||
| 274 | + dirBcOfGroup[1], | ||
| 275 | + dataMap, | ||
| 276 | + -1 | ||
| 277 | + ); | ||
| 278 | + } else { | ||
| 279 | + // 最后一个班次不能为末班车 中间班次不能调整,就调整后一个的班次 | ||
| 280 | + if (!bcFun.lpBcIsHaveFirst(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 281 | + bcList, | ||
| 282 | + dirBcOfGroup[2], | ||
| 283 | + dataMap, | ||
| 284 | + 1 | ||
| 285 | + )) { | ||
| 286 | + _modifyFcsj( | ||
| 287 | + bcList, | ||
| 288 | + dirBcOfGroup[2], | ||
| 289 | + dataMap, | ||
| 290 | + 1 | ||
| 291 | + ); | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + } else if (dirBcIntervalOfGroup[0] > fcjx.max) { | ||
| 295 | + // 发车间隙调整为高峰发车间隙 -时间 | ||
| 296 | + if (_isModifyBcFcsj( | ||
| 297 | + bcList, | ||
| 298 | + dirBcOfGroup[1], | ||
| 299 | + dataMap, | ||
| 300 | + 1 | ||
| 301 | + // fcjx.max - dirBcIntervalOfGroup[0] | ||
| 302 | + )) { | ||
| 303 | + _modifyFcsj( | ||
| 304 | + bcList, | ||
| 305 | + dirBcOfGroup[1], | ||
| 306 | + dataMap, | ||
| 307 | + 1 | ||
| 308 | + // fcjx.max - dirBcIntervalOfGroup[0] | ||
| 309 | + ); | ||
| 310 | + } else { | ||
| 311 | + // 最后一个班次不能为首班车 中间班次不能调整,就调整后一个的班次 | ||
| 312 | + if (!bcFun.lpBcIsHaveFirst(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 313 | + bcList, | ||
| 314 | + dirBcOfGroup[2], | ||
| 315 | + dataMap, | ||
| 316 | + dirBcIntervalOfGroup[0] - fcjx.max | ||
| 317 | + )) { | ||
| 318 | + _modifyFcsj( | ||
| 319 | + bcList, | ||
| 320 | + dirBcOfGroup[2], | ||
| 321 | + dataMap, | ||
| 322 | + dirBcIntervalOfGroup[0] - fcjx.max | ||
| 323 | + ); | ||
| 324 | + } else { | ||
| 325 | + // 前一个班次不能为首班车 中间班次不能调整,就调整前一个的班次 | ||
| 326 | + if (!bcFun.lpBcIsHaveLast(dirBcOfGroup[0]) && _isModifyBcFcsj( | ||
| 327 | + bcList, | ||
| 328 | + dirBcOfGroup[0], | ||
| 329 | + dataMap, | ||
| 330 | + -1 | ||
| 331 | + )) { | ||
| 332 | + _modifyFcsj( | ||
| 333 | + bcList, | ||
| 334 | + dirBcOfGroup[0], | ||
| 335 | + dataMap, | ||
| 336 | + -1 | ||
| 337 | + ); | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + } | ||
| 341 | + } else { | ||
| 342 | + // -1或+1分钟 | ||
| 343 | + if (Math.abs(dirBcIntervalOfGroup[0] - dirBcIntervalOfGroup[1]) <= 1) { | ||
| 344 | + continue; | ||
| 345 | + // 两个间隔相差1分钟,不处理 | ||
| 346 | + } else if (dirBcIntervalOfGroup[0] > dirBcIntervalOfGroup[1]) { | ||
| 347 | + if (_isModifyBcFcsj( | ||
| 348 | + bcList, | ||
| 349 | + dirBcOfGroup[1], | ||
| 350 | + dataMap, | ||
| 351 | + 1 | ||
| 352 | + )) { | ||
| 353 | + _modifyFcsj( | ||
| 354 | + bcList, | ||
| 355 | + dirBcOfGroup[1], | ||
| 356 | + dataMap, | ||
| 357 | + 1 | ||
| 358 | + ); | ||
| 359 | + } else { | ||
| 360 | + // 前一个班次不能为首班车 中间班次不能调整,就调整前一个的班次 | ||
| 361 | + if (!bcFun.lpBcIsHaveLast(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 362 | + bcList, | ||
| 363 | + dirBcOfGroup[0], | ||
| 364 | + dataMap, | ||
| 365 | + -1 | ||
| 366 | + )) { | ||
| 367 | + _modifyFcsj( | ||
| 368 | + bcList, | ||
| 369 | + dirBcOfGroup[0], | ||
| 370 | + dataMap, | ||
| 371 | + -1 | ||
| 372 | + ); | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + } else { | ||
| 376 | + if (_isModifyBcFcsj( | ||
| 377 | + bcList, | ||
| 378 | + dirBcOfGroup[1], | ||
| 379 | + dataMap, | ||
| 380 | + -1 | ||
| 381 | + )) { | ||
| 382 | + _modifyFcsj( | ||
| 383 | + bcList, | ||
| 384 | + dirBcOfGroup[1], | ||
| 385 | + dataMap, | ||
| 386 | + -1 | ||
| 387 | + ); | ||
| 388 | + } else { | ||
| 389 | + // 最后一个班次不能为末班车 中间班次不能调整,就调整后一个的班次 | ||
| 390 | + if (!bcFun.lpBcIsHaveFirst(dirBcOfGroup,dataMap.smbcsjArr) && _isModifyBcFcsj( | ||
| 391 | + bcList, | ||
| 392 | + dirBcOfGroup[2], | ||
| 393 | + dataMap, | ||
| 394 | + 1 | ||
| 395 | + )) { | ||
| 396 | + _modifyFcsj( | ||
| 397 | + bcList, | ||
| 398 | + dirBcOfGroup[2], | ||
| 399 | + dataMap, | ||
| 400 | + 1 | ||
| 401 | + ); | ||
| 402 | + } | ||
| 403 | + } | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + } | ||
| 408 | + // bcFun.deleteNotInRangeBc(dirBc, dataMap.smbcsjArr[].kssj, dataMap.smbcsjArr[].jssj); | ||
| 409 | + // 递归迭代 | ||
| 410 | + calculateReverse(dirBc, bcList, dataMap, iFre - 1); | ||
| 411 | + } | ||
| 412 | + }; | ||
| 413 | + /** | ||
| 414 | + * 按照规则计算班次列表()。 | ||
| 415 | + * @param iStartIndex {int} 开始索引 | ||
| 416 | + * @param dirBc {array} 班次列表 | ||
| 417 | + * @private | ||
| 418 | + */ | ||
| 419 | + var _calcuReverseBcGroup = function(iStartIndex, dirBc) { | ||
| 420 | + dirBcOfGroup = []; | ||
| 421 | + dirBcIntervalOfGroup = []; | ||
| 422 | + for (var i = iStartIndex; i < iStartIndex + iBcCountOfGroup && iStartIndex < dirBc.length - 2; i++) { | ||
| 423 | + if(dirBc[i].bcType == 'cf') | ||
| 424 | + iStartIndex++; | ||
| 425 | + else | ||
| 426 | + dirBcOfGroup.push(dirBc[i]); | ||
| 427 | + } | ||
| 428 | + for (var j = 0; j < dirBcOfGroup.length - 1; j++) { | ||
| 429 | + dirBcIntervalOfGroup.push((DateTimeTool.getDateTime(dirBcOfGroup[j].fcsj).getTime() - DateTimeTool.getDateTime(dirBcOfGroup[j + 1].fcsj).getTime())/60000); | ||
| 430 | + // dirBcIntervalOfGroup.push(Math.round((dirBcOfGroup[j + 1].fcint - dirBcOfGroup[j].fcint)/360000)); | ||
| 431 | + } | ||
| 432 | + }; | ||
| 433 | + | ||
| 434 | + /** | ||
| 152 | * 是否可以调整班次发车时间。 | 435 | * 是否可以调整班次发车时间。 |
| 153 | * @param bcList {InternalLpObj} 所有班次对象 | 436 | * @param bcList {InternalLpObj} 所有班次对象 |
| 154 | * @param oBc {InternalBcObj} 调整班次对象 | 437 | * @param oBc {InternalBcObj} 调整班次对象 |
| @@ -159,19 +442,21 @@ var AdjustTrip = function () { | @@ -159,19 +442,21 @@ var AdjustTrip = function () { | ||
| 159 | // 获取前后班次 | 442 | // 获取前后班次 |
| 160 | var bc = getLpPrevAndNextBc(bcList, oBc), | 443 | var bc = getLpPrevAndNextBc(bcList, oBc), |
| 161 | prevBc = bc[0], | 444 | prevBc = bc[0], |
| 162 | - nextBc = bc[1]; | 445 | + nextBc = bc[1], |
| 446 | + cfBc = bc[2], | ||
| 447 | + cfBcsj = 0; | ||
| 448 | + if(cfBc != null){ | ||
| 449 | + cfBcsj = cfBc.bcsj; | ||
| 450 | + } | ||
| 163 | if (prevBc != null && nextBc != null){ | 451 | if (prevBc != null && nextBc != null){ |
| 164 | - if (prevBc.bcType == 'cf') { // 如果是吃饭班次,不能修改发车时间 | ||
| 165 | - return false; | ||
| 166 | - } | ||
| 167 | // 上一个班次的停站范围, 本班次停站范围, 上一班次停站时间, 本班次停站时间 | 452 | // 上一个班次的停站范围, 本班次停站范围, 上一班次停站时间, 本班次停站时间 |
| 168 | - var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][judgmentTimeQuantum(prevBc.fcint)], | ||
| 169 | - StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(oBc.xlDir)][judgmentTimeQuantum(oBc.fcint)], | 453 | + var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][DateTimeTool.judgmentTimeQuantum(prevBc.fcint)], |
| 454 | + StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(oBc.xlDir)][DateTimeTool.judgmentTimeQuantum(oBc.fcint)], | ||
| 170 | // prevBcStopTime = prevBc.STOPTIME + iStep, | 455 | // prevBcStopTime = prevBc.STOPTIME + iStep, |
| 171 | // BcStopTime = oBc.STOPTIME + iStep; | 456 | // BcStopTime = oBc.STOPTIME + iStep; |
| 172 | // iStep为班次往后移动的时间,调整后的时间 = 停站 - 往后移动的时间 | 457 | // iStep为班次往后移动的时间,调整后的时间 = 停站 - 往后移动的时间 |
| 173 | prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep, | 458 | prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep, |
| 174 | - BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep; | 459 | + BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep - cfBcsj; // 如果有吃饭,则多减掉一个吃饭班次的运行时间 |
| 175 | // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 | 460 | // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 |
| 176 | if (prevBcStopTime >= 0 && BcStopTime >= 0) { | 461 | if (prevBcStopTime >= 0 && BcStopTime >= 0) { |
| 177 | return true; | 462 | return true; |
| @@ -179,9 +464,9 @@ var AdjustTrip = function () { | @@ -179,9 +464,9 @@ var AdjustTrip = function () { | ||
| 179 | return false; | 464 | return false; |
| 180 | } | 465 | } |
| 181 | } else if(prevBc == null && nextBc != null) { | 466 | } else if(prevBc == null && nextBc != null) { |
| 182 | - var StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(nextBc.xlDir)][judgmentTimeQuantum(nextBc.fcint)], | ||
| 183 | - BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep; | ||
| 184 | - // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 TODO:没有判定调整发车时间后会不会不够 | 467 | + var StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(nextBc.xlDir)][DateTimeTool.judgmentTimeQuantum(nextBc.fcint)], |
| 468 | + BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep - cfBcsj; // 如果有吃饭,则多减掉一个吃饭班次的运行时间 | ||
| 469 | + // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 | ||
| 185 | if (BcStopTime >= 0) { | 470 | if (BcStopTime >= 0) { |
| 186 | return true; | 471 | return true; |
| 187 | } else { | 472 | } else { |
| @@ -189,10 +474,7 @@ var AdjustTrip = function () { | @@ -189,10 +474,7 @@ var AdjustTrip = function () { | ||
| 189 | } | 474 | } |
| 190 | // 如果是第一个班次为空 | 475 | // 如果是第一个班次为空 |
| 191 | } else if(prevBc != null && nextBc == null) { | 476 | } else if(prevBc != null && nextBc == null) { |
| 192 | - if (prevBc.bcType == 'cf') { // 如果是吃饭班次,不能修改发车时间 | ||
| 193 | - return false; | ||
| 194 | - } | ||
| 195 | - var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][judgmentTimeQuantum(prevBc.fcint)], | 477 | + var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][DateTimeTool.judgmentTimeQuantum(prevBc.fcint)], |
| 196 | prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep; | 478 | prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep; |
| 197 | // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 | 479 | // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 |
| 198 | if (prevBcStopTime >= 0) { | 480 | if (prevBcStopTime >= 0) { |
| @@ -202,53 +484,6 @@ var AdjustTrip = function () { | @@ -202,53 +484,6 @@ var AdjustTrip = function () { | ||
| 202 | } | 484 | } |
| 203 | } | 485 | } |
| 204 | } | 486 | } |
| 205 | - /*function _isModifyBcFcsj(bcList, oBc, dataMap, iStep) { | ||
| 206 | - // 获取前后班次 | ||
| 207 | - var bc = getLpPrevAndNextBc(bcList, oBc), | ||
| 208 | - prevBc = bc[0], | ||
| 209 | - nextBc = bc[1]; | ||
| 210 | - if (prevBc != null && nextBc != null){ | ||
| 211 | - if (prevBc.bcType == 'cf') { // 如果是吃饭班次,不能修改发车时间 | ||
| 212 | - return false; | ||
| 213 | - } | ||
| 214 | - // 上一个班次的停站范围, 本班次停站范围, 上一班次停站时间, 本班次停站时间 | ||
| 215 | - var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][judgmentTimeQuantum(prevBc.fcint)], | ||
| 216 | - StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(oBc.xlDir)][judgmentTimeQuantum(oBc.fcint)], | ||
| 217 | - // prevBcStopTime = prevBc.STOPTIME + iStep, | ||
| 218 | - // BcStopTime = oBc.STOPTIME + iStep; | ||
| 219 | - // iStep为班次往后移动的时间,调整后的时间 = 停站 - 往后移动的时间 | ||
| 220 | - prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep, | ||
| 221 | - BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep; | ||
| 222 | - // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 | ||
| 223 | - if (prevBcStopTime >= prevStopTimeScope.min && BcStopTime >= StopTimeScope.min) { | ||
| 224 | - return true; | ||
| 225 | - } else { | ||
| 226 | - return false; | ||
| 227 | - } | ||
| 228 | - } else if(prevBc == null && nextBc != null) { | ||
| 229 | - var StopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(nextBc.xlDir)][judgmentTimeQuantum(nextBc.fcint)], | ||
| 230 | - BcStopTime = (DateTimeTool.getDateTime(nextBc.fcsj) - DateTimeTool.getDateTime(oBc.ARRIVALTIME))/60000 - iStep; | ||
| 231 | - // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 TODO:没有判定调整发车时间后会不会不够 | ||
| 232 | - if (BcStopTime >= StopTimeScope.min) { | ||
| 233 | - return true; | ||
| 234 | - } else { | ||
| 235 | - return false; | ||
| 236 | - } | ||
| 237 | - // 如果是第一个班次为空 | ||
| 238 | - } else if(prevBc != null && nextBc == null) { | ||
| 239 | - if (prevBc.bcType == 'cf') { // 如果是吃饭班次,不能修改发车时间 | ||
| 240 | - return false; | ||
| 241 | - } | ||
| 242 | - var prevStopTimeScope = dataMap.tzsj[bcFun.upDownStrConvertNum(prevBc.xlDir)][judgmentTimeQuantum(prevBc.fcint)], | ||
| 243 | - prevBcStopTime = (DateTimeTool.getDateTime(oBc.fcsj) - DateTimeTool.getDateTime(prevBc.ARRIVALTIME))/60000 + iStep; | ||
| 244 | - // 班次移动调整发车间隔时,需要考录的移动班次的前后停站 | ||
| 245 | - if (prevBcStopTime >= prevStopTimeScope.min) { | ||
| 246 | - return true; | ||
| 247 | - } else { | ||
| 248 | - return false; | ||
| 249 | - } | ||
| 250 | - } | ||
| 251 | - }*/ | ||
| 252 | 487 | ||
| 253 | /** | 488 | /** |
| 254 | * 调整发车时间(调整当前班次后,需要处理后续路牌的所有班次)。 | 489 | * 调整发车时间(调整当前班次后,需要处理后续路牌的所有班次)。 |
| @@ -261,19 +496,26 @@ var AdjustTrip = function () { | @@ -261,19 +496,26 @@ var AdjustTrip = function () { | ||
| 261 | function _modifyFcsj(bcList, oBc, dataMap, iMin) { | 496 | function _modifyFcsj(bcList, oBc, dataMap, iMin) { |
| 262 | var bc = getLpPrevAndNextBc(bcList, oBc), | 497 | var bc = getLpPrevAndNextBc(bcList, oBc), |
| 263 | prevBc = bc[0], | 498 | prevBc = bc[0], |
| 264 | - nextBc = bc[1]; | 499 | + nextBc = bc[1], |
| 500 | + cfBc = bc[2]; | ||
| 265 | var fcsj = DateTimeTool.getDateTime(oBc.fcsj); | 501 | var fcsj = DateTimeTool.getDateTime(oBc.fcsj); |
| 266 | fcsj.setMinutes(fcsj.getMinutes() + iMin); | 502 | fcsj.setMinutes(fcsj.getMinutes() + iMin); |
| 267 | $.each(bcList, function () { | 503 | $.each(bcList, function () { |
| 268 | - if(this.lpNo == oBc.lpNo && this.fcno == oBc.fcno){ | 504 | + if(this.lpNo == oBc.lpNo && this.fcno == oBc.fcno && this.bcType != 'cf'){ |
| 269 | var time = new Date(fcsj); | 505 | var time = new Date(fcsj); |
| 270 | - this.ARRIVALTIME = DateTimeTool.getHHmmStr(time.setMinutes(time.getMinutes() + this.bcsj)); | 506 | + time.setMinutes(time.getMinutes() + this.bcsj); |
| 507 | + this.ARRIVALTIME = DateTimeTool.getHHmmStr(time); | ||
| 271 | this.fcsj = DateTimeTool.getHHmmStr(fcsj); | 508 | this.fcsj = DateTimeTool.getHHmmStr(fcsj); |
| 272 | this.fcint = fcsj.getTime(); | 509 | this.fcint = fcsj.getTime(); |
| 273 | - // 前一个班次停站时间 = 原停站时间 - 中间班次移动时间 | ||
| 274 | - this.STOPTIME -= iMin; | 510 | + // 不是分班班次这调整停站 前一个班次停站时间 = 原停站时间 - 中间班次移动时间 |
| 511 | + if(this.isfb == 0) | ||
| 512 | + this.STOPTIME -= iMin; | ||
| 513 | + if(cfBc != null) { | ||
| 514 | + cfBc.fcsj = this.ARRIVALTIME; | ||
| 515 | + cfBc.ARRIVALTIME = DateTimeTool.getHHmmStr(time.setMinutes(time.getMinutes() + cfBc.bcsj)); | ||
| 516 | + } | ||
| 275 | } | 517 | } |
| 276 | - if(prevBc != undefined && prevBc != null && this.lpNo == oBc.lpNo && this.fcno == prevBc.fcno){ | 518 | + if(prevBc != undefined && prevBc != null && this.lpNo == oBc.lpNo && this.fcno == prevBc.fcno && this.isfb == 0){ |
| 277 | // 前一个班次停站时间 = 原停站时间 + 中间班次移动时间 | 519 | // 前一个班次停站时间 = 原停站时间 + 中间班次移动时间 |
| 278 | this.STOPTIME += iMin; | 520 | this.STOPTIME += iMin; |
| 279 | } | 521 | } |
| @@ -283,37 +525,25 @@ var AdjustTrip = function () { | @@ -283,37 +525,25 @@ var AdjustTrip = function () { | ||
| 283 | var getLpPrevAndNextBc = function (bcList, oBc) { | 525 | var getLpPrevAndNextBc = function (bcList, oBc) { |
| 284 | var lpBc = new Array(), | 526 | var lpBc = new Array(), |
| 285 | // 前一个班次 | 527 | // 前一个班次 |
| 286 | - prevBc = null, nextBc = null; | 528 | + prevBc = null, nextBc = null, cfBc = null; |
| 287 | $.each(bcList, function () { | 529 | $.each(bcList, function () { |
| 288 | if(this.lpNo == oBc.lpNo) | 530 | if(this.lpNo == oBc.lpNo) |
| 289 | lpBc.push(this); | 531 | lpBc.push(this); |
| 290 | }); | 532 | }); |
| 291 | - lpBc.sort(function (a,b) {return a.fcint - b.fcint;}); | 533 | + lpBc.sort(function (a,b) {return DateTimeTool.getDateTime(a.fcsj)-DateTimeTool.getDateTime(b.fcsj);}); |
| 292 | for(var n = 0; n < lpBc.length; n++) { | 534 | for(var n = 0; n < lpBc.length; n++) { |
| 293 | if(lpBc[n].fcno == oBc.fcno && n > 0) | 535 | if(lpBc[n].fcno == oBc.fcno && n > 0) |
| 294 | prevBc = lpBc[n-1]; | 536 | prevBc = lpBc[n-1]; |
| 295 | - if(lpBc[n].fcno == oBc.fcno && n < lpBc.length-1) | ||
| 296 | - nextBc = lpBc[n+1]; | 537 | + if(lpBc[n].fcno == oBc.fcno && n < lpBc.length-1){ |
| 538 | + if(lpBc[n+1].bcType == 'cf'){ | ||
| 539 | + nextBc = lpBc[n+2]; | ||
| 540 | + cfBc = lpBc[n+1]; | ||
| 541 | + } else { | ||
| 542 | + nextBc = lpBc[n+1]; | ||
| 543 | + } | ||
| 544 | + } | ||
| 297 | } | 545 | } |
| 298 | - return [prevBc, nextBc]; | ||
| 299 | - }; | ||
| 300 | - // 判断时间在什么时间段段内 | ||
| 301 | - /** | ||
| 302 | - * 判断时间在什么时间段段内 | ||
| 303 | - * @param t 时间 | ||
| 304 | - * @private | ||
| 305 | - */ | ||
| 306 | - var judgmentTimeQuantum = function (t) { | ||
| 307 | - if(t <= DateTimeTool.getDateTime('6:30')) | ||
| 308 | - return 0; | ||
| 309 | - else if(t > DateTimeTool.getDateTime('6:30') && t <= DateTimeTool.getDateTime('8:30')) | ||
| 310 | - return 1; | ||
| 311 | - else if(t > DateTimeTool.getDateTime('8:30') && t <= DateTimeTool.getDateTime('16:00')) | ||
| 312 | - return 2; | ||
| 313 | - else if(t > DateTimeTool.getDateTime('16:00') && t <= DateTimeTool.getDateTime('18:00')) | ||
| 314 | - return 3; | ||
| 315 | - else if(t > DateTimeTool.getDateTime('18:00')) | ||
| 316 | - return 4; | 546 | + return [prevBc, nextBc, cfBc]; |
| 317 | }; | 547 | }; |
| 318 | return { | 548 | return { |
| 319 | departureClearanceAdjust : departureClearanceAdjust | 549 | departureClearanceAdjust : departureClearanceAdjust |
src/main/resources/static/pages/base/timesmodel/js/v1/bcFun.js
| @@ -30,6 +30,7 @@ var bcFun = function() { | @@ -30,6 +30,7 @@ var bcFun = function() { | ||
| 30 | obj.bcType = type; | 30 | obj.bcType = type; |
| 31 | obj.xlDir = dir; | 31 | obj.xlDir = dir; |
| 32 | obj.fcno = xh; | 32 | obj.fcno = xh; |
| 33 | + obj.qs = xh; | ||
| 33 | obj.jhlc = jhlc;// 计划里程 | 34 | obj.jhlc = jhlc;// 计划里程 |
| 34 | obj.tcc = gatps.tcc_id;// 停车场id | 35 | obj.tcc = gatps.tcc_id;// 停车场id |
| 35 | obj.ttinfo = gatps.skbName;// 时刻表id | 36 | obj.ttinfo = gatps.skbName;// 时刻表id |
| @@ -125,6 +126,7 @@ var bcFun = function() { | @@ -125,6 +126,7 @@ var bcFun = function() { | ||
| 125 | } | 126 | } |
| 126 | } | 127 | } |
| 127 | }; | 128 | }; |
| 129 | + | ||
| 128 | /** | 130 | /** |
| 129 | * @description (TODO) 获取 上、下行的正常、区间、空放、直放班次. | 131 | * @description (TODO) 获取 上、下行的正常、区间、空放、直放班次. |
| 130 | * @param 需要分割的班次数据集合. | 132 | * @param 需要分割的班次数据集合. |
| @@ -135,7 +137,7 @@ var bcFun = function() { | @@ -135,7 +137,7 @@ var bcFun = function() { | ||
| 135 | var upArray = new Array(),downArray = new Array(),rs = new Array(); | 137 | var upArray = new Array(),downArray = new Array(),rs = new Array(); |
| 136 | for(var j = 0 ; j< json.length ; j++) { | 138 | for(var j = 0 ; j< json.length ; j++) { |
| 137 | // 判断是否为正常、区间、空放、直放班次 | 139 | // 判断是否为正常、区间、空放、直放班次 |
| 138 | - if(json[j].bcType== dataMap.bcTypeArr.normal || | 140 | + /*if(json[j].bcType== dataMap.bcTypeArr.normal || |
| 139 | json[j].bcType== dataMap.bcTypeArr.region || | 141 | json[j].bcType== dataMap.bcTypeArr.region || |
| 140 | json[j].bcType== dataMap.bcTypeArr.major || | 142 | json[j].bcType== dataMap.bcTypeArr.major || |
| 141 | json[j].bcType== dataMap.bcTypeArr.venting) { | 143 | json[j].bcType== dataMap.bcTypeArr.venting) { |
| @@ -143,9 +145,13 @@ var bcFun = function() { | @@ -143,9 +145,13 @@ var bcFun = function() { | ||
| 143 | upArray.push(json[j]); | 145 | upArray.push(json[j]); |
| 144 | else if(json[j].xlDir == dataMap.dira[1]) | 146 | else if(json[j].xlDir == dataMap.dira[1]) |
| 145 | downArray.push(json[j]); | 147 | downArray.push(json[j]); |
| 146 | - } | 148 | + }*/ |
| 149 | + if(json[j].xlDir == dataMap.dira[0]) | ||
| 150 | + upArray.push(json[j]); | ||
| 151 | + else if(json[j].xlDir == dataMap.dira[1]) | ||
| 152 | + downArray.push(json[j]); | ||
| 147 | } | 153 | } |
| 148 | - rs.push(upArray,downArray); | 154 | + rs.push(upArray, downArray); |
| 149 | // 返回数据. | 155 | // 返回数据. |
| 150 | return rs; | 156 | return rs; |
| 151 | }; | 157 | }; |
| @@ -180,9 +186,9 @@ var bcFun = function() { | @@ -180,9 +186,9 @@ var bcFun = function() { | ||
| 180 | } | 186 | } |
| 181 | // 按照发车序号顺序排序. | 187 | // 按照发车序号顺序排序. |
| 182 | lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | 188 | lpbc_.sort(function(a,b){return a.fcno-b.fcno}); |
| 183 | - addcfbc01(lpbc_,dataMap,map); | ||
| 184 | - // 按照发车序号顺序排序. | ||
| 185 | - lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | 189 | + // addcfbc01(lpbc_,dataMap,map); |
| 190 | + // // 按照发车序号顺序排序. | ||
| 191 | + // lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | ||
| 186 | var tt = addjclbbc01(lpbc_,dataMap,dataMap.lbsj,map); | 192 | var tt = addjclbbc01(lpbc_,dataMap,dataMap.lbsj,map); |
| 187 | bcs = updfcno(tt,bcs); | 193 | bcs = updfcno(tt,bcs); |
| 188 | resultJA = resultJA.concat(tt); | 194 | resultJA = resultJA.concat(tt); |
| @@ -227,24 +233,39 @@ var bcFun = function() { | @@ -227,24 +233,39 @@ var bcFun = function() { | ||
| 227 | result.push(getbcObj( | 233 | result.push(getbcObj( |
| 228 | dqbcfcsj,dataMap.ccsjArr[fxdm],car,dataMap.bcTypeArr.out, | 234 | dqbcfcsj,dataMap.ccsjArr[fxdm],car,dataMap.bcTypeArr.out, |
| 229 | dataMap.dira[fxdm],2,dataMap.cclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 出场班次 | 235 | dataMap.dira[fxdm],2,dataMap.cclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 出场班次 |
| 230 | - fcno ++; | 236 | + fcno = 3; |
| 231 | }else if(b==bc.length-1){ | 237 | }else if(b==bc.length-1){ |
| 232 | - var fcno_ = dxfno + 2; | 238 | + fxdm = fxdm == 0 ? 1:0; |
| 239 | + // var fcno_ = dxfno + 2; | ||
| 233 | var qdbcddsj = DateTimeTool.getDateTime(bc[b].ARRIVALTIME); | 240 | var qdbcddsj = DateTimeTool.getDateTime(bc[b].ARRIVALTIME); |
| 234 | - result.push(getbcObj( | ||
| 235 | - qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.in_, | ||
| 236 | - dataMap.dira[fxdm],fcno_++,dataMap.jclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 进场班次 | 241 | + if(dataMap.jcsjArr[fxdm] > 0){ |
| 242 | + result.push(getbcObj( | ||
| 243 | + qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.in_, | ||
| 244 | + dataMap.dira[fxdm],++fcno,dataMap.jclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 进场班次 | ||
| 245 | + } | ||
| 237 | result.push(getbcObj( | 246 | result.push(getbcObj( |
| 238 | qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.lc, | 247 | qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.lc, |
| 239 | - dataMap.dira[fxdm],fcno_++,0,gatps,0,null,null,null,0,lbsj));// 晚班例保班次 | 248 | + dataMap.dira[fxdm],++fcno,0,gatps,0,null,null,null,0,lbsj));// 晚班例保班次 |
| 249 | + } else if(bc[b].isfb && b!=bc.length-1){ | ||
| 250 | + fxdm = fxdm == 0 ? 1:0; | ||
| 251 | + var qdbcddsj = DateTimeTool.getDateTime(bc[b].ARRIVALTIME); | ||
| 252 | + if(dataMap.jcsjArr[fxdm] > 0){ | ||
| 253 | + result.push(getbcObj( | ||
| 254 | + qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.in_, | ||
| 255 | + dataMap.dira[fxdm],++fcno,dataMap.jclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 进场班次 | ||
| 256 | + } | ||
| 240 | } | 257 | } |
| 241 | - dxfno = bc[b].fcno + fcno; | ||
| 242 | - bc[b].fcno = dxfno; | ||
| 243 | - if(stas) { | 258 | + // dxfno = bc[b].fcno + fcno; |
| 259 | + // bc[b].fcno = dxfno; | ||
| 260 | + | ||
| 261 | + bc[b].fcno = fcno; | ||
| 262 | + result.push(bc[b]); | ||
| 263 | + fcno++; | ||
| 264 | + | ||
| 265 | + /*if(stas) { | ||
| 244 | fcno ++; | 266 | fcno ++; |
| 245 | stas = false; | 267 | stas = false; |
| 246 | - } | ||
| 247 | - result.push(bc[b]); | 268 | + }*/ |
| 248 | } | 269 | } |
| 249 | return result; | 270 | return result; |
| 250 | }; | 271 | }; |
| @@ -254,7 +275,7 @@ var bcFun = function() { | @@ -254,7 +275,7 @@ var bcFun = function() { | ||
| 254 | for(var g = 0 ; g <lpbcar.length-1;g++ ) { | 275 | for(var g = 0 ; g <lpbcar.length-1;g++ ) { |
| 255 | if( parseInt((DateTimeTool.getDateTime(lpbcar[g+1].fcsj) - DateTimeTool.getDateTime(lpbcar[g].ARRIVALTIME))/60000) > 180 | 276 | if( parseInt((DateTimeTool.getDateTime(lpbcar[g+1].fcsj) - DateTimeTool.getDateTime(lpbcar[g].ARRIVALTIME))/60000) > 180 |
| 256 | && lpbcar[g].STOPTIME==0 && lpbcar[g].bcType =='normal' ) { | 277 | && lpbcar[g].STOPTIME==0 && lpbcar[g].bcType =='normal' ) { |
| 257 | - lpbcar[g].isfb = 1; | 278 | + lpbcar[g].isfb = true; |
| 258 | } | 279 | } |
| 259 | } | 280 | } |
| 260 | }; | 281 | }; |
| @@ -265,6 +286,222 @@ var bcFun = function() { | @@ -265,6 +286,222 @@ var bcFun = function() { | ||
| 265 | return 1; | 286 | return 1; |
| 266 | }; | 287 | }; |
| 267 | 288 | ||
| 289 | + /** | ||
| 290 | + * @description (TODO) 横向调整 调整停站时间. | ||
| 291 | + * @param cara 路牌数组. | ||
| 292 | + * @param tempa 所有的班次数组集合. | ||
| 293 | + * @param dataMap 封装的 以上、下行方向成对存在的 一些参数数组 [下标0 -- 代表上行 ; 下标1 -- 代表下行]. | ||
| 294 | + * | ||
| 295 | + * ******************************** 思路 ************************************************* | ||
| 296 | + * 第一步 等到每个路牌下的班次数组集合. | ||
| 297 | + * | ||
| 298 | + * 第二步 顺序排序每个路牌下的班次数组集合. | ||
| 299 | + * | ||
| 300 | + * 第三步 从第二个班次开始,用第二个班次的发车时间 - 上一个班次的到达时间 得到 上一个班次的停站时间. | ||
| 301 | + * | ||
| 302 | + * 第四步 修改上一个班次的停站时间. | ||
| 303 | + * | ||
| 304 | + * 修改停站时间规则:以行驶时间的10%-15% 为标准。 | ||
| 305 | + * 如果超出该范围。则以录入参数低谷最大停站间隙为准。 | ||
| 306 | + * 停站时间最大不能超过该停站时间。 | ||
| 307 | + * 高峰附近的班次的停站时间在离高峰最近一个班次的停站时间浮动范围【1-2】分钟。 | ||
| 308 | + * | ||
| 309 | + * **************************************************************************************** | ||
| 310 | + */ | ||
| 311 | + var resizeByPitStopTime = function(cara,tempa,dataMap) { | ||
| 312 | + var cLen = cara.length,tLen = tempa.length; | ||
| 313 | + if(cLen<= 0 || tLen<=0 || dataMap==null) | ||
| 314 | + return; | ||
| 315 | + // 定义低谷最大停站时间、行业标准最小、最大停站时间(行驶时间的10%~15%). | ||
| 316 | + var dgmaxtzsj = dataMap.dgmaxtzsj,normmintzsj, normmaxtzsj; | ||
| 317 | + for(var t = 0 ; t < cLen ; t++) { | ||
| 318 | + // 定义当前路牌班次数组集合. | ||
| 319 | + var sslpbcA = new Array(); | ||
| 320 | + for(var j =0 ; j < tLen ; j++) { | ||
| 321 | + // 判断当期遍历的班次是否属于当前的路牌.如果是则添加到当前的路牌班次数组集合. | ||
| 322 | + if(tempa[j].lpNo == cara[t].lpNo) { | ||
| 323 | + tempa[j].fcint = DateTimeTool.getDateTime(tempa[j].fcsj).getTime(); | ||
| 324 | + sslpbcA.push(tempa[j]); | ||
| 325 | + } | ||
| 326 | + } | ||
| 327 | + if(sslpbcA.length > 0) { | ||
| 328 | + // 按发车时间顺序排序. | ||
| 329 | + sslpbcA.sort(function(a,b){return a.fcint-b.fcint}); | ||
| 330 | + // 按照规则修改停站时间. | ||
| 331 | + for(var r = 0 ; r < sslpbcA.length-1 ; r++) { | ||
| 332 | + if(sslpbcA[r].isfb) | ||
| 333 | + continue; | ||
| 334 | + // test | ||
| 335 | + //if(sslpbcA[r].bcType == 'cf') { | ||
| 336 | + // alert('cf' + sslpbcA[r-1].fcsj); | ||
| 337 | + //} | ||
| 338 | + // 定义上一个班次的发车时间、当前班次的到达时间、发车时间. | ||
| 339 | + var sgbcfcsj = DateTimeTool.getDateTime(sslpbcA[r+1].fcsj), | ||
| 340 | + dqbcddsj = DateTimeTool.getDateTime(sslpbcA[r].ARRIVALTIME), | ||
| 341 | + dqbcfcsj = DateTimeTool.getDateTime(sslpbcA[r].fcsj); | ||
| 342 | + // 定义当前班次方向下标代码[0代表上行;1代表下行]. | ||
| 343 | + var cctag = dirDmToIndex(sslpbcA[r].xlDir); // dataMap.smbcsjArr | ||
| 344 | + // 定义每每相邻两个班次之间的时间差分钟数(也就是停站时间.) | ||
| 345 | + var dxmin = parseInt( (sgbcfcsj - dqbcddsj)/60000); | ||
| 346 | + // 定义是否高峰 | ||
| 347 | + var tt_flag = scheduleInitialize.isPeakTimeScope(dqbcfcsj , dataMap); | ||
| 348 | + // 获取行驶时间. | ||
| 349 | + var xxsj = scheduleInitialize.judgeXSSJ(cctag, dqbcfcsj, dataMap); | ||
| 350 | + var time = dataMap.tzsj[cctag][DateTimeTool.judgmentTimeQuantum(xxsj)]; | ||
| 351 | + | ||
| 352 | + normmintzsj = time.min; | ||
| 353 | + normmaxtzsj = time.max; | ||
| 354 | + var flag = false; | ||
| 355 | + | ||
| 356 | + // 如果小于零 | ||
| 357 | + if(dxmin < 0 && sslpbcA[r].isfb ==0) { | ||
| 358 | + // 根据不同时段的停站时间.重新赋值停站时间. | ||
| 359 | + if(sslpbcA[r].bcType=='normal' && sslpbcA[r+1].bcType =='normal') | ||
| 360 | + //dxmin = tt_flag ? dataMap.gftzsj[cctag] : dataMap.dgtzsj[cctag]; | ||
| 361 | + dxmin = 1; | ||
| 362 | + else | ||
| 363 | + dxmin = 0; | ||
| 364 | + flag = true; | ||
| 365 | + }else if(dxmin==0){ | ||
| 366 | + if (sslpbcA[r].bcType == 'cf') { // 如果是吃饭班次,停站为0 | ||
| 367 | + dxmin = 0; | ||
| 368 | + } else { | ||
| 369 | + // 这里区分,如果下一个班次是吃饭班次,停站为0 | ||
| 370 | + if (sslpbcA[r + 1].bcType=='cf') { | ||
| 371 | + dxmin = 0; | ||
| 372 | + } else { // 否则使用最小停站时间 | ||
| 373 | + dxmin = normmintzsj; | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + | ||
| 377 | + flag = true; | ||
| 378 | + }else { | ||
| 379 | + // 如果 大于等于低谷最大停站时间 并且 小于等于三小时.则把低谷最大停站时间 作为 停站时间. | ||
| 380 | + if(dxmin >= dgmaxtzsj && dxmin < 180 && sslpbcA[r].isfb==false) { | ||
| 381 | + dxmin = dgmaxtzsj; | ||
| 382 | + flag = true; | ||
| 383 | + // 如果大于零 并且 小于等于行业标准的最小停站时间 | ||
| 384 | + }else if(dxmin > 0 && dxmin <= normmintzsj ) { | ||
| 385 | + // dxmin = dxmin; | ||
| 386 | + flag = true; | ||
| 387 | + // 如果大于行业标准的最小停站时间 并且 小于等于行业标准的最大停站时间 | ||
| 388 | + }else if(dxmin > normmintzsj && dxmin <= normmaxtzsj ) { | ||
| 389 | + // dxmin = dxmin; | ||
| 390 | + flag = true; | ||
| 391 | + // 如果大于行业标准的最大停站时间 并且 小于低谷最大停站时间 | ||
| 392 | + }else if(dxmin > normmaxtzsj && dxmin < dgmaxtzsj ) { | ||
| 393 | + // dxmin = dxmin; | ||
| 394 | + flag = true; | ||
| 395 | + }else if (dxmin >= 180){ | ||
| 396 | + dxmin = 0; | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + if(flag) { | ||
| 400 | + if(!isDirSmbc(dirDmToIndex(sslpbcA[r+1].xlDir) , sslpbcA[r+1].fcsj , dataMap)) { | ||
| 401 | + // 修改当前班次的停站时间. | ||
| 402 | + sslpbcA[r].STOPTIME = parseInt(dxmin) ; | ||
| 403 | + // 当前班次的到达时间 + 停站时间 作为下一个班次的发车时间. | ||
| 404 | + dqbcddsj.setMinutes(dqbcddsj.getMinutes() + dxmin); | ||
| 405 | + // 修改下一个班次的发车时间. | ||
| 406 | + sslpbcA[r+1].fcsj = DateTimeTool.getHHmmStr(dqbcddsj); | ||
| 407 | + // 下一个班次的发车时间 + 行驶时间 作为下一个班次的到达时间. | ||
| 408 | + dqbcddsj.setMinutes(dqbcddsj.getMinutes() + sslpbcA[r+1].bcsj); | ||
| 409 | + // 修改下一个班次的到达时间. | ||
| 410 | + sslpbcA[r+1].ARRIVALTIME = DateTimeTool.getHHmmStr(dqbcddsj); | ||
| 411 | + }else { | ||
| 412 | + if(r>0) { | ||
| 413 | + // 修改当前班次的停站时间. | ||
| 414 | + sslpbcA[r].STOPTIME = parseInt(dxmin) ; | ||
| 415 | + sgbcfcsj.setMinutes(sgbcfcsj.getMinutes() - sslpbcA[r].STOPTIME); | ||
| 416 | + sslpbcA[r].ARRIVALTIME = DateTimeTool.getHHmmStr(sgbcfcsj); | ||
| 417 | + sgbcfcsj.setMinutes(sgbcfcsj.getMinutes() - sslpbcA[r].bcsj); | ||
| 418 | + sslpbcA[r].fcsj = DateTimeTool.getHHmmStr(sgbcfcsj); | ||
| 419 | + sslpbcA[r-1].STOPTIME = parseInt( ( sgbcfcsj - DateTimeTool.getDateTime(sslpbcA[r-1].ARRIVALTIME))/60000); | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + } | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + } | ||
| 426 | + }; | ||
| 427 | + | ||
| 428 | + var isDirSmbc = function(dirDm , fcsj , dataMap) { | ||
| 429 | + var falg = false; | ||
| 430 | + if(fcsj == dataMap.smbcsjArr[dirDm].kssj || fcsj == dataMap.smbcsjArr[dirDm].jssj) | ||
| 431 | + falg = true; | ||
| 432 | + return falg; | ||
| 433 | + }; | ||
| 434 | + | ||
| 435 | + | ||
| 436 | + | ||
| 437 | + /** | ||
| 438 | + * @description (TODO) 标记上、下行首末班车. | ||
| 439 | + * @param jsonArray 初始化路牌下的所有班次并且已经均匀发车间隙的数组集合. | ||
| 440 | + * @param dataMap 封装的 以上、下行方向成对存在的 一些参数数组 [下标0 -- 代表上行 ; 下标1 -- 代表下行]. | ||
| 441 | + */ | ||
| 442 | + var markLastBus = function(jsonArray , dataMap) { | ||
| 443 | + // 定义上、下行的正常、区间、空放、直放班次、返回数组集合. | ||
| 444 | + var listMap = getUpAndDownBc( jsonArray , dataMap) , resultArray = new Array(); | ||
| 445 | + for(var i = 0 ; i < listMap.length ; i++) { | ||
| 446 | + if(listMap[i].length > 0){ | ||
| 447 | + // 把班次顺序排序. | ||
| 448 | + listMap[i].sort(function(a,b){return a.fcint-b.fcint}); | ||
| 449 | + // 确定首末班车时间. | ||
| 450 | + markFirstAndLastBusAlso(listMap[i] , dataMap , i); | ||
| 451 | + } | ||
| 452 | + resultArray = resultArray.concat(listMap[i]); | ||
| 453 | + } | ||
| 454 | + return resultArray; | ||
| 455 | + }; | ||
| 456 | + | ||
| 457 | + /** | ||
| 458 | + * @description (TODO) 确定某方向下的末班车. | ||
| 459 | + * @param dirArray 某方向下的数组集合. | ||
| 460 | + * @param dataMap 封装的 以上、下行方向成对存在的 一些参数数组 [下标0 -- 代表上行 ; 下标1 -- 代表下行]. | ||
| 461 | + * @param dir 方向. | ||
| 462 | + */ | ||
| 463 | + var markFirstAndLastBusAlso = function(dirArray , dataMap , dir) { | ||
| 464 | + if(dirArray.length>=2) { | ||
| 465 | + // 定义最后一个班次. | ||
| 466 | + var dirLastBc = dirArray[dirArray.length-1]; | ||
| 467 | + // 确认末班车时间 | ||
| 468 | + if(dirLastBc.fcsj != dataMap.smbcsjArr[dir].jssj) { | ||
| 469 | + // 修改最后一个班次的发车时间. | ||
| 470 | + dirLastBc.fcsj = dataMap.smbcsjArr[dir].jssj; | ||
| 471 | + // 定义到达时间. | ||
| 472 | + var ddsj_ = DateTimeTool.getDateTime(dirLastBc.fcsj); | ||
| 473 | + ddsj_.setMinutes(ddsj_.getMinutes() + dataMap.xssj[dir][4]); | ||
| 474 | + // 修改最后一个班次的到达时间. | ||
| 475 | + dirLastBc.ARRIVALTIME = DateTimeTool.getHHmmStr(ddsj_); | ||
| 476 | + dirLastBc.bcsj = dataMap.xssj[dir][4]; | ||
| 477 | + } | ||
| 478 | + } | ||
| 479 | + }; | ||
| 480 | + | ||
| 481 | + /** | ||
| 482 | + * @description (TODO) 判断某路牌下是否存在末班车时间班次. | ||
| 483 | + * @param arr 某路牌下的班次. | ||
| 484 | + * @param smbcsjArr 首末班车时间点数组集合. | ||
| 485 | + */ | ||
| 486 | + var lpBcIsHaveLast = function(arr , smbcsjArr) { | ||
| 487 | + for(var a = 0 ; a < arr.length ; a++) { | ||
| 488 | + for(var s = 0 ; s < smbcsjArr.length ; s++) { | ||
| 489 | + if(arr[a].fcsj == smbcsjArr[s].jssj && dirDmToIndex(arr[a].xlDir) == s) | ||
| 490 | + return true; | ||
| 491 | + } | ||
| 492 | + } | ||
| 493 | + return false; | ||
| 494 | + }; | ||
| 495 | + var lpBcIsHaveFirst = function(arr , smbcsjArr) { | ||
| 496 | + for(var a = 0 ; a < arr.length ; a++) { | ||
| 497 | + for(var s = 0 ; s < smbcsjArr.length ; s++) { | ||
| 498 | + if(arr[a].fcsj == smbcsjArr[s].kssj && dirDmToIndex(arr[a].xlDir) == s) | ||
| 499 | + return true; | ||
| 500 | + } | ||
| 501 | + } | ||
| 502 | + return false; | ||
| 503 | + }; | ||
| 504 | + | ||
| 268 | return{ | 505 | return{ |
| 269 | getbcObj : getbcObj, //封装班次属性值 | 506 | getbcObj : getbcObj, //封装班次属性值 |
| 270 | upDownStrConvertNum : upDownStrConvertNum, | 507 | upDownStrConvertNum : upDownStrConvertNum, |
| @@ -272,6 +509,11 @@ var bcFun = function() { | @@ -272,6 +509,11 @@ var bcFun = function() { | ||
| 272 | markFirstAndLastBusAlsoDietNotInRangeBc : markFirstAndLastBusAlsoDietNotInRangeBc, | 509 | markFirstAndLastBusAlsoDietNotInRangeBc : markFirstAndLastBusAlsoDietNotInRangeBc, |
| 273 | getUpAndDownBc : getUpAndDownBc, | 510 | getUpAndDownBc : getUpAndDownBc, |
| 274 | addInOutFieldBc : addInOutFieldBc, //添加进出场班次 | 511 | addInOutFieldBc : addInOutFieldBc, //添加进出场班次 |
| 275 | - updfcno : updfcno | 512 | + updfcno : updfcno, |
| 513 | + resizeByPitStopTime : resizeByPitStopTime, | ||
| 514 | + markLastBus : markLastBus, //标记上、下行末班车 | ||
| 515 | + lpBcIsHaveLast : lpBcIsHaveLast, // 判断路牌班次是否有末班车 | ||
| 516 | + lpBcIsHaveFirst : lpBcIsHaveFirst, // 判断路牌班次是否有首班车 | ||
| 517 | + dirDmToIndex : dirDmToIndex // 字符串转换为方向 | ||
| 276 | } | 518 | } |
| 277 | }(); | 519 | }(); |
src/main/resources/static/pages/base/timesmodel/js/v1/lpFun.js
| @@ -64,49 +64,6 @@ var lpFun = function () { | @@ -64,49 +64,6 @@ var lpFun = function () { | ||
| 64 | // 返回数据. | 64 | // 返回数据. |
| 65 | return list.sort(function(a,b){return b.hoursV-a.hoursV}); | 65 | return list.sort(function(a,b){return b.hoursV-a.hoursV}); |
| 66 | }; | 66 | }; |
| 67 | - /** | ||
| 68 | - * @description (TODO) 把班型人次合理的分配到不同的路牌上. | ||
| 69 | - * @param list 班型人次数组集合. | ||
| 70 | - * @param clzs 路牌数组. | ||
| 71 | - * @return 返回一个把路牌合理的分配到班型人次下组成的数据集合. | ||
| 72 | - * */ | ||
| 73 | - var bxAlloTotLp = function(arr,clzs){ | ||
| 74 | - var cLen = clzs.length; | ||
| 75 | - var type = getMode(arr); | ||
| 76 | - var i=0; | ||
| 77 | - while(clzs.length > i){ | ||
| 78 | - for(var j=0; j<type.length; j++) { | ||
| 79 | - if(arr[type[j]].len-- > 0) { | ||
| 80 | - arr[type[j]].bx.sslp.push(clzs[i]); | ||
| 81 | - i++ | ||
| 82 | - } | ||
| 83 | - } | ||
| 84 | - } | ||
| 85 | - }; | ||
| 86 | - var getMode = function(arr){ | ||
| 87 | - var mode = [], bxRcList = arr; | ||
| 88 | - var count = bxRcList[0].lps; | ||
| 89 | - for(var i=1; i<bxRcList.length; i++) { | ||
| 90 | - if(bxRcList[i].lps < count) | ||
| 91 | - count = bxRcList[i].lps; | ||
| 92 | - } | ||
| 93 | - for(var i=0; i<bxRcList.length; i++) { | ||
| 94 | - bxRcList[i] = {'bx':bxRcList[i],'len':bxRcList[i].lps, 'ratio':Math.round(bxRcList[i].lps/count)} | ||
| 95 | - } | ||
| 96 | - for(var i=0; i<bxRcList.length; i++) { | ||
| 97 | - for(var j=0; j<bxRcList[i].ratio; j++) { | ||
| 98 | - mode.push(i); | ||
| 99 | - } | ||
| 100 | - } | ||
| 101 | - // for(var m=0; m<mode.length-2; m++) { | ||
| 102 | - // if(mode[m] == mode[m+1]) { | ||
| 103 | - // var a = mode[m+1]; | ||
| 104 | - // mode[m+1] = mode[m+2]; | ||
| 105 | - // mode[m+2] = a; | ||
| 106 | - // } | ||
| 107 | - // } | ||
| 108 | - return mode; | ||
| 109 | - }; | ||
| 110 | // 路牌整理 | 67 | // 路牌整理 |
| 111 | var lpNeaten = function (bxRcList, carList, dataMap) { | 68 | var lpNeaten = function (bxRcList, carList, dataMap) { |
| 112 | var carListH = new Array(); | 69 | var carListH = new Array(); |
| @@ -132,11 +89,12 @@ var lpFun = function () { | @@ -132,11 +89,12 @@ var lpFun = function () { | ||
| 132 | // carListH:带工时和圈数的车辆list,carListCache:缓存为分班车辆 | 89 | // carListH:带工时和圈数的车辆list,carListCache:缓存为分班车辆 |
| 133 | var carListH = [],carListCache = []; | 90 | var carListH = [],carListCache = []; |
| 134 | 91 | ||
| 135 | - // 最少分班路牌 = 总路牌 - (低谷周转/低谷最大发车间隔)向上取整 | 92 | + // 最多分班路牌 = 总路牌 - (低谷周转/低谷最大发车间隔)向上取整 |
| 136 | var fblps = carList.length - Math.ceil((dataMap.zzsj[2]) / map.dgmaxfcjx); | 93 | var fblps = carList.length - Math.ceil((dataMap.zzsj[2]) / map.dgmaxfcjx); |
| 137 | // 取出有工时的路牌 | 94 | // 取出有工时的路牌 |
| 138 | for (var i = 0; i < bxRcList.length; i++) { | 95 | for (var i = 0; i < bxRcList.length; i++) { |
| 139 | var sslp = bxRcList[i].bx.sslp, bx = bxRcList[i].bx; | 96 | var sslp = bxRcList[i].bx.sslp, bx = bxRcList[i].bx; |
| 97 | + // 路牌能有多少圈 | ||
| 140 | var count = Math.round(bx.hoursV / (dataMap.zzsj[1]/60));// 早高峰周转:dataMap.zzsj[1] | 98 | var count = Math.round(bx.hoursV / (dataMap.zzsj[1]/60));// 早高峰周转:dataMap.zzsj[1] |
| 141 | if(bx.type == '五工二休') { | 99 | if(bx.type == '五工二休') { |
| 142 | $.each(sslp, function () { | 100 | $.each(sslp, function () { |
| @@ -167,7 +125,7 @@ var lpFun = function () { | @@ -167,7 +125,7 @@ var lpFun = function () { | ||
| 167 | cutCar(carListH,carListCache); | 125 | cutCar(carListH,carListCache); |
| 168 | var index = Math.floor(carListH.length / fblps); | 126 | var index = Math.floor(carListH.length / fblps); |
| 169 | for(var s=1; s<=fblps; s++){ | 127 | for(var s=1; s<=fblps; s++){ |
| 170 | - carListH[s*index].isfb = true; | 128 | + carListH[s*index - 1].isfb = true; |
| 171 | } | 129 | } |
| 172 | } | 130 | } |
| 173 | carListH = carListH.concat(carListCache); | 131 | carListH = carListH.concat(carListCache); |
| @@ -179,6 +137,16 @@ var lpFun = function () { | @@ -179,6 +137,16 @@ var lpFun = function () { | ||
| 179 | } | 137 | } |
| 180 | return carListH; | 138 | return carListH; |
| 181 | }; | 139 | }; |
| 140 | + // 切割出连班路牌 | ||
| 141 | + var cutCar = function(carListH,carListCache) { | ||
| 142 | + for(var c=0; c<carListH.length; c++){ | ||
| 143 | + if(carListH[c].isfb) { | ||
| 144 | + carListCache.push(carListH[c]); | ||
| 145 | + carListH.splice(c,1); | ||
| 146 | + cutCar(carListH,carListCache); | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + }; | ||
| 182 | // 确定路牌分班数 | 150 | // 确定路牌分班数 |
| 183 | var lpfbs = function (fblps, bxRcList, index) { | 151 | var lpfbs = function (fblps, bxRcList, index) { |
| 184 | if(fblps > bxRcList[index].lps){ | 152 | if(fblps > bxRcList[index].lps){ |