MES Integration Layer — Overview & How to Use

Module: MES Integration Layer v1.0.0

What is MES Integration Layer?

Manufacturing Execution System integration layer for Perfex CRM — endpoints, event catalog, sync log, and manufacturing hooks

This module installs into modules/mes/ and adds its own admin menus, permissions, and database tables — without editing Perfex CRM core files.

Who should use this module?

  • Admins — activate the module, configure Settings, assign roles, and manage integrations.
  • Operators / day-to-day staff — create and update records (orders, attendance, shipments, messages, etc.).
  • Managers / approvers — review queues, approve workflows, and monitor dashboards/KPIs.
  • Finance / compliance / ops leads — run reports, exports, and audit trails when the module supports them.

What you can achieve

  • Keep all related work in one place inside Perfex CRM instead of spreadsheets.
  • Control who can view, create, edit, approve, or export with role permissions.
  • Use dashboards and reports to see status, bottlenecks, and history.
  • Connect to other CRM data (customers, invoices, items, staff) where the module integrates.

Recommended learning path

  1. Read How to Install and activate the module.
  2. Skim Features so you know what screens exist.
  3. Complete the Quick Start checklist on this page (Settings → masters → first sample record).
  4. Open each screen guide under Screen-by-screen guides when you need step-by-step help.
  5. Check Version & Changelog after upgrades for new options.

Tip: Train one admin first, then create a limited role for operators so they only see the screens they need.

5-minute Quick Start

Follow this short path the first time you use MES Integration Layer:

  1. Activate — Setup → Modules → activate MES Integration Layer (run Upgrade if prompted).
  2. Permissions — Setup → Staff → Roles → enable view/create/edit (and approve/settings if needed) for this module.
  3. Settings — Open MES Integration Layer → Settings and save company defaults, prefixes, and integrations.
  4. Master data — Create the first required masters (products, warehouses, templates, channels, accounts, routes, etc.).
  5. First transaction — Create one sample record end-to-end (save → submit/approve → complete) and confirm it appears in lists/reports.
  6. Cron — If the module uses alerts, sync, queues, or AI, confirm Perfex CRM cron is scheduled on the server.

Module documentation index

Start here — full guides for MES Integration Layer:

Screen-by-screen guides (each tab explained)

Click a menu item below for step-by-step instructions on that MES Integration Layer screen:

How to use in Perfex CRM (daily operations)

  1. Sign in to the admin area with a role that includes MES Integration Layer permissions.
  2. Open Mes (sidebar) or search for MES Integration Layer in the admin menu.
  3. Start on the Dashboard (if available) to see open tasks, pending approvals, and KPIs.
  4. Review Settings after upgrades — new options may need defaults for your company.
  5. Create or import master data first; most modules block transactions until masters exist.
  6. Run the main business flow (create → submit → approve → post/complete) using the screens listed in Admin menu below.
  7. Use Reports / Analytics screens to reconcile stock, finance, compliance, or SLA metrics.
  8. For integrations (API, EDI, gateways, tax), confirm credentials in Settings and monitor logs or webhook delivery screens.
  9. Train staff with role-based access — give approvers approve permissions only, operators create/edit on their area.
  10. If something fails overnight, check Perfex CRM cron ran and open the module log / failed queue screen if present.

Admin menu — where to work

Open the MES Integration Layer section in the admin sidebar. Screens your staff may use (depending on role):

  • API Keys
  • Event Routing
  • Field Mappings
  • Integration Dashboard
  • Integration Events
  • Integration Reports
  • MES
  • MES Endpoints
  • Outbound Webhooks
  • Settings

Screens map — what each menu is for

These are the admin screens registered by MES Integration Layer. Click a name in the Knowledge Base for a full how-to, or open the path in admin.

#ScreenAdmin pathGuide
1Integration Dashboardadmin/mesHow to use
2MES Endpointsadmin/mes/mes_endpointsHow to use
3Integration Eventsadmin/mes/mes_eventsHow to use
4Event Routingadmin/mes/mes_event_routesHow to use
5Field Mappingsadmin/mes/mes_field_mappingsHow to use
6Outbound Webhooksadmin/mes/mes_webhooksHow to use
7Integration Reportsadmin/mes/mes_reportsHow to use
8API Keysadmin/mes/mes_api_keysHow to use
9Settingsadmin/mes/mes_settingsHow to use

Detailed guide — features, workflows, API & FAQ

