wangxinhui
2025-03-19 d8db1698c125618c1b5f62b009204ddc5d4eed5a
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs
@@ -29,6 +29,29 @@
            _taskService = taskService;
            _taskRepository = taskRepository;
        }
        [HttpPost, HttpGet, Route("AGVFinish"), AllowAnonymous]
        public WebResponseContent AGVFinish(string barcode)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var task = _taskRepository.QueryFirst(x => x.PalletCode == barcode);
                if (task == null) throw new Exception($"未找到任务,托盘号【{barcode}】");
                AgvUpdateDTO updateDTO = new AgvUpdateDTO()
                {
                    TaskCode = task.AgvTaskNum,
                    Method = "end"
                };
                var agvResponseContent = CtuCallback(updateDTO);
                if (agvResponseContent.Code == "1") throw new Exception(agvResponseContent.Message);
                content.OK();
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
        #region å®‰å…¨ä¿¡å·ç”³è¯·
        /// <summary>
@@ -84,10 +107,35 @@
                var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum);
                if (task == null) throw new Exception($"未找到任务,任务号【{agvUpdateModel.TaskCode}】");
                if (agvUpdateModel.Method == "end")
                switch (agvUpdateModel.Method)
                {
                    if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) PutFinish(task.NextAddress);
                    _taskService.TaskCompleted(task.TaskNum);
                    case "end":
                        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())
                        {
                            _taskService.UpdateTask(task,TaskStatusEnum.AGV_WaitToExecute);
                        }
                        break;
                    case "applyFromAgv":
                        //更改成品出AGV放货任务状态
                        if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
                        {
                            _taskService.UpdateTask(task, TaskStatusEnum.AGV_WaitToExecute);
                        }
                        break;
                    case "outbin":
                        if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
                        {
                            TakeFinish(task.CurrentAddress);
                        }
                        break;
                    default:
                        break;
                }
                agvResponseContent.Code = "0";
                agvResponseContent.Message = "成功";