Skip to content

SerialCreatedEvent

EventType: SERIAL_CREATEDDomain: serial Broker subject: progress.notification.serial

Creates a new Serial document for a product that has traceability enabled. If the product requires a code at creation (or the serial is being released immediately), generates one via the product's linked counter. Raises SerialCodeAlreadyPresent if the code is already in use for the product.

Sequence Diagram

Trigger

Triggered by: POST /event (universal event dispatcher)

Dispatched via POST /event in backend/api/endpoints/traceability.py with event_type: SERIAL_CREATED. Also spawned as a child event by MovementCompletedEvent for receipts of traceable products without an existing serial.

Preconditions

  • Product exists with key info.product_key
  • Product has traceability_level enabled
  • If info.code provided: code is not already in use for the product
  • If serial needs a code and none provided: product has a counter_key

State Changes (Transaction)

Collections: Inherited from BaseSerialEvent.get_tx_collections()

  • Serial inserted with product key, optional code, form data, and released timestamp
  • Counter incremented if code was auto-generated

Side Effects (post_processing)

Inherits post_processing() from BaseSerialEvent:

  • Publishes to progress.notification.serial

InfoModel Fields

FieldTypeDescription
datalist[SerialFormFieldValue] | NoneInitial form field data for the serial
codeProcessedSerialCode | NonePre-assigned serial code object
wo_keystr | NoneWork order key to associate with the serial
product_keystr | NoneArangoDB key of the product
counter_keystr | NoneCounter key for auto-code generation (resolved from product)
releaseddatetime | NoneRelease timestamp (defaults to now if provided)

None.

Source

SerialCreatedEvent on GitHub

Released under the Apache 2.0 License.