OEE Job
An OEE Job (formerly called “Batch”) is a production run event tracked at a Station. Jobs can only belong to one station at a time — they cannot span multiple stations simultaneously. However, multiple machines and/or multiple people contribute hours towards the same job at that station. Hours are cumulative: 3 people x 2 hours = 6 job-hours.
OEE Jobs are stored as records in oee_machine_events with event_type = 'job', with additional details in oee_batch_details. See Events for how jobs compare to the other event types (downtime and incidents).
Naming History
- Originally called Batch throughout the codebase. Some tables and columns still use the old name (e.g.,
oee_batch_details,batch_number).
Lifecycle & States
OEE Jobs have the following lifecycle:
stateDiagram-v2 [*] --> idle: Job posted to station idle --> running: Machine/person starts work running --> idle: Machine/person stops running --> completed: Job completed running --> aborted: Job aborted idle --> aborted: Job aborted completed --> [*]: Moves to next station aborted --> [*]
| State | Description |
|---|---|
idle | Job exists at the station but nothing is actively working on it |
running | A machine or person is actively contributing time to the job |
completed | Job finished successfully |
aborted | Job was stopped early (with abort reason) |
Jobs cycle between idle and running as machines and people start and stop contributing time. A job can be aborted from either idle (cancel a waiting job) or running (stop mid-work), but can only be completed from running.
Data Model
Primary record: oee_machine_events (the time-based event)
| Column | Type | Description |
|---|---|---|
event_type | VARCHAR(20) | 'job' |
machine_id | UUID (FK) | Which Machine contributed time to this job |
job_id | UUID (FK, nullable) | Optional link to a job (ops_jobs) |
start_ts | TIMESTAMPTZ | When the job started |
end_ts | TIMESTAMPTZ | When it ended (NULL = still running) |
duration_minutes | DECIMAL | Calculated duration |
Detail record: oee_batch_details (production specifics)
| Column | Type | Description |
|---|---|---|
batch_number | VARCHAR(100) | Not unique — same batch can span multiple machines contributing to the same job |
work_order | VARCHAR(100) | Optional work order reference |
target_quantity | INTEGER | Target parts |
good_parts / scrap_parts / total_parts | INTEGER | Production counts |
status | VARCHAR(20) | running, completed, aborted |
abort_reason_id | UUID (FK) | References oee_abort_reasons |
scrap_reason_id | UUID (FK) | References oee_scrap_reasons |
Time Contribution Model
Jobs live at stations. Machines and people contribute hours towards jobs:
- Multiple machines can contribute time to the same job simultaneously
- Multiple people can contribute time to the same job simultaneously
- Machine time and person time are cumulative (additive)
- Example: 2 machines x 4 hours = 8 machine-hours; 3 people x 2 hours = 6 person-hours
See Job Time Tracking for the full cumulative time model.
Job Number Tracking Across Stations
Completing a job means finishing it at the current station. To track work as it moves through a process flow, jobs use job_number (stored as batch_number in oee_batch_details):
- A job exists at one station at a time
- When the same work moves to the next station, a new job event is created there with the same
job_number - Querying all jobs with a given
job_numberacross stations reveals the full journey of that work through the site
The job_number is how the system tracks how work has moved along the site, systems, and stations.
Codebase Paths
- Machine events table:
database/sql_scripts/tables/oee_machine_events.sql - Batch details table:
database/sql_scripts/tables/oee_batch_details.sql
Unified Time Tracking
OEE Jobs contribute to the cumulative time tracking model:
- Machine-hours and person-hours from contributors feed into the job’s total actual hours
- Multiple machines and/or multiple people can contribute time to the same job simultaneously
- This combined time is used for efficiency calculations
- Machine time feeds into cost calculations (machine-hours x machine hourly rate)
- Person time feeds into cost calculations (person-hours x labor rate)
See Job Time Tracking for the full cumulative time model.