From b0a4c47dd74bc41c5df3bab6ddd8de7bcc6a52b0 Mon Sep 17 00:00:00 2001
From: patrick <patrick.xu@broconcentric.com>
Date: 星期五, 06 十二月 2019 18:35:42 +0800
Subject: [PATCH] 1. 重新整理项目,按照A034模式,将设备异步操作修改为类同步操作。使用任务队列来存储和分配任务。

---
 src/Bro.Device.Common/DeviceBase/PLCBase.cs |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/Bro.Device.Common/DeviceBase/PLCBase.cs b/src/Bro.Device.Common/DeviceBase/PLCBase.cs
index c1e99b9..2141644 100644
--- a/src/Bro.Device.Common/DeviceBase/PLCBase.cs
+++ b/src/Bro.Device.Common/DeviceBase/PLCBase.cs
@@ -79,7 +79,7 @@
                     }
                     catch (Exception ex)
                     {
-                        OnLog?.Invoke(DateTime.Now, this, "PLC鐩戝惉寮傚父:" + ex.GetExceptionMessage());
+                        OnLog?.Invoke(DateTime.Now, this, $"{Name}鐩戝惉寮傚父:{ex.GetExceptionMessage()}");
                     }
                 }
             }
@@ -141,13 +141,13 @@
                               return tempNew[index];
                           }).ToList();
 
-                        OnMonitorInvoke?.BeginInvoke(DateTime.Now, m, OnMethodInvoked, m);
+                        OnMonitorInvoke?.BeginInvoke(DateTime.Now, this, m, OnMethodInvoked, m);
                     }
                 }
             });
         }
 
-        private void OnMethodInvoked(IAsyncResult ar)
+        protected virtual void OnMethodInvoked(IAsyncResult ar)
         {
             MonitorSet monitorSet = ar.AsyncState as MonitorSet;
 
@@ -186,7 +186,7 @@
 
                         if (repeatTime <= 0)
                         {
-                            new ProcessException("PLC鍙嶉鍐欏叆寮傚父", ex);
+                            new ProcessException("PLC鍙嶉鍐欏叆寮傚父", ExceptionLevel.Info, ex);
                         }
                     }
                 } while (repeatTime > 0);
@@ -234,13 +234,13 @@
         [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")]
         public int Timeout { get; set; } = 500;
 
-        [Category("杈撳嚭璁剧疆")]
-        [Description("鏄惁鏃ュ織杈撳嚭")]
-        public bool IsEnabelLog { get; set; } = false;
+        //[Category("杈撳嚭璁剧疆")]
+        //[Description("鏄惁鏃ュ織杈撳嚭")]
+        //public bool IsEnabelLog { get; set; } = false;
 
-        [Category("杈撳嚭璁剧疆")]
-        [Description("杈撳嚭鏂囦欢璺緞")]
-        public string LogPath { get; set; } = @"D:\PLCLog.txt";
+        //[Category("杈撳嚭璁剧疆")]
+        //[Description("杈撳嚭鏂囦欢璺緞")]
+        //public string LogPath { get; set; } = @"D:\PLCLog.txt";
 
         #region 鍦板潃璁剧疆
         [Category("浜嬩欢鍦板潃璁剧疆")]

--
Gitblit v1.8.0