|
- using BPASmartClient.AGV;
- using BPASmartClient.AGV.Feedback;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.SignalR;
- using Newtonsoft.Json;
- using System.Diagnostics;
- using System.Text;
-
- namespace BPASmartClient.AgvApi.Controllers
- {
- [ApiController]
- [Route("apicallback/quicktron/[Controller]")]
- public class robotjobController : ControllerBase
- {
-
- /// <summary>
- /// 搬运任务状态上报
- /// </summary>
- /// <param name="sign"></param>
- /// <returns></returns>
- [HttpPost("report")]
- public async Task<string> report()
- {
- //if (sign != null)
- //{
- try
- {
- using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
- {
- string body = await reader.ReadToEndAsync();
-
- var res = JsonConvert.DeserializeObject<TaskData>(body);
- var r = res.body.@event;
- if (r != null)
- {
- await Factory.GetInstance.SendReport(r);
- return "Report SUCCESS";
- }
-
- }
- }
- catch (Exception ex)
- {
- return ex.ToString();
- }
- //var res = JsonConvert.DeserializeObject<AGVToUpSystem>(sign);
- // if (res != null)
- // {
- // Factory.GetInstance.SendReport(res);
- // return "SUCCESS";
- // }
- //}
-
-
- //}
- return "Error";
-
- }
-
- /// <summary>
- /// AGV上下料交互请求接口
- /// </summary>
- /// <param name="sign"></param>
- /// <returns></returns>
- [HttpPost("upstreamrequest")]
- public async Task<string> upstreamrequest()
- {
- //if (sign != null)
- //{
- try
- {
- using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
- {
- string body = await reader.ReadToEndAsync();
-
- var res = JsonConvert.DeserializeObject<LoadRequest>(body);
- var r = res.body.@event;
- if (r != null)
- {
- await Factory.GetInstance.SendUpstreamrequest(r);
- //return "UpStream SUCCESS";
- return JsonConvert.SerializeObject(new HttpResponseModel() { header = new HttpResponseHeaderModel { requestId = res.header.requestId,timestamp=DateTime.Now.ToString(),version="2.7" } ,body = new HttpResponseBodyModel() { success = true, code = "SUCCESS", message = "", data = null } });
-
- }
- }
- //var res = JsonConvert.DeserializeObject<Upstreamrequest>(sign);
- //if (res != null)
- //{
- // Factory.GetInstance.SendUpstreamrequest(res);
- // return "SUCCESS";
- //}
- }
- catch (Exception ex)
- {
- return ex.ToString();
- }
-
- //}
- return "Error";
-
- }
-
- }
- }
|