优化
This commit is contained in:
@@ -78,6 +78,16 @@ export async function getPallet(warehouseId: string, palletId: string) {
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
|
||||
export async function getPalletLabelPdf(warehouseId: string, palletId: string) {
|
||||
const blob = await overseasHttp.get<Blob, Blob>(
|
||||
`/platform/v1/warehouse-admin/${encodeURIComponent(warehouseId)}/pallets/${encodeURIComponent(palletId)}/label`,
|
||||
{ responseType: 'blob', timeout: 60_000 },
|
||||
)
|
||||
if (blob.type.includes('application/json')) unwrapApiResponse(JSON.parse(await blob.text()) as ApiEnvelope<unknown>)
|
||||
if (!blob.size || !blob.type.includes('application/pdf')) throw new Error('打印服务未返回有效 PDF,请重试')
|
||||
return blob
|
||||
}
|
||||
|
||||
export async function createPallet(warehouseId: string, payload: SavePalletPayload) {
|
||||
const response = await overseasHttp.post<ApiEnvelope<string>, ApiEnvelope<string>>(
|
||||
`/platform/v1/warehouse-admin/${encodeURIComponent(warehouseId)}/pallets`, payload,
|
||||
|
||||
Reference in New Issue
Block a user