Detailed architecture of a Manufacturing Execution System (MES) showing OT, Edge, IT (.NET 8 backend), and UI layers, including data flow.
graph TD
%% --- 樣式定義 (Styles) ---
classDef hardware fill:#E1F5FE,stroke:#01579B,stroke-width:2px,color:#01579B;
classDef edge fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px,color:#F57F17;
classDef backend fill:#F3E5F5,stroke:#7B1FA2,stroke-width:2px,color:#4A148C;
classDef database fill:#E0F2F1,stroke:#00695C,stroke-width:2px,shape:cylinder,color:#004D40;
classDef frontend fill:#FFF3E0,stroke:#E65100,stroke-width:2px,color:#BF360C;
classDef domain fill:#FCE4EC,stroke:#C2185B,stroke-width:1px,stroke-dasharray: 5 5,color:#880E4F;
%% --- 1. OT 層: 現場設備 ---
subgraph OT_Layer ["OT Layer: 現場設備"]
direction TB
Eq1[機台 SMT-01]:::hardware
Eq2[機台 AOI-01]:::hardware
Eq3[機台 Reflow-01]:::hardware
end
%% --- 2. Edge 層: 數據採集 ---
subgraph Edge_Layer ["Edge Layer: 邊緣運算"]
Gateway["IoT Gateway / Python Simulator"]:::edge
end
%% --- 3. IT 層: MES 核心系統 (.NET 8) ---
%% 修正處:這裡加上了雙引號 "..."
subgraph IT_Layer ["IT Layer: Backend Core (.NET 8)"]
direction TB
%% API 入口
API["Web API Controllers<br>Authorization / Routing"]:::backend
%% 商業邏輯
Service["Application Services<br>Business Logic"]:::backend
%% 領域實體
Domain(["Domain Entities<br>Validation / Models"]):::domain
%% 資料存取
Repo["Repository Layer<br>Data Access / Abstraction"]:::backend
%% 外部資料庫
DB[("SQL Server / Database")]:::database
end
%% --- 4. UI 層: 呈現 ---
subgraph UI_Layer ["UI Layer: 戰情室"]
Dashboard["Web Dashboard<br>(React/Vue/HTML)"]:::frontend
end
%% --- 數據流向 (Data Flow) ---
%% OT to Edge
Eq1 & Eq2 & Eq3 --> |感測訊號 / PLC| Gateway
%% Edge to IT (Telemetry)
Gateway -- "HTTP PATCH / MQTT<br>(Telemetry Data)" --> API
%% UI to IT (User Actions)
Dashboard <--> |"REST API (HTTPS)<br>JWT Auth"| API
%% Backend Internal Flow
API --> |Injects| Service
Service --> |Injects| Repo
Repo --> |EF Core / Dapper| DB
%% Domain Interaction
Service -.-> |Validates| Domain
Repo -.-> |Maps to| Domain
%% Legend / Note
linkStyle default stroke:#333,stroke-width:1px;
This diagram illustrates a multi-layered Manufacturing Execution System (MES) architecture. It details the operational technology (OT) layer with machines, an Edge layer for data collection via an IoT Gateway, an IT layer powered by a .NET 8 backend (Web API, Application Services, Repository, Domain Entities), and a UI layer for the web dashboard. It also shows the data flow between these layers, including sensor data, MQTT/HTTP telemetry, and REST API interactions.
Use this diagram when designing or documenting an MES system, an industrial IoT solution, or any multi-layered enterprise application requiring data acquisition from physical devices. It's suitable for explaining the separation of concerns across OT, Edge, and IT environments and demonstrating data flow from hardware to user interfaces.
This architecture can be adapted by swapping specific technologies, such as replacing SQL Server with PostgreSQL or NoSQL, changing the IoT Gateway implementation (e.g., specific protocols like OPC UA, Modbus), or using a different frontend framework. The .NET 8 backend can be extended with microservices for scalability. The OT layer can integrate various industrial communication protocols. The domain layer can be enriched with more complex business rules and entities.