【增加改方按钮抬起验证】

This commit is contained in:
weizhihong 2023-04-19 17:21:35 +08:00
parent dc68b2daeb
commit 91ad315825

View File

@ -73,6 +73,26 @@ public class StationDirectionService {
} }
}; };
/**
* 改方按钮抬起验证
*/
private final ButtonValidInterface turnDirectionPressUpValid = (simulation, stationDirection) -> {
// 原接车站无发车进路锁闭
boolean isDeliverConflict = stationDirection.getDeliverRouteList().stream().anyMatch(Route::isLock);
if (isDeliverConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在发车进路");
}
// 原发车站无发车进路锁闭
StationDirection relativeDirection = getRelativeStationDirection(simulation, stationDirection);
boolean isReceiverConflict = relativeDirection != null;
if (isReceiverConflict) {
isReceiverConflict = relativeDirection.getReceiveRouteList().stream().anyMatch(Route::isLock);
}
if (isReceiverConflict) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:相对方向存在接车进路");
}
};
/** /**
* 总辅助校验 * 总辅助校验
*/ */
@ -311,6 +331,8 @@ 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_UP_TURN_DIRECTION, this.turnDirectionPressUpValid);
// 总辅助按下验证函数 // 总辅助按下验证函数
this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_MAIN_ASSIST, this.turnAssistValid); this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_MAIN_ASSIST, this.turnAssistValid);
// 接辅助按下验证函数 // 接辅助按下验证函数