【分散自律同意、不同意逻辑处理】

This commit is contained in:
weizhihong 2023-02-17 14:21:52 +08:00
parent aad3a16d5b
commit eac12826d1
3 changed files with 17 additions and 35 deletions

View File

@ -628,14 +628,9 @@ public class Operation {
Station_Switch_Control_Operation_Mode(new Label[]{Label.CLIENT},true),
/**
* 分散自律同意转换
* 分散自律同意不同意转换
*/
Station_Agree_Operation_Mode(new Label[]{Label.CLIENT},true),
/**
* 分散自律不同意转换
*/
Station_No_Agree_Operation_Mode(new Label[]{Label.CLIENT},true),
Station_Handle_Operation_Mode_Apply(new Label[]{Label.CLIENT},true),
//--------------------------- 列车 ---------------------------
/**
* 在指定区段加载一辆计划列车本地开发使用

View File

@ -338,18 +338,10 @@ public class StationOperateHandler {
}
/**
* 分散自律同意转换模式操作
* 分散自律同意不同意转换模式操作
*/
@OperateHandlerMapping(type = Operation.Type.Station_Agree_Operation_Mode)
public void agreeOperationModel(Simulation simulation, List<String> stationCodes) {
atsStationService.agreeOperationMode(simulation, stationCodes);
}
/**
* 分散自律不同意转换模式操作
*/
@OperateHandlerMapping(type = Operation.Type.Station_No_Agree_Operation_Mode)
public void noAgreeOperationModel(Simulation simulation, List<String> stationCodes) {
atsStationService.noAgreeOperationMode(simulation, stationCodes);
@OperateHandlerMapping(type = Operation.Type.Station_Handle_Operation_Mode_Apply)
public void handleOperationModelApply(Simulation simulation, List<String> agreeStationCodes, List<String> noAgreeStationCodes) {
atsStationService.handleOperationModelApply(simulation, agreeStationCodes, noAgreeStationCodes);
}
}

View File

@ -637,28 +637,21 @@ public class AtsStationService {
}
/**
* 同意分散自律操作模式转换
* 分散自律同意不同意转换模式操作
*
* @param simulation 仿真
* @param stationCodes 车站编码
* @param agreeStationCodes 同意车站编码
* @param noAgreeStationCodes 不同意车站编码
*/
public void agreeOperationMode(Simulation simulation, List<String> stationCodes) {
stationCodes.forEach(stationCode -> {
public void handleOperationModelApply(Simulation simulation, List<String> agreeStationCodes, List<String> noAgreeStationCodes) {
agreeStationCodes.forEach(stationCode -> {
Station station = getStation(simulation, stationCode);
if (station.getOperationModeApplication() != null) {
doOperationModeSwitch(station);
}
});
}
/**
* 不同意分散自律操作模式转换
*
* @param simulation 仿真
* @param stationCodes 车站编码
*/
public void noAgreeOperationMode(Simulation simulation, List<String> stationCodes) {
stationCodes.forEach(stationCode -> {
// 不同意分散自律操作模式转换
noAgreeStationCodes.forEach(stationCode -> {
Station station = getStation(simulation, stationCode);
station.setOperationModeApplication(null);
});
@ -717,7 +710,9 @@ public class AtsStationService {
*/
public void doOperationModeSwitch(Station station) {
Station.OperationModeApplication applyOperation = station.getOperationModeApplication();
station.setOperationMode(applyOperation.getTarget());
station.setOperationModeApplication(null);
if (applyOperation != null) {
station.setOperationMode(applyOperation.getTarget());
station.setOperationModeApplication(null);
}
}
}