fix(pda): 修复海外PDA真机作业并固定APK与热更新发布流程

This commit is contained in:
2026-11-06 12:32:22 +08:00
parent 10d9896b6b
commit 7e793b1d1b
13 changed files with 420 additions and 47 deletions
+78
View File
@@ -107,6 +107,84 @@ test('actual loading confirmation leaves reference measurements blank and blocks
assert.equal(state.loadingRows[0].deliveryIndex, null)
Object.assign(state.loadingRows[0], { weightKg: 92, volumeCbm: 1.5 }); await state.completeLoading(); assert.equal(posts, 0); assert.match(state.error.message, /卸货站/)
})
test('loading completion opens a callback-based confirmation with pallet and package counts before submitting', async () => {
storage(); let modal, posts = 0, reads = 0
uni.showModal = options => { modal = options }
const preview = { dispatchNo: 'PC/1', recordVersion: 0, manifestHash: 'two-pallets', pickingReconciled: true, loadingComplete: { allowed: true }, pallets: [
{ palletNo: 'PALLET-1', pickedPackages: '12', deliveryIndex: 1 },
{ palletNo: 'PALLET-2', pickedPackages: '10', deliveryIndex: 1 }
] }
const state = page({ getDispatchLoading: async () => { reads++; return preview },
completeDispatchLoading: async () => { posts++; return proof(lastCommand) },
getDispatchTask: async () => task({ recordVersion: 1, stage: 'AFTER_LOADING' }) })
state.current = task({ pickingReconciled: true, items: [item({ pickedPackages: 2 })] })
await state.prepareLoading()
assert.equal(state.busy, false)
assert.equal(modal.title, '确认装车')
assert.equal(modal.content, '已拣托盘 2 托\n已拣箱数 22 箱')
assert.equal(posts, 0)
await state.prepareLoading()
assert.equal(reads, 1)
await modal.success({ confirm: true })
assert.equal(posts, 1)
assert.equal(state.current.stage, 'AFTER_LOADING')
assert.equal(state.loadingPreview, null)
})
test('cancelling or failing to open loading confirmation releases the preview for a fresh attempt', async () => {
storage(); let modal, reads = 0
uni.showModal = options => { modal = options }
const preview = { dispatchNo: 'PC/1', recordVersion: 0, pickingReconciled: true, loadingComplete: { allowed: true }, pallets: [{ pickedPackages: 2, deliveryIndex: 1 }] }
const state = page({ getDispatchLoading: async () => { reads++; return preview } })
state.current = task({ pickingReconciled: true, items: [item({ pickedPackages: 2 })] })
await state.prepareLoading()
await modal.success({ cancel: true })
assert.equal(state.loadingPreview, null)
await state.prepareLoading()
modal.fail({ errMsg: '弹窗打开失败' })
assert.equal(state.loadingPreview, null)
assert.equal(state.error.message, '弹窗打开失败')
await state.prepareLoading()
assert.equal(reads, 3)
})
test('loading confirmation ignores responses and callbacks after leaving the task', async () => {
storage(); let resolve, modal, posts = 0
uni.showModal = options => { modal = options }
const preview = { dispatchNo: 'PC/1', recordVersion: 0, pickingReconciled: true, loadingComplete: { allowed: true }, pallets: [{ pickedPackages: 2, deliveryIndex: 1 }] }
const state = page({ getDispatchLoading: () => new Promise(done => { resolve = done }), completeDispatchLoading: async () => { posts++ } })
state.current = task({ pickingReconciled: true, items: [item({ pickedPackages: 2 })] })
const reading = state.prepareLoading()
assert.equal(state.requestBusy, true)
state.generation++
resolve(preview)
await reading
assert.equal(modal, undefined)
assert.equal(state.loadingPreview, null)
const secondReading = state.prepareLoading()
resolve(preview)
await secondReading
state.generation++
await modal.success({ confirm: true })
assert.equal(posts, 0)
assert.equal(state.loadingPreview, null)
})
test('failed loading submission closes the native confirmation and allows a new read', async () => {
storage(); let modal, reads = 0
uni.showModal = options => { modal = options }
const preview = { dispatchNo: 'PC/1', recordVersion: 0, manifestHash: 'manifest', pickingReconciled: true, loadingComplete: { allowed: true }, pallets: [{ pickedPackages: 2, deliveryIndex: 1 }] }
const state = page({ getDispatchLoading: async () => { reads++; return preview }, completeDispatchLoading: async () => { throw new Error('装车提交失败') } })
state.current = task({ pickingReconciled: true, items: [item({ pickedPackages: 2 })] })
await state.prepareLoading()
await modal.success({ confirm: true })
assert.equal(state.error.message, '装车提交失败')
assert.equal(state.loadingPreview, null)
assert.equal(state.busy, false)
await state.prepareLoading()
assert.equal(reads, 2)
})
test('missing versions surface a local error before picking or loading completion and never produce a write', async () => {
storage(); const state = page(); state.selectPallet(state.current.items[0]); state.current.recordVersion = undefined
await state.submitPick(); assert.match(state.error.message, /版本/); assert.equal('pendingCommand' in fulfillment.dispatch, false)