From c34f8f93417c5a0125f9c55ba3d347411995ac13 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 10 9月 2024 15:05:32 +0800 Subject: [PATCH] 1 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs | 87 +++++++++++++++++++++++++++---------------- 1 files changed, 54 insertions(+), 33 deletions(-) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs index 18763cd..2ffc05d 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs @@ -1,4 +1,5 @@ 锘縰sing iWare_SCADA_BusinessLogical.BLL; +using iWare_SCADA_BusinessLogical.BLL.Important; using iWare_SCADA_BusinessLogical.Utils; using iWare_SCADA_Model; using System; @@ -89,16 +90,13 @@ 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()}**"); - if(value.ToString().ToUpper().Equals("TRUE")) - { - } - if (SystemValue.value_OP1003.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) - {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝 - //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 - //涓氬姟浠g爜 + WorkPieceLogMiddle wplog = null; + var value_bool = value.ToString().ToUpper().Equals("TRUE"); + if (value_bool) + { threadStatusMonitor.Threadlastmodifytime = DateTime.Now; - WorkPieceLogMiddle wplog = new WorkPieceLogMiddle(); + wplog = new WorkPieceLogMiddle(); wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId(); wplog.WorkingProcedure = WorkingProcedure; wplog.EquipmentID = _dataCaptureConfig.EquipmentID; @@ -108,7 +106,7 @@ SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, DataCapturePointCode, DataCapturePointCname); wplog.CreatedTime = DateTimeHelper.GetDateTime(); wplog.UpdatedTime = DateTimeHelper.GetDateTime(); - wplog.UpdatedUserName = Environment.MachineName+"鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString(); + wplog.UpdatedUserName = Environment.MachineName + "鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString(); wplog.OnlineTime = DateTimeHelper.GetDateTime(); wplog.IsDeleted = false; @@ -123,7 +121,7 @@ { Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭鐩戞帶璇荤爜鏍囪 {col.DataCaptureColumnTabelName}璇诲彇宸ヤ欢鐮佸姩鎬佺敱浜庡瓧娈靛悕娌℃壘鍒帮紝璧嬪�笺�恵WorkingProcedure ?? "绌哄瓧绗︿覆"}銆戝け璐wplog.Id}"); } - if(col.DataCaptureColumnTabelName.Contains("Quality")) + if (col.DataCaptureColumnTabelName.Contains("Quality")) {//瀛楁鍚嶅寘鍚玅uality鏄涓烘槸璐ㄩ噺鏁版嵁锛岄兘鏄浆鎹㈡垚string set.SetValue(wplog, valuecol.ToString());//缁欏姩鎬佸瓧娈佃祴鍊� } @@ -137,37 +135,60 @@ Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭鐩戞帶璇荤爜鏍囪 {col.DataCaptureColumnTabelName}璇诲彇宸ヤ欢鐮佸姩鎬佽祴鍊笺�恵WorkingProcedure ?? "绌哄瓧绗︿覆"}銆戝紓甯竰wplog.Id}", setex); } } - if (wplog.WorkPieceID.Length != 22) - {//鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯� - Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹椂寮傚父锛�"); - continue; - } - //#region 宸ユ帶鏈鸿鍙栬川閲忎俊鎭� - - - ////鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖 - //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime()); - //foreach (System.IO.FileInfo file in newFiles) - //{ - // var datatable = CSVHelper.ReadCSV(file.FullName); - //} - - //#endregion - - - //鏇存柊WorkPieceInfo琛ㄤ互鍙婃彃鍏orkPieceLog琛ㄥ拰WorkPieceInfoLog琛� - WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); - threadStatusMonitor.Threadstatue = 1; + //鐩戞帶涓婄嚎 + MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); } - SystemValue.value_OP1003 = value.ToString(); + else + { + SystemValue.value_OP1003 = value.ToString(); + } + 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 + //涓氬姟浠g爜 + + if (wplog.WorkPieceID.Length != 22) + {//鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯� + Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹椂寮傚父锛�"); + continue; + } + + //#region 宸ユ帶鏈鸿鍙栬川閲忎俊鎭� + + + ////鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖 + //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime()); + //foreach (System.IO.FileInfo file in newFiles) + //{ + // var datatable = CSVHelper.ReadCSV(file.FullName); + //} + + //#endregion + + + //鏇存柊WorkPieceInfo琛ㄤ互鍙婃彃鍏orkPieceLog琛ㄥ拰WorkPieceInfoLog琛� + QualityInfoCompleteManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); + threadStatusMonitor.Threadstatue = 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 { -- Gitblit v1.9.3