终端一体化运控平台
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

868 рядки
46 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. Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  19. //根据Key读取<add>元素的Value
  20. // string name = config.AppSettings.Settings["name"].Value;
  21. public AGVHelper()
  22. {
  23. }
  24. public string HttpRequest(string url, string head, string body)
  25. {
  26. return PostData(url, head, body);
  27. }
  28. public string PostData(string url, string head, string body)
  29. {
  30. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  31. request.Method = "POST";
  32. request.Headers["header"] = head;
  33. request.Proxy = null;
  34. byte[] bytes = Encoding.UTF8.GetBytes(body);
  35. request.ContentType = "application/json; charset=UTF-8"; //窗体数据被编码为名称/值对形式
  36. //request.ContentType = "application/json";
  37. request.ContentLength = bytes.Length;
  38. Stream myResponseStream = request.GetRequestStream();
  39. myResponseStream.Write(bytes, 0, bytes.Length);
  40. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  41. StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);//解码
  42. string retString = myStreamReader.ReadToEnd();
  43. myStreamReader.Close();
  44. myResponseStream.Close();
  45. if (response != null)
  46. {
  47. response.Close();
  48. }
  49. if (request != null)
  50. {
  51. request.Abort();
  52. }
  53. return retString;//返回响应报文
  54. }
  55. /// <summary>
  56. /// MD5哈希摘要转16进制
  57. /// </summary>
  58. /// <param name="body"></param>
  59. /// <returns></returns>
  60. public string MD5Deal(string body)
  61. {
  62. //如果启用签名 用MD5 哈希摘要 再转16进制
  63. MD5 md5 = MD5.Create();
  64. byte[] bte = md5.ComputeHash(Encoding.UTF8.GetBytes(body));
  65. StringBuilder build = new StringBuilder();
  66. for (int i = 0; i < bte.Length; i++)
  67. {
  68. build.Append(bte[i].ToString("X"));
  69. }
  70. return build.ToString();
  71. }
  72. /// <summary>
  73. /// AGV去1号线体装桶
  74. /// </summary>
  75. /// <returns></returns>
  76. public string AgvToLineOneLoadRoller(string robotJobId)
  77. {
  78. //bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取
  79. string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  80. //请求报文头
  81. HttpRequestHeaderModel httpHeader=new HttpRequestHeaderModel();
  82. httpHeader.appKey = "";
  83. httpHeader.appSecret = "";
  84. httpHeader.requestId = "";
  85. httpHeader.timestamp = "";
  86. httpHeader.version = "2.8";
  87. string head = JsonConvert.SerializeObject(httpHeader);
  88. //请求报文体
  89. AGVModel httpModel = new AGVModel();
  90. httpModel.robotJobId = robotJobId;//上游提供
  91. httpModel.warehouseId = 123; //仓库编号
  92. httpModel.jobPriority = 1;//任务执行的优先级
  93. httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  94. httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  95. //详细任务数据
  96. //点到点
  97. AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  98. httpJobData.startPoint = "";//起点点位
  99. httpJobData.endPoint = "";//目的点位
  100. httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  101. httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  102. httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  103. httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  104. httpModel.jobData = httpJobData;
  105. string body = JsonConvert.SerializeObject(httpModel);
  106. // string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求
  107. //货位到货位
  108. //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  109. //httpSlotJobData.startSlotCode = "";//起点槽位编号
  110. //httpSlotJobData.endSlotCode = "";//目的槽位编号
  111. //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  112. //httpSlotJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  113. //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  114. //httpSlotJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  115. //httpModel.jobData = httpSlotJobData;
  116. //string body = JsonConvert.SerializeObject(httpModel);
  117. //启用签名
  118. //url = url + "?sign=" + MD5Deal(body);
  119. string data = HttpRequest(url, head, body);
  120. object objData = JsonConvert.DeserializeObject(data);
  121. if (objData != null && objData is HttpResponseBodyModel response)
  122. {
  123. return response.code;
  124. }
  125. return "Analysis Error";
  126. }
  127. /// <summary>
  128. /// AGV去2号线体装桶
  129. /// </summary>
  130. /// <returns></returns>
  131. public string AgvToLineTwoLoadRoller(string robotJobId)
  132. {
  133. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  134. ////请求报文头
  135. // HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  136. //httpHeader.appKey = "";
  137. //httpHeader.appSecret = "";
  138. //httpHeader.requestId = "";
  139. //httpHeader.timestamp = "";
  140. //httpHeader.version = "2.8";
  141. //string head = JsonConvert.SerializeObject(httpHeader);
  142. ////请求报文体
  143. // AGVModel httpModel = new AGVModel();
  144. //httpModel.robotJobId = robotJobId;//上游提供
  145. //httpModel.warehouseId = 123; //仓库编号
  146. //httpModel.jobPriority = 1;//任务执行的优先级
  147. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  148. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  149. ////详细任务数据
  150. ////点到点
  151. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  152. //httpJobData.startPoint = "";//起点点位
  153. //httpJobData.endPoint = "";//目的点位
  154. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  155. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  156. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  157. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  158. //httpModel.jobData = httpJobData;
  159. //string body = JsonConvert.SerializeObject(httpModel);
  160. ////货位到货位
  161. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  162. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  163. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  164. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  165. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  166. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  167. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  168. ////httpModel.jobData = httpSlotJobData;
  169. ////string body = JsonConvert.SerializeObject(httpModel);
  170. ////启用签名
  171. ////url = url + "?sign=" + MD5Deal(body);
  172. //string data= HttpRequest(url, head, body);
  173. //object objData = JsonConvert.DeserializeObject(data);
  174. //if (objData != null && objData is HttpResponseBodyModel response)
  175. //{
  176. // return response.code;
  177. //}
  178. return "Analysis Error";
  179. }
  180. /// <summary>
  181. /// AGV去3号线体装桶
  182. /// </summary>
  183. /// <returns></returns>
  184. public string AgvToLineThreeLoadRoller(string robotJobId)
  185. {
  186. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  187. ////请求报文头
  188. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  189. //httpHeader.appKey = "";
  190. //httpHeader.appSecret = "";
  191. //httpHeader.requestId = "";
  192. //httpHeader.timestamp = "";
  193. //httpHeader.version = "2.8";
  194. //string head = JsonConvert.SerializeObject(httpHeader);
  195. ////请求报文体
  196. //AGVModel httpModel=new AGVModel();
  197. //httpModel.robotJobId = robotJobId;//上游提供
  198. //httpModel.warehouseId = 123; //仓库编号
  199. //httpModel.jobPriority = 1;//任务执行的优先级
  200. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  201. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  202. ////详细任务数据
  203. ////点到点
  204. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  205. //httpJobData.startPoint = "";//起点点位
  206. //httpJobData.endPoint = "";//目的点位
  207. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  208. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  209. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  210. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  211. //httpModel.jobData = httpJobData;
  212. //string body = JsonConvert.SerializeObject(httpModel);
  213. ////货位到货位
  214. ////AGV_SlotRollerJobData httpSlotJobData=new AGV_SlotRollerJobData();
  215. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  216. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  217. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  218. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  219. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  220. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  221. ////httpModel.jobData = httpSlotJobData;
  222. ////string body = JsonConvert.SerializeObject(httpModel);
  223. ////启用签名
  224. ////url = url + "?sign=" + MD5Deal(body);
  225. //string data = HttpRequest(url, head, body);
  226. //object objData = JsonConvert.DeserializeObject(data);
  227. //if (objData != null && objData is HttpResponseBodyModel response)
  228. //{
  229. // return response.code;
  230. //}
  231. return "Analysis Error";
  232. }
  233. /// <summary>
  234. /// AGV从清洗台到4号线体卸桶
  235. /// </summary>
  236. /// <returns></returns>
  237. public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId)
  238. {
  239. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  240. ////请求报文头
  241. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  242. //httpHeader.appKey = "";
  243. //httpHeader.appSecret = "";
  244. //httpHeader.requestId = "";
  245. //httpHeader.timestamp = "";
  246. //httpHeader.version = "2.8";
  247. //string head = JsonConvert.SerializeObject(httpHeader);
  248. ////请求报文体
  249. //AGVModel httpModel = new AGVModel();
  250. //httpModel.robotJobId = robotJobId;//上游提供
  251. //httpModel.warehouseId = 123; //仓库编号
  252. //httpModel.jobPriority = 1;//任务执行的优先级
  253. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  254. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  255. ////详细任务数据
  256. ////点到点
  257. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  258. //httpJobData.startPoint = "";//起点点位
  259. //httpJobData.endPoint = "";//目的点位
  260. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  261. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  262. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  263. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  264. //httpModel.jobData = httpJobData;
  265. //string body = JsonConvert.SerializeObject(httpModel);
  266. ////货位到货位
  267. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  268. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  269. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  270. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  271. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  272. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  273. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  274. ////httpModel.jobData = httpSlotJobData;
  275. ////string body = JsonConvert.SerializeObject(httpModel);
  276. ////启用签名
  277. ////url = url + "?sign=" + MD5Deal(body);
  278. //string data = HttpRequest(url, head, body);
  279. //object objData = JsonConvert.DeserializeObject(data);
  280. //if (objData != null && objData is HttpResponseBodyModel response)
  281. //{
  282. // return response.code;
  283. //}
  284. return "Analysis Error";
  285. }
  286. /// <summary>
  287. /// AGV离开炒锅1
  288. /// </summary>
  289. /// <returns></returns>
  290. public string AgvLeaveFryPotOne(string robotJobId)
  291. {
  292. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  293. ////请求报文头
  294. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  295. //httpHeader.appKey = "";
  296. //httpHeader.appSecret = "";
  297. //httpHeader.requestId = "";
  298. //httpHeader.timestamp = "";
  299. //httpHeader.version = "2.8";
  300. //string head = JsonConvert.SerializeObject(httpHeader);
  301. ////请求报文体
  302. //AGVModel httpModel = new AGVModel();
  303. //httpModel.robotJobId = robotJobId;//上游提供
  304. //httpModel.warehouseId = 123; //仓库编号
  305. //httpModel.jobPriority = 1;//任务执行的优先级
  306. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  307. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  308. ////详细任务数据
  309. ////点到点
  310. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  311. //httpJobData.startPoint = "";//起点点位
  312. //httpJobData.endPoint = "";//目的点位
  313. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  314. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  315. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  316. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  317. //httpModel.jobData = httpJobData;
  318. //string body = JsonConvert.SerializeObject(httpModel);
  319. ////货位到货位
  320. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  321. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  322. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  323. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  324. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  325. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  326. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  327. ////httpModel.jobData = httpSlotJobData;
  328. ////string body = JsonConvert.SerializeObject(httpModel);
  329. ////启用签名
  330. ////url = url + "?sign=" + MD5Deal(body);
  331. //string data = HttpRequest(url, head, body);
  332. //object objData = JsonConvert.DeserializeObject(data);
  333. //if (objData != null && objData is HttpResponseBodyModel response)
  334. //{
  335. // return response.code;
  336. //}
  337. return "Analysis Error";
  338. }
  339. /// <summary>
  340. /// AGV离开炒锅2
  341. /// </summary>
  342. /// <returns></returns>
  343. public string AgvLeaveFryPotTwo(string robotJobId)
  344. {
  345. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  346. ////请求报文头
  347. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  348. //httpHeader.appKey = "";
  349. //httpHeader.appSecret = "";
  350. //httpHeader.requestId = "";
  351. //httpHeader.timestamp = "";
  352. //httpHeader.version = "2.8";
  353. //string head = JsonConvert.SerializeObject(httpHeader);
  354. ////请求报文体
  355. //AGVModel httpModel = new AGVModel();
  356. //httpModel.robotJobId = robotJobId;//上游提供
  357. //httpModel.warehouseId = 123; //仓库编号
  358. //httpModel.jobPriority = 1;//任务执行的优先级
  359. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  360. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  361. ////详细任务数据
  362. ////点到点
  363. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  364. //httpJobData.startPoint = "";//起点点位
  365. //httpJobData.endPoint = "";//目的点位
  366. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  367. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  368. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  369. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  370. //httpModel.jobData = httpJobData;
  371. //string body = JsonConvert.SerializeObject(httpModel);
  372. ////货位到货位
  373. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  374. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  375. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  376. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  377. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  378. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  379. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  380. ////httpModel.jobData = httpSlotJobData;
  381. ////string body = JsonConvert.SerializeObject(httpModel);
  382. ////启用签名
  383. ////url = url + "?sign=" + MD5Deal(body);
  384. //string data = HttpRequest(url, head, body);
  385. //object objData = JsonConvert.DeserializeObject(data);
  386. //if (objData != null && objData is HttpResponseBodyModel response)
  387. //{
  388. // return response.code;
  389. //}
  390. return "Analysis Error";
  391. }
  392. /// <summary>
  393. /// AGV离开炒锅3
  394. /// </summary>
  395. /// <returns></returns>
  396. public string AgvLeaveFryPotThree(string robotJobId)
  397. {
  398. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  399. ////请求报文头
  400. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  401. //httpHeader.appKey = "";
  402. //httpHeader.appSecret = "";
  403. //httpHeader.requestId = "";
  404. //httpHeader.timestamp = "";
  405. //httpHeader.version = "2.8";
  406. //string head = JsonConvert.SerializeObject(httpHeader);
  407. ////请求报文体
  408. //AGVModel httpModel = new AGVModel();
  409. //httpModel.robotJobId = robotJobId;//上游提供
  410. //httpModel.warehouseId = 123; //仓库编号
  411. //httpModel.jobPriority = 1;//任务执行的优先级
  412. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  413. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  414. ////详细任务数据
  415. ////点到点
  416. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  417. //httpJobData.startPoint = "";//起点点位
  418. //httpJobData.endPoint = "";//目的点位
  419. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  420. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  421. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  422. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  423. //httpModel.jobData = httpJobData;
  424. //string body = JsonConvert.SerializeObject(httpModel);
  425. ////货位到货位
  426. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  427. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  428. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  429. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  430. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  431. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  432. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  433. ////httpModel.jobData = httpSlotJobData;
  434. ////string body = JsonConvert.SerializeObject(httpModel);
  435. ////启用签名
  436. ////url = url + "?sign=" + MD5Deal(body);
  437. //string data = HttpRequest(url, head, body);
  438. //object objData = JsonConvert.DeserializeObject(data);
  439. //if (objData != null && objData is HttpResponseBodyModel response)
  440. //{
  441. // return response.code;
  442. //}
  443. return "Analysis Error";
  444. }
  445. /// <summary>
  446. /// AGV离开炒锅4
  447. /// </summary>
  448. /// <returns></returns>
  449. public string AgvLeaveFryPotFour(string robotJobId)
  450. {
  451. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  452. ////请求报文头
  453. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  454. //httpHeader.appKey = "";
  455. //httpHeader.appSecret = "";
  456. //httpHeader.requestId = "";
  457. //httpHeader.timestamp = "";
  458. //httpHeader.version = "2.8";
  459. //string head = JsonConvert.SerializeObject(httpHeader);
  460. ////请求报文体
  461. //AGVModel httpModel = new AGVModel();
  462. //httpModel.robotJobId = robotJobId;//上游提供
  463. //httpModel.warehouseId = 123; //仓库编号
  464. //httpModel.jobPriority = 1;//任务执行的优先级
  465. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  466. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  467. ////详细任务数据
  468. ////点到点
  469. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  470. //httpJobData.startPoint = "";//起点点位
  471. //httpJobData.endPoint = "";//目的点位
  472. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  473. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  474. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  475. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  476. //httpModel.jobData = httpJobData;
  477. //string body = JsonConvert.SerializeObject(httpModel);
  478. ////货位到货位
  479. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  480. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  481. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  482. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  483. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  484. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  485. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  486. ////httpModel.jobData = httpSlotJobData;
  487. ////string body = JsonConvert.SerializeObject(httpModel);
  488. ////启用签名
  489. ////url = url + "?sign=" + MD5Deal(body);
  490. //string data = HttpRequest(url, head, body);
  491. //object objData = JsonConvert.DeserializeObject(data);
  492. //if (objData != null && objData is HttpResponseBodyModel response)
  493. //{
  494. // return response.code;
  495. //}
  496. return "Analysis Error";
  497. }
  498. /// <summary>
  499. /// AGV离开炒锅5
  500. /// </summary>
  501. /// <returns></returns>
  502. public string AgvLeaveFryPotFive(string robotJobId)
  503. {
  504. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  505. ////请求报文头
  506. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  507. //httpHeader.appKey = "";
  508. //httpHeader.appSecret = "";
  509. //httpHeader.requestId = "";
  510. //httpHeader.timestamp = "";
  511. //httpHeader.version = "2.8";
  512. //string head = JsonConvert.SerializeObject(httpHeader);
  513. ////请求报文体
  514. //AGVModel httpModel = new AGVModel();
  515. //httpModel.robotJobId = robotJobId;//上游提供
  516. //httpModel.warehouseId = 123; //仓库编号
  517. //httpModel.jobPriority = 1;//任务执行的优先级
  518. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  519. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  520. ////详细任务数据
  521. ////点到点
  522. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  523. //httpJobData.startPoint = "";//起点点位
  524. //httpJobData.endPoint = "";//目的点位
  525. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  526. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  527. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  528. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  529. //httpModel.jobData = httpJobData;
  530. //string body = JsonConvert.SerializeObject(httpModel);
  531. ////货位到货位
  532. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  533. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  534. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  535. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  536. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  537. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  538. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  539. ////httpModel.jobData = httpSlotJobData;
  540. ////string body = JsonConvert.SerializeObject(httpModel);
  541. ////启用签名
  542. ////url = url + "?sign=" + MD5Deal(body);
  543. //string data = HttpRequest(url, head, body);
  544. //object objData = JsonConvert.DeserializeObject(data);
  545. //if (objData != null && objData is HttpResponseBodyModel response)
  546. //{
  547. // return response.code;
  548. //}
  549. return "Analysis Error";
  550. }
  551. /// <summary>
  552. /// AGV从1号线运空桶洗桶
  553. /// </summary>
  554. /// <returns></returns>
  555. public string AgvLeaveLOneToClean(string robotJobId)
  556. {
  557. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  558. ////请求报文头
  559. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  560. //httpHeader.appKey = "";
  561. //httpHeader.appSecret = "";
  562. //httpHeader.requestId = "";
  563. //httpHeader.timestamp = "";
  564. //httpHeader.version = "2.8";
  565. //string head = JsonConvert.SerializeObject(httpHeader);
  566. ////请求报文体
  567. //AGVModel httpModel = new AGVModel();
  568. //httpModel.robotJobId = robotJobId;//上游提供
  569. //httpModel.warehouseId = 123; //仓库编号
  570. //httpModel.jobPriority = 1;//任务执行的优先级
  571. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  572. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  573. ////详细任务数据
  574. ////点到点
  575. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  576. //httpJobData.startPoint = "";//起点点位
  577. //httpJobData.endPoint = "";//目的点位
  578. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  579. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  580. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  581. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  582. //httpModel.jobData = httpJobData;
  583. //string body = JsonConvert.SerializeObject(httpModel);
  584. ////货位到货位
  585. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  586. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  587. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  588. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  589. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  590. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  591. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  592. ////httpModel.jobData = httpSlotJobData;
  593. ////string body = JsonConvert.SerializeObject(httpModel);
  594. ////启用签名
  595. ////url = url + "?sign=" + MD5Deal(body);
  596. //string data = HttpRequest(url, head, body);
  597. //object objData = JsonConvert.DeserializeObject(data);
  598. //if (objData != null && objData is HttpResponseBodyModel response)
  599. //{
  600. // return response.code;
  601. //}
  602. return "Analysis Error";
  603. }
  604. /// <summary>
  605. /// AGV从2号线运空桶洗桶
  606. /// </summary>
  607. /// <returns></returns>
  608. public string AgvLeaveLTwoToClean(string robotJobId)
  609. {
  610. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  611. ////请求报文头
  612. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  613. //httpHeader.appKey = "";
  614. //httpHeader.appSecret = "";
  615. //httpHeader.requestId = "";
  616. //httpHeader.timestamp = "";
  617. //httpHeader.version = "2.8";
  618. //string head = JsonConvert.SerializeObject(httpHeader);
  619. ////请求报文体
  620. //AGVModel httpModel = new AGVModel();
  621. //httpModel.robotJobId = robotJobId;//上游提供
  622. //httpModel.warehouseId = 123; //仓库编号
  623. //httpModel.jobPriority = 1;//任务执行的优先级
  624. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  625. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  626. ////详细任务数据
  627. ////点到点
  628. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  629. //httpJobData.startPoint = "";//起点点位
  630. //httpJobData.endPoint = "";//目的点位
  631. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  632. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  633. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  634. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  635. //httpModel.jobData = httpJobData;
  636. //string body = JsonConvert.SerializeObject(httpModel);
  637. ////货位到货位
  638. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  639. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  640. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  641. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  642. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  643. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  644. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  645. ////httpModel.jobData = httpSlotJobData;
  646. ////string body = JsonConvert.SerializeObject(httpModel);
  647. ////启用签名
  648. ////url = url + "?sign=" + MD5Deal(body);
  649. //string data = HttpRequest(url, head, body);
  650. //object objData = JsonConvert.DeserializeObject(data);
  651. //if (objData != null && objData is HttpResponseBodyModel response)
  652. //{
  653. // return response.code;
  654. //}
  655. return "Analysis Error";
  656. }
  657. /// <summary>
  658. /// AGV从3号线运空桶洗桶
  659. /// </summary>
  660. /// <returns></returns>
  661. public string AgvLeaveLThreeToClean(string robotJobId)
  662. {
  663. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  664. ////请求报文头
  665. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  666. //httpHeader.appKey = "";
  667. //httpHeader.appSecret = "";
  668. //httpHeader.requestId = "";
  669. //httpHeader.timestamp = "";
  670. //httpHeader.version = "2.8";
  671. //string head = JsonConvert.SerializeObject(httpHeader);
  672. ////请求报文体
  673. //AGVModel httpModel = new AGVModel();
  674. //httpModel.robotJobId = robotJobId;//上游提供
  675. //httpModel.warehouseId = 123; //仓库编号
  676. //httpModel.jobPriority = 1;//任务执行的优先级
  677. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  678. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  679. ////详细任务数据
  680. ////点到点
  681. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  682. //httpJobData.startPoint = "";//起点点位
  683. //httpJobData.endPoint = "";//目的点位
  684. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  685. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  686. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  687. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  688. //httpModel.jobData = httpJobData;
  689. //string body = JsonConvert.SerializeObject(httpModel);
  690. ////货位到货位
  691. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  692. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  693. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  694. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  695. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  696. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  697. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  698. ////httpModel.jobData = httpSlotJobData;
  699. ////string body = JsonConvert.SerializeObject(httpModel);
  700. ////启用签名
  701. ////url = url + "?sign=" + MD5Deal(body);
  702. //string data = HttpRequest(url, head, body);
  703. //object objData = JsonConvert.DeserializeObject(data);
  704. //if (objData != null && objData is HttpResponseBodyModel response)
  705. //{
  706. // return response.code;
  707. //}
  708. return "Analysis Error";
  709. }
  710. /// <summary>
  711. /// AGV从洗桶处运桶到4号洗桶线
  712. /// </summary>
  713. /// <returns></returns>
  714. public string AgvLeaveCleanToLFour(string robotJobId)
  715. {
  716. //string url = AGVRequestUrl.GetInstance.TaskSendUrl;
  717. ////请求报文头
  718. //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  719. //httpHeader.appKey = "";
  720. //httpHeader.appSecret = "";
  721. //httpHeader.requestId = "";
  722. //httpHeader.timestamp = "";
  723. //httpHeader.version = "2.8";
  724. //string head = JsonConvert.SerializeObject(httpHeader);
  725. ////请求报文体
  726. //AGVModel httpModel = new AGVModel();
  727. //httpModel.robotJobId = robotJobId;//上游提供
  728. //httpModel.warehouseId = 123; //仓库编号
  729. //httpModel.jobPriority = 1;//任务执行的优先级
  730. //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
  731. //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
  732. ////详细任务数据
  733. ////点到点
  734. //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData();
  735. //httpJobData.startPoint = "";//起点点位
  736. //httpJobData.endPoint = "";//目的点位
  737. //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  738. //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
  739. //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  740. //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
  741. //httpModel.jobData = httpJobData;
  742. //string body = JsonConvert.SerializeObject(httpModel);
  743. ////货位到货位
  744. ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData();
  745. ////httpSlotJobData.startSlotCode = "";//起点槽位编号
  746. ////httpSlotJobData.endSlotCode = "";//目的槽位编号
  747. ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
  748. ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
  749. ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
  750. ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
  751. ////httpModel.jobData = httpSlotJobData;
  752. ////string body = JsonConvert.SerializeObject(httpModel);
  753. ////启用签名
  754. ////url = url + "?sign=" + MD5Deal(body);
  755. //string data = HttpRequest(url, head, body);
  756. //object objData = JsonConvert.DeserializeObject(data);
  757. //if (objData != null && objData is HttpResponseBodyModel response)
  758. //{
  759. // return response.code;
  760. //}
  761. return "Analysis Error";
  762. }
  763. /// <summary>
  764. /// 任务取消
  765. /// </summary>
  766. /// <param name="robotJobId">上游系统任务号,全局唯一</param>
  767. public string CancelJobTask(string robotJobId)
  768. {
  769. string url = AGVRequestUrl.GetInstance.TaskCancelUrl;
  770. //请求报文头
  771. HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  772. httpHeader.appKey = "";
  773. httpHeader.appSecret = "";
  774. httpHeader.requestId = "";
  775. httpHeader.timestamp = "";
  776. httpHeader.version = "2.8";
  777. string head = JsonConvert.SerializeObject(httpHeader);
  778. //请求报文体
  779. AGVTaskCancelModel cancel = new AGVTaskCancelModel();
  780. cancel.robotJobId = robotJobId;
  781. cancel.warehouseId = 123;//仓库编号
  782. string body = JsonConvert.SerializeObject(cancel);
  783. //启用签名
  784. //url = url + "?sign=" + MD5Deal(body);
  785. string data = HttpRequest(url, head, body);
  786. object objData = JsonConvert.DeserializeObject(data);
  787. if (objData != null && objData is HttpResponseBodyModel response)
  788. {
  789. return response.code;
  790. }
  791. return "Analysis Error";
  792. }
  793. /// <summary>
  794. /// 实操任务完成通知
  795. /// </summary>
  796. /// <returns></returns>
  797. public string TaskCompleteNotify(string robotJobId)
  798. {
  799. string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
  800. //请求报文头
  801. HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  802. httpHeader.appKey = "";
  803. httpHeader.appSecret = "";
  804. httpHeader.requestId = "";
  805. httpHeader.timestamp = "";
  806. httpHeader.version = "2.8";
  807. string head = JsonConvert.SerializeObject(httpHeader);
  808. //请求报文体
  809. AGVTaskCompleteNotifyModel notify = new AGVTaskCompleteNotifyModel();
  810. notify.robotJobId = robotJobId;
  811. notify.warehouseId = 123;//仓库编号
  812. string body = JsonConvert.SerializeObject(notify);
  813. //启用签名
  814. //url = url + "?sign=" + MD5Deal(body);
  815. string data = HttpRequest(url, head, body);
  816. object objData = JsonConvert.DeserializeObject(data);
  817. if (objData != null && objData is HttpResponseBodyModel response)
  818. {
  819. return response.code;
  820. }
  821. return "Analysis Error";
  822. }
  823. /// <summary>
  824. /// AGV上下料交互反馈
  825. /// </summary>
  826. /// <param name="agvCode">AGV编号</param>
  827. /// <param name="jobId">任务编号</param>
  828. /// <param name="msgId">消息编号</param>
  829. /// <returns></returns>
  830. public string UpDownFeedBack(string agvCode, string jobId, string msgId)
  831. {
  832. string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
  833. //请求报文头
  834. HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel();
  835. httpHeader.appKey = "";
  836. httpHeader.appSecret = "";
  837. httpHeader.requestId = "";
  838. httpHeader.timestamp = "";
  839. httpHeader.version = "2.8";
  840. string head = JsonConvert.SerializeObject(httpHeader);
  841. //请求报文体
  842. AGVLoadInteracteModel load = new AGVLoadInteracteModel();
  843. load.agvCode = agvCode;
  844. load.jobId = jobId;
  845. load.msgId = msgId;
  846. string body = JsonConvert.SerializeObject(load);
  847. //启用签名
  848. //url = url + "?sign=" + MD5Deal(body);
  849. string data = HttpRequest(url, head, body);
  850. object objData = JsonConvert.DeserializeObject(data);
  851. if (objData != null && objData is HttpResponseBodyModel response)
  852. {
  853. return response.code;
  854. }
  855. return "Analysis Error";
  856. }
  857. }
  858. }