终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4434 rivejä
246 KiB

  1. using BPASmartClient.AGV;
  2. using BPASmartClient.AGV.Enums;
  3. using BPASmartClient.AGV.Feedback;
  4. using BPASmartClient.CustomResource.Pages.Model;
  5. using BPASmartClient.Helper;
  6. using BPASmartClient.HubHelper;
  7. using FryPot_DosingSystem.Model;
  8. using FryPot_DosingSystem.ViewModel;
  9. using Newtonsoft.Json;
  10. using System;
  11. using System.Collections.Concurrent;
  12. using System.Collections.Generic;
  13. using System.Collections.ObjectModel;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading;
  17. using System.Threading.Tasks;
  18. using System.Windows.Media;
  19. using System.Windows;
  20. using FryPot_DosingSystem.AGV;
  21. using FryPot_DosingSystem.FryPotStatus;
  22. using System.IO;
  23. using System.Runtime.Serialization.Formatters.Binary;
  24. using System.Diagnostics;
  25. namespace FryPot_DosingSystem.Control
  26. {
  27. internal class DosingLogicControl
  28. {
  29. public static DosingLogicControl _instance;
  30. public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
  31. /// <summary>
  32. /// 滚筒线PLC数据
  33. /// </summary>
  34. public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
  35. public ConcurrentDictionary<string, object> FryOneData = new ConcurrentDictionary<string, object>();
  36. public ConcurrentDictionary<string, object> FryTwoData = new ConcurrentDictionary<string, object>();
  37. public ConcurrentDictionary<string, object> FryThreeData = new ConcurrentDictionary<string, object>();
  38. public ConcurrentDictionary<string, object> FryFourData = new ConcurrentDictionary<string, object>();
  39. public ConcurrentDictionary<string, object> FryFiveData = new ConcurrentDictionary<string, object>();
  40. /// <summary>
  41. /// 线体1配方队列
  42. /// </summary>
  43. public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  44. /// <summary>
  45. /// 线体2配方队列
  46. /// </summary>
  47. public ConcurrentQueue<NewRecipeModel> LTwoRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  48. /// <summary>
  49. /// 线体3配方队列
  50. /// </summary>
  51. public ConcurrentQueue<NewRecipeModel> LThreeRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  52. /// <summary>
  53. /// 线体1进料原料队列
  54. /// </summary>
  55. public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  56. /// <summary>
  57. /// 线体2进料原料队列
  58. /// </summary>
  59. public ConcurrentQueue<MaterialInfo> LTwoInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  60. /// <summary>
  61. /// 线体3进料原料队列
  62. /// </summary>
  63. public ConcurrentQueue<MaterialInfo> LThreeInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  64. /// <summary>
  65. /// 线体1出料原料队列
  66. /// </summary>
  67. public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  68. /// <summary>
  69. /// 线体2出料原料队列
  70. /// </summary>
  71. public ConcurrentQueue<MaterialInfo> LTwoOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  72. /// <summary>
  73. /// 线体3出料原料队列
  74. /// </summary>
  75. public ConcurrentQueue<MaterialInfo> LThreeOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  76. /// <summary>
  77. /// 全局变量对象声明
  78. /// </summary>
  79. GlobalVariable globalVar;
  80. /// <summary>
  81. /// 线体状态对象声明
  82. /// </summary>
  83. HardWareStatusViewModel hardWareStatusModel;
  84. ///// <summary>
  85. ///// 炒锅1状态
  86. ///// </summary>
  87. //PotOneStatus fryOne;
  88. ///// <summary>
  89. ///// 炒锅2状态
  90. ///// </summary>
  91. //PotTwoStatus fryTwo;
  92. ///// <summary>
  93. ///// 炒锅3状态
  94. ///// </summary>
  95. //PotThreeStatus fryThree;
  96. ///// <summary>
  97. ///// 炒锅4状态
  98. ///// </summary>
  99. //PotFourStatus fryFour;
  100. ///// <summary>
  101. ///// 炒锅5状态
  102. ///// </summary>
  103. //PotFiveStatus fryFive;
  104. /// <summary>
  105. /// 报警信息对象声明
  106. /// </summary>
  107. #region 上位机内部变量
  108. int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障
  109. int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障
  110. int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障
  111. int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障
  112. int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障
  113. int ReicpeNum = 0;//记录接收到的配方数
  114. bool ErrorRecipe;//线体1错误配方标识
  115. bool LTwoErrorRecipe;//线体2错误配方标识
  116. bool LThreeErrorRecipe;//线体3错误配方标识
  117. string fryOneRecipe = string.Empty;
  118. string fryTwoRecipe = string.Empty;
  119. string fryThreeRecipe = string.Empty;
  120. string fryFourRecipe = string.Empty;
  121. string fryFiveRecipe = string.Empty;
  122. #endregion
  123. #region agv临时变量
  124. //bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
  125. //bool agvArriveLTwoUpLoad = false;//agv是否到达线体2上料位置
  126. //bool agvArriveLThreeUpLoad = false;//agv是否到达线体3上料位置
  127. //bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
  128. //bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
  129. //bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置
  130. //bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶
  131. //bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶
  132. //bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶
  133. string LOnerobotJobId = string.Empty;//线体1当前上游系统任务号,全局唯一 从线体1到炒锅路径
  134. string LTworobotJobId = string.Empty;//线体2当前上游系统任务号,全局唯一 从线体2到炒锅路径
  135. string LThreerobotJobId = string.Empty;//线体3当前上游系统任务号,全局唯一 从线体3到炒锅路径
  136. string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径
  137. string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径
  138. string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径
  139. List<string> LSevenrobotJobId = new List<string>(); //从线体1到清洗台路径
  140. List<string> LEightrobotJobId = new List<string>();//从线体2到清洗台路径
  141. List<string> LNinerobotJobId = new List<string>(); //从线体3到清洗台路径
  142. List<string> LTenrobotJobId = new List<string>(); //从清洗台到线体4路径
  143. Dictionary<string, int> agvCode = new Dictionary<string, int>() { { "1", 1 }, { "2", 2 }, { "3", 3 }, { "4", 4 } };//agv小车的编号对AGV动画小车编号
  144. public int CleanNum = 0;//当前清洗台桶数
  145. #endregion
  146. /// <summary>
  147. /// 调试命令注册
  148. /// </summary>
  149. public void CommandRegist()
  150. {
  151. #region 线体空桶清洗及回收调试
  152. ActionManage.GetInstance.Register(new Action(() =>
  153. {
  154. globalVar.agvArriveLineOneLoadEmptyRoller = true;
  155. }), "AgvArriveLineOneEmptyRollerLoc");
  156. ActionManage.GetInstance.Register(new Action(() =>
  157. {
  158. globalVar.agvArriveLineTwoLoadEmptyRoller = true;
  159. }), "AgvArriveLineTwoEmptyRollerLoc");
  160. ActionManage.GetInstance.Register(new Action(() =>
  161. {
  162. globalVar.agvArriveLineThreeLoadEmptyRoller = true;
  163. }), "AgvArriveLineThreeEmptyRollerLoc");
  164. ActionManage.GetInstance.Register(new Action(() =>
  165. {
  166. globalVar.CleanComplete = 1;
  167. }), "CleanPlateCallAgv");
  168. ActionManage.GetInstance.Register(new Action(() =>
  169. {
  170. globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
  171. globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;
  172. globalVar.rollerLineThree.agvArriveCleanUnLoad = true;
  173. }), "AgvArriveCleanPlateLoc");
  174. ActionManage.GetInstance.Register(new Action(() =>
  175. {
  176. globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
  177. }), "AgvArriveCleanPlateLocLoad");
  178. ActionManage.GetInstance.Register(new Action(() =>
  179. {
  180. globalVar.agvArriveLineFour = true;
  181. globalVar.rollerLineOne.agvArriveLineFour = true;
  182. globalVar.rollerLineTwo.agvArriveLineFour = true;
  183. globalVar.rollerLineThree.agvArriveLineFour = true;
  184. }), "AgvArriveLineFourLoc");
  185. ActionManage.GetInstance.Register(new Action(() =>
  186. {
  187. LineOneEmptyRollerCleanTaskRestart();
  188. }), "EmptyRollerCleanTaskRestart");
  189. ActionManage.GetInstance.Register(new Action(() =>
  190. {
  191. LineTwoEmptyRollerCleanTaskRestart();
  192. }), "LineTwoEmptyRollerCleanTaskRestart");
  193. ActionManage.GetInstance.Register(new Action(() =>
  194. {
  195. LineThreeEmptyRollerCleanTaskRestart();
  196. }), "LineThreeEmptyRollerCleanTaskRestart");
  197. #endregion
  198. //接口调试
  199. ActionManage.GetInstance.Register(new Action(() =>
  200. {
  201. string id = Guid.NewGuid().ToString();
  202. string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
  203. if (errorCode == "SUCCESS")
  204. {
  205. MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功");
  206. }
  207. else if (errorCode == "Analysis Error")
  208. {
  209. MessageLog.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
  210. }
  211. else
  212. {
  213. MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
  214. }
  215. }), "AgvDebug");
  216. ActionManage.GetInstance.Register(() =>
  217. {
  218. MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成");
  219. }, "AgvArriveCleanPlateLocCom");
  220. ActionManage.GetInstance.Register(() =>
  221. {
  222. MessageLog.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成");
  223. MessageLog.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成");
  224. MessageLog.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成");
  225. MessageLog.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成");
  226. }, "AgvArriveLineFourLocCom");
  227. ActionManage.GetInstance.Register(() =>
  228. {
  229. MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成");
  230. }, "AgvArriveCleanPlateLocLoadCom");
  231. ActionManage.GetInstance.Register(() =>
  232. {
  233. globalVar.rollerLineOne.RecipeCompleteSingle = 1;
  234. }, "LineOneRecipeComSignal");
  235. ActionManage.GetInstance.Register(() =>
  236. {
  237. globalVar.rollerLineTwo.RecipeCompleteSingle = 1;
  238. }, "LineTwoRecipeComSignal");
  239. ActionManage.GetInstance.Register(() =>
  240. {
  241. globalVar.rollerLineThree.RecipeCompleteSingle = 1;
  242. }, "LineThreeRecipeComSignal");
  243. ActionManage.GetInstance.Register(new Action(() =>
  244. {
  245. globalVar.agvArriveLineOneLoadCom = true;
  246. }), "AgvLineOneLoadEmptyCom");
  247. ActionManage.GetInstance.Register(new Action(() =>
  248. {
  249. globalVar.agvArriveLineTwoLoadCom = true;
  250. }), "AgvLineTwoLoadEmptyCom");
  251. ActionManage.GetInstance.Register(new Action(() =>
  252. {
  253. globalVar.agvArriveLineThreeLoadCom = true;
  254. }), "AgvLineThreeLoadEmptyCom");
  255. ActionManage.GetInstance.Register(new Action(() =>
  256. {
  257. globalVar.rollerLineOne.CanRun = true;
  258. }), "AGVLineOneLoadCom");
  259. ActionManage.GetInstance.Register(new Action(() =>
  260. {
  261. globalVar.rollerLineTwo.CanRun = true;
  262. }), "AGVLineTwoLoadCom");
  263. ActionManage.GetInstance.Register(new Action(() =>
  264. {
  265. globalVar.rollerLineThree.CanRun = true;
  266. }), "AGVLineThreeLoadCom");
  267. ActionManage.GetInstance.Register(new Action(() =>
  268. {
  269. globalVar.rollerLineOne.OutMaterialingSingle = 1;
  270. }), "RollerLineRunning");
  271. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  272. {
  273. globalVar.rollerLineOne.StationEight = (ushort)obj;
  274. }), "EightWorkLoc");
  275. ActionManage.GetInstance.Register(new Action(() =>
  276. {
  277. globalVar.fryPotOne.InputMaterialArrivedSingle = 1;
  278. globalVar.fryPotFour.InputMaterialArrivedSingle = 1;
  279. }), "FryPotInputArrive");
  280. ActionManage.GetInstance.Register(new Action(() =>
  281. {
  282. globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1;
  283. globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1;
  284. }), "FryPotEmptyRollerArrive");
  285. ActionManage.GetInstance.Register(new Action(() =>
  286. {
  287. globalVar.agvArriveUpLoad = true;
  288. }), "AGVLOneArrive");
  289. ActionManage.GetInstance.Register(new Action(() =>
  290. {
  291. globalVar.agvArriveUnLoad = true;
  292. }), "AGVFryPotDownArrive");
  293. ActionManage.GetInstance.Register(new Action(() =>
  294. {
  295. globalVar.agvArriveUpLoad = true;
  296. }), "AGVFryPotUpArrive");
  297. ActionManage.GetInstance.Register(new Action(() =>
  298. {
  299. globalVar.agvFryPotEmptyRollerArrive = true;
  300. }), "AGVFryPotGetEmptyRoller");
  301. //滚筒线2
  302. ActionManage.GetInstance.Register(new Action(() =>
  303. {
  304. globalVar.rollerLineTwo.OutMaterialingSingle = 1;
  305. }), "RollerLineTwoRunning");
  306. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  307. {
  308. globalVar.rollerLineTwo.StationEight = (ushort)obj;
  309. }), "TwoEightWorkLoc");
  310. ActionManage.GetInstance.Register(new Action(() =>
  311. {
  312. globalVar.fryPotTwo.InputMaterialArrivedSingle = 1;
  313. globalVar.fryPotFive.InputMaterialArrivedSingle = 1;
  314. }), "FryPotTwoInputArrive");
  315. ActionManage.GetInstance.Register(new Action(() =>
  316. {
  317. globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1;
  318. globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1;
  319. }), "FryPotTwoEmptyRollerArrive");
  320. ActionManage.GetInstance.Register(new Action(() =>
  321. {
  322. globalVar.agvArriveLTwoUpLoad = true;
  323. }), "AGVLTwoArrive");
  324. ActionManage.GetInstance.Register(new Action(() =>
  325. {
  326. globalVar.LTwoagvArriveUnLoad = true;
  327. }), "AGVFryPotTwoDownArrive");
  328. ActionManage.GetInstance.Register(new Action(() =>
  329. {
  330. globalVar.agvArriveLTwoUpLoad = true;
  331. }), "AGVFryPotTwoUpArrive");
  332. ActionManage.GetInstance.Register(new Action(() =>
  333. {
  334. globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  335. }), "AGVFryPotTwoGetEmptyRoller");
  336. //滚筒线3
  337. ActionManage.GetInstance.Register(new Action(() =>
  338. {
  339. globalVar.rollerLineThree.OutMaterialingSingle = 1;
  340. }), "RollerLineThreeRunning");
  341. ActionManage.GetInstance.Register(new Action<object>((obj) =>
  342. {
  343. globalVar.rollerLineThree.StationEight = (ushort)obj;
  344. }), "ThreeEightWorkLoc");
  345. ActionManage.GetInstance.Register(new Action(() =>
  346. {
  347. globalVar.fryPotThree.InputMaterialArrivedSingle = 1;
  348. }), "FryPotThreeInputArrive");
  349. ActionManage.GetInstance.Register(new Action(() =>
  350. {
  351. globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1;
  352. }), "FryPotThreeEmptyRollerArrive");
  353. ActionManage.GetInstance.Register(new Action(() =>
  354. {
  355. globalVar.agvArriveLThreeUpLoad = true;
  356. }), "AGVLThreeArrive");
  357. ActionManage.GetInstance.Register(new Action(() =>
  358. {
  359. globalVar.LThreeagvArriveUnLoad = true;
  360. }), "AGVFryPotThreeDownArrive");
  361. ActionManage.GetInstance.Register(new Action(() =>
  362. {
  363. globalVar.agvArriveLThreeUpLoad = true;
  364. }), "AGVFryPotThreeUpArrive");
  365. ActionManage.GetInstance.Register(new Action(() =>
  366. {
  367. globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  368. }), "AGVFryPotThreeGetEmptyRoller");
  369. }
  370. public DosingLogicControl()
  371. {
  372. globalVar = new GlobalVariable();
  373. //fryOne = new PotOneStatus();
  374. //fryTwo = new PotTwoStatus();
  375. //fryThree = new PotThreeStatus();
  376. //fryFour = new PotFourStatus();
  377. //fryFive = new PotFiveStatus();
  378. hardWareStatusModel = HardWareStatusViewModel.GetInstance;
  379. DateTimeJudge();
  380. FileRegClean();
  381. ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
  382. //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
  383. ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
  384. ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
  385. ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
  386. //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
  387. //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
  388. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
  389. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
  390. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
  391. HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
  392. HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
  393. // ResetProgram();
  394. ReadPlcData();
  395. SaveFryPotData();
  396. MainTask();
  397. CommandRegist();
  398. }
  399. /// <summary>
  400. /// 文件数据定期清理
  401. /// </summary>
  402. /// <exception cref="NotImplementedException"></exception>
  403. private void FileRegClean()
  404. {
  405. try
  406. {
  407. int days = 5; //清除期限
  408. string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
  409. if (filesOne.Count() > 0)
  410. {
  411. foreach (var item in filesOne)
  412. {
  413. FileInfo info = new FileInfo(item);
  414. DateTime createTime = info.CreationTime;
  415. DateTime timeNow = DateTime.Now;
  416. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  417. {
  418. Directory.Delete(item, true);
  419. }
  420. }
  421. }
  422. string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
  423. if (filesTwo.Count() > 0)
  424. {
  425. foreach (var item in filesTwo)
  426. {
  427. FileInfo info = new FileInfo(item);
  428. DateTime createTime = info.CreationTime;
  429. DateTime timeNow = DateTime.Now;
  430. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  431. {
  432. Directory.Delete(item, true);
  433. }
  434. }
  435. }
  436. string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
  437. if (filesThree.Count() > 0)
  438. {
  439. foreach (var item in filesThree)
  440. {
  441. FileInfo info = new FileInfo(item);
  442. DateTime createTime = info.CreationTime;
  443. DateTime timeNow = DateTime.Now;
  444. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  445. {
  446. Directory.Delete(item, true);
  447. }
  448. }
  449. }
  450. string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
  451. if (filesFour.Count() > 0)
  452. {
  453. foreach (var item in filesFour)
  454. {
  455. FileInfo info = new FileInfo(item);
  456. DateTime createTime = info.CreationTime;
  457. DateTime timeNow = DateTime.Now;
  458. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  459. {
  460. Directory.Delete(item, true);
  461. }
  462. }
  463. }
  464. string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
  465. if (filesFive.Count() > 0)
  466. {
  467. foreach (var item in filesFive)
  468. {
  469. FileInfo info = new FileInfo(item);
  470. DateTime createTime = info.CreationTime;
  471. DateTime timeNow = DateTime.Now;
  472. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  473. {
  474. Directory.Delete(item, true);
  475. }
  476. }
  477. }
  478. }
  479. catch (Exception)
  480. {
  481. // throw;
  482. }
  483. }
  484. /// <summary>
  485. /// 时间差计算
  486. /// </summary>
  487. /// <param name="t">当前时间</param>
  488. /// <param name="t2">创建时间</param>
  489. /// <returns></returns>
  490. private int TimeDiff(DateTime t, DateTime t2)
  491. {
  492. long lReturn = -1;
  493. System.TimeSpan NowValue = new TimeSpan(t.Ticks);
  494. System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
  495. System.TimeSpan DateDiff = TimeSpan.Zero;
  496. try
  497. {
  498. //计算时间差
  499. //DateDiff = TimeValue.Subtract(NowValue).Duration();
  500. DateDiff = NowValue.Subtract(TimeValue);
  501. int h = DateDiff.Hours;
  502. int m = DateDiff.Minutes;
  503. return DateDiff.Days;
  504. }
  505. catch
  506. {
  507. return -1;
  508. }
  509. }
  510. /// <summary>
  511. /// 炒锅数据实时保存
  512. /// </summary>
  513. /// <exception cref="NotImplementedException"></exception>
  514. private void SaveFryPotData()
  515. {
  516. Task.Run(new Action(() =>
  517. {
  518. while (true)
  519. {
  520. FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
  521. }
  522. }));
  523. }
  524. /// <summary>
  525. /// 时间判断,数据处理
  526. /// </summary>
  527. private void DateTimeJudge()
  528. {
  529. #region sqlite数据库保存
  530. //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
  531. //{
  532. // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
  533. // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  534. // {
  535. // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  536. // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
  537. // }
  538. //}
  539. //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
  540. //{
  541. // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
  542. // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  543. // {
  544. // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  545. // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
  546. // }
  547. //}
  548. //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
  549. //{
  550. // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
  551. // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  552. // {
  553. // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  554. // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
  555. // }
  556. //}
  557. //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
  558. //{
  559. // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
  560. // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  561. // {
  562. // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  563. // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
  564. // }
  565. //}
  566. //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
  567. //{
  568. // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
  569. // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  570. // {
  571. // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  572. // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
  573. // }
  574. //}
  575. #endregion
  576. string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
  577. string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
  578. string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
  579. string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
  580. string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
  581. if (!Directory.Exists("AccessFile//" + "Statistic"))
  582. Directory.CreateDirectory("AccessFile//" + "Statistic");
  583. if (File.Exists(p1))
  584. {
  585. using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
  586. {
  587. string time = sReader.ReadLine();
  588. string statistic = sReader.ReadLine();
  589. if (DateTime.Now.ToShortDateString() == time)
  590. {
  591. FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  592. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  593. }
  594. }
  595. }
  596. if (File.Exists(p2))
  597. {
  598. using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
  599. {
  600. string time = sReader.ReadLine();
  601. string statistic = sReader.ReadLine();
  602. if (DateTime.Now.ToShortDateString() == time)
  603. {
  604. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  605. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  606. }
  607. }
  608. }
  609. if (File.Exists(p3))
  610. {
  611. using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
  612. {
  613. string time = sReader.ReadLine();
  614. string statistic = sReader.ReadLine();
  615. if (DateTime.Now.ToShortDateString() == time)
  616. {
  617. FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  618. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  619. }
  620. }
  621. }
  622. if (File.Exists(p4))
  623. {
  624. using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
  625. {
  626. string time = sReader.ReadLine();
  627. string statistic = sReader.ReadLine();
  628. if (DateTime.Now.ToShortDateString() == time)
  629. {
  630. FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  631. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  632. }
  633. }
  634. }
  635. if (File.Exists(p5))
  636. {
  637. using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
  638. {
  639. string time = sReader.ReadLine();
  640. string statistic = sReader.ReadLine();
  641. if (DateTime.Now.ToShortDateString() == time)
  642. {
  643. FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  644. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  645. }
  646. }
  647. }
  648. }
  649. /// <summary>
  650. /// AGV上下料上报数据解析
  651. /// </summary>
  652. /// <param name="obj"></param>
  653. private void AgvFeedBackUpReportDataAnalysis(object obj)
  654. {
  655. //if (obj != null && obj is byte[] datas)
  656. //{
  657. //string strData = Encoding.UTF8.GetString(datas);
  658. Upstreamrequest objData = JsonConvert.DeserializeObject<Upstreamrequest>(obj.ToString());
  659. if (objData != null)
  660. {
  661. #region 线体到炒锅请求上下料
  662. //线体1请求上下料
  663. if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  664. {
  665. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  666. }
  667. if (objData.robotJobId == LOnerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  668. {
  669. globalVar.agvArriveUnLoad = true;//AGV到达下料位置
  670. }
  671. //线体2请求上下料
  672. if (objData.robotJobId == LTworobotJobId && objData.command == "LOAD")
  673. {
  674. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  675. }
  676. if (objData.robotJobId == LTworobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  677. {
  678. globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
  679. }
  680. //线体3请求上下料
  681. if (objData.robotJobId == LThreerobotJobId && objData.command == "LOAD")
  682. {
  683. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  684. }
  685. if (objData.robotJobId == LThreerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  686. {
  687. globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
  688. }
  689. #endregion
  690. #region 炒锅到线体4请求上下料
  691. if (objData.robotJobId == LFourrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  692. {
  693. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  694. }
  695. if (objData.robotJobId == LFourrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  696. {
  697. globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置
  698. // AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  699. }
  700. if (objData.robotJobId == LFiverobotJobId && objData.command == "LOAD")
  701. {
  702. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  703. }
  704. if (objData.robotJobId == LFiverobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  705. {
  706. globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置
  707. }
  708. if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD")
  709. {
  710. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  711. }
  712. if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  713. {
  714. globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置
  715. }
  716. #endregion
  717. #region 线体123到清洗台请求上下料
  718. if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  719. {
  720. globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
  721. }
  722. if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  723. {
  724. globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//AGV到达下料位置
  725. }
  726. if (LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD")
  727. {
  728. globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
  729. }
  730. if (LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  731. {
  732. globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;//AGV到达下料位置
  733. }
  734. if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD")
  735. {
  736. globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
  737. }
  738. if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  739. {
  740. globalVar.rollerLineThree.agvArriveCleanUnLoad = true;//AGV到达下料位置
  741. }
  742. #endregion
  743. #region 清洗台到线体4请求上下料
  744. if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD")
  745. {
  746. globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
  747. }
  748. if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")
  749. {
  750. globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
  751. }
  752. #endregion
  753. }
  754. }
  755. /// <summary>
  756. /// AGV搬运任务上报数据解析
  757. /// </summary>
  758. /// <param name="obj"></param>
  759. private void AgvTaskUpReportDataAnalysis(object obj)
  760. {
  761. //if (obj != null && obj is byte[] datas)
  762. //{
  763. // string strData = Encoding.UTF8.GetString(datas);
  764. AGVToUpSystem objData = JsonConvert.DeserializeObject<AGVToUpSystem>(obj.ToString());
  765. if (objData != null)
  766. {
  767. #region 线体上下料任务信息回报
  768. //线体1任务上报
  769. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  770. {
  771. }
  772. //线体2任务上报
  773. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  774. {
  775. //日志
  776. }
  777. //线体3任务上报
  778. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体上料
  779. {
  780. //日志
  781. }
  782. //线体1任务上报
  783. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  784. {
  785. globalVar.agvLineOneLoadCom = true;
  786. AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
  787. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  788. if (globalVar.LOneFryPotSerial == 1)
  789. {
  790. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_1);
  791. }
  792. else if (globalVar.LOneFryPotSerial == 4)
  793. {
  794. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_4);
  795. }
  796. }
  797. //线体2任务上报
  798. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  799. {
  800. globalVar.agvLineTwoLoadCom = true;
  801. AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
  802. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  803. if (globalVar.LTwoFryPotSerial == 2)
  804. {
  805. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_2);
  806. }
  807. else if (globalVar.LTwoFryPotSerial == 5)
  808. {
  809. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_5);
  810. }
  811. }
  812. //线体3任务上报
  813. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料
  814. {
  815. globalVar.agvLineThreeLoadCom = true;
  816. AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
  817. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  818. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_3_3);
  819. }
  820. //线体1任务上报
  821. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料
  822. {
  823. }
  824. //线体2任务上报
  825. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料
  826. {
  827. }
  828. //线体3任务上报
  829. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料
  830. {
  831. }
  832. //线体1任务上报
  833. if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料
  834. {
  835. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  836. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  837. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  838. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  839. }
  840. //线体2任务上报
  841. if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料
  842. {
  843. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  844. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  845. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  846. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  847. }
  848. //线体3任务上报
  849. if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料
  850. {
  851. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  852. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  853. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  854. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  855. }
  856. #endregion
  857. #region 炒锅空桶上下料任务信息回报
  858. //线体1任务上报
  859. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  860. {
  861. //日志
  862. }
  863. //线体2任务上报
  864. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  865. {
  866. //日志
  867. }
  868. //线体3任务上报
  869. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料
  870. {
  871. //日志
  872. }
  873. //线体1任务上报
  874. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  875. {
  876. globalVar.agvFryPotEmptyRollerArrive = true;
  877. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  878. if (globalVar.LOneFryPotSerial == 1)
  879. {
  880. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_1);
  881. }
  882. else if (globalVar.LOneFryPotSerial == 4)
  883. {
  884. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);
  885. }
  886. }
  887. //线体2任务上报
  888. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  889. {
  890. globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  891. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  892. if (globalVar.LTwoFryPotSerial == 2)
  893. {
  894. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_2);
  895. }
  896. else if (globalVar.LTwoFryPotSerial == 5)
  897. {
  898. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_5);
  899. }
  900. }
  901. //线体3任务上报
  902. if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料
  903. {
  904. globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  905. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  906. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_3);
  907. }
  908. //线体1任务上报
  909. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  910. {
  911. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  912. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  913. }
  914. //线体2任务上报
  915. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  916. {
  917. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  918. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  919. }
  920. //线体3任务上报
  921. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
  922. {
  923. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  924. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  925. }
  926. //线体1任务上报
  927. if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  928. {
  929. MessageLog.GetInstance.ShowRunLog("1号线炒锅空桶在4号线卸桶完成");
  930. if (globalVar.LFourRollerNum >= 8)
  931. {
  932. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  933. }
  934. else
  935. {
  936. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  937. }
  938. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  939. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  940. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  941. }
  942. //线体2任务上报
  943. if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  944. {
  945. MessageLog.GetInstance.ShowRunLog("2号线炒锅空桶在4号线卸桶完成");
  946. if (globalVar.LFourRollerNum >= 8)
  947. {
  948. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  949. }
  950. else
  951. {
  952. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  953. }
  954. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  955. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  956. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  957. }
  958. //线体3任务上报
  959. if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料
  960. {
  961. MessageLog.GetInstance.ShowRunLog("3号线炒锅空桶在4号线卸桶完成");
  962. if (globalVar.LFourRollerNum >= 8)
  963. {
  964. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  965. }
  966. else
  967. {
  968. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  969. }
  970. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  971. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  972. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  973. }
  974. #endregion
  975. #region 线体123空桶到清戏台
  976. //线体1任务上报
  977. if (objData.state == "ROLLER_LOAD_FINISH" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料
  978. {
  979. globalVar.agvArriveLineOneLoadCom = true;
  980. AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
  981. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  982. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_1);
  983. //到清洗处
  984. }
  985. //线体2任务上报
  986. if (objData.state == "ROLLER_LOAD_FINISH" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料
  987. {
  988. globalVar.agvArriveLineTwoLoadCom = true;
  989. AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
  990. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  991. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_2);
  992. //到清洗处
  993. }
  994. //线体3任务上报
  995. if (objData.state == "ROLLER_LOAD_FINISH" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料
  996. {
  997. globalVar.agvArriveLineThreeLoadCom = true;
  998. AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
  999. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1000. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_3);
  1001. //到清洗处
  1002. }
  1003. if (objData.state == "DONE" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料
  1004. {
  1005. LSevenrobotJobId.Remove(objData.robotJobId);
  1006. MessageLog.GetInstance.ShowRunLog("线体【1】空桶在清洗台卸桶完成");
  1007. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1008. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1009. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1010. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1011. }
  1012. if (objData.state == "DONE" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料
  1013. {
  1014. LEightrobotJobId.Remove(objData.robotJobId);
  1015. MessageLog.GetInstance.ShowRunLog("线体【2】空桶在清洗台卸桶完成");
  1016. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1017. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1018. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1019. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1020. }
  1021. if (objData.state == "DONE" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料
  1022. {
  1023. LNinerobotJobId.Remove(objData.robotJobId);
  1024. MessageLog.GetInstance.ShowRunLog("线体【3】空桶在清洗台卸桶完成");
  1025. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1026. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1027. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1028. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1029. }
  1030. #endregion
  1031. #region 清洗台到线体4
  1032. if (objData.state == "ROLLER_LOAD_FINISH" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料
  1033. {
  1034. MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成");
  1035. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1036. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);//去四号空桶线
  1037. AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
  1038. }
  1039. if (objData.state == "ROLLER_UNLOAD_DOING" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "")//指定下料点正在下料,指清洗台空桶到线体4下料
  1040. {
  1041. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  1042. }
  1043. if (objData.state == "DONE" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料
  1044. {
  1045. LTenrobotJobId.Remove(objData.robotJobId);
  1046. MessageLog.GetInstance.ShowRunLog("【4】号线空桶回桶完成");
  1047. if (globalVar.LFourRollerNum >= 8)
  1048. {
  1049. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  1050. }
  1051. else
  1052. {
  1053. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  1054. }
  1055. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1056. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  1057. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  1058. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1059. }
  1060. #endregion
  1061. }
  1062. }
  1063. /// <summary>
  1064. /// 主任务重启
  1065. /// </summary>
  1066. private void ResetProgram()
  1067. {
  1068. ThreadManage.GetInstance().StartLong(new Action(() =>
  1069. {
  1070. if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
  1071. {
  1072. MessageLog.GetInstance.ShowUserLog("主任务正在重启");
  1073. ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
  1074. {
  1075. //ActionManage.GetInstance.CancelRegister("RecipeSetDown");
  1076. //ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
  1077. // ActionManage.GetInstance.Send("ClearRecipes");
  1078. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1079. {
  1080. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1081. {
  1082. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1083. {
  1084. globalVar = null;
  1085. globalVar = new GlobalVariable();
  1086. ReicpeNum = 0;
  1087. ReadPlcData();
  1088. MainTask();
  1089. MessageLog.GetInstance.ShowUserLog("主任务重启完成");
  1090. }));
  1091. }));
  1092. }));
  1093. }));
  1094. }
  1095. Thread.Sleep(10);
  1096. }), "ResetProgram");
  1097. }
  1098. public void LineOneTaskRestart()
  1099. {
  1100. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1101. {
  1102. ActionManage.GetInstance.Send("ClearOneRecipes");
  1103. globalVar.rollerLineOne = null;
  1104. globalVar.rollerLineOne = new RollerLineOne();
  1105. globalVar.fryPotOne = null;
  1106. globalVar.fryPotOne = new FryPotOne();
  1107. globalVar.fryPotFour = null;
  1108. globalVar.fryPotFour = new FryPotFour();
  1109. globalVar.ExitLineOneTask = false;
  1110. globalVar.AllowAgvToLineLoadRoller = true;
  1111. globalVar.InOrOutputLock = false;
  1112. globalVar.LOneCurrentRecipeName = string.Empty;
  1113. globalVar.LoadRoller = false;
  1114. globalVar.AgvToFryPot = false;
  1115. globalVar.PotOneInputMaterialArrive = false;
  1116. globalVar.PotOneOutputRollerArrive = false;
  1117. globalVar.AgvArrivePot = false;
  1118. globalVar.LOneMaterialNum = 0;
  1119. globalVar.LOneFryPotSerial = 1;
  1120. globalVar.LOneCurrentCookingStep = 0;
  1121. globalVar.agvArriveUpLoad = false;
  1122. globalVar.agvArriveUnLoad = false;
  1123. globalVar.agvFryPotEmptyRollerArrive = false;
  1124. globalVar.agvLineOneLoadCom = false;
  1125. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  1126. MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
  1127. }));
  1128. }
  1129. public void LineTwoTaskRestart()
  1130. {
  1131. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1132. {
  1133. ActionManage.GetInstance.Send("ClearTwoRecipes");
  1134. globalVar.rollerLineTwo = null;
  1135. globalVar.rollerLineTwo = new RollerLineTwo();
  1136. globalVar.fryPotTwo = null;
  1137. globalVar.fryPotTwo = new FryPotTwo();
  1138. globalVar.fryPotFive = null;
  1139. globalVar.fryPotFive = new FryPotFive();
  1140. globalVar.ExitLineTwoTask = false;
  1141. globalVar.AllowAgvToLineTwoLoadRoller = true;
  1142. globalVar.LTwoInOrOutputLock = false;
  1143. globalVar.LTwoCurrentRecipeName = string.Empty;
  1144. globalVar.LTwoLoadRoller = false;
  1145. globalVar.LTwoAgvToFryPot = false;
  1146. globalVar.LTwoPotInputMaterialArrive = false;
  1147. globalVar.LTwoPotOutputRollerArrive = false;
  1148. globalVar.LTwoAgvArrivePot = false;
  1149. globalVar.LTwoMaterialNum = 0;
  1150. globalVar.LTwoFryPotSerial = 2;
  1151. globalVar.LTwoCurrentCookingStep = 0;
  1152. globalVar.agvArriveLTwoUpLoad = false;
  1153. globalVar.LTwoagvArriveUnLoad = false;
  1154. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  1155. globalVar.agvLineTwoLoadCom = false;
  1156. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  1157. MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
  1158. }));
  1159. }
  1160. public void LineThreeTaskRestart()
  1161. {
  1162. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1163. {
  1164. ActionManage.GetInstance.Send("ClearThreeRecipes");
  1165. globalVar.rollerLineThree = null;
  1166. globalVar.rollerLineThree = new RollerLineThree();
  1167. globalVar.fryPotThree = null;
  1168. globalVar.fryPotThree = new FryPotThree();
  1169. globalVar.ExitLineThreeTask = false;
  1170. globalVar.AllowAgvToLineThreeLoadRoller = true;
  1171. globalVar.LThreeInOrOutputLock = false;
  1172. globalVar.LThreeCurrentRecipeName = string.Empty;
  1173. globalVar.LThreeLoadRoller = false;
  1174. globalVar.LThreeAgvToFryPot = false;
  1175. globalVar.LThreePotInputMaterialArrive = false;
  1176. globalVar.LThreePotOutputRollerArrive = false;
  1177. globalVar.LThreeAgvArrivePot = false;
  1178. globalVar.LThreeMaterialNum = 0;
  1179. globalVar.LThreeFryPotSerial = 3;
  1180. globalVar.LThreeCurrentCookingStep = 0;
  1181. globalVar.agvArriveLThreeUpLoad = false;
  1182. globalVar.LThreeagvArriveUnLoad = false;
  1183. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  1184. globalVar.agvLineThreeLoadCom = false;
  1185. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  1186. MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
  1187. }));
  1188. }
  1189. public void LineOneEmptyRollerCleanTaskRestart()
  1190. {
  1191. ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() =>
  1192. {
  1193. globalVar.rollerLineOne.StationEight = 0;
  1194. globalVar.rollerLineOne.EmptyRollerNums.Clear();
  1195. globalVar.rollerLineOne.EmptyRollerNums.Add(108);
  1196. globalVar.rollerLineOne.IsEpmtyBefore = false;
  1197. // globalVar.rollerLineOne.CanRun = true;
  1198. globalVar.agvArriveLineFour = false;
  1199. globalVar.agvArriveCleanLoad = false;
  1200. globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
  1201. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  1202. globalVar.agvArriveLineOneLoadCom = false;
  1203. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
  1204. MessageLog.GetInstance.ShowUserLog("滚筒线【1】空桶清洗任务重启成功");
  1205. }));
  1206. }
  1207. public void LineTwoEmptyRollerCleanTaskRestart()
  1208. {
  1209. ThreadManage.GetInstance().StopTask("滚筒线2空桶清洗任务线程", new Action(() =>
  1210. {
  1211. globalVar.rollerLineTwo.StationEight = 0;
  1212. globalVar.rollerLineTwo.EmptyRollerNums.Clear();
  1213. globalVar.rollerLineTwo.EmptyRollerNums.Add(208);
  1214. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  1215. //globalVar.rollerLineTwo.CanRun = true;
  1216. globalVar.agvArriveLineFour = false;
  1217. globalVar.agvArriveCleanLoad = false;
  1218. globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
  1219. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  1220. globalVar.agvArriveLineTwoLoadCom = false;
  1221. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
  1222. MessageLog.GetInstance.ShowUserLog("滚筒线【2】空桶清洗任务重启成功");
  1223. }));
  1224. }
  1225. public void LineThreeEmptyRollerCleanTaskRestart()
  1226. {
  1227. ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() =>
  1228. {
  1229. globalVar.rollerLineThree.StationEight = 0;
  1230. globalVar.rollerLineThree.EmptyRollerNums.Clear();
  1231. globalVar.rollerLineThree.EmptyRollerNums.Add(308);
  1232. globalVar.rollerLineThree.IsEpmtyBefore = false;
  1233. //globalVar.rollerLineThree.CanRun = true;
  1234. globalVar.agvArriveLineFour = false;
  1235. globalVar.agvArriveCleanLoad = false;
  1236. globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
  1237. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  1238. globalVar.agvArriveLineThreeLoadCom = false;
  1239. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
  1240. MessageLog.GetInstance.ShowUserLog("滚筒线【3】空桶清洗任务重启成功");
  1241. }));
  1242. }
  1243. /// <summary>
  1244. /// 实时获取plc数据
  1245. /// </summary>
  1246. public void ReadPlcData()
  1247. {
  1248. ThreadManage.GetInstance().StartLong(new Action(() =>
  1249. {
  1250. GetAddressData("D2001", new Action<ushort[]>((data) =>
  1251. {
  1252. globalVar.rollerLineOne.StationOne = data[0];
  1253. globalVar.rollerLineOne.StationTwo = data[1];
  1254. globalVar.rollerLineOne.StationThree = data[2];
  1255. globalVar.rollerLineOne.StationFour = data[3];
  1256. globalVar.rollerLineOne.StationFive = data[4];
  1257. globalVar.rollerLineOne.StationSix = data[5];
  1258. globalVar.rollerLineOne.StationSeven = data[6];
  1259. globalVar.rollerLineOne.StationEight = data[7];
  1260. }));
  1261. GetAddressData("D2011", new Action<ushort[]>((data) =>
  1262. {
  1263. globalVar.rollerLineTwo.StationOne = data[0];
  1264. globalVar.rollerLineTwo.StationTwo = data[1];
  1265. globalVar.rollerLineTwo.StationThree = data[2];
  1266. globalVar.rollerLineTwo.StationFour = data[3];
  1267. globalVar.rollerLineTwo.StationFive = data[4];
  1268. globalVar.rollerLineTwo.StationSix = data[5];
  1269. globalVar.rollerLineTwo.StationSeven = data[6];
  1270. globalVar.rollerLineTwo.StationEight = data[7];
  1271. }));
  1272. GetAddressData("D2021", new Action<ushort[]>((data) =>
  1273. {
  1274. globalVar.rollerLineThree.StationOne = data[0];
  1275. globalVar.rollerLineThree.StationTwo = data[1];
  1276. globalVar.rollerLineThree.StationThree = data[2];
  1277. globalVar.rollerLineThree.StationFour = data[3];
  1278. globalVar.rollerLineThree.StationFive = data[4];
  1279. globalVar.rollerLineThree.StationSix = data[5];
  1280. globalVar.rollerLineThree.StationSeven = data[6];
  1281. globalVar.rollerLineThree.StationEight = data[7];
  1282. }));
  1283. GetAddressData("D2031", new Action<ushort[]>((data) =>
  1284. {
  1285. globalVar.rollerLineOne.OutMaterialingSingle = data[3];
  1286. globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
  1287. globalVar.rollerLineThree.OutMaterialingSingle = data[5];
  1288. AlarmHelper<AlarmInfo>.Alarm.LineOneRollerRunning = data[3];
  1289. AlarmHelper<AlarmInfo>.Alarm.LineTwoRollerRunning = data[4];
  1290. AlarmHelper<AlarmInfo>.Alarm.LineThreeRollerRunning = data[5];
  1291. AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
  1292. AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
  1293. AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
  1294. }));
  1295. GetAddressData("D2040", new Action<ushort[]>((data) =>
  1296. {
  1297. globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
  1298. globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
  1299. globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
  1300. globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
  1301. globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
  1302. AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerRunning = data[0];
  1303. AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerRunning = data[1];
  1304. AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerRunning = data[2];
  1305. AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerRunning = data[3];
  1306. AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerRunning = data[4];
  1307. }));
  1308. GetAddressData("D2045", new Action<ushort[]>((data) =>
  1309. {
  1310. globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
  1311. globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
  1312. globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
  1313. globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
  1314. globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
  1315. }));
  1316. GetAddressData("D2050", new Action<ushort[]>((data) =>
  1317. {
  1318. globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
  1319. globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
  1320. globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
  1321. globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
  1322. globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
  1323. }));
  1324. GetAddressData("D2065", new Action<ushort[]>((data) =>
  1325. {
  1326. globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
  1327. globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
  1328. globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
  1329. globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
  1330. globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
  1331. AlarmHelper<AlarmInfo>.Alarm.FryPotOneEmptyRollerRunning = data[0];
  1332. AlarmHelper<AlarmInfo>.Alarm.FryPotTwoEmptyRollerRunning = data[1];
  1333. AlarmHelper<AlarmInfo>.Alarm.FryPotThreeEmptyRollerRunning = data[2];
  1334. AlarmHelper<AlarmInfo>.Alarm.FryPotFourEmptyRollerRunning = data[3];
  1335. AlarmHelper<AlarmInfo>.Alarm.FryPotFiveEmptyRollerRunning = data[4];
  1336. }));
  1337. GetAddressData("D2070", new Action<ushort[]>((data) =>
  1338. {
  1339. //globalVar.fryPotOne.RollerTroubleSingle = data[0];
  1340. //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
  1341. //globalVar.fryPotThree.RollerTroubleSingle = data[2];
  1342. //globalVar.fryPotFour.RollerTroubleSingle = data[3];
  1343. //globalVar.fryPotFive.RollerTroubleSingle = data[4];
  1344. AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble = data[0];
  1345. AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
  1346. AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
  1347. AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
  1348. AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble = data[4];
  1349. }));
  1350. GetAddressData("D2078", new Action<ushort[]>(data =>
  1351. {
  1352. globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
  1353. globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
  1354. globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
  1355. }));
  1356. GetAddressData("D2075", new Action<ushort[]>(data =>
  1357. {
  1358. AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning = data[0];
  1359. globalVar.CleadBarrelEnterSingle = data[0];
  1360. }));
  1361. GetAddressData("2076", new Action<ushort[]>(data =>
  1362. {
  1363. globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号
  1364. }));
  1365. GetAddressData("D2077", new Action<ushort[]>(data =>
  1366. {
  1367. AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning = data[0];
  1368. globalVar.CleadBarrelExitSingle = data[0];
  1369. }));
  1370. //炒锅1状态数据
  1371. GetFryOneData("D2001", new Action<ushort[]>(data =>
  1372. {
  1373. //FryPotMonitorManage.GetInstance.fryOne.Temperature =?;
  1374. }));
  1375. //炒锅2状态数据
  1376. GetFryTwoData("D2001", new Action<ushort[]>(data =>
  1377. {
  1378. }));
  1379. //炒锅3状态数据
  1380. GetFryThreeData("D2001", new Action<ushort[]>(data =>
  1381. {
  1382. }));
  1383. //炒锅4状态数据
  1384. GetFryFourData("D2001", new Action<ushort[]>(data =>
  1385. {
  1386. }));
  1387. //炒锅5状态数据
  1388. GetFryFiveData("D2001", new Action<ushort[]>(data =>
  1389. {
  1390. }));
  1391. //线体上放空桶
  1392. if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0)
  1393. {
  1394. globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
  1395. ++globalVar.LOneMaterialNum;
  1396. //是否手动复位PLC
  1397. }
  1398. if (globalVar.rollerLineTwo.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineTwo.EmptyRollerNum != 0)
  1399. {
  1400. globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
  1401. ++globalVar.LTwoMaterialNum;
  1402. //是否手动复位PLC
  1403. }
  1404. if (globalVar.rollerLineThree.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineThree.EmptyRollerNum != 0)
  1405. {
  1406. globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
  1407. ++globalVar.LThreeMaterialNum;
  1408. //是否手动复位PLC
  1409. }
  1410. //炒锅状态数据
  1411. if (globalVar.fryPotOne.OilConfirm == 1)
  1412. {
  1413. FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
  1414. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
  1415. }
  1416. if (globalVar.fryPotTwo.OilConfirm == 1)
  1417. {
  1418. FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
  1419. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
  1420. }
  1421. if (globalVar.fryPotThree.OilConfirm == 1)
  1422. {
  1423. FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
  1424. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
  1425. }
  1426. if (globalVar.fryPotFour.OilConfirm == 1)
  1427. {
  1428. FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
  1429. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
  1430. }
  1431. if (globalVar.fryPotFive.OilConfirm == 1)
  1432. {
  1433. FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
  1434. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
  1435. }
  1436. //炒锅状态实时显示
  1437. FryPotStatusDisplay();
  1438. RollerLineStatusDisplay();
  1439. Thread.Sleep(10);
  1440. }), "MainViewReadPlcData");
  1441. }
  1442. /// <summary>
  1443. /// 炒锅状态实时显示
  1444. /// </summary>
  1445. private void FryPotStatusDisplay()
  1446. {
  1447. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
  1448. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString();
  1449. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
  1450. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
  1451. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
  1452. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
  1453. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();
  1454. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
  1455. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString();
  1456. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
  1457. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
  1458. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
  1459. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
  1460. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();
  1461. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
  1462. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString();
  1463. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
  1464. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
  1465. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
  1466. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
  1467. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();
  1468. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
  1469. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString();
  1470. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
  1471. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
  1472. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
  1473. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
  1474. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();
  1475. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
  1476. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString();
  1477. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
  1478. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
  1479. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
  1480. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
  1481. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();
  1482. //FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
  1483. //FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
  1484. //FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
  1485. //FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
  1486. //FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
  1487. //FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
  1488. //FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
  1489. }
  1490. /// <summary>
  1491. /// 炒锅状态数据保存到二进制文件
  1492. /// </summary>
  1493. public void FryPotDataSaveToBinaryFile()
  1494. {
  1495. #region 炒锅1状态数据保存
  1496. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据"))
  1497. {
  1498. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
  1499. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  1500. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  1501. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  1502. {
  1503. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1504. {
  1505. writeStream.Position = writeStream.Length;
  1506. PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1507. BinaryFormatter bf = new BinaryFormatter();
  1508. bf.Serialize(writeStream, p1);
  1509. }
  1510. }
  1511. }
  1512. else
  1513. {
  1514. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  1515. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  1516. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  1517. {
  1518. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1519. {
  1520. writeStream.Position = writeStream.Length;
  1521. PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1522. BinaryFormatter bf = new BinaryFormatter();
  1523. bf.Serialize(writeStream, p1);
  1524. }
  1525. }
  1526. }
  1527. #endregion
  1528. #region 炒锅2状态数据保存
  1529. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据"))
  1530. {
  1531. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
  1532. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  1533. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  1534. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  1535. {
  1536. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1537. {
  1538. writeStream.Position = writeStream.Length;
  1539. PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1540. BinaryFormatter bf = new BinaryFormatter();
  1541. bf.Serialize(writeStream, p1);
  1542. }
  1543. }
  1544. }
  1545. else
  1546. {
  1547. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  1548. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  1549. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  1550. {
  1551. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1552. {
  1553. writeStream.Position = writeStream.Length;
  1554. PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1555. BinaryFormatter bf = new BinaryFormatter();
  1556. bf.Serialize(writeStream, p1);
  1557. }
  1558. }
  1559. }
  1560. #endregion
  1561. #region 炒锅3状态数据保存
  1562. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据"))
  1563. {
  1564. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
  1565. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  1566. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  1567. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  1568. {
  1569. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1570. {
  1571. writeStream.Position = writeStream.Length;
  1572. PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1573. BinaryFormatter bf = new BinaryFormatter();
  1574. bf.Serialize(writeStream, p1);
  1575. }
  1576. }
  1577. }
  1578. else
  1579. {
  1580. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  1581. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  1582. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  1583. {
  1584. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1585. {
  1586. writeStream.Position = writeStream.Length;
  1587. PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1588. BinaryFormatter bf = new BinaryFormatter();
  1589. bf.Serialize(writeStream, p1);
  1590. }
  1591. }
  1592. }
  1593. #endregion
  1594. #region 炒锅4状态数据保存
  1595. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据"))
  1596. {
  1597. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
  1598. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  1599. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  1600. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  1601. {
  1602. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1603. {
  1604. writeStream.Position = writeStream.Length;
  1605. PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe,Time= DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1606. BinaryFormatter bf = new BinaryFormatter();
  1607. bf.Serialize(writeStream, p1);
  1608. }
  1609. }
  1610. }
  1611. else
  1612. {
  1613. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  1614. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  1615. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  1616. {
  1617. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1618. {
  1619. writeStream.Position = writeStream.Length;
  1620. PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1621. BinaryFormatter bf = new BinaryFormatter();
  1622. bf.Serialize(writeStream, p1);
  1623. }
  1624. }
  1625. }
  1626. #endregion
  1627. #region 炒锅5状态数据保存
  1628. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据"))
  1629. {
  1630. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
  1631. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  1632. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  1633. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  1634. {
  1635. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1636. {
  1637. writeStream.Position = writeStream.Length;
  1638. PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1639. BinaryFormatter bf = new BinaryFormatter();
  1640. bf.Serialize(writeStream, p1);
  1641. }
  1642. }
  1643. }
  1644. else
  1645. {
  1646. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  1647. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  1648. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  1649. {
  1650. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  1651. {
  1652. writeStream.Position = writeStream.Length;
  1653. PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
  1654. BinaryFormatter bf = new BinaryFormatter();
  1655. bf.Serialize(writeStream, p1);
  1656. }
  1657. }
  1658. }
  1659. #endregion
  1660. }
  1661. /// <summary>
  1662. /// 滚筒线运行状态显示
  1663. /// </summary>
  1664. private void RollerLineStatusDisplay()
  1665. {
  1666. hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
  1667. hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
  1668. hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
  1669. hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
  1670. hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
  1671. hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
  1672. hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
  1673. hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
  1674. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
  1675. {
  1676. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1677. }
  1678. else
  1679. {
  1680. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1681. }
  1682. if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
  1683. {
  1684. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1685. }
  1686. else
  1687. {
  1688. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1689. }
  1690. hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
  1691. hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
  1692. hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
  1693. hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
  1694. hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
  1695. hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
  1696. hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
  1697. hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
  1698. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)
  1699. {
  1700. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1701. }
  1702. else
  1703. {
  1704. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1705. }
  1706. if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
  1707. {
  1708. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1709. }
  1710. else
  1711. {
  1712. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1713. }
  1714. hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
  1715. hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
  1716. hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
  1717. hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
  1718. hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
  1719. hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
  1720. hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
  1721. hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
  1722. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)
  1723. {
  1724. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  1725. }
  1726. else
  1727. {
  1728. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  1729. }
  1730. if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
  1731. {
  1732. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  1733. }
  1734. else
  1735. {
  1736. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  1737. }
  1738. //滚筒线4
  1739. }
  1740. /// <summary>
  1741. /// 返回滚筒线PLC指定地址指定长度的数据
  1742. /// </summary>
  1743. /// <param name="address"></param>
  1744. /// <returns></returns>
  1745. public void GetAddressData(string address, Action<ushort[]> action)
  1746. {
  1747. PlcReadData = DeviceOperate.GetInstance.GetAllData();
  1748. if (PlcReadData.ContainsKey(address))
  1749. {
  1750. action((ushort[])(PlcReadData[address]));
  1751. }
  1752. }
  1753. public void GetFryOneData(string address, Action<ushort[]> action)
  1754. {
  1755. FryOneData = DeviceOperate.GetInstance.GetFryOneData();
  1756. if (FryOneData.ContainsKey(address))
  1757. {
  1758. action((ushort[])(FryOneData[address]));
  1759. }
  1760. }
  1761. public void GetFryTwoData(string address, Action<ushort[]> action)
  1762. {
  1763. FryTwoData = DeviceOperate.GetInstance.GetFryTwoData();
  1764. if (FryTwoData.ContainsKey(address))
  1765. {
  1766. action((ushort[])(FryTwoData[address]));
  1767. }
  1768. }
  1769. public void GetFryThreeData(string address, Action<ushort[]> action)
  1770. {
  1771. FryThreeData = DeviceOperate.GetInstance.GetFryThreeData();
  1772. if (FryThreeData.ContainsKey(address))
  1773. {
  1774. action((ushort[])(FryThreeData[address]));
  1775. }
  1776. }
  1777. public void GetFryFourData(string address, Action<ushort[]> action)
  1778. {
  1779. FryFourData = DeviceOperate.GetInstance.GetFryFourData();
  1780. if (FryFourData.ContainsKey(address))
  1781. {
  1782. action((ushort[])(FryFourData[address]));
  1783. }
  1784. }
  1785. public void GetFryFiveData(string address, Action<ushort[]> action)
  1786. {
  1787. FryFiveData = DeviceOperate.GetInstance.GetFryFiveData();
  1788. if (FryFiveData.ContainsKey(address))
  1789. {
  1790. action((ushort[])(FryFiveData[address]));
  1791. }
  1792. }
  1793. /// <summary>
  1794. /// 写Plc数据
  1795. /// </summary>
  1796. /// <param name="address"></param>
  1797. /// <param name="Value"></param>
  1798. public void WritePlcData(string address, ushort Value)
  1799. {
  1800. DeviceOperate.GetInstance.WritePlcData(address, Value);
  1801. }
  1802. /// <summary>
  1803. /// 初始化任务
  1804. /// </summary>
  1805. //public void IniteTask()
  1806. //{
  1807. // ThreadManage.GetInstance().StartLong(new Action(() =>
  1808. // {
  1809. // MainTask();
  1810. // }), "MainTask");
  1811. //}
  1812. /// <summary>
  1813. /// 配方数据接收
  1814. /// </summary>
  1815. public void RecipeDataParse(object obj)
  1816. {
  1817. Task.Run(new Action(() =>
  1818. {
  1819. if (obj != null && obj is NewRecipeModel[] recipes)
  1820. {
  1821. ReicpeNum = ReicpeNum + recipes.Length;
  1822. MessageLog.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
  1823. for (int i = 0; i < recipes.Length; i++)
  1824. {
  1825. int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100;
  1826. if (res != null)
  1827. {
  1828. switch (res)
  1829. {
  1830. case 1:
  1831. case 4: RecipeQuene.Enqueue(recipes[i]); break;
  1832. case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break;
  1833. case 2:
  1834. case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break;
  1835. }
  1836. }
  1837. }
  1838. }
  1839. }));
  1840. }
  1841. /// <summary>
  1842. /// 开启主任务
  1843. /// </summary>
  1844. public void MainTask()
  1845. {
  1846. ////RecipeDataToPlc();
  1847. //LOneRecipeDataToPlc();
  1848. //LTwoRecipeDataToPlc();
  1849. //LThreeRecipeDataToPlc();
  1850. ////AgvLoadRoller();
  1851. //LOneLoadRoller();
  1852. //LTwoAgvLoadRoller();
  1853. //LThreeAgvLoadRoller();
  1854. //// FryPotInputMaterial();
  1855. //LOneFryPotInputMaterial();
  1856. //LTwoFryPotInputMaterial();
  1857. //LThreeFryPotInputMaterial();
  1858. ////FryPotOutputMaterial();
  1859. //LOneFryPotOutputMaterial();
  1860. //LTwoFryPotOutputMaterial();
  1861. //LThreeFryPotOutputMaterial();
  1862. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  1863. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  1864. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  1865. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
  1866. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
  1867. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
  1868. ThreadManage.GetInstance().StartLong(new Action(() => { ToLineFourFromCleanPlate(); Thread.Sleep(10); }), "清洗台空桶回桶任务线程");
  1869. ThreadManage.GetInstance().StartLong(new Action(() => { EmptyRollerToLinFourFromPot(); Thread.Sleep(10); }), "炒锅空桶回桶任务线程");
  1870. }
  1871. /// <summary>
  1872. /// 线体1的执行流程
  1873. /// </summary>
  1874. public void LineOneProcessExecute()
  1875. {
  1876. //if (!globalVar.LOneTaskLock)
  1877. //{
  1878. // globalVar.LOneTaskLock = true;
  1879. LOneRecipeDataToPlc();
  1880. LOneLoadRoller();
  1881. LOneFryPotInputMaterial();
  1882. LOneFallMaterial();
  1883. LOneFryPotOutputMaterial();
  1884. LOneEmptyOperate();
  1885. // globalVar.LOneTaskLock = false;
  1886. //}
  1887. }
  1888. /// <summary>
  1889. /// 线体2的执行流程
  1890. /// </summary>
  1891. public void LineTwoProcessExecute()
  1892. {
  1893. //if (!globalVar.LTwoTaskLock)
  1894. //{
  1895. // globalVar.LTwoTaskLock = true;
  1896. LTwoRecipeDataToPlc();
  1897. LTwoAgvLoadRoller();
  1898. LTwoFryPotInputMaterial();
  1899. LTwoFallMaterial();
  1900. LTwoFryPotOutputMaterial();
  1901. LTwoEmptyOperate();
  1902. // globalVar.LTwoTaskLock = false;
  1903. //}
  1904. }
  1905. /// <summary>
  1906. /// 线体3的执行流程
  1907. /// </summary>
  1908. public void LineThreeProcessExecute()
  1909. {
  1910. //if (!globalVar.LThreeTaskLock)
  1911. //{
  1912. // globalVar.LThreeTaskLock = true;
  1913. LThreeRecipeDataToPlc();
  1914. LThreeAgvLoadRoller();
  1915. LThreeFryPotInputMaterial();
  1916. LThreeFallMaterial();
  1917. LThreeFryPotOutputMaterial();
  1918. LThreeEmptyOperate();
  1919. // globalVar.LThreeTaskLock = false;
  1920. //}
  1921. }
  1922. private void LineOneToCleanProcessExecute()
  1923. {
  1924. //线体1到清洗台
  1925. AgvFromLineOneToCleanPlate();
  1926. AgvArriveCleanPlateFromLineOne();
  1927. }
  1928. public void LineTwoToCleanProcessExecute()
  1929. {
  1930. //线体1到清洗台
  1931. AgvFromLineTwoToCleanPlate();
  1932. AgvArriveCleanPlateFromLineTwo();
  1933. }
  1934. public void LineThreeToCleanProcessExecute()
  1935. {
  1936. //线体1到清洗台
  1937. AgvFromLineThreeToCleanPlate();
  1938. AgvArriveCleanPlateFromLineThree();
  1939. }
  1940. private void ToLineFourFromCleanPlate()
  1941. {
  1942. //空桶到线体4
  1943. CallAgvToLineFour();
  1944. CleanPlateUpLoad();
  1945. EmptyRollerToLinFourFromClean();
  1946. }
  1947. private void CleanPlateUpLoad()
  1948. {
  1949. if (globalVar.agvArriveCleanLoad)
  1950. {
  1951. globalVar.agvArriveCleanLoad = false;
  1952. MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
  1953. erp: if (AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning == 0)
  1954. {
  1955. //plc交互
  1956. WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
  1957. }
  1958. else//有故障
  1959. {
  1960. while (AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning == 1)
  1961. {
  1962. Thread.Sleep(5);
  1963. if (globalVar.ExitLineOneTask)
  1964. return;
  1965. }
  1966. MessageLog.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!");
  1967. goto erp;
  1968. }
  1969. }
  1970. }
  1971. /// <summary>
  1972. /// 线体1到清洗台
  1973. /// </summary>
  1974. private void AgvFromLineOneToCleanPlate()
  1975. {
  1976. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
  1977. {
  1978. //线体1到清洗台
  1979. if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun)
  1980. {
  1981. var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  1982. if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶
  1983. {
  1984. //下发AGV去空桶线洗桶任务
  1985. e: string id = Guid.NewGuid().ToString("N");
  1986. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  1987. goto e;
  1988. string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  1989. LSevenrobotJobId.Add(id);
  1990. Thread.Sleep(500);
  1991. LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
  1992. globalVar.rollerLineOne.IsEpmtyBefore = true;
  1993. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  1994. }
  1995. }
  1996. else
  1997. {
  1998. AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  1999. }
  2000. }
  2001. }
  2002. /// <summary>
  2003. /// 线体2到清洗台
  2004. /// </summary>
  2005. private void AgvFromLineTwoToCleanPlate()
  2006. {
  2007. // 线体2到清洗台
  2008. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
  2009. {
  2010. if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun)
  2011. {
  2012. var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  2013. if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
  2014. {
  2015. //下发AGV去空桶线洗桶任务
  2016. e: string id = Guid.NewGuid().ToString("N");
  2017. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  2018. goto e;
  2019. string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  2020. LEightrobotJobId.Add(id);
  2021. Thread.Sleep(500);
  2022. LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
  2023. globalVar.rollerLineTwo.IsEpmtyBefore = true;
  2024. //AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  2025. }
  2026. }
  2027. else
  2028. {
  2029. AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  2030. }
  2031. }
  2032. }
  2033. /// <summary>
  2034. /// 线体3到清洗台
  2035. /// </summary>
  2036. private void AgvFromLineThreeToCleanPlate()
  2037. {
  2038. //线体3到清洗台
  2039. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  2040. {
  2041. if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun)
  2042. {
  2043. var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  2044. if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶
  2045. {
  2046. //下发AGV去空桶线洗桶任务
  2047. e: string id = Guid.NewGuid().ToString("N");
  2048. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  2049. goto e;
  2050. string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  2051. LNinerobotJobId.Add(id);
  2052. Thread.Sleep(500);
  2053. LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
  2054. globalVar.rollerLineThree.IsEpmtyBefore = true;
  2055. //AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  2056. }
  2057. }
  2058. else
  2059. {
  2060. AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  2061. }
  2062. }
  2063. }
  2064. /// <summary>
  2065. /// AGV从线体1到达清洗台下料位置
  2066. /// </summary>
  2067. private void AgvArriveCleanPlateFromLineOne()
  2068. {
  2069. if (globalVar.rollerLineOne.agvArriveCleanUnLoad)
  2070. {
  2071. globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
  2072. MessageLog.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶");
  2073. erp: if (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
  2074. {
  2075. //plc交互
  2076. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  2077. }
  2078. else//有故障
  2079. {
  2080. while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
  2081. {
  2082. Thread.Sleep(5);
  2083. if (globalVar.ExitLineOneTask)
  2084. return;
  2085. }
  2086. MessageLog.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  2087. goto erp;
  2088. }
  2089. }
  2090. }
  2091. /// <summary>
  2092. /// AGV从线体2到达清洗台下料位置
  2093. /// </summary>
  2094. private void AgvArriveCleanPlateFromLineTwo()
  2095. {
  2096. if (globalVar.rollerLineTwo.agvArriveCleanUnLoad)
  2097. {
  2098. globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
  2099. MessageLog.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶");
  2100. erp: if (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
  2101. {
  2102. //plc交互
  2103. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  2104. }
  2105. else//有故障
  2106. {
  2107. while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
  2108. {
  2109. Thread.Sleep(5);
  2110. if (globalVar.ExitLineOneTask)
  2111. return;
  2112. }
  2113. MessageLog.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  2114. goto erp;
  2115. }
  2116. }
  2117. }
  2118. /// <summary>
  2119. /// AGV从线体3到达清洗台下料位置
  2120. /// </summary>
  2121. private void AgvArriveCleanPlateFromLineThree()
  2122. {
  2123. if (globalVar.rollerLineThree.agvArriveCleanUnLoad)
  2124. {
  2125. globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
  2126. MessageLog.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶");
  2127. erp: if (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
  2128. {
  2129. //plc交互
  2130. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  2131. }
  2132. else//有故障
  2133. {
  2134. while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
  2135. {
  2136. Thread.Sleep(5);
  2137. if (globalVar.ExitLineOneTask)
  2138. return;
  2139. }
  2140. MessageLog.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  2141. goto erp;
  2142. }
  2143. ////plc交互
  2144. //WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  2145. //if (globalVar.CleadBarrelEnterSingle == 0)
  2146. //{
  2147. // MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!");
  2148. //}
  2149. }
  2150. }
  2151. /// <summary>
  2152. /// 呼叫Agv从清洗台运洗好的空桶到四号线体
  2153. /// </summary>
  2154. public void CallAgvToLineFour()
  2155. {
  2156. if (globalVar.CleanComplete == 1)
  2157. {
  2158. //是否需要手动给PLC置位??
  2159. globalVar.CleanComplete = 0;
  2160. e: string id = Guid.NewGuid().ToString("N");
  2161. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  2162. goto e;
  2163. string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id);
  2164. LTenrobotJobId.Add(id);
  2165. Thread.Sleep(500);
  2166. MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
  2167. CleanToLineCarryTaskErrorCodeAnalysis(info, 4);
  2168. }
  2169. }
  2170. /// <summary>
  2171. /// 3号滚筒线数据下发 2022/7/4 新增
  2172. /// </summary>
  2173. /// <exception cref="NotImplementedException"></exception>
  2174. private void LThreeRecipeDataToPlc()
  2175. {
  2176. if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe && globalVar.rollerLineThree.RecipeCompleteSingle == 1)
  2177. {
  2178. globalVar.rollerLineThree.RecipeComMidSingle = 1;
  2179. if (globalVar.LThreeCurrentRecipeName != string.Empty)
  2180. {
  2181. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
  2182. if (globalVar.LThreeFryPotSerial == 3)
  2183. {
  2184. FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
  2185. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
  2186. {
  2187. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2188. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2189. }
  2190. //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2191. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  2192. }
  2193. globalVar.LThreeCurrentRecipeName = string.Empty;
  2194. Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
  2195. }
  2196. }
  2197. if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1)//后续添加其它限制条件
  2198. {
  2199. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
  2200. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
  2201. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
  2202. //if (globalVar.LThreeCurrentRecipeName != string.Empty)
  2203. // MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
  2204. if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
  2205. {
  2206. LThreeErrorRecipe = false;
  2207. int headNum = result.materialCollection[0].MaterialLoc / 100;
  2208. globalVar.LThreeMaterialNum = result.materialCollection.Count;
  2209. globalVar.LThreeFryPotSerial = headNum;
  2210. globalVar.LThreeCurrentRecipeName = result.RecipeName;
  2211. AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
  2212. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
  2213. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2214. {
  2215. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
  2216. {
  2217. fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
  2218. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
  2219. //将配方中原料加入新的队列
  2220. LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
  2221. {
  2222. materialType = result.materialCollection[i],
  2223. materialId = result.RecipeId
  2224. });
  2225. RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//3号滚筒线桶号以及重量数据下发
  2226. }
  2227. else
  2228. {
  2229. MessageLog.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2230. MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2231. LThreeInputMaterialQuene.Clear();
  2232. LThreeErrorRecipe = true;
  2233. return;
  2234. }
  2235. }
  2236. DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
  2237. globalVar.rollerLineThree.RecipeComMidSingle = 0;
  2238. }
  2239. }
  2240. }
  2241. /// <summary>
  2242. /// 2号滚筒线数据下发 2022/7/4 新增
  2243. /// </summary>
  2244. /// <exception cref="NotImplementedException"></exception>
  2245. private void LTwoRecipeDataToPlc()
  2246. {
  2247. if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe && globalVar.rollerLineTwo.RecipeCompleteSingle == 1)
  2248. {
  2249. globalVar.rollerLineTwo.RecipeComMidSingle = 1;
  2250. if (globalVar.LTwoCurrentRecipeName != string.Empty)
  2251. {
  2252. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
  2253. if (globalVar.LTwoFryPotSerial == 2)
  2254. {
  2255. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
  2256. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
  2257. {
  2258. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2259. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2260. }
  2261. //Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2262. //Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  2263. }
  2264. if (globalVar.LTwoFryPotSerial == 5)
  2265. {
  2266. FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
  2267. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
  2268. {
  2269. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2270. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2271. }
  2272. //Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2273. //Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  2274. }
  2275. globalVar.LTwoCurrentRecipeName = string.Empty;
  2276. Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
  2277. }
  2278. }
  2279. if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1)//后续添加其它限制条件
  2280. {
  2281. if (globalVar.LTwoFryPotSerial == 2)
  2282. {
  2283. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; }));
  2284. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection<WorkflowModel>(); }));
  2285. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  2286. }
  2287. if (globalVar.LTwoFryPotSerial == 5)
  2288. {
  2289. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; }));
  2290. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
  2291. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  2292. }
  2293. //if (globalVar.LTwoCurrentRecipeName != string.Empty)
  2294. // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
  2295. if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
  2296. {
  2297. LTwoErrorRecipe = false;
  2298. int headNum = result.materialCollection[0].MaterialLoc / 100;
  2299. globalVar.LTwoMaterialNum = result.materialCollection.Count;
  2300. globalVar.LTwoFryPotSerial = headNum;
  2301. globalVar.LTwoCurrentRecipeName = result.RecipeName;
  2302. AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
  2303. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
  2304. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2305. {
  2306. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5))
  2307. {
  2308. if (headNum == 2)//炒锅2
  2309. {
  2310. fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
  2311. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
  2312. }
  2313. else//炒锅5
  2314. {
  2315. fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
  2316. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
  2317. }
  2318. //将配方中原料加入新的队列
  2319. LTwoInputMaterialQuene.Enqueue(new MaterialInfo()
  2320. {
  2321. materialType = result.materialCollection[i],
  2322. materialId = result.RecipeId
  2323. });
  2324. RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//2号滚筒线桶号以及重量数据下发
  2325. }
  2326. else
  2327. {
  2328. MessageLog.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2329. MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2330. LTwoInputMaterialQuene.Clear();
  2331. LTwoErrorRecipe = true;
  2332. return;
  2333. }
  2334. }
  2335. DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
  2336. globalVar.rollerLineTwo.RecipeComMidSingle = 0;
  2337. }
  2338. }
  2339. }
  2340. /// <summary>
  2341. /// 1号滚筒线数据下发 2022/7/4 新增
  2342. /// </summary>
  2343. private void LOneRecipeDataToPlc()
  2344. {
  2345. if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe && globalVar.rollerLineOne.RecipeCompleteSingle == 1)
  2346. {
  2347. globalVar.rollerLineOne.RecipeComMidSingle = 1;
  2348. if (globalVar.LOneCurrentRecipeName != string.Empty)
  2349. {
  2350. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
  2351. if (globalVar.LOneFryPotSerial == 1)
  2352. {
  2353. FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
  2354. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
  2355. {
  2356. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2357. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2358. }
  2359. //Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2360. //Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
  2361. }
  2362. if (globalVar.LOneFryPotSerial == 4)
  2363. {
  2364. FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
  2365. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
  2366. {
  2367. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  2368. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
  2369. }
  2370. //Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2371. //Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
  2372. }
  2373. globalVar.LOneCurrentRecipeName = string.Empty;
  2374. Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
  2375. }
  2376. }
  2377. if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1)//后续添加其它限制条件
  2378. {
  2379. if (globalVar.LOneFryPotSerial == 1)
  2380. {
  2381. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; }));
  2382. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection<WorkflowModel>(); }));
  2383. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  2384. }
  2385. if (globalVar.LOneFryPotSerial == 4)
  2386. {
  2387. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; }));
  2388. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection<WorkflowModel>(); }));
  2389. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  2390. }
  2391. if (RecipeQuene.TryDequeue(out NewRecipeModel result))
  2392. {
  2393. ErrorRecipe = false;
  2394. int headNum = result.materialCollection[0].MaterialLoc / 100;
  2395. globalVar.LOneMaterialNum = result.materialCollection.Count;
  2396. globalVar.LOneFryPotSerial = headNum;
  2397. globalVar.LOneCurrentRecipeName = result.RecipeName;
  2398. AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
  2399. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
  2400. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2401. {
  2402. if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
  2403. {
  2404. if (headNum == 1)//炒锅1
  2405. {
  2406. fryOneRecipe = result.RecipeName;//炒锅状态开始记录
  2407. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
  2408. }
  2409. else//炒锅4
  2410. {
  2411. fryFourRecipe = result.RecipeName;//炒锅状态开始记录
  2412. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
  2413. }
  2414. //将配方中原料加入新的队列
  2415. InputMaterialQuene.Enqueue(new MaterialInfo()
  2416. {
  2417. materialType = result.materialCollection[i],
  2418. materialId = result.RecipeId
  2419. });
  2420. RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//1号滚筒线桶号以及重量数据下发
  2421. }
  2422. else
  2423. {
  2424. MessageLog.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2425. MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  2426. InputMaterialQuene.Clear();
  2427. ErrorRecipe = true;
  2428. return;
  2429. }
  2430. }
  2431. DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
  2432. globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0
  2433. }
  2434. }
  2435. }
  2436. /// <summary>
  2437. /// 数据下发PLC
  2438. /// </summary>
  2439. //public void RecipeDataToPlc()
  2440. //{
  2441. // if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
  2442. // {
  2443. // //NewRecipeModel newRecipe = new NewRecipeModel();
  2444. // //MaterialType material = new MaterialType();
  2445. // if (RecipeQuene.TryDequeue(out NewRecipeModel result))
  2446. // {
  2447. // //newRecipe = result;
  2448. // MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方");
  2449. // //for (int k = 0; k < newRecipe.materialCollection.Count - 1; k++)
  2450. // //{
  2451. // // for (int j = 0; j < newRecipe.materialCollection.Count - 1 - k; j++)
  2452. // // {
  2453. // // if (newRecipe.materialCollection[j].MaterialLoc > newRecipe.materialCollection[j + 1].MaterialLoc)
  2454. // // {
  2455. // // material = newRecipe.materialCollection[j];
  2456. // // // newRecipe.materialCollection[j] = null;
  2457. // // newRecipe.materialCollection[j] = newRecipe.materialCollection[j + 1];
  2458. // // // newRecipe.materialCollection[j + 1] = null;
  2459. // // newRecipe.materialCollection[j + 1] = material;
  2460. // // }
  2461. // // }
  2462. // //}
  2463. // for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  2464. // {
  2465. // //将配方中原料加入新的队列
  2466. // InputMaterialQuene.Enqueue(new MaterialInfo()
  2467. // {
  2468. // materialType = result.materialCollection[i],
  2469. // materialId = result.RecipeId
  2470. // });
  2471. // ushort n = result.materialCollection[i].MaterialLoc;
  2472. // switch (n / 100)
  2473. // {
  2474. // case 1:
  2475. // case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
  2476. // case 2:
  2477. // case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
  2478. // case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
  2479. // }
  2480. // }
  2481. // switch (result.materialCollection[0].MaterialLoc / 100)
  2482. // {
  2483. // case 1:
  2484. // DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
  2485. // case 2:
  2486. // DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
  2487. // case 3:
  2488. // DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
  2489. // }
  2490. // }
  2491. // }
  2492. //}
  2493. /// <summary>
  2494. /// AGV到配方线体1装桶以及出料到炒锅
  2495. /// </summary>
  2496. //public void AgvLoadRoller()
  2497. //{
  2498. // //lineAlarm = 0;
  2499. // if (InputMaterialQuene.Count > 0)
  2500. // {
  2501. // switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  2502. // {
  2503. // case 1:
  2504. // case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
  2505. // case 2:
  2506. // case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
  2507. // case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
  2508. // }
  2509. // }
  2510. //}
  2511. /// <summary>
  2512. /// AGV到配方线体1装桶以及出料到炒锅
  2513. /// </summary>
  2514. public void LOneLoadRoller()
  2515. {
  2516. if (InputMaterialQuene.Count > 0)
  2517. {
  2518. AgvToLineOneLoadRoller();
  2519. AgvFromLineOneToFryPot();//AGV到1号线体装桶
  2520. AgvLineOneLoadRollerCom();
  2521. }
  2522. }
  2523. /// <summary>
  2524. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2525. /// </summary>
  2526. /// <exception cref="NotImplementedException"></exception>
  2527. private void AgvLineOneLoadRollerCom()
  2528. {
  2529. if (globalVar.agvLineOneLoadCom)
  2530. {
  2531. globalVar.rollerLineOne.CanRun = true;
  2532. globalVar.agvLineOneLoadCom = false;
  2533. MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
  2534. }
  2535. }
  2536. /// <summary>
  2537. /// AGV到配方线体2装桶以及出料到炒锅
  2538. /// </summary>
  2539. public void LTwoAgvLoadRoller()
  2540. {
  2541. if (LTwoInputMaterialQuene.Count > 0)
  2542. {
  2543. AgvToLineTwoLoadRoller();
  2544. AgvFromLineTwoToFryPot();//AGV到2号线体装桶
  2545. AgvLineTwoLoadRollerCom();
  2546. }
  2547. }
  2548. /// <summary>
  2549. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2550. /// </summary>
  2551. private void AgvLineTwoLoadRollerCom()
  2552. {
  2553. if (globalVar.agvLineTwoLoadCom)
  2554. {
  2555. globalVar.rollerLineTwo.CanRun = true;
  2556. globalVar.agvLineTwoLoadCom = false;
  2557. MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
  2558. }
  2559. }
  2560. /// <summary>
  2561. /// AGV到配方线体3装桶以及出料到炒锅
  2562. /// </summary>
  2563. public void LThreeAgvLoadRoller()
  2564. {
  2565. if (LThreeInputMaterialQuene.Count > 0)
  2566. {
  2567. AgvToLineThreeLoadRoller();
  2568. AgvFromLineThreeToFryPot();//AGV到2号线体装桶
  2569. AgvLineThreeLoadRollerCom();
  2570. }
  2571. }
  2572. /// <summary>
  2573. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  2574. /// </summary>
  2575. private void AgvLineThreeLoadRollerCom()
  2576. {
  2577. if (globalVar.agvLineThreeLoadCom)
  2578. {
  2579. globalVar.rollerLineThree.CanRun = true;
  2580. globalVar.agvLineThreeLoadCom = false;
  2581. MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
  2582. }
  2583. }
  2584. /// <summary>
  2585. /// AGV从炒锅送料位置到倒料过程处理
  2586. /// </summary>
  2587. //public void FryPotInputMaterial()
  2588. //{
  2589. // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
  2590. // {
  2591. // while (!agvArriveUnLoad)//等待agv到达炒锅位置
  2592. // {
  2593. // Thread.Sleep(5);
  2594. // if (globalVar.ExitMainTask)
  2595. // return;
  2596. // }
  2597. // AgvArriveFryPotSingleSetDown();
  2598. // FryPotRollerTroubleCheck();
  2599. // if (FryPotAlarm == 1)//炒锅滚筒无故障
  2600. // {
  2601. // //炒锅滚筒进料运行到位处理
  2602. // FryPotInputMaterialRollerOperate();
  2603. // globalVar.InOrOutputLock = true;
  2604. // }
  2605. // }
  2606. //}
  2607. /// <summary>
  2608. /// 线体1的AGV从炒锅送料位置到倒料过程处理
  2609. /// </summary>
  2610. public void LOneFryPotInputMaterial()
  2611. {
  2612. if (OutputMaterialQuene.Count > 0 && globalVar.agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
  2613. {
  2614. //if (globalVar.LOneFryPotSerial == 1)
  2615. //{
  2616. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
  2617. //}
  2618. //else if (globalVar.LOneFryPotSerial == 4)
  2619. //{
  2620. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
  2621. //}
  2622. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
  2623. AgvArriveFryPotOneOrFourSingleSetDown();
  2624. globalVar.agvArriveUnLoad = false;
  2625. globalVar.PotOneInputMaterialArrive = true;
  2626. FryPotOneRollerTroubleCheck();
  2627. }
  2628. }
  2629. public void LOneFallMaterial()
  2630. {
  2631. if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
  2632. {
  2633. //if (globalVar.LOneFryPotSerial == 1)
  2634. //{
  2635. // Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2636. // Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
  2637. //}
  2638. //else
  2639. //{
  2640. // Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2641. // Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
  2642. //}
  2643. //FryPotOneRollerTroubleCheck();
  2644. if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1 )|| (FryPotFourAlarm == 1&& globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障
  2645. {
  2646. if (globalVar.LOneFryPotSerial == 1)
  2647. {
  2648. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2649. }
  2650. else
  2651. {
  2652. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2653. }
  2654. //炒锅滚筒进料运行到位处理
  2655. FryPotOneOrFourInputMaterialRollerOperate();
  2656. AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
  2657. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
  2658. globalVar.InOrOutputLock = true;
  2659. globalVar.PotOneOutputRollerArrive = true;
  2660. }
  2661. }
  2662. }
  2663. /// <summary>
  2664. /// 线体2的AGV从炒锅送料位置到倒料过程处理
  2665. /// </summary>
  2666. public void LTwoFryPotInputMaterial()
  2667. {
  2668. if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
  2669. {
  2670. //if (globalVar.LTwoFryPotSerial == 2)
  2671. //{
  2672. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
  2673. //}
  2674. //else if (globalVar.LTwoFryPotSerial == 5)
  2675. //{
  2676. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
  2677. //}
  2678. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
  2679. AgvArriveFryPotTwoOrFiveSingleSetDown();
  2680. globalVar.LTwoagvArriveUnLoad = false;
  2681. globalVar.LTwoPotInputMaterialArrive = true;
  2682. FryPotTwoRollerTroubleCheck();
  2683. }
  2684. }
  2685. public void LTwoFallMaterial()
  2686. {
  2687. if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
  2688. {
  2689. //if (globalVar.LTwoFryPotSerial == 2)
  2690. //{
  2691. // Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2692. // Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  2693. //}
  2694. //else
  2695. //{
  2696. // Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2697. // Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  2698. //}
  2699. if ((FryPotTwoAlarm == 1&& globalVar.LTwoFryPotSerial == 2) ||( FryPotFiveAlarm == 1&& globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障
  2700. {
  2701. if (globalVar.LTwoFryPotSerial == 2)
  2702. {
  2703. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2704. }
  2705. else
  2706. {
  2707. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2708. }
  2709. //炒锅滚筒进料运行到位处理
  2710. FryPotTwoOrFiveInputMaterialRollerOperate();
  2711. AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
  2712. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
  2713. globalVar.LTwoInOrOutputLock = true;
  2714. globalVar.LTwoPotOutputRollerArrive = true;
  2715. }
  2716. }
  2717. }
  2718. /// <summary>
  2719. /// 线体3的AGV从炒锅送料位置到倒料过程处理
  2720. /// </summary>
  2721. public void LThreeFryPotInputMaterial()
  2722. {
  2723. if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
  2724. {
  2725. // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
  2726. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
  2727. AgvArriveFryPotThreeSingleSetDown();
  2728. globalVar.LThreeagvArriveUnLoad = false;
  2729. globalVar.LThreePotInputMaterialArrive = true;
  2730. FryPotThreeRollerTroubleCheck();
  2731. }
  2732. }
  2733. public void LThreeFallMaterial()
  2734. {
  2735. if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
  2736. {
  2737. //Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
  2738. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  2739. if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
  2740. {
  2741. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
  2742. //炒锅滚筒进料运行到位处理
  2743. FryPotThreeInputMaterialRollerOperate();
  2744. AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
  2745. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
  2746. globalVar.LThreeInOrOutputLock = true;
  2747. globalVar.LThreePotOutputRollerArrive = true;
  2748. }
  2749. }
  2750. }
  2751. /// <summary>
  2752. /// 炒锅出桶
  2753. /// </summary>
  2754. //public void FryPotOutputMaterial()
  2755. //{
  2756. // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
  2757. // {
  2758. // AgvFromFryPotToClean();//上游下发搬运任务给AGV
  2759. // while (!agvArriveUpLoad)//等待agv到达炒锅位置
  2760. // {
  2761. // Thread.Sleep(5);
  2762. // if (globalVar.ExitMainTask)
  2763. // return;
  2764. // }
  2765. // agvArriveUpLoad = false;
  2766. // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2767. // FryPotRollerTroubleCheck();
  2768. // if (FryPotAlarm == 1)//无故障
  2769. // {
  2770. // FryPotOutEmpetyRollerOperate();
  2771. // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2772. // {
  2773. // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
  2774. // {
  2775. // Thread.Sleep(5);
  2776. // if (globalVar.ExitMainTask)
  2777. // return;
  2778. // }
  2779. // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2780. // globalVar.AllowAgvToLineLoadRoller = true;
  2781. // globalVar.InOrOutputLock = false;
  2782. // }
  2783. // }
  2784. // }
  2785. //}
  2786. /// <summary>
  2787. /// 线体1对应炒锅出桶
  2788. /// </summary>
  2789. public void LOneFryPotOutputMaterial()
  2790. {
  2791. if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.agvArriveUpLoad && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
  2792. {
  2793. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
  2794. AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2795. globalVar.agvArriveUpLoad = false;
  2796. globalVar.AgvArrivePot = true;
  2797. FryPotOneRollerTroubleCheck();
  2798. }
  2799. }
  2800. public void LOneEmptyOperate()
  2801. {
  2802. if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
  2803. {
  2804. // FryPotOneRollerTroubleCheck();
  2805. if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障
  2806. {
  2807. if (globalVar.agvFryPotEmptyRollerArrive)
  2808. {
  2809. FryPotOneOrFourOutEmpetyRollerOperate();
  2810. if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2811. {
  2812. //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
  2813. //if (globalVar.LOneFryPotSerial == 1)
  2814. //{
  2815. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
  2816. //}
  2817. //else if (globalVar.LOneFryPotSerial == 4)
  2818. //{
  2819. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
  2820. //}
  2821. globalVar.agvFryPotEmptyRollerArrive = false;
  2822. globalVar.InOrOutputLock = false;
  2823. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2824. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2825. globalVar.AllowAgvToLineLoadRoller = true;
  2826. globalVar.LoadRoller = false;
  2827. globalVar.AgvToFryPot = false;
  2828. globalVar.PotOneInputMaterialArrive = false;
  2829. globalVar.PotOneOutputRollerArrive = false;
  2830. globalVar.AgvArrivePot = false;
  2831. }
  2832. }
  2833. }
  2834. }
  2835. }
  2836. /// <summary>
  2837. /// 线体2对应炒锅出桶
  2838. /// </summary>
  2839. public void LTwoFryPotOutputMaterial()
  2840. {
  2841. if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && globalVar.agvArriveLTwoUpLoad && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
  2842. {
  2843. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
  2844. AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2845. globalVar.agvArriveLTwoUpLoad = false;
  2846. globalVar.LTwoAgvArrivePot = true;
  2847. }
  2848. }
  2849. public void LTwoEmptyOperate()
  2850. {
  2851. if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
  2852. {
  2853. FryPotTwoRollerTroubleCheck();
  2854. if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
  2855. {
  2856. if (globalVar.LTwoagvFryPotEmptyRollerArrive)
  2857. {
  2858. FryPotTwoOrFiveOutEmpetyRollerOperate();
  2859. if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2860. {
  2861. //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
  2862. //if (globalVar.LTwoFryPotSerial == 2)
  2863. //{
  2864. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
  2865. //}
  2866. //else if (globalVar.LTwoFryPotSerial == 5)
  2867. //{
  2868. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
  2869. //}
  2870. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  2871. globalVar.LTwoInOrOutputLock = false;
  2872. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2873. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2874. globalVar.AllowAgvToLineTwoLoadRoller = true;
  2875. globalVar.LTwoLoadRoller = false;
  2876. globalVar.LTwoAgvToFryPot = false;
  2877. globalVar.LTwoPotInputMaterialArrive = false;
  2878. globalVar.LTwoPotOutputRollerArrive = false;
  2879. globalVar.LTwoAgvArrivePot = false;
  2880. }
  2881. }
  2882. }
  2883. }
  2884. }
  2885. /// <summary>
  2886. /// 线体3对应炒锅出桶
  2887. /// </summary>
  2888. public void LThreeFryPotOutputMaterial()
  2889. {
  2890. if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && globalVar.agvArriveLThreeUpLoad && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
  2891. {
  2892. MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
  2893. AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  2894. globalVar.agvArriveLThreeUpLoad = false;
  2895. globalVar.LThreeAgvArrivePot = true;
  2896. }
  2897. }
  2898. public void LThreeEmptyOperate()
  2899. {
  2900. if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
  2901. {
  2902. FryPotThreeRollerTroubleCheck();
  2903. if (FryPotThreeAlarm == 1)//无故障
  2904. {
  2905. if (globalVar.LThreeagvFryPotEmptyRollerArrive)
  2906. {
  2907. FryPotThreeOutEmpetyRollerOperate();
  2908. if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  2909. {
  2910. //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
  2911. //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
  2912. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  2913. globalVar.LThreeInOrOutputLock = false;
  2914. MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  2915. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  2916. globalVar.AllowAgvToLineThreeLoadRoller = true;
  2917. globalVar.LThreeLoadRoller = false;
  2918. globalVar.LThreeAgvToFryPot = false;
  2919. globalVar.LThreePotInputMaterialArrive = false;
  2920. globalVar.LThreePotOutputRollerArrive = false;
  2921. globalVar.LThreeAgvArrivePot = false;
  2922. }
  2923. }
  2924. }
  2925. }
  2926. }
  2927. /// <summary>
  2928. /// 清洗台到4号线体下料
  2929. /// </summary>
  2930. public void EmptyRollerToLinFourFromClean()
  2931. {
  2932. if (globalVar.agvArriveLineFour)//agv到达线体4下料位置
  2933. {
  2934. globalVar.agvArriveLineFour = false;
  2935. //线体四信号交互
  2936. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2937. MessageLog.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶");
  2938. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2939. }
  2940. }
  2941. public void EmptyRollerToLinFourFromPot()
  2942. {
  2943. if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
  2944. {
  2945. globalVar.rollerLineOne.agvArriveLineFour = false;
  2946. //线体四信号交互
  2947. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2948. MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
  2949. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2950. }
  2951. if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
  2952. {
  2953. globalVar.rollerLineTwo.agvArriveLineFour = false;
  2954. //线体四信号交互
  2955. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2956. MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
  2957. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2958. }
  2959. if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
  2960. {
  2961. globalVar.rollerLineThree.agvArriveLineFour = false;
  2962. //线体四信号交互
  2963. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2964. MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
  2965. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2966. }
  2967. }
  2968. ///// <summary>
  2969. ///// 线体1对应炒锅到4号线体下料
  2970. ///// </summary>
  2971. //public void EmptyRollerToLinFourFromLineOne()
  2972. //{
  2973. // if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
  2974. // {
  2975. // globalVar.rollerLineOne.agvArriveLineFour = false;
  2976. // //线体四信号交互
  2977. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2978. // MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
  2979. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2980. // }
  2981. //}
  2982. ///// <summary>
  2983. /////线体2对应炒锅到4号线体下料
  2984. ///// </summary>
  2985. //public void EmptyRollerToLinFourFromLineTwo()
  2986. //{
  2987. // if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
  2988. // {
  2989. // globalVar.rollerLineTwo.agvArriveLineFour = false;
  2990. // //线体四信号交互
  2991. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  2992. // MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
  2993. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  2994. // }
  2995. //}
  2996. ///// <summary>
  2997. ///// 线体3对应炒锅到4号线体下料
  2998. ///// </summary>
  2999. //public void EmptyRollerToLinFourFromLineThree()
  3000. //{
  3001. // if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
  3002. // {
  3003. // globalVar.rollerLineThree.agvArriveLineFour = false;
  3004. // //线体四信号交互
  3005. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  3006. // MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
  3007. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  3008. // }
  3009. //}
  3010. /// <summary>
  3011. /// 炒锅1,4滚筒进料运行到位处理
  3012. /// </summary>
  3013. public void FryPotOneOrFourInputMaterialRollerOperate()
  3014. {
  3015. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3016. {
  3017. case 1:
  3018. //while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
  3019. //{
  3020. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3021. // return;
  3022. //}
  3023. MessageLog.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  3024. case 4:
  3025. //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
  3026. //{
  3027. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3028. // return;
  3029. //}
  3030. MessageLog.GetInstance.ShowRunLog($"炒锅【4】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  3031. }
  3032. }
  3033. /// <summary>
  3034. /// 炒锅2,5滚筒进料运行到位处理
  3035. /// </summary>
  3036. public void FryPotTwoOrFiveInputMaterialRollerOperate()
  3037. {
  3038. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3039. {
  3040. case 2:
  3041. //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
  3042. //{
  3043. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3044. // return;
  3045. //}
  3046. MessageLog.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  3047. case 5:
  3048. //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
  3049. //{
  3050. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3051. // return;
  3052. //}
  3053. MessageLog.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  3054. }
  3055. }
  3056. public void FryPotThreeInputMaterialRollerOperate()
  3057. {
  3058. //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
  3059. //{
  3060. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3061. // return;
  3062. //}
  3063. MessageLog.GetInstance.ShowRunLog($"炒锅【3】:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
  3064. }
  3065. /// <summary>
  3066. /// 炒锅滚筒空桶出桶处理
  3067. /// </summary>
  3068. //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
  3069. //{
  3070. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3071. // {
  3072. // case 1:
  3073. // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  3074. // {
  3075. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3076. // return;
  3077. // }
  3078. // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  3079. // case 2:
  3080. // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  3081. // {
  3082. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3083. // return;
  3084. // }
  3085. // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  3086. // case 3:
  3087. // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  3088. // {
  3089. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3090. // return;
  3091. // }
  3092. // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  3093. // case 4:
  3094. // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  3095. // {
  3096. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3097. // return;
  3098. // }
  3099. // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  3100. // case 5:
  3101. // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  3102. // {
  3103. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3104. // return;
  3105. // }
  3106. // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  3107. // }
  3108. //}
  3109. /// <summary>
  3110. /// 炒锅1,4滚筒空桶出桶处理
  3111. /// </summary>
  3112. public void FryPotOneOrFourOutEmpetyRollerOperate()
  3113. {
  3114. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3115. {
  3116. case 1:
  3117. //while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  3118. //{
  3119. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3120. // return;
  3121. //}
  3122. MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  3123. case 4:
  3124. //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  3125. //{
  3126. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3127. // return;
  3128. //}
  3129. MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  3130. }
  3131. }
  3132. /// <summary>
  3133. /// 炒锅2,5滚筒空桶出桶处理
  3134. /// </summary>
  3135. public void FryPotTwoOrFiveOutEmpetyRollerOperate()
  3136. {
  3137. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3138. {
  3139. case 2:
  3140. //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  3141. //{
  3142. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3143. // return;
  3144. //}
  3145. MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  3146. case 5:
  3147. //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  3148. //{
  3149. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3150. // return;
  3151. //}
  3152. MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
  3153. }
  3154. }
  3155. /// <summary>
  3156. /// 炒锅3滚筒空桶出桶处理
  3157. /// </summary>
  3158. public void FryPotThreeOutEmpetyRollerOperate()
  3159. {
  3160. //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  3161. //{
  3162. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  3163. // return;
  3164. //}
  3165. MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成");
  3166. }
  3167. /// <summary>
  3168. /// 发送agv送料就位信号至PLC(线体到炒锅)
  3169. /// </summary>
  3170. public void AgvArriveFryPotSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  3171. {
  3172. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3173. {
  3174. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  3175. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  3176. case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
  3177. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  3178. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  3179. }
  3180. }
  3181. /// <summary>
  3182. /// 发送agv送料就位信号至PLC(线体1到炒锅)
  3183. /// </summary>
  3184. public void AgvArriveFryPotOneOrFourSingleSetDown()
  3185. {
  3186. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3187. {
  3188. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  3189. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  3190. }
  3191. }
  3192. /// <summary>
  3193. /// 发送agv送料就位信号至PLC(线体2到炒锅)
  3194. /// </summary>
  3195. public void AgvArriveFryPotTwoOrFiveSingleSetDown()
  3196. {
  3197. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3198. {
  3199. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  3200. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  3201. }
  3202. }
  3203. /// <summary>
  3204. /// 发送agv送料就位信号至PLC(线体3到炒锅)
  3205. /// </summary>
  3206. public void AgvArriveFryPotThreeSingleSetDown()
  3207. {
  3208. DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号
  3209. }
  3210. /// <summary>
  3211. /// 发送agv回桶就位信号至PLC
  3212. /// </summary>
  3213. public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  3214. {
  3215. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3216. {
  3217. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  3218. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  3219. case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
  3220. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  3221. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  3222. }
  3223. }
  3224. public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown()
  3225. {
  3226. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3227. {
  3228. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  3229. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  3230. }
  3231. }
  3232. public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown()
  3233. {
  3234. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3235. {
  3236. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  3237. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  3238. }
  3239. }
  3240. public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown()
  3241. {
  3242. DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号
  3243. }
  3244. ///// <summary>
  3245. ///// AGV离开炒锅运送空桶任务
  3246. ///// </summary>
  3247. //public void AgvFromFryPotToClean(ConcurrentQueue<MaterialInfo> queue)
  3248. //{
  3249. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3250. // {
  3251. // case 1:
  3252. // erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
  3253. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId)
  3254. // {
  3255. // goto erp;
  3256. // }
  3257. // string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  3258. // LOnerobotJobId = id;
  3259. // FryCarryTaskErrorCodeAnalysis(info, 1); break;
  3260. // case 2:
  3261. // erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
  3262. // if (id1 == LTworobotJobId)
  3263. // {
  3264. // goto erp1;
  3265. // }
  3266. // string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  3267. // LTworobotJobId = id1;
  3268. // FryCarryTaskErrorCodeAnalysis(info1, 2); break;
  3269. // case 3:
  3270. // erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
  3271. // if (id2 == LThreerobotJobId)
  3272. // {
  3273. // goto erp2;
  3274. // }
  3275. // string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  3276. // LThreerobotJobId = id2;
  3277. // FryCarryTaskErrorCodeAnalysis(info2, 3); break;
  3278. // case 4:
  3279. // erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
  3280. // if (id3 == LOnerobotJobId)
  3281. // {
  3282. // goto erp3;
  3283. // }
  3284. // string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  3285. // LOnerobotJobId = id3;
  3286. // FryCarryTaskErrorCodeAnalysis(info3, 4); break;
  3287. // case 5:
  3288. // erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
  3289. // if (id4 == LTworobotJobId)
  3290. // {
  3291. // goto erp4;
  3292. // }
  3293. // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  3294. // LTworobotJobId = id4;
  3295. // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
  3296. // }
  3297. //}
  3298. /// <summary>
  3299. /// AGV离开炒锅1,4运送空桶任务
  3300. /// </summary>
  3301. public void AgvFromFryPotOneOrFourToClean()
  3302. {
  3303. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3304. {
  3305. case 1:
  3306. erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
  3307. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  3308. {
  3309. goto erp;
  3310. }
  3311. MessageLog.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
  3312. string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  3313. LFourrobotJobId = id;
  3314. FryCarryTaskErrorCodeAnalysis(info, 1); break;
  3315. case 4:
  3316. erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
  3317. if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id3) != null || LEightrobotJobId.FirstOrDefault(p => p == id3) != null || LNinerobotJobId.FirstOrDefault(p => p == id3) != null || LTenrobotJobId.FirstOrDefault(p => p == id3) != null)
  3318. {
  3319. goto erp3;
  3320. }
  3321. MessageLog.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
  3322. string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  3323. LFourrobotJobId = id3;
  3324. FryCarryTaskErrorCodeAnalysis(info3, 4); break;
  3325. }
  3326. }
  3327. /// <summary>
  3328. /// AGV离开炒锅2,5运送空桶任务
  3329. /// </summary>
  3330. public void AgvFromFryPotTwoOrFiveToClean()
  3331. {
  3332. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  3333. {
  3334. case 2:
  3335. erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
  3336. if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id1) != null || LEightrobotJobId.FirstOrDefault(p => p == id1) != null || LNinerobotJobId.FirstOrDefault(p => p == id1) != null || LTenrobotJobId.FirstOrDefault(p => p == id1) != null)
  3337. {
  3338. goto erp1;
  3339. }
  3340. MessageLog.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
  3341. string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  3342. LFiverobotJobId = id1;
  3343. FryCarryTaskErrorCodeAnalysis(info1, 2); break;
  3344. case 5:
  3345. erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
  3346. if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id4) != null || LEightrobotJobId.FirstOrDefault(p => p == id4) != null || LNinerobotJobId.FirstOrDefault(p => p == id4) != null || LTenrobotJobId.FirstOrDefault(p => p == id4) != null)
  3347. {
  3348. goto erp4;
  3349. }
  3350. MessageLog.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
  3351. string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  3352. LFiverobotJobId = id4;
  3353. FryCarryTaskErrorCodeAnalysis(info4, 5); break;
  3354. }
  3355. }
  3356. /// <summary>
  3357. /// AGV离开炒锅3运送空桶任务
  3358. /// </summary>
  3359. public void AgvFromFryPotThreeToClean()
  3360. {
  3361. erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
  3362. if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id2) != null || LEightrobotJobId.FirstOrDefault(p => p == id2) != null || LNinerobotJobId.FirstOrDefault(p => p == id2) != null || LTenrobotJobId.FirstOrDefault(p => p == id2) != null)
  3363. {
  3364. goto erp2;
  3365. }
  3366. MessageLog.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
  3367. string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  3368. LSixrobotJobId = id2;
  3369. FryCarryTaskErrorCodeAnalysis(info2, 3);
  3370. }
  3371. /// <summary>
  3372. /// 处理agv从线体1到送料到炒锅的条件
  3373. /// </summary>
  3374. /// <param name="lineAlarm"></param>
  3375. public void AgvFromLineOneToFryPot()
  3376. {
  3377. erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
  3378. {
  3379. if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
  3380. {
  3381. MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  3382. AgvArriveLineSingelSetDown(InputMaterialQuene);
  3383. if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3384. {
  3385. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3386. globalVar.LOneCurrentCookingStep++;
  3387. OutputMaterialQuene.Enqueue(materialInfo);
  3388. globalVar.agvArriveUpLoad = false;
  3389. globalVar.AgvToFryPot = true;
  3390. //原料到位,agv到位,agv自行运料到炒锅
  3391. }
  3392. }
  3393. }
  3394. else//有故障
  3395. {
  3396. while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
  3397. {
  3398. Thread.Sleep(5);
  3399. if (globalVar.ExitLineOneTask)
  3400. return;
  3401. }
  3402. MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  3403. //lineAlarm = 1;
  3404. goto erp;
  3405. }
  3406. }
  3407. /// <summary>
  3408. /// Agv从1号线体运空桶到清洗处
  3409. /// </summary>
  3410. public void AgvFromLineOneToClean(ushort emptyRollerNum)
  3411. {
  3412. erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//无故障
  3413. {
  3414. if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
  3415. {
  3416. MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  3417. DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
  3418. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3419. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  3420. //原料到位,agv到位,agv自行运料到清洗处
  3421. }
  3422. if (globalVar.agvArriveLineOneLoadCom)//上料完成
  3423. {
  3424. globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
  3425. globalVar.agvArriveLineOneLoadCom = false;
  3426. globalVar.rollerLineOne.IsEpmtyBefore = false;
  3427. MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成【{emptyRollerNum}】号空料桶装载");
  3428. }
  3429. }
  3430. else//有故障
  3431. {
  3432. while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
  3433. {
  3434. Thread.Sleep(5);
  3435. if (globalVar.ExitLineOneTask)
  3436. return;
  3437. }
  3438. MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  3439. //lineAlarm = 1;
  3440. goto erp;
  3441. }
  3442. }
  3443. /// <summary>
  3444. /// 处理agv从线体2到送料到炒锅的条件
  3445. /// </summary>
  3446. /// <param name="lineAlarm"></param>
  3447. public void AgvFromLineTwoToFryPot()
  3448. {
  3449. erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
  3450. {
  3451. if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
  3452. {
  3453. MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  3454. AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
  3455. if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3456. {
  3457. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3458. globalVar.LTwoCurrentCookingStep++;
  3459. LTwoOutputMaterialQuene.Enqueue(materialInfo);
  3460. globalVar.agvArriveLTwoUpLoad = false;
  3461. globalVar.LTwoAgvToFryPot = true;
  3462. //原料到位,agv到位,agv自行运料到炒锅
  3463. }
  3464. }
  3465. }
  3466. else//有故障
  3467. {
  3468. while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
  3469. {
  3470. Thread.Sleep(5);
  3471. if (globalVar.ExitLineTwoTask)
  3472. return;
  3473. }
  3474. MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  3475. // lineAlarm = 1;
  3476. goto erp;
  3477. }
  3478. }
  3479. /// <summary>
  3480. /// Agv从2号线体运空桶到清洗处
  3481. /// </summary>
  3482. public void AgvFromLineTwoToClean(ushort emptyRollerNum)
  3483. {
  3484. erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
  3485. {
  3486. if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
  3487. {
  3488. MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  3489. DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
  3490. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3491. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  3492. //原料到位,agv到位,agv自行运料到清洗处
  3493. }
  3494. if (globalVar.agvArriveLineTwoLoadCom)//上料完成
  3495. {
  3496. globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
  3497. globalVar.agvArriveLineTwoLoadCom = false;
  3498. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  3499. MessageLog.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
  3500. }
  3501. }
  3502. else//有故障
  3503. {
  3504. while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
  3505. {
  3506. Thread.Sleep(5);
  3507. if (globalVar.ExitLineOneTask)
  3508. return;
  3509. }
  3510. MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  3511. //lineAlarm = 1;
  3512. goto erp;
  3513. }
  3514. }
  3515. /// <summary>
  3516. /// 处理agv从线体3到送料到炒锅的条件
  3517. /// </summary>
  3518. /// <param name="lineAlarm"></param>
  3519. public void AgvFromLineThreeToFryPot()
  3520. {
  3521. erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
  3522. {
  3523. if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
  3524. {
  3525. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  3526. AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
  3527. if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  3528. {
  3529. MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  3530. globalVar.LThreeCurrentCookingStep++;
  3531. LThreeOutputMaterialQuene.Enqueue(materialInfo);
  3532. globalVar.agvArriveLThreeUpLoad = false;
  3533. globalVar.LThreeAgvToFryPot = true;
  3534. //原料到位,agv到位,agv自行运料到炒锅
  3535. }
  3536. }
  3537. }
  3538. else //有故障
  3539. {
  3540. while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
  3541. {
  3542. Thread.Sleep(5);
  3543. if (globalVar.ExitLineThreeTask)
  3544. return;
  3545. }
  3546. MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  3547. // lineAlarm = 1;
  3548. goto erp;
  3549. }
  3550. }
  3551. /// <summary>
  3552. /// Agv从3号线体运空桶到清洗处
  3553. /// </summary>
  3554. public void AgvFromLineThreeToClean(ushort emptyRollerNum)
  3555. {
  3556. erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
  3557. {
  3558. if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
  3559. {
  3560. MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  3561. DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
  3562. MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  3563. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  3564. // globalVar.rollerLineThree.IsEpmtyBefore = false;
  3565. //原料到位,agv到位,agv自行运料到清洗处
  3566. }
  3567. if (globalVar.agvArriveLineThreeLoadCom)//上料完成
  3568. {
  3569. globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
  3570. globalVar.agvArriveLineThreeLoadCom = false;
  3571. globalVar.rollerLineThree.IsEpmtyBefore = false;
  3572. MessageLog.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
  3573. }
  3574. }
  3575. else//有故障
  3576. {
  3577. while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
  3578. {
  3579. Thread.Sleep(5);
  3580. if (globalVar.ExitLineOneTask)
  3581. return;
  3582. }
  3583. MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  3584. //lineAlarm = 1;
  3585. goto erp;
  3586. }
  3587. }
  3588. /// <summary>
  3589. /// 线体到炒锅搬运任务错误码分析
  3590. /// </summary>
  3591. /// <param name="errorCode"></param>
  3592. /// <param name="num"></param>
  3593. public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3594. {
  3595. if (errorCode == "SUCCESS")
  3596. {
  3597. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
  3598. globalVar.AllowAgvToLineLoadRoller = false;
  3599. }
  3600. else if (errorCode == "Analysis Error")
  3601. {
  3602. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3603. }
  3604. else
  3605. {
  3606. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3607. }
  3608. }
  3609. /// <summary>
  3610. /// 线体到清洗台搬运任务错误码分析
  3611. /// </summary>
  3612. /// <param name="errorCode"></param>
  3613. /// <param name="num"></param>
  3614. public void LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3615. {
  3616. if (errorCode == "SUCCESS")
  3617. {
  3618. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
  3619. }
  3620. else if (errorCode == "Analysis Error")
  3621. {
  3622. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3623. }
  3624. else
  3625. {
  3626. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3627. }
  3628. }
  3629. /// <summary>
  3630. /// 清洗台到线体搬运任务错误码分析
  3631. /// </summary>
  3632. /// <param name="errorCode"></param>
  3633. /// <param name="num"></param>
  3634. public void CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3635. {
  3636. if (errorCode == "SUCCESS")
  3637. {
  3638. MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线卸桶");
  3639. }
  3640. else if (errorCode == "Analysis Error")
  3641. {
  3642. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  3643. }
  3644. else
  3645. {
  3646. MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  3647. }
  3648. }
  3649. /// <summary>
  3650. /// 炒锅搬运任务错误码分析
  3651. /// </summary>
  3652. /// <param name="errorCode"></param>
  3653. /// <param name="num"></param>
  3654. public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
  3655. {
  3656. if (errorCode == "SUCCESS")
  3657. {
  3658. MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
  3659. }
  3660. else if (errorCode == "Analysis Error")
  3661. {
  3662. MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
  3663. }
  3664. else
  3665. {
  3666. MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
  3667. }
  3668. }
  3669. public void AgvToLineOneLoadRoller()
  3670. {
  3671. if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
  3672. {
  3673. if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && globalVar.rollerLineOne.OutMaterialingSingle == 1 && !globalVar.LoadRoller)
  3674. {
  3675. if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
  3676. {
  3677. globalVar.rollerLineOne.CanRun = false;
  3678. e: string id = Guid.NewGuid().ToString("N");
  3679. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  3680. goto e;
  3681. string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
  3682. LOnerobotJobId = id;
  3683. Thread.Sleep(500);
  3684. LineCarryTaskErrorCodeAnalysis(info, 1);
  3685. globalVar.LoadRoller = true;
  3686. }
  3687. //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3688. //{
  3689. // globalVar.rollerLineOne.CanRun = true;
  3690. //}
  3691. //else // 工位8上面不是配方料桶或没有桶时
  3692. //{
  3693. // if (!globalVar.rollerLineOne.IsEpmtyBefore)
  3694. // {
  3695. // var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  3696. // if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
  3697. // {
  3698. // //下发AGV去空桶线洗桶任务
  3699. // e: string id = Guid.NewGuid().ToString("N");
  3700. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3701. // goto e;
  3702. // string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  3703. // LFourrobotJobId = id;
  3704. // Thread.Sleep(500);
  3705. // LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
  3706. // globalVar.rollerLineOne.IsEpmtyBefore = true;
  3707. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3708. // }
  3709. // }
  3710. // else
  3711. // {
  3712. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3713. // }
  3714. //}
  3715. }
  3716. }
  3717. //else
  3718. //{
  3719. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
  3720. // // lineAlarm = -1;
  3721. //}
  3722. //// lineAlarm = 1;
  3723. }
  3724. public void AgvToLineTwoLoadRoller()
  3725. {
  3726. if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
  3727. {
  3728. if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && globalVar.rollerLineTwo.OutMaterialingSingle == 1 && !globalVar.LTwoLoadRoller)
  3729. {
  3730. if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
  3731. {
  3732. globalVar.rollerLineTwo.CanRun = false;
  3733. e: string id = Guid.NewGuid().ToString("N");
  3734. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  3735. goto e;
  3736. string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
  3737. LTworobotJobId = id;
  3738. Thread.Sleep(500);
  3739. LineCarryTaskErrorCodeAnalysis(info, 2);
  3740. globalVar.LTwoLoadRoller = true;
  3741. }
  3742. //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3743. //{
  3744. // globalVar.rollerLineTwo.CanRun = true;
  3745. //}
  3746. }
  3747. //else// 工位8上面不是配方料桶或没有桶时
  3748. //{
  3749. // if (!globalVar.rollerLineTwo.IsEpmtyBefore)
  3750. // {
  3751. // var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  3752. // if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  3753. // {
  3754. // //下发AGV去空桶线洗桶任务
  3755. // e: string id = Guid.NewGuid().ToString("N");
  3756. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3757. // goto e;
  3758. // string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  3759. // LFiverobotJobId = id;
  3760. // Thread.Sleep(500);
  3761. // LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
  3762. // globalVar.rollerLineTwo.IsEpmtyBefore = true;
  3763. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  3764. // }
  3765. // }
  3766. // else
  3767. // {
  3768. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  3769. // }
  3770. //}
  3771. }
  3772. }
  3773. public void AgvToLineThreeLoadRoller()
  3774. {
  3775. if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  3776. {
  3777. if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && globalVar.rollerLineThree.OutMaterialingSingle == 1 && !globalVar.LThreeLoadRoller)
  3778. {
  3779. if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
  3780. {
  3781. globalVar.rollerLineThree.CanRun = false;
  3782. e: string id = Guid.NewGuid().ToString("N");
  3783. if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
  3784. goto e;
  3785. string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  3786. LThreerobotJobId = id;
  3787. Thread.Sleep(500);
  3788. LineCarryTaskErrorCodeAnalysis(info, 3);
  3789. globalVar.LThreeLoadRoller = true;
  3790. }
  3791. //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  3792. //{
  3793. // globalVar.rollerLineThree.CanRun = true;
  3794. //}
  3795. //else // 工位8上面不是配方料桶或没有桶时
  3796. //{
  3797. // if (!globalVar.rollerLineThree.IsEpmtyBefore)
  3798. // {
  3799. // var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  3800. // if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  3801. // {
  3802. // //下发AGV去空桶线洗桶任务
  3803. // e: string id = Guid.NewGuid().ToString("N");
  3804. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  3805. // goto e;
  3806. // string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  3807. // LSixrobotJobId = id;
  3808. // Thread.Sleep(500);
  3809. // LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
  3810. // globalVar.rollerLineThree.IsEpmtyBefore = true;
  3811. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  3812. // }
  3813. // }
  3814. // else
  3815. // {
  3816. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  3817. // }
  3818. //}
  3819. }
  3820. }
  3821. //if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  3822. //{
  3823. // if (LThreeInputMaterialQuene.Count > 0)
  3824. // {
  3825. // while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
  3826. // {
  3827. // Thread.Sleep(5);
  3828. // if (globalVar.ExitMainTask)
  3829. // return;
  3830. // }
  3831. // g: string id = Guid.NewGuid().ToString();
  3832. // if (id == LThreerobotJobId)
  3833. // goto g;
  3834. // string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  3835. // // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
  3836. // LThreerobotJobId = id;
  3837. // Thread.Sleep(500);
  3838. // LineCarryTaskErrorCodeAnalysis(info, 3);
  3839. // }
  3840. //}
  3841. //else
  3842. //{
  3843. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
  3844. // // lineAlarm = -1;
  3845. //}
  3846. }
  3847. /// <summary>
  3848. /// 1号线体数据下发
  3849. /// </summary>
  3850. /// <param name="count"></param>
  3851. /// <param name="materialLoc"></param>
  3852. /// <param name="materialWeight"></param>
  3853. public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3854. {
  3855. switch (count)
  3856. {
  3857. case 0:
  3858. DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
  3859. DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
  3860. break;
  3861. case 1:
  3862. DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
  3863. DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
  3864. break;
  3865. case 2:
  3866. DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
  3867. DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
  3868. break;
  3869. case 3:
  3870. DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
  3871. DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
  3872. break;
  3873. case 4:
  3874. DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
  3875. DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
  3876. break;
  3877. case 5:
  3878. DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
  3879. DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
  3880. break;
  3881. case 6:
  3882. DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
  3883. DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
  3884. break;
  3885. case 7:
  3886. DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
  3887. DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
  3888. break;
  3889. }
  3890. }
  3891. /// <summary>
  3892. /// 2号线体数据下发
  3893. /// </summary>
  3894. /// <param name="count"></param>
  3895. /// <param name="materialLoc"></param>
  3896. /// <param name="materialWeight"></param>
  3897. public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3898. {
  3899. switch (count)
  3900. {
  3901. case 0:
  3902. DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
  3903. DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
  3904. break;
  3905. case 1:
  3906. DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
  3907. DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
  3908. break;
  3909. case 2:
  3910. DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
  3911. DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
  3912. break;
  3913. case 3:
  3914. DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
  3915. DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
  3916. break;
  3917. case 4:
  3918. DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
  3919. DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
  3920. break;
  3921. case 5:
  3922. DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
  3923. DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
  3924. break;
  3925. case 6:
  3926. DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
  3927. DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
  3928. break;
  3929. case 7:
  3930. DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
  3931. DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
  3932. break;
  3933. }
  3934. }
  3935. /// <summary>
  3936. /// 3号线体数据下发
  3937. /// </summary>
  3938. /// <param name="count"></param>
  3939. /// <param name="materialLoc"></param>
  3940. /// <param name="materialWeight"></param>
  3941. public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight)
  3942. {
  3943. switch (count)
  3944. {
  3945. case 0:
  3946. DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
  3947. DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
  3948. break;
  3949. case 1:
  3950. DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
  3951. DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
  3952. break;
  3953. case 2:
  3954. DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
  3955. DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
  3956. break;
  3957. case 3:
  3958. DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
  3959. DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
  3960. break;
  3961. case 4:
  3962. DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
  3963. DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
  3964. break;
  3965. case 5:
  3966. DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
  3967. DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
  3968. break;
  3969. case 6:
  3970. DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
  3971. DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
  3972. break;
  3973. case 7:
  3974. DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
  3975. DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
  3976. break;
  3977. }
  3978. }
  3979. /// <summary>
  3980. /// AGV线体进料就位信号下发至PLC
  3981. /// </summary>
  3982. public void AgvArriveLineSingelSetDown(ConcurrentQueue<MaterialInfo> queue)
  3983. {
  3984. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  3985. {
  3986. case 1:
  3987. case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
  3988. case 2:
  3989. case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
  3990. case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
  3991. }
  3992. }
  3993. /// <summary>
  3994. /// 炒锅滚筒信号检测
  3995. /// </summary>
  3996. //public void FryPotRollerTroubleCheck()
  3997. //{
  3998. // FryPotAlarm = 0;
  3999. // FryPotTwoAlarm = 0;
  4000. // FryPotThreeAlarm = 0;
  4001. // FryPotFourAlarm = 0;
  4002. // FryPotFiveAlarm = 0;
  4003. // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4004. // {
  4005. // case 1:
  4006. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  4007. // {
  4008. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4009. // return;
  4010. // }
  4011. // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  4012. // FryPotAlarm = 1; break;
  4013. // case 2:
  4014. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
  4015. // {
  4016. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4017. // return;
  4018. // }
  4019. // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
  4020. // FryPotTwoAlarm = 1; break;
  4021. // case 3:
  4022. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
  4023. // {
  4024. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4025. // return;
  4026. // }
  4027. // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  4028. // FryPotThreeAlarm = 1; break;
  4029. // case 4:
  4030. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
  4031. // {
  4032. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4033. // return;
  4034. // }
  4035. // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  4036. // FryPotFourAlarm = 1; break;
  4037. // case 5:
  4038. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
  4039. // {
  4040. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4041. // return;
  4042. // }
  4043. // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
  4044. // FryPotFiveAlarm = 1; break;
  4045. // }
  4046. //}
  4047. /// <summary>
  4048. /// 炒锅1,4滚筒信号检测
  4049. /// </summary>
  4050. public void FryPotOneRollerTroubleCheck()
  4051. {
  4052. FryPotAlarm = 0;
  4053. FryPotFourAlarm = 0;
  4054. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4055. {
  4056. case 1:
  4057. if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  4058. {
  4059. FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障");
  4060. }
  4061. else
  4062. {
  4063. FryPotAlarm = 1; return;
  4064. }
  4065. while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  4066. {
  4067. Thread.Sleep(5); if (globalVar.ExitLineOneTask)
  4068. return;
  4069. }
  4070. MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  4071. FryPotAlarm = 1; break;
  4072. case 4:
  4073. if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
  4074. {
  4075. Thread.Sleep(5); if (globalVar.ExitLineOneTask)
  4076. return;
  4077. }
  4078. MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  4079. FryPotFourAlarm = 1; break;
  4080. }
  4081. }
  4082. /// <summary>
  4083. /// 炒锅2,5滚筒信号检测
  4084. /// </summary>
  4085. public void FryPotTwoRollerTroubleCheck()
  4086. {
  4087. FryPotTwoAlarm = 0;
  4088. FryPotFiveAlarm = 0;
  4089. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4090. {
  4091. case 2:
  4092. if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
  4093. {
  4094. Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
  4095. return;
  4096. }
  4097. MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  4098. FryPotTwoAlarm = 1; break;
  4099. case 5:
  4100. if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
  4101. {
  4102. Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
  4103. return;
  4104. }
  4105. MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  4106. FryPotFiveAlarm = 1; break;
  4107. }
  4108. }
  4109. /// <summary>
  4110. /// 炒锅3滚筒信号检测
  4111. /// </summary>
  4112. public void FryPotThreeRollerTroubleCheck()
  4113. {
  4114. FryPotThreeAlarm = 0;
  4115. if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
  4116. {
  4117. Thread.Sleep(5); if (globalVar.ExitLineThreeTask)
  4118. return;
  4119. }
  4120. MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  4121. FryPotThreeAlarm = 1;
  4122. }
  4123. }
  4124. }