Features

  • MES Endpoints — REST, MQTT, OPC-UA, SOAP, Webhook, SFTP, Local
  • Event Dispatcher — Outbound with retry / exponential backoff
  • Inbound Webhook — Receive shop-floor events from external MES
  • REST API — API keys, scopes, rate limits
  • Outbound Webhooks — event.queued, event.processed, event.failed
  • Field Mapping — Transform payload fields per endpoint/event type
  • Event Routes — Route event types to endpoints
  • Integration Reports — SLA, error rates, archive stats
  • Credential Encryption — Secure endpoint secrets
  • Event Archive — Archive before retention purge
  • Dashboard — Stats, chart, recent events
  • Permissions — Role-based access
  • Clean Uninstall — Drops all module tables and options

Requirements

  • Perfex CRM 3.0+
  • PHP 7.4+ (8.1+ recommended)
  • MySQL 5.7+ / MariaDB 10.3+
  • Optional: Manufacturing / QMS / LIMS modules for advanced sync

2. Features

  • MES Endpoints — Connect external MES systems via REST, MQTT, OPC-UA, SOAP, Webhook, SFTP, or Local folder
  • Event Catalog — Built-in production, quality, maintenance, inventory, and IoT event types
  • Outbound Dispatcher — Queue and push events to configured endpoints with retry / backoff
  • Inbound Webhook — Receive shop-floor events (scans, QC results, downtime, lab results)
  • REST API — Authenticated API keys for reading endpoints/events and submitting events
  • Outbound Webhooks — Notify third-party systems on event.queued, event.processed, event.failed
  • Field Mapping — Transform payload fields per endpoint / event type
  • Event Routes — Route event types to specific endpoints (optional plant routing)
  • Integration Reports — Endpoint SLA, error rates, archive statistics
  • SFTP / Local Transport — File-based inbound/outbound with cron polling
  • Credential Encryption — Secure storage of endpoint secrets
  • Event Archive — Archive processed events before retention purge
  • Dashboard Widget — Integration stats and recent events
  • Role-based Permissions — Granular staff capabilities
  • Clean Uninstall — Removes all mes_* tables and options

3. How to Use

3.1 Configure Settings

  1. Go to MES Integration Layer → Settings.
  2. Enable integration, set default protocol, retention days, and dispatch options.
  3. Optionally enable REST API, outbound webhooks, SFTP/local poll, QMS/LIMS routing.
  4. Click Save.

3.2 Add an MES Endpoint

  1. Go to MES Endpoints → New.
  2. Enter endpoint code (e.g. MES-PLANT1), name, vendor, protocol, and direction.
  3. Fill protocol-specific config (URL, credentials, paths, topics, etc.).
  4. Mark as active and save.

3.3 Create Event Routes (optional)

  1. Go to Event Routes.
  2. Map an event type (e.g. Work Order Started) to an endpoint.
  3. Set priority and activate the route.

3.4 Field Mappings (optional)

  1. Go to Field Mappings.
  2. Choose endpoint (+ optional event type).
  3. Map source field → target field and optional transform.

3.5 View Integration Events

  1. Open Integration Events to review queued, processed, and failed events.
  2. Create a manual test event if needed.
  3. Use Reprocess on failed events (permission required).

3.6 Outbound Webhooks

  1. Go to Webhooks → New.
  2. Enter destination URL, secret, and selected events.
  3. Deliveries are logged under each webhook.

3.7 API Keys

  1. Go to API Keys (Settings permission).
  2. Create a key with read / write / read_write scope.
  3. Copy the token immediately — it is shown once.
  4. Use the token in the X-API-KEY (or configured) header against MES REST endpoints.

3.8 Reports

Open Reports for endpoint performance, failure rates, and archive stats.

4. Inbound Webhook Example

Enable inbound under Settings and use the webhook secret in the request header.

curl -X POST "https://your-domain.com/admin/mes/mes_webhook/receive" \
  -H "Content-Type: application/json" \
  -H "X-MES-Token: YOUR_WEBHOOK_SECRET" \
  -d '{
    "event_ref": "MES-EXT-1001",
    "event_code": "operation_scan",
    "payload": {
      "scan_code": "OP:123",
      "action": "start",
      "work_order_id": 10,
      "operation_id": 123
    }
  }'

Common inbound event codes: operation_scan, iot_reading_ingested, downtime_started, downtime_ended, qc_result, qc_failed, lab_result.

Exact admin/public URL path may vary with your Perfex rewrite / base URL. Check the module webhook controller route after install.

5. Permissions

