|
- 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;
- using System.Security.Cryptography;
-
- namespace BPASmartClient.AGV
- {
- public class AGVHelper
- {
- public static AGVHelper _Instance { get; set; }
- public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper());
-
- Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
- //根据Key读取<add>元素的Value
- // string name = config.AppSettings.Settings["name"].Value;
-
- public AGVHelper()
- {
-
- }
-
- 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 = null;
- 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;//返回响应报文
- }
- /// <summary>
- /// MD5哈希摘要转16进制
- /// </summary>
- /// <param name="body"></param>
- /// <returns></returns>
- public string MD5Deal(string body)
- {
- //如果启用签名 用MD5 哈希摘要 再转16进制
- MD5 md5 = MD5.Create();
- byte[] bte = md5.ComputeHash(Encoding.UTF8.GetBytes(body));
- StringBuilder build = new StringBuilder();
- for (int i = 0; i < bte.Length; i++)
- {
- build.Append(bte[i].ToString("X"));
- }
-
- return build.ToString();
- }
- /// <summary>
- /// AGV去1号线体装桶
- /// </summary>
- /// <returns></returns>
- public string AgvToLineOneLoadRoller(string robotJobId)
- {
- //bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取
- string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- //请求报文头
- HttpRequestHeaderModel httpHeader=new HttpRequestHeaderModel();
- httpHeader.appKey = "";
- httpHeader.appSecret = "";
- httpHeader.requestId = "";
- httpHeader.timestamp = "";
- httpHeader.version = "2.8";
- string head = JsonConvert.SerializeObject(httpHeader);
- //请求报文体
- AGVModel httpModel = new AGVModel();
- httpModel.robotJobId = robotJobId;//上游提供
- httpModel.warehouseId = 123; //仓库编号
- httpModel.jobPriority = 1;//任务执行的优先级
- httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- //详细任务数据
- //点到点
- AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- httpJobData.startPoint = "";//起点点位
- httpJobData.endPoint = "";//目的点位
- httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- httpModel.jobData = httpJobData;
- string body = JsonConvert.SerializeObject(httpModel);
- // string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求
-
- //货位到货位
- //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- //httpSlotJobData.startSlotCode = "";//起点槽位编号
- //httpSlotJobData.endSlotCode = "";//目的槽位编号
- //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpSlotJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpSlotJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpSlotJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- //启用签名
- //url = url + "?sign=" + MD5Deal(body);
- string data = HttpRequest(url, head, body);
- object objData = JsonConvert.DeserializeObject(data);
- if (objData != null && objData is HttpResponseBodyModel response)
- {
- return response.code;
- }
- return "Analysis Error";
- }
- /// <summary>
- /// AGV去2号线体装桶
- /// </summary>
- /// <returns></returns>
- public string AgvToLineTwoLoadRoller(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- // HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- // AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data= HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV去3号线体装桶
- /// </summary>
- /// <returns></returns>
- public string AgvToLineThreeLoadRoller(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel=new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData=new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV从清洗台到4号线体卸桶
- /// </summary>
- /// <returns></returns>
- public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV离开炒锅1
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveFryPotOne(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV离开炒锅2
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveFryPotTwo(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV离开炒锅3
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveFryPotThree(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV离开炒锅4
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveFryPotFour(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV离开炒锅5
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveFryPotFive(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
-
- /// <summary>
- /// AGV从1号线运空桶洗桶
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveLOneToClean(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV从2号线运空桶洗桶
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveLTwoToClean(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV从3号线运空桶洗桶
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveLThreeToClean(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// AGV从洗桶处运桶到4号洗桶线
- /// </summary>
- /// <returns></returns>
- public string AgvLeaveCleanToLFour(string robotJobId)
- {
- //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
- ////请求报文头
- //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- //httpHeader.appKey = "";
- //httpHeader.appSecret = "";
- //httpHeader.requestId = "";
- //httpHeader.timestamp = "";
- //httpHeader.version = "2.8";
- //string head = JsonConvert.SerializeObject(httpHeader);
- ////请求报文体
- //AGVModel httpModel = new AGVModel();
- //httpModel.robotJobId = robotJobId;//上游提供
- //httpModel.warehouseId = 123; //仓库编号
- //httpModel.jobPriority = 1;//任务执行的优先级
- //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
- //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
- ////详细任务数据
- ////点到点
- //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
- //httpJobData.startPoint = "";//起点点位
- //httpJobData.endPoint = "";//目的点位
- //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
- //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
- //httpModel.jobData = httpJobData;
- //string body = JsonConvert.SerializeObject(httpModel);
- ////货位到货位
- ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
- ////httpSlotJobData.startSlotCode = "";//起点槽位编号
- ////httpSlotJobData.endSlotCode = "";//目的槽位编号
- ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
- ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
- ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
- ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
- ////httpModel.jobData = httpSlotJobData;
- ////string body = JsonConvert.SerializeObject(httpModel);
- ////启用签名
- ////url = url + "?sign=" + MD5Deal(body);
- //string data = HttpRequest(url, head, body);
- //object objData = JsonConvert.DeserializeObject(data);
- //if (objData != null && objData is HttpResponseBodyModel response)
- //{
- // return response.code;
- //}
- return "Analysis Error";
- }
- /// <summary>
- /// 任务取消
- /// </summary>
- /// <param name="robotJobId">上游系统任务号,全局唯一</param>
- public string CancelJobTask(string robotJobId)
- {
- string url = AGVRequestUrl.GetInstance.TaskCancelUrl;
- //请求报文头
- HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- httpHeader.appKey = "";
- httpHeader.appSecret = "";
- httpHeader.requestId = "";
- httpHeader.timestamp = "";
- httpHeader.version = "2.8";
- string head = JsonConvert.SerializeObject(httpHeader);
- //请求报文体
- AGVTaskCancelModel cancel = new AGVTaskCancelModel();
- cancel.robotJobId = robotJobId;
- cancel.warehouseId = 123;//仓库编号
- string body = JsonConvert.SerializeObject(cancel);
- //启用签名
- //url = url + "?sign=" + MD5Deal(body);
- string data = HttpRequest(url, head, body);
- object objData = JsonConvert.DeserializeObject(data);
- if (objData != null && objData is HttpResponseBodyModel response)
- {
- return response.code;
- }
- return "Analysis Error";
- }
- /// <summary>
- /// 实操任务完成通知
- /// </summary>
- /// <returns></returns>
- public string TaskCompleteNotify(string robotJobId)
- {
- string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
- //请求报文头
- HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- httpHeader.appKey = "";
- httpHeader.appSecret = "";
- httpHeader.requestId = "";
- httpHeader.timestamp = "";
- httpHeader.version = "2.8";
- string head = JsonConvert.SerializeObject(httpHeader);
- //请求报文体
- AGVTaskCompleteNotifyModel notify = new AGVTaskCompleteNotifyModel();
- notify.robotJobId = robotJobId;
- notify.warehouseId = 123;//仓库编号
- string body = JsonConvert.SerializeObject(notify);
- //启用签名
- //url = url + "?sign=" + MD5Deal(body);
- string data = HttpRequest(url, head, body);
- object objData = JsonConvert.DeserializeObject(data);
- if (objData != null && objData is HttpResponseBodyModel response)
- {
- return response.code;
- }
- return "Analysis Error";
- }
- /// <summary>
- /// AGV上下料交互反馈
- /// </summary>
- /// <param name="agvCode">AGV编号</param>
- /// <param name="jobId">任务编号</param>
- /// <param name="msgId">消息编号</param>
- /// <returns></returns>
- public string UpDownFeedBack(string agvCode, string jobId, string msgId)
- {
- string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
- //请求报文头
- HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
- httpHeader.appKey = "";
- httpHeader.appSecret = "";
- httpHeader.requestId = "";
- httpHeader.timestamp = "";
- httpHeader.version = "2.8";
- string head = JsonConvert.SerializeObject(httpHeader);
- //请求报文体
- AGVLoadInteracteModel load = new AGVLoadInteracteModel();
- load.agvCode = agvCode;
- load.jobId = jobId;
- load.msgId = msgId;
- string body = JsonConvert.SerializeObject(load);
- //启用签名
- //url = url + "?sign=" + MD5Deal(body);
- string data = HttpRequest(url, head, body);
- object objData = JsonConvert.DeserializeObject(data);
- if (objData != null && objData is HttpResponseBodyModel response)
- {
- return response.code;
- }
- return "Analysis Error";
- }
- }
- }
|