【指示灯状态逻辑】
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)) {
|
if (IndicatorStatusEnum.R.equals(statusEnum)) {
|
||||||
indicator.getStation().getButtonsList()
|
indicator.getStation().getButtonsList()
|
||||||
.stream()
|
.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));
|
.forEach(button -> button.setPressDown(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,19 +109,34 @@ public class AssistService {
|
|||||||
Route deliverRoute = deliverIndicator.getRoute();
|
Route deliverRoute = deliverIndicator.getRoute();
|
||||||
IndicatorStatusEnum receiveStatus;
|
IndicatorStatusEnum receiveStatus;
|
||||||
IndicatorStatusEnum deliverStatus;
|
IndicatorStatusEnum deliverStatus;
|
||||||
// 两个进路都锁闭存在问题
|
// X、S 优先判断发车灯
|
||||||
if (receiveRoute.isLock() && deliverRoute.isLock()) {
|
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
|
||||||
receiveStatus = IndicatorStatusEnum.Y;
|
// 当发车进路办理时,必须亮起发车灯
|
||||||
deliverStatus = IndicatorStatusEnum.G;
|
if (deliverRoute.isLock()) {
|
||||||
} else if (receiveRoute.isLock() && !deliverRoute.isLock()) { // 亮接、灭发
|
deliverIndicator.setOn(true);
|
||||||
receiveStatus = IndicatorStatusEnum.Y;
|
receiveIndicator.setOn(false);
|
||||||
deliverStatus = IndicatorStatusEnum.No;
|
deliverStatus = IndicatorStatusEnum.R;
|
||||||
} else if (!receiveRoute.isLock() && deliverRoute.isLock()) { // 亮发、灭接
|
receiveStatus = IndicatorStatusEnum.No;
|
||||||
receiveStatus = IndicatorStatusEnum.No;
|
} else {
|
||||||
deliverStatus = IndicatorStatusEnum.G;
|
// 发车灯自身亮、并且发车进路并没锁闭、接车进路也没办理,说明刚完成改方操作
|
||||||
} else { // 复位
|
if (deliverIndicator.isOn() && !deliverRoute.isLock() && !receiveRoute.isLock()) {
|
||||||
receiveStatus = receiveIndicator.getDefaultStatus();
|
deliverIndicator.setOn(true);
|
||||||
deliverStatus = deliverIndicator.getDefaultStatus();
|
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);
|
receiveIndicator.setAspect(receiveStatus);
|
||||||
deliverIndicator.setAspect(deliverStatus);
|
deliverIndicator.setAspect(deliverStatus);
|
||||||
|
@ -31,9 +31,9 @@ public class Indicator extends MapNamedElement {
|
|||||||
private DirectionLabelEnum label;
|
private DirectionLabelEnum label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否改方状态
|
* 是否开启
|
||||||
*/
|
*/
|
||||||
private boolean isChangeDirection;
|
private boolean on;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区段信息
|
* 区段信息
|
||||||
@ -57,7 +57,7 @@ public class Indicator extends MapNamedElement {
|
|||||||
|
|
||||||
public Indicator(String code, String name) {
|
public Indicator(String code, String name) {
|
||||||
super(code, name, DeviceType.INDICATOR);
|
super(code, name, DeviceType.INDICATOR);
|
||||||
isChangeDirection = Boolean.FALSE;
|
on = Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Indicator(String code, String name, DeviceType deviceType) {
|
protected Indicator(String code, String name, DeviceType deviceType) {
|
||||||
@ -66,6 +66,7 @@ public class Indicator extends MapNamedElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
on = Boolean.FALSE;
|
||||||
aspect = getDefaultStatus();
|
aspect = getDefaultStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,18 +86,4 @@ public class Indicator extends MapNamedElement {
|
|||||||
return IndicatorStatusEnum.No;
|
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