Skip to content

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_type must not be REVERSAL (use MovementReversedEvent instead)
  • position_from and position_to (if provided and not NULL/OUT) must exist and not be deleted
  • product_key is required unless it is a container TRANSFER with explicit positions

State Changes (Transaction)

Collections: Inherited from BaseInventoryEvent.get_tx_collections()

  • movement document inserted (new movement) or updated (planned movement confirmed)
  • is_in_position updated via InventoryChangedEvent child events for each position affected
  • Serial potentially created via SerialCreatedEvent for traced receipt

Side Effects (post_processing)

Inherits post_processing() from BaseInventoryEvent:

  • Publishes to progress.notification.inventory

InfoModel Fields

FieldTypeDescription
movement_keystr | NoneKey of an existing planned movement to confirm (null for new movements)
movement_typeInventoryMovementTypeMovement type: RECEIPT, SHIPMENT, ADJUSTMENT, TRANSFER, PRODUCTION, CONSUMPTION
product_keystr | NoneArangoDB key of the product (not required for container TRANSFER)
qt_plannedfloatPlanned quantity
qt_confirmedfloatConfirmed quantity
serial_keystr | NoneSerial key (required for traceable SHIPMENT)
serial_codestr | NoneSerial code for receipt auto-creation (excluded from event payload)
position_fromstr | NoneSource position key (NULL for PRODUCTION, OUT for RECEIPT)
position_tostr | NoneDestination position key (NULL for CONSUMPTION, OUT for SHIPMENT)
movement_list_keystr | NoneKey of the movement list this movement belongs to
movement_list_itemfloat | NoneItem index within the movement list
referencesInventoryMovementReferences | NoneContextual references (job, batch, work order)
reasonstr | NoneReason for the movement
extraAnyAdditional arbitrary data

Source

MovementCompletedEvent on GitHub

Released under the Apache 2.0 License.