fix(overseas): reuse original resource command after reopening conversion

This commit is contained in:
2026-10-05 02:13:24 +08:00
parent ea24496b11
commit 058b0778a2
4 changed files with 41 additions and 5 deletions
@@ -724,6 +724,37 @@ describe('LastMileOrdersView pending order and container conversion', () => {
expect((button(wrapper, '修改接柜仓')!.element as HTMLButtonElement).disabled).toBe(false)
})
it('restores the original resource command after reopening a locally committed cabinet', async () => {
vi.mocked(listContainerPlanProgress).mockResolvedValueOnce({
records: [{ ...summary, pendingPlanCount: 0, resourcePendingPlanCount: 1, allPlansReady: true }],
page: 1, size: 10, total: 1, pages: 1,
})
const reopenedPreview = {
...preview, snapshotVersion: 10, snapshotHash: 'b'.repeat(64),
groups: preview.groups.map((group) => ({
...group, destinationType: 'FBA' as const,
orders: group.orders.map((order) => ({
...order, destinationType: 'FBA' as const, fbaWarehouseCode: 'ONT8',
readiness: 'RESOURCE_PENDING' as const, existingPlanNo: 'LIP-ORIGINAL', plannedPalletCount: 5,
})),
})),
resourceRetry: { idempotencyKey: 'original-container-command', snapshotVersion: 9, snapshotHash: 'a'.repeat(64) },
}
vi.mocked(getContainerInboundPlanPreview).mockResolvedValueOnce(reopenedPreview)
const wrapper = await mountView()
await openHiddenContainerWorkbench(wrapper)
await button(wrapper, '重试生成托盘码')!.trigger('click')
await flushPromises()
const confirm = [...document.body.querySelectorAll('button')]
.find((item) => item.textContent?.includes('确认生成')) as HTMLButtonElement
expect(confirm.disabled).toBe(false)
confirm.click()
await flushPromises()
expect(convertLastMileContainerToInboundPlans).toHaveBeenCalledWith({
sourceContainerBookingId: bookingId, snapshotVersion: 9, snapshotHash: 'a'.repeat(64),
}, 'original-container-command')
})
it('renders the all-cabinet empty state and unit', async () => {
vi.mocked(listContainerPlanProgress).mockResolvedValueOnce({ records: [], page: 1, size: 10, total: 0, pages: 0 })
const wrapper = await mountView()