diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java index 4aeb3ece1..3adb99070 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java @@ -12,7 +12,6 @@ import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Switch; -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; @@ -295,11 +294,23 @@ public class SwitchOperateHandler { */ @OperateHandlerMapping(type = Operation.Type.Switch_Hook_Lock) public void switchHookLock(Simulation simulation, String switchCode, Boolean normal) { - VirtualRealitySwitch vrSwitch = simulation.getRepository().getVRByCode(switchCode, VirtualRealitySwitch.class); + SimulationDataRepository repository = simulation.getRepository(); + Switch aSwitch = repository.getByCode(switchCode, Switch.class); if (normal) { - vrSwitch.setP(SwitchIndication.N); + aSwitch.getVirtualSwitch().setP(SwitchIndication.N); } else { - vrSwitch.setP(SwitchIndication.R); + aSwitch.getVirtualSwitch().setP(SwitchIndication.R); + } + + if (simulation.getRepository().getConfig().isSwitchNRTurnChain()) { + Switch linkedSwitch = aSwitch.queryLinkedSwitch(); + if (linkedSwitch != null) { + if (normal) { + linkedSwitch.getVirtualSwitch().setP(SwitchIndication.N); + } else { + linkedSwitch.getVirtualSwitch().setP(SwitchIndication.R); + } + } } } 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 983d0b865..0e7c6b9c1 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 @@ -12,6 +12,13 @@ import lombok.Setter; @Getter @Setter public class VirtualRealitySwitch extends ControllableVrDevice { + + private SwitchIndication p; + + // -------------运行逻辑控制参数------------- + + private Fault fault; + @Override protected boolean checkConditionBeforeControl(Operation command) { switch (command) { @@ -66,12 +73,6 @@ public class VirtualRealitySwitch extends ControllableVrDevice