Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-02-02 18:35:59 +08:00
commit b5c3d1867e
10 changed files with 65 additions and 28 deletions

View File

@ -25,6 +25,8 @@ public interface TrainingConsts {
/** 步骤所需code类型 */
enum CodeType {
/** 空值 */
NULL,
/** 区段 */
SECTION,
/** 道岔 */

View File

@ -94,6 +94,8 @@ public interface GeneratorNew {
break;
}
}
case NULL:
break;
default:
s.setDeviceCode(mapDevice.getCode());
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
@ -111,11 +114,15 @@ 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;

View File

@ -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);

View File

@ -22,10 +22,7 @@ public class StationGeneratorNew implements GeneratorNew {
public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) {
List<TrainingNewVO> trainingVOList = new ArrayList<>();
//找到所有有控制模式的车站
List<Station> stationList = simulation.getRepository().getStationList()
.stream()
.filter(station -> station.isHasControlMode())
.collect(Collectors.toList());
List<Station> 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<Route> 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<Route> 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;

View File

@ -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:{
// 背景为道岔计轴失效

View File

@ -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();

View File

@ -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<String> 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<String> standCodes) {
for (String standCode : standCodes) {
this.atsStandService.cancelHoldTrain(simulation, standCode);
}
}
/**