优化优化

This commit is contained in:
2026-10-10 14:58:15 +08:00
parent 1abc831df1
commit 40cccee266
5 changed files with 88 additions and 4 deletions
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { http } from '@/shared/api/http'
import { reviewCargoDiscard } from './lastMileOrders'
import { reviewCargoDiscard, updateLastMileOrderPalletMerge } from './lastMileOrders'
import { changeContainerReceivingWarehouse, convertLastMileContainerToInboundPlans, createManualInboundPlan, getContainerPlanProgress, getLastMileOrder, getLastMileOrderManualNodes, listContainerPlanProgress, listLastMileOrders, transferLastMileOrders, updateLastMileOrderHold, updateLastMileOrderManualNodes } from './lastMileOrders'
vi.mock('@/shared/api/http', async (importOriginal) => ({ ...(await importOriginal<typeof import('@/shared/api/http')>()), http: { get: vi.fn(), put: vi.fn(), post: vi.fn() } }))
@@ -148,3 +148,12 @@ describe('last-mile order overseas API', () => {
)
})
})
it('sets and cancels a merge group with string IDs and explicit customer scope', async () => {
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: null })
for (const required of [true, false]) {
await updateLastMileOrderPalletMerge(['2092873463568596994'], '2092618717861048321', required)
expect(http.put).toHaveBeenLastCalledWith('/platform/v1/last-leg/orders/pallet-merge-required/batch',
{ orderIds: ['2092873463568596994'], palletMergeRequired: required }, { params: { customerId: '2092618717861048321' } })
}
})
@@ -427,6 +427,15 @@ export async function transferLastMileOrders(payload: TransferDestinationPayload
return unwrapApiResponse(response)
}
export async function updateLastMileOrderPalletMerge(orderIds: string[], customerId: string, palletMergeRequired: boolean) {
const response = await http.put<ApiEnvelope<null>, ApiEnvelope<null>>(
'/platform/v1/last-leg/orders/pallet-merge-required/batch',
{ orderIds, palletMergeRequired },
{ params: { customerId } },
)
return unwrapApiResponse(response)
}
export async function listContainerPlanProgress(query: ContainerPlanProgressQuery): Promise<OverseasPageResult<ContainerPlanProgressSummaryDto>> {
const response = await http.get<ApiEnvelope<OverseasPagePayload<ContainerPlanProgressSummaryDto>>, ApiEnvelope<OverseasPagePayload<ContainerPlanProgressSummaryDto>>>(
'/platform/v1/last-leg/orders/container-summaries',