diff --git a/src/modules/container-loading/api/platformContainerLoading.test.ts b/src/modules/container-loading/api/platformContainerLoading.test.ts index 057a9583..bc94b422 100644 --- a/src/modules/container-loading/api/platformContainerLoading.test.ts +++ b/src/modules/container-loading/api/platformContainerLoading.test.ts @@ -39,7 +39,8 @@ describe('platform container loading API', () => { .mockResolvedValueOnce({ code: '200', data: container }) .mockResolvedValueOnce({ code: '200', data: [{ accountId: 1, inboundId: 2, inboundDetailId: 3, orderId: 4, warehouseId: 5, destinationWarehouseId: 6, availablePackageCount: '7' }] }) expect((await getContainer('9')).id).toBe(String(container.id)) - expect(await listSmartLoadingCandidates('5')).toMatchObject([{ accountId: '1', inboundDetailId: '3', destinationWarehouseId: '6', availablePackageCount: 7 }]) + expect(await listSmartLoadingCandidates('7', '5')).toMatchObject([{ accountId: '1', inboundDetailId: '3', destinationWarehouseId: '6', availablePackageCount: 7 }]) + expect(http.get).toHaveBeenLastCalledWith('/platform/v1/first-leg/smart-loading/candidates', { params: { bookingId: '7', warehouseId: '5' } }) }) it('sends plan and item versions plus operation and idempotency keys', async () => { diff --git a/src/modules/container-loading/api/platformContainerLoading.ts b/src/modules/container-loading/api/platformContainerLoading.ts index 1c70206d..c6e55300 100644 --- a/src/modules/container-loading/api/platformContainerLoading.ts +++ b/src/modules/container-loading/api/platformContainerLoading.ts @@ -76,8 +76,8 @@ export async function updateContainerTransport(containerId: string, version: num return container(unwrapApiResponse(response)) } -export async function listSmartLoadingCandidates(warehouseId: string) { - const response = await http.get, ApiEnvelope>(`${smartLoadingPath}/candidates`, { params: { warehouseId } }) +export async function listSmartLoadingCandidates(bookingId: string, warehouseId: string) { + const response = await http.get, ApiEnvelope>(`${smartLoadingPath}/candidates`, { params: { bookingId, warehouseId } }) return unwrapApiResponse(response).map((raw) => ({ ...raw, accountId: id(raw.accountId), inboundId: id(raw.inboundId), inboundDetailId: id(raw.inboundDetailId), orderId: id(raw.orderId), warehouseId: id(raw.warehouseId), destinationWarehouseId: optionalId(raw.destinationWarehouseId), diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts index cbc5b455..cc25338e 100644 --- a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts +++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts @@ -65,7 +65,7 @@ describe('GlobalSmartLoadingView', () => { expect(listContainers).toHaveBeenCalledWith({ page: 1, size: 100 }) expect(getSmartLoadingPlanByBooking).toHaveBeenCalledWith(container.id) - expect(listSmartLoadingCandidates).toHaveBeenCalledWith(container.warehouseId) + expect(listSmartLoadingCandidates).toHaveBeenCalledWith(container.id, container.warehouseId) expect(wrapper.text()).toContain('候选订单与货物') expect(wrapper.text()).toContain('ORD-2') expect(wrapper.text()).toContain('CB-1 装柜方案') @@ -146,7 +146,7 @@ describe('GlobalSmartLoadingView', () => { await flushPromises() expect(getSmartLoadingPlanByBooking).toHaveBeenCalledWith(pushed.id) - expect(listSmartLoadingCandidates).toHaveBeenCalledWith(pushed.warehouseId) + expect(listSmartLoadingCandidates).toHaveBeenCalledWith(pushed.id, pushed.warehouseId) expect(wrapper.text()).toContain('CB-2') expect(wrapper.text()).toContain('拣货中') expect(wrapper.text()).toContain('智能推荐') diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue index afa26bf5..6163e571 100644 --- a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue +++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue @@ -172,7 +172,7 @@ async function loadSelectedData(preserved: Record = {}) { selectionLoading.value = true try { const [candidateResult, planResult] = await Promise.all([ - listSmartLoadingCandidates(container.warehouseId), + listSmartLoadingCandidates(container.id, container.warehouseId), getSmartLoadingPlanByBooking(container.id).then((value) => ({ value, missing: false })).catch((error) => { const details = getApiErrorDetails(error) if (details.code === 'A0404') return { value: null, missing: true } diff --git a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts index 7365b72e..20263988 100644 --- a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts +++ b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.test.ts @@ -42,7 +42,7 @@ describe('SmartLoadingWorkbenchView', () => { await flushPromises() expect(getContainer).toHaveBeenCalledWith(container.id) expect(getSmartLoadingPlanByBooking).toHaveBeenCalledWith(container.id) - expect(listSmartLoadingCandidates).toHaveBeenCalledWith('8') + expect(listSmartLoadingCandidates).toHaveBeenCalledWith(container.id, '8') expect(wrapper.text()).toContain('LP-99') expect(wrapper.text()).toContain('ORD-1') expect(wrapper.text()).toContain('按 110% 上限') @@ -57,7 +57,7 @@ describe('SmartLoadingWorkbenchView', () => { await flushPromises() expect(getSmartLoadingPlanByBooking).toHaveBeenCalledWith(container.id) - expect(listSmartLoadingCandidates).toHaveBeenCalledWith(container.warehouseId) + expect(listSmartLoadingCandidates).toHaveBeenCalledWith(container.id, container.warehouseId) expect(wrapper.text()).toContain('拣货中') expect(wrapper.text()).toContain('智能推荐') expect(wrapper.text()).toContain('ORD-1') diff --git a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue index 3338130d..76c4c5a6 100644 --- a/src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue +++ b/src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue @@ -108,7 +108,7 @@ async function load() { if (detail.code === 'A0404') { plan.value = null; noDraft.value = true } else throw error } - candidates.value = await listSmartLoadingCandidates(container.value.warehouseId) + candidates.value = await listSmartLoadingCandidates(container.value.id, container.value.warehouseId) } catch (error) { loadError.value = getApiErrorDetails(error, '智能排柜工作台加载失败') } finally { loading.value = false } } diff --git a/src/modules/ocean-bookings/api/platformOceanBookings.test.ts b/src/modules/ocean-bookings/api/platformOceanBookings.test.ts index bbabd03d..0191d9b8 100644 --- a/src/modules/ocean-bookings/api/platformOceanBookings.test.ts +++ b/src/modules/ocean-bookings/api/platformOceanBookings.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import { createOceanBooking, listOceanBookings, performOceanBookingAction, requestOceanBookingChange } from './platformOceanBookings' +import { createOceanBooking, listOceanBookings, performOceanBookingAction, releaseOceanBooking, requestOceanBookingChange } from './platformOceanBookings' import { http } from '@/shared/api/http' const detailResponse = (version = 0) => ({ @@ -22,7 +22,7 @@ describe('ocean bookings api', () => { it('uses version zero for create and extracts the id from the returned Detail', async () => { const post = vi.spyOn(http, 'post').mockResolvedValue({ code: '200', message: 'ok', data: detailResponse() }) - const created = await createOceanBooking({ expectedVersion: 0, data: { customerId: '456', customerName: '客户', parties: [], containerRequirements: [] } }) + const created = await createOceanBooking({ expectedVersion: 0, data: { customerId: '456', customerName: '客户', channelCode: 'SEA', channelName: '海运', warehouseId: '8', warehouseName: '义乌仓', parties: [], containerRequirements: [] } }) expect(post.mock.calls[0]?.[1]).toMatchObject({ expectedVersion: 0 }) expect(post.mock.calls[0]?.[2]).toMatchObject({ headers: { 'Idempotency-Key': expect.any(String) } }) expect(created.id).toBe('123') @@ -38,5 +38,9 @@ describe('ocean bookings api', () => { await requestOceanBookingChange('123', { expectedVersion: 4, vesselName: 'VESSEL', voyageNo: 'V001', reason: '调整船期' }) expect(post.mock.calls[1]?.[0]).toContain('/123/change-request') expect(post.mock.calls[1]?.[1]).toMatchObject({ expectedVersion: 4, vesselName: 'VESSEL', voyageNo: 'V001', reason: '调整船期' }) + + await releaseOceanBooking('123', { expectedVersion: 4, billOfLadingNo: 'BL-1', vesselName: 'VESSEL', voyageNo: 'V001', estimatedSailingAt: '2026-08-12T10:00:00', estimatedArrivalAt: '2026-09-01T10:00:00' }) + expect(post.mock.calls[2]?.[0]).toContain('/123/release') + expect(post.mock.calls[2]?.[1]).toMatchObject({ billOfLadingNo: 'BL-1', vesselName: 'VESSEL', voyageNo: 'V001', estimatedSailingAt: '2026-08-12T10:00:00', estimatedArrivalAt: '2026-09-01T10:00:00' }) }) }) diff --git a/src/modules/ocean-bookings/api/platformOceanBookings.ts b/src/modules/ocean-bookings/api/platformOceanBookings.ts index 4d9f5200..484a5d5c 100644 --- a/src/modules/ocean-bookings/api/platformOceanBookings.ts +++ b/src/modules/ocean-bookings/api/platformOceanBookings.ts @@ -1,5 +1,5 @@ import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http' -import type { OceanBookingActionRequest, OceanBookingChangeRequest, OceanBookingDetail, OceanBookingPage, OceanBookingQuery, OceanBookingResource, OceanBookingSaveRequest, OceanBookingStatus } from '../types' +import type { OceanBookingActionRequest, OceanBookingChangeRequest, OceanBookingDetail, OceanBookingPage, OceanBookingQuery, OceanBookingResource, OceanBookingSaveRequest, OceanBookingStatus, OceanBookingReleaseRequest } from '../types' const basePath = '/platform/v1/ocean-bookings' function pageNumber(value: number | string, fallback: number) { const n = Number(value); return Number.isFinite(n) ? Math.trunc(n) : fallback } @@ -45,7 +45,8 @@ function idempotencyKey() { return `ocean-booking-${Date.now()}-${Math.random(). export async function createOceanBooking(payload: OceanBookingSaveRequest) { const response = await http.post, ApiEnvelope>(basePath, payload, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } export async function updateOceanBooking(id: string, payload: OceanBookingSaveRequest) { const response = await http.put, ApiEnvelope>(`${basePath}/${encodeURIComponent(id)}`, payload, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } export type OceanBookingAction = 'submit' | 'confirm' | 'release' | 'fail' | 'cancel' | 'change-request' | 'change-confirm' | 'change-fail' -export async function performOceanBookingAction(id: string, action: Exclude, request: OceanBookingActionRequest) { const response = await http.post, ApiEnvelope>(`${basePath}/${encodeURIComponent(id)}/${action}`, request, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } +export async function performOceanBookingAction(id: string, action: Exclude, request: OceanBookingActionRequest) { const response = await http.post, ApiEnvelope>(`${basePath}/${encodeURIComponent(id)}/${action}`, request, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } +export async function releaseOceanBooking(id: string, request: OceanBookingReleaseRequest) { const response = await http.post, ApiEnvelope>(`${basePath}/${encodeURIComponent(id)}/release`, request, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } export async function requestOceanBookingChange(id: string, request: OceanBookingChangeRequest) { const response = await http.post, ApiEnvelope>(`${basePath}/${encodeURIComponent(id)}/change-request`, request, { headers: { 'Idempotency-Key': idempotencyKey() } }); return detail(unwrapApiResponse(response)) } export async function printOceanBooking(id: string, type: 'SHIPPING_INSTRUCTION' | 'BILL_CONFIRMATION') { return http.get(`${basePath}/${encodeURIComponent(id)}/print`, { params: { type }, responseType: 'blob' }) } export type { OceanBookingResource, OceanBookingStatus } diff --git a/src/modules/ocean-bookings/pages/OceanBookingDetailView.test.ts b/src/modules/ocean-bookings/pages/OceanBookingDetailView.test.ts index 3fca8f92..57bb9e2e 100644 --- a/src/modules/ocean-bookings/pages/OceanBookingDetailView.test.ts +++ b/src/modules/ocean-bookings/pages/OceanBookingDetailView.test.ts @@ -41,6 +41,15 @@ describe('OceanBookingDetailView interaction contract', () => { ]) expect(source).toContain(`placeholder="${placeholder}"`) }) + it('captures channel, warehouse, capacity snapshots and uses the release DTO', () => { + expect(source).toContain('v-model="form.data.channelCode"') + expect(source).toContain('v-model="form.data.channelName"') + expect(source).toContain('form.data.warehouseName = warehouses.find') + expect(source).toContain('v-model="container.capacityCbm"') + expect(source).toContain('v-model="container.maxWeightKg"') + expect(source).toContain('releaseOceanBooking(id.value, releaseRequest)') + }) + it('keeps view, create and edit on the formal detail route with a return action', () => { expect(source).toContain("router.push('/ocean-bookings')") expect(source).toContain("router.replace(`/ocean-bookings/${created.id}`)") diff --git a/src/modules/ocean-bookings/pages/OceanBookingDetailView.vue b/src/modules/ocean-bookings/pages/OceanBookingDetailView.vue index 81f5e2f4..d509caf2 100644 --- a/src/modules/ocean-bookings/pages/OceanBookingDetailView.vue +++ b/src/modules/ocean-bookings/pages/OceanBookingDetailView.vue @@ -14,10 +14,12 @@ import DetailPageLayout from '@/shared/components/DetailPageLayout.vue' import PageToolbar from '@/shared/components/PageToolbar.vue' import { listPlatformTenants, type PlatformTenantResource } from '@/modules/iam' import { listPlatformPartners, type PlatformPartnerResource } from '@/modules/master-data' +import { listPlatformWarehouses, type PlatformWarehouseResource } from '@/modules/warehouses' import { createOceanBooking, getOceanBooking, performOceanBookingAction, + releaseOceanBooking, requestOceanBookingChange, updateOceanBooking, type OceanBookingAction, @@ -68,6 +70,7 @@ const actionError = ref | null>(null) const formRef = ref() const customers = ref([]) const partners = ref([]) +const warehouses = ref([]) const optionsLoading = ref(false) const optionsError = ref('') const selectableCustomers = computed(() => customers.value.filter((customer) => ( @@ -81,8 +84,8 @@ function blankParties(): OceanBookingParty[] { } function blankData(): OceanBookingDraftData { return { - customerId: '', customerName: '', parties: blankParties(), - containerRequirements: [{ containerType: '40HC', containerKind: 'FCL', quantity: 1 }], + customerId: '', customerName: '', channelCode: '', channelName: '', warehouseId: '', warehouseName: '', parties: blankParties(), + containerRequirements: [{ containerType: '40HC', containerKind: 'FCL', capacityCbm: 68, maxWeightKg: 28000, quantity: 1 }], } } const form = reactive({ expectedVersion: 0, data: blankData() }) @@ -106,12 +109,14 @@ async function loadOptions() { optionsLoading.value = true optionsError.value = '' try { - const [customerResult, partnerResult] = await Promise.all([ + const [customerResult, partnerResult, warehouseResult] = await Promise.all([ listPlatformTenants({ page: 1, size: 200 }), listPlatformPartners({ page: 1, size: 200, status: 'ACTIVE' }), + listPlatformWarehouses({ page: 1, size: 200, status: 'ACTIVE' }), ]) customers.value = customerResult.records partners.value = partnerResult.records + warehouses.value = warehouseResult.records } catch (cause) { optionsError.value = getApiErrorDetails(cause, '客户及合作单位选项加载失败').message } finally { @@ -136,7 +141,7 @@ function applyDetail(value: OceanBookingDetail) { detail.value = value form.expectedVersion = value.version form.data = { - customerId: value.customerId || '', customerName: value.customerName || '', billOfLadingNo: value.billOfLadingNo, + customerId: value.customerId || '', customerName: value.customerName || '', channelCode: value.channelCode || '', channelName: value.channelName || '', warehouseId: value.warehouseId || '', warehouseName: value.warehouseName || '', billOfLadingNo: value.billOfLadingNo, shippingCompanyId: value.shippingCompanyId, shippingCompanyName: value.shippingCompanyName, bookingAgentId: value.bookingAgentId, bookingAgentName: value.bookingAgentName, vesselName: value.vesselName, voyageNo: value.voyageNo, @@ -146,7 +151,7 @@ function applyDetail(value: OceanBookingDetail) { estimatedSailingAt: value.estimatedSailingAt, estimatedArrivalAt: value.estimatedArrivalAt, remark: value.remark, parties: value.parties.length ? value.parties.map(({ partyType, partyName, contactName, contactPhone, address }) => ({ partyType, partyName, contactName, contactPhone, address })) : blankParties(), - containerRequirements: value.containerRequirements.length ? value.containerRequirements.map(({ containerType, containerKind, quantity }) => ({ containerType, containerKind, quantity })) : [{ containerType: '40HC', containerKind: 'FCL', quantity: 1 }], + containerRequirements: value.containerRequirements.length ? value.containerRequirements.map(({ containerType, containerKind, capacityCbm, maxWeightKg, quantity }) => ({ containerType, containerKind, capacityCbm, maxWeightKg, quantity })) : [{ containerType: '40HC', containerKind: 'FCL', capacityCbm: 68, maxWeightKg: 28000, quantity: 1 }], } } async function load() { @@ -213,13 +218,16 @@ async function runAction(action: OceanBookingAction) { const reason = await requiredReason(action) await ElMessageBox.confirm(`确认执行“${actionLabels[action]}”吗?`, actionLabels[action], { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }) actionSaving.value = true - applyDetail(await performOceanBookingAction(id.value, action, { expectedVersion: detail.value.version, reason })) + if (action === 'release') { + const releaseRequest = { expectedVersion: detail.value.version, billOfLadingNo: form.data.billOfLadingNo || '', vesselName: form.data.vesselName || '', voyageNo: form.data.voyageNo || '', estimatedSailingAt: form.data.estimatedSailingAt || '', estimatedArrivalAt: form.data.estimatedArrivalAt || '', reason } + applyDetail(await releaseOceanBooking(id.value, releaseRequest)) + } else applyDetail(await performOceanBookingAction(id.value, action, { expectedVersion: detail.value.version, reason })) ElMessage.success(`${actionLabels[action]}成功`) } catch (cause) { if (cause !== 'cancel' && !(cause instanceof Error && cause.message === 'cancel')) actionError.value = getApiErrorDetails(cause) } finally { actionSaving.value = false } } -function addContainer() { form.data.containerRequirements.push({ containerType: '40HC', containerKind: 'FCL', quantity: 1 }) } +function addContainer() { form.data.containerRequirements.push({ containerType: '40HC', containerKind: 'FCL', capacityCbm: 68, maxWeightKg: 28000, quantity: 1 }) } function removeContainer(index: number) { if (form.data.containerRequirements.length > 1) form.data.containerRequirements.splice(index, 1) } onMounted(() => { void load(); void loadOptions() }) @@ -255,6 +263,9 @@ onMounted(() => { void load(); void loadOptions() }) + + + @@ -280,6 +291,8 @@ onMounted(() => { void load(); void loadOptions() })
+ + 删除
diff --git a/src/modules/ocean-bookings/types.ts b/src/modules/ocean-bookings/types.ts index 5c2e7415..8f71e39b 100644 --- a/src/modules/ocean-bookings/types.ts +++ b/src/modules/ocean-bookings/types.ts @@ -1,10 +1,11 @@ export type OceanBookingStatus = 'DRAFT' | 'SUBMITTED' | 'CONFIRMED' | 'RELEASED' | 'FAILED' | 'CHANGE_PENDING' | 'CANCELLED' export interface OceanBookingParty { id?: string; partyType: string; partyName: string; contactName?: string | null; contactPhone?: string | null; address?: string | null } -export interface OceanBookingContainer { id?: string; containerType: string; quantity: number; containerKind?: string | null } +export interface OceanBookingContainer { id?: string; containerType: string; quantity: number; containerKind?: string | null; capacityCbm: number; maxWeightKg: number } export interface OceanBookingContainerAllocation extends OceanBookingContainer { allocatedQuantity?: number | null } export interface OceanBookingDraftData { customerId: string; customerName: string; parties: OceanBookingParty[]; containerRequirements: OceanBookingContainer[] + channelCode: string; channelName: string; warehouseId: string; warehouseName: string billOfLadingNo?: string | null shippingCompanyId?: string | null; shippingCompanyName?: string | null; bookingAgentId?: string | null; bookingAgentName?: string | null departurePortCode?: string | null; departurePortName?: string | null; destinationPortCode?: string | null; destinationPortName?: string | null @@ -14,6 +15,7 @@ export interface OceanBookingDraftData { export interface OceanBookingResource { id: string; bookingNo: string | null; status: OceanBookingStatus; version: number customerId: string | null; customerName: string | null; billOfLadingNo: string | null + channelCode: string | null; channelName: string | null; warehouseId: string | null; warehouseName: string | null shippingCompanyId: string | null; shippingCompanyName: string | null; bookingAgentId: string | null; bookingAgentName: string | null vesselName: string | null; voyageNo: string | null; departurePortCode: string | null; departurePortName: string | null destinationPortCode: string | null; destinationPortName: string | null; placeOfDelivery: string | null @@ -32,6 +34,7 @@ export interface OceanBookingPage { records: OceanBookingResource[]; page: numbe export interface OceanBookingQuery { page: number; size: number; keyword?: string; status?: OceanBookingStatus; customerId?: string } export interface OceanBookingSaveRequest { expectedVersion: number; data: OceanBookingDraftData } export interface OceanBookingActionRequest { expectedVersion: number; reason?: string | null } +export interface OceanBookingReleaseRequest { expectedVersion: number; billOfLadingNo: string; vesselName: string; voyageNo: string; estimatedSailingAt: string; estimatedArrivalAt: string; reason?: string | null } export interface OceanBookingChangeRequest extends OceanBookingActionRequest { vesselName: string voyageNo: string diff --git a/src/modules/unified-orders/workflows/api.test.ts b/src/modules/unified-orders/workflows/api.test.ts index a859ea45..88cdb948 100644 --- a/src/modules/unified-orders/workflows/api.test.ts +++ b/src/modules/unified-orders/workflows/api.test.ts @@ -103,7 +103,8 @@ describe('unified order workflow API contract', () => { unitWeightKg: '10.5', unitVolumeCbm: '0.25', }] }) const container = await getContainerBooking('2086085512165634050') - const candidates = await listSmartLoadingCandidates(container.warehouseId!) + const candidates = await listSmartLoadingCandidates(container.id, container.warehouseId!) + expect(http.get).toHaveBeenLastCalledWith('/platform/v1/first-leg/smart-loading/candidates', { params: { bookingId: container.id, warehouseId: container.warehouseId } }) expect(container).toMatchObject({ id: '2086085512165634050', warehouseId: '2086085512165634051', capacityCbm: 68 }) expect(candidates[0]).toMatchObject({ accountId: '2086085512165634052', inboundId: '2086085512165634053', diff --git a/src/modules/unified-orders/workflows/api.ts b/src/modules/unified-orders/workflows/api.ts index 1074cab7..82cf6219 100644 --- a/src/modules/unified-orders/workflows/api.ts +++ b/src/modules/unified-orders/workflows/api.ts @@ -339,9 +339,9 @@ export async function getContainerBooking(bookingId: string | number) { return normalizeContainer(unwrapApiResponse(response)) } -export async function listSmartLoadingCandidates(warehouseId: string | number) { +export async function listSmartLoadingCandidates(bookingId: string | number, warehouseId: string | number) { const response = await http.get[]>, ApiEnvelope[]>>( - `${smartLoadingBasePath}/candidates`, { params: { warehouseId: String(warehouseId) } }, + `${smartLoadingBasePath}/candidates`, { params: { bookingId: String(bookingId), warehouseId: String(warehouseId) } }, ) return unwrapApiResponse(response).map(normalizeCandidate) } diff --git a/src/modules/unified-orders/workflows/components/SmartLoadingWorkbench.vue b/src/modules/unified-orders/workflows/components/SmartLoadingWorkbench.vue index 65bc866d..1fddb865 100644 --- a/src/modules/unified-orders/workflows/components/SmartLoadingWorkbench.vue +++ b/src/modules/unified-orders/workflows/components/SmartLoadingWorkbench.vue @@ -166,7 +166,7 @@ async function load() { if (error instanceof ApiResponseError && ['A0404', 'NOT_FOUND'].includes(error.code)) plan.value = null else throw Object.assign(error instanceof Error ? error : new Error(details.message), { details }) } - candidates.value = nextContainer.warehouseId ? await listSmartLoadingCandidates(nextContainer.warehouseId) : [] + candidates.value = nextContainer.warehouseId ? await listSmartLoadingCandidates(nextContainer.id, nextContainer.warehouseId) : [] } catch (error) { container.value = null plan.value = null @@ -185,7 +185,7 @@ async function runAction(name: string, operation: () => Promise