2026-10-09 11:01:41 +08:00
|
|
|
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
|
|
|
|
|
|
|
|
|
export interface ArrivalCalendarEntry {
|
|
|
|
|
containerBookingId: string
|
|
|
|
|
bookingNo: string
|
|
|
|
|
containerNo?: string | null
|
|
|
|
|
vesselName?: string | null
|
|
|
|
|
voyageNo?: string | null
|
|
|
|
|
destinationPortName?: string | null
|
|
|
|
|
destinationWarehouseCode?: string | null
|
|
|
|
|
arrivalAt: string
|
|
|
|
|
arrivalType: 'ACTUAL' | 'ESTIMATED'
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-10 11:43:49 +08:00
|
|
|
export interface PickupCalendarEntry {
|
|
|
|
|
containerBookingId: string
|
|
|
|
|
bookingNo: string
|
|
|
|
|
containerNo: string | null
|
|
|
|
|
destinationPortName: string | null
|
|
|
|
|
destinationWarehouseCode: string | null
|
|
|
|
|
fleetSupplierName: string | null
|
|
|
|
|
pickupAppointmentAt: string
|
|
|
|
|
actualPickupAt: string | null
|
|
|
|
|
}
|
|
|
|
|
export interface PickupCalendar {
|
|
|
|
|
records: PickupCalendarEntry[]
|
|
|
|
|
truncated: boolean
|
|
|
|
|
unclassifiedCount: number
|
|
|
|
|
scopeBasis: 'US_DESTINATION_WAREHOUSE'
|
|
|
|
|
timeBasis: 'SOURCE_LOCAL_UNSPECIFIED'
|
|
|
|
|
}
|
|
|
|
|
export async function listPickupCalendar(query: { from: string; to: string }, signal?: AbortSignal) {
|
|
|
|
|
return unwrapApiResponse(await http.get<ApiEnvelope<PickupCalendar>, ApiEnvelope<PickupCalendar>>(
|
|
|
|
|
'/platform/v1/terminal-drayages/calendar', { params: query, signal },
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-09 11:01:41 +08:00
|
|
|
export async function listArrivalCalendar(query: { from: string; to: string }, signal?: AbortSignal) {
|
|
|
|
|
const response = await http.get<ApiEnvelope<ArrivalCalendarEntry[]>, ApiEnvelope<ArrivalCalendarEntry[]>>(
|
|
|
|
|
'/platform/v1/port-schedules/arrival-calendar', { params: query, signal },
|
|
|
|
|
)
|
|
|
|
|
return unwrapApiResponse(response)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function deleteAppointment(appointmentNo: string, version: number) {
|
|
|
|
|
const response = await http.delete<ApiEnvelope<void>, ApiEnvelope<void>>(
|
|
|
|
|
`/platform/v1/last-leg/inbound-plans/fba-appointments/${encodeURIComponent(appointmentNo)}`,
|
|
|
|
|
{ params: { version } },
|
|
|
|
|
)
|
|
|
|
|
return unwrapApiResponse(response)
|
|
|
|
|
}
|