From c319250093395cc880e9a29a78d5b0ed82a0bb7a Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 14 Oct 2021 14:30:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A6=8F=E5=B7=9E=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../training/generatornew/GeneratorNew.java | 6 ++++-- .../generatornew/base/SignalGeneratorNew.java | 1 + .../generatornew/base/SwitchGeneratorNew.java | 14 +++++++------- .../rtss/simulation/cbtc/CI/CiApiServiceImpl2.java | 2 +- .../cbtc/data/storage/device/StorageSection.java | 9 +++++++++ .../cbtc/data/storage/device/StorageSignal.java | 9 +++++++++ .../cbtc/data/storage/device/StorageSwitch.java | 9 +++++++++ .../storage/vr/StorageVirtualRealityTrain.java | 14 ++++++++++++++ 8 files changed, 54 insertions(+), 10 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java index 21cd23c14..17d497154 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java @@ -12,7 +12,7 @@ import club.joylink.rtss.vo.client.training.TrainingStepVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.definition.OperatePlaceholderVO; import club.joylink.rtss.vo.client.training.definition.OperateStepVO; -import club.joylink.rtss.vo.map.*; +import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.graph.MapAutomaticRouteButtonVO; import club.joylink.rtss.vo.map.graph.MapCycleButtonVO; import club.joylink.rtss.vo.map.graph.MapTotalGuideLockButtonVO; @@ -121,7 +121,9 @@ public interface GeneratorNew { if (MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) { stepList.get(0).setDeviceCode(((Route) mapDevice).getStart().getCode()); } else { - stepList.get(0).setDeviceCode(mapDevice.getCode()); + if (!"bar".equals(stepList.get(0).getDeviceType())) { //为处理转为站控实训,操作正确但结束实训判为错误的bug + stepList.get(0).setDeviceCode(mapDevice.getCode()); + } } } Map placeholderVOMap = operateDefinitionVO.getPlaceholderVOMap(); diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java index c23ef9341..a5acf6631 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java @@ -213,6 +213,7 @@ public class SignalGeneratorNew implements GeneratorNew { } this.deviceStatusModifyTool.openRouteDirect(simulation, route); this.deviceStatusModifyTool.closeSignalDirectly(route.getStart()); + signal.setForbidden(true); trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 this.resetSimulation(simulation); diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java index 6dbd00393..c141925d1 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java @@ -7,7 +7,6 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.service.AtsSectionService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.Switch; -import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter; import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool; import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; @@ -97,12 +96,13 @@ public class SwitchGeneratorNew implements GeneratorNew { break; } case Switch_Axle_Pre_Reset:{ - aSwitch.setPreReset(false); - VirtualRealitySectionAxleCounter virtualAxleCounter = aSwitch.getA().getParent().getVirtualAxleCounter(); - virtualAxleCounter.setOccupy(true); - virtualAxleCounter.setPreReset(false); - virtualAxleCounter.setLeftCount(3); - virtualAxleCounter.setRightCount(3); + Switch.SwitchFault.AXLE_FAULT.apply(aSwitch); +// aSwitch.setPreReset(false); +// VirtualRealitySectionAxleCounter virtualAxleCounter = aSwitch.getA().getParent().getVirtualAxleCounter(); +// virtualAxleCounter.setOccupy(true); +// virtualAxleCounter.setPreReset(false); +// virtualAxleCounter.setLeftCount(0); +// virtualAxleCounter.setRightCount(3); break; } case Switch_Confirm_Axis_Valid:{ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java index d3eed90f4..ffbf926e0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java @@ -250,7 +250,7 @@ public class CiApiServiceImpl2 implements CiApiService { @Override public void switchSectionFaultUnlock(Simulation simulation, String switchCode) { Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); - if (!aSwitch.isLocked()) + if (!aSwitch.isLocked() && aSwitch.getAllSections().stream().noneMatch(Section::isFaultLock)) return; List lockedRouteList = simulation.getRepository().queryAllLockedRoute(); Route lockedRoute = null; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java index 592baf67f..e8a7a5767 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java @@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; +import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; @@ -34,6 +35,8 @@ public class StorageSection extends StorageDelayUnlockDevice { @JsonDeserialize(using = Boolean2NumDeserializer.class) private Boolean routeLock; + private String route; + /** * 锁闭方向 */ @@ -129,6 +132,11 @@ public class StorageSection extends StorageDelayUnlockDevice { change = true; storageSection.setRouteLock(section.isRouteLock()); } + Route route = section.getRoute(); + if (route != null) { + change = true; + storageSection.setRoute(route.getCode()); + } if (section.isLockRight()) { change = true; storageSection.setLockRight(section.isLockRight()); @@ -185,6 +193,7 @@ public class StorageSection extends StorageDelayUnlockDevice { Section section = (Section) element; section.setBlockade(blockade != null ? blockade : false); section.setRouteLock(routeLock != null ? routeLock : false); + section.setRoute(route == null ? null : repository.getByCode(route, Route.class)); section.setLockRight(lockRight != null ? lockRight : false); section.setOverlapLock(overlapLock != null ? overlapLock : false); section.setCtOccupied(ctOccupied != null ? ctOccupied : false); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java index a0a0ca8ca..624e2c5a0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java @@ -56,6 +56,10 @@ public class StorageSignal extends StorageDelayUnlockDevice { private SignalAspect aspect; + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean forbidden; + /** * 绿灯开放 */ @@ -122,6 +126,10 @@ public class StorageSignal extends StorageDelayUnlockDevice { change = true; storageSignal.setAspect(signal.getAspect()); } + if (signal.isForbidden()) { + change = true; + storageSignal.setForbidden(signal.isForbidden()); + } if (signal.getRemain() > 0) { change = true; storageSignal.saveFrom(signal); @@ -154,6 +162,7 @@ public class StorageSignal extends StorageDelayUnlockDevice { if (aspect != null) { signal.setAspect(aspect); } + signal.setForbidden(this.forbidden == null ? false : this.forbidden); if (this.getRemain() > 0) { this.recoverTo(signal, repository); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java index 72f403945..3220955ec 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java @@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; +import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; @@ -40,6 +41,8 @@ public class StorageSwitch extends StorageDelayUnlockDevice { @JsonDeserialize(using = Boolean2NumDeserializer.class) private Boolean routeLock; + private String route; + /** * 是否进路侧防锁闭 */ @@ -92,6 +95,11 @@ public class StorageSwitch extends StorageDelayUnlockDevice { change = true; storageSwitch.setRouteLock(s.isRouteLock()); } + Route route = s.getRoute(); + if (route != null) { + change = true; + storageSwitch.setRoute(route.getCode()); + } if (s.isFpLock()) { change = true; storageSwitch.setFpLock(s.isFpLock()); @@ -133,6 +141,7 @@ public class StorageSwitch extends StorageDelayUnlockDevice { s.setSingleLock(singleLock != null ? singleLock : false); s.setBlockade(blockade != null ? blockade : false); s.setRouteLock(routeLock != null ? routeLock : false); + s.setRoute(route == null ? null : repository.getByCode(route, Route.class)); s.setOverlapLock(overlapLock != null ? overlapLock : false); s.setMasterGuideLock(masterGuideLock != null ? masterGuideLock : false); if (pos != null) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/vr/StorageVirtualRealityTrain.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/vr/StorageVirtualRealityTrain.java index a9a3d7d75..5c16d7c20 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/vr/StorageVirtualRealityTrain.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/vr/StorageVirtualRealityTrain.java @@ -39,6 +39,16 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu */ private DriveMode driveMode; + /** + * 临时预选模式 + */ + private VirtualRealityTrain.PreselectionMode tempPreselectionMode; + + /** + * 预选模式 + */ + private VirtualRealityTrain.PreselectionMode preselectionMode; + /** * 服务号 */ @@ -257,6 +267,8 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu this.groupNumber = train.getGroupNumber(); this.runLevel = train.getRunLevel(); this.driveMode = train.getDriveMode(); + this.tempPreselectionMode = train.getTempPreselectionMode(); + this.preselectionMode = train.getPreselectionMode(); this.serviceNumber = train.getServiceNumber(); this.tripNumber = train.getTripNumber(); this.destinationCode = train.getDestinationCode(); @@ -331,6 +343,8 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu VirtualRealityTrain train = (VirtualRealityTrain) vrDevice; train.setRunLevel(runLevel); train.setDriveMode(driveMode); + train.setTempPreselectionMode(tempPreselectionMode); + train.setPreselectionMode(preselectionMode); train.setServiceNumber(serviceNumber); train.setTripNumber(tripNumber); train.setDestinationCode(destinationCode);