优化
This commit is contained in:
@@ -80,6 +80,7 @@ export type LoadingListSummary = PreloadSummary | ConfirmedSummary
|
||||
|
||||
export interface LoadingItem {
|
||||
itemId: string
|
||||
itemVersion: number
|
||||
accountId: string
|
||||
customerName: string | null
|
||||
orderId: string
|
||||
@@ -172,6 +173,19 @@ export interface TransportUpdateRequest {
|
||||
operationReason: string | null
|
||||
}
|
||||
|
||||
export interface WarehouseRemarkUpdateRequest {
|
||||
warehouseRemark: string | null
|
||||
expectedPlanVersion: number
|
||||
expectedItemVersion: number
|
||||
operationId: string
|
||||
}
|
||||
|
||||
export interface WarehouseRemarkUpdateResponse {
|
||||
id: string
|
||||
version: number
|
||||
items: Array<{ id: string; version: number; warehouseRemark: string | null }>
|
||||
}
|
||||
|
||||
export interface PreloadConfirmationResponse {
|
||||
planId: string
|
||||
containerBookingId: string
|
||||
@@ -239,6 +253,7 @@ function normalizeItem(raw: LoadingItem): LoadingItem {
|
||||
return {
|
||||
...raw,
|
||||
itemId: requiredId(raw.itemId),
|
||||
itemVersion: Number(raw.itemVersion),
|
||||
accountId: requiredId(raw.accountId),
|
||||
orderId: requiredId(raw.orderId),
|
||||
inboundId: requiredId(raw.inboundId),
|
||||
@@ -312,6 +327,19 @@ export async function updatePreloadTransport(planId: string, warehouseId: string
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateLoadingItemWarehouseRemark(planId: string, itemId: string, request: WarehouseRemarkUpdateRequest) {
|
||||
const response = await http.patch<ApiEnvelope<WarehouseRemarkUpdateResponse>, ApiEnvelope<WarehouseRemarkUpdateResponse>>(
|
||||
`${basePath}/smart-loading/plans/${encodeURIComponent(planId)}/items/${encodeURIComponent(itemId)}/warehouse-remark`,
|
||||
request,
|
||||
)
|
||||
const result = unwrapApiResponse(response)
|
||||
return {
|
||||
...result,
|
||||
id: requiredId(result.id),
|
||||
items: (result.items || []).map((item) => ({ ...item, id: requiredId(item.id), version: Number(item.version) })),
|
||||
}
|
||||
}
|
||||
|
||||
export async function confirmPreloadPlan(planId: string, expectedVersion: number, operationId: string) {
|
||||
const response = await http.post<ApiEnvelope<PreloadConfirmationResponse>, ApiEnvelope<PreloadConfirmationResponse>>(
|
||||
`${basePath}/loading-plans/${encodeURIComponent(planId)}/confirm`,
|
||||
|
||||
Reference in New Issue
Block a user