xiazhengtongxue
2026-01-23 f65bfbd6e84fdffc71353acfe7c9ccca5b117c45
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
using System.Text;
using System.Text.RegularExpressions;
using WIDESEA_DTO.Agv;
@@ -62,6 +63,14 @@
                    case nameof(AGVStatusEnum.PICKER_RECEIVE):
                        if (task == null) throw new Exception($"未找到料箱【{agvUpdateDTO.ContainerCode}】任务");
                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_TakeFinish);
                        Dt_ErrorInfo e1 = new Dt_ErrorInfo()
                        {
                            RobotCode = agvUpdateDTO.RobotId,
                            Message = agvUpdateDTO.Message,
                            ErrorType = 0
                        };
                        _taskService.AgvSearchStatus1(e1);
                        break;
                    case nameof(AGVStatusEnum.PICKER_SEND):
                        if (task == null) throw new Exception($"未找到料箱【{agvUpdateDTO.ContainerCode}】任务");
@@ -74,6 +83,13 @@
                        {
                            _taskService.TaskCompleted(task.TaskNum);
                        }
                        Dt_ErrorInfo e2 = new Dt_ErrorInfo()
                        {
                            RobotCode = agvUpdateDTO.RobotId,
                            Message = agvUpdateDTO.Message,
                            ErrorType = 0
                        };
                        _taskService.AgvSearchStatus1(e2);
                        break;
                    case nameof(AGVStatusEnum.WAITFEEDBACK):
                        //AGV放行
@@ -83,10 +99,39 @@
                            WebResponseContent responseContent = _taskService.AgvTaskFlow(agvUpdateDTO.MissionCode);
                            if (!responseContent.Status) throw new Exception($"{responseContent.Message}");
                        }
                        Dt_ErrorInfo e3 = new Dt_ErrorInfo()
                        {
                            RobotCode = agvUpdateDTO.RobotId,
                            Message = agvUpdateDTO.Message,
                            ErrorType = 0
                        };
                        _taskService.AgvSearchStatus1(e3);
                        break;
                    default:
                        break;
                }
                if (agvUpdateDTO.Message != null && agvUpdateDTO.Message == "ROBOT_ERROR-haiUnknownError")
                {
                    var task1 = _taskRepository.QueryFirst(x => (agvUpdateDTO.MissionCode ?? "") == x.GroupId);
                    if (task1 == null) throw new Exception($"未找到料箱【{agvUpdateDTO.ContainerCode}】任务");
                    Dt_ErrorInfo errorInfo = new Dt_ErrorInfo()
                    {
                        RobotCode = agvUpdateDTO.RobotId,
                        Message = agvUpdateDTO.Message,
                        ErrorType = 2
                    };
                    if (task1.TaskType == 500)
                    {
                        errorInfo.Message = "入库异常";
                        errorInfo.StationCode = task1.CurrentAddress;
                    }
                    else
                    {
                        errorInfo.Message = "出库异常";
                        errorInfo.StationCode = task1.NextAddress;
                    }
                    _taskService.AgvSearchStatus1(errorInfo);
                }
                content.OK();
            }
            catch (Exception ex)