This commit is contained in:
2026-09-24 08:55:38 +08:00
parent 50dbbcaa6e
commit bc9fa0faa3
8 changed files with 107 additions and 15 deletions
+27
View File
@@ -30,3 +30,30 @@ test('cancel stays on list and preserves existing task selection', async () => {
assert.equal(context.taskCode, 'PREVIOUS')
assert.equal(context.busy, false)
})
test('new relabel task asks whether to start before it can be claimed', async () => {
const calls = []
const uni = { showModal(options) { calls.push(options); options.success({ confirm: false }) } }
const component = new Function('PortalHeader', 'RelabelPalletWork', 'ScanTargetInput', 'uni', body)({}, {}, {}, uni)
const context = { busy: false }
const confirmed = await component.methods.confirmStartTask.call(context, { relabelNo: 'RL-NEW' })
assert.equal(confirmed, false)
assert.equal(calls[0].title, '开始贴标作业')
assert.match(calls[0].content, /是否开始贴标作业/)
assert.match(calls[0].content, /RL-NEW/)
assert.equal(calls[0].confirmText, '是')
assert.equal(calls[0].cancelText, '否')
assert.equal(context.busy, false)
})
test('start confirmation gates task selection and claim', () => {
const start = source.indexOf('const confirmed = await this.confirmStartTask(item)')
const selection = source.indexOf('this.taskCode = item.relabelNo', start)
const claim = source.indexOf("warehouseIdempotencyKey('relabel', 'claim', payload)", start)
assert.ok(start >= 0)
assert.ok(selection > start)
assert.ok(claim > selection)
assert.match(source.slice(start, selection), /if \(!confirmed\) return/)
})
+26 -2
View File
@@ -19,17 +19,41 @@ test('warehouse transfer PDA API exposes candidates and palletize operations', a
test('warehouse transfer workbench entry is registered', async () => {
const { MODULES } = await import('../src/data/overseas-workbench.js')
const operation = MODULES.flatMap((m) => m.operations).find((item) => item.key === 'warehouseTransfer')
const operation = MODULES.flatMap((m) => m.operations).find((item) => item.key === 'warehouseTransferList')
assert.equal(operation?.available, true)
assert.equal(operation?.route, '/pages/warehouse-transfer/warehouse-transfer')
assert.equal(operation?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=list')
const work = MODULES.flatMap((m) => m.operations).find((item) => item.key === 'warehouseTransferWork')
assert.equal(work?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=work')
})
test('warehouse transfer page loads detail without exposing internal identifiers', async () => {
const page = await readFile(new URL('../src/pages/warehouse-transfer/warehouse-transfer.vue', import.meta.url), 'utf8')
assert.match(page, /getWarehouseTransferDetail\(item\.transferNo\)/)
assert.match(page, /待测转运单/)
assert.match(page, /仓储转运测量列表/)
assert.match(page, /转运测量作业/)
assert.match(page, /!selected && entryMode === 'list'/)
assert.match(page, /entryMode === 'work' && taskNo/)
assert.match(page, /mode=work&task=\$\{encodeURIComponent\(String\(item\.transferNo\)\)\}/)
assert.match(page, /v-if="!selected && entryMode === 'list'"/)
assert.match(page, /作业详情/)
assert.match(page, /backToCandidates\(\)/)
assert.match(page, /backToCandidates\(\) \{ if \(this\.submitting.*this\.entryMode = 'list'/)
assert.match(page, /存在未完结的测量单/)
assert.match(page, /title: '开始测量'/)
assert.match(page, /确认开始测量转运单/)
assert.match(page, /warehouseWork\.warehouseTransfer\.currentNo/)
assert.match(page, /resetWarehouseDomain\('warehouseTransfer'\)/)
assert.match(page, /statusLabel\(status, transferNo = ''\) \{ if \(String\(status\) === 'WAIT_PDA_RECEIVING'/)
assert.match(page, /listWarehouseTransferCandidates\(\)\)\.map\(\(item\) => String\(item\.transferNo\) === activeNo.*PARTIALLY_RECEIVED/s)
assert.doesNotMatch(page, /转运明细 ID|manualItems/)
})
test('warehouse transfer removes completed work from the pending list', async () => {
const page = await readFile(new URL('../src/pages/warehouse-transfer/warehouse-transfer.vue', import.meta.url), 'utf8')
assert.match(page, /this\.selected = null; this\.pendingKey = '';[\s\S]*await this\.loadCandidates\(\)/)
})
test('warehouse transfer shows forecast and actual variance without blocking short or over receipt', async () => {
const page = await readFile(new URL('../src/pages/warehouse-transfer/warehouse-transfer.vue', import.meta.url), 'utf8')
for (const label of ['客户预报', '当前实收', '短收差异', '超收差异']) assert.match(page, new RegExp(label))
+2 -1
View File
@@ -102,11 +102,12 @@ test('mixed relabel keeps SKU work open and return bulk also mounts pallet work'
assert.match(page, /<RelabelPalletWork v-if="taskTab === 'carton' \|\| isReturnBulk"/)
})
test('relabel list opens a row directly in execution and completion returns to the list', async () => {
test('relabel list confirms before starting a new task and completion returns to the list', async () => {
const page = await read('../src/pages/relabel/relabel.vue')
assert.doesNotMatch(page, /name="relabelTask"/)
assert.match(page, /@tap="openExecution\(item\)"/)
assert.match(page, /async openExecution\(item\)/)
assert.match(page, /const confirmed = await this\.confirmStartTask\(item\)[\s\S]*if \(!confirmed\) return[\s\S]*claimRelabelTask/)
assert.match(page, /relabelExecute&task=\$\{encodeURIComponent\(item\.relabelNo\)\}/)
assert.match(page, /当前账号正在执行 \$\{active\.relabelNo\}/)
assert.match(page, /v-if="showCurrent" class="detail-toolbar"[\s\S]*@tap="closeCurrent">\u2039 返回列表<\/button>/)
+3 -2
View File
@@ -7,7 +7,7 @@ test('only operations backed by a dedicated overseas PDA contract are enabled',
const enabled = operations.filter((operation) => operation.available)
assert.deepEqual(enabled.map(({ module, name }) => ({ module, name })), [
{ module: 'inbound', name: '拆柜收货' },
{ module: 'inbound', name: '仓储转运测量' },
{ module: 'inbound', name: '仓储转运测量列表' }, { module: 'inbound', name: '转运测量作业' },
{ module: 'inbound', name: '退货入库' },
{ module: 'inbound', name: '退货合箱' },
{ module: 'outbound', name: '排车拣货' },
@@ -26,7 +26,8 @@ test('only operations backed by a dedicated overseas PDA contract are enabled',
assert.equal(operations.find((item) => item.name === '出库作业')?.route, '/pages/outbound/outbound')
assert.equal(operations.find((item) => item.name === '退货入库')?.route, '/pages/return-receipt/return-receipt')
assert.equal(operations.find((item) => item.name === '退货合箱')?.route, '/pages/return-packing/return-packing')
assert.equal(operations.find((item) => item.name === '仓储转运测量')?.route, '/pages/warehouse-transfer/warehouse-transfer')
assert.equal(operations.find((item) => item.name === '仓储转运测量列表')?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=list')
assert.equal(operations.find((item) => item.name === '转运测量作业')?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=work')
assert.equal(operations.some((item) => item.name === '库存盘点'), false)