Release Order plus Storage Allocation Rule and fee

This commit is contained in:
hagiye
2026-06-24 15:27:38 +03:00
174 changed files with 11729 additions and 3162 deletions

View File

@@ -362,6 +362,18 @@ export interface IBooking extends BaseEntity {
/** Null for general contracts at creation — the date is chosen per order. */
scheduledDate: string;
totalAmount: number;
/** Staff-adjusted total that overrides totalAmount for the customer, if set. */
adjustedTotalAmount?: number | null;
adjustedByStaffId?: string | null;
adjustedAt?: string | null;
adjustmentReason?: string | null;
/**
* Contract validity window set by the backoffice at the accept step. Valid
* from contractValidFrom through contractValidUntil (validFrom + N days).
*/
contractValidityDays?: number | null;
contractValidFrom?: string | null;
contractValidUntil?: string | null;
paymentStatus: PaymentStatus;
shippingLineId?: string | null;
@@ -373,8 +385,15 @@ export interface IBooking extends BaseEntity {
firstMileEnabled: boolean;
firstMilePickupAddress?: string | null;
firstMilePickupLat?: number | null;
firstMilePickupLng?: number | null;
lastMileEnabled: boolean;
lastMileDeliveryAddress?: string | null;
lastMileDeliveryLat?: number | null;
lastMileDeliveryLng?: number | null;
customsClearingEnabled?: boolean;
customsClearingAgent?: string | null;
equipmentReturn: "WITH_RETURN" | "WITHOUT_RETURN";
originYard?: IYard | null;
@@ -389,7 +408,6 @@ export interface IBooking extends BaseEntity {
tradeDirection: "IMPORT" | "EXPORT";
paymentCurrency: string;
allowConsolidation: boolean;
consolidationPartnerId?: string | null;
startDate?: string | null;
@@ -432,7 +450,14 @@ export interface IBooking extends BaseEntity {
export interface PricingBreakdownLineItem {
code: string;
/** Computed line total (unitAmount × quantity). */
amount: number;
/** Price for a single unit of this charge (e.g. one 20ft container, one ton). */
unitAmount?: number;
/** Unit the rate is charged per: PER_CONTAINER | PER_TON | PER_WAGON | PER_KM | FLAT. */
unit?: string;
/** How many units this charge applies to (containers, tons, wagons; 1 for FLAT). */
quantity?: number;
currency: string;
description: string;
}
@@ -444,6 +469,34 @@ export interface PricingBreakdown {
totalAmount: number;
}
// ── Document clearance (post counter-sign GL workflow) ──────────────────────
export type DocumentReviewStatus = "PENDING" | "APPROVED" | "QUERIED";
/** One row of the clearance document grid (a required doc + its file + review). */
export interface ClearanceDocument {
fileKey: string;
label: string;
required: boolean;
/** Who supplies this document: the customer, or Global Logistics staff. */
uploadedBy: "customer" | "gl";
settingCode: string;
file: { id: string; name: string; url: string } | null;
reviewStatus: DocumentReviewStatus | null;
note: string | null;
}
/** The clearance view for a booking, driving both portals' clearance UI. */
export interface ClearanceView {
status: string;
includesCustoms: boolean;
inputCode: string | null;
outputCode: string | null;
documents: ClearanceDocument[];
/** True once every required customer document is APPROVED (the 100% gate). */
allApproved: boolean;
}
export interface IInvoice extends BaseEntity {
bookingId: string;
invoiceNumber: string;
@@ -579,6 +632,14 @@ export interface CreateBookingContainerDto {
vgmPerUnitTons: number;
}
/** A contracted route+quantity line for a GENERAL contract. */
export interface CreateContractRouteDto {
originYardId: string;
destinationYardId: string;
containerTypeId?: string | undefined;
quantity: number;
}
export interface CreateBookingDto {
freightShapeValidation?: boolean | undefined;
reference?: string | undefined;
@@ -595,7 +656,13 @@ export interface CreateBookingDto {
previousContractId?: string | undefined;
serviceTypeId: string;
firstMilePickupAddress?: string | undefined;
firstMilePickupLat?: number | undefined;
firstMilePickupLng?: number | undefined;
lastMileDeliveryAddress?: string | undefined;
lastMileDeliveryLat?: number | undefined;
lastMileDeliveryLng?: number | undefined;
customsClearingEnabled?: boolean | undefined;
customsClearingAgent?: string | undefined;
equipmentReturn: string;
originYardId: string;
destinationYardId: string;
@@ -612,7 +679,8 @@ export interface CreateBookingDto {
endDate?: string | undefined;
financialTerms?: string | undefined;
containers?: CreateBookingContainerDto[];
allowConsolidation?: boolean;
/** GENERAL_CONTRACT only: routes the contract reserves quantity across. */
routes?: CreateContractRouteDto[];
}
// ── General Contracts & Booking Orders ──────────────────────────────────────────
@@ -651,11 +719,33 @@ export interface CreateBookingOrderLineDto {
/** Null for bulk/break-bulk; the container type id for container contracts. */
containerTypeId?: string | null;
quantity: number;
/** How much of this line is hazardous (≤ quantity). Defaults to 0. */
hazardousQuantity?: number;
/** How much of this line is refrigerated (≤ quantity). Defaults to 0. */
reeferQuantity?: number;
}
/** Per-route contracted / ordered / remaining pool line (multi-route contracts). */
export interface ContractRouteLine {
routeLineId: string;
originYardId: string;
originYardName?: string | null;
destinationYardId: string;
destinationYardName?: string | null;
containerTypeId?: string | null;
containerTypeName?: string | null;
contractedQuantity: number;
orderedQuantity: number;
remainingQuantity: number;
/** Road distance (km) for this route; used to bill road orders. Null for rail-only. */
km?: number | null;
}
export interface CreateBookingOrderDto {
/** The general contract (booking) this order draws down from. */
contractBookingId: string;
/** For multi-route contracts: the route line being drawn from. */
routeLineId?: string;
/** The shipment day the customer wants for this order. */
scheduledDate: string;
lines: CreateBookingOrderLineDto[];
@@ -666,6 +756,8 @@ export interface IBookingOrderLine {
containerTypeId?: string | null;
containerTypeName?: string | null;
quantity: number;
hazardousQuantity?: number;
reeferQuantity?: number;
}
export interface IBookingOrder {