AgvApi.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using ServiceCenter.WebApi;
  2. using WCS.WorkEngineering.WebApi.Models.AGV;
  3. using WCS.WorkEngineering.WebApi.Models.AGV.Request;
  4. using WCS.WorkEngineering.WebApi.Models.AGV.Response;
  5. using WCS.WorkEngineering.Worlds.Logs;
  6. namespace WCS.WorkEngineering.WebApi.Controllers
  7. {
  8. /// <summary>
  9. /// AGV接口
  10. /// </summary>
  11. public static class AgvApi
  12. {
  13. /// <summary>
  14. /// AGV地址
  15. /// </summary>
  16. public static string AgvUrl = null!;
  17. //public static GenAgvSchedulingTaskResponse GenAgvSchedulingTask()
  18. //{
  19. // var res = APICaller.CallApi2<ContinueTaskResponse>(AgvUrl + "/hikRpcService/continueTask", new ContinueTaskRequest
  20. // {
  21. // reqCode = Guid.NewGuid().ToString(),
  22. // taskCode = taskCode,
  23. // type = "00",
  24. // nextPositionCode = nextPositionCode
  25. // });
  26. // if (res.code != AgvContinueTaskResponseCode.Success)
  27. // {
  28. // throw new KnownException(res.message, LogLevelEnum.High);
  29. // }
  30. // return res;
  31. //}
  32. /// <summary>
  33. /// 继续执行任务
  34. /// </summary>
  35. /// <param name="taskCode">AGV任务号</param>
  36. /// <param name="nextPositionCode">下一个地址</param>
  37. /// <returns>接口返回结果</returns>
  38. /// <exception cref="KnownException"></exception>
  39. public static ContinueTaskResponse ContinueTask(string taskCode, string nextPositionCode)
  40. {
  41. var res = APICaller.CallApi2<ContinueTaskResponse>(AgvUrl + "/hikRpcService/continueTask", new ContinueTaskRequest
  42. {
  43. reqCode = Guid.NewGuid().ToString(),
  44. taskCode = taskCode,
  45. type = "00",
  46. nextPositionCode = nextPositionCode
  47. });
  48. if (res.code != AgvResponseCode.Success)
  49. {
  50. throw new KnownException(res.message, LogLevelEnum.High);
  51. }
  52. return res;
  53. }
  54. }
  55. }