From fcd49db2ee33ee2e1d33e5a41e53d9897a8a3b0f Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 05 六月 2025 19:19:10 +0800
Subject: [PATCH] 限制plc伸到位报警,和限制开始作业无限点击问题

---
 project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs |   72 +++++++++++++++++++++++++----------
 1 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
index c737cc9..c5ba941 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
@@ -56,20 +56,35 @@
                 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)
+                try
                 {
-                    return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                    var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//宸lc鍒板師鐐逛綅缃俊鍙�
+                    var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//鍙硃lc鍒拌揪鍘熺偣浣嶇疆淇″彿
+                    if (leftorigin == true || rightorigin == true)
+                    {
+                        return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                    }
                 }
-                if (lefttarget == true || righttarget == true)
+                catch (Exception)
                 {
-                    return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
-                }
 
+
+                }
+                try
+                {
+                    var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//宸lc鍒拌揪鐩爣浣嶇疆
+                    var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//鍙硃lc鍒拌揪鐩爣浣嶇疆
+                    if (lefttarget == true || righttarget == true)
+                    {
+                        return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
+                    }
+
+                }
+                catch (Exception)
+                {
+
+
+                }
                 if (ExtendedState == "浼稿嚭")
                 {
                     try
@@ -168,21 +183,36 @@
                 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)
+                try
                 {
-                    return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                    var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//宸lc鍒板師鐐逛綅缃俊鍙�
+                    var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//鍙硃lc鍒拌揪鍘熺偣浣嶇疆淇″彿
+                    if (leftorigin == true || rightorigin == true)
+                    {
+                        return new WebResponseContent { Status = false, Message = "宸插埌鍘熷鐐�" };
+                    }
                 }
-                if(lefttarget==true|| righttarget == true)
+                catch (Exception)
                 {
-                    return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
-                }
 
+                    
+                }
+                try
+                {
+                    var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//宸lc鍒拌揪鐩爣浣嶇疆
+                    var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//鍙硃lc鍒拌揪鐩爣浣嶇疆
+                    if (lefttarget == true || righttarget == true)
+                    {
+                        return new WebResponseContent { Status = false, Message = "宸插埌鏈�澶у��" };
+                    }
+
+                }
+                catch (Exception)
+                {
+
+                    
+                }
+              
 
                 if (position == "宸�" && ExtendedState == "浼稿嚭")
                 {

--
Gitblit v1.9.3