Repository navigation
Data Model and API
The backend exposes its OpenAPI schema at /openapi.json and interactive Swagger UI at /docs.
| Model | Purpose |
|---|---|
MesOrderRecord (mes_order) |
Durable order identity, normalized input, type, and shared FIFO sequence. |
OrderRunRecord (order_run) |
Execution phase, optimistic version, timestamps, and review state. |
ProductUnitRecord (product_unit) |
Planned product units and any observed per-unit result. |
RunReviewRecord (run_review) |
Idempotency and audit trail for manual outcome reviews. |
DispatchStateRecord (dispatch_state) |
Shared active run and accepted sequence. |
PlcSourceStateRecord (plc_source_state) |
PLC source health per order type. |
PlcCatalogProductRecord / PlcCatalogStateRecord
|
Persisted PLC product catalog and synchronization/capacity state. |
StorageOutboxEvent |
Durable RabbitMQ outbound stock events and publish state. |
Legacy CRUD models such as Article, Storage, and machine/user records remain in the application alongside the durable order pipeline.
| Method | Route | Purpose |
|---|---|---|
GET |
/plc-storage/ |
Read a live inventory snapshot from PLC storage nodes. Returns 503 when unavailable. |
GET |
/storage/ |
List database-backed legacy stock records. |
GET |
/storage/status |
Report inbound RabbitMQ consumer configuration and health. |
GET |
/storage/{item_id} |
Read one legacy stock record. |
POST, PATCH
|
/storage/{item_id} |
Create or update legacy stock. |
PATCH |
/storage/{item_id}/{amount} |
Apply a relative legacy stock change. |
GET |
/productionorder/, /deliveryorder/
|
Paginated, searchable order lists. |
GET |
/productionorder/queue-status, /deliveryorder/queue-status
|
Worker and queue diagnostics without PLC reads. |
GET |
/productionorder/{order_id}, /deliveryorder/{order_id}
|
Order and run details. |
POST |
/productionorder/, /deliveryorder/
|
Admit an order. 202 means persisted admission, not PLC start or completion. |
GET |
/orders/overview |
Combined order summary and source/dispatch state. |
GET |
/orders/input-context?order_type=production (or delivery) |
Prepare form data, identifiers, catalog and queue capacity. |
POST |
/orders/catalog/sync?order_type=production (or delivery) |
Synchronize catalog from the PLC into the database. |
POST |
/orders/runs/{run_id}/reviews |
Record an outcome review with version checking and request idempotency. |
GET, PUT
|
/settings/ |
Read or update PLC node names and polling settings. |
GET |
/analytics/ |
Historical runs; accepts date and order type filters. |
Order-pipeline errors use 409 for conflicting or stale state, 404 for missing records, 422 for invalid data, and 503 when a required service is unavailable. Review requests must include the expected run version and a request ID. Repeating the same request is idempotent; reusing its ID with a different payload is a conflict.
The PLC contract currently establishes order feedback states, but a result code is only meaningful when confirmed and mapped in configuration. Planned queue quantities are not measured output. Unknown product result codes must not be presented as measured quality. Manual reviews can record an outcome where PLC evidence is insufficient. See Configuration and OPC UA Integration.