修复智能装柜入仓码重复展示

This commit is contained in:
2026-08-24 18:07:38 +08:00
parent bff9ccbfb6
commit 1f3e14a6cd
5 changed files with 167 additions and 24 deletions
@@ -80,7 +80,7 @@ describe('GlobalSmartLoadingView', () => {
expect(wrapper.text()).not.toContain('服装')
expect(wrapper.text()).not.toContain('鞋类')
expect(wrapper.text()).not.toContain('SKU-1')
expect(wrapper.text()).not.toContain('IN-1')
expect(wrapper.text()).toContain('IN-1')
expect(wrapper.text()).toContain('IN-2')
expect(wrapper.text()).not.toContain('ORD-1')
expect(wrapper.text()).not.toContain('ORD-2')
@@ -378,6 +378,34 @@ describe('GlobalSmartLoadingView', () => {
expect(wrapper.text()).toContain('当前柜次暂无装柜明细')
})
it('shows one row per inbound code and removes all internal specification rows', async () => {
const secondDetail = {
...plan.items[0], id: '102', inboundDetailId: '4', skuCode: 'SKU-2', productNameZh: '鞋类',
packageCount: 4, grossWeightKg: 40, volumeCbm: 0.8, loadSequence: 2,
}
const groupedPlan = { ...plan, items: [plan.items[0], secondDetail] }
const afterFirst = { ...plan, version: 3, items: [secondDetail] }
const emptyPlan = { ...plan, version: 4, items: [] }
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValueOnce(groupedPlan).mockResolvedValue(emptyPlan)
vi.mocked(removeSmartLoadingItem).mockResolvedValueOnce(afterFirst).mockResolvedValueOnce(emptyPlan)
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue('confirm' as never)
const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
await flushPromises()
const inboundRows = wrapper.findAll('tr').filter((row) => row.text().includes('IN-1'))
expect(inboundRows).toHaveLength(1)
expect(inboundRows[0].text()).toContain('多规格;改箱数请移除后重加')
expect(inboundRows[0].text()).toContain('100 kg')
expect(inboundRows[0].text()).toContain('2 m³')
await inboundRows[0].find('.el-button--danger').trigger('click')
await flushPromises()
expect(removeSmartLoadingItem).toHaveBeenNthCalledWith(1, plan.id, plan.items[0].id, 2, 1)
expect(removeSmartLoadingItem).toHaveBeenNthCalledWith(2, plan.id, secondDetail.id, 3, 1)
})
it('uses item capabilities to protect picked quantities and removal', async () => {
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({
...plan,