diff --git a/src/modules/overseas-warehouse/components/SmartDispatchDialog.test.ts b/src/modules/overseas-warehouse/components/SmartDispatchDialog.test.ts index 9691e345..fab5fd64 100644 --- a/src/modules/overseas-warehouse/components/SmartDispatchDialog.test.ts +++ b/src/modules/overseas-warehouse/components/SmartDispatchDialog.test.ts @@ -110,6 +110,19 @@ it('does not submit a physical pallet fallback when its actual plan source ident wrapper.unmount() }) +it('submits relabel physical pallet identity without requiring an inbound plan pallet', async () => { + vi.mocked(listDispatchDrafts).mockResolvedValue([{ draftToken: 'relabel-draft', containers: [ + { id: 'container', capacity: 30, palletIds: ['101'] }, + ] }]) + vi.mocked(listDispatchCandidates).mockResolvedValue([{ ...plan, planPalletId: null, sourceStage: 'RELABEL', orderRefs: 'RL-1' }]) + vi.mocked(preArrangeDispatch).mockResolvedValue({ id: '1', dispatchNo: 'DS-1' }) + const wrapper = mountDraft(); await flushPromises(); await submitDraft(wrapper) + expect(preArrangeDispatch).toHaveBeenCalledExactlyOnceWith({ planPalletIds: ['101'], returnReceiptIds: [], relabelNo: 'RL-1' }) + expect(preArrangeDraftDispatch).not.toHaveBeenCalled() + expect(wrapper.emitted('created')).toHaveLength(1) + wrapper.unmount() +}) + it('does not send a second batch while the original command is pending', async () => { vi.mocked(listDispatchDrafts).mockResolvedValue([twoGroups]) vi.mocked(listDispatchCandidates).mockResolvedValue([plan, secondPlan, thirdPlan, returned]) diff --git a/src/modules/overseas-warehouse/components/SmartDispatchDialog.vue b/src/modules/overseas-warehouse/components/SmartDispatchDialog.vue index 85488af2..7788c741 100644 --- a/src/modules/overseas-warehouse/components/SmartDispatchDialog.vue +++ b/src/modules/overseas-warehouse/components/SmartDispatchDialog.vue @@ -330,7 +330,8 @@ async function submit() { ElMessage.warning('草稿中存在重复托盘或无效装车容器,请核对分组;原草稿已保留') return } - if (assigned.value.some(item => item.sourceType === 'RETURN_RECEIPT' + if (assigned.value.some(item => item.sourceStage === 'RELABEL' + ? !String(item.warehousePalletId || '').trim() : item.sourceType === 'RETURN_RECEIPT' ? !String(item.returnReceiptId || '').trim() : !String(item.planPalletId || '').trim())) { ElMessage.warning('所选托盘来源标识缺失,请重新加载核对;原草稿已保留') return