From 09a12e1094e90fe83c5578de64b56e9237c60507 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周四, 05 9月 2024 14:13:33 +0800 Subject: [PATCH] 代码回归 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs | 2 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - 复制(2).cs | 359 ++++++++++++++++++++++++++++++++++++++++++++ DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs | 50 +++--- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs | 10 - DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj | 1 5 files changed, 388 insertions(+), 34 deletions(-) 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 0a6611e..689b0c9 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs @@ -296,8 +296,8 @@ new_process.CreatedTime = _time; new_process.UpdatedTime = _time; } - db.WorkPieceProcess.Add(new_process); } + db.WorkPieceProcess.Add(new_process); //db.Database.AutoTransactionsEnabled = false;// 鍚屼竴涓猄aveChanges榛樿浜嬪姟锛� 鍏抽棴榛樿浜嬪姟锛�... 濂藉儚涓嶈兘鐢ㄥ晩锛屽悗闈㈠啀鐮旂┒鍚� if (isAddWorkPieceInfo) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs index 953c0c3..8a2a57a 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs @@ -106,7 +106,7 @@ //plcService.Close(); //plcService.OpenService(); } - string value_01 = "FALSE";//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� + string value_01 = "";//娉ㄦ剰锛氶粯璁ゆ槸FALSE 銆怑ditby shaocx,2024-09-05銆� while (true) { threadStatusMonitor.ErrorMsg = ""; @@ -177,36 +177,36 @@ //鐩戞帶涓婄嚎 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 (value_01.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) - {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝 - //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 - //涓氬姟浠g爜 - threadStatusMonitor.Threadlastmodifytime = DateTime.Now; + if (value_01.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE")) + {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝 + //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 + //涓氬姟浠g爜 + threadStatusMonitor.Threadlastmodifytime = DateTime.Now; - //鐗规畩澶勭悊OP50 銆怑ditby shaocx,2024-08-16銆� - string sideValue = GetSideForOP50(plcService, wplog); - wplog.MonitoringPoint += sideValue; - //wplog.CreatedUserName = wplog.MonitoringPoint; - SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, wplog.MonitoringPoint, DataCapturePointCname); + //鐗规畩澶勭悊OP50 銆怑ditby shaocx,2024-08-16銆� + string sideValue = GetSideForOP50(plcService, wplog); + wplog.MonitoringPoint += sideValue; + //wplog.CreatedUserName = wplog.MonitoringPoint; + SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, wplog.MonitoringPoint, DataCapturePointCname); - //璇诲彇浜岀淮鐮佸悗鏇存柊鏁版嵁搴� - WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback); + //璇诲彇浜岀淮鐮佸悗鏇存柊鏁版嵁搴� + WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback); - threadStatusMonitor.Threadstatue = 1; + threadStatusMonitor.Threadstatue = 1; - } - value_01 = value.ToString(); - - #endregion - } } + value_01 = value.ToString(); + + #endregion + // } + //} } threadStatusMonitor.Remarks = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}"; if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10) diff --git "a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266\0502\051.cs" "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266\0502\051.cs" new file mode 100644 index 0000000..5d893a1 --- /dev/null +++ "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266\0502\051.cs" @@ -0,0 +1,359 @@ +锘�//using iWare_SCADA_BusinessLogical.BLL; +//using iWare_SCADA_BusinessLogical.Utils; +//using iWare_SCADA_Model; +//using System; +//using System.Collections.Generic; +//using System.Data; +//using System.Globalization; +//using System.IO; +//using System.Linq; +//using System.Text; +//using System.Threading; +//using System.Threading.Tasks; +//using System.Web.UI.WebControls; + +//namespace iWare_SCADA_BusinessLogical +//{ +// /// <summary> +// /// OP05 鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅 +// /// </summary> +// public class DataCaptureHandler_OP0501 : DataCaptureHandler +// { +// public static readonly DataCaptureHandler_OP0501 Instance = new DataCaptureHandler_OP0501(); + +// public DataCaptureHandler_OP0501() +// { +// } + +// public override string WorkingProcedure +// { +// get { return _dataCaptureConfig.WorkingProcedure; } +// } + +// public override string DataCapturePointCode +// { +// get { return _dataCaptureConfig.DataCapturePointCode; } +// } +// public override string DataCapturePointCname +// { +// get { return _dataCaptureConfig.DataCapturePointCname; } +// } +// public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig) +// { + +// } +// public override void DataCaptureStart() +// { +// if (IsCaptureflag) +// { +// //// plc杩炴帴 +// //var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig); +// //if (plcService == null) +// //{ +// // SystemValue.lbl_Alert_OP0501 = $"{RandomHelper.GenerateRandomCode(4)} 娌℃湁鎵惧埌{_dataCaptureConfig.WorkingProcedure}鐨凱LC璁惧"; +// // return; +// //} +// //if (plcService != null && !plcService.IsConnected) +// //{ +// // plcService.Close(); +// // plcService.OpenService(); +// //} + +// string lastHandlerWorkPileIDForOP0501 = "";//鏈�鍚庝竴娆″鐞嗙殑宸ヤ欢鍙� + +// while (true) +// { +// ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor(); +// threadStatusMonitor.Threadcode = DataCapturePointCode; +// threadStatusMonitor.Threadcname = DataCapturePointCname; +// threadStatusMonitor.Threadendtime = DateTime.Now; +// //threadStatusMonitor.Threadlastmodifytime = DateTime.Now; +// threadStatusMonitor.Threadstatue = 0; +// threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString(); +// try +// { +// ////_dataCaptureConfig +// //if (plcService == null || !plcService.IsConnected) +// //{ +// // SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC杩炴帴宸叉柇寮�锛屾鍦ㄥ皾璇曟墦寮�!"; +// // plcService.Close(); +// // plcService.OpenService(); +// // Thread.Sleep(100); +// // continue; +// //} +// //else +// { +// //var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType)); +// //if (SystemValue.value_OP0501.Equals("0") && value.ToString().Equals("1")) +// {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝 +// //瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1 +// //涓氬姟浠g爜 +// //璇荤爜瀹屾垚娌″暐涓氬姟鎿嶄綔锛岃幏鍙栦簩缁寸爜锛岀劧鍚庢斁鍒伴槦鍒椾腑 +// #region 浠庡伐鎺ф満鑾峰彇鐩稿叧浜岀淮鐮� +// var path = ConfigHelper.GetConfigString("WorkPeiceIDPath");//鎵撶爜鏈烘墦鐮佷簩缁寸爜璺緞 +// //鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖 涓�鑸妭鎷嶅湪15绉掑乏鍙筹紙鍙互纭涓�涓嬶級 +// //鎵弿淇敼鏃堕棿鍦ㄤ笂娆℃壂鎻忔椂闂翠箣鍓�10绉掑埌褰撳墠鏃堕棿鐨勪箣闂寸殑鏂囦欢 +// var dataTime = CommonManager.Instance.CheackPath(Environment.CurrentDirectory + "\\LastModifyTime\\OP05-LastScapTime.txt", 4, -10); +// var scapEndTime = DateTimeHelper.GetDateTime(); +// var newFiles = FileHelper.DetectNewFilesCSV(path, 60, Convert.ToDateTime(dataTime), scapEndTime); + + +// Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭紑濮�:{dataTime}"); + +// foreach (System.IO.FileInfo file in newFiles) +// { +// threadStatusMonitor.Threadlastmodifytime = DateTime.Now; +// Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,鏂囦欢鍚�:{file.FullName}"); +// DataTable dt = null; +// dt = CSVHelper.ReadCSV(file.FullName); +// if (dt == null) +// { +// continue; +// } +// lock (SystemValue.lock5QRcodeList) +// { +// #region 娓呰繃鏈熺紦瀛� +// try +// { +// //娓呰繃鏈熺紦瀛� +// var lstRemoveKey = SystemValue.QRcodeList +// .Where(p => p.Value < DateTimeHelper.GetDateTime().AddMinutes(-600)) +// .Select(p => p.Key).ToList(); +// if (lstRemoveKey.Count > 0) +// { +// foreach (var key in lstRemoveKey) SystemValue.QRcodeList.Remove(key); +// Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"娓呴櫎缂撳瓨鏁伴噺锛氾紙{lstRemoveKey.Count}锛� 鍓╀綑缂撳瓨鏁伴噺锛氾紙{SystemValue.QRcodeList.Count}锛�"); +// } +// } +// catch (Exception ex) +// { +// Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "娓呴櫎鍛婅鎶ユ枃ID缂撳瓨閿欒锛�", ex); +// } +// #endregion + +// ////绛涢�夐渶瑕佸鐞嗙殑浜岀淮鐮佷俊鎭� +// //DataRow[] drArr = dt.Select(" 鎵爜缁撴灉='鎴愬姛'"); //鏌ヨ +// //DataTable dtNew = dt.Clone(); +// //for (int i = 0; i < drArr.Length; i++) +// //{ +// // var now = DateTime.Now; +// // var list = drArr[i]["鏃堕棿"].ToString().Split(':'); +// // var d = new DateTime(now.Year, now.Month, now.Day, Convert.ToInt32(list[0]), Convert.ToInt32(list[1]), Convert.ToInt32(list[2]), DateTimeKind.Local); +// // //and 鏃堕棿> '19:19:34:547' +// // if (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " +drArr[i]["鏃堕棿"]).TimeOfDay> Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 19:19:34:547").TimeOfDay) +// // dtNew.ImportRow(drArr[i]); +// // //鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯� +// // SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�"; +// // Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// // $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�"); +// //} +// DataTable newDt = new DataTable(); +// var dates = file.Name.Split('-', '.'); +// var date = string.Format("{0:D4}-{1:D2}-{2:D2}", int.Parse(dates[0]), int.Parse(dates[1]), int.Parse(dates[2])); +// if (DateTimeHelper.GetDateTime().Date != Convert.ToDateTime(date) && DateTimeHelper.GetDateTime().AddDays(-1).Date != Convert.ToDateTime(date)) +// { +// continue; +// } +// DataRow[] filteredRows = new DataRow[dt.Rows.Count]; +// if (dt.Rows.Count > 0) +// { +// int j = 0; +// var cache = DataCache.GetCache("OP501-LastTime"); +// DateTime? lasttime = null; +// if (cache != null) +// { +// lasttime = Convert.ToDateTime(cache); +// } + +// Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,宸ヤ欢鏈�鏂版椂闂�:{(cache == null ? "鏃犵紦瀛�" : cache.ToString())}"); +// for (int i = dt.Rows.Count - 1; i >= 0; i--) +// {//闄嶅簭锛屽嵆浼樺厛璇诲彇鏈�鍚庝竴鏉℃暟鎹� +// string timeValue = " "; +// try +// { +// timeValue = dt.Rows[i]["鏃堕棿"].ToString(); +// string[] timeComponents = timeValue.Split(':'); +// string correctedTime = string.Format("{0:D2}:{1:D2}:{2:D2}", int.Parse(timeComponents[0]), int.Parse(timeComponents[1]), int.Parse(timeComponents[2])); +// var newTime = date + " " + correctedTime; +// dt.Rows[i]["鏃堕棿"] = newTime; + +// var currrentTime = Convert.ToDateTime(dt.Rows[i]["鏃堕棿"]); +// if (cache == null) +// { +// if (j == 0) +// { +// if (currrentTime > DateTimeHelper.GetDateTime().AddHours(-10)) +// { +// lasttime = currrentTime; +// } +// } +// var oldTime = DateTime.Now.AddMinutes(-10); +// // if (currrentTime <= oldTime) +// if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"])) +// {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 褰撳墠鍓�10鍒嗛挓鏃堕棿瑕佹棭锛岄偅涔堟垜灏卞拷鐣ヤ笉澶勭悊銆� +// break; +// } +// filteredRows[j] = dt.Rows[i]; +// } +// else +// { +// var cacheTime = Convert.ToDateTime(cache); +// //if (currrentTime <= cacheTime) +// if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"])) +// {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 鎴戠紦瀛樹腑鐨勬椂闂磋鏃╋紝閭d箞鎴戝氨蹇界暐涓嶅鐞嗐�� +// break; +// } +// filteredRows[j] = dt.Rows[i]; +// } + +// if (currrentTime > DateTimeHelper.GetDateTime().AddHours(-10)) +// { +// if (lasttime != null && lasttime < currrentTime) +// { +// lasttime = currrentTime; +// } +// } +// j++; +// } +// catch (Exception ex) +// { +// SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}鏂囦欢鎵撴爣鏃堕棿[{timeValue}]寮傚父锛岃鏌ョ湅鏃ュ織锛�"; +// Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}鏂囦欢鎵撴爣鏃堕棿,鍑虹幇寮傚父锛�", ex); +// } +// } + +// filteredRows = filteredRows.Where(item => item != null).ToArray(); +// // 璁剧疆缂撳瓨鍊� +// DateTime absoluteExpiration = DateTime.Now.AddDays(30); +// TimeSpan slidingExpiration = TimeSpan.FromMinutes(20); +// if (slidingExpiration == TimeSpan.Zero) +// { +// absoluteExpiration = DateTime.Now.AddDays(30); +// } +// else +// { +// absoluteExpiration = DateTime.MaxValue; +// } +// DataCache.SetCache("OP501-LastTime", lasttime, absoluteExpiration, slidingExpiration); +// if (filteredRows.Count() <= 0) +// { +// continue; +// } +// if (file.LastAccessTime < Convert.ToDateTime(dataTime)) continue; +// using (StreamWriter writer = new StreamWriter(Environment.CurrentDirectory + "\\OP05-LastScapTime.txt", false)) +// { +// dataTime = file.LastAccessTime.ToString(); +// writer.Write(dataTime); +// } +// Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"璇诲彇鍒皗filteredRows.Count()}琛屾暟鎹紝鏃堕棿鑼冨洿鏄瘂filteredRows[j - 1]["鏃堕棿"]}-{filteredRows[0]["鏃堕棿"]}"); +// } + +// //// 宸ヤ欢鍙凤紙浜岀淮鐮佸�硷級 +// //string WorkPieceID = dt.Rows[0][""].ToString(); +// //if (WorkPieceID.Length != 22) +// //{ +// // //鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯� +// // SystemValue.lbl_Alert_HMI01 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�"; +// // Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// // $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�"); +// //} + + +// //SystemValue.QRcodeList.Add("", DateTimeHelper.GetDateTime());//浜岀淮鐮佹坊鍔犲埌鍒楄〃涓� + +// WorkPieceLog wplog = new WorkPieceLog(); +// wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId(); +// wplog.WorkingProcedure = _dataCaptureConfig.WorkingProcedure; ; +// //wplog.EquipmentID = WorkingProcedure; +// wplog.Remarks = "cs"; +// wplog.MonitoringPoint = DataCapturePointCode; +// //wplog.CreatedUserName = DataCapturePointCode; +// SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, DataCapturePointCode, DataCapturePointCname); +// wplog.CreatedTime = DateTimeHelper.GetDateTime(); +// wplog.UpdatedTime = DateTimeHelper.GetDateTime(); +// wplog.UpdatedUserName = Environment.MachineName + "鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString(); +// wplog.IsDeleted = false; +// wplog.EquipmentID = _dataCaptureConfig.EquipmentID; + +// wplog.OnlineTime = DateTimeHelper.GetDateTime();//缁欎笂绾挎椂闂寸敤 + +// //wplog.QualityState = 1; +// wplog.QualityState = (int)QualityStateEnum.OK;//榛樿鍚堟牸锛孫P05榛樿鍚堟牸 + +// wplog.ProcessingDuration = 1; +// wplog.MachineToolState = 1; +// wplog.AlertType = 1; +// wplog.WorkPieceNumber = 1; +// wplog.WorkPieceOnlineTime = Convert.ToDateTime(dataTime); +// wplog.WorkPieceOfflineTime = Convert.ToDateTime(dataTime).AddHours(1); +// wplog.WorkPieceStartMachiningTime = Convert.ToDateTime(dataTime); +// wplog.WorkPieceEndMachiningTime = DateTime.Now.AddDays(7); +// wplog.KnifeEdgeNumber = 10; +// wplog.KnifeToolLife = 10; +// wplog.KnifeToolEarlyWarningLife = 3; +// wplog.KnifeToolSurplusLife = 10; + +// foreach (var item in filteredRows) +// { +// Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), +// $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,璇诲彇宸ヤ欢浜岀淮鐮�:{item["鎵撴爣鍐呭"].ToString()}"); + +// if (item == null) break; +// wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId(); +// wplog.WorkPieceID = item["鎵撴爣鍐呭"].ToString(); +// wplog.OfflineTime = Convert.ToDateTime(dataTime); +// wplog.Remarks = item["鏃堕棿"].ToString() + "|" + item["鎵撴爣鍐呭"].ToString() + "|" + item["鎵撴爣鍐呭"].ToString() + "|" + item["鎵爜绛夌骇"].ToString() + "|" + item["鎵爜缁撴灉"].ToString(); +// WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), null, _dataCaptureConfig.IsFeedback); + +// threadStatusMonitor.Threadstatue = 1; +// } + + +// //璁板綍涓嬫渶鍚庝竴涓爜 +// lastHandlerWorkPileIDForOP0501 = Convert.ToString(dt.Rows[dt.Rows.Count - 1]["鎵撴爣鍐呭"]); +// } +// } + + +// #endregion +// //var fileCount = ((iWare_SCADA_BusinessLogical.Utils.FindFiles)newFiles).; +// //Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"鎵弿瀹屾垚锛屽叡鎵弿鍒帮細锛坽fileCount.Count()}锛変釜鏂囦欢"); +// } +// //SystemValue.value_OP0501 = value.ToString(); +// } +// } +// catch (Exception ex) +// { +// threadStatusMonitor.ErrorMsg = $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛岃鏌ョ湅鏃ュ織锛�"; + +// SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛岃鏌ョ湅鏃ュ織锛�"; +// Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛�", ex); +// } +// finally +// { +// WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor); +// } +// //绾跨▼澶氫箙鎵ц涓�娆★紙涓嶅寘鍚笟鍔″鐞嗘椂闂达級 +// if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10) +// { +// Thread.Sleep(3000); +// } +// else +// { +// Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value); +// } +// } +// } +// else +// { +// SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛屼笉鍋氭牎楠岋紝璇风‘璁ら厤缃俊鎭紒"; +// Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛屼笉鍋氭牎楠岋紝璇风‘璁ら厤缃紓甯�"); +// } + +// } + +// } +//} diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs index 740b5d8..484a428 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs @@ -59,8 +59,6 @@ // plcService.OpenService(); //} - string lastHandlerWorkPileIDForOP0501 = "";//鏈�鍚庝竴娆″鐞嗙殑宸ヤ欢鍙� - while (true) { ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor(); @@ -191,8 +189,7 @@ } } var oldTime = DateTime.Now.AddMinutes(-10); - // if (currrentTime <= oldTime) - if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"])) + if (currrentTime <= oldTime) {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 褰撳墠鍓�10鍒嗛挓鏃堕棿瑕佹棭锛岄偅涔堟垜灏卞拷鐣ヤ笉澶勭悊銆� break; } @@ -201,8 +198,7 @@ else { var cacheTime = Convert.ToDateTime(cache); - //if (currrentTime <= cacheTime) - if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"])) + if (currrentTime <= cacheTime) {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 鎴戠紦瀛樹腑鐨勬椂闂磋鏃╋紝閭d箞鎴戝氨蹇界暐涓嶅鐞嗐�� break; } @@ -312,8 +308,6 @@ } - //璁板綍涓嬫渶鍚庝竴涓爜 - lastHandlerWorkPileIDForOP0501 = Convert.ToString(dt.Rows[dt.Rows.Count - 1]["鎵撴爣鍐呭"]); } } diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj index a65e5ef..159c7d5 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj @@ -83,6 +83,7 @@ <Compile Include="BLL\SystemValue.cs" /> <Compile Include="BLL\WorkPieceInfoManager.cs" /> <Compile Include="BLL\WorkPieceLogManager.cs" /> + <Compile Include="DataCaptureHandlerV2\DataCaptureHandler_OP0501 - 澶嶅埗%282%29.cs" /> <Compile Include="DataCaptureHandlerV2\DataCaptureHandler_OP0501 - 澶嶅埗.cs" /> <Compile Include="DataCaptureHandlerV2\DeleteDataHandler.cs" /> <Compile Include="DataCaptureHandlerV2\OP80QualityDataHandler.cs" /> -- Gitblit v1.9.3