Merge origin/dev into release/test preserving current workflows

This commit is contained in:
2026-09-14 11:05:48 +08:00
17 changed files with 328 additions and 24 deletions
+27 -7
View File
@@ -1,4 +1,5 @@
import { apiDownload, apiRequest } from '@/api/http.js'
import { stableOperationId } from '@/utils/idempotency.js'
import { session } from '@/stores/session.js'
const ROOT = '/first-leg/pda-dropship'
@@ -7,9 +8,8 @@ function stableId(value) {
return String(value ?? '').trim()
}
function operationId(action, taskId) {
const random = Math.random().toString(36).slice(2, 10)
return `pda-dropship-${action}-${taskId}-${Date.now()}-${random}`.slice(0, 128)
function operationId(action, taskId, payload = {}) {
return stableOperationId('dropship-' + action, String(session.currentUser?.id) + '-' + taskId, payload)
}
export function listDropshipPalletizationTasks(keyword = '', warehouseId) {
@@ -33,15 +33,15 @@ export function resolveDropshipCarton(taskId, warehouseId, boxCode) {
}
export function countDropshipCarton(taskId, payload) {
return apiRequest({ url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/cartons/count`, method: 'POST', data: { ...payload, warehouseId: stableId(payload.warehouseId), operationId: payload.operationId || operationId('count', taskId) } })
return apiRequest({ url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/cartons/count`, method: 'POST', data: { ...payload, warehouseId: stableId(payload.warehouseId), operationId: payload.operationId || operationId('count', taskId, payload) } })
}
export function bindDropshipPendingCartons(taskId, warehouseId, palletNo) {
return apiRequest({ url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/pallets/bind-pending`, method: 'POST', data: { warehouseId: stableId(warehouseId), palletNo: String(palletNo || '').trim().toUpperCase(), operationId: operationId('bind', taskId) } })
export function bindDropshipPendingCartons(taskId, warehouseId, palletNo, taskVersion) {
return apiRequest({ url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/pallets/bind-pending`, method: 'POST', data: { warehouseId: stableId(warehouseId), palletNo: String(palletNo || '').trim().toUpperCase(), operationId: operationId('bind', taskId, { warehouseId, palletNo, taskVersion }) } })
}
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) } })
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) {
@@ -69,3 +69,23 @@ export function downloadAllDropshipPalletLabels(taskId, warehouseId) {
return response.tempFilePath
})
}
function requireValue(value, message) {
if (value === null || value === undefined || value === '') throw new Error(message)
}
function operationHeader(operationId) {
return operationId ? { 'Idempotency-Key': String(operationId) } : {}
}
export function moveDropshipCarton(taskId, cartonId, payload = {}) {
requireValue(cartonId, '缺少箱明细标识')
for (const [field, message] of [['warehouseId', '缺少作业仓库标识'], ['operationId', '缺少操作幂等标识']]) requireValue(payload[field], message)
return apiRequest({
url: `${ROOT}/tasks/${encodeURIComponent(taskId)}/cartons/${encodeURIComponent(cartonId)}/move`,
method: 'POST',
header: operationHeader(payload.operationId),
data: { warehouseId: payload.warehouseId, targetPalletNo: payload.targetPalletNo || null, operationId: payload.operationId }
})
}
+1
View File
@@ -126,6 +126,7 @@ export async function submitContainerPickingBatch(task, actions, { warehouseId,
const items = (actions || []).map((action) => ({
itemId: action.itemId,
action: action.type,
palletNo: action.type === 'PICK_PALLET' ? action.palletNo : null,
pickedPackageCount: action.type === 'PICK' ? action.pickedPackageCount : null,
finalPickedPackageCount: action.type === 'PARTIAL' ? action.finalPickedPackageCount : null,
version: action.version,