Assign under Setup → Staff → Roles:

CapabilityPurpose
MES DashboardView dashboard / widget
MES EndpointsView / create / edit / delete endpoints
MES EventsView / create / edit / delete / reprocess events
MES Event RoutesManage routing rules
MES Field MappingsManage field transforms
MES WebhooksManage outbound webhooks
MES ReportsView integration reports
MES SettingsView / edit settings & API keys

6. Cron Jobs

Dispatch retries, SFTP/local polling, webhook delivery, and retention use Perfex CRM’s main cron.

* * * * * php /path/to/perfex/index.php cron/index >/dev/null 2>&1

Ensure cron is already configured for Perfex. No separate crontab entry is required for this module.

7. Uninstall

  1. Go to Setup → Modules.
  2. Deactivate MES Integration Layer.
  3. Click Uninstall.

Uninstall removes:

  • All database tables matching {db_prefix}mes_% (endpoints, events, routes, webhooks, API keys, archives, logs, etc.)
  • All options whose names start with mes_

Perfex core data (invoices, customers, manufacturing records outside MES tables) is not deleted.

After activation — configuration checklist

  1. Extract the purchase ZIP. You will find a folder named mes.
  2. Log in as admin → go to Setup → Modules.
  3. Find MES Integration Layer and click Activate.
  4. If Perfex shows Upgrade Database, click it (or reload admin once). Schema is created automatically.
  5. Assign staff permissions under Setup → Staff → Roles.
  6. Open the sidebar menu MES Integration Layer and configure Settings.
  7. Perfex CRM 3.0+ (compatible with current 3.x)
  8. PHP 7.4+ (8.1+ recommended)
  9. MySQL 5.7+ / MariaDB 10.3+ (InnoDB)
  10. PHP extensions: mysqli, json, mbstring, curl, fileinfo, openssl
  11. Optional: Manufacturing / QMS / LIMS / Multi-Plant modules for advanced sync features

Staff permissions (from module)

Assign under Setup → Staff → Roles. Each feature can expose different actions:

FeatureActions
Integration Dashboard
mes_dashboard
view
MES Endpoints
mes_endpoints
view, create, edit, delete
Integration Events
mes_events
view, create, edit, delete, reprocess
Settings
mes_settings
view, edit
Event Routing
mes_event_routes
view, create, edit, delete
Outbound Webhooks
mes_webhooks
view, create, edit, delete
Field Mappings
mes_field_mappings
view, create, edit, delete
Integration Reports
mes_reports
view

One-time setup (first time only)

  1. Setup → Modules → activate MES Integration Layer.
  2. Setup → Staff → Roles → assign MES Integration Layer permissions (view, create, edit, delete, approve, export, settings as needed).
  3. Open MES Integration Layer → Settings and complete company defaults, prefixes, integrations, and notification options.
  4. Create master data (warehouses, products, templates, accounts, routes, etc.) before processing live transactions.
  5. Enable Perfex CRM cron (php /path/to/perfex/index.php cron/index) for sync, retries, alerts, and scheduled jobs.
  6. Optionally enable REST API / webhooks in module settings if you integrate external systems.

Tips for success

  • Always configure Settings before creating live transactions.
  • Create master data (items, warehouses, templates, channels, accounts) first — most modules block incomplete records.
  • Use a test/sample record before going live with real customers or production stock.
  • Separate roles: operators create/edit; managers approve; finance/reporting get view/export only.
  • After any module upgrade, reopen Settings and confirm new options have sensible defaults.
  • If overnight jobs fail, verify Perfex CRM cron and check the module log / failed queue screen.

Common questions (FAQ)

Where do I find the module after activation?

In the admin sidebar look for MES Integration Layer. If missing, your role may lack view permission — fix under Setup → Staff → Roles.

Do I need to edit core Perfex CRM files?

No. Keep all custom code under modules/mes/. Activate/deactivate from Setup → Modules.

What happens if I uninstall?

Deactivate keeps data. Uninstall usually removes module tables/options (see the Install article). Core customers, invoices, and items are not deleted by well-built modules.

Why can't my staff see a screen?

Almost always a permissions issue. Give the role at least view on that feature, then ask the user to log out and back in.

Reports/export buttons do nothing

Confirm the role has export (or view reports) permission, and that filters return at least one row. Try PDF/CSV from a wider date range.


Perfex CRM Knowledge Base — detailed usage guide generated from module README, HOW_TO_USE, and documentation.

Did you find this article useful?