终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

89 rader
2.5 KiB

  1. using BPASmartClient.AGV.Feedback;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Microsoft.AspNetCore.SignalR;
  4. using Newtonsoft.Json;
  5. using System.Diagnostics;
  6. using System.Text;
  7. namespace BPASmartClient.AgvApi.Controllers
  8. {
  9. [ApiController]
  10. [Route("apicallback/quicktron/[Controller]")]
  11. public class robotjobController : ControllerBase
  12. {
  13. /// <summary>
  14. /// 搬运任务状态上报
  15. /// </summary>
  16. /// <param name="sign"></param>
  17. /// <returns></returns>
  18. [HttpPost("report")]
  19. public async Task<string> report()
  20. {
  21. //if (sign != null)
  22. //{
  23. try
  24. {
  25. using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
  26. {
  27. string body = await reader.ReadToEndAsync();
  28. AGVToUpSystem s = JsonConvert.DeserializeObject<AGVToUpSystem>(body);
  29. if (s != null)
  30. {
  31. await Factory.GetInstance.SendReport(s);
  32. return "SUCCESS";
  33. }
  34. }
  35. //var res = JsonConvert.DeserializeObject<AGVToUpSystem>(sign);
  36. //if (res != null)
  37. //{
  38. // Factory.GetInstance.SendReport(res);
  39. // return "SUCCESS";
  40. //}
  41. }
  42. catch (Exception ex)
  43. {
  44. return ex.ToString();
  45. }
  46. // }
  47. return "Error";
  48. }
  49. /// <summary>
  50. /// AGV上下料交互请求接口
  51. /// </summary>
  52. /// <param name="sign"></param>
  53. /// <returns></returns>
  54. [HttpPost("upstreamrequest")]
  55. public async Task<string> upstreamrequest()
  56. {
  57. //if (sign != null)
  58. //{
  59. try
  60. {
  61. using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
  62. {
  63. string body = await reader.ReadToEndAsync();
  64. var res = JsonConvert.DeserializeObject<Upstreamrequest>(body);
  65. if (res != null)
  66. {
  67. await Factory.GetInstance.SendUpstreamrequest(res);
  68. return "SUCCESS";
  69. }
  70. }
  71. }
  72. catch (Exception ex)
  73. {
  74. return ex.ToString();
  75. }
  76. // }
  77. return "Error";
  78. }
  79. }
  80. }