1
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
import { ApiResponseError, http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||||||
import type {
|
import type {
|
||||||
InboundFileSummary,
|
InboundFileSummary,
|
||||||
InboundInternalNote,
|
InboundInternalNote,
|
||||||
@@ -126,3 +126,24 @@ export async function getPlatformInbound(tenantId: string, inboundId: string) {
|
|||||||
)
|
)
|
||||||
return normalizeDetail(unwrapApiResponse(response))
|
return normalizeDetail(unwrapApiResponse(response))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function downloadInboundCartonLabels(tenantId: string, inboundId: string, cartonIndexes?: number[]) {
|
||||||
|
const response = await http.post<Blob, Blob>(
|
||||||
|
`${basePath}/${encodeURIComponent(inboundId)}/carton-label-pdf`,
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
tenantId,
|
||||||
|
...(cartonIndexes?.length ? { cartonIndex: cartonIndexes } : {}),
|
||||||
|
},
|
||||||
|
responseType: 'blob',
|
||||||
|
timeout: 60_000,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if (response.type.includes('json')) {
|
||||||
|
const error = JSON.parse(await response.text()) as Partial<ApiEnvelope<unknown>>
|
||||||
|
throw new ApiResponseError(error.message || '箱唛生成失败', error.code || 'UNKNOWN', undefined,
|
||||||
|
error.data, error.requestId, error.traceId)
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user