MovementCompletedEvent
EventType: MOVEMENT_COMPLETEDDomain: inventory Broker subject: progress.notification.inventory
Records a confirmed inventory movement of any type (RECEIPT, SHIPMENT, ADJUSTMENT, TRANSFER, PRODUCTION, CONSUMPTION). Dispatches to a type-specific handler that updates is_in_position quantities via child InventoryChangedEvent records. Optionally creates a SerialCreatedEvent child for receipts of traceable products without an existing serial.
Sequence Diagram
Trigger
Triggered by: POST /event (universal event dispatcher)
Dispatched via POST /event in backend/api/endpoints/traceability.py with event_type: MOVEMENT_COMPLETED. Also spawned as a child event by BatchCompletedEvent for PRODUCTION and CONSUMPTION movements.
Preconditions
movement_typemust not beREVERSAL(useMovementReversedEventinstead)position_fromandposition_to(if provided and notNULL/OUT) must exist and not be deletedproduct_keyis required unless it is a container TRANSFER with explicit positions
State Changes (Transaction)
Collections: Inherited from BaseInventoryEvent.get_tx_collections()
movementdocument inserted (new movement) or updated (planned movement confirmed)is_in_positionupdated viaInventoryChangedEventchild events for each position affectedSerialpotentially created viaSerialCreatedEventfor traced receipt
Side Effects (post_processing)
Inherits post_processing() from BaseInventoryEvent:
- Publishes to
progress.notification.inventory
InfoModel Fields
| Field | Type | Description |
|---|---|---|
movement_key | str | None | Key of an existing planned movement to confirm (null for new movements) |
movement_type | InventoryMovementType | Movement type: RECEIPT, SHIPMENT, ADJUSTMENT, TRANSFER, PRODUCTION, CONSUMPTION |
product_key | str | None | ArangoDB key of the product (not required for container TRANSFER) |
qt_planned | float | Planned quantity |
qt_confirmed | float | Confirmed quantity |
serial_key | str | None | Serial key (required for traceable SHIPMENT) |
serial_code | str | None | Serial code for receipt auto-creation (excluded from event payload) |
position_from | str | None | Source position key (NULL for PRODUCTION, OUT for RECEIPT) |
position_to | str | None | Destination position key (NULL for CONSUMPTION, OUT for SHIPMENT) |
movement_list_key | str | None | Key of the movement list this movement belongs to |
movement_list_item | float | None | Item index within the movement list |
references | InventoryMovementReferences | None | Contextual references (job, batch, work order) |
reason | str | None | Reason for the movement |
extra | Any | Additional arbitrary data |
Related Events
InventoryChangedEvent— spawned for each position quantity updateSerialCreatedEvent— spawned for receipt of a traceable product without an existing serial