终端一体化运控平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

576 linhas
34 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Net;
  7. using System.Web;
  8. using Newtonsoft.Json;
  9. using System.Net.Http;
  10. using System.Configuration;
  11. using System.Security.Cryptography;
  12. namespace BPASmartClient.AGV
  13. {
  14. public class AGVHelper
  15. {
  16. public static AGVHelper _Instance { get; set; }
  17. public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper());
  18. public AGVHelper()
  19. {
  20. }
  21. /// <summary>
  22. /// 获取配置文件信息
  23. /// </summary>
  24. /// <param name="strKey"></param>
  25. /// <returns></returns>
  26. public string GetAppSettingValue(string strKey)
  27. {
  28. string file = System.Environment.CurrentDirectory;
  29. Configuration config = ConfigurationManager.OpenExeConfiguration(file);
  30. foreach (string key in config.AppSettings.Settings.AllKeys)
  31. {
  32. if (key == strKey)
  33. {
  34. return config.AppSettings.Settings[strKey].Value.ToString();
  35. }
  36. }
  37. return null;
  38. }
  39. public string HttpRequest(string url, string head, string body)
  40. {
  41. return PostData(url, head, body);
  42. }
  43. public string PostData(string url, string head, string body)
  44. {
  45. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  46. request.Method = "POST";
  47. request.Headers["header"] = head;
  48. request.Proxy = null;
  49. byte[] bytes = Encoding.UTF8.GetBytes(body);
  50. request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式
  51. //request.ContentType = "application/json";
  52. request.ContentLength = bytes.Length;
  53. Stream myResponseStream = request.GetRequestStream();
  54. myResponseStream.Write(bytes, 0, bytes.Length);
  55. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  56. StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);//解码
  57. string retString = myStreamReader.ReadToEnd();
  58. myStreamReader.Close();
  59. myResponseStream.Close();
  60. if (response != null)
  61. {
  62. response.Close();
  63. }
  64. if (request != null)
  65. {
  66. request.Abort();
  67. }
  68. return retString;//返回响应报文
  69. }
  70. /// <summary>
  71. /// MD5哈希摘要转16进制
  72. /// </summary>
  73. /// <param name="body"></param>
  74. /// <returns></returns>
  75. public string MD5Deal(string body)
  76. {
  77. //如果启用签名 用MD5 哈希摘要 再转16进制
  78. MD5 md5 = MD5.Create();
  79. byte[] bte = md5.ComputeHash(Encoding.UTF8.GetBytes(body));
  80. StringBuilder build = new StringBuilder();
  81. for (int i = 0; i < bte.Length; i++)
  82. {
  83. build.Append(bte[i].ToString("X"));
  84. }
  85. return build.ToString();
  86. }
  87. /// <summary>
  88. /// AGV去1号线体装桶
  89. /// </summary>
  90. /// <returns></returns>
  91. public string AgvToLineOneLoadRoller(string robotJobId)
  92. {
  93. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  94. ////请求报文头
  95. //HttpRequestHeaderModel.GetInstance.appKey = "";
  96. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  97. //HttpRequestHeaderModel.GetInstance.requestId = "";
  98. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  99. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  100. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  101. ////请求报文体
  102. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  103. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  104. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  105. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  106. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  107. ////详细任务数据
  108. ////点到点
  109. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  110. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  111. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  112. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  113. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  114. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  115. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  116. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  117. //// string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求
  118. ////货位到货位
  119. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  120. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  121. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  122. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  123. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  124. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  125. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  126. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  127. ////启用签名
  128. ////url = url + "?sign=" + MD5Deal(body);
  129. //string data = HttpRequest(url, head, body);
  130. //object objData = JsonConvert.DeserializeObject(data);
  131. //if (objData != null && objData is HttpResponseBodyModel response)
  132. //{
  133. // return response.code;
  134. //}
  135. return "Analysis Error";
  136. }
  137. /// <summary>
  138. /// AGV去2号线体装桶
  139. /// </summary>
  140. /// <returns></returns>
  141. public string AgvToLineTwoLoadRoller(string robotJobId)
  142. {
  143. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  144. ////请求报文头
  145. //HttpRequestHeaderModel.GetInstance.appKey = "";
  146. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  147. //HttpRequestHeaderModel.GetInstance.requestId = "";
  148. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  149. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  150. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  151. ////请求报文体
  152. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  153. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  154. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  155. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  156. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  157. ////详细任务数据
  158. ////点到点
  159. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  160. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  161. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  162. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  163. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  164. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  165. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  166. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  167. ////货位到货位
  168. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  169. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  170. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  171. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  172. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  173. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  174. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  175. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  176. ////启用签名
  177. ////url = url + "?sign=" + MD5Deal(body);
  178. //string data= HttpRequest(url, head, body);
  179. //object objData = JsonConvert.DeserializeObject(data);
  180. //if (objData != null && objData is HttpResponseBodyModel response)
  181. //{
  182. // return response.code;
  183. //}
  184. return "Analysis Error";
  185. }
  186. /// <summary>
  187. /// AGV去3号线体装桶
  188. /// </summary>
  189. /// <returns></returns>
  190. public string AgvToLineThreeLoadRoller(string robotJobId)
  191. {
  192. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  193. ////请求报文头
  194. //HttpRequestHeaderModel.GetInstance.appKey = "";
  195. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  196. //HttpRequestHeaderModel.GetInstance.requestId = "";
  197. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  198. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  199. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  200. ////请求报文体
  201. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  202. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  203. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  204. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  205. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  206. ////详细任务数据
  207. ////点到点
  208. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  209. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  210. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  211. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  212. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  213. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  214. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  215. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  216. ////货位到货位
  217. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  218. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  219. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  220. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  221. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  222. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  223. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  224. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  225. ////启用签名
  226. ////url = url + "?sign=" + MD5Deal(body);
  227. //string data = HttpRequest(url, head, body);
  228. //object objData = JsonConvert.DeserializeObject(data);
  229. //if (objData != null && objData is HttpResponseBodyModel response)
  230. //{
  231. // return response.code;
  232. //}
  233. return "Analysis Error";
  234. }
  235. /// <summary>
  236. /// AGV离开炒锅1
  237. /// </summary>
  238. /// <returns></returns>
  239. public string AgvLeaveFryPotOne(string robotJobId)
  240. {
  241. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  242. ////请求报文头
  243. //HttpRequestHeaderModel.GetInstance.appKey = "";
  244. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  245. //HttpRequestHeaderModel.GetInstance.requestId = "";
  246. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  247. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  248. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  249. ////请求报文体
  250. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  251. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  252. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  253. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  254. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  255. ////详细任务数据
  256. ////点到点
  257. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  258. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  259. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  260. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  261. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  262. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  263. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  264. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  265. ////货位到货位
  266. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  267. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  268. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  269. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  270. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  271. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  272. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  273. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  274. ////启用签名
  275. ////url = url + "?sign=" + MD5Deal(body);
  276. //string data = HttpRequest(url, head, body);
  277. //object objData = JsonConvert.DeserializeObject(data);
  278. //if (objData != null && objData is HttpResponseBodyModel response)
  279. //{
  280. // return response.code;
  281. //}
  282. return "Analysis Error";
  283. }
  284. /// <summary>
  285. /// AGV离开炒锅2
  286. /// </summary>
  287. /// <returns></returns>
  288. public string AgvLeaveFryPotTwo(string robotJobId)
  289. {
  290. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  291. ////请求报文头
  292. //HttpRequestHeaderModel.GetInstance.appKey = "";
  293. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  294. //HttpRequestHeaderModel.GetInstance.requestId = "";
  295. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  296. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  297. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  298. ////请求报文体
  299. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  300. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  301. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  302. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  303. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  304. ////详细任务数据
  305. ////点到点
  306. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  307. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  308. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  309. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  310. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  311. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  312. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  313. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  314. ////货位到货位
  315. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  316. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  317. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  318. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  319. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  320. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  321. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  322. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  323. ////启用签名
  324. ////url = url + "?sign=" + MD5Deal(body);
  325. //string data = HttpRequest(url, head, body);
  326. //object objData = JsonConvert.DeserializeObject(data);
  327. //if (objData != null && objData is HttpResponseBodyModel response)
  328. //{
  329. // return response.code;
  330. //}
  331. return "Analysis Error";
  332. }
  333. /// <summary>
  334. /// AGV离开炒锅3
  335. /// </summary>
  336. /// <returns></returns>
  337. public string AgvLeaveFryPotThree(string robotJobId)
  338. {
  339. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  340. ////请求报文头
  341. //HttpRequestHeaderModel.GetInstance.appKey = "";
  342. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  343. //HttpRequestHeaderModel.GetInstance.requestId = "";
  344. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  345. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  346. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  347. ////请求报文体
  348. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  349. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  350. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  351. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  352. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  353. ////详细任务数据
  354. ////点到点
  355. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  356. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  357. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  358. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  359. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  360. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  361. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  362. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  363. ////货位到货位
  364. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  365. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  366. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  367. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  368. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  369. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  370. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  371. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  372. ////启用签名
  373. ////url = url + "?sign=" + MD5Deal(body);
  374. //string data = HttpRequest(url, head, body);
  375. //object objData = JsonConvert.DeserializeObject(data);
  376. //if (objData != null && objData is HttpResponseBodyModel response)
  377. //{
  378. // return response.code;
  379. //}
  380. return "Analysis Error";
  381. }
  382. /// <summary>
  383. /// AGV离开炒锅4
  384. /// </summary>
  385. /// <returns></returns>
  386. public string AgvLeaveFryPotFour(string robotJobId)
  387. {
  388. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  389. ////请求报文头
  390. //HttpRequestHeaderModel.GetInstance.appKey = "";
  391. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  392. //HttpRequestHeaderModel.GetInstance.requestId = "";
  393. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  394. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  395. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  396. ////请求报文体
  397. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  398. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  399. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  400. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  401. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  402. ////详细任务数据
  403. ////点到点
  404. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  405. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  406. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  407. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  408. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  409. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  410. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  411. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  412. ////货位到货位
  413. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  414. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  415. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  416. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  417. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  418. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  419. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  420. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  421. ////启用签名
  422. ////url = url + "?sign=" + MD5Deal(body);
  423. //string data = HttpRequest(url, head, body);
  424. //object objData = JsonConvert.DeserializeObject(data);
  425. //if (objData != null && objData is HttpResponseBodyModel response)
  426. //{
  427. // return response.code;
  428. //}
  429. return "Analysis Error";
  430. }
  431. /// <summary>
  432. /// AGV离开炒锅5
  433. /// </summary>
  434. /// <returns></returns>
  435. public string AgvLeaveFryPotFive(string robotJobId)
  436. {
  437. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  438. ////请求报文头
  439. //HttpRequestHeaderModel.GetInstance.appKey = "";
  440. //HttpRequestHeaderModel.GetInstance.appSecret = "";
  441. //HttpRequestHeaderModel.GetInstance.requestId = "";
  442. //HttpRequestHeaderModel.GetInstance.timestamp = "";
  443. //HttpRequestHeaderModel.GetInstance.version = "2.8";
  444. //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  445. ////请求报文体
  446. //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
  447. //AGVModel.GetInstance.warehouseId = 123; //仓库编号
  448. //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
  449. //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  450. //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  451. ////详细任务数据
  452. ////点到点
  453. //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
  454. //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
  455. //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  456. //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  457. //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  458. //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  459. //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
  460. //string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  461. ////货位到货位
  462. ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
  463. ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
  464. ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  465. ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  466. ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  467. ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  468. ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
  469. ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
  470. ////启用签名
  471. ////url = url + "?sign=" + MD5Deal(body);
  472. //string data = HttpRequest(url, head, body);
  473. //object objData = JsonConvert.DeserializeObject(data);
  474. //if (objData != null && objData is HttpResponseBodyModel response)
  475. //{
  476. // return response.code;
  477. //}
  478. return "Analysis Error";
  479. }
  480. /// <summary>
  481. /// 任务取消
  482. /// </summary>
  483. /// <param name="robotJobId">上游系统任务号,全局唯一</param>
  484. public string CancelJobTask(string robotJobId)
  485. {
  486. string url = AGVRequestUrl.GetInstance.TaskCancelUrl;
  487. //请求报文头
  488. HttpRequestHeaderModel.GetInstance.appKey = "";
  489. HttpRequestHeaderModel.GetInstance.appSecret = "";
  490. HttpRequestHeaderModel.GetInstance.requestId = "";
  491. HttpRequestHeaderModel.GetInstance.timestamp = "";
  492. HttpRequestHeaderModel.GetInstance.version = "2.8";
  493. string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  494. //请求报文体
  495. AGVTaskCancelModel.GetInstance.robotJobId = robotJobId;
  496. AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号
  497. string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance);
  498. //启用签名
  499. //url = url + "?sign=" + MD5Deal(body);
  500. string data = HttpRequest(url, head, body);
  501. object objData = JsonConvert.DeserializeObject(data);
  502. if (objData != null && objData is HttpResponseBodyModel response)
  503. {
  504. return response.code;
  505. }
  506. return "Analysis Error";
  507. }
  508. /// <summary>
  509. /// 实操任务完成通知
  510. /// </summary>
  511. /// <returns></returns>
  512. public string TaskCompleteNotify(string robotJobId)
  513. {
  514. string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
  515. //请求报文头
  516. HttpRequestHeaderModel.GetInstance.appKey = "";
  517. HttpRequestHeaderModel.GetInstance.appSecret = "";
  518. HttpRequestHeaderModel.GetInstance.requestId = "";
  519. HttpRequestHeaderModel.GetInstance.timestamp = "";
  520. HttpRequestHeaderModel.GetInstance.version = "2.8";
  521. string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  522. //请求报文体
  523. AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId;
  524. AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号
  525. string body = JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance);
  526. //启用签名
  527. //url = url + "?sign=" + MD5Deal(body);
  528. string data = HttpRequest(url, head, body);
  529. object objData = JsonConvert.DeserializeObject(data);
  530. if (objData != null && objData is HttpResponseBodyModel response)
  531. {
  532. return response.code;
  533. }
  534. return "Analysis Error";
  535. }
  536. /// <summary>
  537. /// AGV上下料交互反馈
  538. /// </summary>
  539. /// <param name="agvCode">AGV编号</param>
  540. /// <param name="jobId">任务编号</param>
  541. /// <param name="msgId">消息编号</param>
  542. /// <returns></returns>
  543. public string UpDownFeedBack(string agvCode, string jobId, string msgId)
  544. {
  545. string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
  546. //请求报文头
  547. HttpRequestHeaderModel.GetInstance.appKey = "";
  548. HttpRequestHeaderModel.GetInstance.appSecret = "";
  549. HttpRequestHeaderModel.GetInstance.requestId = "";
  550. HttpRequestHeaderModel.GetInstance.timestamp = "";
  551. HttpRequestHeaderModel.GetInstance.version = "2.8";
  552. string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
  553. //请求报文体
  554. AGVLoadInteracteModel.GetInstance.agvCode = agvCode;
  555. AGVLoadInteracteModel.GetInstance.jobId = jobId;
  556. AGVLoadInteracteModel.GetInstance.msgId = msgId;
  557. string body = JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance);
  558. //启用签名
  559. //url = url + "?sign=" + MD5Deal(body);
  560. string data = HttpRequest(url, head, body);
  561. object objData = JsonConvert.DeserializeObject(data);
  562. if (objData != null && objData is HttpResponseBodyModel response)
  563. {
  564. return response.code;
  565. }
  566. return "Analysis Error";
  567. }
  568. }
  569. }