大铁进路办理代码结构修改;大铁道岔转动、单/解锁联动;cilRepository.config赋值
This commit is contained in:
parent
f234e39935
commit
c7d5c38b73
@ -219,6 +219,8 @@ public class Operation {
|
|||||||
Stand_Open,
|
Stand_Open,
|
||||||
/** 站台关闭 */
|
/** 站台关闭 */
|
||||||
Stand_Close,
|
Stand_Close,
|
||||||
|
/** 站台紧急关闭 */
|
||||||
|
Stand_Emergency_Close,
|
||||||
|
|
||||||
//--------------------------- 控制模式 ---------------------------
|
//--------------------------- 控制模式 ---------------------------
|
||||||
/** 请求站控 */
|
/** 请求站控 */
|
||||||
|
@ -4,7 +4,9 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
|||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStandService;
|
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStandService;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.status.StandStatus;
|
import club.joylink.rtss.simulation.cbtc.data.status.StandStatus;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
@ -25,6 +27,9 @@ public class StandOperateHandler {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StandOperateHandler standOperateHandler;
|
private StandOperateHandler standOperateHandler;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CiApiService ciApiService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置跳停
|
* 设置跳停
|
||||||
*/
|
*/
|
||||||
@ -222,4 +227,10 @@ public class StandOperateHandler {
|
|||||||
public void close(Simulation simulation, List<String> standCodes) {
|
public void close(Simulation simulation, List<String> standCodes) {
|
||||||
atsStandService.close(simulation, standCodes);
|
atsStandService.close(simulation, standCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Stand_Emergency_Close)
|
||||||
|
public void emergencyClose(Simulation simulation, String standCode) {
|
||||||
|
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||||
|
ciApiService.standEC(simulation, stand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import club.joylink.rtss.simulation.rt.SRD.bo.SrPSD;
|
|||||||
import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal;
|
import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal;
|
||||||
import club.joylink.rtss.simulation.rt.SRD.bo.SrSwitch;
|
import club.joylink.rtss.simulation.rt.SRD.bo.SrSwitch;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
|
import club.joylink.rtss.vo.client.map.RealLineConfigVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -458,8 +458,16 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try2LockRouteDevices(rtSimulation, cilRepository, cilRoute, commonRoute); //尝试转动/锁闭设备
|
if (config.isLockFirst()) {
|
||||||
setLockingStateByInterlockCheck(cilRepository, cilRoute, commonRoute); //根据联锁检查情况设置锁闭状态
|
this.lockFirst(cilRepository, commonRoute, cilRoute);
|
||||||
|
}
|
||||||
|
try2TurnAndLockRouteMainDevices(rtSimulation, cilRepository, cilRoute, commonRoute, config); //尝试转动并锁闭进路主体设备
|
||||||
|
cilRoute.setLock(isRoutePassInterlockingCheck(cilRepository, commonRoute)); //根据联锁检查设置进路主体锁闭状态
|
||||||
|
try2TurnAndLockFlankDevices(rtSimulation, cilRepository, cilRoute, commonRoute); //尝试转动并锁闭侧防设备
|
||||||
|
cilRoute.setFl(isFlsPassInterlockingCheck(cilRepository, commonRoute)); //根据联锁检查设置侧防锁闭状态
|
||||||
|
try2TurnAndLockOverlapDevices(rtSimulation, cilRepository, cilRoute, commonRoute, config); //尝试转动并锁闭延续保护设备
|
||||||
|
cilRoute.setOl(isOverlapPassInterlockingCheck(cilRepository, commonRoute, cilRoute.getOverlap())); //根据联锁检查设置延续保护锁闭状态
|
||||||
|
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
updateSignalLevel(cilRepository, cilRoute, commonRoute, cilSignal); //更新信号机信号级别
|
updateSignalLevel(cilRepository, cilRoute, commonRoute, cilSignal); //更新信号机信号级别
|
||||||
if (cilRoute.isCanAutoOpen()) //尝试开放信号
|
if (cilRoute.isCanAutoOpen()) //尝试开放信号
|
||||||
@ -505,23 +513,42 @@ public class CilRouteLogicService {
|
|||||||
* 尝试锁闭进路内的设备
|
* 尝试锁闭进路内的设备
|
||||||
*/
|
*/
|
||||||
private void try2LockRouteDevices(RtSimulation rtSimulation, CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute) {
|
private void try2LockRouteDevices(RtSimulation rtSimulation, CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute) {
|
||||||
// if (config.isLockFirst()) {
|
CilConfig config = cilRepository.getConfig();
|
||||||
// this.lockFirst(cilRepository, commonRoute, cilRoute);
|
if (config.isLockFirst()) {
|
||||||
// }
|
this.lockFirst(cilRepository, commonRoute, cilRoute);
|
||||||
TrackWay pathElement = commonRoute.getPathElement();
|
}
|
||||||
CommonSignal commonSignal = commonRoute.getStart();
|
try2TurnAndLockRouteMainDevices(rtSimulation, cilRepository, cilRoute, commonRoute, config);
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
try2TurnAndLockFlankDevices(rtSimulation, cilRepository, cilRoute, commonRoute);
|
||||||
// 进路内的设备转动、锁闭
|
try2TurnAndLockOverlapDevices(rtSimulation, cilRepository, cilRoute, commonRoute, config);
|
||||||
List<SwitchPosition> spList = pathElement.getSpList();
|
}
|
||||||
if (!cilRoute.isLock()) {
|
|
||||||
cilSwitchLogicService.tryTurn(rtSimulation, spList); // 转动道岔
|
/**
|
||||||
boolean allLock = try2RouteLockSwitches(cilRepository, cilRoute.getId(), spList); // 锁闭道岔
|
* 尝试转动、锁闭延续保护设备
|
||||||
if (allLock) {
|
*/
|
||||||
// if (!config.isLockFirst()) {
|
private void try2TurnAndLockOverlapDevices(RtSimulation rtSimulation, CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute, CilConfig config) {
|
||||||
routeLockSections(cilRepository, commonRoute);
|
// 延续保护设备转动、锁闭
|
||||||
// }
|
CilOverlap overlap = cilRoute.getOverlap();
|
||||||
|
if (overlap != null) {
|
||||||
|
CommonOverlap commonOverlap = commonRoute.getOverlap();
|
||||||
|
if (!cilRoute.isOl()) {
|
||||||
|
TrackWay selectedPath = overlap.getSelectedPath();
|
||||||
|
if (selectedPath != null) {
|
||||||
|
cilSwitchLogicService.tryTurn(rtSimulation, selectedPath.getSpList());
|
||||||
|
boolean allSwitchesLocked = try2OverlapLockSwitches(cilRepository, overlap, selectedPath.getSpList()); // 锁闭道岔
|
||||||
|
if (allSwitchesLocked) {
|
||||||
|
if (!config.isLockFirst()) {
|
||||||
|
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), overlap.getSelectedPath().getSectionList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尝试转动、锁闭侧防设备
|
||||||
|
*/
|
||||||
|
private void try2TurnAndLockFlankDevices(RtSimulation rtSimulation, CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute) {
|
||||||
// 侧防设备转动、锁闭
|
// 侧防设备转动、锁闭
|
||||||
List<CommonFls> flsList = commonRoute.getFlsList();
|
List<CommonFls> flsList = commonRoute.getFlsList();
|
||||||
if (!CollectionUtils.isEmpty(flsList)) {
|
if (!CollectionUtils.isEmpty(flsList)) {
|
||||||
@ -541,20 +568,21 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 延续保护设备转动、锁闭
|
|
||||||
CilOverlap overlap = cilRoute.getOverlap();
|
|
||||||
if (overlap != null) {
|
|
||||||
CommonOverlap commonOverlap = commonRoute.getOverlap();
|
|
||||||
if (!cilRoute.isOl()) {
|
|
||||||
TrackWay selectedPath = overlap.getSelectedPath();
|
|
||||||
if (selectedPath != null) {
|
|
||||||
cilSwitchLogicService.tryTurn(rtSimulation, selectedPath.getSpList());
|
|
||||||
boolean allSwitchesLocked = try2OverlapLockSwitches(cilRepository, overlap, spList); // 锁闭道岔
|
|
||||||
if (allSwitchesLocked) {
|
|
||||||
// if (!config.isLockFirst()) {
|
|
||||||
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), overlap.getSelectedPath().getSectionList());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尝试转动、锁闭进路主体设置
|
||||||
|
*/
|
||||||
|
private void try2TurnAndLockRouteMainDevices(RtSimulation rtSimulation, CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute, CilConfig config) {
|
||||||
|
// 进路内的设备转动、锁闭
|
||||||
|
TrackWay pathElement = commonRoute.getPathElement();
|
||||||
|
List<SwitchPosition> spList = pathElement.getSpList();
|
||||||
|
if (!cilRoute.isLock()) {
|
||||||
|
cilSwitchLogicService.tryTurn(rtSimulation, spList); // 转动道岔
|
||||||
|
boolean allLock = try2RouteLockSwitches(cilRepository, cilRoute.getId(), spList); // 锁闭道岔
|
||||||
|
if (allLock) {
|
||||||
|
if (!config.isLockFirst()) {
|
||||||
|
routeLockSections(cilRepository, commonRoute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,8 +594,8 @@ public class CilRouteLogicService {
|
|||||||
private void updateSignalLevel(CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute, CilSignal cilSignal) {
|
private void updateSignalLevel(CilRepository cilRepository, CilRoute cilRoute, CommonRoute commonRoute, CilSignal cilSignal) {
|
||||||
//判断信号级别
|
//判断信号级别
|
||||||
if (cilRoute.isLock()) {
|
if (cilRoute.isLock()) {
|
||||||
if (cilRoute.isFl() || CollectionUtils.isEmpty(commonRoute.getFlsList())) {
|
if (cilRoute.isFl()) {
|
||||||
if (cilRoute.isOl() || cilRoute.getOverlap() == null) {
|
if (cilRoute.isOl()) {
|
||||||
cilSignal.updateLevel(CilSignal.LEVEL_4);
|
cilSignal.updateLevel(CilSignal.LEVEL_4);
|
||||||
} else {
|
} else {
|
||||||
cilSignal.updateLevel(CilSignal.LEVEL_3);
|
cilSignal.updateLevel(CilSignal.LEVEL_3);
|
||||||
@ -631,6 +659,8 @@ public class CilRouteLogicService {
|
|||||||
private boolean isFlsPassInterlockingCheck(CilRepository cilRepository, CommonRoute commonRoute) {
|
private boolean isFlsPassInterlockingCheck(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
TrackWay pathElement = commonRoute.getPathElement();
|
TrackWay pathElement = commonRoute.getPathElement();
|
||||||
List<CommonFls> flsList = pathElement.getFlsList();
|
List<CommonFls> flsList = pathElement.getFlsList();
|
||||||
|
if (CollectionUtils.isEmpty(flsList))
|
||||||
|
return true;
|
||||||
for (CommonFls commonFls : flsList) {
|
for (CommonFls commonFls : flsList) {
|
||||||
List<CommonFls.FlsElement> flsElements = commonFls.getFirstLevelList();
|
List<CommonFls.FlsElement> flsElements = commonFls.getFirstLevelList();
|
||||||
if (pathElement.isContainSwitchPosition(commonFls.getTarget().getCommonSwitch().getId(), commonFls.getTarget().isNormal())) {
|
if (pathElement.isContainSwitchPosition(commonFls.getTarget().getCommonSwitch().getId(), commonFls.getTarget().isNormal())) {
|
||||||
@ -663,7 +693,11 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOverlapPassInterlockingCheck(CilRepository cilRepository, CommonRoute commonRoute, CilOverlap overlap) {
|
public boolean isOverlapPassInterlockingCheck(CilRepository cilRepository, CommonRoute commonRoute, CilOverlap overlap) {
|
||||||
|
if (overlap == null)
|
||||||
|
return true;
|
||||||
TrackWay path = overlap.getSelectedPath();
|
TrackWay path = overlap.getSelectedPath();
|
||||||
|
if (path == null)
|
||||||
|
return true;
|
||||||
List<CommonSection> sectionList = path.getSectionList();
|
List<CommonSection> sectionList = path.getSectionList();
|
||||||
if (!CollectionUtils.isEmpty(sectionList)) {
|
if (!CollectionUtils.isEmpty(sectionList)) {
|
||||||
for (CommonSection commonSection : sectionList) {
|
for (CommonSection commonSection : sectionList) {
|
||||||
|
@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.rt.repo.SwitchPosition;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,10 +29,19 @@ public class CilSwitchLogicService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void turn(RtSimulation rtSimulation, String id) {
|
public void turn(RtSimulation rtSimulation, String id) {
|
||||||
CilRepository repository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CilSwitch aSwitch = repository.getSwitchById(id);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
|
CilSwitch aSwitch = cilRepository.getSwitchById(id);
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(aSwitch.isLocked(), "道岔锁闭,无法转动");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(aSwitch.isLocked(), "道岔锁闭,无法转动");
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isOccupy(rtSimulation, id), "道岔占用,无法转动");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isOccupy(rtSimulation, id), "道岔占用,无法转动");
|
||||||
|
if (cilRepository.getConfig().isSwitchNRTurnChain()) {
|
||||||
|
CommonSwitch commonSwitch = commonRepository.getSwitchById(aSwitch.getId());
|
||||||
|
CommonSwitch linkedSwitch = commonSwitch.queryLinkedSwitch();
|
||||||
|
CilSwitch linkedCilSwitch = cilRepository.getSwitchById(linkedSwitch.getId());
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(linkedCilSwitch.isLocked(), "道岔锁闭,无法转动");
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isOccupy(rtSimulation, linkedCilSwitch.getId()), "道岔占用,无法转动");
|
||||||
|
srdApiService.turnSwitch(rtSimulation, linkedCilSwitch.getId());
|
||||||
|
}
|
||||||
srdApiService.turnSwitch(rtSimulation, id);
|
srdApiService.turnSwitch(rtSimulation, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,30 +51,33 @@ public class CilSwitchLogicService {
|
|||||||
public void turn(RtSimulation rtSimulation, String switchId, int position) {
|
public void turn(RtSimulation rtSimulation, String switchId, int position) {
|
||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CilSwitch aSwitch = cilRepository.getSwitchById(switchId);
|
|
||||||
if (aSwitch.getPosition() == position) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(aSwitch.isLocked(), "道岔锁闭,无法转动");
|
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isOccupy(rtSimulation, switchId), "道岔占用,无法转动");
|
|
||||||
srdApiService.turnSwitch(rtSimulation, switchId, position);
|
|
||||||
// if (repository.getConfig().isSwitchNRTurnChain()) {
|
|
||||||
CommonSwitch commonSwitch = commonRepository.getSwitchById(switchId);
|
CommonSwitch commonSwitch = commonRepository.getSwitchById(switchId);
|
||||||
CommonSwitch linkedSwitch = commonSwitch.queryLinkedSwitch();
|
String failReason = tryTurn(rtSimulation, cilRepository, commonSwitch, position);
|
||||||
if (linkedSwitch != null) {
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotHasText(failReason, failReason);
|
||||||
srdApiService.turnSwitch(rtSimulation, linkedSwitch.getId(), position);
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tryTurn(RtSimulation rtSimulation, CilRepository cilRepository, CommonSwitch commonSwitch, int position) {
|
/**
|
||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(commonSwitch.getId());
|
* 尝试转动道岔
|
||||||
if (cilSwitch.getPosition() == position) {
|
*
|
||||||
return;
|
* @return 失败原因
|
||||||
|
*/
|
||||||
|
public String tryTurn(RtSimulation rtSimulation, CilRepository cilRepository, CommonSwitch commonSwitch, int position) {
|
||||||
|
String failReason = check4Turn(rtSimulation, cilRepository, commonSwitch, position);
|
||||||
|
if (StringUtils.hasText(failReason))
|
||||||
|
return failReason;
|
||||||
|
if (cilRepository.getConfig().isSwitchNRTurnChain()) {
|
||||||
|
CommonSwitch linkedSwitch = commonSwitch.queryLinkedSwitch();
|
||||||
|
if (linkedSwitch != null) {
|
||||||
|
String failReason2 = check4Turn(rtSimulation, cilRepository, linkedSwitch, position);
|
||||||
|
if (StringUtils.hasText(failReason2)) {
|
||||||
|
return failReason2;
|
||||||
|
} else {
|
||||||
|
srdApiService.turnSwitch(rtSimulation, linkedSwitch.getId(), position);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!cilSwitch.isLocked() && !isOccupy(rtSimulation, commonSwitch.getId())) {
|
|
||||||
srdApiService.turnSwitch(rtSimulation, commonSwitch.getId(), position);
|
srdApiService.turnSwitch(rtSimulation, commonSwitch.getId(), position);
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tryTurn(RtSimulation rtSimulation, List<SwitchPosition> switchPositions) {
|
public void tryTurn(RtSimulation rtSimulation, List<SwitchPosition> switchPositions) {
|
||||||
@ -90,8 +103,18 @@ public class CilSwitchLogicService {
|
|||||||
|
|
||||||
public void singleLockSwitch(RtSimulation simulation, String id) {
|
public void singleLockSwitch(RtSimulation simulation, String id) {
|
||||||
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
|
CommonRepository commonRepository = simulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(id);
|
CilSwitch cilSwitch = cilRepository.getSwitchById(id);
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSwitch.isLost(), "道岔失表,无法单锁");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSwitch.isLost(), "道岔失表,无法单锁");
|
||||||
|
if (cilRepository.getConfig().isSwitchSingleLockChain()) {
|
||||||
|
CommonSwitch commonSwitch = commonRepository.getSwitchById(id);
|
||||||
|
CommonSwitch linkedCommonSwitch = commonSwitch.queryLinkedSwitch();
|
||||||
|
if (linkedCommonSwitch != null) {
|
||||||
|
CilSwitch linkedCilSwitch = cilRepository.getSwitchById(linkedCommonSwitch.getId());
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(linkedCilSwitch.isLost(), "联动道岔失表,无法单锁");
|
||||||
|
linkedCilSwitch.setSl(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
cilSwitch.setSl(true);
|
cilSwitch.setSl(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,4 +123,15 @@ public class CilSwitchLogicService {
|
|||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(id);
|
CilSwitch cilSwitch = cilRepository.getSwitchById(id);
|
||||||
cilSwitch.setSl(false);
|
cilSwitch.setSl(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String check4Turn(RtSimulation simulation, CilRepository cilRepository, CommonSwitch commonSwitch, int position) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(commonSwitch.getId());
|
||||||
|
if (cilSwitch.getPosition() == position)
|
||||||
|
return "道岔已在指定位置";
|
||||||
|
if (cilSwitch.isLocked())
|
||||||
|
return String.format("道岔[%s]锁闭", commonSwitch.getId());
|
||||||
|
if (isOccupy(simulation, commonSwitch.getId()))
|
||||||
|
return String.format("道岔[%s]占用", commonSwitch.getId());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,27 @@
|
|||||||
package club.joylink.rtss.simulation.rt.CIL.bo;
|
package club.joylink.rtss.simulation.rt.CIL.bo;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.map.RealLineConfigVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
public class CilConfig {
|
public class CilConfig {
|
||||||
boolean lockFirst;
|
boolean lockFirst = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 道岔正/反操是否联动
|
* 道岔正/反操是否联动
|
||||||
*/
|
*/
|
||||||
private boolean switchNRTurnChain;
|
private boolean switchNRTurnChain = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道岔单解/锁是否联动
|
||||||
|
*/
|
||||||
|
private boolean switchSingleLockChain = false;
|
||||||
|
|
||||||
|
public CilConfig(RealLineConfigVO configVO) {
|
||||||
|
this.lockFirst = configVO.getLockFirst();
|
||||||
|
this.switchNRTurnChain = configVO.getSwitchNRTurnChain();
|
||||||
|
this.switchSingleLockChain = configVO.getSwitchSingleLockChain();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.rt.CIL.bo;
|
|||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.MapSwitchVO;
|
import club.joylink.rtss.vo.client.map.MapSwitchVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
|
import club.joylink.rtss.vo.client.map.RealLineConfigVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@ -24,9 +25,18 @@ public class CilRepositoryBuilder {
|
|||||||
// buildOverlaps(logicDataNew.getOverlapList(), cilRepository.overlapMap, cilRepository.signalMap, cilRepository.sectionMap, cilRepository.switchMap, cilRepository.flsMap);
|
// buildOverlaps(logicDataNew.getOverlapList(), cilRepository.overlapMap, cilRepository.signalMap, cilRepository.sectionMap, cilRepository.switchMap, cilRepository.flsMap);
|
||||||
buildAutoSignals(logicDataNew.getAutoSignalList(), cilRepository.autoSignalMap);
|
buildAutoSignals(logicDataNew.getAutoSignalList(), cilRepository.autoSignalMap);
|
||||||
buildRoutes(logicDataNew.getRouteList(), cilRepository.routeMap, cilRepository);
|
buildRoutes(logicDataNew.getRouteList(), cilRepository.routeMap, cilRepository);
|
||||||
|
buildConfig(mapVO.getConfigVO(), cilRepository);
|
||||||
return cilRepository;
|
return cilRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void buildConfig(RealLineConfigVO configVO, CilRepository cilRepository) {
|
||||||
|
if (configVO != null) {
|
||||||
|
cilRepository.config = new CilConfig(configVO);
|
||||||
|
} else {
|
||||||
|
cilRepository.config = new CilConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void buildSections(List<MapSectionNewVO> sectionList, Map<String, CilSection> sectionMap) {
|
private static void buildSections(List<MapSectionNewVO> sectionList, Map<String, CilSection> sectionMap) {
|
||||||
for (MapSectionNewVO sectionNewVO : sectionList) {
|
for (MapSectionNewVO sectionNewVO : sectionList) {
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(sectionMap.containsKey(sectionNewVO.getCode()),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(sectionMap.containsKey(sectionNewVO.getCode()),
|
||||||
|
@ -15,9 +15,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
|
Loading…
Reference in New Issue
Block a user