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

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