From a7db793c95cab8fa8c1d0128cd753424b01aabdb Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Tue, 15 Sep 2026 18:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SmartLoadingCandidateInbounds.test.ts | 18 ++++++ .../SmartLoadingCandidateInbounds.vue | 15 +++++ .../pages/GlobalSmartLoadingView.test.ts | 59 +++++++++++++++++-- .../pages/GlobalSmartLoadingView.vue | 12 ++-- .../pages/SmartLoadingWorkbenchView.test.ts | 6 +- .../pages/SmartLoadingWorkbenchView.vue | 8 ++- src/modules/container-loading/types.ts | 1 + .../pages/OutboundDetailView.test.ts | 14 +++++ .../pages/OutboundsView.selection.test.ts | 36 ++++++++--- .../pages/OutboundsView.test.ts | 19 ++++++ .../pages/OutboundsView.vue | 34 +++++------ src/shared/components/StatusBadge.vue | 4 +- 12 files changed, 184 insertions(+), 42 deletions(-) create mode 100644 src/modules/container-loading/components/SmartLoadingCandidateInbounds.test.ts create mode 100644 src/modules/container-loading/components/SmartLoadingCandidateInbounds.vue diff --git a/src/modules/container-loading/components/SmartLoadingCandidateInbounds.test.ts b/src/modules/container-loading/components/SmartLoadingCandidateInbounds.test.ts new file mode 100644 index 00000000..3bc4aff2 --- /dev/null +++ b/src/modules/container-loading/components/SmartLoadingCandidateInbounds.test.ts @@ -0,0 +1,18 @@ +import { mount } from '@vue/test-utils' +import { describe, expect, it } from 'vitest' +import SmartLoadingCandidateInbounds from './SmartLoadingCandidateInbounds.vue' +import type { SmartLoadingCandidate } from '../types' + +describe('sealed pallet composition', () => { + it('shows the two inbound portions, not the whole pallet count twice', async () => { + const candidate = { unitType: 'SEALED_PALLET', inboundCode: 'I180', availablePackageCount: 13, + groupMembers: [{ accountId: '1', inboundId: '180', inboundCode: 'I180', availablePackageCount: 3 }, + { accountId: '1', inboundId: '181', inboundCode: 'I181', availablePackageCount: 10 }] } as SmartLoadingCandidate + const wrapper = mount(SmartLoadingCandidateInbounds, { props: { candidate } }) + expect(wrapper.get('summary').text()).toBe('2 个入仓码 · 展开') + expect(wrapper.text()).toContain('I180:3 箱') + expect(wrapper.text()).toContain('I181:10 箱') + expect(wrapper.text()).not.toContain('13 箱') + expect(wrapper.findAll('button')).toHaveLength(0) + }) +}) diff --git a/src/modules/container-loading/components/SmartLoadingCandidateInbounds.vue b/src/modules/container-loading/components/SmartLoadingCandidateInbounds.vue new file mode 100644 index 00000000..5bd4645d --- /dev/null +++ b/src/modules/container-loading/components/SmartLoadingCandidateInbounds.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts index 01bd5161..8a8077ba 100644 --- a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts +++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts @@ -492,7 +492,7 @@ describe('GlobalSmartLoadingView', () => { expect(wrapper.text()).toContain('CLG-2093539779795795969 · 2 票') expect(wrapper.text()).toContain('3 个入仓片段') expect(wrapper.text()).toContain('ORD-201:NYEXX2608290051、NYEXX2608290051-B') - const buttons = wrapper.findAll('button').filter((button) => button.text().includes('整组分配')) + const buttons = wrapper.findAll('.el-table__body-wrapper button').filter((button) => button.text() === '加入') expect(buttons).toHaveLength(1) await buttons[0].trigger('click') await flushPromises() @@ -560,7 +560,7 @@ describe('GlobalSmartLoadingView', () => { expect(wrapper.text()).toContain('CLG-9900 · 3 票') expect(wrapper.text()).toContain('同柜不可拆组成员候选不齐,缺少 1 票') - const button = wrapper.findAll('button').find((item) => item.text().includes('整组分配'))! + const button = wrapper.findAll('.el-table__body-wrapper button').find((item) => item.text() === '加入')! expect(button.attributes('disabled')).toBeDefined() expect(assignSmartLoadingGroup).not.toHaveBeenCalled() }) @@ -599,6 +599,57 @@ describe('GlobalSmartLoadingView', () => { expect(adjustSmartLoadingItem).toHaveBeenCalledWith(plan.id, plan.items[0].id, 4, plan.version, plan.items[0].version) }) + it('shows a shared pallet once with exact members and a text-only join action', async () => { + vi.mocked(listSmartLoadingCandidates).mockResolvedValue(candidatePage([{ + ...candidate, unitType: 'SEALED_PALLET', palletId: '801', palletNo: 'DP-0025', indivisible: true, + availablePackageCount: 13, unitGrossWeightKg: 10, + groupMembers: [ + { accountId: '1', inboundId: '180', orderId: '180', orderNo: 'O180', inboundCode: 'I180', customerName: '客户', availablePackageCount: 3, orderStatusSnapshot: 'WAIT_SPLIT', expectedArrivalAt: null }, + { accountId: '1', inboundId: '181', orderId: '181', orderNo: 'O181', inboundCode: 'I181', customerName: '客户', availablePackageCount: 10, orderStatusSnapshot: 'WAIT_SPLIT', expectedArrivalAt: null }, + ], + }])) + const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } }) + await flushPromises() + const buttons = wrapper.findAll('.el-table__body-wrapper button').filter(button => button.text() === '加入') + expect(buttons).toHaveLength(1) + expect(buttons[0].find('svg').exists()).toBe(false) + expect(wrapper.text()).toContain('I180:3 箱') + expect(wrapper.text()).toContain('I181:10 箱') + expect(wrapper.text()).toContain('130 kg') + wrapper.unmount() + }) + + it('searches any shared-pallet inbound, retains its complete composition across pages, and resets the search', async () => { + const sharedPallet = { + ...candidate, inboundId: '180', inboundCode: 'I180', unitType: 'SEALED_PALLET' as const, + palletId: '801', palletNo: 'DP-0025', indivisible: true, availablePackageCount: 13, + groupMembers: [ + { accountId: '1', inboundId: '180', orderId: '180', orderNo: 'O180', inboundCode: 'I180', customerName: '客户', availablePackageCount: 3, orderStatusSnapshot: 'WAIT_SPLIT', expectedArrivalAt: null }, + { accountId: '1', inboundId: '181', orderId: '181', orderNo: 'O181', inboundCode: 'I181', customerName: '客户', availablePackageCount: 10, orderStatusSnapshot: 'WAIT_SPLIT', expectedArrivalAt: null }, + ], + } + vi.mocked(listSmartLoadingCandidates).mockResolvedValue(candidatePage([sharedPallet], 1, 20, 21)) + const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } }) + await flushPromises() + const filters = { warehouseId: '', customerId: '', inboundCode: ' I181 ', createdRange: [], expectedArrivalRange: [], orderStatuses: [] } + wrapper.getComponent(QueryToolbar).vm.$emit('search', filters) + await flushPromises() + expect(listSmartLoadingCandidates).toHaveBeenLastCalledWith({ channelGroupCodes: ['MATSON_CLX'], inboundCode: 'I181', page: 1, size: 20 }) + const pane = wrapper.get('.candidate-pane') + expect(pane.text()).toContain('I180:3 箱') + expect(pane.text()).toContain('I181:10 箱') + expect(pane.findAll('.el-table__body-wrapper button').filter(button => button.text() === '加入')).toHaveLength(1) + + await pane.get('button[aria-label="下一页"]').trigger('click') + await flushPromises() + expect(listSmartLoadingCandidates).toHaveBeenLastCalledWith({ channelGroupCodes: ['MATSON_CLX'], inboundCode: 'I181', page: 2, size: 20 }) + + wrapper.getComponent(QueryToolbar).vm.$emit('reset', { ...filters, inboundCode: '' }) + await flushPromises() + expect(listSmartLoadingCandidates).toHaveBeenLastCalledWith({ channelGroupCodes: ['MATSON_CLX'], page: 1, size: 20 }) + wrapper.unmount() + }) + it('rounds capacity percentages and hides column settings in embedded tables', async () => { vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({ ...plan, @@ -607,8 +658,8 @@ describe('GlobalSmartLoadingView', () => { const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } }) await flushPromises() - expect(wrapper.text()).toContain('0.16%') - expect(wrapper.text()).toContain('0.03%') + expect(wrapper.text()).toContain('0.18%') + expect(wrapper.text()).toContain('0.05%') expect(wrapper.text()).not.toContain('0.169999999') expect(wrapper.findAll('button[aria-label="列设置"]')).toHaveLength(0) }) diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue index 400332ed..d824f585 100644 --- a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue +++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue @@ -1,6 +1,7 @@