From a6e0ea9ce13e791f3edae4edffeb3be3ccb760be Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 31 三月 2025 02:14:59 +0800
Subject: [PATCH] 版本更新

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs |   77 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 4 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
index 0a5c229..cb6f801 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
@@ -6,6 +6,7 @@
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_DTO.Agv;
 using WIDESEAWCS_IBasicInfoRepository;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
@@ -90,7 +91,69 @@
             //return _taskService.AgvSecureApply(secureApplyModel);
         }
         #endregion
-
+        /// <summary>
+        /// 鏂欑鍒ゆ柇
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost, HttpGet, Route("AgvCallbackBoxNo"), AllowAnonymous]
+        public AgvResponseContent AgvCallbackBoxNo([FromBody] AgvCallbackBoxNoDTO agvCallbackBox)
+        {
+            AgvResponseContent agvResponseContent = new AgvResponseContent();
+            try
+            {
+                var task = _taskRepository.QueryFirst(x => agvCallbackBox.TaskNo == x.AgvTaskNum);
+                if (task==null)
+                {
+                    agvResponseContent.Code = "1";
+                    agvResponseContent.Message = $"鏈壘鍒颁换鍔agvCallbackBox.TaskNo}";
+                    return agvResponseContent;
+                }
+                if (task.PalletCode!= agvCallbackBox.ContainerCode)
+                {
+                    string Address = task.CurrentAddress switch
+                    {
+                        "5206" => "5105",
+                        "5212" => "5111",
+                        "5218" => "5117",
+                        "8005" => "8001",
+                        "5135" => "5236",
+                    };
+                    AgvCTUCancelDTO agvCTUCancel=new AgvCTUCancelDTO()
+                    {
+                        ForceCancel="1",
+                        MatterArea= task.CurrentAddress,
+                        TaskCode=task.AgvTaskNum,
+                        ReqCode = DateTime.Now.ToString("yyyyMMddHHmmss") + task.AgvTaskNum,
+                        ReqTime= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    };
+                    WebResponseContent content = _taskService.AgvBoxApplyPass(agvCTUCancel);
+                    //鍙栨秷浠诲姟
+                    if (content.Status)
+                    {
+                        agvResponseContent.Code = "0";
+                        agvResponseContent.Message = $"鍙栨秷{task.AgvTaskNum}鎴愬姛";
+                        task.ExceptionMessage = $"瀹為檯绠卞彿{task.PalletCode}鎵弿绠眥agvCallbackBox.ContainerCode}";
+                        _taskService.UpdateTask(task, TaskStatusEnum.Cancel);
+                    }
+                    else
+                    {
+                        agvResponseContent.Code = "1";
+                        agvResponseContent.Message = content.Message;
+                    }
+                }
+                else
+                {
+                    agvResponseContent.Code = "0";
+                    agvResponseContent.Message = "鎴愬姛";
+                }
+            }
+            catch (Exception ex)
+            {
+                agvResponseContent.Code = "1";
+                agvResponseContent.Message = ex.Message;
+            }
+            return agvResponseContent;
+        }
         /// <summary>
         /// CtuAGV浠诲姟鏇存柊/瀹屾垚
         /// </summary>
@@ -110,13 +173,14 @@
                 switch (agvUpdateModel.Method)
                 {
                     case "end":
-                        if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
+                        if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutEmpty.ObjToInt() 
+                            || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
                             PutFinish(task.NextAddress);
                         _taskService.TaskCompleted(task.TaskNum);
                         break;
                     case "applyToAgv":
                         //鏇存敼鎴愬搧鍏ュ簱AGV鍙栬揣浠诲姟鐘舵��
-                        if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt())
+                        if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt() || task.TaskType == TaskTypeEnum.InProductBack.ObjToInt())
                         {
                             _taskService.UpdateTask(task,TaskStatusEnum.AGV_WaitToExecute);
                         }
@@ -129,9 +193,14 @@
                         }
                         break;
                     case "outbin":
-                        if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
+                        if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt() || task.TaskType == TaskTypeEnum.InProductBack.ObjToInt())
                         {
                             TakeFinish(task.CurrentAddress);
+                            _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
+                        }
+                        else if(task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
+                        {
+                            _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                         }
                         break;
                     default:

--
Gitblit v1.9.3