Shop Floor Control and MES Integration
Where the plan meets the machines. This is the boundary between ERP time (hours and days) and factory time (seconds and milliseconds).
The ISA-95 model
The standard vocabulary for the whole ERP↔factory boundary. Learn it — every integration conversation uses these level numbers.
Level 4 ERP / Business planning and logistics
Orders, materials, costs, months–days
▲ production orders down │ confirmations up
▼
Level 3 MES / MOM — Manufacturing Operations Management
Dispatching, execution, tracking, quality, days–hours
▲ │
▼
Level 2 SCADA / HMI — supervisory control, seconds
▲ │
▼
Level 1 PLC / DCS — sensing and manipulating, milliseconds
▲ │
▼
Level 0 The physical process — machines, sensors, actuators
The rule: never let an ERP talk directly to Level 1. ERPs are not real-time systems, and a PLC cannot wait for a database transaction. Level 3 is the buffer that translates between the two worlds.
What ERP sends down
| Data | Purpose |
|---|---|
| Production/process order | What to make, how much, when |
| BOM components and quantities | What to consume |
| Routing/recipe operations | The steps |
| Work centre / resource assignment | Where |
| Quality inspection plan | What to check |
| Batch and serial requirements | Traceability |
| Documents | Drawings, work instructions, SOPs |
| Priority and sequence | What to run first |
What MES sends back
| Data | Purpose |
|---|---|
| Operation start/finish | Progress and actual times |
| Yield and scrap quantities | Confirmation |
| Scrap reason codes | Analysis |
| Actual material consumption | Real, not backflushed |
| Batch/serial genealogy | Traceability |
| Labour time by operator | Cost and payroll |
| Machine downtime and reason | OEE |
| Quality results | Inspection lot results |
| Process values | Temperature, pressure, cycle time — for batch records |
The integration contract
ERP ──▶ MES: ProductionOrderDownload (create/change/cancel/release)
MaterialMasterSync
BOMSync, RoutingSync
MES ──▶ ERP: OperationConfirmation (yield, scrap, times)
MaterialConsumption
GoodsReceipt
DowntimeEvent
QualityResult
Rules for this integration
- Idempotency on every message. Factory networks drop; MES retries. A duplicated confirmation posts duplicate cost and duplicate consumption.
- MES must run offline. The factory does not stop because the ERP is being patched. Queue confirmations locally and replay in order.
- Order of operations matters on replay. Confirmation for op 20 before op 10 must either be accepted or explicitly rejected — decide which.
- Reconcile daily. MES-reported quantities vs ERP-posted quantities, per order. Publish the differences every morning.
- The ERP owns the financial posting. MES confirms physical facts; ERP books cost and inventory.
- Version the message contract. MES upgrades and ERP upgrades happen on different schedules.
- Backpressure. A high-speed line can generate confirmations faster than the ERP can post them. Aggregate at the MES (confirm per hour, not per unit) rather than melting the ERP.
When you need an MES
| Signal | Verdict |
|---|---|
| Operators confirm on paper, entered once a day | ERP alone may do |
| You need real-time WIP visibility | MES |
| Machine data collection / OEE | MES |
| Electronic batch records (pharma) | MES, mandatory |
| Complex routing with dynamic dispatching | MES |
| Detailed labour tracking per operator | MES |
| Quality data collected at each operation | MES |
| Paperless factory / 21 CFR Part 11 | MES |
Many mid-size manufacturers run ERP-only shop floor control with tablets for confirmation. That’s a legitimate choice, and often the right one.
Data collection methods
| Method | Notes |
|---|---|
| Barcode scanning | Cheapest, most reliable, still the default |
| RFID | No line of sight, bulk reading |
| Touchscreen terminals | Confirmations, downtime reasons, quality |
| Direct machine interface | OPC UA, MQTT, Modbus — counts, cycle times, alarms |
| IoT sensors | Temperature, vibration, energy |
| Vision systems | Automated inspection |
| Manual entry | Last resort, and the least accurate |
OPC UA is the dominant industrial interoperability standard for machine data; MQTT with Sparkplug B is common for lightweight IIoT telemetry. If your integration touches machines, these two names will come up.
Downtime tracking and OEE
downtime_event(
id, work_center_id, start_time, end_time,
category, -- PLANNED | UNPLANNED
reason_code, -- BREAKDOWN | CHANGEOVER | NO_MATERIAL | NO_OPERATOR
-- QUALITY_ISSUE | MAINTENANCE | BREAK | NO_ORDER
sub_reason, machine_code, comment,
operator_id, order_id
)
Reason codes are the whole value. “The line was down 4 hours” is useless. “Down 4 hours: 2.5h waiting for material, 1h changeover, 0.5h breakdown” is an action plan — and it says the fix is in the warehouse, not in maintenance.
OEE calculation is covered in Manufacturing Types. The critical design point: you cannot compute OEE without downtime reasons. Capture them from the start.
Electronic batch records (pharma/food)
Regulated process industries need a complete, signed record of every batch:
- Every material lot consumed, with its own certificate of analysis
- Every process parameter with timestamps (temperature profile, mixing time, pH)
- Every operator action, with electronic signature
- Every deviation, with investigation and disposition
- Equipment used and its calibration/cleaning status
- Final QA release signature
Review by exception is the modern approach: rather than a human reading a 400-page batch record, the system flags only the parameters that went out of specification. It’s what makes electronic batch records economically viable, and it’s a real design requirement — you must define acceptable ranges for every recorded parameter.
Regulatory frame: 21 CFR Part 11, EU GMP Annex 11, GAMP 5 for validation. Systems in this space are validated, meaning a documented IQ/OQ/PQ exercise, change control on every deployment, and no untested hotfixes. Plan your release process accordingly.
Andon and visual management
- Andon — an operator signals a problem; the line stops and help is summoned. Digital andon routes the alert by reason and escalates on a timer.
- Digital shop-floor boards — real-time output vs plan, quality, downtime
- Takt indicators — are we on pace?
Small builds, disproportionate operational value. A digital andon board that shows current output vs target is frequently the most-loved thing a developer delivers on a manufacturing project.
Labour tracking
labour_confirmation(
operator_id, order_id, operation_number,
activity_type, start_time, end_time, duration,
quantity_produced, indirect_reason
)
Complications:
- One operator, several machines — how do you split the time?
- Several operators, one operation — team confirmations
- Indirect time — cleaning, meetings, training, waiting. Charged to a cost centre, not an order
- Payroll linkage — attendance vs order-confirmed time must reconcile, and the gap is “indirect”
Be careful here. Labour tracking is individual performance monitoring. In many jurisdictions it requires works-council agreement or employee consultation, and in the EU it engages GDPR. Design it with the ability to aggregate and anonymise, and involve HR before you build it.
Maintenance integration (EAM/PM)
Production and maintenance compete for the same machines:
- Preventive maintenance consumes capacity and must be in the schedule, not a surprise
- Breakdown creates an unplanned maintenance order and blocks the work centre
- Condition-based / predictive uses IoT sensor data to trigger maintenance before failure
- Maintenance orders consume spare parts from inventory and labour from technicians
The ERP must model machine availability as the intersection of production shifts and maintenance windows. Planning production into a scheduled maintenance slot is a common and avoidable error.
Developer checklist
- Every MES→ERP message has an idempotency key
- MES can queue and replay when the ERP is unavailable
- Confirmation reversal is supported end to end
- Downtime reason codes are mandatory and hierarchical
- Daily MES↔ERP quantity reconciliation report
- Confirmation UI is <3 taps for the common case
- Aggregate high-frequency confirmations before sending
- Message contract is versioned
- Labour data handling reviewed for privacy/works-council requirements
- For regulated industries: audit trail, e-signature, and a validation plan before you write code