终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

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