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 a841a8b0c..e5cfb29a5 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 @@ -1,22 +1,22 @@ package club.joylink.rtss.services.training.generatornew; +import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.services.training.constant.TrainingConsts; import club.joylink.rtss.services.training.data.GenerateConfig; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation; -import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.util.ReflectionUtils; -import club.joylink.rtss.vo.client.map.newmap.MapTurnBackStrategyVO; -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.client.map.MapVO; import club.joylink.rtss.vo.client.map.newmap.MapAutomaticRouteButtonVO; import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO; +import club.joylink.rtss.vo.client.map.newmap.MapTotalGuideLockButtonVO; +import club.joylink.rtss.vo.client.map.newmap.MapTurnBackStrategyVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingStepVO; -import org.springframework.util.CollectionUtils; +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 org.springframework.util.StringUtils; import java.util.ArrayList; @@ -97,6 +97,9 @@ public interface GeneratorNew { } else if (mapButton instanceof MapTurnBackStrategyVO) { s.setDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode()); break; + } else if (mapButton instanceof MapTotalGuideLockButtonVO) { + s.setDeviceCode(((MapTotalGuideLockButtonVO) mapButton).getCode()); + break; } } case NULL: @@ -128,6 +131,8 @@ public interface GeneratorNew { trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode()); } else if (mapButton instanceof MapTurnBackStrategyVO) { trainingVO.setLocateDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode()); + } else if (mapButton instanceof MapTotalGuideLockButtonVO) { + trainingVO.setLocateDeviceCode(((MapTotalGuideLockButtonVO) mapButton).getCode()); } } } 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 493a1171f..2b4fdd213 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 @@ -5,8 +5,10 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew; import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.data.map.Cycle; import club.joylink.rtss.simulation.cbtc.data.map.Route; +import club.joylink.rtss.simulation.cbtc.data.map.SectionPath; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; @@ -179,17 +181,16 @@ public class SignalGeneratorNew implements GeneratorNew { case Signal_Human_Release_Route: { // 查询信号机为始端的进路列表,设置背景为进路排列,且进路接近区段占用 // todo 接近区段设置列车逻辑较复杂,推迟实现 + for (Route route : signal.getRouteList()) { + deviceStatusModifyTool.openRouteDirect(simulation, route); + deviceStatusModifyTool.closeSignalDirectly(route.getStart()); + deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001", signal.getSection(), signal.isRight()); + // todo 在接近区段设置一辆列车 + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); + // 仿真重置 + simulation.reset(); + } continue; -// List routeList = signal.getRouteList(); -// for (Route route : routeList) { -// deviceStatusModifyTool.openRouteDirect(simulation, route); -// List
approachSectionList = signal.getApproachSectionList(); -// // todo 在接近区段设置一辆列车 -// trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); -// // 仿真重置 -// simulation = SimulationBuilder.build(simulation.getBuildParams()); -// } -// continue; } case Signal_Close_Signal: { // 查询进路,设置背景为进路已排列 @@ -328,26 +329,28 @@ public class SignalGeneratorNew implements GeneratorNew { } case Signal_Set_Guide: { // 若信号机可开引导信号,则生成实训,暂不设置背景(暂时先简单处理,此处业务比较复杂,需明确后再生成各种情况的实训) -// if (!signal.isCallOn()) { // 不是引导信号机,不生成 -// continue; -// } else { -// //非折返进路办理引导 -// List notTurnBackRouteList = routeList.stream() -// .filter(route -> !route.isTurnBack()) -// .collect(Collectors.toList()); -// if (routeLikeHa1) { -// // 对于ATP进路、地面联锁进路、引导进路类的,取引导进路 -// notTurnBackRouteList = notTurnBackRouteList.stream() -// .filter(route -> route.isGuide()) -// .collect(Collectors.toList()); -// } -// for (Route route : notTurnBackRouteList) { -// trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); -// // 仿真重置 -// simulation.reset(); -// } -// continue; -// } + if (signal.isCallOn()) { // 不是引导信号机,不生成 + //非折返进路办理引导 + List notTurnBackRouteList = routeList.stream() + .filter(route -> !route.isTurnBack()) + .collect(Collectors.toList()); + if (routeLikeHa1) { + // 对于ATP进路、地面联锁进路、引导进路类的,取引导进路 + notTurnBackRouteList = notTurnBackRouteList.stream() + .filter(route -> route.isGuide()) + .collect(Collectors.toList()); + } + for (Route route : notTurnBackRouteList) { + if(simulation.getRepository().getConfig().isGuideNeedRouteSettingFirst()){ + deviceStatusModifyTool.openRouteDirect(simulation, route); + deviceStatusModifyTool.closeSignalDirectly(route.getStart()); + } + deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001",signal.getSection(),signal.isRight()); + trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO)); + // 仿真重置 + simulation.reset(); + } + } continue; } case Signal_Close_Guide: { diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java index 2cc1b6633..412f0c0ad 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java @@ -6,15 +6,21 @@ import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSele import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.TrainType; +import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; +import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.constants.MapPrdTypeEnum; +import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; +import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import java.util.*; @@ -22,6 +28,8 @@ import java.util.*; public class StandGeneratorNew implements GeneratorNew { protected static final int PARKING_TIME = 20; + @Autowired + private DeviceStatusModifyTool deviceStatusModifyTool; @Override public List generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { @@ -43,9 +51,11 @@ public class StandGeneratorNew implements GeneratorNew { stand.setTypeStrategy(Stand.TurnBackType.AUTO); break; case Stand_Set_Hold_Train_Auto: + stand.setTrainLimit(-1); + break; case Stand_Cancel_Hold_Train_Auto: - // 功能暂未实现,不生成 - continue; + stand.setTrainLimit(3); + break; case Stand_Set_Jump_Stop: { // todo 应该设置列车在上一车站,暂时简单处理 // 终点车站正常应不能设置跳停,暂时也不处理 @@ -69,9 +79,15 @@ public class StandGeneratorNew implements GeneratorNew { standList.forEach(stand1 -> stand1.setCenterHoldTrain(true)); break; } - case Stand_Early_Depart:{ - // 提前发车需要列车,暂不生成 - continue; + case Stand_Early_Depart: { + List routeList = simulation.getRepository().getRouteList(); + Route route = routeList.stream().filter(route1 -> + (route1.getStart().getSection() == stand.getSection() || route1.containSection(stand.getSection()) && !route1.routeLastSection(stand.getSection())) && Objects.equals(stand.isRight(), route1.getStart().isRight())).findAny().orElse(null); + if (Objects.nonNull(route)) { + deviceStatusModifyTool.openRouteDirect(simulation, route); + } + deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001", stand.getSection(), stand.isRight()); + break; } case Stand_Cancel_Jump_Stop:{ // 设置背景为全部跳停 diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java index 2ad4144c5..f1554dd78 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java @@ -5,11 +5,14 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew; import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.Simulation; -import club.joylink.rtss.simulation.cbtc.data.map.Route; -import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.data.map.*; +import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import java.time.LocalTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -17,7 +20,8 @@ import java.util.stream.Collectors; @GeneratorSelectorNew(operateObject = Operation.Object.Station) public class StationGeneratorNew implements GeneratorNew { - + @Autowired + private DeviceStatusModifyTool deviceStatusModifyTool; @Override public List generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { List trainingVOList = new ArrayList<>(); @@ -105,14 +109,66 @@ public class StationGeneratorNew implements GeneratorNew { }); continue; } -// simulation.getRepository().getSignalList().stream() -// .filter(s -> Objects.equals(station.getCode(), s.getDeviceStation().getCode())) -// .forEach(signal -> { -// if (!signal.isBlockade()) { -// signal.setBlockade(false); -// } -// }); break; + case Station_Power_On_Unlock: + if(!station.isCentralized()) { + continue; + } + station.setControlMode(Station.ControlMode.Local); + station.setRestartTime(LocalTime.now()); + List
sections = simulation.getRepository().getSectionList(); + sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), station)).forEach(section -> section.setFaultLock(true)); + break; + case Station_Set_Master_Guide_Lock: + if(!station.isCentralized()) { + continue; + } + station.setControlMode(Station.ControlMode.Local); + List switchList = simulation.getRepository().getSwitchList(); + List collect = switchList.stream().filter( + aSwitch -> Objects.equals(aSwitch.getDeviceStation(), station)).collect(Collectors.toList()); + collect.forEach(aSwitch -> aSwitch.setFault(Switch.SwitchFault.SPLIT)); + station.setControlMode(Station.ControlMode.Center); + if (operateDefinitionVO.guideTotalLockButton()) { + simulation.getBuildParams().getMap().getGraphDataNew().getTotalGuideLockButtonVOList() + .stream().filter(guideLockButtonVO -> guideLockButtonVO.getStationCode().equals(station.getCode())) + .forEach(button -> { + trainingVOList.add(this.build(config, simulation, station, button, operateDefinitionVO)); + simulation.reset(); + }); + continue; + } + break; + case Station_Cancel_Master_Guide_Lock: + if(station.isCentralized()) { + station.setTotalGuideLock(true); + station.setControlMode(Station.ControlMode.Local); + List switchList1 = simulation.getRepository().getSwitchList(); + switchList1.stream().filter(aSwitch -> Objects.equals(aSwitch.getDeviceStation(), station)).forEach(aSwitch -> aSwitch.setSingleLock(true)); + List signalList = simulation.getRepository().getSignalList(); + signalList.stream().filter(signal -> Objects.equals(signal.getDeviceStation(), station)).forEach(signal -> { + if (signal.isCallOn()) { + List routeList = signal.getRouteList(); + if (!CollectionUtils.isEmpty(routeList)) { + for (Route route : routeList) { + if (!route.isTurnBack()) { + this.deviceStatusModifyTool.openGuideRouteDirect(simulation, route); + trainingVOList.add(this.build(config, simulation, station, null, operateDefinitionVO)); + // 仿真重置 + simulation.reset(); + break; + } + } + } else if (Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号 + this.deviceStatusModifyTool.openGuideSignalDirectly(signal); + trainingVOList.add(this.build(config, simulation, station, null, operateDefinitionVO)); + // 仿真重置 + simulation.reset(); + } + } + }); + } + continue; default: // 其他操作,不生成 continue; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 093bac152..8e959fa05 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -179,9 +179,9 @@ public class Operation { Stand_Set_Hold_Train_Batch(), /**批量取消扣车*/ Stand_Cancel_Hold_Train_Batch(), - /** 区间列车数量限制 */ + /** 区间列车数量限制(自动扣车) */ Stand_Set_Hold_Train_Auto(), - /** 取消区间列车数量限制 */ + /** 取消区间列车数量限制(取消自动扣车) */ Stand_Cancel_Hold_Train_Auto(), /** 站台总取消 */ Stand_Total_Cancel, @@ -209,6 +209,8 @@ public class Operation { CM_Surrender_Control(), /** 连锁控 */ CM_Interlock_Control(), + /** 回复中控请求(同意/拒绝) */ + CM_Reply_Interlock_Control(), //--------------------------- 集中车站 --------------------------- /** 设置折返策略 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StandOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StandOperateHandler.java index aade50902..8ef427578 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StandOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StandOperateHandler.java @@ -137,8 +137,8 @@ public class StandOperateHandler { * 区间列车数量限制 */ @OperateHandlerMapping(type = Operation.Type.Stand_Set_Hold_Train_Auto) - public void setHoldTrainAuto() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); + public void setHoldTrainAuto(Simulation simulation, String standCode, int limit) { + atsStandService.setAutoHoldTrainLimit(simulation, standCode, limit); } @@ -146,8 +146,8 @@ public class StandOperateHandler { * 取消区间列车数量限制 */ @OperateHandlerMapping(type = Operation.Type.Stand_Cancel_Hold_Train_Auto) - public void cancelHoldTrainAuto() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); + public void cancelHoldTrainAuto(Simulation simulation, String standCode) { + atsStandService.setAutoHoldTrainLimit(simulation, standCode, -1); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java index b6c2257c6..1a3f27e6a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java @@ -102,9 +102,9 @@ public class StationOperateHandler { * 上电解锁 */ @OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock) - public void powerOnUnlock() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); - + public void powerOnUnlock(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + ciApiService.powerOnUnlock(simulation, repository.getByCode(stationCode, Station.class)); } /** @@ -143,6 +143,12 @@ public class StationOperateHandler { atsStationService.applyForCenterControl(simulation, fromMember, stationCodes); } + /**连锁控*/ + @OperateHandlerMapping(type = Operation.Type.CM_Interlock_Control) + public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List stationCodes){ + atsStationService.applyForInterlockControl(simulation, fromMember, stationCodes); + } + /**强制站控-l*/ @OperateHandlerMapping(type = Operation.Type.CM_Force_Station_Control) public void forceForStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes){ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java index f64463595..db0d941b3 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java @@ -277,6 +277,14 @@ public class AtsStandService { stand.setRunLevelTimeForever(alwaysValid); } + /** + * 设置站间列车数量 + */ + public void setAutoHoldTrainLimit(Simulation simulation, String standCode, int limit) { + Stand stand = getStand(simulation, standCode); + stand.setTrainLimit(limit); + } + /** * 设置人工折返策略 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index 6afca0d3e..28bc8070b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -61,7 +61,7 @@ public class AtsStationService { station.setTotalGuideLock(true); List switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); if (!CollectionUtils.isEmpty(switches)) { - switches.forEach(s -> s.setMasterGuideLock(true)); + switches.forEach(s -> s.setSingleLock(true)); } } @@ -77,7 +77,7 @@ public class AtsStationService { station.setTotalGuideLock(false); List switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); if (!CollectionUtils.isEmpty(switches)) { - switches.forEach(s -> s.setMasterGuideLock(false)); + switches.forEach(s -> s.setSingleLock(false)); } } @@ -217,6 +217,20 @@ public class AtsStationService { } + /** + * 请求连锁控处理 + */ + public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "连锁控的车站不能为空"); + } + stationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + station.setControlMode(Station.ControlMode.Interlock); + }); + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)), Operation.Type.CM_Reply_Interlock_Control, null, true, stationCodes)); + + } /** * 回复站控请求c */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java index 2eb1fe61d..ff007355b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java @@ -305,6 +305,9 @@ public interface CiApiService { */ void restart(Simulation simulation, Station station); + /**上电解锁*/ + void powerOnUnlock(Simulation simulation, Station station); + /** * 站台紧急停车 */ 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 2fd99938b..e9b422b9f 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 @@ -18,6 +18,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.time.LocalTime; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -397,7 +398,7 @@ public class CiApiServiceImpl implements CiApiService { } BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode())); boolean signalApproachOccupied = signal.getApproachPathList() - .stream().anyMatch(sectionPath -> sectionPath.getLogicList().stream().anyMatch(Section::isOccupied)); + .stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied)); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied, String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName())); //办理引导进路或开放引导信号 @@ -468,8 +469,21 @@ public class CiApiServiceImpl implements CiApiService { .filter(signal -> signal.getDeviceStation().equals(deviceStation)).collect(Collectors.toList()); signals.forEach(Signal::reset); deviceStation.setInterlockMachineStarting(false); + deviceStation.setRestartTime(LocalTime.now()); } + @Override + public void powerOnUnlock(Simulation simulation, Station station){ + if (!station.isCentralized()) { + station = station.getDeviceStation(); + } + Station deviceStation = station; + if (Objects.nonNull(deviceStation.getRestartTime()) && deviceStation.getRestartTime().plusMinutes(8).isBefore(LocalTime.now())) { + List
sections = simulation.getRepository().getSectionList(); + sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), deviceStation)).forEach(Section::faultUnlock); + } + throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("无效操作或连锁机重启过8分钟需手动解锁"); + } @Override public void standEB(Simulation simulation, Stand stand) { if (stand.getEsp() == null) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java index bed268f0b..60785e59d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java @@ -538,7 +538,9 @@ public class Route extends MapNamedElement { } return sections; } - + public boolean routeLastSection(Section section) { + return Objects.equals(this.sectionList.get(sectionList.size()-1),section); + } /** * 进路检查失败原因 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java index ee4801d4e..e815a2cbd 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java @@ -109,6 +109,11 @@ public class Stand extends MayOutOfOrderDevice { */ private boolean runLevelTimeForever; + /** + * 区间列车数量限制(自动扣车)(不限制-1) + */ + private int trainLimit; + /*停站时间相关*/ /** * 停车时间(自动为-1) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java index b03f5b972..4feee7ea2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java @@ -12,6 +12,7 @@ import lombok.NonNull; import lombok.Setter; import org.springframework.util.CollectionUtils; +import java.time.LocalTime; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -156,6 +157,11 @@ public class Station extends MayOutOfOrderDevice { */ private boolean interlockMachineStarting; + /** + * 联锁机重启时间 + */ + private LocalTime restartTime; + @Override public void reset() { super.reset(); @@ -473,6 +479,7 @@ public class Station extends MayOutOfOrderDevice { if (!Objects.equals(this, device.getFault())) return; station.setInterlockMachineStarting(true); + station.setRestartTime(null); station.setFault(null); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java index 333f481f7..6ba8faf93 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java @@ -63,6 +63,9 @@ public class StandStatus extends DeviceStatus { @JsonSerialize(using = Boolean2NumSerializer.class) private boolean runLevelTimeForever; + /**区间列车数量限制(不限制为-1)*/ + private int trainLimit; + /**停车时间(自动为-1)*/ private int parkingTime; @@ -97,6 +100,7 @@ public class StandStatus extends DeviceStatus { } this.runLevelTime = stand.getRunLevelTime(); this.runLevelTimeForever = stand.isRunLevelTimeForever(); + this.trainLimit = stand.getTrainLimit(); this.parkingTime = stand.getParkingTime(); this.parkingAlwaysValid = stand.isParkingAlwaysValid(); this.noStatus = stand.isNoStatus(); @@ -170,6 +174,11 @@ public class StandStatus extends DeviceStatus { status.setRunLevelTimeForever(this.runLevelTimeForever); change = true; } + if (!Objects.equals(this.trainLimit, stand.getTrainLimit())) { + this.trainLimit = stand.getTrainLimit(); + status.setTrainLimit(this.trainLimit); + change = true; + } if (!Objects.equals(this.parkingTime, stand.getParkingTime())) { this.parkingTime = stand.getParkingTime(); status.setParkingTime(this.parkingTime); @@ -203,6 +212,7 @@ public class StandStatus extends DeviceStatus { StandStatusVO statusVO = new StandStatusVO((Stand) device); statusVO.setParkingAlwaysValid(parkingAlwaysValid); statusVO.setParkingTime(parkingTime); + statusVO.setTrainLimit(trainLimit); statusVO.setRunLevelTimeForever(runLevelTimeForever); statusVO.setRunLevelTime(runLevelTime); statusVO.setAssignSkip(assignSkip); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java index 862c2dd8c..9fccfba2c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java @@ -10,6 +10,7 @@ import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import lombok.Getter; +import java.time.LocalTime; import java.util.Objects; /** @@ -50,6 +51,9 @@ public class StationStatus extends DeviceStatus { */ private Integer validDuration; + /**连锁机上电重启时间*/ + private LocalTime restartTime; + public StationStatus(Station station) { super(station.getCode(), station.getDeviceType()); this.controlMode = station.getControlMode(); @@ -58,6 +62,7 @@ public class StationStatus extends DeviceStatus { this.applicantId = station.getApplicantId(); this.apply2TheControlMode = station.getApply2TheControlMode(); this.validDuration = station.getValidDurationInSeconds(); + this.restartTime = station.getRestartTime(); } @Override @@ -95,6 +100,12 @@ public class StationStatus extends DeviceStatus { this.validDuration = station.getValidDurationInSeconds(); } status.setValidDuration(validDuration); + + if (!Objects.equals(this.restartTime, station.getRestartTime())) { + change = true; + this.restartTime = station.getRestartTime(); + status.setRestartTime(restartTime); + } return change; } @@ -107,6 +118,7 @@ public class StationStatus extends DeviceStatus { statusVO.setApplicantId(applicantId); statusVO.setApply2TheControlMode(apply2TheControlMode); statusVO.setValidDuration(validDuration); + statusVO.setRestartTime(restartTime); return statusVO; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java index c2cfda7bf..19b8cd162 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java @@ -60,6 +60,9 @@ public class StandStatusVO extends DeviceStatusVO { @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean runLevelTimeForever; + /**区间列车数量限制(自不限制-1)*/ + private Integer trainLimit; + /**停车时间(自动为-1)*/ private Integer parkingTime; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java index 0c2c3c44e..526f9fa20 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java @@ -10,6 +10,7 @@ import lombok.Getter; import lombok.Setter; import java.time.LocalDateTime; +import java.time.LocalTime; /** * 车站状态 @@ -49,6 +50,8 @@ public class StationStatusVO extends DeviceStatusVO { @JsonInclude() private Integer validDuration; + private LocalTime restartTime; + public StationStatusVO(Station station) { super(station.getCode(), station.getDeviceType()); } 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 80087693a..bac1de2e0 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 @@ -1,11 +1,14 @@ package club.joylink.rtss.simulation.cbtc.tool; +import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService; import club.joylink.rtss.simulation.cbtc.CI.service.RouteService; import club.joylink.rtss.simulation.cbtc.Simulation; 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.data.vr.VirtualRealityTrain; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -25,6 +28,8 @@ public class DeviceStatusModifyTool { @Autowired private RouteService routeService; + @Autowired + private AtsTrainLoadService atsTrainLoadService; /** * 直接开放进路 @@ -238,4 +243,8 @@ public class DeviceStatusModifyTool { } } } + + public void loadManualTrainOfGroup(Simulation simulation, String groupNumber, Section section , boolean right){ + atsTrainLoadService.loadSpareTrain(simulation, groupNumber, section.getCode(),right); + } } diff --git a/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionConfig.java b/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionConfig.java index 777c7994b..ce17426b9 100644 --- a/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionConfig.java +++ b/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionConfig.java @@ -22,6 +22,8 @@ public class OperateDefinitionConfig { //折返策略按钮 private Boolean tbStrategyBT; + private Boolean guideTotalLockBT; + private List sectionTypes;//区段生成指定类型 public boolean isAtp() { @@ -62,4 +64,10 @@ public class OperateDefinitionConfig { } return false; } + public boolean guideTotalLockButton(){ + if(Objects.nonNull(guideTotalLockBT)){ + return guideTotalLockBT; + } + return false; + } } diff --git a/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionVO.java b/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionVO.java index 93544aba5..7aa300fcc 100644 --- a/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/training/definition/OperateDefinitionVO.java @@ -189,6 +189,14 @@ public class OperateDefinitionVO { return false; } + public boolean guideTotalLockButton() { + OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig(); + if (Objects.nonNull(routeSettingConfig)) { + return routeSettingConfig.guideTotalLockButton(); + } + return false; + } + public List getSectionTypes() { OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig(); if (Objects.nonNull(routeSettingConfig)) {