添加行车计划新增后生成对应进路序列和股道视图的接口

This commit is contained in:
joylink_zhangsai 2022-07-01 16:31:50 +08:00
parent 00976c99d2
commit 69401d16c0
2 changed files with 26 additions and 0 deletions

View File

@ -169,6 +169,10 @@ public class RouteSequence {
}
}
/**
* 进路数据中的行数据
* tips:行数据有可能没有进路没有进路的不会发给前端
*/
@Getter
@AllArgsConstructor
public static class Line {

View File

@ -19,6 +19,28 @@ public class CTCService {
@Autowired
private CiApiService ciApiService;
/**
* 创建了新的运行计划item
*/
public void runPlanItemCreate(Simulation simulation, Station station, CtcStationRunPlanLog.RunPlanItem item, boolean departure) {
CtcRepository ctcRepository = simulation.getCtcRepository();
//进路序列
RouteSequence routeSequence = ctcRepository.getRouteSequence(station.getCode());
AtomicInteger idGenerator = ctcRepository.getRouteSequenceIdGenerator();
RouteSequence.Line line = RouteSequence.buildLine(item, departure, idGenerator);
routeSequence.addLine(line);
//股道视图
TrackView trackView = ctcRepository.getTrackView(station.getCode());
if (departure) {
trackView.addDepartureLine(line);
} else {
trackView.addReceivingLine(line);
}
}
/**
* 运行计划item更新了
*/
public void runPlanItemUpdate(Simulation simulation, Station station, CtcStationRunPlanLog.RunPlanItem item, boolean departure) {
CtcRepository ctcRepository = simulation.getCtcRepository();
RouteSequence.Line routeSequenceLine = ctcRepository.getRouteSequenceLine(station.getCode(), item.getTripNumber(), departure);