终端一体化运控平台
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.
 
 
 

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