| | |
| | | using iWare_SCADA_BusinessLogical.BLL; |
| | | using iWare_SCADA_BusinessLogical.BLL.Important; |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | using iWare_SCADA_Model; |
| | | using iWare_SCADA_Model.MiddleModel; |
| | |
| | | //plcService.Close(); |
| | | //plcService.OpenService(); |
| | | } |
| | | string value_01 = ""; |
| | | string value_01 = "FALSE";//注意:默认是FALSE 【Editby shaocx,2024-09-05】 |
| | | while (true) |
| | | { |
| | | threadStatusMonitor.ErrorMsg = ""; |
| | |
| | | //string hostname = Environment.MachineName; |
| | | |
| | | object value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType)); |
| | | if (value_01.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) |
| | | {//当上一标记位0,当前获取标记为1时, |
| | | //触发操作, 并给静态变量赋值为1 |
| | | //业务代码 |
| | | threadStatusMonitor.Threadlastmodifytime = DateTime.Now; |
| | | WorkPieceLog wplog = new WorkPieceLog(); |
| | | WorkPieceLog wplog = null; |
| | | |
| | | var value_bool = value.ToString().ToUpper().Equals("TRUE"); |
| | | if (value_bool) |
| | | { |
| | | wplog = new WorkPieceLog(); |
| | | wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wplog.WorkingProcedure = WorkingProcedure; |
| | | wplog.EquipmentID = _dataCaptureConfig.EquipmentID; ; |
| | | wplog.Remarks = WorkingProcedure; |
| | | wplog.MonitoringPoint = DataCapturePointCode; |
| | | //wplog.CreatedUserName = DataCapturePointCode; |
| | | SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, DataCapturePointCode, DataCapturePointCname); |
| | | wplog.CreatedTime = DateTimeHelper.GetDateTime(); |
| | | wplog.CreatedUserName = DataCapturePointCode; |
| | | wplog.UpdatedTime = DateTimeHelper.GetDateTime(); |
| | | wplog.UpdatedUserName = Environment.MachineName + "自动" + Thread.CurrentThread.ManagedThreadId.ToString(); |
| | | wplog.OnlineTime = DateTimeHelper.GetDateTime(); |
| | |
| | | //监控测试数据,模拟,测试 |
| | | MonitorHelper.MonitorTestForOP3501(_dataCaptureConfig, value, colConfig, wplog); |
| | | //监控上线 |
| | | MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog); |
| | | |
| | | //特殊处理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); |
| | | |
| | | threadStatusMonitor.Threadstatue = 1; |
| | | |
| | | MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); |
| | | } |
| | | value_01 = value.ToString(); |
| | | else |
| | | { |
| | | value_01 = value.ToString(); |
| | | } |
| | | 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时, |
| | | //触发操作, 并给静态变量赋值为1 |
| | | //业务代码 |
| | | threadStatusMonitor.Threadlastmodifytime = DateTime.Now; |
| | | |
| | | //特殊处理OP50 【Editby shaocx,2024-08-16】 |
| | | string sideValue = GetSideForOP50(plcService, wplog); |
| | | wplog.MonitoringPoint += sideValue; |
| | | wplog.JiaJuGongWei = SystemBussinessHelper.GetJiaJuGongWei(wplog.MonitoringPoint, wplog.WorkingProcedure); |
| | | //wplog.CreatedUserName = wplog.MonitoringPoint; |
| | | SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, wplog.MonitoringPoint, DataCapturePointCname); |
| | | |
| | | //读取二维码后更新数据库 |
| | | ReadQRcodeManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback); |
| | | |
| | | threadStatusMonitor.Threadstatue = 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 |
| | | { |