wangxinhui
2026-01-12 541572199581a80979ec3b62245eb522542a7b15
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs
@@ -149,5 +149,30 @@
            }
            
        }
        public WebResponseContent AgvCancelTask(AgvTaskCancelDTO taskModel, APIEnum SendTask = APIEnum.AgvTaskCancel)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == SendTask.ToString())?.ApiAddress;
                if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"未找到发送AGV任务接口,请检查接口配置");
                string request = JsonConvert.SerializeObject(taskModel, settings);
                string response = HttpHelper.Post(apiAddress, request);
                AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>() ?? throw new Exception("AGV任务发送未返回结果");
                if (agvContent.Success)
                {
                    content.OK();
                }
                else
                {
                    content.Error(agvContent.Message);
                }
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}