wangxinhui
2025-11-30 f2b85c65234e0dcdd3fcce4dafbe16933b7f1b48
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Autofac.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Text;
@@ -43,7 +44,38 @@
            _taskRepository = taskRepository;
            _routerRepository = routerRepository;
        }
        /// <summary>
        /// AGV任务更新
        /// </summary>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("Callback"), AllowAnonymous]
        public WebResponseContent? Callback([FromBody]AgvUpdateDTO agvUpdateDTO)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var task = _taskRepository.QueryFirst(x => agvUpdateDTO.ContainerCode==x.PalletCode) ?? throw new Exception($"未找到料箱【{agvUpdateDTO.ContainerCode}】任务");
                switch (agvUpdateDTO.MissionStatus)
                {
                    case nameof(AGVStatusEnum.PICKER_RECEIVE):
                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_TakeFinish);
                        break;
                    case nameof(AGVStatusEnum.PICKER_SEND):
                        //WebResponseContent responseContent = _taskService.AgvTaskFlow(task.PalletCode);
                        //if (!responseContent.Status) throw new Exception($"{responseContent.Message}");
                        _taskService.TaskCompleted(task.TaskNum);
                        break;
                    default:
                        break;
                }
                content.OK();
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
        
    }
}