| | |
| | | /// <summary> |
| | | /// OP10工序测试完成标记值 |
| | | /// </summary> |
| | | public static string value_OP1002 = string.Empty; |
| | | public static string value_OP1002 = "FALSE";//注意:默认是FALSE 【Editby shaocx,2024-09-05】 |
| | | /// <summary> |
| | | /// OP10工序推出标记值 |
| | | /// </summary> |
| | | public static string value_OP1003 = string.Empty; |
| | | public static string value_OP1003 = "FALSE";//注意:默认是FALSE 【Editby shaocx,2024-09-05】 |
| | | /// <summary> |
| | | /// OP10工序SPC推出标记值 |
| | | /// </summary> |
| | |
| | | //plcService.Close(); |
| | | //plcService.OpenService(); |
| | | } |
| | | string value_01 = ""; |
| | | string value_01 = "FALSE";//注意:默认是FALSE 【Editby shaocx,2024-09-05】 |
| | | while (true) |
| | | { |
| | | threadStatusMonitor.ErrorMsg = ""; |
| | |
| | | |
| | | object value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType)); |
| | | WorkPieceLog wplog = null; |
| | | if (value.ToString().ToUpper().Equals("TRUE")) |
| | | |
| | | var value_bool = value.ToString().ToUpper().Equals("TRUE"); |
| | | if (value_bool) |
| | | { |
| | | wplog = new WorkPieceLog(); |
| | | wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | |
| | | //监控上线 |
| | | MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); |
| | | } |
| | | if (wplog != null) |
| | | { |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(wplog.WorkPieceID); |
| | | if (isRight) |
| | | { |
| | | #region 处理业务 |
| | | |
| | | if (value_01.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) |
| | | {//当上一标记位0,当前获取标记为1时, |
| | |
| | | } |
| | | value_01 = value.ToString(); |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |
| | | threadStatusMonitor.Remarks = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; |
| | | if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10) |
| | | { |
| | | threadStatusMonitor.ThreadFrequency = 1000; |
| | | Thread.Sleep(1000); |
| | | threadStatusMonitor.ThreadFrequency = 700; |
| | | Thread.Sleep(700); |
| | | } |
| | | else |
| | | { |
| | |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}工序测标记读取{DateTime.Now}*****01****{stopwatch.ElapsedMilliseconds}"); |
| | | |
| | | WorkPieceLogMiddle wplog = null; |
| | | if (value.ToString().ToUpper().Equals("TRUE")) |
| | | var value_bool = value.ToString().ToUpper().Equals("TRUE"); |
| | | if (value_bool) |
| | | { |
| | | threadStatusMonitor.Threadlastmodifytime = DateTime.Now; |
| | | wplog = new WorkPieceLogMiddle(); |
| | |
| | | //监控上线 |
| | | MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); |
| | | } |
| | | if (wplog != null) |
| | | { |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(wplog.WorkPieceID); |
| | | if (isRight) |
| | | { |
| | | #region 业务处理 |
| | | |
| | | if (SystemValue.value_OP1002.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) |
| | | {//当上一标记位0,当前获取标记为1时, |
| | |
| | | } |
| | | SystemValue.value_OP1002 = value.ToString(); |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | |
| | | } |
| | | SystemValue.lbl_Alert_OP1002 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; |
| | | if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10) |
| | | { |
| | | Thread.Sleep(5000); |
| | | Thread.Sleep(700); |
| | | } |
| | | else |
| | | { |
| | |
| | | var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType)); |
| | | stopwatch.Stop(); |
| | | Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}工序测标记读取{DateTime.Now}*****01****{stopwatch.ElapsedMilliseconds}*****{value.ToString().ToUpper()}**"); |
| | | |
| | | WorkPieceLogMiddle wplog = null; |
| | | if (value.ToString().ToUpper().Equals("TRUE")) |
| | | var value_bool = value.ToString().ToUpper().Equals("TRUE"); |
| | | if (value_bool) |
| | | { |
| | | threadStatusMonitor.Threadlastmodifytime = DateTime.Now; |
| | | wplog = new WorkPieceLogMiddle(); |
| | |
| | | //监控上线 |
| | | MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); |
| | | } |
| | | if (wplog != null) |
| | | { |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(wplog.WorkPieceID); |
| | | if (isRight) |
| | | { |
| | | #region 业务处理 |
| | | |
| | | if (SystemValue.value_OP1003.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) |
| | | {//当上一标记位0,当前获取标记为1时, |
| | | //触发操作, 并给静态变量赋值为1 |
| | |
| | | } |
| | | SystemValue.value_OP1003 = value.ToString(); |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | |
| | | } |
| | | SystemValue.lbl_Alert_OP1003 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; |
| | | if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10) |
| | | { |
| | | Thread.Sleep(5000); |
| | | Thread.Sleep(700); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | //不正常的码写入数据库 |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(workPieceID); |
| | | PieceLogTypeEnum pieceLogTypeEnum = PieceLogTypeEnum.正常; |
| | | if (isRight == false) |
| | | { |
| | | pieceLogTypeEnum = PieceLogTypeEnum.读码值异常; |
| | | } |
| | | WorkPieceLog workPieceLog = new WorkPieceLog() |
| | | { |
| | | Id = Yitter.IdGenerator.YitIdHelper.NextId(), |
| | |
| | | WorkingProcedure = _dataCaptureConfig.WorkingProcedure, |
| | | CreatedTime = DateTime.Now, |
| | | CreatedUserName = _dataCaptureConfig.DataCapturePointCode, |
| | | MyRemarks = "读码值异常", |
| | | Remarks = "读码值异常", |
| | | PieceLogType = (int)PieceLogTypeEnum.读码值异常, |
| | | PieceLogTypeName = PieceLogTypeEnum.读码值异常.ToString() |
| | | MyRemarks = "", |
| | | Remarks = pieceLogTypeEnum.ToString(), |
| | | PieceLogType = (int)pieceLogTypeEnum, |
| | | PieceLogTypeName = pieceLogTypeEnum.ToString() |
| | | }; |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | db.WorkPieceLog.Add(workPieceLog); |
| | | db.SaveChanges(); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | var n_workPieceID = workPieceID.Trim(); |
| | | if (n_workPieceID.Length == 22) |
| | | { |
| | | if (n_workPieceID.IndexOf("ERROR") > -1) |
| | | if (n_workPieceID.ToUpper().IndexOf("ERROR") > -1) |
| | | { |
| | | return false; |
| | | } |