Kiến Trúc ERP/MES — Phân tích & Đề xuất 2026
Hoàn thành

Kiến Trúc ERP/MES
Phân tích & Đề xuất 2026

Phân tích toàn diện các lựa chọn kiến trúc phần mềm cho hệ thống ERP/MES, từ Modular Monolith đến Event-Driven + CQRS/ES, kèm theo đề xuất cụ thể dựa trên xu hướng công nghệ 2026.

Cập nhật: 22/07/2026
Sơ đồ: 7 Mermaid diagrams
Chuẩn: ISA-95 / IEC 62264
Nguồn: netlinkrg.com, kitrum.com, isa.org
01 — Tổng quan

ERP/MES là gì và tại sao kiến trúc quan trọng

ERP — Enterprise Resource Planning

  • Quản lý tài nguyên doanh nghiệp toàn diện
  • Finance, HR, Sales, Procurement
  • Kế hoạch sản xuất cấp cao (L4)
  • Báo cáo tài chính, compliance

MES — Manufacturing Execution System

  • Điều hành sản xuất theo thời gian thực
  • Production, Quality, Maintenance, Inventory
  • Tầng trung gian L3 trong ISA-95
  • Kết nối Shop Floor với ERP

Kiến trúc phân tầng ISA-95 (IEC 62264)

ISA-95 vẫn là chuẩn vàng năm 2026, định nghĩa 5 tầng từ thiết bị vật lý đến hệ thống kinh doanh. Toàn bộ giao tiếp giữa các tầng đều thông qua Event Bus thay vì polling XML truyền thống.

Sơ đồ 1 — ISA-95 Architecture Layers
flowchart TD L4["L4 — ERP Layer\nBusiness Planning\nFinance · HR · Sales · Procurement"] L3["L3 — MES Layer\nManufacturing Operations\nProduction · Quality · Maintenance · Inventory"] L2["L2 — SCADA / HMI\nMachine Monitoring · Process Control"] L1["L1 — Control Layer\nPLC · DCS · Motion Control"] L0["L0 — Field Level\nSensors · Actuators · Cameras"] L4 <-->|"Event Bus / REST API"| L3 L3 <-->|"OPC-UA / MQTT Bridge"| L2 L2 <-->|"Fieldbus / EtherNet/IP"| L1 L1 <-->|"4-20mA / IO-Link"| L0 style L4 fill:#1E1B4B,stroke:#6366F1,color:#E2E8F0,rx:8 style L3 fill:#052E16,stroke:#10B981,color:#E2E8F0,rx:8 style L2 fill:#1C1917,stroke:#78716C,color:#E2E8F0,rx:8 style L1 fill:#292524,stroke:#57534E,color:#D6D3D1,rx:8 style L0 fill:#1C1917,stroke:#44403C,color:#A8A29E,rx:8
🖱️ Kéo để di chuyển · Cuộn chuột để zoom · Pinch to zoom trên mobile
Tại sao kiến trúc quan trọng?

85%+ doanh nghiệp 2025 đã chuyển sang cloud-native. Kiến trúc sai có thể làm chậm tốc độ phát triển 3-5x và tăng chi phí vận hành lên đến 40%. Chọn đúng từ đầu tiết kiệm hàng năm refactoring.

02 — So sánh

So sánh các kiến trúc phần mềm

Ba kiến trúc phổ biến nhất cho ERP/MES, mỗi loại phù hợp với quy mô và giai đoạn khác nhau của dự án.

