From 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 09 七月 2025 22:55:27 +0800
Subject: [PATCH] 增加质检出入库逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/AGVsignal.cs |   61 ++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 20 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/AGVsignal.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/AGVsignal.cs"
index 3926374..68e822b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/AGVsignal.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/AGVsignal.cs"
@@ -61,7 +61,6 @@
                 CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceName == "杈撻�佺嚎") as CommonConveyorLine;
                 if (conveyorLine == null) throw new Exception("鏈壘鍒拌緭閫佺嚎璁惧淇℃伅");
                 if (!conveyorLine.IsConnected) throw new Exception($"杈撻�佺嚎璁惧閫氳寮傚父");
-                //conveyorLine.SetValue(ConveyorLine_AGV.WriteRGPutComplete, true, "1001");//浜哄伐鏀捐揣瀹屾垚
                 switch (conveyor.Type)
                 {
                     case 1:
@@ -79,31 +78,30 @@
                         }
                         break;
                     case 2:
+                        break;
+                    case 3:
                         {
                             if (conveyor.Station == "1001")
                             {
                                 content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, true, conveyor.Station);
-                                if (content.Status)
-                                {
-                                    Thread.Sleep(1000);
-                                    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestPut, false, conveyor.Station);
-                                    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, false, conveyor.Station);
-                                }
+                                //if (content.Status)
+                                //{
+                                //    Thread.Sleep(1000);
+                                //    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestPut, false, conveyor.Station);
+                                //    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, false, conveyor.Station);
+                                //}
                             }
                             else
                             {
                                 content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, true, conveyor.Station);
-                                if (content.Status)
-                                {
-                                    Thread.Sleep(1000);
-                                    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestTake, false, conveyor.Station);
-                                    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, false, conveyor.Station);
-                                }
+                                //if (content.Status)
+                                //{
+                                //    Thread.Sleep(1000);
+                                //    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestTake, false, conveyor.Station);
+                                //    conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, false, conveyor.Station);
+                                //}
                             }
                         }
-                        break;
-                    case 3:
-
                         break;
                     case 4:
 
@@ -125,9 +123,9 @@
         public static WebResponseContent AGVRequestinProductionLine(ConveyorLineDTO conveyor)
         {
             WebResponseContent content = new WebResponseContent();
+            OtherDevice? ProductionLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == conveyor.Station) as OtherDevice;
             try
             {
-                OtherDevice? ProductionLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == conveyor.Station) as OtherDevice;
                 if (ProductionLine == null) throw new Exception("鏈壘鍒颁骇绾胯澶囦俊鎭�");
                 if (!ProductionLine.IsConnected) throw new Exception($"浜х嚎璁惧閫氳寮傚父");
                 content.Status = ProductionLine.SetValue(ProductionLineDBName.WagvState, conveyor.Type);
@@ -137,14 +135,17 @@
                 switch (conveyor.Type)
                 {
                     case 1:
-                        if (agvState != conveyor.Type) throw new Exception("浜х嚎涓嶅厑璁歌繘鍏ヤ綔涓�");
+                        if (agvState != conveyor.Type) throw new Exception($"AGV鐢宠杩涘叆锛屼骇绾夸笉鍏佽杩涘叆浣滀笟锛屼骇绾夸俊鍙枫�恵agvState}銆�");
+                        ProductionLine?.Communicator.LogNet.WriteDebug($"AGV鐢宠杩涘叆锛屼骇绾垮厑璁歌繘鍏ヤ綔涓氾紝浜х嚎淇″彿銆恵agvState}銆�");
+                        content.OK();
                         break;
                     case 2:
-                        if (agvState != conveyor.Type) throw new Exception("浜х嚎涓嶅厑璁哥寮�");
+                        //if (agvState != conveyor.Type) throw new Exception("浜х嚎涓嶅厑璁哥寮�");
+                        content.OK();
                         break;
                     case 3:
                         content.Status = ProductionLine.SetValue(ProductionLineDBName.Wrequest, 2);
-                        if (content.Status) content.Status = ProductionLine.SetValue(ProductionLineDBName.WagvState, 0);
+                        ProductionLine?.Communicator.LogNet.WriteDebug($"AGV宸茬寮�锛屼换鍔″畬鎴�");
                         break;
                 }
                 content = content.Status ? content.OK() : content.Error("鍐欏叆澶辫触");
@@ -152,8 +153,28 @@
             catch (Exception ex)
             {
                 content.Error(ex.Message);
+                ProductionLine?.Communicator.LogNet.WriteDebug(ex.Message);
             }
             return content;
         }
+        /// <summary>
+        /// 鍏ュ簱杈撻�佺嚎浜哄伐鏀捐揣瀹屾垚
+        /// </summary>
+        /// <returns></returns>
+        public static WebResponseContent ReleaseCompleted()
+        {
+            try
+            {
+                CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceName == "杈撻�佺嚎") as CommonConveyorLine;
+                if (conveyorLine == null) throw new Exception("鏈壘鍒拌緭閫佺嚎璁惧淇℃伅");
+                if (!conveyorLine.IsConnected) throw new Exception($"杈撻�佺嚎璁惧閫氳寮傚父");
+                conveyorLine.SetValue(ConveyorLine_AGV.WriteRGPutComplete, true, "1001");//浜哄伐鏀捐揣瀹屾垚
+                return WebResponseContent.Instance.OK();
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3