From dd5b18ba20b6863ec91c364dff0aa3b9353e54b9 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 16 五月 2025 17:03:13 +0800
Subject: [PATCH] 添加自动伸缩杆的暂停接口,以及添加自动伸出位置

---
 project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
index 6358dba..0c52ddb 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
@@ -53,14 +53,18 @@
 
                 int ext = (int)para.ExtendSpeed;//宸LC鑷姩浼稿嚭缂╁洖閫熷害
                 int ret = (int)para.RetractionSpeed;//鍙砅LC鑷姩浼稿嚭缂╁洖閫熷害
+                int liftPosition= (int)para.LeftPosition;//宸︿几鍑轰綅缃�
+                int rigtpostition= (int)para.RightPosition;//鍙充几鍑轰綅缃�
 
                 if (ExtendedState == "浼稿嚭")
                 {
                     devices.Value.left.Communicator.Write<int>("D1001", ext);//宸LC鑷姩浼稿嚭缂╁洖閫熷害
                     devices.Value.left.Communicator.Write<bool>("M102", true);//浼稿嚭鎸夐挳
+                    devices.Value.left.Communicator.Write<int>("D1002", liftPosition);//宸︿几鍑轰綅缃�
                     devices.Value.right.Communicator.Write<int>("D1001", ret);//鍙砅LC鑷姩浼稿嚭缂╁洖閫熷害
                     devices.Value.right.Communicator.Write<bool>("M102", true);//浼稿嚭鎸夐挳
-                    Console.WriteLine($"鑷姩浼哥缉鏉嗕几鍑� {ext}");
+                    devices.Value.right.Communicator.Write<int>("D1002", rigtpostition);//鍙充几鍑轰綅缃�
+                    Console.WriteLine($"鑷姩浼哥缉鏉嗕几鍑� {ext},鍙充几鍑轰綅缃畕liftPosition}锛屽彸浼稿嚭浣嶇疆{rigtpostition}");
                 }
                 else if (ExtendedState == "缂╁洖")
                 {
@@ -79,7 +83,8 @@
                     Data = new
                     {
                         ExtendSpeed = ext,//
-                        RetractionSpeed = ret
+                        RetractionSpeed = ret,
+                       
                     }
                 };
             }
@@ -201,6 +206,8 @@
                     RetractionSpeed = entity.RetractionSpeed,
                     ManualExtend = entity.ManualExtend,
                     ManualRetraction = entity.ManualRetraction,
+                    LeftPosition = entity.LeftPosition,
+                    RightPosition = entity.RightPosition,   
                     Deptid = isAdmin ? deid : dept.GetValueOrDefault()//濡傛灉褰撳墠鐢ㄦ埛鏄鐞嗗憳锛屽氨鐢ㄩ厤缃枃浠朵腑鐨� DepartmentID锛屽惁鍒欑敤浼犲叆鐨� entity 鍙傛暟涓殑 Deptid
                 };
                 // 娣诲姞鏁版嵁
@@ -222,6 +229,30 @@
         }
 
 
+        /// <summary>
+        ///褰撹嚜鍔ㄤ几鍑洪渶瑕佹殏鍋滄椂锛屾殏鍋滄寜閽�
+        /// </summary>
+        /// <returns></returns>
+        public WebResponseContent PauseButton()
+        {
+            try
+            {
+                //鏍规嵁int.TryParse(AppSettings.Get("DepartmentID")璇诲彇鍒板綋鍓嶆槸杞ㄩ亾鍑狅紝鎵�鏈変汉閮藉彧鑳芥搷浣滃綋鍓�
+                if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid))
+                {
+                    return new WebResponseContent { Status = false, Message = "閰嶇疆椤� DepartmentID 鏃犳硶杞崲涓烘暣鏁�" };
+                };
+                var devices = GetDevicesByDeptId(deid);
+                devices.Value.left.Communicator.Write<bool>("M104", true);
+                devices.Value.right.Communicator.Write<bool>("M104", true);
+                return new WebResponseContent { Status =true,Message="鏆傚仠鎴愬姛",Data = devices};
+            }
+            catch (Exception ex)
+            {
+
+                return new WebResponseContent { Status = false, Message = ex.Message };
+            }
+        }
 
 
 
@@ -270,6 +301,8 @@
                 return new WebResponseContent { Status = false, Message = ex.Message };
             }
         }
+
+     
     }
 
 }

--
Gitblit v1.9.3