Station Process Flow
The Station Process Flow defines how stations connect to form a production pipeline. Jobs automatically advance through stations based on these connections.
Connection Model
Connections are stored in ops_station_connections as directed edges:
| Column | Type | Description |
|---|---|---|
id | UUID (PK) | Auto-generated |
from_station_id | UUID (FK) | Source station |
to_station_id | UUID (FK) | Destination station |
connection_type | VARCHAR(50) | 'feeds_into' (default) or 'rework' |
Constraints:
UNIQUE(from_station_id, to_station_id)— no duplicate connectionsCHECK(from_station_id != to_station_id)— no self-loops
Connection Types
| Type | Meaning |
|---|---|
feeds_into | Normal forward flow. Used for Job Auto-Advancement. |
rework | Return path for defective items. Does NOT trigger auto-advancement. |
Process Flow Visualization
Stations have canvas positions stored in ops_station_positions:
| Column | Type | Description |
|---|---|---|
station_id | UUID (FK, unique) | One position per station |
x / y | NUMERIC | Canvas coordinates |
width / height | NUMERIC | Node dimensions (defaults: 120 x 80) |
The process flow is rendered in the Schematic Builder feature at /oee/process-flow. Users can:
- Drag and drop stations to position them on a canvas
- Draw connections between stations
- View active jobs at each station as badges on the nodes
Auto-Advancement Logic
When a job completes at a station, the complete_ops_job() function checks connections:
flowchart TD A[Job completes at Station A] --> B{How many 'feeds_into' connections?} B -->|0| D[Mark job as 'completed'] B -->|Exactly 1| C[Auto-advance to Station B] B -->|2+| F[Prompt operator to select destination] C --> E[Job becomes 'pending' at Station B] C --> G[New station_history entry created] F --> H{Operator selects?} H -->|Yes| E H -->|No| I[Job enters 'queued' state at current station]
See Job Auto-Advancement for the detailed logic.
SQL Functions
create_ops_station_connection()/get_ops_station_connections()update_ops_station_connection()/delete_ops_station_connection()get_ops_station_positions()/upsert_ops_station_positions()
Codebase Paths
- Connections table:
database/sql_scripts/tables/ops_station_connections.sql - Positions table:
database/sql_scripts/tables/ops_station_positions.sql - Connection functions:
database/sql_scripts/functions/ops/ops_station_functions.sql - Position functions:
database/sql_scripts/functions/ops/ops_station_position_functions.sql - Frontend:
frontend/src/app/features/schematic-builder/ - Backend positions endpoint:
backend/endpoints/schematic.ts