Files
admin-web/src/modules/overseas-warehouse/api/lastMileOrders.ts
T

133 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-08-20 09:10:36 +08:00
import { overseasHttp } from '@/shared/api/overseasHttp'
import { unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
export interface OverseasPageResult<T> {
records: T[]
page: number
size: number
total: number
pages: number
}
export interface LastMileOrderQuery {
page: number
size: number
orderNo?: string
inboundCode?: string
containerNo?: string
status?: string
2026-08-21 11:20:09 +08:00
sourceOrderNo?: string
transferWarehouseCode?: string
abnormal?: boolean
detained?: boolean
createdFrom?: string
createdTo?: string
2026-08-20 09:10:36 +08:00
}
export interface LastMileOrderSummaryDto {
id: string
2026-08-21 11:20:09 +08:00
customerId: string
2026-08-20 09:10:36 +08:00
orderNo: string
orderType?: string | null
inboundCode?: string | null
sourceOrderNo?: string | null
2026-08-21 11:20:09 +08:00
sourceInboundId?: string | null
2026-08-20 09:10:36 +08:00
customerName?: string | null
overseasWarehouseName?: string | null
transferWarehouseName?: string | null
2026-08-21 11:20:09 +08:00
transferWarehouseId?: string | null
transferWarehouseCode?: string | null
2026-08-20 09:10:36 +08:00
fbaWarehouseCode?: string | null
containerNo?: string | null
containerStatus?: string | null
abnormal?: boolean | null
detained?: boolean | null
palletCount?: number | null
packageCount?: number | null
volumeCbm?: number | null
productQuantity?: number | null
volumeWeightKg?: number | null
estimatedArrivalAt?: string | null
actualArrivalAt?: string | null
estimatedWarehouseAt?: string | null
inboundOrderNo?: string | null
2026-08-21 11:20:09 +08:00
/** Legacy read-only association retained for compatibility; absent from current service DTO. */
2026-08-20 09:10:36 +08:00
deliveryOrderNo?: string | null
2026-08-21 11:20:09 +08:00
outboundOrderNo?: string | null
2026-08-20 09:10:36 +08:00
relabelOrderNo?: string | null
relabelStatus?: string | null
palletMergeFlag?: string | null
currentStatus?: string | null
privateRemark?: string | null
customerRemark?: string | null
warehouseRemark?: string | null
}
export interface LastMileOrderDto extends LastMileOrderSummaryDto {
customerId: string
sourceOrderNo?: string | null
subOrderStatus?: string | null
createdAt?: string | null
updatedAt?: string | null
}
export interface LastMileCargoDto {
id: string
skuCode?: string | null
productNameZh?: string | null
productNameEn?: string | null
packageCount?: number | null
productQuantity?: number | null
palletCount?: number | null
grossWeightKg?: number | null
dimensionalWeightKg?: number | null
volumeCbm?: number | null
destinationWarehouseName?: string | null
fbaTrackingNo?: string | null
shipmentNo?: string | null
}
export interface LastMileStatusHistoryDto {
id: string
fromStatus?: string | null
toStatus?: string | null
remark?: string | null
createdAt?: string | null
}
2026-08-21 11:20:09 +08:00
export interface TransferDestinationPayload {
orderIds: string[]
warehouseId: string
warehouseCode: string
warehouseName: string
remark?: string
}
2026-08-20 09:10:36 +08:00
export interface LastMileOrderDetailDto {
order: LastMileOrderDto
cargo: LastMileCargoDto[]
statusHistory: LastMileStatusHistoryDto[]
}
export async function listLastMileOrders(query: LastMileOrderQuery) {
const response = await overseasHttp.get<ApiEnvelope<OverseasPageResult<LastMileOrderSummaryDto>>, ApiEnvelope<OverseasPageResult<LastMileOrderSummaryDto>>>(
'/platform/v1/last-leg/orders',
2026-08-21 11:20:09 +08:00
{ params: query },
2026-08-20 09:10:36 +08:00
)
return unwrapApiResponse(response)
}
2026-08-21 11:20:09 +08:00
export async function getLastMileOrder(orderId: string) {
2026-08-20 09:10:36 +08:00
const response = await overseasHttp.get<ApiEnvelope<LastMileOrderDetailDto>, ApiEnvelope<LastMileOrderDetailDto>>(
`/platform/v1/last-leg/orders/${encodeURIComponent(orderId)}`,
2026-08-21 11:20:09 +08:00
)
return unwrapApiResponse(response)
}
export async function transferLastMileOrders(payload: TransferDestinationPayload) {
const response = await overseasHttp.put<ApiEnvelope<number>, ApiEnvelope<number>>(
'/platform/v1/last-leg/orders/destination', payload,
2026-08-20 09:10:36 +08:00
)
return unwrapApiResponse(response)
}