From 2c889b38311883ceb703c4e0034c798fdaa2e21c Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 12 八月 2025 23:11:57 +0800
Subject: [PATCH] 更新代码,货位分配优化等

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs |   66 +++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 28 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
index d8d1275..dc24b96 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
@@ -46,22 +46,22 @@
             {
                 var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum);
                 if (task == null) throw new Exception("鏈壘鍒颁换鍔�");
-                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
-                {
-                    var content = TakeRequest(task.CurrentAddress);
-                    //if (!content.Status)
-                    //{
-                    //    throw new Exception(content.Message);
-                    //}
-                }
-                else
-                {
-                    var content = PutRequest(task.NextAddress, task.PalletType);
-                    //if (!content.Status)
-                    //{
-                    //    throw new Exception(content.Message);
-                    //}
-                }
+                //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+                //{
+                //    var content = TakeRequest(task.CurrentAddress);
+                //    //if (!content.Status)
+                //    //{
+                //    //    throw new Exception(content.Message);
+                //    //}
+                //}
+                //else
+                //{
+                //    var content = PutRequest(task.NextAddress, task.PalletType);
+                //    //if (!content.Status)
+                //    //{
+                //    //    throw new Exception(content.Message);
+                //    //}
+                //}
                 task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                 var up = _taskRepository.UpdateData(task);
                 agvResponseContent.Code = up ? "0" : "1";
@@ -98,7 +98,12 @@
                         if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                         {
                             var content = TakeFinish(task.CurrentAddress);
-                            if (!content.Status) throw new Exception(content.Message);
+                            if (!content.Status) 
+                            {
+                                task.TaskState = TaskStatusEnum.AGV_TakeError.ObjToInt();
+                                _taskRepository.UpdateData(task);
+                                throw new Exception(content.Message);
+                            }
                             task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt();
                             var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
                             _taskService.TaskCompleted(task.TaskNum);
@@ -109,16 +114,16 @@
                         break;
                     case "getSafetySignal"://瀹夊叏淇″彿鐢宠
                         {
-                            if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
-                            {
-                                var content = TakeRequest(task.CurrentAddress);
-                                //if (!content.Status) throw new Exception(content.Message);
-                            }
-                            else
-                            {
-                                var content = PutRequest(task.NextAddress, task.PalletType);
-                                //if (!content.Status) throw new Exception(content.Message);
-                            }
+                            //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+                            //{
+                            //    var content = TakeRequest(task.CurrentAddress);
+                            //    //if (!content.Status) throw new Exception(content.Message);
+                            //}
+                            //else
+                            //{
+                            //    var content = PutRequest(task.NextAddress, task.PalletType);
+                            //    //if (!content.Status) throw new Exception(content.Message);
+                            //}
                             task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt();
                             var up = _taskRepository.UpdateData(task);
                             agvResponseContent.Code = up ? "0" : "1";
@@ -129,7 +134,12 @@
                         if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt())
                         {
                             var content = PutFinish(task.NextAddress);
-                            if (!content.Status) throw new Exception(content.Message);
+                            if (!content.Status)
+                            {
+                                task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt();
+                                _taskRepository.UpdateData(task);
+                                throw new Exception(content.Message);
+                            }
                             Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress);
                             if (dt_Station == null)
                             {

--
Gitblit v1.9.3