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 { /// /// 搬运任务状态上报 /// /// /// [HttpPost("report")] public async Task report() { //if (sign != null) //{ try { using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { string body = await reader.ReadToEndAsync(); AGVToUpSystem s = JsonConvert.DeserializeObject(body); if (s != null) { await Factory.GetInstance.SendReport(s); return "SUCCESS"; } } //var res = JsonConvert.DeserializeObject(sign); //if (res != null) //{ // Factory.GetInstance.SendReport(res); // return "SUCCESS"; //} } catch (Exception ex) { return ex.ToString(); } // } return "Error"; } /// /// AGV上下料交互请求接口 /// /// /// [HttpPost("upstreamrequest")] public async Task upstreamrequest() { //if (sign != null) //{ try { using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { string body = await reader.ReadToEndAsync(); var res = JsonConvert.DeserializeObject(body); if (res != null) { await Factory.GetInstance.SendUpstreamrequest(res); return "SUCCESS"; } } } catch (Exception ex) { return ex.ToString(); } // } return "Error"; } } }