This commit is contained in:
2026-10-09 11:43:38 +08:00
parent 2caeb12024
commit 9ed5448fe6
4 changed files with 46 additions and 7 deletions
@@ -176,3 +176,27 @@ it('opens the loading review section from the dispatch list deep link', async ()
expect(wrapper.findComponent({ name: 'TripLoadingPanel' }).exists()).toBe(true)
expect(wrapper.text()).toContain('理货审核')
})
it.each([null, 'FBA:OTHER'])('blocks a same-name ACY2 stop with an unmatched identity %s before submitting', async (destinationKey) => {
const cargo = { dispatchNo: 'DP-A', customerId: 'A', dispatchItemId: '100', warehousePalletId: '901', palletNo: 'D0009-101-001', packages: 10, destinationKey: 'FBA:ACY2', destinationLabel: 'ACY2' }
const basis = { tripNo: trip.tripNo, recordVersion: 3, cargo: [cargo], manifestHash: 'hash', capacityPlan: null, planValid: false, blockReason: null, availableSegments: [] }
vi.mocked(api.getTripCapacityPlan).mockResolvedValue(basis)
const currentTrip = { ...trip, stops: [{ name: '起运仓' }, { name: 'ACY2', destinationKey }] }
const wrapper = mount(TripLoadingPanel, { trip: currentTrip, editable: true, planning: true }); await flushPromises()
expect(wrapper.text()).toContain('站点同名不代表已匹配')
expect(wrapper.text()).toContain('按货物匹配卸货站')
expect(button(wrapper, '确认计划容量').attributes('disabled')).toBeDefined()
expect(wrapper.findComponent({ name: 'DataTable' }).props('data')[0].deliveryIndex).toBeNull()
await button(wrapper, '确认计划容量').trigger('click')
expect(api.confirmTripCapacityPlan).not.toHaveBeenCalled()
await wrapper.setProps({ trip: { ...currentTrip, recordVersion: 4, stops: [{ name: '起运仓' }, { name: 'ACY2', destinationKey: 'FBA:ACY2' }] } }); await flushPromises()
expect(wrapper.text()).not.toContain('站点同名不代表已匹配')
expect(wrapper.findComponent({ name: 'DataTable' }).props('data')[0].deliveryIndex).toBe(1)
})
it('blocks a shared pallet with different identities even when both labels are ACY2', async () => {
const cargo = { dispatchNo: 'DP-A', customerId: 'A', dispatchItemId: '100', warehousePalletId: '901', palletNo: 'PLT-1', packages: 10, destinationKey: 'FBA:ACY2', destinationLabel: 'ACY2' }
vi.mocked(api.getTripCapacityPlan).mockResolvedValue({ tripNo: trip.tripNo, recordVersion: 3, cargo: [cargo, { ...cargo, destinationKey: 'WAREHOUSE:ACY2' }], manifestHash: 'hash', capacityPlan: null, planValid: false, blockReason: null, availableSegments: [] })
const wrapper = mount(TripLoadingPanel, { trip: { ...trip, stops: [{ name: '起运仓' }, { name: 'ACY2', destinationKey: 'FBA:ACY2' }] }, editable: true, planning: true }); await flushPromises()
expect(wrapper.text()).toContain('包含不同目的地,请先拆托')
expect(button(wrapper, '确认计划容量').attributes('disabled')).toBeDefined()
})