Tiêu chí Modular Monolith Microservices Event-Driven + CQRS/ES
Độ phức tạp Thấp Cao Cao
Tốc độ phát triển Nhanh Trung bình Trung bình
Khả năng scale Giới hạn Cao Cao
Audit / Traceability Hạn chế Trung bình Hoàn hảo
Transaction nhất quán ACID dễ Saga phức tạp Eventual
Phù hợp ISO/IATF Cần thêm công Cần thêm công Tự nhiên
Team size phù hợp 3–20 người 20+ người 10+ người
Chi phí vận hành Thấp Cao (K8s ops) Trung bình
Sơ đồ 2 — So sánh cấu trúc 3 kiến trúc
flowchart LR subgraph MM["Modular Monolith"] direction TB MA["Auth"] & MB["Production"] & MC["Quality"] & MD["Finance"] MDB[("Single PostgreSQL")] MA & MB & MC & MD --> MDB end subgraph MS["Microservices"] direction TB SA["Auth\n+DB"] & SB["Production\n+DB"] & SC["Quality\n+DB"] BUS[["Message Bus"]] SA & SB & SC <--> BUS end subgraph EDA["Event-Driven + CQRS/ES"] direction TB CMD["Commands"] --> AGG["Aggregates"] AGG --> EVS[("Event Store")] EVS --> KFK[["Kafka"]] KFK --> PROJ["Projections\nRead Models"] end style MM fill:#1E1B4B,stroke:#6366F1,color:#E2E8F0 style MS fill:#022C22,stroke:#10B981,color:#E2E8F0 style EDA fill:#431407,stroke:#F59E0B,color:#E2E8F0
🖱️ Kéo để di chuyển · Cuộn chuột để zoom
Xu hướng 2026: Pragmatic Hybrid

Theo nghiên cứu KITRUM 2026, các team thực chiến đang quay lại Modular Monolith vì microservices quá nhỏ gây overhead không cần thiết. Xu hướng là "Composable" — module hóa chặt chẽ, tách service khi có lý do cụ thể.

03 — Deep Dive

Event-Driven + CQRS / Event Sourcing

CQRS — Command Query Responsibility Segregation

Tách hoàn toàn ghi dữ liệu (Commands) và đọc dữ liệu (Queries), tối ưu độc lập cho từng nhu cầu.

Sơ đồ 3 — CQRS Flow
flowchart LR User(["User"]) --> CMD User --> QRY subgraph Write["Write Side — Command"] CMD["Command\nStartProduction"] --> CH["Command Handler\nValidate + Business Logic"] CH --> AGG["Aggregate\nDomain Object"] AGG --> ES_[("Event Store\nPostgreSQL")] end subgraph Read["Read Side — Query"] RM[("Read Model\nProjection DB")] --> QH["Query Handler"] QH --> QRY["Query\nGetDashboard"] end ES_ -->|"Domain Events"| Kafka[["⚡ Kafka"]] Kafka -->|"Projection Update"| RM style Write fill:#1E1B4B,stroke:#6366F1,color:#E2E8F0 style Read fill:#052E16,stroke:#10B981,color:#E2E8F0
🖱️ Kéo để di chuyển · Cuộn chuột để zoom

Event Sourcing — Lưu lịch sử thay vì trạng thái

Thay vì chỉ lưu trạng thái cuối cùng (status = "completed"), Event Sourcing lưu toàn bộ chuỗi sự kiện đã xảy ra. Trạng thái hiện tại = replay tất cả events từ đầu.

