From 4ea0ad5e1f492139c9d25f4e7a46dfe750f85a50 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 21 Jul 2021 11:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=96=B0=E7=89=88?= =?UTF-8?q?=E5=A4=B4=E7=A0=81=E8=BD=A6=E8=BF=9B=E8=B7=AF=E5=8A=9E=E7=90=86?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AtsHeadTrainRouteSelectServiceImpl.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsHeadTrainRouteSelectServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsHeadTrainRouteSelectServiceImpl.java index 97409c904..d3164b88f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsHeadTrainRouteSelectServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsHeadTrainRouteSelectServiceImpl.java @@ -45,32 +45,38 @@ public class AtsHeadTrainRouteSelectServiceImpl implements AtsRouteSelectService return dcd.queryNextRoute(headSection); } else { // 根据车次计划查找可触发进路列表 - Object[] results = this.queryByDestinationCode(simulation, trainInfo, targetSection, right); + Object[] results = this.queryByDestinationCode(simulation, trainInfo, headSection, targetSection, right); // 根据计划筛选需触发进路 return filterRoutes(repository, trainInfo, results, dcd); } } - private Object[] queryByDestinationCode(Simulation simulation, TrainInfo trainInfo, Section targetSection, Boolean right) { + private Object[] queryByDestinationCode(Simulation simulation, TrainInfo trainInfo, Section headSection, Section targetSection, Boolean right) { SimulationDataRepository repository = simulation.getRepository(); List routePathList = repository.queryRoutePathsByEnd(targetSection); if (CollectionUtils.isEmpty(routePathList)) { return null; } routePathList = routePathList.stream() - .filter(routePath -> routePath.containsSection(targetSection)) + .filter(routePath -> routePath.containsSection(headSection)) .collect(Collectors.toList()); Object[] result = this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList); if (!(boolean) result[1] && !(boolean) result[2]) { //不存在未触发的进路和未接近的信号机 // 判断配置是否列车停站才触发接下来的进路 MapConfig config = repository.getConfig(); - if (config.isSignalOpenAfterParking() && !trainInfo.isParking()) { - return null; - } else { + if (!config.isSignalOpenAfterParking() || trainInfo.isPlanTrain()) { Section nextTarget = AtsHeadTrainStageService.queryNextTarget(simulation, targetSection, trainInfo, right); - routePathList = repository.queryRoutePathsByEnd(nextTarget); - result = this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList); + if (nextTarget != null) { + routePathList = repository.queryRoutePathsByEnd(nextTarget); + if (!CollectionUtils.isEmpty(routePathList)) { + routePathList = routePathList.stream() + .filter(routePath -> routePath.containsSection(headSection)) + .collect(Collectors.toList()); + return this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList); + } + } } + return null; } return result; }