Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
a261c9e3e9
@ -41,10 +41,4 @@ public class RtSimulationController {
|
|||||||
this.rtSimulationService.init(id);
|
this.rtSimulationService.init(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "清除仿真")
|
|
||||||
@DeleteMapping("/{group}/clear")
|
|
||||||
public void clearSimulation(@PathVariable String group, @ApiIgnore @RequestAttribute UserVO user) {
|
|
||||||
this.rtSimulationService.clearSimulation(group, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,12 +170,14 @@ public class MapSystemService implements IMapSystemService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateMapSystem(Long id, MapSystemVO mapSystemVO) {
|
public void updateMapSystem(Long id, MapSystemVO mapSystemVO) {
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(mapSystemVO.getName(), "名称不能为空");
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(mapSystemVO.getNewApi(), "是否使用新版接口不能为空");
|
||||||
MapSystem mapSystem = getEntity(id);
|
MapSystem mapSystem = getEntity(id);
|
||||||
if (StringUtils.hasText(mapSystemVO.getName()) && !Objects.equals(mapSystem.getName(), mapSystemVO.getName())) {
|
if (Objects.equals(mapSystemVO.getName(), mapSystem.getName()) && Objects.equals(mapSystemVO.getNewApi(), mapSystem.getNewApi()))
|
||||||
mapSystem.setName(mapSystemVO.getName());
|
return;
|
||||||
mapSystem.setNewApi(mapSystemVO.getNewApi());
|
mapSystem.setName(mapSystemVO.getName());
|
||||||
mapSystemDAO.updateByPrimaryKey(mapSystem);
|
mapSystem.setNewApi(mapSystemVO.getNewApi());
|
||||||
}
|
mapSystemDAO.updateByPrimaryKey(mapSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +18,7 @@ public class CilApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转动道岔
|
* 转动道岔
|
||||||
|
*
|
||||||
* @param simulation
|
* @param simulation
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -27,6 +28,7 @@ public class CilApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 定操
|
* 定操
|
||||||
|
*
|
||||||
* @param simulation
|
* @param simulation
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -36,6 +38,7 @@ public class CilApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 反操
|
* 反操
|
||||||
|
*
|
||||||
* @param simulation
|
* @param simulation
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -43,9 +46,13 @@ public class CilApiService {
|
|||||||
this.cilSwitchLogicService.turn(simulation, id, CilSwitch.REVERSE);
|
this.cilSwitchLogicService.turn(simulation, id, CilSwitch.REVERSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoute(RtSimulation simulation, String id) {
|
public boolean setRoute(RtSimulation simulation, String id) {
|
||||||
CilRepository repository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository repository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CilRoute cilRoute = repository.getRouteById(id);
|
CilRoute cilRoute = repository.getRouteById(id);
|
||||||
cilRouteLogicService.setRoute(simulation, cilRoute);
|
return cilRouteLogicService.setRoute(simulation, cilRoute);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean cancelRoute(RtSimulation simulation, String id) {
|
||||||
|
return cilRouteLogicService.cancelRoute(simulation, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package club.joylink.rtss.simulation.rt.CIL;
|
|||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.simulation.rt.CIL.bo.*;
|
import club.joylink.rtss.simulation.rt.CIL.bo.*;
|
||||||
import club.joylink.rtss.simulation.rt.RtSimulation;
|
import club.joylink.rtss.simulation.rt.RtSimulation;
|
||||||
import club.joylink.rtss.simulation.rt.SRD.SrdApiService;
|
import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal;
|
||||||
import club.joylink.rtss.simulation.rt.repo.*;
|
import club.joylink.rtss.simulation.rt.repo.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -14,9 +14,6 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
public class CilRouteLogicService {
|
public class CilRouteLogicService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SrdApiService srdApiService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CilSwitchLogicService cilSwitchLogicService;
|
private CilSwitchLogicService cilSwitchLogicService;
|
||||||
|
|
||||||
@ -46,9 +43,12 @@ public class CilRouteLogicService {
|
|||||||
* @return 是否办理
|
* @return 是否办理
|
||||||
*/
|
*/
|
||||||
public boolean setRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
|
public boolean setRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
|
||||||
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
|
if (cilRepository.isSupervised(cilRoute.getId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
|
||||||
// 检查
|
// 检查
|
||||||
// 延续保护选择
|
// 延续保护选择
|
||||||
this.selectRouteOverlap(cilRepository, commonRoute, cilRoute);
|
this.selectRouteOverlap(cilRepository, commonRoute, cilRoute);
|
||||||
@ -80,8 +80,38 @@ public class CilRouteLogicService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cancelRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
|
public boolean cancelRoute(RtSimulation rtSimulation, String routeId) {
|
||||||
return false;
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
|
if (!cilRepository.isSupervised(routeId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CilRoute cilRoute = cilRepository.removeSupervisedRoute(routeId);
|
||||||
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
|
CommonRoute commonRoute = commonRepository.getRouteById(routeId);
|
||||||
|
// 关灯
|
||||||
|
CommonSignal commonSignal = commonRoute.getStart();
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
||||||
|
cilSignalLogicService.UpdateSignalDisplay(rtSimulation, cilSignal, SrSignal.RED, true);
|
||||||
|
/* 取消进路相关所有设备的锁闭状态 */
|
||||||
|
// 延续保护解锁
|
||||||
|
if (cilRoute.getOverlap() != null) {
|
||||||
|
cilRoute.getOverlap().unlock(cilRepository);
|
||||||
|
}
|
||||||
|
cilRoute.setOl(false);
|
||||||
|
// 侧防解锁
|
||||||
|
for (CommonFls commonFls : commonRoute.getFlsList()) {
|
||||||
|
List<CommonFls.FlsElement> firstLevel = commonFls.getFirstLevelList();
|
||||||
|
if (firstLevel != null) {
|
||||||
|
for (CommonFls.FlsElement flsElement : firstLevel) {
|
||||||
|
flsElement.unLock(cilRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cilRoute.setFl(false);
|
||||||
|
// 进路解锁
|
||||||
|
cancelRouteLock(cilRepository, commonRoute);
|
||||||
|
cilRoute.setLock(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void routeUse(CilRepository cilRepository, SwitchPosition switchPosition) {
|
private void routeUse(CilRepository cilRepository, SwitchPosition switchPosition) {
|
||||||
@ -174,9 +204,9 @@ public class CilRouteLogicService {
|
|||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
if (config.isLockFirst()) {
|
// if (config.isLockFirst()) {
|
||||||
this.lockFirst(cilRepository, commonRoute, cilRoute);
|
// this.lockFirst(cilRepository, commonRoute, cilRoute);
|
||||||
}
|
// }
|
||||||
TrackWay pathElement = commonRoute.getPathElement();
|
TrackWay pathElement = commonRoute.getPathElement();
|
||||||
CommonSignal commonSignal = commonRoute.getStart();
|
CommonSignal commonSignal = commonRoute.getStart();
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
||||||
@ -185,28 +215,33 @@ public class CilRouteLogicService {
|
|||||||
cilSwitchLogicService.tryTurn(rtSimulation, pathElement.getSpList()); // 转动道岔
|
cilSwitchLogicService.tryTurn(rtSimulation, pathElement.getSpList()); // 转动道岔
|
||||||
boolean allLock = try2RouteLockSwitches(cilRepository, cilRoute, pathElement.getSpList()); // 锁闭道岔
|
boolean allLock = try2RouteLockSwitches(cilRepository, cilRoute, pathElement.getSpList()); // 锁闭道岔
|
||||||
if (allLock) {
|
if (allLock) {
|
||||||
if (!config.isLockFirst()) {
|
// if (!config.isLockFirst()) {
|
||||||
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
|
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
|
||||||
}
|
// }
|
||||||
cilRoute.setLock(true);
|
cilRoute.setLock(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 侧防设备转动、锁闭
|
// 侧防设备转动、锁闭
|
||||||
if (!cilRoute.isFl()) {
|
if (!cilRoute.isFl()) { //进路未侧防锁闭
|
||||||
List<CommonFls> flsList = pathElement.getFlsList();
|
List<CommonFls> flsList = pathElement.getFlsList();
|
||||||
if (!CollectionUtils.isEmpty(flsList)) {
|
if (!CollectionUtils.isEmpty(flsList)) { //进路侧防不为空
|
||||||
boolean allSwitchLocked = true;
|
boolean allSwitchLocked = true;
|
||||||
for (CommonFls commonFls : flsList) {
|
for (CommonFls commonFls : flsList) {
|
||||||
List<CommonFls.FlsElement> firstLevelList = commonFls.getFirstLevelList();
|
SwitchPosition target = commonFls.getTarget();
|
||||||
for (CommonFls.FlsElement commonFlsElement : firstLevelList) {
|
if (commonRoute.getPathElement().isContainSwitchPosition(target.getCommonSwitch().getId(), target.isNormal())) { //进路包含侧防所防护的道岔位置
|
||||||
//侧防道岔转动
|
List<CommonFls.FlsElement> firstLevelList = commonFls.getFirstLevelList();
|
||||||
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPp().getCommonSwitch(), commonFlsElement.getPp().getPosition());
|
for (CommonFls.FlsElement commonFlsElement : firstLevelList) {
|
||||||
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPae().getCommonSwitch(), commonFlsElement.getPae().getPosition());
|
//侧防信号机关闭并锁闭
|
||||||
//侧防设备锁闭
|
CilSignal flsSignal = cilRepository.getSignalById(commonFlsElement.getPs().getId());
|
||||||
// this.lock(cilRepository, commonFlsElement);
|
cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, flsSignal, CilSignal.RED, true);
|
||||||
boolean allLock = commonFlsElement.lock(cilRepository);
|
//侧防道岔转动
|
||||||
if (!allLock) {
|
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPp().getCommonSwitch(), commonFlsElement.getPp().getPosition());
|
||||||
allSwitchLocked = false;
|
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPae().getCommonSwitch(), commonFlsElement.getPae().getPosition());
|
||||||
|
//侧防设备锁闭
|
||||||
|
boolean allLock = commonFlsElement.lock(cilRepository);
|
||||||
|
if (!allLock) {
|
||||||
|
allSwitchLocked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,6 +252,7 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
// 延续保护设备转动、锁闭
|
// 延续保护设备转动、锁闭
|
||||||
if (!cilRoute.isOl()) {
|
if (!cilRoute.isOl()) {
|
||||||
|
CommonOverlap commonOverlap = commonRoute.getOverlap();
|
||||||
CilOverlap overlap = cilRoute.getOverlap();
|
CilOverlap overlap = cilRoute.getOverlap();
|
||||||
if (overlap != null) {
|
if (overlap != null) {
|
||||||
TrackWay selectedPath = overlap.getSelectedPath();
|
TrackWay selectedPath = overlap.getSelectedPath();
|
||||||
@ -224,9 +260,9 @@ public class CilRouteLogicService {
|
|||||||
cilSwitchLogicService.tryTurn(rtSimulation, selectedPath.getSpList());
|
cilSwitchLogicService.tryTurn(rtSimulation, selectedPath.getSpList());
|
||||||
boolean allSwitchesLocked = try2OverlapLockSwitches(cilRepository, overlap, pathElement.getSpList()); // 锁闭道岔
|
boolean allSwitchesLocked = try2OverlapLockSwitches(cilRepository, overlap, pathElement.getSpList()); // 锁闭道岔
|
||||||
if (allSwitchesLocked) {
|
if (allSwitchesLocked) {
|
||||||
if (!config.isLockFirst()) {
|
// if (!config.isLockFirst()) {
|
||||||
overlapLockSections(cilRepository, overlap, overlap.getSelectedPath().getSectionList());
|
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), overlap.getSelectedPath().getSectionList());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +280,8 @@ public class CilRouteLogicService {
|
|||||||
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean routeCtcMode = cilRoute.getCilServer().isCtcMode();
|
// boolean routeCtcMode = cilRoute.getCilServer().isCtcMode();
|
||||||
|
boolean routeCtcMode = true;
|
||||||
if (cilRoute.isCanAutoOpen()) {
|
if (cilRoute.isCanAutoOpen()) {
|
||||||
if (cilSignal.getSignalAspect() == commonRoute.getSignalAspect()) { //信号机已开启进路指定的信号
|
if (cilSignal.getSignalAspect() == commonRoute.getSignalAspect()) { //信号机已开启进路指定的信号
|
||||||
cilRoute.setCanAutoOpen(false);
|
cilRoute.setCanAutoOpen(false);
|
||||||
@ -335,6 +372,18 @@ public class CilRouteLogicService {
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelRouteLock(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
|
TrackWay pathElement = commonRoute.getPathElement();
|
||||||
|
for (SwitchPosition switchPosition : pathElement.getSpList()) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(switchPosition.getCommonSwitch().getId());
|
||||||
|
cilSwitch.cancelRouteLock();
|
||||||
|
}
|
||||||
|
for (CommonSection commonSection : pathElement.getSectionList()) {
|
||||||
|
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
|
||||||
|
cilSection.cancelRouteLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预先锁闭(锁闭进路内和延续保护的区段)
|
* 预先锁闭(锁闭进路内和延续保护的区段)
|
||||||
*/
|
*/
|
||||||
@ -345,11 +394,12 @@ public class CilRouteLogicService {
|
|||||||
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
|
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
|
||||||
}
|
}
|
||||||
// 延续保护区段锁闭
|
// 延续保护区段锁闭
|
||||||
|
CommonOverlap commonOverlap = commonRoute.getOverlap();
|
||||||
CilOverlap overlap = cilRoute.getOverlap();
|
CilOverlap overlap = cilRoute.getOverlap();
|
||||||
if (overlap != null) {
|
if (overlap != null) {
|
||||||
TrackWay selectedPath = overlap.getSelectedPath();
|
TrackWay selectedPath = overlap.getSelectedPath();
|
||||||
if (selectedPath != null) {
|
if (selectedPath != null) {
|
||||||
overlapLockSections(cilRepository, overlap, selectedPath.getSectionList());
|
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), selectedPath.getSectionList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,13 +560,13 @@ public class CilRouteLogicService {
|
|||||||
// return level;
|
// return level;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 进路征用并转换道岔
|
// * 进路征用并转换道岔
|
||||||
*
|
// *
|
||||||
* @param rtSimulation
|
// * @param rtSimulation
|
||||||
* @param cilRoute
|
// * @param cilRoute
|
||||||
* @return 是否所有道岔已经转换到位
|
// * @return 是否所有道岔已经转换到位
|
||||||
*/
|
// */
|
||||||
// private void turnSwitch(RtSimulation rtSimulation, CilRoute cilRoute) {
|
// private void turnSwitch(RtSimulation rtSimulation, CilRoute cilRoute) {
|
||||||
// // 进路内道岔
|
// // 进路内道岔
|
||||||
// CilRoutePathElement pathElement = cilRoute.getPathElement();
|
// CilRoutePathElement pathElement = cilRoute.getPathElement();
|
||||||
@ -544,23 +594,7 @@ public class CilRouteLogicService {
|
|||||||
// // 延续保护侧防道岔
|
// // 延续保护侧防道岔
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
// private void lockRouteDevices(CilRoute cilRoute) {
|
||||||
* @param rtSimulation
|
|
||||||
* @param cilSwitchPosition
|
|
||||||
* @return 是否转换命令已经发出
|
|
||||||
*/
|
|
||||||
private boolean turnSwitch(RtSimulation rtSimulation, CilSwitchPosition cilSwitchPosition) {
|
|
||||||
CilSwitch cilSwitch = cilSwitchPosition.getCilSwitch();
|
|
||||||
if (!cilSwitchPosition.isOnPosition()) {
|
|
||||||
if (cilSwitch.isRl() || cilSwitch.isSl() || cilSwitch.isOccupy()) { // 道岔进路锁闭/单锁/占用,不转换道岔
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.srdApiService.turnSwitch(rtSimulation, cilSwitch.getId(), cilSwitchPosition.getPosition());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private void lockRouteDevices(CilRoute cilRoute) {
|
|
||||||
// CilRoutePathElement pathElement = cilRoute.getPathElement();
|
// CilRoutePathElement pathElement = cilRoute.getPathElement();
|
||||||
// this.routeLockPathDevices(cilRoute, pathElement);
|
// this.routeLockPathDevices(cilRoute, pathElement);
|
||||||
// // 延续保护锁闭
|
// // 延续保护锁闭
|
||||||
@ -626,7 +660,7 @@ public class CilRouteLogicService {
|
|||||||
// overlapLockSections(overlap, sectionList);
|
// overlapLockSections(overlap, sectionList);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private void overlapLockSections(CilRepository cilRepository, CilOverlap overlap, List<CommonSection> sectionList) {
|
private void overlapLockSections(CilRepository cilRepository, boolean right, List<CommonSection> sectionList) {
|
||||||
for (CommonSection commonSection : sectionList) {
|
for (CommonSection commonSection : sectionList) {
|
||||||
CommonSwitch belongSwitch = commonSection.getBelongSwitch();
|
CommonSwitch belongSwitch = commonSection.getBelongSwitch();
|
||||||
if (belongSwitch != null) {
|
if (belongSwitch != null) {
|
||||||
@ -634,23 +668,13 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
List<CommonSection> relateList = commonSection.getRelateList();
|
List<CommonSection> relateList = commonSection.getRelateList();
|
||||||
if (relateList.isEmpty()) {
|
if (relateList.isEmpty()) {
|
||||||
cilRepository.getSectionById(commonSection.getId()).lockByOverlap(overlap);
|
cilRepository.getSectionById(commonSection.getId()).lockByOverlap(right);
|
||||||
} else {
|
} else {
|
||||||
for (CommonSection section : relateList) {
|
for (CommonSection section : relateList) {
|
||||||
cilRepository.getSectionById(section.getId()).lockByOverlap(overlap);
|
cilRepository.getSectionById(section.getId()).lockByOverlap(right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 进路监控
|
|
||||||
*
|
|
||||||
* @param cilRoute
|
|
||||||
*/
|
|
||||||
private void watchRoute(CilRoute cilRoute) {
|
|
||||||
// if (cilRoute.isOpenAspect()) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -34,27 +34,33 @@ public class CilSignalLogicService {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
|
||||||
* 尝试更新信号机显示
|
// TODO: 2021/4/20 因信号机缺少表示虚拟信号机的字段,故缺少对虚拟信号机的检查
|
||||||
*/
|
// boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
|
||||||
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, boolean logic, int aspect) {
|
// if (signal.sufficientLevel(aspect, logic)) {
|
||||||
if (logic) {
|
// if (logic) {
|
||||||
srdApiService.changeSignalLight(rtSimulation, signal.getId(), SrSignal.OFF);
|
// signal.setAspect(aspect);
|
||||||
signal.setAspect(aspect);
|
// } else {
|
||||||
} else {
|
// srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (signal.sufficientLevel(aspect, false)) {
|
||||||
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
|
public void UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
|
||||||
// TODO: 2021/4/20 因信号机缺少表示虚拟信号机的字段,故缺少对虚拟信号机的检查
|
// TODO: 2021/4/20 因信号机缺少表示虚拟信号机的字段,故缺少对虚拟信号机的检查
|
||||||
boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
|
// boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
|
||||||
if (signal.sufficientLevel(aspect, logic)) {
|
// if (signal.sufficientLevel(aspect, logic)) {
|
||||||
if (logic) {
|
// if (logic) {
|
||||||
signal.setAspect(aspect);
|
// signal.setAspect(aspect);
|
||||||
} else {
|
// } else {
|
||||||
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
// srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
if (signal.sufficientLevel(aspect, false)) {
|
||||||
|
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
package club.joylink.rtss.simulation.rt.CIL.bo;
|
package club.joylink.rtss.simulation.rt.CIL.bo;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.rt.repo.CommonSection;
|
||||||
|
import club.joylink.rtss.simulation.rt.repo.SwitchPosition;
|
||||||
import club.joylink.rtss.simulation.rt.repo.TrackWay;
|
import club.joylink.rtss.simulation.rt.repo.TrackWay;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class CilOverlap extends CilDevice {
|
public class CilOverlap extends CilDevice {
|
||||||
|
|
||||||
boolean right;
|
// boolean right;
|
||||||
CilSignal start;
|
// CilSignal start;
|
||||||
CilSection releaseSection;
|
// CilSection releaseSection;
|
||||||
List<CilRoutePathElement> pathElementList;
|
// List<CilRoutePathElement> pathElementList;
|
||||||
int releaseTime; // 延续保护解锁时间
|
int releaseTime; // 延续保护解锁时间
|
||||||
|
|
||||||
// CilRoutePathElement selectedPath; // 选择出所需办理的路径
|
// CilRoutePathElement selectedPath; // 选择出所需办理的路径
|
||||||
@ -28,4 +31,26 @@ public class CilOverlap extends CilDevice {
|
|||||||
public void updateSelectedPath(TrackWay path) {
|
public void updateSelectedPath(TrackWay path) {
|
||||||
this.selectedPath = path;
|
this.selectedPath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解锁道岔和区段
|
||||||
|
*/
|
||||||
|
public void unlock(CilRepository cilRepository) {
|
||||||
|
if (selectedPath == null)
|
||||||
|
return;
|
||||||
|
List<SwitchPosition> spList = selectedPath.getSpList();
|
||||||
|
if (CollectionUtils.isEmpty(spList))
|
||||||
|
return;
|
||||||
|
for (SwitchPosition switchPosition : spList) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(switchPosition.getCommonSwitch().getId());
|
||||||
|
cilSwitch.cancelOverlapLock();
|
||||||
|
}
|
||||||
|
List<CommonSection> sectionList = selectedPath.getSectionList();
|
||||||
|
if (CollectionUtils.isEmpty(sectionList))
|
||||||
|
return;
|
||||||
|
for (CommonSection commonSection : sectionList) {
|
||||||
|
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
|
||||||
|
cilSection.cancelOverlapLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,4 +112,12 @@ public class CilRepository extends SimulationRepository {
|
|||||||
public void addSupervisedRoute(CilRoute cilRoute) {
|
public void addSupervisedRoute(CilRoute cilRoute) {
|
||||||
this.supervisedRouteMap.put(cilRoute.getId(), cilRoute);
|
this.supervisedRouteMap.put(cilRoute.getId(), cilRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSupervised(String routeId) {
|
||||||
|
return this.supervisedRouteMap.containsKey(routeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CilRoute removeSupervisedRoute(String routeId) {
|
||||||
|
return this.supervisedRouteMap.remove(routeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,13 +205,13 @@ public class CilRepositoryBuilder {
|
|||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSection,
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSection,
|
||||||
String.format("不存在id为[%s]的区段", overlapVO.getUnlockSectionCode()));
|
String.format("不存在id为[%s]的区段", overlapVO.getUnlockSectionCode()));
|
||||||
CilSignal cilSignal = signalMap.get(overlapVO.getSignalCode());
|
CilSignal cilSignal = signalMap.get(overlapVO.getSignalCode());
|
||||||
cilOverlap.releaseSection = cilSection;
|
// cilOverlap.releaseSection = cilSection;
|
||||||
cilOverlap.start = cilSignal;
|
// cilOverlap.start = cilSignal;
|
||||||
cilOverlap.right = cilSignal.isRight();
|
// cilOverlap.right = cilSignal.isRight();
|
||||||
cilOverlap.releaseTime = overlapVO.getUnlockTime();
|
cilOverlap.releaseTime = overlapVO.getUnlockTime();
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSignal,
|
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSignal,
|
||||||
String.format("不存在id为[%s]的信号机", overlapVO.getSignalCode()));
|
String.format("不存在id为[%s]的信号机", overlapVO.getSignalCode()));
|
||||||
cilOverlap.pathElementList = buildPathElementList(cilSignal, overlapVO.getPathList(), sectionMap, switchMap, flsMap);
|
// cilOverlap.pathElementList = buildPathElementList(cilSignal, overlapVO.getPathList(), sectionMap, switchMap, flsMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +44,21 @@ public class CilSection extends CilDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lockByOverlap(CilOverlap overlap) {
|
public void cancelRouteLock() {
|
||||||
|
this.rl = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockByOverlap(boolean right) {
|
||||||
if (!this.ol) {
|
if (!this.ol) {
|
||||||
this.ol = true;
|
this.ol = true;
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(this.rl && this.lr != overlap.isRight());
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(this.rl && this.lr != right);
|
||||||
if (this.lr != overlap.isRight()) {
|
if (this.lr != right) {
|
||||||
this.lr = overlap.isRight();
|
this.lr = right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelOverlapLock() {
|
||||||
|
this.ol = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,14 @@ public class CilSignal extends CilDevice {
|
|||||||
public static final int GREEN = 2; // 绿灯信号(直向通行)
|
public static final int GREEN = 2; // 绿灯信号(直向通行)
|
||||||
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
|
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
|
||||||
public static final int GUIDE = 4; // 引导信号(正线为黄红)
|
public static final int GUIDE = 4; // 引导信号(正线为黄红)
|
||||||
|
public static final int LL = 5; // 绿绿
|
||||||
|
public static final int LH = 6; // 绿黄
|
||||||
|
public static final int HH = 7; // 黄黄
|
||||||
|
public static final int HSH = 8; // 黄闪黄
|
||||||
|
public static final int BH = 9; // 白红
|
||||||
|
public static final int L = 10; // 蓝
|
||||||
|
public static final int B = 11; // 白
|
||||||
|
public static final int HS = 12; // 红闪
|
||||||
boolean logic;
|
boolean logic;
|
||||||
boolean forceLight; // 强制点灯
|
boolean forceLight; // 强制点灯
|
||||||
boolean bl; // 封锁
|
boolean bl; // 封锁
|
||||||
@ -31,6 +39,8 @@ public class CilSignal extends CilDevice {
|
|||||||
public static final int LEVEL_3 = 3; //ATP级
|
public static final int LEVEL_3 = 3; //ATP级
|
||||||
public static final int LEVEL_4 = 4; //主信号级
|
public static final int LEVEL_4 = 4; //主信号级
|
||||||
|
|
||||||
|
boolean fl; //侧防锁闭(侧防锁闭后不能排列任何以此为始端信号机的进路)
|
||||||
|
|
||||||
public CilSignal(String id, String name) {
|
public CilSignal(String id, String name) {
|
||||||
super(id, name);
|
super(id, name);
|
||||||
}
|
}
|
||||||
@ -62,20 +72,29 @@ public class CilSignal extends CilDevice {
|
|||||||
* 信号机有足够的级别以{aspect}显示
|
* 信号机有足够的级别以{aspect}显示
|
||||||
*/
|
*/
|
||||||
public boolean sufficientLevel(int aspect, boolean logic) {
|
public boolean sufficientLevel(int aspect, boolean logic) {
|
||||||
switch (aspect) {
|
// switch (aspect) {
|
||||||
case RED:
|
// case RED:
|
||||||
return true;
|
// return true;
|
||||||
case GUIDE:
|
// case GUIDE:
|
||||||
return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4;
|
// return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4;
|
||||||
case GREEN:
|
// case GREEN:
|
||||||
case YELLOW:
|
// case YELLOW:
|
||||||
if (logic) {
|
// if (logic) {
|
||||||
return level == LEVEL_3 || level == LEVEL_4;
|
// return level == LEVEL_3 || level == LEVEL_4;
|
||||||
} else {
|
// } else {
|
||||||
return level == LEVEL_4;
|
// return level == LEVEL_4;
|
||||||
}
|
// }
|
||||||
default:
|
// default:
|
||||||
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("未知的显示状态");
|
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("未知的显示状态[%s]", aspect));
|
||||||
}
|
// }
|
||||||
|
return level == LEVEL_4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flankLock() {
|
||||||
|
this.fl = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelFlankLock() {
|
||||||
|
this.fl = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,18 +68,30 @@ public class CilSwitch extends CilDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelRouteLock() {
|
||||||
|
this.rl = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void lockByOverlap(CilOverlap overlap) {
|
public void lockByOverlap(CilOverlap overlap) {
|
||||||
if (!this.ol) {
|
if (!this.ol) {
|
||||||
this.ol = true;
|
this.ol = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelOverlapLock() {
|
||||||
|
this.ol = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void flankLock() {
|
public void flankLock() {
|
||||||
if (!this.fl) {
|
if (!this.fl) {
|
||||||
this.fl = true;
|
this.fl = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelFlankLock() {
|
||||||
|
this.fl = false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLocked() {
|
public boolean isLocked() {
|
||||||
return sl || rl || ol || fl;
|
return sl || rl || ol || fl;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,9 @@ public class SrdApiService {
|
|||||||
boolean change = false;
|
boolean change = false;
|
||||||
if (srSignal.getState() != aspect) {
|
if (srSignal.getState() != aspect) {
|
||||||
LocalDateTime systemTime = rtSimulation.getSystemTime();
|
LocalDateTime systemTime = rtSimulation.getSystemTime();
|
||||||
|
if (aspect >= 5 && aspect <= 12) { //2021-04-23 10:41:52 临时
|
||||||
|
srSignal.open(systemTime, aspect);
|
||||||
|
}
|
||||||
switch (aspect) {
|
switch (aspect) {
|
||||||
case SrSignal.OFF:{
|
case SrSignal.OFF:{
|
||||||
srSignal.close(systemTime);
|
srSignal.close(systemTime);
|
||||||
|
@ -28,6 +28,14 @@ public class SrSignal extends SrDevice {
|
|||||||
public static final int GREEN = 2; // 绿灯信号(直向通行)
|
public static final int GREEN = 2; // 绿灯信号(直向通行)
|
||||||
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
|
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
|
||||||
public static final int GUIDE = 4; // 引导信号(正线为黄红)
|
public static final int GUIDE = 4; // 引导信号(正线为黄红)
|
||||||
|
public static final int LL = 5; // 绿绿
|
||||||
|
public static final int LH = 6; // 绿黄
|
||||||
|
public static final int HH = 7; // 黄黄
|
||||||
|
public static final int HSH = 8; // 黄闪黄
|
||||||
|
public static final int BH = 9; // 白红
|
||||||
|
public static final int L = 10; // 蓝
|
||||||
|
public static final int B = 11; // 白
|
||||||
|
public static final int HS = 12; // 红闪
|
||||||
|
|
||||||
AtomicInteger command = new AtomicInteger(NONE);
|
AtomicInteger command = new AtomicInteger(NONE);
|
||||||
public static final int NONE = 0;
|
public static final int NONE = 0;
|
||||||
@ -97,4 +105,8 @@ public class SrSignal extends SrDevice {
|
|||||||
throw new IllegalArgumentException(String.format("无效的道岔状态:[%s]", state));
|
throw new IllegalArgumentException(String.format("无效的道岔状态:[%s]", state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void open(LocalDateTime systemTime, int aspect) {
|
||||||
|
this.startTurn(systemTime, aspect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,11 @@ public class SignalOperationHandler {
|
|||||||
|
|
||||||
@SimulationOperationMapping("Signal_Set_Route")
|
@SimulationOperationMapping("Signal_Set_Route")
|
||||||
public boolean setRoute(RtSimulation simulation, String id) {
|
public boolean setRoute(RtSimulation simulation, String id) {
|
||||||
this.cilApiService.setRoute(simulation, id);
|
return this.cilApiService.setRoute(simulation, id);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SimulationOperationMapping("Signal_Cancel_Route")
|
@SimulationOperationMapping("Signal_Cancel_Route")
|
||||||
public boolean cancelRoute(RtSimulation simulation, String id) {
|
public boolean cancelRoute(RtSimulation simulation, String id) {
|
||||||
this.cilApiService.turnSwitch(simulation, id);
|
return this.cilApiService.cancelRoute(simulation, id);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.simulation.rt.repo;
|
package club.joylink.rtss.simulation.rt.repo;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.rt.CIL.bo.CilRepository;
|
import club.joylink.rtss.simulation.rt.CIL.bo.CilRepository;
|
||||||
|
import club.joylink.rtss.simulation.rt.CIL.bo.CilSignal;
|
||||||
import club.joylink.rtss.simulation.rt.CIL.bo.CilSwitch;
|
import club.joylink.rtss.simulation.rt.CIL.bo.CilSwitch;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -47,6 +48,14 @@ public class CommonFls extends CommonDevice {
|
|||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.ps != null) {
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
|
||||||
|
if (cilSignal.isForbidAspect()) {
|
||||||
|
cilSignal.flankLock();
|
||||||
|
} else {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.pae != null) {
|
if (this.pae != null) {
|
||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(pae.getCommonSwitch().getId());
|
CilSwitch cilSwitch = cilRepository.getSwitchById(pae.getCommonSwitch().getId());
|
||||||
if (pae.getPosition() == cilSwitch.getPosition()) {
|
if (pae.getPosition() == cilSwitch.getPosition()) {
|
||||||
@ -57,5 +66,20 @@ public class CommonFls extends CommonDevice {
|
|||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unLock(CilRepository cilRepository) {
|
||||||
|
if (this.pp != null) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(this.pp.getCommonSwitch().getId());
|
||||||
|
cilSwitch.cancelFlankLock();
|
||||||
|
}
|
||||||
|
if (this.ps != null) {
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
|
||||||
|
cilSignal.cancelFlankLock();
|
||||||
|
}
|
||||||
|
if (this.pae != null) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(this.pae.getCommonSwitch().getId());
|
||||||
|
cilSwitch.cancelFlankLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user