Sơ đồ 4 — Event Sourcing Timeline (Production Order #001)
flowchart LR E1["Event 1 — ProductionOrderCreated\n08:00 · qty:100, product:X"] --> E2["Event 2 — ProductionStarted\n09:15 · machine:M1, op:John"] --> E3["Event 3 — QualityCheckFailed\n11:30 · reason: dim sai"] --> E4["Event 4 — ReworkStarted\n12:00 · rework qty:5"] --> E5["Event 5 — ProductionCompleted\n15:00 · ok:95, scrap:5"] E5 --> SNAP["Snapshot @ Event 5\nStatus: completed\nqty_done: 95"] style E1 fill:#1E1B4B,stroke:#6366F1,color:#E2E8F0 style E2 fill:#052E16,stroke:#10B981,color:#E2E8F0 style E3 fill:#431407,stroke:#EF4444,color:#E2E8F0 style E4 fill:#292524,stroke:#78716C,color:#E2E8F0 style E5 fill:#052E16,stroke:#10B981,color:#E2E8F0 style SNAP fill:#0C2340,stroke:#06B6D4,color:#E2E8F0
🖱️ Kéo để di chuyển · Cuộn chuột để zoom

Sequence hoàn chỉnh — Production Order thực tế

Sơ đồ 5 — Sequence Diagram: Bắt đầu sản xuất
sequenceDiagram actor Op as Operator participant GW as API Gateway participant MES as MES Core participant EVS as Event Store participant KFK as Kafka participant INV as Inventory participant ERP as ERP Core Op->>GW: POST /production/orders/001/start GW->>MES: StartProductionCommand {orderId, machineId, operatorId} MES->>EVS: Load aggregate (replay events) EVS-->>MES: ProductionOrder state MES->>MES: Validate business rules Note over MES: NVL đủ? Máy rảnh?
Operator authorized? MES->>EVS: Append ProductionStarted event EVS-->>MES: OK MES->>KFK: Publish ProductionStarted MES-->>Op: 200 OK par Xử lý song song KFK->>INV: ProductionStarted INV->>INV: Lock raw materials KFK->>ERP: ProductionStarted ERP->>ERP: Update production dashboard end Note over INV,ERP: Eventual Consistency ~100ms
🖱️ Kéo để di chuyển · Cuộn chuột để zoom
Khi nào dùng Event Sourcing?

Chỉ áp dụng ES cho các aggregate có yêu cầu audit trail đầy đủ như Production Order, Quality Inspection, Maintenance Work Order. Không cần ES cho User profile, Config settings hay Master data thông thường.

05 — Technology

Tech Stack đề xuất

Layer Công nghệ Lý do chọn Thay thế
Backend Core .NET 9 hoặc Java Spring Boot 3 Ecosystem DDD/CQRS trưởng thành nhất, performance cao Go (cho service đơn giản)
Event Bus Apache Kafka De-facto standard EDA enterprise, throughput cao, retention vĩnh viễn RabbitMQ (ít phức tạp hơn)
Write DB PostgreSQL 17 ACID, JSON, Event Store schema, mature ecosystem EventStoreDB (dedicated ES)
Read DB / Cache PostgreSQL + Redis Projection tables + hot data cache, giảm latency MongoDB (flexible schema)
Search / Audit Elasticsearch Full-text search, audit log, traceability reports OpenSearch (free tier)
Sensor OEE PostgreSQL 17 Sensor readings + uptime events — RANGE partitioned monthly; OEE A×P×Q snapshots TimescaleDB (nếu cần >1M rows/day)
API REST + GraphQL REST cho Commands, GraphQL cho Query phức tạp nhiều join gRPC (internal service)
Real-time WebSocket / SSE Live dashboard MES, machine status real-time SignalR (.NET)
AI / Analytics Claude API + Python FastAPI LLM cho phân tích, FastAPI cho custom ML models Azure OpenAI, Vertex AI
Container / Infra Kubernetes + Docker 85%+ enterprise dùng K8s 2025, cloud-native standard Docker Compose (dev only)
Frontend React + Module Federation Micro-frontend, mỗi module độc lập deploy Vue, Angular
IoT Protocol OPC-UA + MQTT OPC-UA là chuẩn công nghiệp 2026, MQTT cho IoT nhẹ AMQP, Modbus (legacy)
Apache Kafka
Event Backbone
PostgreSQL 17
Event Store + Read DB
Redis
Cache + Hot Data
Elasticsearch
Audit + Search
Sensor OEE
Postgres Range-partitioned
Kubernetes
Container Orchestration
Claude API
AI Features
React
Micro-frontend
06 — Roadmap

Roadmap triển khai thực tế

Chiến lược 3 giai đoạn, bắt đầu từ nền tảng đơn giản và dần thêm độ phức tạp khi team và hệ thống trưởng thành.

Sơ đồ 7 — Roadmap Gantt Chart
gantt title Roadmap Triển Khai ERP/MES dateFormat YYYY-MM-DD axisFormat %m/%Y section Phase 1 — Foundation Modular Monolith Setup :p1a, 2026-07-01, 2026-09-30 Auth & IAM Module :p1b, 2026-08-01, 2026-10-31 Kafka Event Bus Setup :p1c, 2026-08-01, 2026-09-30 Production Order Module :p1d, 2026-09-01, 2026-11-30 Inventory Module :p1e, 2026-10-01, 2026-12-31 section Phase 2 — Expand Quality Inspection Module :p2a, 2026-12-01, 2027-02-28 Maintenance Module :p2b, 2027-01-01, 2027-03-31 Event Sourcing Integration :p2c, 2027-02-01, 2027-04-30 Read Model & Projections :p2d, 2027-03-01, 2027-05-31 Real-time Dashboard :p2e, 2027-04-01, 2027-05-31 section Phase 3 — Intelligent IT/OT Bridge & IoT :p3a, 2027-05-01, 2027-07-31 AI Anomaly Detection :p3b, 2027-06-01, 2027-08-31 Predictive Maintenance :p3c, 2027-07-01, 2027-09-30 Multi-plant Support :p3d, 2027-09-01, 2027-12-31
🖱️ Kéo để di chuyển · Cuộn chuột để zoom
Phase 1 Foundation — Nền tảng vững chắc Tháng 1–6
✅ Modular Monolith ✅ Auth / IAM ✅ Kafka setup ✅ Production Order ✅ Inventory cơ bản ✅ CQRS per module
Phase 2 Expand — Mở rộng nghiệp vụ Tháng 6–12
✅ Quality Module ✅ Maintenance Module ✅ Event Sourcing (Production) ✅ Read Model / Projections ✅ Real-time Dashboard
Phase 3 Intelligent — Thông minh hóa Tháng 12–18
✅ IT/OT Bridge ✅ IoT / OPC-UA ✅ AI Anomaly Detection ✅ Predictive Maintenance ✅ Multi-plant ✅ Multi-tenant
07 — Anti-patterns

Những gì KHÔNG nên làm

Bài học từ thực tế triển khai ERP/MES năm 2025 — những lỗi phổ biến nhất khiến dự án thất bại hoặc tốn kém refactoring.

Bắt đầu với Microservices
Team nhỏ bắt đầu với 20+ microservices gây overhead vận hành khổng lồ. Distributed tracing, service mesh, inter-service auth — quá nhiều complexity từ ngày đầu.
Kafka cho mọi thứ
Không phải mọi message đều cần Kafka. Các domain event đơn giản, in-process notification dùng PostgreSQL LISTEN/NOTIFY hoặc in-memory event bus là đủ và đơn giản hơn nhiều.
Event Source toàn bộ
ES rất phù hợp cho Production Order và Quality Record, nhưng áp dụng cho User profile, config settings hay master data là over-engineering. Replay 10,000 events chỉ để lấy tên user là sai.
Bỏ qua IT/OT Convergence
MES mà không tích hợp shop floor thực tế chỉ là ERP thêm module. Thiếu IoT Gateway dẫn đến việc nhập liệu thủ công, mất lợi thế real-time và automation.
Vendor Lock-in
Chọn platform độc quyền (SAP all-in, Oracle ERP + MES) làm mất tính linh hoạt. Xu hướng 2026 là Composable — open API, mix-and-match modules từ nhiều vendor.
Bỏ qua Snapshot
Event Sourcing mà không có Snapshot strategy — sau 6 tháng, mỗi lần load Production Order phải replay 50,000+ events. Latency tăng đột biến, system không usable.
Nguyên tắc vàng — Evolve, don't design upfront

Bắt đầu đơn giản nhất có thể hoạt động (Modular Monolith + CQRS + Kafka). Đo lường thực tế. Chỉ thêm complexity khi có pain point rõ ràng và đã được chứng minh bằng data. Ba similar lines are better than a premature abstraction.

Tài liệu này là một phần của

ERP/MES Knowledge Base

Cập nhật: 22/07/2026 · Nguồn: ISA-95, microservices.io, conduktor.io, netlinkrg.com, kitrum.com

← Về trang chủ