From 5c34ca4f23c702291188f122b05165310b579cbc Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周六, 31 8月 2024 10:03:54 +0800 Subject: [PATCH] 监控上线 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs index 1def89c..7365c9b 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs @@ -44,7 +44,7 @@ return typeof(Char); case "real": return typeof(double); - //return typeof(Single); + //return typeof(Single); case "bool": return typeof(bool); case "string": @@ -58,7 +58,7 @@ } } - public static object GetVauleForObjectType(object vaule,TypeCode type) + public static object GetVauleForObjectType(object vaule, TypeCode type) { switch (type) @@ -77,7 +77,7 @@ return Convert.ToString(vaule); case TypeCode.Byte: return Convert.ToByte(vaule); - + default: return Convert.ToString(vaule); } @@ -85,7 +85,7 @@ public static LogType GetLogTypeForWorkingProcedure(string wp) { - switch(wp) + switch (wp) { case "OP05": @@ -115,14 +115,34 @@ } } - public static string GetWorkPieceIDForPLC(DataCaptureConfig _dataCaptureConfig,PLCService plcService) + + /// <summary> + /// 涓婄嚎 + /// </summary> + /// <param name="wp"></param> + /// <returns></returns> + public static LogType GetLogTypeForOnLine(string wp) + { + //寮哄埗杞崲 + try + { + LogType _logType = (LogType)Enum.Parse(typeof(LogType), wp); + return _logType; + } + catch (Exception ex) + { + return LogType.OtherOnLine; + } + } + + public static string GetWorkPieceIDForPLC(DataCaptureConfig _dataCaptureConfig, PLCService plcService) { try { var valueid = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, _dataCaptureConfig.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType)); return valueid.ToString().Trim(); } - catch(Exception ex) + catch (Exception ex) { Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(_dataCaptureConfig.WorkingProcedure), $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹椂寮傚父锛�", ex); throw; -- Gitblit v1.9.3