锁闭道岔的进路改为list
This commit is contained in:
parent
4e7a87cf6b
commit
dd78e5bd29
@ -550,7 +550,7 @@ public class MaService {
|
||||
SwitchElement switchElement = route.getRouteSwitchElement(routeSection.getRelSwitch());
|
||||
Switch aSwitch = switchElement.getASwitch();
|
||||
handledSwitchSet.add(aSwitch.getCode());
|
||||
if (route.equals(aSwitch.getRoute())) {
|
||||
if (aSwitch.getRoutes().contains(route)) {
|
||||
if (aSwitch.isLoss()) {
|
||||
switchFault = true;
|
||||
break;
|
||||
|
@ -15,6 +15,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@ -253,18 +254,20 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
if (!aSwitch.isLocked() && aSwitch.getAllSections().stream().noneMatch(Section::isFaultLock))
|
||||
return;
|
||||
List<Route> lockedRouteList = simulation.getRepository().queryAllLockedRoute();
|
||||
Route lockedRoute = null;
|
||||
List<Route> lockSwitchRoutes = new ArrayList<>();
|
||||
if (aSwitch.isRouteLock()) {
|
||||
lockedRoute = aSwitch.getRoute();
|
||||
lockSwitchRoutes = aSwitch.getRoutes();
|
||||
} else if (aSwitch.isOverlapLock()) {
|
||||
for (Route route : lockedRouteList) {
|
||||
if (route.overlapContainSwitch(aSwitch)) {
|
||||
lockedRoute = route;
|
||||
lockSwitchRoutes.add(route);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.routeService.switchFaultUnlock(simulation, aSwitch, lockedRoute);
|
||||
for (Route lockedRoute : lockSwitchRoutes) {
|
||||
this.routeService.switchFaultUnlock(simulation, aSwitch, lockedRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -74,7 +75,7 @@ public class Switch extends DelayUnlockDevice {
|
||||
/**
|
||||
* 锁闭该道岔的进路
|
||||
*/
|
||||
private Route route;
|
||||
private final List<Route> routes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 是否进路侧防锁闭
|
||||
@ -141,7 +142,7 @@ public class Switch extends DelayUnlockDevice {
|
||||
this.blockade = false;
|
||||
this.usePosition = No_Use;
|
||||
this.routeLock = false;
|
||||
this.route = null;
|
||||
this.routes.clear();
|
||||
this.fpLock = false;
|
||||
this.overlapLock = false;
|
||||
this.masterGuideLock = false;
|
||||
@ -207,22 +208,22 @@ public class Switch extends DelayUnlockDevice {
|
||||
|
||||
public void routeLock(Route route) {
|
||||
this.routeLock = true;
|
||||
this.route = route;
|
||||
this.routes.add(route);
|
||||
}
|
||||
|
||||
public void routeUnlock(Route route) {
|
||||
if (this.isRouteLockBy(route)) {
|
||||
this.a.routeUnlocking(this.route);
|
||||
this.b.routeUnlocking(this.route);
|
||||
this.c.routeUnlocking(this.route);
|
||||
this.routeLock = false;
|
||||
this.route = null;
|
||||
this.a.routeUnlocking(route);
|
||||
this.b.routeUnlocking(route);
|
||||
this.c.routeUnlocking(route);
|
||||
this.routes.remove(route);
|
||||
this.routeLock = !this.routes.isEmpty();
|
||||
this.checkAndResetUsePosition();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRouteLockBy(Route route) {
|
||||
return this.routeLock && this.route.equals(route);
|
||||
return this.routeLock && this.routes.contains(route);
|
||||
}
|
||||
|
||||
private void checkAndResetUsePosition() {
|
||||
@ -393,7 +394,9 @@ public class Switch extends DelayUnlockDevice {
|
||||
}
|
||||
|
||||
public void faultUnlock() {
|
||||
this.routeUnlock(this.route);
|
||||
for (Route route : routes) {
|
||||
this.routeUnlock(route);
|
||||
}
|
||||
this.overlapUnLock();
|
||||
this.fpUnlock();
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -43,6 +47,8 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
||||
|
||||
private String route;
|
||||
|
||||
private List<String> routes;
|
||||
|
||||
/**
|
||||
* 是否进路侧防锁闭
|
||||
*/
|
||||
@ -95,10 +101,16 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
||||
change = true;
|
||||
storageSwitch.setRouteLock(s.isRouteLock());
|
||||
}
|
||||
Route route = s.getRoute();
|
||||
if (route != null) {
|
||||
// Route route = s.getRoutes();
|
||||
// if (route != null) {
|
||||
// change = true;
|
||||
// storageSwitch.setRoute(route.getCode());
|
||||
// }
|
||||
List<Route> routes = s.getRoutes();
|
||||
if (!CollectionUtils.isEmpty(routes)) {
|
||||
change = true;
|
||||
storageSwitch.setRoute(route.getCode());
|
||||
List<String> routeCodes = routes.stream().map(MapElement::getCode).collect(Collectors.toList());
|
||||
storageSwitch.setRoutes(routeCodes);
|
||||
}
|
||||
if (s.isFpLock()) {
|
||||
change = true;
|
||||
@ -141,7 +153,18 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
||||
s.setSingleLock(singleLock != null ? singleLock : false);
|
||||
s.setBlockade(blockade != null ? blockade : false);
|
||||
s.setRouteLock(routeLock != null ? routeLock : false);
|
||||
s.setRoute(route == null ? null : repository.getByCode(route, Route.class));
|
||||
if (route != null) {
|
||||
Route route = repository.getByCode(this.route, Route.class);
|
||||
s.getRoutes().add(route);
|
||||
} else if (!CollectionUtils.isEmpty(routes)) {
|
||||
for (String code : routes) {
|
||||
Route route = repository.getByCode(code, Route.class);
|
||||
s.getRoutes().add(route);
|
||||
}
|
||||
} else {
|
||||
s.getRoutes().clear();
|
||||
}
|
||||
// s.setRoutes(route == null ? null : repository.getByCode(route, Route.class));
|
||||
s.setOverlapLock(overlapLock != null ? overlapLock : false);
|
||||
s.setMasterGuideLock(masterGuideLock != null ? masterGuideLock : false);
|
||||
if (pos != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user