PLC配置

This commit is contained in:
quowingwang 2026-01-30 14:24:42 +08:00
parent 3cf0b6262b
commit f728c88d9d
2 changed files with 2 additions and 24 deletions

View File

@ -5038,29 +5038,7 @@ namespace RIZO.Admin.WebApi.PLC.Service
}
}
// 6. OP070-1专属状态读取删除双层判断+内联转换逻辑)
if (config.PlcName == "OP070-1")
{
try
{
int runStatus = await ReadPlcIntAsync(plc, _op070_1IntMap["运行状态"]);
int machineModel = await ReadPlcIntAsync(plc, _op070_1IntMap["设备模式"]);
int onlineStatus = await ReadPlcIntAsync(plc, _op070_1IntMap["设备在线状态"]);
int produceModel = await ReadPlcIntAsync(plc, _op070_1IntMap["生产模式"]);
result.RunStatus = runStatus switch { 1 => "空闲", 2 => "运行中", 3 => "故障", _ => $"未知({runStatus})" };
result.MachineModel = machineModel switch { 1 => "空模式", 2 => "手动", 4 => "初始化", 8 => "自动", 16 => "CycleStop", _ => $"未知({machineModel})" };
result.OnLineStatus = onlineStatus == 1 ? "离线" : (onlineStatus == 0 ? "在线" : $"未知({onlineStatus})");
result.ProduceModel = produceModel switch { 1 => "正常模式", 2 => "清线模式", 4 => "返工模式", 8 => "换型模式", 16 => "预热模式", _ => $"未知({produceModel})" };
result.ReadMessage = $"{result.ReadMessage}; OP070-1状态读取成功";
}
catch (Exception ex)
{
result.RunStatus = result.MachineModel = result.OnLineStatus = result.ProduceModel = "读取失败";
result.ReadMessage = $"{result.ReadMessage}; OP070-1状态读取失败{ex.Message}";
}
}
}
catch (OperationCanceledException)
{

View File

@ -547,5 +547,5 @@
"IntoStationResp": "DB1010.DBW2000" //
}
}
]·
]
}