feat(pda): persist and batch cabinet picking

This commit is contained in:
2026-08-10 10:53:11 +08:00
parent 8a79cd02ca
commit 73c1cc3386
5 changed files with 352 additions and 37 deletions
+21
View File
@@ -0,0 +1,21 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
const source = await readFile(new URL('../stores/picking.js', import.meta.url), 'utf8')
test('picking drafts are persisted under operator, task and cabinet identity', () => {
assert.match(source, /pda-picking-draft/)
assert.match(source, /operatorId/)
assert.match(source, /taskId/)
assert.match(source, /containerNo/)
assert.match(source, /uni\.setStorageSync\(key/)
assert.match(source, /uni\.getStorageSync\(key/)
assert.match(source, /uni\.removeStorageSync\(key/)
})
test('draft restore rejects a different operator or task', () => {
assert.match(source, /saved\.operatorId !== identityValue\(identity\)\.operatorId/)
assert.match(source, /saved\.taskId !== identityValue\(identity\)\.taskId/)
assert.match(source, /saved\.containerNo !== identityValue\(identity\)\.containerNo/)
})