diff --git a/RIZO.Admin.WebApi/PLC/Service/PlcService.cs b/RIZO.Admin.WebApi/PLC/Service/PlcService.cs index 048cc38..e7f9f0c 100644 --- a/RIZO.Admin.WebApi/PLC/Service/PlcService.cs +++ b/RIZO.Admin.WebApi/PLC/Service/PlcService.cs @@ -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) { diff --git a/RIZO.Admin.WebApi/appsettings.json b/RIZO.Admin.WebApi/appsettings.json index 45f45f2..f8d571c 100644 --- a/RIZO.Admin.WebApi/appsettings.json +++ b/RIZO.Admin.WebApi/appsettings.json @@ -547,5 +547,5 @@ "IntoStationResp": "DB1010.DBW2000" // 进站回复结果地址 } } - ]· + ] }