fix: remove sealed smart-loading rows by pallet

This commit is contained in:
2026-09-14 14:35:30 +08:00
parent 85b3606eca
commit afa49bf1f1
4 changed files with 58 additions and 3 deletions
@@ -22,6 +22,7 @@ import {
removeAllUnpickedSmartLoadingItems,
removeSmartLoadingGroup,
removeSmartLoadingItem,
removeSmartLoadingPallet,
} from '../api/platformContainerLoading'
const { routerPush } = vi.hoisted(() => ({ routerPush: vi.fn() }))
@@ -50,6 +51,7 @@ vi.mock('../api/platformContainerLoading', () => ({
adjustSmartLoadingItem: vi.fn(),
removeSmartLoadingItem: vi.fn(),
removeSmartLoadingGroup: vi.fn(),
removeSmartLoadingPallet: vi.fn(),
removeAllUnpickedSmartLoadingItems: vi.fn(),
pushSmartLoadingPreload: vi.fn(),
}))
@@ -861,6 +863,29 @@ describe('GlobalSmartLoadingView', () => {
expect(wrapper.findAll('button').some((button) => button.text().includes('移除未拣'))).toBe(false)
})
it('removes a sealed pallet row through the whole-pallet command', async () => {
const palletItem = {
...plan.items[0], unitType: 'SEALED_PALLET' as const, palletId: '801', palletNo: 'DP-260914-0021',
indivisible: true, packageCount: 10, pickedPackageCount: 0, minPackageCount: 10,
canAdjust: false, canRemove: true,
}
const palletPlan = { ...plan, items: [palletItem] }
const emptyPlan = { ...palletPlan, version: 3, items: [] }
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue(palletPlan)
vi.mocked(removeSmartLoadingPallet).mockResolvedValue(emptyPlan)
const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
await flushPromises()
const row = wrapper.findAll('tr').find((candidateRow) => candidateRow.text().includes('DP-260914-0021'))
expect(row).toBeDefined()
await row!.find('.el-button--danger').trigger('click')
await flushPromises()
expect(removeSmartLoadingPallet).toHaveBeenCalledWith(plan.id, '801', 2)
expect(removeSmartLoadingItem).not.toHaveBeenCalled()
})
it('renders final completion capability as read-only with the server reason', async () => {
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({
...plan,