【接发辅助灯状态逻辑重写】
【辅助按钮操作(逻辑未完成)】
This commit is contained in:
parent
765d830bed
commit
c56e657ecf
@ -839,6 +839,21 @@ public class Operation {
|
||||
* 改方按钮操作
|
||||
*/
|
||||
ASSIST_PRESS_DOWN_TURN_DIRECTION,
|
||||
|
||||
/**
|
||||
* 总辅助按钮操作
|
||||
*/
|
||||
ASSIST_PRESS_MAIN_ASSIST,
|
||||
|
||||
/**
|
||||
* 接辅助按钮操作
|
||||
*/
|
||||
ASSIST_PRESS_RECEIVE_ASSIST,
|
||||
|
||||
/**
|
||||
* 发辅助按钮操作
|
||||
*/
|
||||
ASSIST_PRESS_DELIVER_ASSIST
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ public class StationDirectionOperateHandler {
|
||||
*
|
||||
* @param simulation 仿真数据
|
||||
* @param stationCode 车站编码
|
||||
* @param labelEnum 按钮类型
|
||||
* @param labelEnum 运行方向
|
||||
* @param pressDown 弹起:0;按下:1
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION)
|
||||
@ -38,4 +38,44 @@ public class StationDirectionOperateHandler {
|
||||
, Button.ButtonTypeEnum.CHANGE_DIRECTION, isPressDown, validInterface, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总辅助按钮操作
|
||||
*
|
||||
* @param simulation 仿真数据
|
||||
* @param stationCode 车站编码
|
||||
* @param labelEnum 运行方向
|
||||
* @param pressDown 弹起:0;按下:1
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_MAIN_ASSIST)
|
||||
public void pressMainAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum
|
||||
, Integer pressDown) {
|
||||
stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.MAIN_ASSIST
|
||||
, (pressDown == 1), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按下接辅助
|
||||
*
|
||||
* @param simulation 仿真数据
|
||||
* @param stationCode 车站编码
|
||||
* @param labelEnum 运行方向
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_RECEIVE_ASSIST)
|
||||
public void pressReceiveAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) {
|
||||
stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.RECEIVE_ASSIST
|
||||
, Boolean.TRUE, stationDirectionService.turnAssistValid, stationDirectionService.receiveAssistThen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按下发辅助
|
||||
*
|
||||
* @param simulation 仿真数据
|
||||
* @param stationCode 车站编码
|
||||
* @param labelEnum 运行方向
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DELIVER_ASSIST)
|
||||
public void pressDeliverAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) {
|
||||
stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.DELIVER_ASSIST
|
||||
, Boolean.TRUE, stationDirectionService.turnAssistValid, stationDirectionService.deliverAssistThen);
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,30 @@ public class StationDirectionService {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 接、发辅助按钮操作校验
|
||||
*/
|
||||
public ButtonValidInterface turnAssistValid = (simulation, stationLabelEnum) -> {
|
||||
if (!stationLabelEnum.isMainAssistStatus()) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:总辅助按钮未按下");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 接辅助按钮后续操作
|
||||
*/
|
||||
public ButtonThenInterface receiveAssistThen = (simulation, stationLabelEnum) -> {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 接辅助按钮后续操作
|
||||
*/
|
||||
public ButtonThenInterface deliverAssistThen = (simulation, stationLabelEnum) -> {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前车站实体
|
||||
*
|
||||
|
@ -18,6 +18,17 @@ import java.util.List;
|
||||
@Getter
|
||||
@Slf4j
|
||||
public class StationDirection extends MapNamedElement {
|
||||
|
||||
/**
|
||||
* 发辅助默认倒计时 25s
|
||||
*/
|
||||
public static final int DEFAULT_DELIVER_DELAY_TIME = 25 * 1000;
|
||||
|
||||
/**
|
||||
* 接辅助默认倒计时 15s
|
||||
*/
|
||||
public static final int DEFAULT_RECEIVE_DELAY_TIME = 15 * 1000;
|
||||
|
||||
/**
|
||||
* 车站
|
||||
*/
|
||||
@ -170,17 +181,12 @@ public class StationDirection extends MapNamedElement {
|
||||
// 进路区段占用判断点灯颜色
|
||||
if (ReceiveAndDeliverModel.RECEIVE.equals(this.receiveAndDeliver)) {
|
||||
deliverAspect = IndicatorStatusEnum.No;
|
||||
boolean receiveSectionBlock = this.receiveRouteList
|
||||
.stream()
|
||||
.anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock));
|
||||
receiveAspect = receiveSectionBlock ? IndicatorStatusEnum.R : IndicatorStatusEnum.Y;
|
||||
// 接车进路锁闭
|
||||
receiveAspect = judgeSignalLock() ? IndicatorStatusEnum.R : IndicatorStatusEnum.Y;
|
||||
} else if (ReceiveAndDeliverModel.DELIVER.equals(this.receiveAndDeliver)) {
|
||||
receiveAspect = IndicatorStatusEnum.No;
|
||||
// 发车进路锁闭
|
||||
boolean deliverSectionBlock = this.deliverRouteList
|
||||
.stream()
|
||||
.anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock));
|
||||
deliverAspect = deliverSectionBlock ? IndicatorStatusEnum.R : IndicatorStatusEnum.G;
|
||||
deliverAspect = judgeSignalLock() ? IndicatorStatusEnum.R : IndicatorStatusEnum.G;
|
||||
} else {
|
||||
receiveAspect = this.receiveAspect;
|
||||
deliverAspect = this.receiveAspect;
|
||||
@ -226,6 +232,23 @@ public class StationDirection extends MapNamedElement {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果信号灯所在区段任意一边被锁闭
|
||||
*
|
||||
* @return 锁闭状态
|
||||
*/
|
||||
private boolean judgeSignalLock() {
|
||||
Section section = this.getSignal().getSection();
|
||||
boolean isLock = section.isRouteLock();
|
||||
if (!isLock && section.getLeftSection() != null) {
|
||||
isLock = section.getLeftSection().isRouteLock();
|
||||
}
|
||||
if (!isLock && section.getRightSection() != null) {
|
||||
isLock = section.getRightSection().isRouteLock();
|
||||
}
|
||||
return isLock;
|
||||
}
|
||||
|
||||
public enum ReceiveAndDeliverModel {
|
||||
// 接
|
||||
RECEIVE,
|
||||
|
Loading…
Reference in New Issue
Block a user