列车到站后先记录实际运行图信息;实迹运行图添加是否站前折返字段
This commit is contained in:
parent
f3115f7faf
commit
a4b42d13d8
@ -55,8 +55,14 @@ public class AtsPlanService {
|
|||||||
*/
|
*/
|
||||||
public void recordTrainRealRun(Simulation simulation, TrainInfo train,
|
public void recordTrainRealRun(Simulation simulation, TrainInfo train,
|
||||||
Station arriveStation, Section parkingSection, boolean arrive) {
|
Station arriveStation, Section parkingSection, boolean arrive) {
|
||||||
TripPlan tripPlan = simulation.getRepository().getTripPlan(train.getServiceNumber(), train.getTripNumber());
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
|
||||||
LocalDateTime systemTime = simulation.getSystemTime();
|
LocalDateTime systemTime = simulation.getSystemTime();
|
||||||
|
Boolean frontTurnBack = null;
|
||||||
|
RealRun lastRealRun = repository.queryLastRealRun(train.getGroupNumber());
|
||||||
|
if (lastRealRun != null && lastRealRun.getRight() != null && !Objects.equals(lastRealRun.getRight(), tripPlan.isRight())) {
|
||||||
|
frontTurnBack = !arrive;
|
||||||
|
}
|
||||||
RealRun realRun = RealRun.builder().
|
RealRun realRun = RealRun.builder().
|
||||||
groupNumber(train.getGroupNumber()).
|
groupNumber(train.getGroupNumber()).
|
||||||
serviceNumber(train.getServiceNumber()).
|
serviceNumber(train.getServiceNumber()).
|
||||||
@ -67,8 +73,9 @@ public class AtsPlanService {
|
|||||||
right(tripPlan.isRight()).
|
right(tripPlan.isRight()).
|
||||||
time(systemTime).
|
time(systemTime).
|
||||||
second(systemTime.toLocalTime().toSecondOfDay()).
|
second(systemTime.toLocalTime().toSecondOfDay()).
|
||||||
|
frontTurnBack(frontTurnBack).
|
||||||
build();
|
build();
|
||||||
simulation.getRepository().addRealRunRecord(realRun);
|
repository.addRealRunRecord(realRun);
|
||||||
|
|
||||||
this.atsMessageCollectAndDispatcher.sendTrainRunData(simulation, realRun);
|
this.atsMessageCollectAndDispatcher.sendTrainRunData(simulation, realRun);
|
||||||
}
|
}
|
||||||
@ -649,6 +656,9 @@ public class AtsPlanService {
|
|||||||
train.getTripNumber(), train.getDestinationCode(),
|
train.getTripNumber(), train.getDestinationCode(),
|
||||||
station.getName(), station.getCode(),
|
station.getName(), station.getCode(),
|
||||||
section.getName(), section.getCode()));
|
section.getName(), section.getCode()));
|
||||||
|
if (train.isPlanTrain()) { //先记录实迹运行图,以免ATS主逻辑改掉服务-车次号
|
||||||
|
this.recordTrainRealRun(simulation, train, station, section, true);
|
||||||
|
}
|
||||||
// 列车到站状态
|
// 列车到站状态
|
||||||
LocalTime systemTime = simulation.getSystemTime().toLocalTime();
|
LocalTime systemTime = simulation.getSystemTime().toLocalTime();
|
||||||
int parkTime = this.atsStandService.trainParkingAndGetParkTime(simulation, section);
|
int parkTime = this.atsStandService.trainParkingAndGetParkTime(simulation, section);
|
||||||
@ -656,8 +666,6 @@ public class AtsPlanService {
|
|||||||
if (train.isPlanTrain()) {
|
if (train.isPlanTrain()) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
|
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
|
||||||
// 记录列车实际运行到站信息
|
|
||||||
this.recordTrainRealRun(simulation, train, station, section, true);
|
|
||||||
// 更新追踪列车到站状态
|
// 更新追踪列车到站状态
|
||||||
StationPlan stationPlan = tripPlan.queryStationPlanByStation(station);
|
StationPlan stationPlan = tripPlan.queryStationPlanByStation(station);
|
||||||
if (parkTime < 0) {
|
if (parkTime < 0) {
|
||||||
|
@ -1068,4 +1068,13 @@ public class SimulationDataRepository {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RealRun queryLastRealRun(String groupNumber) {
|
||||||
|
for (int i = this.realRunRecordList.size() - 1; i >= 0; i--) {
|
||||||
|
RealRun realRun = this.realRunRecordList.get(i);
|
||||||
|
if (realRun.getGroupNumber().equals(groupNumber))
|
||||||
|
return realRun;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@ public class RealRun {
|
|||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
private Boolean right;
|
private Boolean right;
|
||||||
|
|
||||||
|
private Boolean frontTurnBack;
|
||||||
|
|
||||||
public String getSTNumber() {
|
public String getSTNumber() {
|
||||||
return String.format("%s%s", this.serviceNumber, this.tripNumber == null ? "" : this.tripNumber);
|
return String.format("%s%s", this.serviceNumber, this.tripNumber == null ? "" : this.tripNumber);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user