From 266463eb4cadab2dc3fc5959916f3096cddec19c Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 26 Jul 2022 15:28:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E5=B2=94=E9=92=A9=E9=94=81=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/SwitchOperateHandler.java | 19 +++++++++++++++---- .../cbtc/data/vr/VirtualRealitySwitch.java | 13 +++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) 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