修改:设置头码车时的寻路逻辑

This commit is contained in:
joylink_zhangsai 2021-06-03 14:40:45 +08:00
parent ce1425198c
commit b17175b2af
2 changed files with 8 additions and 10 deletions

View File

@ -275,7 +275,7 @@ public class AtsTrainService {
Section section = allSections.get(i);
List<RoutePath> routePaths = repository.queryRoutePathsByEndAndContainsSection(section, headSection);
if (!CollectionUtils.isEmpty(routePaths)) {
if (routePaths.stream().anyMatch(routePath -> !routePath.hasReverseRoute())) { //有不含反向进路的路径
if (routePaths.stream().anyMatch(routePath -> !routePath.isReverse())) { //有不含反向进路的路径
fromSection = section;
selectRouting = routing;
break;

View File

@ -427,15 +427,13 @@ public class RoutePath {
return list;
}
public boolean hasReverseRoute() {
for (Route route : this.routeList) {
Section section = route.getSectionList().get(0);
if (section.isRightLine() && !route.getStart().isRight()) { //右向区段但进路是左向
return true;
}
if (section.isLeftLine() && route.getStart().isRight()) { //左向区段但进路是右向
return true;
}
public boolean isReverse() {
Section section = sectionList.get(0);
if (section.isRightLine()) {
return !this.isRight();
}
if (section.isLeftLine()) {
return this.isRight();
}
return false;
}