feat(appointments): simplify planning and preserve source warehouse intent

This commit is contained in:
2026-10-10 10:44:07 +08:00
parent fb062b5ec4
commit 901431f17a
26 changed files with 423 additions and 108 deletions
@@ -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)