using Autofac.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_DTO.Agv; using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.Agv; namespace WIDESEAWCS_TaskInfoService { public partial class TaskService { public WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask) { WebResponseContent content = new WebResponseContent(); try { string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SendTask.ToString())?.ApiAddress; if (string.IsNullOrEmpty(apiAddress)) return WebResponseContent.Instance.Error($"未找到发送AGV任务接口,请检查接口配置"); string response = HttpHelper.Post(apiAddress, taskModel.Serialize()); AgvResponseContent agvContent = response.DeserializeObject(); if (agvContent.Code == "0") { content.OK(data: agvContent.Data); } else { content.Error(agvContent.Message); } } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// AGV确认完成接口(取放) /// /// /// public WebResponseContent AGVFinish(AgvFinishDTO agvFinishDTO) { WebResponseContent content = new WebResponseContent(); try { string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.AgvFinish.ToString())?.ApiAddress; if (string.IsNullOrEmpty(apiAddress)) return WebResponseContent.Instance.Error($"未找到发送AGV任务接口,请检查接口配置"); string response = HttpHelper.Post(apiAddress, agvFinishDTO.Serialize()); AgvFinishResponse agvContent = response.DeserializeObject(); if (agvContent.Success) { content.OK(); } else { content.Error(agvContent.Content); } } catch (Exception ex) { content.Error(ex.Message); } return content; } } }