feat(train-scheduling): implement container movement between wagons

- Added functionality to move containers between wagons in the train scheduling system.
- Introduced  API endpoint and service method to handle container movement.
- Updated  component to support drag-and-drop for rearranging containers.
- Enhanced  to allow moving containers to other wagons via a context menu.
- Implemented UI feedback for container movement actions, including loading states and success/error notifications.
- Updated relevant types and constants to accommodate new container movement logic.
- Added tests for the rule engine to ensure proper handling of hazardous bookings.
This commit is contained in:
Marshal
2026-07-21 23:02:06 +00:00
parent 00a81fda15
commit 835c9e111c
35 changed files with 1896 additions and 154 deletions

View File

@@ -814,6 +814,26 @@ export const api = {
undefined,
() => [QUERY_KEYS.TRAIN_SCHEDULING.ROOT],
),
moveContainerItem: endpoint<
{
scheduleId: string;
itemId: string;
targetTrainSetWagonId: string;
swapWithItemId?: string;
},
TrainScheduleDetail
>(
"train-scheduling",
"move-container-item",
({ scheduleId, itemId, targetTrainSetWagonId, swapWithItemId }) =>
trainSchedulingService.moveContainerItem(scheduleId, itemId, {
targetTrainSetWagonId,
swapWithItemId,
}),
undefined,
() => [QUERY_KEYS.TRAIN_SCHEDULING.ROOT],
),
},
warehouses: {

View File

@@ -757,6 +757,18 @@ export const trainSchedulingService = {
return unwrap(response.data);
},
moveContainerItem: async (
scheduleId: string,
itemId: string,
payload: { targetTrainSetWagonId: string; swapWithItemId?: string },
): Promise<TrainScheduleDetail> => {
const response = await client.post<TrainScheduleDetail>(
URL_CONSTANTS.TRAIN_SCHEDULING.MOVE_CONTAINER_ITEM(scheduleId, itemId),
payload,
);
return unwrap(response.data);
},
getUnassignedBookings: async (
scheduleId: string,
): Promise<UnassignedBookingsResponse> => {