mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 12:58:13 +00:00
Merge pull request #1045 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
This commit is contained in:
@@ -3718,6 +3718,30 @@ export class TrainSchedulingService {
|
||||
// unload each one by hand. The final station is covered by
|
||||
// arriveSchedule's bulk fallback above.
|
||||
await this.bookingJourneyService.autoUnloadAtYard(scheduleId, station.yardId);
|
||||
// A pass is also a position fix: the locomotives, every wagon still
|
||||
// aboard, and the built train are physically AT this yard now — not at
|
||||
// the origin they departed from. Wagons released at earlier stops no
|
||||
// longer carry this schedule id and stay where they alighted; the final
|
||||
// arrival settle still writes the wagon-movement ledger rows.
|
||||
await this.dataSource.transaction(async (manager) => {
|
||||
const locoIds = this.locomotivesOfTrainSet(schedule.trainSet).map((l) => l.id);
|
||||
if (locoIds.length) {
|
||||
await manager
|
||||
.getRepository(Locomotive)
|
||||
.update({ id: In(locoIds) }, { currentYardId: station.yardId });
|
||||
}
|
||||
await manager
|
||||
.getRepository(Wagon)
|
||||
.update(
|
||||
{ currentTrainScheduleId: scheduleId },
|
||||
{ currentYardId: station.yardId },
|
||||
);
|
||||
if (schedule.trainSet?.trainId) {
|
||||
await manager
|
||||
.getRepository(Train)
|
||||
.update(schedule.trainSet.trainId, { currentYardId: station.yardId });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this.getScheduleCheckpoints(scheduleId);
|
||||
|
||||
Reference in New Issue
Block a user