75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import { overseasHttp } from '@/shared/api/overseasHttp'
|
|||
|
|
import { unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||
|
|
import type { OverseasPageResult } from './lastMileOrders'
|
||
|
|
|
||
|
|
export interface InventoryBalanceDto {
|
||
|
|
id: string
|
||
|
|
customerId: string
|
||
|
|
customerName?: string | null
|
||
|
|
overseasWarehouseId: string
|
||
|
|
overseasWarehouseCode?: string | null
|
||
|
|
overseasWarehouseName?: string | null
|
||
|
|
destinationWarehouseId?: string | null
|
||
|
|
destinationWarehouseCode?: string | null
|
||
|
|
destinationWarehouseName?: string | null
|
||
|
|
inboundOrderId: string
|
||
|
|
inboundOrderNo?: string | null
|
||
|
|
inboundCode: string
|
||
|
|
skuCodes: string[]
|
||
|
|
productNames: string[]
|
||
|
|
warehouseLocationIds: string[]
|
||
|
|
warehouseLocationCodes: string[]
|
||
|
|
totalPackages: number
|
||
|
|
availablePackages: number
|
||
|
|
holdPackages: number
|
||
|
|
allocatedPackages: number
|
||
|
|
pickedPackages: number
|
||
|
|
inTransitPackages: number
|
||
|
|
receivingPackages: number
|
||
|
|
procurementPackages: number
|
||
|
|
updatedAt?: string | null
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface InventoryDashboardDto {
|
||
|
|
inboundOrderCount: number
|
||
|
|
palletCount: number
|
||
|
|
totalPackages: number
|
||
|
|
availablePackages: number
|
||
|
|
holdPackages: number
|
||
|
|
allocatedPackages: number
|
||
|
|
pickedPackages: number
|
||
|
|
inTransitPackages: number
|
||
|
|
receivingPackages: number
|
||
|
|
procurementPackages: number
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface InventoryBalanceQuery {
|
||
|
|
customerId: string
|
||
|
|
page: number
|
||
|
|
size: number
|
||
|
|
customerName?: string
|
||
|
|
overseasWarehouseId?: string
|
||
|
|
skuCode?: string
|
||
|
|
productName?: string
|
||
|
|
batchNo?: string
|
||
|
|
warehouseLocationCode?: string
|
||
|
|
inventoryStatus?: string
|
||
|
|
}
|
||
|
|
|
||
|
|
function params(query: InventoryBalanceQuery) { return { ...query } }
|
||
|
|
|
||
|
|
export async function listInventoryBalances(query: InventoryBalanceQuery) {
|
||
|
|
const response = await overseasHttp.get<ApiEnvelope<OverseasPageResult<InventoryBalanceDto>>, ApiEnvelope<OverseasPageResult<InventoryBalanceDto>>>(
|
||
|
|
'/platform/v1/last-leg/inventory/balances', { params: params(query) },
|
||
|
|
)
|
||
|
|
return unwrapApiResponse(response)
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getInventorySummary(query: InventoryBalanceQuery) {
|
||
|
|
const { page: _page, size: _size, ...summaryParams } = params(query)
|
||
|
|
const response = await overseasHttp.get<ApiEnvelope<InventoryDashboardDto>, ApiEnvelope<InventoryDashboardDto>>(
|
||
|
|
'/platform/v1/last-leg/inventory/summary', { params: summaryParams },
|
||
|
|
)
|
||
|
|
return unwrapApiResponse(response)
|
||
|
|
}
|