ats道岔消息构建添加更多字段

This commit is contained in:
joylink_zhangsai 2021-04-22 17:50:13 +08:00
parent e15ed2db11
commit a1a65a216a
5 changed files with 49 additions and 33 deletions

View File

@ -12,12 +12,20 @@ import java.util.List;
@Setter
public class AtsSwitch extends AtsDevice {
int position;
int routeUserToPosition;
boolean bl;
boolean sl;
String routeId;
boolean rl;
boolean ol;
boolean fl;
public AtsSwitch(String id, String name) {
super(id, name);
}
public List<Object> buildMessage() {
return Arrays.asList(id, position);
return Arrays.asList(id, position, routeUserToPosition, bl, sl, routeId, rl, ol, fl);
}
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.rt.CIL;
import club.joylink.rtss.simulation.rt.CIL.bo.CilRepository;
import club.joylink.rtss.simulation.rt.CIL.bo.CilRoute;
import club.joylink.rtss.simulation.rt.CIL.bo.CilSwitch;
import club.joylink.rtss.simulation.rt.RtSimulation;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,6 +13,9 @@ public class CilApiService {
@Autowired
private CilSwitchLogicService cilSwitchLogicService;
@Autowired
private CilRouteLogicService cilRouteLogicService;
/**
* 转动道岔
* @param simulation
@ -37,4 +42,10 @@ public class CilApiService {
public void turnSwitchToReverse(RtSimulation simulation, String id) {
this.cilSwitchLogicService.turn(simulation, id, CilSwitch.REVERSE);
}
public void setRoute(RtSimulation simulation, String id) {
CilRepository repository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
CilRoute cilRoute = repository.getRouteById(id);
cilRouteLogicService.setRoute(simulation, cilRoute);
}
}

View File

@ -46,7 +46,7 @@ public class CilRouteLogicService {
* @return 是否办理
*/
public boolean setRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
CommonRepository commonRepository = null; // TODO: 2021/4/19
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
// 检查
@ -78,37 +78,10 @@ public class CilRouteLogicService {
cilRoute.startSetting(rtSimulation.getSystemTime());
cilRepository.addSupervisedRoute(cilRoute);
return true;
}
// // 检查
// // 延续保护选择
// this.selectRouteOverlap(cilRoute);
// // 其他初始化
// // 道岔征用
// CilRoutePathElement pathElement = cilRoute.getPathElement();
// List<CilSwitchPosition> switchPositionList = pathElement.getSwitchPositionList();
// for (CilSwitchPosition cilSwitchPosition : switchPositionList) {
// cilSwitchPosition.routeUse();
// }
// List<CilFls> flsList = pathElement.getFlsList();
// for (CilFls cilFls : flsList) {
// List<CilFls.FlsElement> firstLevelList = cilFls.getFirstLevelList();
// for (CilFls.FlsElement flsElement : firstLevelList) {
// CilSwitchPosition pp = flsElement.getPp();
// if (pp != null) {
// pp.routeUse();
// }
// CilSwitchPosition pae = flsElement.getPae();
// if (pae != null) {
// pae.routeUse();
// }
// }
// }
// // 开始办理
// cilRoute.startSetting(rtSimulation.getSystemTime());
// CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
// cilRepository.addSupervisedRoute(cilRoute);
// return true;
public boolean cancelRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
return false;
}
private void routeUse(CilRepository cilRepository, SwitchPosition switchPosition) {
@ -198,7 +171,7 @@ public class CilRouteLogicService {
}
private void settingProgress(RtSimulation rtSimulation, CilRoute cilRoute, CilConfig config) {
CommonRepository commonRepository = null; // TODO: 2021/4/19
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
if (config.isLockFirst()) {

View File

@ -83,6 +83,12 @@ public class CilRepository extends SimulationRepository {
return cilPsd;
}
public CilRoute getRouteById(String id) {
CilRoute cilRoute = this.routeMap.get(id);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(cilRoute);
return cilRoute;
}
public List<CilRoute> getRouteList() {
return new ArrayList<>(this.routeMap.values());
}

View File

@ -1,7 +1,25 @@
package club.joylink.rtss.simulation.rt.operation;
import club.joylink.rtss.simulation.operation.SimulationOperationController;
import club.joylink.rtss.simulation.operation.SimulationOperationMapping;
import club.joylink.rtss.simulation.rt.CIL.CilApiService;
import club.joylink.rtss.simulation.rt.RtSimulation;
import org.springframework.beans.factory.annotation.Autowired;
@SimulationOperationController()
public class SignalOperationHandler {
@Autowired
private CilApiService cilApiService;
@SimulationOperationMapping("Signal_Set_Route")
public boolean setRoute(RtSimulation simulation, String id) {
this.cilApiService.setRoute(simulation, id);
return true;
}
@SimulationOperationMapping("Signal_Cancel_Route")
public boolean cancelRoute(RtSimulation simulation, String id) {
this.cilApiService.turnSwitch(simulation, id);
return true;
}
}