From 16e188758b164ed959090dd5149d109b7a9adb92 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周四, 05 9月 2024 11:40:08 +0800 Subject: [PATCH] 10和40 上线逻辑回退 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs | 2 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs | 26 ++++---- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1003.cs | 72 ++++++++++++------------ DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1002.cs | 56 +++++++++--------- 4 files changed, 79 insertions(+), 77 deletions(-) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs index c5aa581..b42fae3 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs @@ -47,7 +47,7 @@ public static void PLCServiceReconnect(PLCService plcService) { - if(plcService==null) + if (plcService == null) { return; } @@ -78,16 +78,17 @@ public static char PLCDBADDRESS_SEPARATE = '|'; - public static List<ThreadStatusMonitor> MainList=new List<ThreadStatusMonitor>(); + public static List<ThreadStatusMonitor> MainList = new List<ThreadStatusMonitor>(); private static object lockMainList = new object(); public static async void UpdateMainList(ThreadStatusMonitor threadinfo) { - await Task.Run(() => { + await Task.Run(() => + { lock (lockMainList) { var info = MainList.Where(o => o.Threadcode == threadinfo.Threadcode).FirstOrDefault(); - if(info == null) + if (info == null) { MainList.Add(threadinfo); } @@ -96,7 +97,7 @@ DateTime time = DateTime.Now; info.Remarks = threadinfo.Remarks; info.Threadendtime = time;//姣忔閮芥洿鏂� - info.Threadlastmodifytime = threadinfo.Threadlastmodifytime>DateTime.MinValue? threadinfo.Threadlastmodifytime: info.Threadlastmodifytime;//濡傛灉鏈変紶鍙傚垯鏇存柊 + info.Threadlastmodifytime = threadinfo.Threadlastmodifytime > DateTime.MinValue ? threadinfo.Threadlastmodifytime : info.Threadlastmodifytime;//濡傛灉鏈変紶鍙傚垯鏇存柊 info.ThreadId = threadinfo.ThreadId; info.ThreadFrequency = threadinfo.ThreadFrequency; info.UpdatedTime = time; @@ -143,10 +144,11 @@ /// <summary> /// 鏄惁鍏佽鎵ц鐩戞帶OP05宸ュ簭鎵撶爜瀹屾垚鏍囪绾跨▼ /// </summary> - public static bool isAllowRuning_OP0501 - { - get { return _isAllowRuning_OP0501; } - set { + public static bool isAllowRuning_OP0501 + { + get { return _isAllowRuning_OP0501; } + set + { lock (lockOP0501Runing) { _isAllowRuning_OP0501 = value; @@ -446,11 +448,11 @@ /// <summary> /// OP10宸ュ簭娴嬭瘯瀹屾垚鏍囪鍊� /// </summary> - public static string value_OP1002 = "FALSE";//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� + public static string value_OP1002 = string.Empty;//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� /// <summary> /// OP10宸ュ簭鎺ㄥ嚭鏍囪鍊� /// </summary> - public static string value_OP1003 = "FALSE";//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� + public static string value_OP1003 = string.Empty;//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� /// <summary> /// OP10宸ュ簭SPC鎺ㄥ嚭鏍囪鍊� /// </summary> @@ -1064,7 +1066,7 @@ } } } - + private static object lockOP3501Alert = new object(); private static object lockOP3502Alert = new object(); private static object lockOP3503Alert = new object(); diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs index 8ebde78..0a641a4 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs @@ -983,7 +983,7 @@ cur_db_info = db.WorkPieceInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault(); if (cur_db_info == null || cur_db_info.WorkPieceID.Length < 1) {//娌℃湁宸ヤ欢淇℃伅锛屼笉鍋氭洿鏂� - Log4NetHelper.WriteErrorLog(type, $"宸ヤ欢{loginfo.WorkPieceID} 宸ヤ欢鎺ㄥ嚭宸ュ簭{loginfo.WorkingProcedure} 娌℃湁鑾峰彇鍒板伐浠朵俊鎭笉鍋氭洿鏂�"); + Log4NetHelper.WriteErrorLog(type, $"宸ヤ欢{loginfo.WorkPieceID} 宸ヤ欢鎺ㄥ嚭NOOK宸ュ簭{loginfo.WorkingProcedure} 娌℃湁鑾峰彇鍒板伐浠朵俊鎭笉鍋氭洿鏂�"); return; } else diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1002.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1002.cs index bc52240..fe09314 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1002.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1002.cs @@ -143,46 +143,46 @@ //鐩戞帶涓婄嚎 MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); } - if (wplog != null) - { - var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(wplog.WorkPieceID); - if (isRight) - { - #region 涓氬姟澶勭悊 + //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鏃讹紝 - //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 - //涓氬姟浠g爜 - Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭娴嬫爣璁拌鍙杮DateTime.Now}***1****"); + if (SystemValue.value_OP1002.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) + {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝 + //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 + //涓氬姟浠g爜 + Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭娴嬫爣璁拌鍙杮DateTime.Now}***1****"); - //#region 宸ユ帶鏈鸿鍙栬川閲忎俊鎭� + //#region 宸ユ帶鏈鸿鍙栬川閲忎俊鎭� - ////鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖 - //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime()); - //foreach (System.IO.FileInfo file in newFiles) - //{ - // var datatable = CSVHelper.ReadCSV(file.FullName); - //} + ////鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖 + //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime()); + //foreach (System.IO.FileInfo file in newFiles) + //{ + // var datatable = CSVHelper.ReadCSV(file.FullName); + //} - //#endregion - Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭娴嬫爣璁拌鍙杮DateTime.Now}***3****"); + //#endregion + Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭娴嬫爣璁拌鍙杮DateTime.Now}***3****"); - //鏇存柊WorkPieceInfo琛ㄤ互鍙婃彃鍏orkPieceLog琛ㄥ拰WorkPieceInfoLog琛� - WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); - threadStatusMonitor.Threadstatue = 1; + //鏇存柊WorkPieceInfo琛ㄤ互鍙婃彃鍏orkPieceLog琛ㄥ拰WorkPieceInfoLog琛� + WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); + threadStatusMonitor.Threadstatue = 1; - } - SystemValue.value_OP1002 = value.ToString(); - - #endregion - } } + SystemValue.value_OP1002 = value.ToString(); + + #endregion + // } + //} } SystemValue.lbl_Alert_OP1002 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; 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 6b2dc90..9b5d01b 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 @@ -138,46 +138,46 @@ //鐩戞帶涓婄嚎 MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID); } - if (wplog != null) - { - var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(wplog.WorkPieceID); - if (isRight) - { - #region 涓氬姟澶勭悊 + //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 (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琛� - WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); - threadStatusMonitor.Threadstatue = 1; - } - SystemValue.value_OP1003 = value.ToString(); - - #endregion + 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; } + SystemValue.value_OP1003 = value.ToString(); + + #endregion + // } + //} } SystemValue.lbl_Alert_OP1003 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; -- Gitblit v1.9.3