Files
admin-web/src/modules/overseas-warehouse/api/warehouseTransfers.ts
T
2026-09-13 21:10:05 +08:00

118 lines
3.5 KiB
TypeScript

import { overseasHttp } from '@/shared/api/overseasHttp'
import { unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
import { normalizeOverseasPage, type OverseasPagePayload } from './lastMileOrders'
export interface WarehouseTransferQuery {
page: number
size: number
transferNo?: string
operatingWarehouseId?: string
fbaWarehouseCode?: string
status?: string
needRelabel?: boolean
}
export interface WarehouseTransferSummaryDto {
id: string
transferNo: string
inboundCode?: string | null
lastlegOrderId?: string | null
lastlegOrderNo?: string | null
operatingWarehouseId?: string | null
fbaWarehouseCode?: string | null
packageCount: number
deliveryMethod?: string | null
needRelabel: boolean
relabelNo?: string | null
status: string
estimatedArrivalAt?: string | null
createdAt?: string | null
}
export interface WarehouseTransferItemDto {
id: string
skuCode: string
productNameZh: string
packageCount: number
shippingMark?: string | null
}
export interface WarehouseTransferCartonDto {
cartonMark?: string | null
customerCartonMark?: string | null
cartonIndex: number
totalCartons: number
status: string
}
export interface WarehouseTransferRelabelBindingDto {
operationType: string
customerCartonMark: string
originalSku: string
newSku?: string | null
quantity: number
fbaCartonMark?: string | null
destinationWarehouseCode?: string | null
remark?: string | null
}
export interface WarehouseTransferPalletDto {
id: string
sequenceNo: number
palletNo?: string | null
cartonCount: number
grossWeightKg: number
volumeCbm: number
status: string
}
export interface WarehouseTransferDetailDto extends WarehouseTransferSummaryDto {
inboundOrderId?: string | null
orderType?: string | null
orderStatus?: string | null
relabelApplicationId?: string | null
relabelStatus?: string | null
deliveryAddress?: string | null
estimatedShipAt?: string | null
fbaShipmentNo?: string | null
trackingNo?: string | null
fbaBoxNos?: string | null
remark?: string | null
items: WarehouseTransferItemDto[]
cartons: WarehouseTransferCartonDto[]
pallets: WarehouseTransferPalletDto[]
relabelBindings: WarehouseTransferRelabelBindingDto[]
customerConfirmedAt?: string | null
actualShipAt?: string | null
}
export async function listWarehouseTransfers(customerId: string, query: WarehouseTransferQuery) {
const response = await overseasHttp.get<ApiEnvelope<OverseasPagePayload<WarehouseTransferSummaryDto>>, ApiEnvelope<OverseasPagePayload<WarehouseTransferSummaryDto>>>(
'/platform/v1/last-leg/warehouse-transfers',
{ params: { ...query, customerId } },
)
return normalizeOverseasPage(unwrapApiResponse(response))
}
export async function getWarehouseTransfer(customerId: string, transferNo: string) {
const response = await overseasHttp.get<ApiEnvelope<WarehouseTransferDetailDto>, ApiEnvelope<WarehouseTransferDetailDto>>(
`/platform/v1/last-leg/warehouse-transfers/${encodeURIComponent(transferNo)}`,
{ params: { customerId } },
)
return unwrapApiResponse(response)
}
export async function reviewWarehouseTransfer(
customerId: string,
transferNo: string,
decision: 'APPROVE' | 'REJECT',
remark?: string,
) {
const response = await overseasHttp.post<ApiEnvelope<WarehouseTransferDetailDto>, ApiEnvelope<WarehouseTransferDetailDto>>(
`/platform/v1/last-leg/warehouse-transfers/${encodeURIComponent(transferNo)}/review`,
{ decision, remark },
{ params: { customerId } },
)
return unwrapApiResponse(response)
}