优化
This commit is contained in:
@@ -104,6 +104,29 @@ describe('UnifiedOrdersView co-load group behavior', () => {
|
|||||||
expect(wrapper.text()).not.toContain('7000')
|
expect(wrapper.text()).not.toContain('7000')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it.each(['PENDING_REVIEW', 'WAIT_MEASURE', 'WAIT_SPLIT', 'LOADING'] as const)(
|
||||||
|
'allows creating a co-load group when both orders are %s', async (mainStatus) => {
|
||||||
|
const selectedRows = rows.map(row => ({ ...row, mainStatus }))
|
||||||
|
vi.mocked(listPlatformUnifiedOrders).mockResolvedValue({ records: selectedRows, page: 1, size: 20, total: 2, pages: 1 })
|
||||||
|
const wrapper = mountView()
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.get('[data-testid="select"]').trigger('click')
|
||||||
|
expect(wrapper.findAll('button').find((button) => button.text().includes('合柜报关'))!.attributes('disabled')).toBeUndefined()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
it.each(['LOADED', 'DELIVERED', 'COMPLETED'] as const)(
|
||||||
|
'blocks creating a co-load group when selected orders are %s', async (mainStatus) => {
|
||||||
|
const selectedRows = rows.map(row => ({ ...row, mainStatus }))
|
||||||
|
vi.mocked(listPlatformUnifiedOrders).mockResolvedValue({ records: selectedRows, page: 1, size: 20, total: 2, pages: 1 })
|
||||||
|
const wrapper = mountView()
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.get('[data-testid="select"]').trigger('click')
|
||||||
|
expect(wrapper.findAll('button').find((button) => button.text().includes('合柜报关'))!.attributes('disabled')).toBeDefined()
|
||||||
|
expect(createPlatformCoLoadGroup).not.toHaveBeenCalled()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['平台收货仓', [{ ...rows[0], receivingWarehouseId: null, receivingWarehouseName: null }, rows[1]], '以下入仓码缺少平台收货仓:IN-1(仓库:未配置仓库;渠道:纽约渠道),请刷新后重试'],
|
['平台收货仓', [{ ...rows[0], receivingWarehouseId: null, receivingWarehouseName: null }, rows[1]], '以下入仓码缺少平台收货仓:IN-1(仓库:未配置仓库;渠道:纽约渠道),请刷新后重试'],
|
||||||
['渠道', [{ ...rows[0], channelCode: null, channelName: null }, rows[1]], '以下入仓码缺少渠道:IN-1(仓库:义乌仓;渠道:未配置渠道),请刷新后重试'],
|
['渠道', [{ ...rows[0], channelCode: null, channelName: null }, rows[1]], '以下入仓码缺少渠道:IN-1(仓库:义乌仓;渠道:未配置渠道),请刷新后重试'],
|
||||||
|
|||||||
@@ -1803,6 +1803,9 @@ function coLoadSelectionMembersLabel(rows: UnifiedOrderResource[]) {
|
|||||||
|
|
||||||
const coLoadSelectionProblem = computed(() => {
|
const coLoadSelectionProblem = computed(() => {
|
||||||
if (selectedOrders.value.length < 2) return null
|
if (selectedOrders.value.length < 2) return null
|
||||||
|
const allowedStatuses = new Set<UnifiedOrderMainStatus>(['PENDING_REVIEW', 'WAIT_MEASURE', 'WAIT_SPLIT', 'LOADING'])
|
||||||
|
const invalidStatusRows = selectedOrders.value.filter((row) => !allowedStatuses.has(row.mainStatus))
|
||||||
|
if (invalidStatusRows.length) return `以下入仓码当前状态不能合柜:${coLoadSelectionMembersLabel(invalidStatusRows)}`
|
||||||
const groupedRows = selectedOrders.value.filter((row) => row.coLoadGroup && row.coLoadGroup.status !== 'CANCELLED')
|
const groupedRows = selectedOrders.value.filter((row) => row.coLoadGroup && row.coLoadGroup.status !== 'CANCELLED')
|
||||||
if (groupedRows.length) return `以下入仓码已有同柜组:${coLoadSelectionMembersLabel(groupedRows)},请先解除原同柜组`
|
if (groupedRows.length) return `以下入仓码已有同柜组:${coLoadSelectionMembersLabel(groupedRows)},请先解除原同柜组`
|
||||||
const missingWarehouseRows = selectedOrders.value.filter((row) => !String(row.receivingWarehouseId || '').trim())
|
const missingWarehouseRows = selectedOrders.value.filter((row) => !String(row.receivingWarehouseId || '').trim())
|
||||||
|
|||||||
Reference in New Issue
Block a user