mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 18:20:57 +00:00
feat: full wagon cancel, leg board, wagon dates
feat(freight): editable train leg times, SL invoice payer
This commit is contained in:
@@ -121,6 +121,7 @@ import { VehiclesModule } from "../vehicles/vehicles.module";
|
||||
BookingsService,
|
||||
BookingsRepository,
|
||||
BookingPricingService,
|
||||
ContainerValidationService,
|
||||
BookingInvoiceService,
|
||||
BookingLifecycleNotifierService,
|
||||
BookingTransitionService,
|
||||
|
||||
@@ -67,9 +67,16 @@ export class ContainerValidationService {
|
||||
const has20ft = containerLines.some((bc) => (bc.containerSize ?? '').includes('20'));
|
||||
if (!has20ft) return [];
|
||||
|
||||
const units = await this.load20ftUnits(booking);
|
||||
if (units.length < 2) return [];
|
||||
return this.validate20ftPairingUnits(await this.load20ftUnits(booking));
|
||||
}
|
||||
|
||||
/**
|
||||
* Same rule over units that are not (yet) persisted — a completion payload
|
||||
* being previewed or submitted. Shipping-line completion uses this: its
|
||||
* cargo only hits the DB after the check passes.
|
||||
*/
|
||||
async validate20ftPairingUnits(units: Container20ftUnit[]): Promise<PairingViolation[]> {
|
||||
if (units.length < 2) return [];
|
||||
const maxDiff = await this.maxPairDiffTons();
|
||||
return validate20ftWeightPairing(units, maxDiff);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user