| | |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}工序监控上线完成标记 字段{col.DataCaptureColumnTabelName}动态赋值异常{wplog.Id}", setex); |
| | | } |
| | | } |
| | | |
| | | //特殊处理OP50 【Editby shaocx,2024-08-16】 |
| | | string sideValue = GetSideForOP50(plcService, wplog); |
| | | wplog.MonitoringPoint += sideValue; |
| | | wplog.CreatedUserName = wplog.MonitoringPoint; |
| | | |
| | | //读取二维码后更新数据库 |
| | | WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取OP50的某个工位的哪个面 |
| | | /// </summary> |
| | | /// <param name="plcService"></param> |
| | | /// <returns></returns> |
| | | private string GetSideForOP50(PLCService plcService, WorkPieceLog wplog) |
| | | { |
| | | try |
| | | { |
| | | if (!(DataCapturePointCode.Contains("OP5001A") || DataCapturePointCode.Contains("OP5001B"))) |
| | | { |
| | | return ""; |
| | | } |
| | | string title = $"读取 {DataCapturePointCode}工序时,获取OP50的哪个面,工件号:{wplog.WorkPieceID}"; |
| | | |
| | | int i_value_M88 = _GetSideForOP50(plcService, wplog, "M87.0"); |
| | | if (i_value_M88 == 1) |
| | | { |
| | | title += ",返回1"; |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), title); |
| | | return "1"; |
| | | } |
| | | |
| | | i_value_M88 = _GetSideForOP50(plcService, wplog, "M87.2"); |
| | | if (i_value_M88 == 1) |
| | | { |
| | | title += ",返回2"; |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), title); |
| | | return "2"; |
| | | } |
| | | |
| | | i_value_M88 = _GetSideForOP50(plcService, wplog, "M87.4"); |
| | | if (i_value_M88 == 1) |
| | | { |
| | | title += ",返回3"; |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), title); |
| | | return "3"; |
| | | } |
| | | |
| | | i_value_M88 = _GetSideForOP50(plcService, wplog, "M87.6"); |
| | | if (i_value_M88 == 1) |
| | | { |
| | | title += ",返回4"; |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), title); |
| | | return "4"; |
| | | } |
| | | |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}工序时,无效数值,获取OP50的哪个面,i_value_M88:{i_value_M88},工件号:{wplog.WorkPieceID}"); |
| | | return ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}工序时异常,获取OP50的哪个面,工件号:{wplog.WorkPieceID}", ex); |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | |
| | | private int _GetSideForOP50(PLCService plcService, WorkPieceLog wplog, string address) |
| | | { |
| | | try |
| | | { |
| | | object value_M88 = plcService.ReadValuePointV2(address, PLCManger.GetTypeForString("int")); |
| | | int i_value_M88 = 0; |
| | | var isRight = int.TryParse(value_M88.ToString(), out i_value_M88); |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode},读取地址 {address},工序监控数据,获取OP50的哪个面,i_value_M88:{i_value_M88},工件号:{wplog.WorkPieceID}"); |
| | | if (isRight) |
| | | { |
| | | return i_value_M88; |
| | | } |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode},读取地址 {address},工序监控测量标记数据时,无效数值,获取OP50的哪个面,,i_value_M88:{i_value_M88},工件号:{wplog.WorkPieceID}", null); |
| | | return 0; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode},读取地址 {address},工序监控测量标记数据时异常,获取OP50的哪个面,工件号:{wplog.WorkPieceID}", ex); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | } |