using System; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using MainForm.ClassFile.XiaomiAPI_MES; using static MainForm.ClassFile.XiaomiAPI_AGV.XiaomiAGVHttp_Response; namespace MainForm.ClassFile.XiaomiAPI_AGV { /// /// 小米AGV(x5协议)- 空容器补给请求接⼝ /// SMT⽣产过程中呼叫空箱,AGV配送空容器到 SMT下料⼝ /// 如:‘Tray盘下料装备’站 上料 /// 接⼝地址:${HOST}/x5/task/callEmptyContainer/create /// 接口方法:callEmptyContainer /// public class XiaomiAGVHttp_CallEmptyContainerLoading : XiaomiMESHttp_X5 { #region 变量 /// /// 接口地址 /// protected new static string MESUrl { set; get; } = string.Format($"Http://{0}/x5/task/callEmptyContainer/create", GlobalContext.AGVHttpHost); /// /// 接口方法 /// protected new static string Method { set; get; } = "callEmptyContainer"; #endregion 变量 /// /// 请求空容器补给 /// public XiaomiAGVHttp_Response Call(XmAGVCallEmptyContainerLoadingRequest_Body body) { XiaomiAGVHttp_Response agvResponse = new XiaomiAGVHttp_Response(); string bodyJson = JsonConvert.SerializeObject(body); XiaomiMES_X5RequestHeader header = new XiaomiMES_X5RequestHeader(); header.AppId = Appid; // 系统分配的应⽤ID header.Method = Method; // API接⼝名称 header.Sign = GetSign_Up(Appid, bodyJson, Appkey); // md5签名 header.Url = MESUrl; // 接⼝地址 XmAGVCallEmptyContainerLoadingRequest request = new XmAGVCallEmptyContainerLoadingRequest(); request.header = header; request.body = body; string data = JsonConvert.SerializeObject(request); XiaomiMES_X5Response response = Post(MESUrl, data); // ZS保存日志 agvResponse.header = response.header; string responseBody = response.body; agvResponse.body = JsonConvert.DeserializeObject(responseBody); return agvResponse; } #region 入参 /// /// 空容器补给请求接⼝ - 入参 /// public class XmAGVCallEmptyContainerLoadingRequest { /// /// 报文头(Header) /// public XiaomiMES_X5RequestHeader header { get; set; } = new XiaomiMES_X5RequestHeader(); /// /// 报文内容(Body) /// public XmAGVCallEmptyContainerLoadingRequest_Body body { get; set; } = new XmAGVCallEmptyContainerLoadingRequest_Body(); } /// /// 空容器补给请求接⼝ - 入参 - Body /// public class XmAGVCallEmptyContainerLoadingRequest_Body { /// /// 任务类型;非必填 /// 默认:NG: NG料盘呼叫任务 /// public string taskType { get; set; } = string.Empty; /// /// 容器类型;非必填 /// public string containerType { get; set; } = string.Empty; /// /// 起始点;非必填 /// public string startingContainerCode { get; set; } = string.Empty; /// /// 起始区域;非必填 /// public string startingArea { get; set; } = string.Empty; /// /// ⽬标区域;非必填 /// public string targetArea { get; set; } = string.Empty; /// /// ⽬标点:料站点(接驳⼝) /// public string targetContainerCode { get; set; } = string.Empty; } #endregion 入参 } }