feat: add tail order controls and terminal drayage UI

This commit is contained in:
2026-09-07 23:58:18 +08:00
parent 36d34b7d1d
commit 74d883a443
11 changed files with 664 additions and 51 deletions
@@ -61,6 +61,11 @@ export interface LastMileOrderSummaryDto {
containerStatus?: string | null
abnormal?: boolean | null
detained?: boolean | null
holdChargeable?: boolean | null
holdReason?: string | null
manualOverrideEnabled?: boolean | null
nodeSource?: 'CONTAINER' | 'MANUAL' | null
version?: number | null
palletCount?: number | null
packageCount?: number | null
volumeCbm?: number | null
@@ -155,11 +160,6 @@ export interface TransferDestinationPayload {
remark?: string
}
export interface ConvertInboundPlanPayload {
orderId: string
customerId: string
}
export interface ContainerPlanProgressQuery {
page: number
size: number
@@ -210,6 +210,60 @@ export interface ConvertContainerInboundPlanPayload {
sourceContainerBookingId: string
}
export type ManualNodeCode =
| 'DOMESTIC_CUSTOMS_COMPLETED'
| 'ESTIMATED_DEPARTURE'
| 'ACTUAL_DEPARTURE'
| 'ESTIMATED_ARRIVAL'
| 'OVERSEAS_CUSTOMS_COMPLETED'
| 'ACTUAL_ARRIVAL_WAITING_UNLOAD'
| 'PICKUP_APPOINTED'
| 'UNLOADED'
export interface ManualInboundPlanPayload {
customerId: string
orderId: string
expectedOrderVersion: number
plannedWarehouseId: string
plannedWarehouseCode: string
plannedWarehouseName: string
plannedArrivalDate: string
inboundCode: string
palletCount: number
palletType: 'STANDARD' | 'WOOD' | 'PAPER'
assigned: boolean
mergeRequired: boolean
urgent: boolean
remark?: string
}
export interface HoldLastMileOrderPayload {
held: boolean
chargeable: boolean
reason: string
expectedVersion: number
}
export interface HoldLastMileOrderResponse {
orderId: string
held: boolean
chargeable: boolean
reason?: string | null
version: number
}
export interface ManualNodeValue {
nodeCode: ManualNodeCode
nodeAt: string | null
}
export interface ManualNodesResponse {
orderId: string
manualOverrideEnabled: boolean
nodes: Array<ManualNodeValue & { source: 'MANUAL' }>
version: number
}
export interface ChangeContainerReceivingWarehousePayload {
overseasWarehouseId: string
expectedVersion: number
@@ -218,6 +272,7 @@ export interface ChangeContainerReceivingWarehousePayload {
export interface LastMileOrderDetailDto {
order: LastMileOrderDto
manualNodes?: ManualNodesResponse['nodes']
cargo: LastMileCargoDto[]
statusHistory: LastMileStatusHistoryDto[]
fees: LastMileFeeDto[]
@@ -276,13 +331,6 @@ export async function transferLastMileOrders(payload: TransferDestinationPayload
return unwrapApiResponse(response)
}
export async function convertLastMileOrderToInboundPlan(payload: ConvertInboundPlanPayload) {
const response = await overseasHttp.post<ApiEnvelope<unknown>, ApiEnvelope<unknown>>(
'/platform/v1/last-leg/inbound-plans/convert', payload,
)
return unwrapApiResponse(response)
}
export async function listContainerPlanProgress(query: ContainerPlanProgressQuery): Promise<OverseasPageResult<ContainerPlanProgressSummaryDto>> {
const response = await overseasHttp.get<ApiEnvelope<OverseasPagePayload<ContainerPlanProgressSummaryDto>>, ApiEnvelope<OverseasPagePayload<ContainerPlanProgressSummaryDto>>>(
'/platform/v1/last-leg/orders/container-summaries',
@@ -298,6 +346,43 @@ export async function getContainerPlanProgress(sourceContainerBookingId: string)
return unwrapApiResponse(response)
}
export async function createManualInboundPlan(payload: ManualInboundPlanPayload, idempotencyKey: string) {
const response = await overseasHttp.post<ApiEnvelope<InboundPlanDetailDto>, ApiEnvelope<InboundPlanDetailDto>>(
'/platform/v1/last-leg/inbound-plans/manual', payload,
{ headers: { 'Idempotency-Key': idempotencyKey } },
)
return unwrapApiResponse(response)
}
export async function updateLastMileOrderHold(orderId: string, payload: HoldLastMileOrderPayload, idempotencyKey: string) {
const response = await overseasHttp.put<ApiEnvelope<HoldLastMileOrderResponse>, ApiEnvelope<HoldLastMileOrderResponse>>(
`/platform/v1/last-leg/orders/${encodeURIComponent(orderId)}/hold`, payload,
{ headers: { 'Idempotency-Key': idempotencyKey } },
)
return unwrapApiResponse(response)
}
export async function getLastMileOrderManualNodes(orderId: string) {
const response = await overseasHttp.get<ApiEnvelope<ManualNodesResponse>, ApiEnvelope<ManualNodesResponse>>(
`/platform/v1/last-leg/orders/${encodeURIComponent(orderId)}/manual-nodes`,
)
return unwrapApiResponse(response)
}
export async function updateLastMileOrderManualNodes(
orderId: string,
expectedVersion: number,
nodes: ManualNodeValue[],
idempotencyKey: string,
) {
const response = await overseasHttp.put<ApiEnvelope<ManualNodesResponse>, ApiEnvelope<ManualNodesResponse>>(
`/platform/v1/last-leg/orders/${encodeURIComponent(orderId)}/manual-nodes`,
{ expectedVersion, nodes },
{ headers: { 'Idempotency-Key': idempotencyKey } },
)
return unwrapApiResponse(response)
}
export async function changeContainerReceivingWarehouse(
sourceContainerBookingId: string,
payload: ChangeContainerReceivingWarehousePayload,