From 2a38288e205cca708e1f7b80ad913020fa2c9b65 Mon Sep 17 00:00:00 2001 From: liuyihe <2513762445@qq.com> Date: Thu, 15 Oct 2026 15:45:32 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/warehouse-transfers.js | 8 + src/components/CartonCountFields.vue | 12 + src/pages/outbound/outbound.vue | 2 +- src/pages/return-counting/return-counting.vue | 6 +- .../warehouse-transfer/warehouse-transfer.vue | 242 ++++++++++++++---- tests/return-counting-page.test.mjs | 2 +- tests/warehouse-transfer-api.test.mjs | 10 +- tests/warehouse-transfer-counting.test.mjs | 129 ++++++++++ 8 files changed, 358 insertions(+), 53 deletions(-) create mode 100644 src/components/CartonCountFields.vue create mode 100644 tests/warehouse-transfer-counting.test.mjs diff --git a/src/api/warehouse-transfers.js b/src/api/warehouse-transfers.js index 90e7479..764ccc9 100644 --- a/src/api/warehouse-transfers.js +++ b/src/api/warehouse-transfers.js @@ -49,3 +49,11 @@ export function downloadWarehouseTransferPalletLabel(labelDownloadPath) { if (!path) return Promise.reject(new Error('服务端未返回托盘标签下载地址')) return overseasDownload(path) } + +export function countWarehouseTransferCartons(transferNo, payload) { + return overseasRequest('POST', `${BASE}/${encoded(transferNo)}/cartons/count`, payload) +} + +export function getWarehouseTransferCartonLabel(transferNo) { + return overseasRequest('GET', `${BASE}/${encoded(transferNo)}/carton-label`) +} diff --git a/src/components/CartonCountFields.vue b/src/components/CartonCountFields.vue new file mode 100644 index 0000000..a5be130 --- /dev/null +++ b/src/components/CartonCountFields.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/pages/outbound/outbound.vue b/src/pages/outbound/outbound.vue index 65cdc72..26c728c 100644 --- a/src/pages/outbound/outbound.vue +++ b/src/pages/outbound/outbound.vue @@ -5,7 +5,7 @@ 出库任务整托扫描托盘码,散箱扫描箱唛;扫描排车业务号会转入“排车拣货” 当前任务出库作业详情 - + 任务号直接恢复;退货整托出库扫托盘码,散箱出库扫箱唛。 diff --git a/src/pages/return-counting/return-counting.vue b/src/pages/return-counting/return-counting.vue index 335375f..4b6eb5c 100644 --- a/src/pages/return-counting/return-counting.vue +++ b/src/pages/return-counting/return-counting.vue @@ -13,8 +13,7 @@ @@ -22,13 +21,14 @@ diff --git a/tests/return-counting-page.test.mjs b/tests/return-counting-page.test.mjs index 577c226..f50cc7d 100644 --- a/tests/return-counting-page.test.mjs +++ b/tests/return-counting-page.test.mjs @@ -5,7 +5,7 @@ import { runInNewContext } from 'node:vm' const source = readFileSync(new URL('../src/pages/return-counting/return-counting.vue', import.meta.url), 'utf8') const script = source.match(/ diff --git a/tests/warehouse-transfer-api.test.mjs b/tests/warehouse-transfer-api.test.mjs index bb9704d..1b062a9 100644 --- a/tests/warehouse-transfer-api.test.mjs +++ b/tests/warehouse-transfer-api.test.mjs @@ -36,7 +36,7 @@ test('warehouse transfer page loads detail without exposing internal identifiers 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, /返回列表/) assert.match(page, /backToCandidates\(\)/) assert.match(page, /backToCandidates\(\) \{ if \(this\.submitting.*this\.entryMode = 'list'/) assert.match(page, /存在未完结的测量单/) diff --git a/tests/warehouse-transfer-mixed-cartons.test.mjs b/tests/warehouse-transfer-mixed-cartons.test.mjs new file mode 100644 index 0000000..e625e00 --- /dev/null +++ b/tests/warehouse-transfer-mixed-cartons.test.mjs @@ -0,0 +1,117 @@ +import test from 'node:test' +import assert from 'node:assert/strict' +import { readFile } from 'node:fs/promises' + +const source = await readFile(new URL('../src/pages/warehouse-transfer/warehouse-transfer.vue', import.meta.url), 'utf8') +const script = source.match(/')[0].replace(/^import .*$/gm, '').replace('export default', 'return') function setup() { const calls = [] - const component = new Function('ScanTargetInput', 'measureRelabelPallet', 'warehouseIdempotencyKey', 'releaseWarehouseKey', script)( + const component = new Function('ScanTargetInput', 'measureRelabelPallet', 'warehouseIdempotencyKey', 'releaseWarehouseKey', 'bindRelabelPallet', script)( {}, async payload => { calls.push(payload); return [{ palletCode: payload.palletCode, volumeCbm: 0.25, grossWeightKg: payload.grossWeightKg }] }, - () => ({ value: 'stable-key', signature: 'signature' }), () => {}) + () => ({ value: 'stable-key', signature: 'signature' }), () => {}, async payload => calls.push(payload)) const value = { ...component.data(), task: { relabelNo: 'RL-1' }, $emit() {} } for (const [key, method] of Object.entries(component.methods)) value[key] = method.bind(value) return { component, value, calls } @@ -33,3 +35,74 @@ test('only whole physical pallet quantities offer original pallet reuse', () => ctx.plannedPackages = 10;ctx.isReturnBulk = true assert.equal(canRetain.call(ctx), false) }) + +async function renderMeasurements(measurements) { + const { component } = setup() + const template = source.slice(source.indexOf('