From 3364b096f5a6ff7f4fbb41088dbb02f629446f44 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 8 Oct 2021 15:53:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8C=89=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E8=A1=8C=E8=BD=A6=E7=9A=84=E8=BF=9B=E8=B7=AF=E5=8A=9E=E7=90=86?= =?UTF-8?q?=E3=80=81=E8=A7=A3=E9=94=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/service/AtsTrainLoadService.java | 16 +++++++++++-- .../cbtc/tool/DeviceStatusModifyTool.java | 23 +++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainLoadService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainLoadService.java index d8905b772..9d538300b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainLoadService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainLoadService.java @@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.ATS.service; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService; import club.joylink.rtss.simulation.cbtc.ATS.service.ars.AtsRouteSelectService; +import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiLogic; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService; @@ -69,6 +70,9 @@ public class AtsTrainLoadService { @Qualifier("atsPlanTrainRouteSelectServiceImpl") private AtsRouteSelectService atsRouteSelectService; + @Autowired + private CiApiService ciApiService; + public int getGivenTimeCouldLoadedTrainNumber(Simulation simulation, LocalTime time) { List list = this.getCurrentAllNeedLoadTrain(simulation, time); return list.size(); @@ -438,10 +442,17 @@ public class AtsTrainLoadService { SimulationDataRepository repository = simulation.getRepository(); for (TrainInfo trainInfo : repository.getSuperviseTrainList()) { VirtualRealityTrain train = repository.getOnlineTrainBy(trainInfo.getGroupNumber()); + if (train.isStop()) + continue; //筛选其它进路 Route route = atsRouteSelectService.select(simulation, trainInfo); if (route == null) continue; + if (route.getStart().getSection().getCode().equals(trainInfo.getPlanStandTrack())) //进路始端信号机所在区段是列车的计划区段 + continue; + Route.CheckFailMessage checkFailMessage = ciApiService.routeSettingCheck(simulation, route.getCode()); + if (checkFailMessage != null) + continue; VirtualRealityTrain thatTrain = map.get(route); if (thatTrain != null) { if (train.isRight() == thatTrain.isRight()) { @@ -653,10 +664,11 @@ public class AtsTrainLoadService { if (Objects.nonNull(route)) { // 排列好进路 this.deviceStatusModifyTool.openRouteDirect(simulation, route); + // 根据列车位置直接进路正常解锁 + this.deviceStatusModifyTool.routeUnlockByEndSection(route, tailPosition); // 进路设置为正常解锁 this.ciLogic.trainUnlockStart(simulation, route); -// // 根据列车位置直接进路正常解锁 -// this.deviceStatusModifyTool.routeUnlockByEndSection(route, tailPosition.getSection()); + route.setUnlockedSection(tailPosition.getSection()); break; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/tool/DeviceStatusModifyTool.java b/src/main/java/club/joylink/rtss/simulation/cbtc/tool/DeviceStatusModifyTool.java index 1d25f8f50..2d14330f6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/tool/DeviceStatusModifyTool.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/tool/DeviceStatusModifyTool.java @@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.*; +import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService; @@ -16,6 +17,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; @@ -204,9 +206,9 @@ public class DeviceStatusModifyTool { /** * 直接根据最后一根区段解锁进路 * @param route - * @param endOccupied */ - public void routeUnlockByEndSection(Route route, Section endOccupied) { + public void routeUnlockByEndSection(Route route, SectionPosition tailPosition) { + Section endOccupied = tailPosition.getSection(); if (!route.isRouteSection(endOccupied)) { // 不是进路区段,不解锁 return; @@ -216,6 +218,23 @@ public class DeviceStatusModifyTool { List
sectionList = route.getSectionList(); for (Section section : sectionList) { if (section.isSamePhysical(endOccupied.getCode())) { + if (!CollectionUtils.isEmpty(section.getLogicList())) { + // 逻辑区段占用,根据逻辑区段占用位置解锁 + List
logicList = section.getLogicList(); + if (!right) { // 向左,逻辑区段列表reverse + logicList = new ArrayList<>(section.getLogicList()); + Collections.reverse(logicList); + } + Section logicSection = tailPosition.getLogicSection(); + for (Section logic : logicList) { + if (logic.equals(logicSection)) { + break; + } else { + logic.routeUnlocking(route); + logic.overlapUnlocking(); + } + } + } break; } // 直接解锁区段