fix(pda): enforce cabinet evidence contract

This commit is contained in:
2026-08-10 11:53:43 +08:00
parent 5983fad266
commit fc1944fb7e
3 changed files with 93 additions and 26 deletions
+15 -4
View File
@@ -121,7 +121,7 @@ export async function submitContainerPickingBatch(task, actions, { warehouseId,
const results = []
let version = task.version ?? task.pickingVersion
for (const action of actions || []) {
const common = { warehouseId, version: action.version ?? version, operationId: `${submitOperationId}-${action.itemId}` }
const common = { warehouseId, locationIds: action.locationIds || [], version: action.version ?? version, operationId: `${submitOperationId}-${action.itemId}` }
let result
if (action.type === 'PICK') result = await pickContainerItem(task.taskId, action.itemId, { ...common, pickedPackageCount: action.pickedPackageCount })
else if (action.type === 'PARTIAL') result = await partialContainerItem(task.taskId, action.itemId, { ...common, finalPickedPackageCount: action.finalPickedPackageCount })
@@ -190,7 +190,7 @@ export function completePicking(inboundId, payload, tenantId) {
export function getEvidence(inboundId, tenantId) {
return request({
url: `/inbounds/${encodeURIComponent(inboundId)}/loading/evidence?tenantId=${encodeURIComponent(tenantQuery(tenantId))}`,
url: `/inbounds/${encodeURIComponent(inboundId)}/loading/evidence/pda?tenantId=${encodeURIComponent(tenantQuery(tenantId))}`,
method: 'GET'
})
}
@@ -198,9 +198,20 @@ export function getEvidence(inboundId, tenantId) {
export function upsertEvidence(inboundId, payload, tenantId) {
if (!EVIDENCE_TYPES.includes(payload.evidenceType)) throw new Error('不支持的装柜证据类型')
return request({
url: `/inbounds/${encodeURIComponent(inboundId)}/loading/evidence?tenantId=${encodeURIComponent(tenantQuery(tenantId))}`,
url: `/inbounds/${encodeURIComponent(inboundId)}/loading/evidence/pda?tenantId=${encodeURIComponent(tenantQuery(tenantId))}`,
method: 'POST',
header: { 'Idempotency-Key': idempotencyKey(`evidence-${payload.evidenceType}`, inboundId) },
header: { 'Idempotency-Key': stableIdempotencyKey(payload.operationId || `evidence-${inboundId}-${payload.evidenceType}-${payload.fileId || 'seal'}`) },
data: payload
})
}
export function voidEvidence(inboundId, evidenceId, payload = {}, tenantId) {
if (!inboundId || !evidenceId) throw new Error('缺少装柜证据标识,无法作废')
if (!String(payload.reason || '').trim()) throw new Error('作废原因不能为空')
return request({
url: `/inbounds/${encodeURIComponent(inboundId)}/loading/evidence/${encodeURIComponent(evidenceId)}/void/pda?tenantId=${encodeURIComponent(tenantQuery(tenantId))}`,
method: 'POST',
header: { 'Idempotency-Key': stableIdempotencyKey(payload.operationId || `void-evidence-${inboundId}-${evidenceId}-${payload.expectedVersion ?? 0}`) },
data: payload
})
}