From 96af0971ecc85f8efe4a77df5c039cd5e4503be5 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 10 Jun 2021 15:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=8A=A2=E8=B7=AF=E9=80=BB=E8=BE=91=EF=BC=88=E8=A5=BF=E5=AE=89?= =?UTF-8?q?=E4=B8=89=E9=97=AE=E9=A2=9829=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ATS/service/AtsRouteSettingService.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java index 9849e8b92..6c9e5f8af 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java @@ -3,12 +3,10 @@ package club.joylink.rtss.simulation.cbtc.ATS.service; import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.DriveMode; -import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan; import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan; -import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption; @@ -288,8 +286,8 @@ public class AtsRouteSettingService { // 处理站前折返的进路排列 routePaths = repository.queryRoutePaths(trainSection, nextSection); } else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack())) { // 折返轨停车 - // 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划 - if (this.containsConflictOutBoundPlan(simulation, tripPlan)) { + // 判断从当前时间到折返后下一计划到站时间中是否存在冲突计划 + if (this.containsConflictPlan(simulation, tripPlan)) { log.debug(String.format("折返与出库冲突,不排列")); return null; } @@ -346,11 +344,12 @@ public class AtsRouteSettingService { * @param tripPlan * @return */ - private boolean containsConflictOutBoundPlan(Simulation simulation, TripPlan tripPlan) { + private boolean containsConflictPlan(Simulation simulation, TripPlan tripPlan) { LocalTime current = simulation.getSystemTime().toLocalTime(); + LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime(); + SimulationDataRepository repository = simulation.getRepository(); + // 判断是否有冲突的出库计划 if (tripPlan.isTurnBack()) { - SimulationDataRepository repository = simulation.getRepository(); - LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime(); if (current.isAfter(arriveTime)) { return false; } @@ -362,11 +361,10 @@ public class AtsRouteSettingService { } } } - StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime); - if (stationPlan != null) - return true; } - return false; + // 判断是否有冲突的运行计划 + StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime); + return stationPlan != null; } private Route selectRouteOfPaths(Simulation simulation, TrainInfo train,