Batches

oee batch production

A batch is a production run on a piece of equipment. Every batch is linked to a product and tracked as a job event in oee_machine_events with details in oee_batch_details.

Starting a Batch

To start a batch, the operator selects an equipment node on the Process Flow and chooses “Start Batch.” Required and optional fields:

FieldRequiredDescription
ProductYesDropdown of active products for the site
Target QuantityNoAuto-populated from product.default_quantity; operator can override
Work OrderNoFree-text reference to external work order
Batch NumberNoAuto-generated sequentially, or manual entry
Start TimeNoDefaults to now; can be backdated

Target Quantity Fallback Chain

When target quantity is not explicitly provided:

  1. product.default_quantity (from the selected product’s configuration)
  2. equipment.default_target_quantity (from the equipment’s settings)
  3. NULL (no target set)

Batch Lifecycle

stateDiagram-v2
    [*] --> running: Start Batch
    running --> completed: Complete Batch
    running --> aborted: Abort Batch
    completed --> resolved: Routed to next station
StateTriggerRecords
runningOperator starts batchstart_ts, product_id, target_quantity
completedOperator completes batchend_ts, good_parts, scrap_parts, total_parts
abortedOperator aborts batchend_ts, abort_reason_id, partial counts
resolvedBatch started at next stationme.resolved = TRUE — batch disappears from source station

Display Status on Process Flow

On the Process Flow, batch-items derive their display status from actual data rather than the stored bd.status column. See Batch Status on Process Flow for the full derivation logic, click behavior, and routing flow.

Completing a Batch

The operator records:

  • Good parts — parts that passed quality checks
  • Scrap parts — parts that failed (categorized by Scrap Reason)
  • Total parts — calculated as good + scrap

Aborting a Batch

Requires selecting an abort reason (from the Abort taxonomy). Aborted batches are excluded from Quality calculations but included in Availability and Performance.

Product Info Across the UI

Product information propagates throughout the application wherever batches are displayed:

LocationWhat’s Shown
Event Log tableProduct column (code + name) for batch events
Batch History pageProduct name column
Process FlowBatch badges show product code/name
Production Line cardsProduct info on equipment cards
CSV Exportproduct_name and product_code columns
View/Edit Event modalsProduct displayed (editable in inline edit mode)
Batch History TimelineProduct info in timeline tooltips

Database

oee_machine_events (primary record)

Standard event fields: id, organization_id, site_id, machine_id, event_type = 'job', start_ts, end_ts, duration_minutes, notes, created_by, completed_by.

oee_batch_details (detail record)

ColumnTypeDescription
idUUIDPK
event_idUUIDFK to oee_machine_events
batch_numberVARCHARAuto-generated or manual
work_orderVARCHARExternal reference
product_idUUIDFK to ops_products (required)
target_quantityINTEGERTarget production count
good_partsINTEGERParts passing QC
scrap_partsINTEGERParts failing QC
total_partsINTEGERgood + scrap
statusVARCHARrunning, completed, aborted
abort_reason_idUUIDFK to abort reasons (if aborted)
scrap_reason_idUUIDFK to scrap reasons

See Also