【指示灯状态逻辑】
Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
parent
8abe421380
commit
9d7a9422d0
@ -82,7 +82,7 @@ public class AssistService {
|
||||
if (IndicatorStatusEnum.R.equals(statusEnum)) {
|
||||
indicator.getStation().getButtonsList()
|
||||
.stream()
|
||||
.filter(button -> indicator.getType().equals(button.getLabel()) && ButtonTypeEnum.CHANGE_DIRECTION.equals(button.getType()))
|
||||
.filter(button -> indicator.getLabel().equals(button.getLabel()) && ButtonTypeEnum.CHANGE_DIRECTION.equals(button.getType()))
|
||||
.forEach(button -> button.setPressDown(false));
|
||||
}
|
||||
|
||||
@ -109,19 +109,34 @@ public class AssistService {
|
||||
Route deliverRoute = deliverIndicator.getRoute();
|
||||
IndicatorStatusEnum receiveStatus;
|
||||
IndicatorStatusEnum deliverStatus;
|
||||
// 两个进路都锁闭存在问题
|
||||
if (receiveRoute.isLock() && deliverRoute.isLock()) {
|
||||
receiveStatus = IndicatorStatusEnum.Y;
|
||||
deliverStatus = IndicatorStatusEnum.G;
|
||||
} else if (receiveRoute.isLock() && !deliverRoute.isLock()) { // 亮接、灭发
|
||||
receiveStatus = IndicatorStatusEnum.Y;
|
||||
deliverStatus = IndicatorStatusEnum.No;
|
||||
} else if (!receiveRoute.isLock() && deliverRoute.isLock()) { // 亮发、灭接
|
||||
receiveStatus = IndicatorStatusEnum.No;
|
||||
deliverStatus = IndicatorStatusEnum.G;
|
||||
} else { // 复位
|
||||
receiveStatus = receiveIndicator.getDefaultStatus();
|
||||
deliverStatus = deliverIndicator.getDefaultStatus();
|
||||
// X、S 优先判断发车灯
|
||||
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
|
||||
// 当发车进路办理时,必须亮起发车灯
|
||||
if (deliverRoute.isLock()) {
|
||||
deliverIndicator.setOn(true);
|
||||
receiveIndicator.setOn(false);
|
||||
deliverStatus = IndicatorStatusEnum.R;
|
||||
receiveStatus = IndicatorStatusEnum.No;
|
||||
} else {
|
||||
// 发车灯自身亮、并且发车进路并没锁闭、接车进路也没办理,说明刚完成改方操作
|
||||
if (deliverIndicator.isOn() && !deliverRoute.isLock() && !receiveRoute.isLock()) {
|
||||
deliverIndicator.setOn(true);
|
||||
receiveIndicator.setOn(false);
|
||||
deliverStatus = IndicatorStatusEnum.G;
|
||||
receiveStatus = IndicatorStatusEnum.No;
|
||||
} else { // 其他操作均已接车灯为主
|
||||
deliverIndicator.setOn(false);
|
||||
receiveIndicator.setOn(true);
|
||||
deliverStatus = IndicatorStatusEnum.No;
|
||||
receiveStatus = IndicatorStatusEnum.Y;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 如果接车灯不亮就发车灯亮
|
||||
receiveIndicator.setOn(receiveRoute.isLock());
|
||||
deliverIndicator.setOn(!receiveRoute.isLock());
|
||||
deliverStatus = deliverIndicator.isOn() ? IndicatorStatusEnum.G : IndicatorStatusEnum.No;
|
||||
receiveStatus = receiveIndicator.isOn() ? IndicatorStatusEnum.Y : IndicatorStatusEnum.No;
|
||||
}
|
||||
receiveIndicator.setAspect(receiveStatus);
|
||||
deliverIndicator.setAspect(deliverStatus);
|
||||
|
@ -31,9 +31,9 @@ public class Indicator extends MapNamedElement {
|
||||
private DirectionLabelEnum label;
|
||||
|
||||
/**
|
||||
* 是否改方状态
|
||||
* 是否开启
|
||||
*/
|
||||
private boolean isChangeDirection;
|
||||
private boolean on;
|
||||
|
||||
/**
|
||||
* 区段信息
|
||||
@ -57,7 +57,7 @@ public class Indicator extends MapNamedElement {
|
||||
|
||||
public Indicator(String code, String name) {
|
||||
super(code, name, DeviceType.INDICATOR);
|
||||
isChangeDirection = Boolean.FALSE;
|
||||
on = Boolean.FALSE;
|
||||
}
|
||||
|
||||
protected Indicator(String code, String name, DeviceType deviceType) {
|
||||
@ -66,6 +66,7 @@ public class Indicator extends MapNamedElement {
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
on = Boolean.FALSE;
|
||||
aspect = getDefaultStatus();
|
||||
}
|
||||
|
||||
@ -85,18 +86,4 @@ public class Indicator extends MapNamedElement {
|
||||
return IndicatorStatusEnum.No;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进路办理后的指示灯状态
|
||||
*
|
||||
* @return 办理状态
|
||||
*/
|
||||
public IndicatorStatusEnum setLockRouteStatus() {
|
||||
// 接
|
||||
if (IndicatorTypeEnum.RECEIVE.equals(type)) {
|
||||
return IndicatorStatusEnum.Y;
|
||||
} else {
|
||||
return IndicatorStatusEnum.G;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user