# digital-mes
**Repository Path**: meoneko/digital-mes
## Basic Information
- **Project Name**: digital-mes
- **Description**: 基于 .NET 构建的 MES 系统服务端。
- **Primary Language**: C#
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 7
- **Created**: 2025-05-26
- **Last Updated**: 2025-05-26
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# digital-mes
## 介绍
基于 .NET9 构建的产线级 MES 系统服务端。
系统内部集成了 [ThingsEdge.Exchange](https://www.nuget.org/packages/ThingsEdge.Exchange) 通信驱动,可以主流的 PLC 设备进行数据交互,更多配置信息参考 [OpenThingsEdge](https://github.com/mickeygo/OpenThingsEdge)。
Web 前端配套系统:[digital-mes-web](https://gitee.com/industry-digital-lab/digital-mes-web)。
桌面端系统:[digital-mes-desktop](https://gitee.com/industry-digital-lab/digital-mes-desktop)。
## 目前系统功能模块
* 系统管理
* 基础数据
* 设备管理
* 工艺管理
* 生产管理
* 质量管理
* 数据追溯
## 数据采集配置
```JSON
[
{
"Name": "Line01", "Keynote": "",
"Devices": [
{
"Name": "Dev01", "Model": "ModbusTcp", "Host": "127.0.0.1", "Port": 0, "Keynote": "",
"Tags": [
{ "Name": "PLC_Device_Heartbeat", "Address": "s=1;x=3;0", "Length": 0, "DataType": "Int", "ScanRate": 500, "Flag": "Heartbeat" },
{ "Name": "PLC_Equipment_Alarm", "Address": "s=1;x=3;1", "Length": 96, "DataType": "Int", "ScanRate": 5000, "Flag": "Notice" },
{ "Name": "PLC_Equipment_Energy", "Address": "s=1;x=3;1", "Length": 0, "DataType": "Int", "ScanRate": 60000, "Flag": "Notice", "PublishMode": "EveryScan" },
{ "Name": "PLC_Equipment_State", "Address": "s=1;x=3;60", "Length": 0, "DataType": "Int", "ScanRate": 1000, "Flag": "Notice" },
{ "Name": "PLC_Equipment_Mode", "Address": "s=1;x=3;60", "Length": 0, "DataType": "Int", "ScanRate": 1000, "Flag": "Notice" },
],
"CallbackTags": [
{ "Name": "MES_Callback_ErrorMessage", "Address": "s=1;x=3;460", "Length": 30, "DataType": "String" },
],
"TagGroups": [
{
"Name": "OP110", "Keynote": "",
"Tags": [
{
{ "Name": "PLC_Workstation_Andon", "Address": "s=1;x=3;60", "Length": 0, "DataType": "Int", "ScanRate": 1000, "Flag": "Notice" },
},
{
"Name": "PLC_Inbound_Sign", "Address": "s=1;x=3;20", "Length": 0, "DataType": "Int", "ScanRate": 500, "Flag": "Trigger",
"NormalTags": [
{ "Name": "PLC_Inbound_SN", "Address": "s=1;x=3;112", "Length": 50, "DataType": "String" },
{ "Name": "PLC_Inbound_ProductCode", "Address": "s=1;x=3;132", "Length": 20, "DataType": "String" },
],
},
{
"Name": "PLC_Outbound_Sign", "Address": "s=1;x=3;30", "Length": 0, "DataType": "Int", "ScanRate": 500, "Flag": "Trigger",
"NormalTags": [
{ "Name": "PLC_Outbound_SN", "Address": "s=1;x=3;352", "Length": 50, "DataType": "String" },
{ "Name": "PLC_Outbound_PassResult", "Address": "s=1;x=3;372", "Length": 0, "DataType": "Int" },
{ "Name": "PLC_Outbound_CycleTime", "Address": "s=1;x=3;410", "Length": 0, "DataType": "Real" },
],
},
{
"Name": "PLC_ScanKey_Sign", "Address": "s=1;x=3;440", "Length": 0, "DataType": "Int", "ScanRate": 500, "Flag": "Trigger",
"NormalTags": [
{ "Name": "PLC_ScanKey_SN", "Address": "s=1;x=3;352", "Length": 50, "DataType": "String" },
{ "Name": "PLC_ScanKey_Barcode", "Address": "s=1;x=3;442", "Length": 50, "DataType": "String" },
],
},
{
"Name": "PLC_StepTask_Sign", "Address": "s=1;x=3;440", "Length": 0, "DataType": "Int", "ScanRate": 500, "Flag": "Trigger",
"NormalTags": [
{ "Name": "PLC_StepTask_SN", "Address": "s=1;x=3;442", "Length": 50, "DataType": "String" },
{ "Name": "PLC_StepTask_Angle", "Address": "s=1;x=3;420", "Length": 0, "DataType": "Real" },
{ "Name": "PLC_StepTask_Torque", "Address": "s=1;x=3;424", "Length": 0, "DataType": "Real" },
{ "Name": "PLC_StepTask_PassResult", "Address": "s=1;x=3;372", "Length": 0, "DataType": "Int" },
],
},
{
"Name": "PLC_Switch1", "Address": "s=1;x=3;40", "Length": 0, "DataType": "Int", "ScanRate": 100, "Flag": "Switch", "DisplayName": "ArcWelding",
"NormalTags": [
{ "Name": "PLC_Switch1_SN", "Address": "s=1;x=3;41", "Length": 50, "DataType": "String", "CurveUsage": "Master" },
{ "Name": "PLC_Switch1_No", "Address": "s=1;x=3;42", "Length": 10, "DataType": "String", "CurveUsage": "Master" },
{ "Name": "PLC_Switch1_Current", "Address": "s=1;x=3;43", "Length": 0, "DataType": "Int", "CurveUsage": "Data", "DisplayName": "Current" },
{ "Name": "PLC_Switch1_Voltage", "Address": "s=1;x=3;44", "Length": 0, "DataType": "Int", "CurveUsage": "Data", "DisplayName": "Voltage" },
],
},
{
"Name": "PLC_Switch2", "Address": "s=1;x=3;40", "Length": 0, "DataType": "Int", "ScanRate": 100, "Flag": "Switch", "DisplayName": "ArcWelding",
"NormalTags": [
{ "Name": "PLC_Switch2_SN", "Address": "s=1;x=3;41", "Length": 50, "DataType": "String", "CurveUsage": "Master" },
{ "Name": "PLC_Switch2_No", "Address": "s=1;x=3;42", "Length": 10, "DataType": "String", "CurveUsage": "Master" },
{ "Name": "PLC_Switch2_Current", "Address": "s=1;x=3;43", "Length": 0, "DataType": "Int", "CurveUsage": "Data", "DisplayName": "Current" },
{ "Name": "PLC_Switch2_Voltage", "Address": "s=1;x=3;44", "Length": 0, "DataType": "Int", "CurveUsage": "Data", "DisplayName": "Voltage" },
],
},
],
"CallbackTags": [
{ "Name": "MES_Callback_ReworkOperation", "Address": "s=1;x=3;460", "Length": 10, "DataType": "String" },
],
},
],
},
],
},
]
```
### 标记说明
#### 设备状态
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Device_Heartbeat | Bit/Word/Int |(可选)心跳标记。
PLC_Equipment_Alarm | Bit[] |(可选)报警标记。
PLC_Equipment_State | Int |(可选)设备状态,如 运行中、空闲、故障、急停等。
PLC_Equipment_Mode | Int |(可选)设备状态,如 手动、自动等。
PLC_Equipment_Energy | Int/DInt/Real |(可选)设备能耗标记(按前缀匹配)。
#### 设备状态
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Workstation_Andon | Int |(可选)工位安灯。
#### 进站请求
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Inbound_Sign | Int |进站信号标记。
PLC_Inbound_SN | Int |(必选)产品零件码。
PLC_Inbound_ProductCode | String |(必选)产品编号。
PLC_Inbound_Operator | String |(可选)操作人员。
PLC_Inbound_Shift | String |(可选)班次。
PLC_Inbound_Rfid | String |(可选)RFID。
#### 出站请求
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Outbound_Sign | Int |出站信号标记。
PLC_Outbound_SN | String |(必选)产品零件码。
PLC_Outbound_PassResult | Int |(必选)过站结果(1->OK;2->NG;3->强制OK;4->强制NG;5->报废)。
PLC_Outbound_CycleTime | Int/Real |(可选)节拍用时。
#### 工步请求
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_StepTask_Sign[_分类] | Int |工步请求信号标记(按前缀匹配)。
PLC_StepTask_SN | String |(必选)产品零件码。
PLC_StepTask_Index | Int |(必选)工步编号。
PLC_StepTask_PassResult | Int |(可选)过点最终结果(1->OK;2->NG;3->强制OK;4->强制NG;5->报废)。
PLC_StepTask_CycleTime | Int/Real |(可选)节拍用时。
PLC_StepTask_[参数] | Word/Int/Real |(可选)具体参数值。
PLC_StepTask_[参数]_MinLimit | Word/Int/Real |(可选)参数下限值。
PLC_StepTask_[参数]_MaxLimit | Word/Int/Real |(可选)参数上限值。
PLC_StepTask_[参数]_Result | Int |(可选)过点结果(1->OK;2->NG;3->强制OK;4->强制NG;5->报废)。
#### 关键物料扫码
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_ScanKey_Sign | Int |关键物料扫码请求信号标记。
PLC_ScanKey_SN | String |(必选)产品零件码。
PLC_ScanKey_Barcode | String |(必选)关键物料条码。
PLC_ScanKey_Step | Int |(可选)扫码上料步序。
#### 批次料扫码
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_ScanBatch_Sign | Int |批次料扫码请求信号标记。
PLC_ScanBatch_Barcode | String |(必选)批次料条码。
PLC_ScanBatch_Qty | Int |(可选)批次数量。
#### 设备点检
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Inspect_Sign[_分类] | Int |设备点检请求信号标记(按前缀匹配),多个设备需设置 Alias 属性。
PLC_Inspect_PartNo | String |(可选)标件码。
PLC_Inspect_PassResult | Int |(可选)点检最终结果(1->OK;2->NG;3->强制OK;4->强制NG;5->报废)。
PLC_Inspect_[参数] | Word/Int/Real |(可选)具体点检参数值。
PLC_Inspect_[参数]_MinLimit | Word/Int/Real |(可选)参数下限值。
PLC_Inspect_[参数]_MaxLimit | Word/Int/Real |(可选)参数上限值。
PLC_Inspect_[参数]_Result | Int |(可选)点检结果(1->OK;2->NG;3->强制OK;4->强制NG;5->报废)。
#### NG口(不良品口)返工上件标记
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_ReworkFeeding_Sign | Int |上件请求信号标记。
PLC_ReworkFeeding_SN | String |(必选)上件的零件码。
#### 曲线数据采集
标记名 | 类型 | 说明
:---------------|:---------|:--------
PLC_Curve_[分类] | Int |曲线信号标记,使用 DisplayName 属性表示曲线名称。
PLC_Curve_SN | String |(必选)产品零件码,使用 { CurveUsage: "Master" } 标识为主数据。
PLC_Curve_No | String/Int |(可选)编号,使用 { CurveUsage: "Master" } 标识为主数据。
PLC_Switch_[参数1] | Int/Real |(可选)参数值1,{ CurveUsage: "Data" } 标识为要曲线数据,DisplayName 标识为参数名称。
PLC_Switch_[参数2] | Int/Real |同上,参数值2。