From 9ca96199d92168fe221dda9aba56f55520a561d8 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 29 十月 2024 17:30:59 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs
index 114795a..6038eca 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs
@@ -17,10 +17,7 @@
     /// <summary>
     /// 鑷畾涔夊爢鍨涙満
     /// </summary>
-    /// <typeparam name="T1">鍫嗗灈鏈虹姸鎬�1娉涘瀷</typeparam>
-    /// <typeparam name="T2">鍫嗗灈鏈虹姸鎬�2娉涘瀷</typeparam>
-    /// <typeparam name="T3">鍫嗗灈鏈虹姸鎬�3娉涘瀷</typeparam>
-    [Description("鍫嗗灈鏈�")]
+    [Description("鍫嗗灈鏈�2")]
     public class SpeStackerCrane : IStackerCrane
     {
         #region Private Member
@@ -193,25 +190,32 @@
 
         public bool SendCommand<T>(T command) where T : IDataTransfer, new()
         {
-            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
-            DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-            if (devicePro == null)
+            if (Communicator is SiemensS7)
             {
+                if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+                DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                if (devicePro == null)
+                {
+                    return false;
+                }
+                if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command))
+                {
+                    StackerCraneTaskCommand = command;
+                    //CheckStackerCraneTaskCompleted();
+                    return true;
+                }
                 return false;
             }
-            if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command))
+            else
             {
-                StackerCraneTaskCommand = command;
-                //CheckStackerCraneTaskCompleted();
-                return true;
+                throw new Exception("鏆備笉鏀寔闄よタ闂ㄥ瓙涔嬪鐨凱LC");
             }
-            return false;
         }
 
         /// <summary>
         /// 鐩戞祴鍫嗗灈鏈轰换鍔℃槸鍚﹀畬鎴�(闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽畾涔夋墜鍔ㄨЕ鍙戝姛鑳�)
         /// </summary>
-         void CheckStackerCraneTaskCompleted()
+        void CheckStackerCraneTaskCompleted()
         {
             if (_isChecked)
                 return;

--
Gitblit v1.9.3