Skip to content

1.6 ERP-MES contract: orders, confirmations, consumption, scrap, WIP

The interface between ERP (Enterprise Resource Planning) and MES (Manufacturing Execution System) is not merely a data pipe; it is a binding contract between Finance and Operations. If the ERP believes you have 100 units of raw material, but the MES has practically consumed 105, your Balance Sheet is fiction. Design this interface to be transactional, idempotent, and resilient to network partitions.

Do not tightly couple these systems. ERP is the “Architect” (Planning); MES is the “Builder” (Execution).

  • ERP Responsibility: Defines What to build, When to build it, and How Many (Demand).
  • MES Responsibility: Enforces How it is built and reports Actuals (Execution).
  • When the required Master Data (like a BOM or Routing) is missing from the MES, the system should reject the Work Order (WO). Producing a generic product without complete definition introduces risk and inaccuracies.
  • When the ERP sends a “Force Close” command on an active Work Order, the MES should allow the currently active unit to gracefully finish its operation at the Quality Gate before terminating the run.

Define strict schemas for every transaction. Ambiguous fields lead to inventory drift.

Downstream: work order management (ERP → MES)

Section titled “Downstream: work order management (ERP → MES)”

Work Order Create

  • Trigger: Planner releases order in ERP.
  • Payload: WO_ID, Part_Number, Revision, Qty_Target, Scheduled_Start, Priority.
  • Constraint: The WO_ID must be globally unique. If WO_ID exists, treat as an idempotent update (or reject based on status).

Work Order Change

  • Trigger: A requested increase or decrease in quantity, or a shift in the delivery date.
  • Logic:
    • When the newly requested quantity is less than the quantity already produced, the system must reject the update. Tracking requires accurate accounting of physical products already built.
    • When the Work Order status is currently “Running” on the floor, the system should notify the Supervisor to review and manage the change gracefully without disrupting the line.

Work Order Close

  • Trigger: Short-close or cancellation.
  • Action: MES releases reserved material allocations back to General Inventory.

Upstream: execution feedback (MES → ERP)

Section titled “Upstream: execution feedback (MES → ERP)”

Material Issue (Consumption)

  • Trigger: Component mounted or batch consumed.
  • Payload: WO_ID, Component_Part, Lot_Number, Qty_Consumed, UoM.
  • Strategy: Use Micro-Batching (e.g. every 15 mins or every 50 units). Real-time 1:1 transaction reporting often creates “Row Locking” issues in the ERP database.

Production Completion (Good Receipts)

  • Trigger: Unit passes Final Quality Gate.
  • Payload: WO_ID, Parent_Part, Serial_Number, Qty_Good, Location_ID.
  • Impact: Increases Finished Goods (FG) inventory in ERP.

Non-Conformance & Scrap

  • Trigger: Unit fails and cannot be reworked.
  • Payload: WO_ID, Component_Part, Reason_Code, Cost_Center.
  • Impact: Triggers financial write-off. Pro-Tip: Map MES “Defect Codes” (technical) to ERP “Reason Codes” (financial) in a lookup table.

Genealogy / As-Built Record

  • Trigger: WO Close.
  • Payload: Do not send the full trace tree to ERP (it cannot handle the volume). Send a Summary Link (URL) or a PDF reference to the compliance record stored in the MES/Historian.

Networks fail. APIs timeout. Design for failure to prevent data loss.

Every transactional message must carry a unique Transaction_UUID.

  • Scenario: The MES transmits a “Consumption: 50 units” message. A network timeout occurs, and the MES retries the transmission.
  • Without Idempotency: The ERP might process both messages and deduct 100 units.
  • With Idempotency: The ERP detects the duplicate UUID, ignores the second payload, and simply returns a “Success (Cached)” response.

Messages are important records and should not be discarded, even when they fail. When a message fails validation (for example, “Part Number Not Found”):

  1. Move the message to the DLQ.
  2. Alert the IT Support team.
  3. Hold any dependent transactions to preserve the sequence of events.
  4. Initiate a Retry mechanism using an Exponential Backoff strategy (e.g. 30s, 1m, 5m, 1h).

Running solely on event triggers is risky. Implement a “State of the Union” sync.

  • Frequency: Nightly (scheduled during periods of low system load).
  • Logic: The system compares the WIP balance in the ERP against the physical WIP balance recorded in the MES.
  • Action: When the variance exceeds the defined threshold, the system should automatically create an Adjustment Journal and flag the discrepancy for an audit.

Final Checkout: ERP-MES contract: orders, confirmations, consumption, scrap, WIP

Section titled “Final Checkout: ERP-MES contract: orders, confirmations, consumption, scrap, WIP”
CategoryMetric / ControlThreshold / Rule
IntegrityIdempotencyAll APIs require Transaction_UUID header
PerformanceBatchingMaterial Consumption micro-batched (5–15 min)
LogicValidationsBlock “Create WO” if Master Data is missing
InventoryNegative StockERP must reject consumption if Stock < 0 (Configurable)
ErrorsDLQ MonitoringAlert if DLQ depth > 10 messages
DriftReconciliationAuto-report variances > 1% daily
GenealogyStorageERP holds the Link; MES holds the Tree