From b7796f5e4d6594976ea948905af769eca863f27c Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 07 七月 2025 15:28:15 +0800
Subject: [PATCH] 代码更新

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs"
index 67617af..6439995 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs"
@@ -89,7 +89,7 @@
                 if (agvUpdateModel == null) throw new Exception("鏈幏鍙栧埌璇锋眰鍙傛暟");
                 agvResponseContent.ReqCode = agvUpdateModel.ReqCode;
                 var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum);
-                if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.TaskCode}銆�");
+                if (task == null && agvUpdateModel.Method!= "begin") throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.TaskCode}銆�");
                 switch (agvUpdateModel.Method)
                 {
                     case "begin":
@@ -98,7 +98,7 @@
                         agvResponseContent.Message = requestZH.Status ? "鎴愬姛" : "澶辫触";
                         return agvResponseContent;
                     case "outbin"://鍑哄簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鍙栬揣瀹屾垚
-                        if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+                        if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                         {
                             var content = TakeFinish(task.CurrentAddress);
                             if (!content.Status) throw new Exception(content.Message);
@@ -112,7 +112,7 @@
                         break;
                     case "getSafetySignal"://瀹夊叏淇″彿鐢宠
                         {
-                            if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+                            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                             {
                                 var content = TakeRequest(task.CurrentAddress);
                                 //if (!content.Status) throw new Exception(content.Message);
@@ -136,12 +136,12 @@
                             Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress);
                             if (dt_Station == null)
                             {
-                                throw new Exception($"{task.NextAddress}AGV绔欏彴鏈畾涔�");
+                                throw new Exception($"{task.NextAddress}绔欏彴鏈畾涔�");
                             }
                             task.CurrentAddress = dt_Station.StationCode;
                             task.NextAddress = "";
                             task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
-                            task.DeviceCode = "SC01_CSJ";
+                            task.DeviceCode = "SC01_ZH";
                             var up = _taskRepository.UpdateData(task);
                             agvResponseContent.Code = up ? "0" : "1";
                             agvResponseContent.Message = up ? "鎴愬姛" : "澶辫触";
@@ -334,5 +334,32 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+
+        //闃荤剨浠撳嚭搴撲换鍔$┖鍌ㄤ綅寮傚父鎵嬪姩閲嶅彂AGV浠诲姟
+        [HttpPost, HttpGet,Route("AgvZHTaskResend"),AllowAnonymous]
+        public WebResponseContent AgvZHTaskResend(int taskNum)
+        {
+            try
+            {
+                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+                if (task == null)
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒扮浉鍏充换鍔′俊鎭�");
+                }
+                if (task.TaskState == TaskStatusEnum.Exception.ObjToInt() && task.DeviceCode == "AGV_ZH")
+                {
+                    _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute);
+                }
+                else
+                {
+                    return WebResponseContent.Instance.Error("浠诲姟璁惧缂栧彿涓嶆纭垨浠诲姟鐘舵�侀潪绌哄偍浣嶅紓甯�");
+                }
+                return WebResponseContent.Instance.OK();
+            }
+            catch(Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3