diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index 7bba22f21..5e990cc0d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage; import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.extern.slf4j.Slf4j; @@ -458,6 +459,13 @@ public class CiApiServiceImpl implements CiApiService { @Override public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) { - + Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!aSwitch.isLocked(), String.format("道岔[%s]锁闭,无法转动", aSwitch.getCode())); + VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch(); + if (normal == null) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(vrSwitch.isLoss(), "道岔不在定反位,不能转动"); + normal = vrSwitch.isReverse(); + } + vrSwitch.startSetting(normal); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index 3bf018a3a..8d6559bea 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -693,6 +693,7 @@ public class RouteService { switchList.forEach(switchElement -> { Switch aSwitch = switchElement.getASwitch(); aSwitch.routeUnlock(); + aSwitch.overlapUnLock(); }); } // 进路侧防取消锁闭 @@ -1043,10 +1044,20 @@ public class RouteService { SwitchElement switchElement = route.getRouteSwitchElement(relSwitch); section.routeUnlocking(right); relSwitch.routeUnlock(); + relSwitch.overlapUnLock(); RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch); if (routeFls != null) { routeFls.unlock(); } + //检查道岔的联动道岔和计轴关联道岔是否可以解锁 + List switches = Arrays.asList(null, relSwitch.queryAxleRelatedOtherSwitch()); + for (Switch linkedSwitch : switches) { + if (linkedSwitch == null) + continue; + if (linkedSwitch.getAllSections().stream().noneMatch(Section::isRouteLock)) { //道岔关联的所有区段都没有进路锁闭 + linkedSwitch.routeUnlock(); + } + } } else { section.routeUnlocking(right); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index 3ca080594..4b87be41f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -232,7 +232,6 @@ public class Switch extends MayOutOfOrderDevice { public void routeUnlock() { this.routeLock = false; - this.overlapLock = false; } public void fpLock() { @@ -367,6 +366,20 @@ public class Switch extends MayOutOfOrderDevice { (!normal && SwitchFault.REVERSE_SPLIT.equals(this.getFault()))); } + /** + * 获取定位的道岔区段列表 + */ + public List
getNormalSections() { + return Arrays.asList(a, b); + } + + /** + * 获取道岔关联的所有区段 + */ + public List
getAllSections() { + return List.of(a, b, c); + } + public enum SwitchFault implements DeviceFault { /** * 道岔挤岔 @@ -421,11 +434,4 @@ public class Switch extends MayOutOfOrderDevice { public boolean isLoss() { return !this.isNormalPosition() && !this.isReversePosition(); } - - /** - * 获取定位的道岔区段列表 - */ - public List
getNormalSections() { - return Arrays.asList(a, b); - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java index 78df87ffb..660b60b94 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java @@ -109,7 +109,7 @@ public class VirtualRealitySwitch extends VirtualRealityDevice { * 是否失表 * @return */ - private boolean isLoss() { + public boolean isLoss() { return !this.isNormal() && !this.isReverse(); }