mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
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.
This commit is contained in:
@@ -2802,10 +2802,14 @@ export class TrainSchedulingService {
|
||||
`Booking ${booking.reference} is within the soft hold window (expires ${booking.holdExpiresAt?.toISOString()})`,
|
||||
);
|
||||
}
|
||||
// Overweight is the soft threshold (maxVgmTons): the customer already
|
||||
// paid the overweight surcharge at booking. The hard ceiling
|
||||
// (maxCapacityTons) blocks booking creation, so anything reaching
|
||||
// scheduling is shippable — warn the planner, never block allocation.
|
||||
const overweightLines = (booking.bookingContainers ?? []).filter((c) => c.isOverweight);
|
||||
if (overweightLines.length) {
|
||||
violations.push(
|
||||
`Booking ${booking.reference} has overweight container lines; use forceAssign to override`,
|
||||
warnings.push(
|
||||
`Booking ${booking.reference} has ${overweightLines.length} overweight container line(s); overweight surcharge applied`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user