【大铁进路开信号逻辑修改】

This commit is contained in:
weizhihong 2023-02-03 16:08:30 +08:00
parent 6e8c08aec7
commit 029e536c81
3 changed files with 32 additions and 14 deletions

View File

@ -475,6 +475,17 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
&& this.assistTime.plusSeconds(DEFAULT_DURATION_TIME).isBefore(currentDateTime);
}
/**
* 获取自动出入口电路方向
*/
public boolean currentRight() {
if (this.changeDirectionStatus) { // 改方状态
return !this.right;
} else { // 当前默认状态
return this.right;
}
}
/**
* 设置默认属性
*/

View File

@ -376,7 +376,9 @@ public class CiRouteService {
// 进路道岔解锁
route.getSwitchList().forEach(aSwitch -> aSwitch.getASwitch().routeUnlock(route));
// 进路侧防解锁
route.getFlsList().forEach(RouteFls::unlock);
if (!CollectionUtils.isEmpty(route.getFlsList())) {
route.getFlsList().forEach(RouteFls::unlock);
}
// // 进路区段取消锁闭
// List<Section> sectionList = route.getSectionList();
// for (Section section : sectionList) {

View File

@ -10,6 +10,8 @@ import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@Slf4j
@Component
@ -177,19 +179,22 @@ public class CiService {
return level;
// 大铁情况下做判断
if (simulation.getRepository().getConfig().isRailway() && !route.isShutting()) {
// 如果当前进路在列表中不存在则信号灯不开放
boolean isCanHandle = simulation.getRepository().getStationList().stream()
.filter(station -> station.getCode().equals(route.getStart().getStation().getCode())
|| station.getCode().equals(route.getDestination().getStation().getCode()))
.anyMatch(station -> {
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = station.getStationDirectionMap();
if (CollectionUtils.isEmpty(stationDirectionMap)) {
return true;
}
return stationDirectionMap.values().stream()
.filter(stationDirection -> !CollectionUtils.isEmpty(stationDirection.getCurrentRouteList()))
.anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route));
});
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = route.getStart().getStation().getStationDirectionMap();
// 无出入口数据为空时不做判断
boolean isCanHandle = stationDirectionMap.isEmpty();
if (!isCanHandle) {
Optional<StationDirection> stationDirectionOptional = stationDirectionMap.values().stream()
.filter(stationDirection -> Objects.equals(stationDirection.getSignal(), route.getStart())
|| Objects.equals(stationDirection.getSignal(), route.getDestination()))
.findFirst();
if (stationDirectionOptional.isPresent()) {
StationDirection stationDirection = stationDirectionOptional.get();
// 如果当前进路在列表中不存在则信号灯不开放
isCanHandle = Objects.equals(stationDirection.currentRight(), route.isRight())
&& (stationDirection.getChangeDirectionTime() == null || route.getSettingStartTime().isAfter(stationDirection.getChangeDirectionTime()))
&& stationDirection.getCurrentRouteList().contains(route);
}
}
if (!isCanHandle) {
return level;
}