Skip to main content

1.6 ERP-MES Contract: Orders, confirmations, consumption, scrap, WIP

The interface between ERP (Enterprise Resource Planning) and MES (Manufacturing Execution System) is thenot financialmerely a data pipe; it is a binding contract between Finance and operationalOperations. equatorIf the ERP believes you have 100 units of raw material, but the factory.MES Ifhas physically consumed 105, your Balance Sheet is fiction. Design this datainterface contractto fails,be transactional, idempotent, and resilient to network partitions.

The Architecture of Trust

Do not tightly couple these systems. ERP is the company either ships products it cannot bill or builds products it does not need. Define this integration with strict transactional logic, not vague synchronization promises.

Production Orders"Architect" (Planning); MES is the "Builder" (Execution).

  • ERP Responsibility: MES)

The ERP dictatesDefines whatWhat to build, When to build it, and when.How The MES executes how. Do not allow the MES to create production orders autonomously; it must remain a slave to the ERP planning engine.

Download Triggers

  • Trigger:Many Order Status change to "Released" in ERP.(Demand).
  • Frequency:MES Responsibility: Real-timeEnforces How it is built and reports Actuals (Webhook) or near real-time (Polling ≤ 15 mins)Execution).

Validation Logic

Upon receiving an order, the MES must perform a "Sanity Check" before accepting it.

  • If SKU does not exist in MES Master Data → Reject Order + Alert Planning.
  • If Required BOM components are obsolete/blocked → Hold Order.
  • If Order Qty > 0 AND Due Date ≥ Today → Accept & Schedule.

Pro-Tip: Never update an active order's quantity in the ERP while it is running in the MES. Instead, close the original order and issue a new "Child Order" for the delta. This preserves traceability.

Confirmations & WIP Updates (MES → ERP)

The MES must report progress back to the ERP to keep financial accounts accurate. Balance the granularity of reporting against system load.

Reporting Granularity

  • Milestone Reporting: Report only at key financial gateways (e.g., SMT Complete, Box Build Complete, Shipping).
  • Step-by-Step Reporting: Report every barcode scan.
    • Decision: Use Milestone Reporting. Step-by-step floods the ERP with noise and creates locking issues during high-volume production.

ConfirmationSynchronization Logic

  • If OperationMaster = "Critical Gateway"Data (e.g.,BOM/Route) Enddoes ofnot Line)exist in MESTriggerThen ERPReject ConfirmationWork Order (WO) immediately. (Never accept an order for a ghost product).
  • If ERP APIsends isa down"Force Close" on a WOQueueThen MessageMES locallymust (Store & Forward). Never stopfinish the lineactive becauseunit SAPat isthe patching.Quality Gate before terminating the run.

MaterialMessage ConsumptionContracts: (BackflushThe vs.Data Discrete)Handshake

InventoryDefine accuracystrict dependsschemas onfor whenevery andtransaction. howAmbiguous youfields deductlead components.to inventory drift.

StrategyDownstream: A:Work BackflushingOrder Management (Standard)ERP → MES)

DeductWork componentsOrder automaticallyCreate

  • 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 thestatus).
BOM

Work whenOrder the parent assembly is confirmed.Change

  • Use Case:Trigger: HighQty volume,increase/decrease lowor costDate components (Resistors, Screws).shift.
  • Risk: Implicitly assumes 100% yield. If you scrap a unit but don't record it, inventory drifts.

Strategy B: Discrete Issue (Real-Time)

Deduct components exactly when scanned/loaded onto the machine.

  • Use Case: High value, serialized components (CPU, PCBA, Displays).
  • Control:Logic:
    • If MaterialNew_Qty is< "Class A" (High Value)Qty_ProducedRequireReject DiscreteUpdate. Issue(You cannot un-make physical products).
    • If MaterialStatus is= "Bulk"Running"SetNotify Supervisor to Backflush.acknowledge the change.

Scrap & Non-Conformance

Scrap is money on fire. The digital system must record the burn immediately to trigger replacement orders and financial write-offs.

ScrapWork WorkflowsOrder Close

    • Material Scrap:Trigger: ComponentShort-close damagedor during assembly.cancellation.
      • Action: OperatorMES selectsreleases reasonreserved codematerial onallocations HMIback to General Inventory.

      Upstream: Execution Feedback (MESMESERP)

      deducts component from WIP → MES sends "Goods

      Material Issue to(Consumption)

      Scrap"
      • Trigger: movementComponent tomounted 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

      • Assembly Scrap:Trigger: Entire unitUnit fails and cannot be repaired.reworked.
        • Action:Payload: SupervisorWO_ID, authorizesComponent_Part, scrapReason_Code, → MES consumes all child parts → MES closes specific serial number as "Scrapped" → ERP reduces Production Order open quantity.Cost_Center.
  • Impact:

    Triggers financial write-off. Pro-Tip: Map every MES defect"Defect codeCodes" (technical) to ERP "Reason Codes" (financial) in a specificlookup GLtable.

  • Genealogy / As-Built Record

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

    Error Fault"Strategy goes& Resilience

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

    Idempotency Keys

    Every transactional message must carry a differentunique accountTransaction_UUID.

    than
    • Scenario: MES sends "OperatorConsumption: Error.50 units". Network times out. MES retries.
    • Without Idempotency: ERP deducts 100 units.
    • With Idempotency: ERP sees the same UUID, ignores the second payload, and returns "Success (Cached)".

    The Dead-Letter Queue (DLQ)

    Never discard a failed message. If a message fails validation (e.g., "Part Number Not Found"):

    1. Move message to DLQ.
    2. Alert IT Support.
    3. Hold dependent transactions (preserve sequence).
    4. Retry mechanism (Exponential Backoff: 30s, 1m, 5m, 1h).

    Reconciliation Jobs (The Safety Net)

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

    • Frequency: Nightly (during low load).
    • Logic: Compare ERP.WIP_Balance vs MES.WIP_Balance.
    • If Variance > Threshold → Create Adjustment Journal and flag for audit.

    Final Checklist

    Category

    Metric / Control

    Threshold / Rule

    OrdersIntegrity

    Idempotency

    All APIs require Transaction_UUID header

    Performance

    Batching

    Material Consumption micro-batched (5–15 min)

    Logic

    Validations

    Block "Create WO" if Master Data is missing

    Inventory

    Negative Stock

    ERP ismust thereject onlyconsumption sourceif ofStock Production< Orders0 (Configurable)

    SyncErrors

    LatencyDLQ Monitoring

    Alert if DLQ depth > 10 messages

    Drift

    Reconciliation

    Auto-report variances > 1% daily

    Genealogy

    Storage

    ERP holds the Link; MES Orderholds syncthe ≤ 10 mins

    Consumption

    High Value Parts

    Deduct in Real-Time (Discrete Issue)

    Consumption

    Bulk Parts

    Backflush at Key Milestones

    Financial

    WIP Accuracy

    MES WIP = ERP WIP (Daily Reconciliation)

    Failure

    API Downtime

    Store & Forward enabled (No Line Stop)

    Scrap

    Authorization

    Supervisor password required for Unit ScrapTree