diff --git a/src/main/java/club/joylink/rtss/services/training/constant/TrainingConsts.java b/src/main/java/club/joylink/rtss/services/training/constant/TrainingConsts.java index bdc610b24..d73101a5e 100644 --- a/src/main/java/club/joylink/rtss/services/training/constant/TrainingConsts.java +++ b/src/main/java/club/joylink/rtss/services/training/constant/TrainingConsts.java @@ -25,6 +25,8 @@ public interface TrainingConsts { /** 步骤所需code类型 */ enum CodeType { + /** 空值 */ + NULL, /** 区段 */ SECTION, /** 道岔 */ 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 6ed81524f..e5b04608c 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 @@ -94,6 +94,8 @@ public interface GeneratorNew { break; } } + case NULL: + break; default: s.setDeviceCode(mapDevice.getCode()); } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java index d00028eb5..e51698feb 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java @@ -1,5 +1,6 @@ package club.joylink.rtss.services.training.generatornew.base; +import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.services.training.data.GenerateConfig; import club.joylink.rtss.services.training.generatornew.GeneratorNew; import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew; @@ -33,10 +34,16 @@ public class ControlGeneratorNew implements GeneratorNew { case CM_Force_Station_Control: case CM_Emergency_Station_Control: case CM_Apply_For_Station_Control: // 请求/强制/紧急站控,设置背景为中控 - case CM_Surrender_Control: - case CM_Receive_Control: station.setControlMode(Station.ControlMode.Center); break; + case CM_Receive_Control: + station.setControlMode(Station.ControlMode.None); + break; + case CM_Surrender_Control: + if(BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())){ + station.setControlMode(Station.ControlMode.Local); + } + break; default: // 其他操作,不生成 continue; diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java index 6e6bc33a5..f19b0be36 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java @@ -7,6 +7,7 @@ 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.data.map.Section; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; import org.springframework.util.CollectionUtils; @@ -31,7 +32,7 @@ public class SectionGeneratorNew implements GeneratorNew { continue; } if (CollectionUtils.isEmpty(operateDefinitionVO.getSectionTypes())) { - if (section.isSwitchTrack() || section.isSwitchAxleCounterSection() || section.isLogicSection()) { // 道岔区段不生成 + if (section.isSwitchTrack() || section.isSwitchAxleCounterSection() || section.isLogicSection() || section.isCross()) { // 道岔区段不生成 continue; } }else{ @@ -110,8 +111,12 @@ public class SectionGeneratorNew implements GeneratorNew { } break; case Section_Axis_Pre_Reset: - // todo 因为操作暂未实现,此实训暂不生成 - continue; + VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter(); + virtualAxleCounter.setOccupy(true); + virtualAxleCounter.setPreReset(false); + virtualAxleCounter.setLeftCount(2); + virtualAxleCounter.setRightCount(2); + break; default: // 其他操作,不生成 continue; 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 90cbac67e..5d6ed5290 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 @@ -99,6 +99,9 @@ public class SignalGeneratorNew implements GeneratorNew { case Signal_Set_CI_Auto_Trigger: { if (!CollectionUtils.isEmpty(routeList)) { if (routeLikeHa1) { + if (simulation.getRepository().getConfig().isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger()) { + routeList.forEach(route -> route.setAtsControl(false)); + } trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); simulation.reset(); continue; @@ -112,10 +115,14 @@ public class SignalGeneratorNew implements GeneratorNew { if (route.isGuide()) { // 引导进路跳过 continue; } + if (simulation.getRepository().getConfig().isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger()) { + route.setAtsControl(false); + } + } trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); - } + } } continue; 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 065de0c25..efda92bfa 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 @@ -5,13 +5,18 @@ 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.constant.TrainType; +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.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.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; -import java.util.ArrayList; -import java.util.List; +import java.util.*; @GeneratorSelectorNew(operateObject = Operation.Object.Stand) public class StandGeneratorNew implements GeneratorNew { @@ -30,15 +35,13 @@ public class StandGeneratorNew implements GeneratorNew { switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) { case Stand_View_Status: case Stand_Set_Hold_Train: + case Stand_Set_Hold_Train_Batch: case Stand_Set_Park_Time: // 无背景 break; case Stand_Set_Reentry_Strategy: stand.setTypeStrategy(Stand.TurnBackType.AUTO); break; - case Stand_Force_Cancel_Hold_Train: - case Stand_Set_Hold_Train_Batch: - case Stand_Cancel_Hold_Train_Batch: case Stand_Set_Hold_Train_Auto: case Stand_Cancel_Hold_Train_Auto: // 功能暂未实现,不生成 @@ -48,7 +51,11 @@ public class StandGeneratorNew implements GeneratorNew { // 终点车站正常应不能设置跳停,暂时也不处理 break; } - case Stand_Cancel_Hold_Train:{ + case Stand_Force_Cancel_Hold_Train: + stand.setCenterHoldTrain(true); + break; + case Stand_Cancel_Hold_Train: + case Stand_Cancel_Hold_Train_Batch: { if (MapPrdTypeEnum.LOCAL.equals(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))) { // 现地,设置背景为现地扣车 stand.setStationHoldTrain(true); 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 14be7ea5f..1201e9ba3 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 @@ -22,10 +22,7 @@ public class StationGeneratorNew implements GeneratorNew { public List generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { List trainingVOList = new ArrayList<>(); //找到所有有控制模式的车站 - List stationList = simulation.getRepository().getStationList() - .stream() - .filter(station -> station.isHasControlMode()) - .collect(Collectors.toList()); + List stationList = simulation.getRepository().getStationList(); //对每个站根据实训设置场景 for (Station station : stationList) { switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) { @@ -51,6 +48,7 @@ public class StationGeneratorNew implements GeneratorNew { } break; case Station_Open_Auto_Setting: + if(!station.isInterlock())continue; station.setControlMode(Station.ControlMode.Center); List routeList3 = simulation.getRepository().getRouteList(); for (Route route : routeList3) { @@ -62,6 +60,7 @@ public class StationGeneratorNew implements GeneratorNew { } break; case Station_Close_Auto_Setting: + if(!station.isInterlock())continue; List routeList4 = simulation.getRepository().getRouteList(); station.setControlMode(Station.ControlMode.Center); for (Route route : routeList4) { @@ -92,9 +91,6 @@ public class StationGeneratorNew implements GeneratorNew { // } // }); break; - case Station_Set_Turn_Back_Strategy: - station.setControlMode(Station.ControlMode.Center); - break; default: // 其他操作,不生成 continue; 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 9bd9d0ccd..cc68420d1 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 @@ -6,7 +6,9 @@ import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSele 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.Section; 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.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; @@ -96,8 +98,13 @@ public class SwitchGeneratorNew implements GeneratorNew { break; } case Switch_Axle_Pre_Reset:{ - // todo 操作暂未实现,实训暂不生成 - continue; + aSwitch.setPreReset(false); + VirtualRealitySectionAxleCounter virtualAxleCounter = aSwitch.getA().getParent().getVirtualAxleCounter(); + virtualAxleCounter.setOccupy(true); + virtualAxleCounter.setPreReset(false); + virtualAxleCounter.setLeftCount(3); + virtualAxleCounter.setRightCount(3); + break; } case Switch_Confirm_Axis_Valid:{ // 背景为道岔计轴失效 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/OperateMethod.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/OperateMethod.java index 50f6b52b7..a1d2faecb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/OperateMethod.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/OperateMethod.java @@ -62,7 +62,7 @@ public class OperateMethod { ParameterizedType parameterizedType = (ParameterizedType) parameter.getParameterizedType(); Class actualClass = (Class) parameterizedType.getActualTypeArguments()[0]; args[i] = JsonUtils.read(JsonUtils.writeValueAsString(param.get(parameter.getName())), - JsonUtils.getCollectionType(ArrayList.class, actualClass)); + JsonUtils.getCollectionType(parameter.getType(), actualClass)); } else if (parameter.getType().isEnum()) { Object o = param.get(parameter.getName()); Object[] enumConstants = parameter.getType().getEnumConstants(); 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 c19ec43d0..aade50902 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 @@ -11,6 +11,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + @Slf4j @OperateHandler public class StandOperateHandler { @@ -115,18 +117,20 @@ public class StandOperateHandler { * 批量扣车 */ @OperateHandlerMapping(type = Operation.Type.Stand_Set_Hold_Train_Batch) - public void setHoldTrainBatch() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); - + public void setHoldTrainBatch(Simulation simulation, List standCodes) { + for (String standCode : standCodes) { + this.atsStandService.holdTrain(simulation, standCode); + } } /** * 批量取消扣车 */ @OperateHandlerMapping(type = Operation.Type.Stand_Cancel_Hold_Train_Batch) - public void cancelHoldTrainBatch() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); - + public void cancelHoldTrainBatch(Simulation simulation, List standCodes) { + for (String standCode : standCodes) { + this.atsStandService.cancelHoldTrain(simulation, standCode); + } } /**