refactor: remove dropship printing from PDA
This commit is contained in:
+1
-26
@@ -1,4 +1,4 @@
|
||||
import { apiDownload, apiRequest } from '@/api/http.js'
|
||||
import { apiRequest } from '@/api/http.js'
|
||||
import { stableOperationId } from '@/utils/idempotency.js'
|
||||
import { session } from '@/stores/session.js'
|
||||
|
||||
@@ -44,31 +44,6 @@ export function sealDropshipPallet(taskId, warehouseId, pallet) {
|
||||
return apiRequest({ url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/pallets/${encodeURIComponent(pallet.palletId)}/seal`, method: 'POST', data: { warehouseId: stableId(warehouseId), expectedVersion: pallet.version, operationId: operationId('seal', taskId, { warehouseId, palletId: pallet.palletId, version: pallet.version }) } })
|
||||
}
|
||||
|
||||
export function downloadDropshipPalletLabel(taskId, warehouseId, palletId) {
|
||||
const baseUrl = String(session.apiBase || '/api/platform/v1').replace(/\/$/, '')
|
||||
const url = `${baseUrl}${ROOT}/tasks/${encodeURIComponent(taskId)}/pallets/${encodeURIComponent(palletId)}/print?warehouseId=${encodeURIComponent(stableId(warehouseId))}`
|
||||
return apiDownload({ url }).then((response) => {
|
||||
const contentType = response.header?.['Content-Type'] || response.header?.['content-type'] || ''
|
||||
if (response.statusCode < 200 || response.statusCode >= 300 || !response.tempFilePath || (contentType && !/^application\/pdf/i.test(contentType))) {
|
||||
const error = new Error('托盘码打印文件生成失败')
|
||||
error.statusCode = response.statusCode
|
||||
error.requestId = response.header?.['X-Request-Id'] || response.header?.['x-request-id']
|
||||
error.traceId = response.header?.['X-Trace-Id'] || response.header?.['x-trace-id']
|
||||
throw error
|
||||
}
|
||||
return response.tempFilePath
|
||||
})
|
||||
}
|
||||
|
||||
export function downloadAllDropshipPalletLabels(taskId, warehouseId) {
|
||||
const baseUrl = String(session.apiBase || '/api/platform/v1').replace(/\/$/, '')
|
||||
const url = `${baseUrl}${ROOT}/tasks/${encodeURIComponent(taskId)}/pallets/print?warehouseId=${encodeURIComponent(stableId(warehouseId))}`
|
||||
return apiDownload({ url }).then((response) => {
|
||||
const contentType = response.header?.['Content-Type'] || response.header?.['content-type'] || ''
|
||||
if (response.statusCode < 200 || response.statusCode >= 300 || !response.tempFilePath || (contentType && !/^application\/pdf/i.test(contentType))) throw new Error('全部托盘码打印文件生成失败')
|
||||
return response.tempFilePath
|
||||
})
|
||||
}
|
||||
|
||||
function requireValue(value, message) {
|
||||
if (value === null || value === undefined || value === '') throw new Error(message)
|
||||
|
||||
Reference in New Issue
Block a user