接近锁闭进路配置逻辑调整

This commit is contained in:
Jade 2021-11-04 17:31:44 +08:00
parent 81e1aa081a
commit 267003cd1a
6 changed files with 46 additions and 13 deletions

View File

@ -17,6 +17,14 @@ public interface ExceptionAssert {
BaseException exception(String message, Throwable t); BaseException exception(String message, Throwable t);
default void fail() {
throw exception();
}
default void fail(String message) {
throw exception(message);
}
default void assertNotNull(Object object) { default void assertNotNull(Object object) {
if (object == null) { if (object == null) {
throw exception(); throw exception();

View File

@ -51,12 +51,25 @@ public class SignalOperateHandler {
public void cancelRoute(Simulation simulation, String signalCode) { public void cancelRoute(Simulation simulation, String signalCode) {
//是否接近区段占用仍执行取消进路 //是否接近区段占用仍执行取消进路
Route route = this.ciApiService.findLockedRouteByStartSignal(simulation, signalCode); Route route = this.ciApiService.findLockedRouteByStartSignal(simulation, signalCode);
if (route != null && route.isApproachLock() && if (route == null) {
simulation.getRepository().getConfig().isSignalForceCancelRoute()) {
this.ciApiService.humanCancel(simulation, route.getCode());
return; return;
} }
this.atsRouteService.cancelRoute(simulation, signalCode); if (route.isApproachLock()) {
switch (simulation.getRepository().getConfig().getSingleApproachLockCancelRoute()) {
case DELAY:
this.ciApiService.humanCancel(simulation, route.getCode());
break;
case DIRECT:
this.ciApiService.forceUnlockRoute(simulation, route.getCode());
break;
case NOT:
default:
BusinessExceptionAssertEnum.OPERATION_FAIL.fail("无法取消接近锁闭进路");
break;
}
} else {
this.atsRouteService.cancelRoute(simulation, signalCode);
}
} }
@OperateHandlerMapping(type = Operation.Type.Signal_Set_Overlap) @OperateHandlerMapping(type = Operation.Type.Signal_Set_Overlap)

View File

@ -140,7 +140,7 @@ public interface CiApiService {
void unlockRoute(Simulation simulation, String routeCode); void unlockRoute(Simulation simulation, String routeCode);
/** /**
* 解锁进路/取消进路强制取消进路无论接近区段是否占用如果占用延时取消 * 解锁进路/取消进路强制取消进路无论接近区段是否占用
* @param simulation * @param simulation
* @param routeCode * @param routeCode
*/ */

View File

@ -199,11 +199,7 @@ public class CiApiServiceImpl2 implements CiApiService {
Route route = simulation.getRepository().getByCode(routeCode, Route.class); Route route = simulation.getRepository().getByCode(routeCode, Route.class);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(), BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(),
String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr())); String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr()));
if (route.isApproachLock()) { this.routeService.unlockRoute(simulation, route);
this.routeService.delayUnlockStart(simulation, route, route.getStart());
} else {
this.routeService.unlockRoute(simulation, route);
}
} }
@Override @Override

View File

@ -100,7 +100,7 @@ public class MapConfig {
/** /**
* 取消进路命令能否取消引导或接近锁闭的进路 * 取消进路命令能否取消引导或接近锁闭的进路
*/ */
private boolean signalForceCancelRoute; private ApproachLockCancel singleApproachLockCancelRoute;
/** /**
@ -239,7 +239,7 @@ public class MapConfig {
setSwitchNRTurnChain(configVO.getSwitchNRTurnChain()); setSwitchNRTurnChain(configVO.getSwitchNRTurnChain());
setSwitchSingleLockChain(configVO.getSwitchSingleLockChain()); setSwitchSingleLockChain(configVO.getSwitchSingleLockChain());
setSwitchLossChain(configVO.getSwitchLossChain()); setSwitchLossChain(configVO.getSwitchLossChain());
setSignalForceCancelRoute(configVO.getSignalForceCancelRoute()); setSingleApproachLockCancelRoute(configVO.getSingleApproachLockCancelRoute());
setRunMode(RunLevel.valueOf(configVO.getRunMode())); setRunMode(RunLevel.valueOf(configVO.getRunMode()));
setInitSingleLockSwitch(configVO.isInitSingleLockSwitch()); setInitSingleLockSwitch(configVO.isInitSingleLockSwitch());
setNoParkingSM(configVO.getNoParkingSM()); setNoParkingSM(configVO.getNoParkingSM());
@ -324,4 +324,19 @@ public class MapConfig {
} }
return false; return false;
} }
public enum ApproachLockCancel {
/**
* 不能取消
*/
NOT,
/**
* 延时取消
*/
DELAY,
/**
* 直接取消
*/
DIRECT,;
}
} }

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.vo.map; package club.joylink.rtss.vo.map;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel; import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -83,7 +84,7 @@ public class RealLineConfigVO {
/** /**
*是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路 *是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路
*/ */
private Boolean signalForceCancelRoute = false; private MapConfig.ApproachLockCancel singleApproachLockCancelRoute = MapConfig.ApproachLockCancel.NOT;
/** /**
*列车控制模式/级别 *列车控制模式/级别