| | |
| | | return typeof(Char); |
| | | case "real": |
| | | return typeof(double); |
| | | //return typeof(Single); |
| | | //return typeof(Single); |
| | | case "bool": |
| | | return typeof(bool); |
| | | case "string": |
| | |
| | | } |
| | | } |
| | | |
| | | public static object GetVauleForObjectType(object vaule,TypeCode type) |
| | | public static object GetVauleForObjectType(object vaule, TypeCode type) |
| | | { |
| | | |
| | | switch (type) |
| | |
| | | return Convert.ToString(vaule); |
| | | case TypeCode.Byte: |
| | | return Convert.ToByte(vaule); |
| | | |
| | | |
| | | default: |
| | | return Convert.ToString(vaule); |
| | | } |
| | |
| | | |
| | | public static LogType GetLogTypeForWorkingProcedure(string wp) |
| | | { |
| | | switch(wp) |
| | | switch (wp) |
| | | { |
| | | |
| | | case "OP05": |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |