diff --git a/pages/picking/picking.vue b/pages/picking/picking.vue index 00a7b77..1f35439 100644 --- a/pages/picking/picking.vue +++ b/pages/picking/picking.vue @@ -1644,6 +1644,13 @@ this.loadingVersion = submittedTask.inboundVersion ?? submittedTask.loadingVersion ?? this.remotePick.inboundVersion ?? this.remotePick.loadingVersion ?? this.loadingVersion this.evidenceIdentity = this.captureEvidenceIdentity() } + this.showToast('拣货已提交,正在刷新最新状态', 'success') + await this.syncRemoteTask() + if (!this.pickingCompleted) { + this.remoteError = this.remoteError || '拣货已提交,但最新任务状态尚未同步,请点击刷新任务' + this.showToast('拣货已提交,状态同步未完成,请刷新任务', 'warning') + return + } // Legacy inbound completePicking(expectedVersion: Number(this.pickingVersion)) remains adapter-only; cabinet tasks use item actions. } catch (error) { this.debugSubmit('submit.error', { message: error.message || '', code: error.code || '', statusCode: error.statusCode || '', requestIdFromServer: error.requestId || '', traceId: error.traceId || '', network: Boolean(error.network) }) diff --git a/tests/picking-evidence-stage.test.mjs b/tests/picking-evidence-stage.test.mjs index 46b75aa..adfebc4 100644 --- a/tests/picking-evidence-stage.test.mjs +++ b/tests/picking-evidence-stage.test.mjs @@ -103,6 +103,18 @@ test('completed detail overrides stale local state and an empty batch refreshes assert.ok(perform.indexOf('if (!actions.length)') < perform.indexOf('submitContainerPickingBatch(')) }) +test('successful batch submission automatically refreshes canonical item status before completion gates', () => { + const perform = page.match(/async performSubmit\([^)]*\) \{[\s\S]*?\n\t\t\t\},/)?.[0] || '' + const submitIndex = perform.indexOf('await submitContainerPickingBatch(') + const refreshIndex = perform.indexOf('await this.syncRemoteTask()', submitIndex) + const gateIndex = perform.indexOf('if (!this.pickingCompleted)', refreshIndex) + assert.ok(submitIndex >= 0 && refreshIndex > submitIndex, 'canonical detail should refresh after the accepted batch') + assert.ok(gateIndex > refreshIndex, 'completion should be evaluated only after the automatic refresh') + assert.match(perform, /拣货已提交,正在刷新最新状态/) + assert.match(perform, /拣货已提交,但最新任务状态尚未同步,请点击刷新任务/) + assert.match(perform, /if \(!this\.pickingCompleted\)[\s\S]*?return/) +}) + test('final completion preserves backend gate errors and refreshes after an atomic A0409', () => { const complete = page.match(/async completeLoadingTask\(\) \{[\s\S]*?\n\t\t\t\},/)?.[0] || '' assert.match(complete, /this\.isTaskConflict\(error\)[\s\S]*?await this\.refreshAfterTaskConflict\(sanitizeUserMessage\(error\.message, '订舱、装柜关联或证据状态已变化,请刷新后重试'\)\)/)