mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 02:58:11 +00:00
fix issues
This commit is contained in:
@@ -590,6 +590,9 @@ export class BookingBatchService implements OnModuleInit {
|
||||
const board: BatchBoardSchedule[] = [];
|
||||
for (const s of schedules) {
|
||||
if (s.status === "ARRIVED" || s.status === "CANCELLED") continue;
|
||||
// Batch board is IMPORT-only: export is FCFS with no batch/priority calc,
|
||||
// and domestic/legacy schedules run the legacy fill, not the window batch.
|
||||
if (s.direction !== "IMPORT") continue;
|
||||
|
||||
const links = await linkRepo.find({ where: { trainScheduleId: s.id } });
|
||||
const linkedIds = new Set(links.map((l) => l.bookingId));
|
||||
@@ -630,6 +633,12 @@ export class BookingBatchService implements OnModuleInit {
|
||||
if (s.status === "ARRIVED" || s.status === "CANCELLED") {
|
||||
throw new BadRequestException("Schedule is no longer active");
|
||||
}
|
||||
// Batch board is IMPORT-only (export is FCFS, no batch/priority calc).
|
||||
if (s.direction !== "IMPORT") {
|
||||
throw new BadRequestException(
|
||||
"The batch board only covers import schedules",
|
||||
);
|
||||
}
|
||||
|
||||
const wagonLengths = await this.loadWagonLengths();
|
||||
const linkRepo = this.dataSource.getRepository(TrainScheduleBooking);
|
||||
@@ -710,15 +719,18 @@ export class BookingBatchService implements OnModuleInit {
|
||||
|
||||
const loco = s.trainSet?.locomotive ?? null;
|
||||
|
||||
// Display windows span the whole booking window: from when it opened
|
||||
// (schedule creation) through the scheduled departure, in 3-hour EAT slots.
|
||||
const openDate = s.createdAt ?? s.scheduledDepartureDate ?? new Date();
|
||||
// Display windows are the REAL booking-window cycles from the global-rules
|
||||
// config (import: opens at windowOpenHour EAT importWindowLeadDays before
|
||||
// departure, lasts windowDurationHours, reopens per reopenDelayMinutes;
|
||||
// export: single FCFS lead window) — not a fixed clock grid.
|
||||
const windowCfg = await this.trainSchedulingService.getWindowConfig();
|
||||
const departureDate = s.scheduledDepartureDate ?? new Date();
|
||||
const windowBuckets = groupBookingsIntoBoardWindows(
|
||||
items,
|
||||
(item) => (item.fullyExecutedAt ? new Date(item.fullyExecutedAt) : null),
|
||||
openDate,
|
||||
s.direction ?? null,
|
||||
departureDate,
|
||||
windowCfg,
|
||||
);
|
||||
|
||||
const emptyCounts = () => ({
|
||||
|
||||
Reference in New Issue
Block a user