From 34bafb439a438c0f4e85ef7006dac590140d155c Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 01 十一月 2024 14:50:15 +0800
Subject: [PATCH] 联调程序变动

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
index 7aa2adf..f67ac7c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
@@ -1,4 +1,5 @@
 锘�#region << 鐗� 鏈� 娉� 閲� >>
+
 /*----------------------------------------------------------------
  * 鍛藉悕绌洪棿锛歐IDESEAWCS_QuartzJob
  * 鍒涘缓鑰咃細鑳$搴�
@@ -11,8 +12,9 @@
  * 淇敼鏃堕棿锛�
  * 鐗堟湰锛歏1.0.1
  * 淇敼璇存槑锛�
- * 
+ *
  *----------------------------------------------------------------*/
+
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
 using HslCommunication;
@@ -34,6 +36,7 @@
     public class CommonConveyorLine : IConveyorLine
     {
         #region Private Member
+
         /// <summary>
         /// 鍫嗗灈鏈洪�氳瀵硅薄
         /// </summary>
@@ -62,9 +65,11 @@
         private bool _heartStatr = true;
 
         private bool _isConnected = true;
+
         #endregion
 
         #region Public Member
+
         /// <summary>
         /// 杈撻�佺嚎閫氳瀵硅薄
         /// </summary>
@@ -104,9 +109,11 @@
         /// 璁惧鐘舵��
         /// </summary>
         public DeviceStatus Status => DeviceStatus.Offline;
+
         #endregion
 
         #region Constructor Function
+
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
@@ -124,9 +131,11 @@
             _deviceName = deviceName;
             CheckConnect();
         }
+
         #endregion
 
         #region Private Method
+
         private void CheckConnect()
         {
             Task.Run(() =>
@@ -150,9 +159,11 @@
                 }
             });
         }
+
         #endregion
 
         #region Public Method
+
         /// <summary>
         /// 璇诲彇PLC鍗忚鍦板潃鐨勬暟鎹�
         /// </summary>
@@ -177,7 +188,7 @@
         }
 
         /// <summary>
-        /// 
+        ///
         /// </summary>
         /// <typeparam name="T"></typeparam>
         /// <param name="command"></param>
@@ -222,6 +233,29 @@
         }
 
         /// <summary>
+        /// 璇诲彇PLC鏁版嵁锛岃繑鍥炶嚜瀹氫箟瀵硅薄
+        /// </summary>
+        /// <typeparam name="T">娉涘瀷</typeparam>
+        /// <param name="deviceChildCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="deviceProParamType">鍙傛暟绫诲瀷</param>
+        /// <returns>杩斿洖鑷畾涔夊璞℃垨鎶涘嚭寮傚父</returns>
+        /// <exception cref="Exception"></exception>
+        public T ReadCustomer<T>(string deviceChildCode, string deviceProParamType) where T : IDataTransfer, new()
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == deviceProParamType && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+
+            if (devicePro == null)
+            {
+                throw new Exception("鏈壘鍒板崗璁俊鎭�");
+            }
+            else
+            {
+                return Communicator.ReadCustomer<T>(devicePro.DeviceProAddress);
+            }
+        }
+
+        /// <summary>
         /// 鏍规嵁鍙傛暟鍚嶇О銆佽澶囧瓙缂栧彿鍐欏叆瀵瑰簲鐨勬暟鎹��
         /// </summary>
         /// <typeparam name="TEnum">鍙傛暟鍚嶇О鏋氫妇绫诲瀷銆�</typeparam>
@@ -240,7 +274,7 @@
         }
 
         /// <summary>
-        /// 
+        ///
         /// </summary>
         /// <param name="deviceChildCode"></param>
         /// <returns></returns>
@@ -278,6 +312,7 @@
             _communicator.Dispose();
             GC.SuppressFinalize(this);
         }
+
         #endregion
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3