This commit is contained in:
2026-08-07 17:15:06 +08:00
parent 8474829b0e
commit dbaf4c09df
+22 -1
View File
@@ -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 {
InboundFileSummary,
InboundInternalNote,
@@ -126,3 +126,24 @@ export async function getPlatformInbound(tenantId: string, inboundId: string) {
)
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
}