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

This commit is contained in:
joylink_zhangsai 2022-07-14 10:16:29 +08:00
commit e1f1d8bc5e
3 changed files with 56 additions and 15 deletions

View File

@ -52,9 +52,10 @@ public class StationDirectionOperateHandler {
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_MAIN_ASSIST) @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_MAIN_ASSIST)
public void pressMainAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum public void pressMainAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum
, Integer pressDown) { , Integer pressDown) {
ButtonValidInterface validInterface = stationDirectionService.getValidMethodByType(Operation.Type.ASSIST_PRESS_MAIN_ASSIST);
ButtonThenInterface thenInterface = stationDirectionService.getThenMethodByType(Operation.Type.ASSIST_PRESS_MAIN_ASSIST); ButtonThenInterface thenInterface = stationDirectionService.getThenMethodByType(Operation.Type.ASSIST_PRESS_MAIN_ASSIST);
stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum
, StationDirection.ButtonTypeEnum.MAIN_ASSIST, (pressDown == 1), null, thenInterface); , StationDirection.ButtonTypeEnum.MAIN_ASSIST, (pressDown == 1), validInterface, thenInterface);
} }
/** /**

View File

@ -52,11 +52,20 @@ public class StationDirectionService {
if (StationDirection.IndicatorStatusEnum.O.equals(stationDirection.getSectionAspect())) { if (StationDirection.IndicatorStatusEnum.O.equals(stationDirection.getSectionAspect())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲");
} }
// 接车进路锁闭有车进入 // 原接车站无接车进路锁闭
boolean isReceiveConflict = stationDirection.getReceiveRouteList().stream().anyMatch(Route::isLock); boolean isReceiveConflict = stationDirection.getReceiveRouteList().stream().anyMatch(Route::isLock);
if (isReceiveConflict) { if (isReceiveConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在接车进路冲突"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在接车进路冲突");
} }
// 原发车站无发车进路锁闭
StationDirection relativeDirection = getRelativeStationDirection(simulation, stationDirection);
boolean isDeliverConflict = relativeDirection != null;
if (isDeliverConflict) {
isDeliverConflict = relativeDirection.getDeliverRouteList().stream().anyMatch(Route::isLock);
}
if (isDeliverConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:相对方向存在发车进路");
}
// 查找发车进路方向的站台上是否有停靠列车 // 查找发车进路方向的站台上是否有停靠列车
Optional<Route> routeOptional = stationDirection.getReceiveRouteList().stream().findAny(); Optional<Route> routeOptional = stationDirection.getReceiveRouteList().stream().findAny();
if (routeOptional.isEmpty()) { if (routeOptional.isEmpty()) {
@ -65,9 +74,28 @@ public class StationDirectionService {
}; };
/** /**
* 发辅助按钮操作校验 * 总辅助校验
*/ */
private final ButtonValidInterface turnAssistValid = (simulation, stationDirection) -> { private final ButtonValidInterface turnAssistValid = (simulation, stationDirection) -> {
// 原接车站无接车进路锁闭
boolean isReceiveConflict = stationDirection.getReceiveRouteList().stream().anyMatch(Route::isLock);
// 原发车站无发车进路锁闭
boolean isDeliverConflict = stationDirection.getDeliverRouteList().stream().anyMatch(Route::isLock);
// 相对车站
StationDirection relativeDirection = getRelativeStationDirection(simulation, stationDirection);
if (relativeDirection != null) {
isReceiveConflict = isReceiveConflict || relativeDirection.getReceiveRouteList().stream().anyMatch(Route::isLock);
isDeliverConflict = isDeliverConflict || relativeDirection.getDeliverRouteList().stream().anyMatch(Route::isLock);
}
if (isReceiveConflict || isDeliverConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在锁闭进路");
}
};
/**
* 发辅助按钮操作校验
*/
private final ButtonValidInterface deliverAssistValid = (simulation, stationDirection) -> {
if (!stationDirection.isMainAssistStatus()) { if (!stationDirection.isMainAssistStatus()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:总辅助按钮未按下"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:总辅助按钮未按下");
} }
@ -78,7 +106,9 @@ public class StationDirectionService {
*/ */
private final ButtonValidInterface receiveAssistValid = (simulation, stationDirection) -> { private final ButtonValidInterface receiveAssistValid = (simulation, stationDirection) -> {
// 判断总辅助 // 判断总辅助
this.turnAssistValid.valid(simulation, stationDirection); if (!stationDirection.isMainAssistStatus()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:总辅助按钮未按下");
}
// 发车方向 // 发车方向
StationDirection deliverDirection = getRelativeStationDirection(simulation, stationDirection); StationDirection deliverDirection = getRelativeStationDirection(simulation, stationDirection);
if (deliverDirection == null) { if (deliverDirection == null) {
@ -118,11 +148,10 @@ public class StationDirectionService {
* 总辅助后续操作 * 总辅助后续操作
*/ */
private final ButtonThenInterface turnAssistThen = (simulation, stationDirection) -> { private final ButtonThenInterface turnAssistThen = (simulation, stationDirection) -> {
// 总辅助弹起后接发辅助倒计时重置 // 总辅助弹起后
if (!stationDirection.isMainAssistStatus()) { if (!stationDirection.isMainAssistStatus()) {
stationDirection.setReceiveAssistStatus(false); // 接发辅助倒计时重置
stationDirection.setDeliverAssistStatus(false); stationDirection.resetAssistStatus();
stationDirection.getRemain().set(0);
// 总辅助抬起后将辅助准备状态 // 总辅助抬起后将辅助准备状态
stationDirection.setAssistReadyStatus(false); stationDirection.setAssistReadyStatus(false);
// 相对方向辅助准备状态也恢复 // 相对方向辅助准备状态也恢复
@ -140,13 +169,15 @@ public class StationDirectionService {
// 接辅助完成后,改变接方向 // 接辅助完成后,改变接方向
stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R); stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R);
stationDirection.setAssistReadyStatus(true); stationDirection.setAssistReadyStatus(true);
// 邻站修改发方向
StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection);
adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D);
adjacentDirection.setAssistReadyStatus(true);
// 办理完成后 // 办理完成后
stationDirection.resetAssistStatus(); stationDirection.resetAssistStatus();
// 邻站修改发方向
StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection);
if (adjacentDirection != null) {
adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D);
adjacentDirection.setAssistReadyStatus(true);
adjacentDirection.resetAssistStatus(); adjacentDirection.resetAssistStatus();
}
}; };
/** /**
@ -157,6 +188,13 @@ public class StationDirectionService {
stationDirection.setReceiveAssistStatus(false); stationDirection.setReceiveAssistStatus(false);
// 重新设置倒计时时间 // 重新设置倒计时时间
stationDirection.getRemain().set(StationDirection.DEFAULT_DELIVER_DELAY_TIME); stationDirection.getRemain().set(StationDirection.DEFAULT_DELIVER_DELAY_TIME);
// 就绪状态恢复
stationDirection.setAssistReadyStatus(false);
// 邻站修改发方向
StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection);
if (adjacentDirection != null) {
adjacentDirection.setAssistReadyStatus(false);
}
}; };
/** /**
@ -264,10 +302,12 @@ public class StationDirectionService {
this.operationButtonValidMap = new HashMap<>(); this.operationButtonValidMap = new HashMap<>();
// 改方按下验证函数 // 改方按下验证函数
this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION, this.turnDirectionPressDownValid); this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION, this.turnDirectionPressDownValid);
// 总辅助按下验证函数
this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_MAIN_ASSIST, this.turnAssistValid);
// 接辅助按下验证函数 // 接辅助按下验证函数
this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_RECEIVE_ASSIST, this.receiveAssistValid); this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_RECEIVE_ASSIST, this.receiveAssistValid);
// 发辅助按下验证函数 // 发辅助按下验证函数
this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_DELIVER_ASSIST, this.turnAssistValid); this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_DELIVER_ASSIST, this.deliverAssistValid);
// 操作按钮后续操作集合 // 操作按钮后续操作集合
this.operationButtonThenMap = new HashMap<>(); this.operationButtonThenMap = new HashMap<>();
// 总辅助后续操作 // 总辅助后续操作

View File

@ -259,7 +259,7 @@ public class StationDirection extends MapNamedElement {
this.receiveAssistStatus = false; this.receiveAssistStatus = false;
} }
// 如果总辅助接发任意一方按下为白灯 // 如果总辅助接发任意一方按下为白灯
if (this.mainAssistStatus && (this.deliverAssistStatus || this.receiveAssistStatus)) { if (this.mainAssistStatus && (this.deliverAssistStatus || this.receiveAssistStatus || this.assistReadyStatus)) {
this.assistAspect = IndicatorStatusEnum.O; this.assistAspect = IndicatorStatusEnum.O;
} else { } else {
this.assistAspect = IndicatorStatusEnum.F; this.assistAspect = IndicatorStatusEnum.F;