mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-31 22:27:37 +00:00
feat: implement 20ft container weight-pairing validation
- Added ContainerValidationService to handle 20ft weight-pairing logic. - Introduced validate20ftWeightPairing utility function to check weight differences. - Updated BookingPricingService to include overweight line details and pairing errors in price response. - Enhanced BookingTransitionService to reject submissions with unpairable 20ft containers. - Created ShipmentValidation interface for pre-submit validation of container contracts. - Integrated shipment validation into the contract booking process, providing warnings for overweight containers and hard blocks for pairing errors. - Updated front-end components to display validation results and prevent submission when errors are present.
This commit is contained in:
@@ -27,6 +27,20 @@ export class PriceLineItemDto {
|
||||
currency!: string;
|
||||
}
|
||||
|
||||
export class OverweightLineDto {
|
||||
@ApiProperty()
|
||||
containerTypeCode!: string;
|
||||
|
||||
@ApiProperty()
|
||||
totalVgmTons!: number;
|
||||
|
||||
@ApiProperty()
|
||||
maxAllowedTons!: number;
|
||||
|
||||
@ApiProperty()
|
||||
excessTons!: number;
|
||||
}
|
||||
|
||||
export class GeneratePriceResponseDto {
|
||||
@ApiProperty()
|
||||
bookingId!: string;
|
||||
@@ -42,4 +56,16 @@ export class GeneratePriceResponseDto {
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
warnings!: string[];
|
||||
|
||||
/** Overweight container lines (VGM over the weight-limit rule) — surcharge already in lineItems. */
|
||||
@ApiProperty({ type: [OverweightLineDto] })
|
||||
overweightLines!: OverweightLineDto[];
|
||||
|
||||
/**
|
||||
* 20ft weight-pairing violations. Non-empty means the booking cannot be
|
||||
* balanced onto wagons and submit is HARD-BLOCKED — the customer must fix
|
||||
* container weights/quantities. (Overweight, by contrast, only warns.)
|
||||
*/
|
||||
@ApiProperty({ type: [String] })
|
||||
pairingErrors!: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user