From 8131d58d217a729b71e014b4a76bc5764bee5d73 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Thu, 27 Aug 2026 16:34:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/picking/picking.vue | 6 ++++-- tests/picking-refresh-route.test.mjs | 31 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/pages/picking/picking.vue b/pages/picking/picking.vue index e4fb2d1..cb87fd3 100644 --- a/pages/picking/picking.vue +++ b/pages/picking/picking.vue @@ -658,8 +658,10 @@ const message = /^internal server error$/i.test(raw) ? '服务端处理异常,请联系管理员' : (raw || fallback) + const code = String(error?.code || '').trim() const reference = String(error?.requestId || error?.traceId || '').trim() - return reference ? `${message}(请求编号:${reference})` : message + const meta = [code ? `错误码:${code}` : '', reference ? `请求编号:${reference}` : ''].filter(Boolean) + return meta.length ? `${message}(${meta.join(';')})` : message }, async refreshAfterTaskConflict(message) { const requestedTaskId = this.remoteTaskId || this.currentBox.taskId @@ -1177,7 +1179,7 @@ } catch (error) { if (requestId !== this.taskRequestId) return this.debugSubmit('refresh.error', { requestId, message: error.message || '', code: error.code || '', statusCode: error.statusCode || '', requestIdFromServer: error.requestId || '', traceId: error.traceId || '' }) - this.remoteError = error.network ? '网络不可用,无法开始拣货,恢复网络后请重试' : (error.message || '任务同步失败') + this.remoteError = error.network ? '网络不可用,无法开始拣货,恢复网络后请重试' : this.remoteFailureMessage(error, '任务同步失败') } finally { if (requestId === this.taskRequestId) this.remoteLoading = false } }, async loadLoadingEvidence() { diff --git a/tests/picking-refresh-route.test.mjs b/tests/picking-refresh-route.test.mjs index 48d1bcf..6e33be2 100644 --- a/tests/picking-refresh-route.test.mjs +++ b/tests/picking-refresh-route.test.mjs @@ -26,3 +26,34 @@ test('picking route carries only stable task and warehouse identity', async () = assert.match(onLoad, /warehouseId: options\.warehouseId \? String\(options\.warehouseId\) : null/) assert.doesNotMatch(onLoad, /options\.(cabinetNo|currentContainerNo|orderNo|inboundId|inboundVersion|tenantId)/) }) + +test('target task detail keeps 19 digit identifiers as strings from route through request', async () => { + const [adapter, tasks, page] = await Promise.all([ + read('../api/pda-loading.js'), + read('../pages/tasks/tasks.vue'), + read('../pages/picking/picking.vue') + ]) + const taskId = '2092889048731414530' + const warehouseId = '193000000000200002' + assert.equal(`/first-leg/pda-loading/tasks/${encodeURIComponent(taskId)}?warehouseId=${encodeURIComponent(warehouseId)}`, + '/first-leg/pda-loading/tasks/2092889048731414530?warehouseId=193000000000200002') + assert.match(adapter, /tasks\/\$\{encodeURIComponent\(taskId\)\}\?warehouseId=\$\{encodeURIComponent\(warehouseId\)\}/) + assert.match(tasks, /taskId=\$\{encodeURIComponent\(task\.taskId\)\}&warehouseId=\$\{encodeURIComponent\(task\.warehouseId\)\}/) + assert.match(page, /taskId: String\(options\.taskId\)/) + assert.match(page, /warehouseId: options\.warehouseId \? String\(options\.warehouseId\) : null/) + assert.doesNotMatch(page.match(/onLoad\(options = \{\}\) \{[\s\S]*?\n\t\t\},/)?.[0] || '', /Number\((?:options\.)?(?:taskId|warehouseId)/) +}) + +test('task detail restores before and after claim and exposes S0500 metadata', async () => { + const [http, page] = await Promise.all([read('../api/http.js'), read('../pages/picking/picking.vue')]) + const sync = page.match(/async syncRemoteTask\(\) \{[\s\S]*?\n\t\t\t\},/)?.[0] || '' + assert.match(sync, /remoteTask\.workflowStatus === 'UNASSIGNED'[\s\S]*?claimContainerPickingTask/) + assert.match(sync, /remoteTask\.workflowStatus === 'IN_PROGRESS'[\s\S]*?assigneeId/) + assert.match(sync, /normalizePickingTask\(\{ \.\.\.task, \.\.\.\(claimed \|\| \{\}\) \}\)/) + assert.match(http, /error\.code = body\.code \|\| response\.statusCode/) + assert.match(http, /error\.requestId = body\.requestId/) + assert.match(http, /error\.traceId = body\.traceId/) + assert.match(page, /const code = String\(error\?\.code \|\| ''\)\.trim\(\)/) + assert.match(page, /错误码:\$\{code\}/) + assert.match(sync, /this\.remoteFailureMessage\(error, '任务同步失败'\)/) +})