feat(appointments): simplify planning and preserve source warehouse intent
This commit is contained in:
@@ -33,7 +33,7 @@ describe('inbound order overseas API', () => {
|
||||
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: detail })
|
||||
|
||||
await getFbaAppointment('APT/1')
|
||||
await updateFbaAppointment('APT/1', { version: detail.version, appointmentAt: detail.appointmentAt, expectedLoadingAt: detail.expectedLoadingAt, appointmentStatus: 'SUCCESS' })
|
||||
await updateFbaAppointment('APT/1', { version: detail.version, idempotencyKey: 'update-key', details: {appointmentAt: detail.appointmentAt, confirmationNo: 'EXT-1', appointmentStatus: 'SUCCESS'} })
|
||||
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/last-leg/inbound-plans/fba-appointments/APT%2F1')
|
||||
expect(http.put).toHaveBeenCalledWith('/platform/v1/last-leg/inbound-plans/fba-appointments/APT%2F1', expect.not.objectContaining({ customerId: expect.anything() }))
|
||||
@@ -50,11 +50,9 @@ describe('inbound order overseas API', () => {
|
||||
it('preserves selected line ids as strings when creating an appointment', async () => {
|
||||
vi.mocked(http.post).mockResolvedValue({ code: '200', message: 'success', data: { id: '1', appointmentNo: 'APT-1', appointmentStatus: 'SUCCESS', selectedCount: 1, fbaWarehouseCode: 'ONT8' } })
|
||||
const payload = {
|
||||
lineIds: ['190000000000000099'],
|
||||
appointmentNo: 'APT-1',
|
||||
appointmentAt: '2026-08-20T10:30:00',
|
||||
expectedLoadingAt: '2026-08-20T09:00:00',
|
||||
appointmentStatus: 'SUCCESS' as const,
|
||||
originWarehouseId: '100', fbaWarehouseCode: 'ONT8', lineIds: ['190000000000000099'],
|
||||
idempotencyKey: 'create-key',
|
||||
details: { plannedDate: '2026-08-20', appointmentStatus: 'PENDING' as const },
|
||||
}
|
||||
await createFbaAppointment(payload)
|
||||
expect(http.post).toHaveBeenCalledWith('/platform/v1/last-leg/inbound-plans/fba-appointments/batch', payload)
|
||||
|
||||
@@ -53,31 +53,48 @@ export interface InboundOrderSummaryDto {
|
||||
version?: number | null
|
||||
}
|
||||
|
||||
export interface BatchFbaAppointmentPayload {
|
||||
lineIds: string[]
|
||||
appointmentNo: string
|
||||
appointmentAt: string
|
||||
export interface FbaAppointmentDetailsPayload {
|
||||
plannedDate?: string | null
|
||||
plannedAt?: string | null
|
||||
plannedEndAt?: string | null
|
||||
confirmationNo?: string | null
|
||||
appointmentAt?: string | null
|
||||
appointmentEndAt?: string | null
|
||||
expectedLoadingAt: string
|
||||
appointmentStatus: 'PENDING' | 'SUCCESS' | 'FAILED' | 'CANCELLED'
|
||||
appointmentRemark?: string
|
||||
appointmentRemark?: string | null
|
||||
startOffset?: string | null
|
||||
endOffset?: string | null
|
||||
}
|
||||
export interface BatchFbaAppointmentPayload {
|
||||
originWarehouseId: string
|
||||
fbaWarehouseCode: string
|
||||
lineIds: string[]
|
||||
details: FbaAppointmentDetailsPayload
|
||||
idempotencyKey: string
|
||||
}
|
||||
|
||||
export interface FbaAppointmentDto {
|
||||
version: number
|
||||
id: string
|
||||
appointmentNo: string
|
||||
appointmentAt: string
|
||||
confirmationNo?: string | null
|
||||
plannedDate?: string | null
|
||||
plannedAt?: string | null
|
||||
plannedEndAt?: string | null
|
||||
appointmentAt?: string | null
|
||||
appointmentEndAt?: string | null
|
||||
expectedLoadingAt: string
|
||||
timezone?: string | null
|
||||
appointmentStartUtc?: string | null
|
||||
appointmentEndUtc?: string | null
|
||||
originWarehouseId: string
|
||||
appointmentStatus: string
|
||||
appointmentRemark?: string | null
|
||||
selectedCount: number
|
||||
fbaWarehouseCode: string
|
||||
items: Array<{ customerId: string; id: string; planId: string; lineId: string; orderId: string; inboundCode: string; fbaWarehouseCode: string }>
|
||||
items: Array<{ customerId: string; id: string; sourceKey: string; sourceVersion?: string | null; orderId?: string | null; inboundCode?: string | null; fbaWarehouseCode: string; packageCount?: number | null }>
|
||||
}
|
||||
|
||||
export type UpdateFbaAppointmentPayload = Omit<BatchFbaAppointmentPayload, 'lineIds' | 'appointmentNo'> & { version: number }
|
||||
export interface UpdateFbaAppointmentPayload { details: FbaAppointmentDetailsPayload; version: number; idempotencyKey: string }
|
||||
|
||||
export async function listFbaAppointmentCalendar(query: { from: string; to: string }, signal?: AbortSignal) {
|
||||
const response = await http.get<ApiEnvelope<FbaAppointmentDto[]>, ApiEnvelope<FbaAppointmentDto[]>>(
|
||||
|
||||
Reference in New Issue
Block a user