Merge branch 'freight/feat/booking-schedule' into freight/develop

This commit is contained in:
ghost2023
2026-06-16 12:39:56 +03:00
35 changed files with 2648 additions and 963 deletions

View File

@@ -1,20 +1,20 @@
import type { BaseEntity } from "../common";
export * from "./file_upload_settings";
export * from "./dropdown_settings";
export * from "./file_upload_settings";
export * from "./overview";
export enum TradeDirection {
IMPORT = 'IMPORT',
EXPORT = 'EXPORT',
BOTH = 'BOTH',
IMPORT = "IMPORT",
EXPORT = "EXPORT",
BOTH = "BOTH",
}
export enum PriorityType {
USD_PAYER = 'USD_PAYER',
RAIL_AND_FORWARDING = 'RAIL_AND_FORWARDING',
GOVERNMENT_ACCOUNT = 'GOVERNMENT_ACCOUNT',
HIGH_VOLUME_SHIPMENT = 'HIGH_VOLUME_SHIPMENT',
USD_PAYER = "USD_PAYER",
RAIL_AND_FORWARDING = "RAIL_AND_FORWARDING",
GOVERNMENT_ACCOUNT = "GOVERNMENT_ACCOUNT",
HIGH_VOLUME_SHIPMENT = "HIGH_VOLUME_SHIPMENT",
}
/** Bonus applied to government bookings so they outrank commercial priority. */
@@ -26,19 +26,19 @@ export interface GovernmentBookingFields {
}
export enum ExceededAction {
WARNING_ONLY = 'WARNING_ONLY',
HARD_BLOCK = 'HARD_BLOCK',
WARNING_ONLY = "WARNING_ONLY",
HARD_BLOCK = "HARD_BLOCK",
}
export enum CalculationMethod {
PER_TON = 'PER_TON',
FLAT_FEE = 'FLAT_FEE',
PERCENTAGE = 'PERCENTAGE',
PER_TON = "PER_TON",
FLAT_FEE = "FLAT_FEE",
PERCENTAGE = "PERCENTAGE",
}
export enum FreightType {
Container = 'CONTAINER',
Bulk = 'BULK',
Container = "CONTAINER",
Bulk = "BULK",
}
export enum BookingStatus {
@@ -282,6 +282,9 @@ export interface IBooking extends BaseEntity {
totalAmount: number;
paymentStatus: PaymentStatus;
shippingLineId?: string | null;
serviceTypeId: string;
contractType: "NEW" | "RENEWAL";
previousContractId?: string | null;
serviceType: "RAIL_ONLY" | "RAIL_AND_FORWARDING";
@@ -311,6 +314,11 @@ export interface IBooking extends BaseEntity {
endDate?: string | null;
financialTerms?: string | null;
/** When the batch engine picked this booking and opened the pay window. */
selectedForBatchAt?: string | null;
/** End of the pay window once the booking is SELECTED_FOR_BATCH. */
paymentDeadline?: string | null;
containers?: Array<{ type: string; qty: number; vgm: number }> | null;
versionNumber: number;
@@ -390,6 +398,18 @@ export interface BookingReferenceService {
id: string;
name: string;
code: string;
serviceName: string;
description?: string | null | undefined;
canBeBookedAlone: boolean;
includesFirstMile: boolean;
includesLastMile: boolean;
includesCustoms: boolean;
priorityBonusPoints: number;
isActive: boolean;
displayOrder: number;
createdAt: string;
updatedAt: string;
deletedAt?: string | null | undefined;
}
export interface BookingReferenceShippingLine {
@@ -420,6 +440,39 @@ export interface BookingReferenceData {
cargo_type: BookingReferenceCargoTypeGroup[];
}
// ── Train Scheduling (bookable schedules) ──────────────────────────────────────
export interface BookableSchedulesQuery {
originYardId?: string;
destinationYardId?: string;
}
export interface BookableScheduleLocomotive {
id: string;
code: string;
name: string | null;
readiness: string | null;
}
export interface BookableScheduleItem {
id: string;
scheduleDate: string;
trainNumber: string | null;
routeName: string | null;
origin: string | null;
destination: string | null;
locomotive: BookableScheduleLocomotive | null;
wagonCount: number;
totalWeightTons: number;
totalLengthMeters: number;
bookingsCount: number;
freightType: FreightType | "MIXED" | null;
status: TrainScheduleStatus;
bookingWindowStatus: ScheduleBookingWindow;
maxWagons: number;
remainingWagons: number;
}
// ── DTOs ───────────────────────────────────────────────────────────────────────
export interface CreateBookingContainerDto {
@@ -429,31 +482,34 @@ export interface CreateBookingContainerDto {
}
export interface CreateBookingDto {
reference?: string;
customerId?: string;
companyId?: string;
trainId?: string;
freightShapeValidation?: boolean | undefined;
reference?: string | undefined;
isGovernment?: boolean | undefined;
governmentInstitution?: string | undefined;
companyId?: string | undefined;
trainId?: string | undefined;
trainScheduleId?: string | undefined;
scheduledDate: string;
contractType: "NEW" | "RENEWAL";
previousContractId?: string;
contractType: string;
previousContractId?: string | undefined;
serviceTypeId: string;
firstMilePickupAddress?: string;
lastMileDeliveryAddress?: string;
equipmentReturn: "WITH_RETURN" | "WITHOUT_RETURN" | "NA";
firstMilePickupAddress?: string | undefined;
lastMileDeliveryAddress?: string | undefined;
equipmentReturn: string;
originYardId: string;
destinationYardId: string;
tradeDirection: "IMPORT" | "EXPORT" | "DOMESTIC";
freightType: FreightType;
cargoTypeId?: string;
cargoFreeText?: string;
shippingLineId?: string;
tradeDirection: string;
freightType: string;
cargoTypeId?: string | undefined;
cargoFreeText?: string | undefined;
shippingLineId?: string | undefined;
cargoTotalWeightVgm: number;
isHazardous?: boolean;
paymentCurrency: "ETB" | "USD";
pnrCode?: string;
startDate?: string;
endDate?: string;
financialTerms?: string;
isHazardous?: boolean | undefined;
paymentCurrency: string;
pnrCode?: string | undefined;
startDate?: string | undefined;
endDate?: string | undefined;
financialTerms?: string | undefined;
containers?: CreateBookingContainerDto[];
allowConsolidation?: boolean;
}