优化
This commit is contained in:
@@ -102,6 +102,7 @@ function selectedRow(overrides: Record<string, unknown> = {}) {
|
||||
id: '2092873463568596994', customerId, sourceContainerBookingId: bookingId, orderNo: 'LMO-260827-0001',
|
||||
overseasWarehouseId: summary.overseasWarehouseId, overseasWarehouseCode: summary.overseasWarehouseCode,
|
||||
warehouse: summary.overseasWarehouseName, inboundCode: 'IN-LOCKED', version: 3, pallets: 2,
|
||||
estimatedWarehouseAt: '2026-09-01T08:00:00', warehouseEta: '2026-09-01 08:00',
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -261,7 +262,7 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
||||
await button(wrapper, '生成入库计划')!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(document.body.textContent).toContain('计划入库仓')
|
||||
expect(document.body.textContent).toContain('预计到仓日期')
|
||||
expect(document.body.textContent).toContain('预计到仓时间')
|
||||
expect(document.body.textContent).toContain('托盘类型')
|
||||
const inboundCodeInput = wrapper.findAllComponents({ name: 'ElInput' })
|
||||
.find((input) => input.props('placeholder') === '订单冻结入仓码')
|
||||
@@ -270,6 +271,11 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
||||
.find((input) => input.props('placeholder') === '当前柜接柜仓')
|
||||
expect(receivingWarehouseInput?.props('disabled')).toBe(true)
|
||||
expect(receivingWarehouseInput?.props('modelValue')).toBe('LAX01 · 洛杉矶接柜仓')
|
||||
const expectedArrivalInput = wrapper.findAllComponents({ name: 'ElInput' })
|
||||
.find((input) => input.props('placeholder') === '当前柜预计到仓时间')
|
||||
expect(expectedArrivalInput?.props('disabled')).toBe(true)
|
||||
expect(expectedArrivalInput?.props('modelValue')).toBe('2026-09-01 08:00')
|
||||
expect(document.body.textContent).toContain('同柜所有入库计划保持一致')
|
||||
expect(document.body.textContent).toContain('接柜仓按柜统一')
|
||||
expect(listAllPlatformWarehouses).not.toHaveBeenCalled()
|
||||
expect(createManualInboundPlan).not.toHaveBeenCalled()
|
||||
@@ -277,14 +283,11 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
||||
expect(listContainerPlanProgress).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('shows the order-frozen inbound code but never sends it or a per-order receiving warehouse override', async () => {
|
||||
it('shows cabinet-frozen facts but never sends arrival time or per-order warehouse overrides', async () => {
|
||||
const wrapper = await openPending()
|
||||
await selectRows(wrapper, [selectedRow()])
|
||||
await button(wrapper, '生成入库计划')!.trigger('click')
|
||||
await flushPromises()
|
||||
const datePicker = wrapper.find('.command-form').findComponent({ name: 'ElDatePicker' })
|
||||
datePicker.vm.$emit('update:modelValue', '2026-09-08')
|
||||
await wrapper.vm.$nextTick()
|
||||
const confirm = [...document.body.querySelectorAll('button')]
|
||||
.find((item) => item.textContent?.includes('保存并生成入库单')) as HTMLButtonElement
|
||||
confirm.click()
|
||||
@@ -292,15 +295,28 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
||||
|
||||
expect(createManualInboundPlan).toHaveBeenCalledWith(expect.objectContaining({
|
||||
customerId, orderId: '2092873463568596994', expectedOrderVersion: 3,
|
||||
plannedArrivalDate: '2026-09-08', palletCount: 5, palletType: 'WOOD',
|
||||
palletCount: 5, palletType: 'WOOD',
|
||||
}), expect.stringContaining('manual-inbound-plan-'))
|
||||
const payload = vi.mocked(createManualInboundPlan).mock.calls[0][0] as unknown as Record<string, unknown>
|
||||
expect(payload).not.toHaveProperty('inboundCode')
|
||||
expect(payload).not.toHaveProperty('plannedArrivalDate')
|
||||
expect(payload).not.toHaveProperty('plannedWarehouseId')
|
||||
expect(payload).not.toHaveProperty('plannedWarehouseCode')
|
||||
expect(payload).not.toHaveProperty('plannedWarehouseName')
|
||||
})
|
||||
|
||||
it('blocks manual plan creation when the cabinet has no frozen expected arrival time', async () => {
|
||||
const wrapper = await openPending()
|
||||
await selectRows(wrapper, [selectedRow({ estimatedWarehouseAt: '', warehouseEta: '—' })])
|
||||
await button(wrapper, '生成入库计划')!.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
const confirm = [...document.body.querySelectorAll('button')]
|
||||
.find((item) => item.textContent?.includes('保存并生成入库单')) as HTMLButtonElement
|
||||
expect(confirm.disabled).toBe(true)
|
||||
expect(createManualInboundPlan).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('locks one-click dropship manual plans to the frozen source pallet count', async () => {
|
||||
vi.mocked(getContainerInboundPlanPreview).mockResolvedValue({
|
||||
...preview,
|
||||
@@ -324,9 +340,6 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
||||
expect(palletInput.props('modelValue')).toBe(1)
|
||||
expect(document.body.textContent).toContain('固定按头程已封托托盘数整体入库')
|
||||
|
||||
wrapper.find('.command-form').findComponent({ name: 'ElDatePicker' })
|
||||
.vm.$emit('update:modelValue', '2026-09-08')
|
||||
await wrapper.vm.$nextTick()
|
||||
;([...document.body.querySelectorAll('button')]
|
||||
.find((item) => item.textContent?.includes('保存并生成入库单')) as HTMLButtonElement).click()
|
||||
await flushPromises()
|
||||
|
||||
Reference in New Issue
Block a user