Files
edr-platform/apps/edr-freight-api/src/modules/train-scheduling/booking-batch.constants.ts
Marshal eb819d66a1 Enhance wagon capacity handling and validation in booking service
- Added default capacities for container and bulk wagons.
- Updated wagonsFor method to consider weight and length for wagon calculations.
- Improved handling of overweight bookings with appropriate warnings.
- Adjusted tests to reflect changes in wagon capacity and validation logic.
2026-07-09 13:10:32 +00:00

47 lines
1.8 KiB
TypeScript

/**
* Tunables for the demand-batching booking → allocation flow.
* Times run in EAT so window boundaries match the local operating clock.
*
* Cadence and pay-window durations moved to the train_scheduling_global_rules
* table (TrainSchedulingService.getWindowConfig) — the window engine
* (BookingWindowService) drives all timing off that config.
*/
export const BATCH_TIMEZONE = 'Africa/Addis_Ababa';
/** Fallback wagons-per-booking when a booking has no computed `wagonsRequired`. */
export const DEFAULT_WAGONS_PER_BOOKING = 1;
/**
* Fallback per-wagon length (m) for the batch length budget when global rules don't yet
* define maxTrainLength / maxWagons to derive it from. Used only to estimate train length
* against the locomotive's max train length.
*/
export const DEFAULT_WAGON_LENGTH_METERS = 14;
/** Default NW5 flat wagon length for container bookings (m). */
export const DEFAULT_CONTAINER_WAGON_LENGTH_METERS = 14;
/** Default CW3 covered wagon length for bulk bookings (m). */
export const DEFAULT_BULK_WAGON_LENGTH_METERS = 14;
/**
* Fallback tare weights (T) matching the length fallbacks above. The locomotive
* pull limit is a GROSS limit, so a booking's weight budget must include the
* empty weight of every wagon it occupies — not just its cargo.
*/
export const DEFAULT_CONTAINER_WAGON_TARE_TONS = 22.4;
/** Default CW3 gondola tare for bulk bookings (T). */
export const DEFAULT_BULK_WAGON_TARE_TONS = 23.4;
/**
* Fallback rated payloads (T) matching the tare fallbacks above. A bulk booking's
* wagon count is its cargo divided by this, so a zero here would make the count
* infinite — callers must floor it at a positive number.
*/
export const DEFAULT_CONTAINER_WAGON_CAPACITY_TONS = 70;
/** Default CW3 gondola rated payload for bulk bookings (T). */
export const DEFAULT_BULK_WAGON_CAPACITY_TONS = 60;