From 4b4cc0dd66d0bfb8220709f6a5edd5fc3b8a65c2 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 02 六月 2025 13:58:47 +0800
Subject: [PATCH] 按需修改美心接口

---
 project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
index c10c5af..c737cc9 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
@@ -56,6 +56,19 @@
                 int ret = (int)para.RetractionSpeed;//鍙砅LC鑷姩浼稿嚭缂╁洖閫熷害
                 int liftPosition= (int)para.LeftPosition;//宸︿几鍑轰綅缃�
                 int rigtpostition= (int)para.RightPosition;//鍙充几鍑轰綅缃�
+                var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//宸lc鍒板師鐐逛綅缃俊鍙�
+                var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//鍙硃lc鍒拌揪鍘熺偣浣嶇疆淇″彿
+                var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//宸lc鍒拌揪鐩爣浣嶇疆
+                var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//鍙硃lc鍒拌揪鐩爣浣嶇疆
+
+                if (leftorigin == true || rightorigin == true)
+                {
+                    return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                }
+                if (lefttarget == true || righttarget == true)
+                {
+                    return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
+                }
 
                 if (ExtendedState == "浼稿嚭")
                 {
@@ -155,18 +168,34 @@
                 var para = BaseDal.QueryData().Where(x => x.Deptid == deid).OrderByDescending(x => x.CreateDate).FirstOrDefault();
                 int ext = (int)para.ManualExtend;//宸LC鎵嬪姩浼稿嚭缂╁洖閫熷害
                 int ret = (int)para.ManualRetraction;//鍙砅LC鎵嬪姩浼稿嚭缂╁洖閫熷害
+                
+                var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//宸lc鍒板師鐐逛綅缃俊鍙�
+                var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//鍙硃lc鍒拌揪鍘熺偣浣嶇疆淇″彿
+                var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//宸lc鍒拌揪鐩爣浣嶇疆
+                var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//鍙硃lc鍒拌揪鐩爣浣嶇疆
+
+                if (leftorigin==true|| rightorigin==true)
+                {
+                    return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                }
+                if(lefttarget==true|| righttarget == true)
+                {
+                    return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
+                }
+
+
                 if (position == "宸�" && ExtendedState == "浼稿嚭")
                 {
                     devices.Value.left.Communicator.Write<int>("D1000", ext);//宸LC鎵嬪姩浼稿嚭缂╁洖閫熷害
                     devices.Value.left.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
-                    Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑虹缉鍥瀧ext}");
+                    Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑簕ext}");
                 }
                 else if (position == "宸�" && ExtendedState == "缂╁洖")
                 {
                     devices.Value.left.Communicator.Write<int>("D1000", ext);//宸LC鎵嬪姩浼稿嚭缂╁洖閫熷害
                     devices.Value.left.Communicator.Write<bool>("M101", true);
                  
-                    Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑虹缉鍥瀧ext}");
+                    Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄧ缉鍥瀧ext}");
                 }
                 else if (position == "鍙�" && ExtendedState == "浼稿嚭")
                 {
@@ -187,7 +216,7 @@
                         ManualExtend = ext,
                         ManualRetraction = ret
                     }
-                };//杩欓噷瑕佸姞杩斿洖閫熷害
+                };
             }
             catch (Exception ex)
             {
@@ -282,7 +311,7 @@
                 catch (Exception)
                 {
 
-                    throw;
+                  
                 }
                 try
                 {
@@ -291,7 +320,7 @@
                 catch (Exception)
                 {
 
-                    throw;
+                   
                 }
                
                 

--
Gitblit v1.9.3