using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net; using System.Web; using Newtonsoft.Json; using System.Net.Http; using System.Configuration; namespace BPASmartClient.AGV { public class AGVHelper { public static AGVHelper _Instance { get; set; } public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper()); public AGVHelper() { } /// /// 获取配置文件信息 /// /// /// public string GetAppSettingValue(string strKey) { string file = System.Environment.CurrentDirectory; Configuration config = ConfigurationManager.OpenExeConfiguration(file); foreach (string key in config.AppSettings.Settings.AllKeys) { if (key == strKey) { return config.AppSettings.Settings[strKey].Value.ToString(); } } return null; } public string HttpRequest(string url, string head, string body) { return PostData(url, head, body); } public string PostData(string url, string head, string body) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.Headers["header"] = head; //request.Proxy = new WebProxy("192.168.1.12",80); byte[] bytes = Encoding.UTF8.GetBytes(body); request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式 //request.ContentType = "application/json"; request.ContentLength = bytes.Length; Stream myResponseStream = request.GetRequestStream(); myResponseStream.Write(bytes, 0, bytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); string retString = myStreamReader.ReadToEnd(); myStreamReader.Close(); myResponseStream.Close(); if (response != null) { response.Close(); } if (request != null) { request.Abort(); } return retString;//返回响应报文 } /// /// AGV去1号线体装桶 /// /// public string AgvToLineOneLoadRoller(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求 ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV去2号线体装桶 /// /// public string AgvToLineTwoLoadRoller(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data= HttpRequest(url, head, body); //object objData= JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV去3号线体装桶 /// /// public string AgvToLineThreeLoadRoller(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV离开炒锅1 /// /// public string AgvLeaveFryPotOne(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV离开炒锅2 /// /// public string AgvLeaveFryPotTwo(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV离开炒锅3 /// /// public string AgvLeaveFryPotThree(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV离开炒锅4 /// /// public string AgvLeaveFryPotFour(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// AGV离开炒锅5 /// /// public string AgvLeaveFryPotFive(string robotJobId) { //string url = AGVRequestUrl.GetInstance.TaskSendUrl; ////请求报文头 //HttpRequestHeaderModel.GetInstance.appKey = ""; //HttpRequestHeaderModel.GetInstance.appSecret = ""; //HttpRequestHeaderModel.GetInstance.requestId = ""; //HttpRequestHeaderModel.GetInstance.timestamp = ""; //HttpRequestHeaderModel.GetInstance.version = "2.8"; //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); ////请求报文体 //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 //AGVModel.GetInstance.warehouseId = 123; //仓库编号 //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE ////详细任务数据 ////点到点 //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); ////货位到货位 ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); //if (objData != null && objData is HttpResponseModel response) //{ // return response.Body?.code; //} return "Analysis Error"; } /// /// 任务取消 /// /// 上游系统任务号,全局唯一 public string CancelJobTask(string robotJobId) { string url = AGVRequestUrl.GetInstance.TaskCancelUrl; //请求报文头 HttpRequestHeaderModel.GetInstance.appKey = ""; HttpRequestHeaderModel.GetInstance.appSecret = ""; HttpRequestHeaderModel.GetInstance.requestId = ""; HttpRequestHeaderModel.GetInstance.timestamp = ""; HttpRequestHeaderModel.GetInstance.version = "2.8"; string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); //请求报文体 AGVTaskCancelModel.GetInstance.robotJobId = robotJobId; AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号 string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseModel response) { return response.Body?.code; } return "Analysis Error"; } /// /// 实操任务完成通知 /// /// public string TaskCompleteNotify(string robotJobId) { string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; //请求报文头 HttpRequestHeaderModel.GetInstance.appKey = ""; HttpRequestHeaderModel.GetInstance.appSecret = ""; HttpRequestHeaderModel.GetInstance.requestId = ""; HttpRequestHeaderModel.GetInstance.timestamp = ""; HttpRequestHeaderModel.GetInstance.version = "2.8"; string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); //请求报文体 AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId; AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号 string body=JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseModel response) { return response.Body?.code; } return "Analysis Error"; } /// /// AGV上下料交互反馈 /// /// AGV编号 /// 任务编号 /// 消息编号 /// public string UpDownFeedBack(string agvCode,string jobId,string msgId) { string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; //请求报文头 HttpRequestHeaderModel.GetInstance.appKey = ""; HttpRequestHeaderModel.GetInstance.appSecret = ""; HttpRequestHeaderModel.GetInstance.requestId = ""; HttpRequestHeaderModel.GetInstance.timestamp = ""; HttpRequestHeaderModel.GetInstance.version = "2.8"; string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); //请求报文体 AGVLoadInteracteModel.GetInstance.agvCode = agvCode; AGVLoadInteracteModel.GetInstance.jobId = jobId; AGVLoadInteracteModel.GetInstance.msgId= msgId; string body=JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseModel response) { return response.Body?.code; } return "Analysis Error"; } } }