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

7215 lines
403 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. using Renci.SshNet.Messages;
  28. namespace FryPot_DosingSystem.Control
  29. {
  30. internal class DosingLogicControl
  31. {
  32. public static DosingLogicControl _instance;
  33. public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
  34. 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 };
  35. /// <summary>
  36. /// 桶净重
  37. /// </summary>r
  38. public ushort RollerNetweight = 19;//19公斤
  39. /// <summary>
  40. /// 滚筒线PLC数据
  41. /// </summary>
  42. public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
  43. public ConcurrentDictionary<string, object> FryOneData = new ConcurrentDictionary<string, object>();
  44. public ConcurrentDictionary<string, object> FryTwoData = new ConcurrentDictionary<string, object>();
  45. public ConcurrentDictionary<string, object> FryThreeData = new ConcurrentDictionary<string, object>();
  46. public ConcurrentDictionary<string, object> FryFourData = new ConcurrentDictionary<string, object>();
  47. public ConcurrentDictionary<string, object> FryFiveData = new ConcurrentDictionary<string, object>();
  48. /// <summary>
  49. /// 线体1配方队列
  50. /// </summary>
  51. public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  52. /// <summary>
  53. /// 线体2配方队列
  54. /// </summary>
  55. public ConcurrentQueue<NewRecipeModel> LTwoRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  56. /// <summary>
  57. /// 线体3配方队列
  58. /// </summary>
  59. public ConcurrentQueue<NewRecipeModel> LThreeRecipeQuene = new ConcurrentQueue<NewRecipeModel>();
  60. /// <summary>
  61. /// 线体1进料原料队列
  62. /// </summary>
  63. public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  64. /// <summary>
  65. /// 线体2进料原料队列
  66. /// </summary>
  67. public ConcurrentQueue<MaterialInfo> LTwoInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  68. /// <summary>
  69. /// 线体3进料原料队列
  70. /// </summary>
  71. public ConcurrentQueue<MaterialInfo> LThreeInputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  72. /// <summary>
  73. /// 线体1出料原料队列
  74. /// </summary>
  75. public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  76. /// <summary>
  77. /// 线体2出料原料队列
  78. /// </summary>
  79. public ConcurrentQueue<MaterialInfo> LTwoOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  80. /// <summary>
  81. /// 线体3出料原料队列
  82. /// </summary>
  83. public ConcurrentQueue<MaterialInfo> LThreeOutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
  84. /// <summary>
  85. /// 全局变量对象声明
  86. /// </summary>
  87. GlobalVariable globalVar;
  88. /// <summary>
  89. /// 线体状态对象声明
  90. /// </summary>
  91. HardWareStatusViewModel hardWareStatusModel;
  92. ///// <summary>
  93. ///// 炒锅1状态
  94. ///// </summary>
  95. //PotOneStatus fryOne;
  96. ///// <summary>
  97. ///// 炒锅2状态
  98. ///// </summary>
  99. //PotTwoStatus fryTwo;
  100. ///// <summary>
  101. ///// 炒锅3状态
  102. ///// </summary>
  103. //PotThreeStatus fryThree;
  104. ///// <summary>
  105. ///// 炒锅4状态
  106. ///// </summary>
  107. //PotFourStatus fryFour;
  108. ///// <summary>
  109. ///// 炒锅5状态
  110. ///// </summary>
  111. //PotFiveStatus fryFive;
  112. /// <summary>
  113. /// 报警信息对象声明
  114. /// </summary>
  115. #region 上位机内部变量
  116. int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障
  117. int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障
  118. int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障
  119. int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障
  120. int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障
  121. int ReicpeNum = 0;//记录接收到的配方数
  122. bool ErrorRecipe;//线体1错误配方标识
  123. bool LTwoErrorRecipe;//线体2错误配方标识
  124. bool LThreeErrorRecipe;//线体3错误配方标识
  125. string fryOneRecipe = string.Empty;
  126. string fryTwoRecipe = string.Empty;
  127. string fryThreeRecipe = string.Empty;
  128. string fryFourRecipe = string.Empty;
  129. string fryFiveRecipe = string.Empty;
  130. #endregion
  131. #region agv临时变量
  132. //bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
  133. //bool agvArriveLTwoUpLoad = false;//agv是否到达线体2上料位置
  134. //bool agvArriveLThreeUpLoad = false;//agv是否到达线体3上料位置
  135. //bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
  136. //bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
  137. //bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置
  138. //bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶
  139. //bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶
  140. //bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶
  141. string LOnerobotJobId = string.Empty;//线体1当前上游系统任务号,全局唯一 从线体1到炒锅路径
  142. string LTworobotJobId = string.Empty;//线体2当前上游系统任务号,全局唯一 从线体2到炒锅路径
  143. string LThreerobotJobId = string.Empty;//线体3当前上游系统任务号,全局唯一 从线体3到炒锅路径
  144. string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径
  145. string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径
  146. string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径
  147. List<string> LSevenrobotJobId = new List<string>(); //从线体1到清洗台路径
  148. List<string> LEightrobotJobId = new List<string>();//从线体2到清洗台路径
  149. List<string> LNinerobotJobId = new List<string>(); //从线体3到清洗台路径
  150. List<string> LTenrobotJobId = new List<string>(); //从清洗台到线体4路径
  151. Dictionary<string, int> agvCode = new Dictionary<string, int>() { { "ZT11-21", 1 }, { "ZT11-22", 2 }, { "ZT11-23", 3 }, { "ZT11-24", 4 } };//agv小车的编号对AGV动画小车编号
  152. private static readonly object Obj_Lock = new object();//3条滚筒线洗桶线程互斥锁
  153. private static readonly object Pot_Lock = new object();//炒股工艺工艺下发锁
  154. public int CleanNum = 0;//当前清洗台桶数
  155. ushort LOneCurrentRollerNum = 0;//当前线体1的空桶桶号
  156. ushort LTwoCurrentRollerNum = 0;//当前线体2的空桶桶号
  157. ushort LThreeCurrentRollerNum = 0;//当前线体3的空桶桶号
  158. public NewRecipeModel potOneCurrentRecipe = null;
  159. public NewRecipeModel potTwoCurrentRecipe = null;
  160. public NewRecipeModel potThreeCurrentRecipe = null;
  161. public NewRecipeModel potFourCurrentRecipe = null;
  162. public NewRecipeModel potFiveCurrentRecipe = null;
  163. #endregion
  164. /// <summary>
  165. /// 调试命令注册
  166. /// </summary>
  167. public void CommandRegist()
  168. {
  169. #region 线体空桶清洗及回收调试
  170. ActionManage.GetInstance.Register(new Action(() =>
  171. {
  172. globalVar.agvArriveLineOneLoadEmptyRoller = true;
  173. }), "AgvArriveLineOneEmptyRollerLoc");
  174. ActionManage.GetInstance.Register(new Action(() =>
  175. {
  176. globalVar.agvArriveLineTwoLoadEmptyRoller = true;
  177. }), "AgvArriveLineTwoEmptyRollerLoc");
  178. ActionManage.GetInstance.Register(new Action(() =>
  179. {
  180. globalVar.agvArriveLineThreeLoadEmptyRoller = true;
  181. }), "AgvArriveLineThreeEmptyRollerLoc");
  182. //ActionManage.GetInstance.Register(new Action(() =>
  183. //{
  184. // globalVar.CleanComplete = 1;
  185. //}), "CleanPlateCallAgv");
  186. //ActionManage.GetInstance.Register(new Action(() =>
  187. //{
  188. // globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位
  189. // globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;
  190. // globalVar.rollerLineThree.agvArriveCleanUnLoad = true;
  191. //}), "AgvArriveCleanPlateLoc");
  192. ActionManage.GetInstance.Register(new Action(() =>
  193. {
  194. globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位
  195. }), "AgvArriveCleanPlateLocLoad");
  196. //ActionManage.GetInstance.Register(new Action(() =>
  197. //{
  198. // globalVar.agvArriveLineFour = true;
  199. // globalVar.rollerLineOne.agvArriveLineFour = true;
  200. // globalVar.rollerLineTwo.agvArriveLineFour = true;
  201. // globalVar.rollerLineThree.agvArriveLineFour = true;
  202. //}), "AgvArriveLineFourLoc");
  203. #endregion
  204. //接口调试
  205. //ActionManage.GetInstance.Register(new Action(() =>
  206. //{
  207. // string id = Guid.NewGuid().ToString("D");
  208. // string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
  209. // if (errorCode == "SUCCESS")
  210. // {
  211. // MessageNotify.GetInstance.ShowRunLog($"AGV任务下发成功");
  212. // }
  213. // else if (errorCode == "Analysis Error")
  214. // {
  215. // MessageNotify.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文");
  216. // }
  217. // else
  218. // {
  219. // MessageNotify.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
  220. // }
  221. //}), "AgvDebug");
  222. //ActionManage.GetInstance.Register(() =>
  223. //{
  224. // MessageNotify.GetInstance.ShowRunLog("清洗台卸桶完成");
  225. //}, "AgvArriveCleanPlateLocCom");
  226. //ActionManage.GetInstance.Register(() =>
  227. //{
  228. // MessageNotify.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成");
  229. // MessageNotify.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成");
  230. // MessageNotify.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成");
  231. // MessageNotify.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成");
  232. //}, "AgvArriveLineFourLocCom");
  233. //ActionManage.GetInstance.Register(() =>
  234. //{
  235. // MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
  236. //}, "AgvArriveCleanPlateLocLoadCom");
  237. //ActionManage.GetInstance.Register(() =>
  238. //{
  239. // // globalVar.rollerLineOne.RecipeCompleteSingle = 1;
  240. //}, "LineOneRecipeComSignal");
  241. //ActionManage.GetInstance.Register(() =>
  242. //{
  243. // // globalVar.rollerLineTwo.RecipeCompleteSingle = 1;
  244. //}, "LineTwoRecipeComSignal");
  245. //ActionManage.GetInstance.Register(() =>
  246. //{
  247. // // globalVar.rollerLineThree.RecipeCompleteSingle = 1;
  248. //}, "LineThreeRecipeComSignal");
  249. //ActionManage.GetInstance.Register(new Action(() =>
  250. //{
  251. // globalVar.agvArriveLineOneLoadCom = true;
  252. //}), "AgvLineOneLoadEmptyCom");
  253. //ActionManage.GetInstance.Register(new Action(() =>
  254. //{
  255. // globalVar.agvArriveLineTwoLoadCom = true;
  256. //}), "AgvLineTwoLoadEmptyCom");
  257. //ActionManage.GetInstance.Register(new Action(() =>
  258. //{
  259. // globalVar.agvArriveLineThreeLoadCom = true;
  260. //}), "AgvLineThreeLoadEmptyCom");
  261. //ActionManage.GetInstance.Register(new Action(() =>
  262. //{
  263. // globalVar.rollerLineOne.CanRun = true;
  264. //}), "AGVLineOneLoadCom");
  265. //ActionManage.GetInstance.Register(new Action(() =>
  266. //{
  267. // globalVar.rollerLineTwo.CanRun = true;
  268. //}), "AGVLineTwoLoadCom");
  269. //ActionManage.GetInstance.Register(new Action(() =>
  270. //{
  271. // globalVar.rollerLineThree.CanRun = true;
  272. //}), "AGVLineThreeLoadCom");
  273. //ActionManage.GetInstance.Register(new Action(() =>
  274. //{
  275. // globalVar.rollerLineOne.OutMaterialingSingle = 1;
  276. //}), "RollerLineRunning");
  277. //ActionManage.GetInstance.Register(new Action<object>((obj) =>
  278. //{
  279. // globalVar.rollerLineOne.StationEight = (ushort)obj;
  280. //}), "EightWorkLoc");
  281. //ActionManage.GetInstance.Register(new Action(() =>
  282. //{
  283. // globalVar.fryPotOne.InputMaterialArrivedSingle = 1;
  284. // globalVar.fryPotFour.InputMaterialArrivedSingle = 1;
  285. //}), "FryPotInputArrive");
  286. //ActionManage.GetInstance.Register(new Action(() =>
  287. //{
  288. // globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1;
  289. // globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1;
  290. //}), "FryPotEmptyRollerArrive");
  291. ActionManage.GetInstance.Register(new Action(() =>
  292. {
  293. globalVar.agvArriveUpLoad = true;
  294. }), "AGVLOneArrive");
  295. ActionManage.GetInstance.Register(new Action(() =>
  296. {
  297. globalVar.agvArriveUnLoad = true;
  298. }), "AGVFryPotDownArrive");
  299. ActionManage.GetInstance.Register(new Action(() =>
  300. {
  301. globalVar.agvArriveUpLoad = true;
  302. }), "AGVFryPotUpArrive");
  303. //ActionManage.GetInstance.Register(new Action(() =>
  304. //{
  305. // globalVar.agvFryPotEmptyRollerArrive = true;
  306. //}), "AGVFryPotGetEmptyRoller");
  307. //滚筒线2
  308. //ActionManage.GetInstance.Register(new Action(() =>
  309. //{
  310. // globalVar.rollerLineTwo.OutMaterialingSingle = 1;
  311. //}), "RollerLineTwoRunning");
  312. //ActionManage.GetInstance.Register(new Action<object>((obj) =>
  313. //{
  314. // globalVar.rollerLineTwo.StationEight = (ushort)obj;
  315. //}), "TwoEightWorkLoc");
  316. //ActionManage.GetInstance.Register(new Action(() =>
  317. //{
  318. // globalVar.fryPotTwo.InputMaterialArrivedSingle = 1;
  319. // globalVar.fryPotFive.InputMaterialArrivedSingle = 1;
  320. //}), "FryPotTwoInputArrive");
  321. //ActionManage.GetInstance.Register(new Action(() =>
  322. //{
  323. // globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1;
  324. // globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1;
  325. //}), "FryPotTwoEmptyRollerArrive");
  326. ActionManage.GetInstance.Register(new Action(() =>
  327. {
  328. globalVar.agvArriveLTwoUpLoad = true;
  329. }), "AGVLTwoArrive");
  330. ActionManage.GetInstance.Register(new Action(() =>
  331. {
  332. globalVar.LTwoagvArriveUnLoad = true;
  333. }), "AGVFryPotTwoDownArrive");
  334. ActionManage.GetInstance.Register(new Action(() =>
  335. {
  336. globalVar.agvArriveLTwoUpLoad = true;
  337. }), "AGVFryPotTwoUpArrive");
  338. //ActionManage.GetInstance.Register(new Action(() =>
  339. //{
  340. // globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  341. //}), "AGVFryPotTwoGetEmptyRoller");
  342. //滚筒线3
  343. //ActionManage.GetInstance.Register(new Action(() =>
  344. //{
  345. // globalVar.rollerLineThree.OutMaterialingSingle = 1;
  346. //}), "RollerLineThreeRunning");
  347. //ActionManage.GetInstance.Register(new Action<object>((obj) =>
  348. //{
  349. // globalVar.rollerLineThree.StationEight = (ushort)obj;
  350. //}), "ThreeEightWorkLoc");
  351. //ActionManage.GetInstance.Register(new Action(() =>
  352. //{
  353. // globalVar.fryPotThree.InputMaterialArrivedSingle = 1;
  354. //}), "FryPotThreeInputArrive");
  355. //ActionManage.GetInstance.Register(new Action(() =>
  356. //{
  357. // globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1;
  358. //}), "FryPotThreeEmptyRollerArrive");
  359. ActionManage.GetInstance.Register(new Action(() =>
  360. {
  361. globalVar.agvArriveLThreeUpLoad = true;
  362. }), "AGVLThreeArrive");
  363. ActionManage.GetInstance.Register(new Action(() =>
  364. {
  365. globalVar.LThreeagvArriveUnLoad = true;
  366. }), "AGVFryPotThreeDownArrive");
  367. ActionManage.GetInstance.Register(new Action(() =>
  368. {
  369. globalVar.agvArriveLThreeUpLoad = true;
  370. }), "AGVFryPotThreeUpArrive");
  371. //ActionManage.GetInstance.Register(new Action(() =>
  372. //{
  373. // globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  374. //}), "AGVFryPotThreeGetEmptyRoller");
  375. }
  376. public DosingLogicControl()
  377. {
  378. globalVar = new GlobalVariable();
  379. //fryOne = new PotOneStatus();
  380. //fryTwo = new PotTwoStatus();
  381. //fryThree = new PotThreeStatus();
  382. //fryFour = new PotFourStatus();
  383. //fryFive = new PotFiveStatus();
  384. hardWareStatusModel = HardWareStatusViewModel.GetInstance;
  385. DateTimeJudge();
  386. FileRegClean();
  387. ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
  388. //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
  389. ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
  390. ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
  391. ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
  392. //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
  393. //ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
  394. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
  395. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
  396. ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
  397. ActionManage.GetInstance.Register(new Action(() =>
  398. {
  399. globalVar.ExitLineOneTask = true;
  400. LineOneEmptyRollerCleanTaskRestart();
  401. }), "EmptyRollerCleanTaskRestart");
  402. ActionManage.GetInstance.Register(new Action(() =>
  403. {
  404. globalVar.ExitLineTwoTask = true;
  405. LineTwoEmptyRollerCleanTaskRestart();
  406. }), "LineTwoEmptyRollerCleanTaskRestart");
  407. ActionManage.GetInstance.Register(new Action(() =>
  408. {
  409. globalVar.ExitLineThreeTask = true;
  410. LineThreeEmptyRollerCleanTaskRestart();
  411. }), "LineThreeEmptyRollerCleanTaskRestart");
  412. HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
  413. HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
  414. //ResetProgram();
  415. ReadPlcData();
  416. SaveFryPotData();
  417. MainTask();
  418. CommandRegist();
  419. }
  420. /// <summary>
  421. /// 文件数据定期清理
  422. /// </summary>
  423. /// <exception cref="NotImplementedException"></exception>
  424. private void FileRegClean()
  425. {
  426. try
  427. {
  428. int days = 5; //清除期限
  429. string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
  430. if (filesOne.Count() > 0)
  431. {
  432. foreach (var item in filesOne)
  433. {
  434. FileInfo info = new FileInfo(item);
  435. DateTime createTime = info.CreationTime;
  436. DateTime timeNow = DateTime.Now;
  437. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  438. {
  439. Directory.Delete(item, true);
  440. }
  441. }
  442. }
  443. string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
  444. if (filesTwo.Count() > 0)
  445. {
  446. foreach (var item in filesTwo)
  447. {
  448. FileInfo info = new FileInfo(item);
  449. DateTime createTime = info.CreationTime;
  450. DateTime timeNow = DateTime.Now;
  451. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  452. {
  453. Directory.Delete(item, true);
  454. }
  455. }
  456. }
  457. string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
  458. if (filesThree.Count() > 0)
  459. {
  460. foreach (var item in filesThree)
  461. {
  462. FileInfo info = new FileInfo(item);
  463. DateTime createTime = info.CreationTime;
  464. DateTime timeNow = DateTime.Now;
  465. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  466. {
  467. Directory.Delete(item, true);
  468. }
  469. }
  470. }
  471. string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
  472. if (filesFour.Count() > 0)
  473. {
  474. foreach (var item in filesFour)
  475. {
  476. FileInfo info = new FileInfo(item);
  477. DateTime createTime = info.CreationTime;
  478. DateTime timeNow = DateTime.Now;
  479. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  480. {
  481. Directory.Delete(item, true);
  482. }
  483. }
  484. }
  485. string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
  486. if (filesFive.Count() > 0)
  487. {
  488. foreach (var item in filesFive)
  489. {
  490. FileInfo info = new FileInfo(item);
  491. DateTime createTime = info.CreationTime;
  492. DateTime timeNow = DateTime.Now;
  493. if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
  494. {
  495. Directory.Delete(item, true);
  496. }
  497. }
  498. }
  499. }
  500. catch (Exception)
  501. {
  502. // throw;
  503. }
  504. }
  505. /// <summary>
  506. /// 时间差计算
  507. /// </summary>
  508. /// <param name="t">当前时间</param>
  509. /// <param name="t2">创建时间</param>
  510. /// <returns></returns>
  511. private int TimeDiff(DateTime t, DateTime t2)
  512. {
  513. long lReturn = -1;
  514. System.TimeSpan NowValue = new TimeSpan(t.Ticks);
  515. System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
  516. System.TimeSpan DateDiff = TimeSpan.Zero;
  517. try
  518. {
  519. //计算时间差
  520. //DateDiff = TimeValue.Subtract(NowValue).Duration();
  521. DateDiff = NowValue.Subtract(TimeValue);
  522. int h = DateDiff.Hours;
  523. int m = DateDiff.Minutes;
  524. return DateDiff.Days;
  525. }
  526. catch
  527. {
  528. return -1;
  529. }
  530. }
  531. /// <summary>
  532. /// 炒锅数据实时保存
  533. /// </summary>
  534. /// <exception cref="NotImplementedException"></exception>
  535. private void SaveFryPotData()
  536. {
  537. Task.Run(new Action(() =>
  538. {
  539. while (true)
  540. {
  541. FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
  542. }
  543. }));
  544. }
  545. /// <summary>
  546. /// 时间判断,数据处理
  547. /// </summary>
  548. private void DateTimeJudge()
  549. {
  550. #region sqlite数据库保存
  551. //if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
  552. //{
  553. // string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
  554. // if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  555. // {
  556. // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  557. // FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
  558. // }
  559. //}
  560. //if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
  561. //{
  562. // string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
  563. // if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  564. // {
  565. // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  566. // FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
  567. // }
  568. //}
  569. //if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
  570. //{
  571. // string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
  572. // if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  573. // {
  574. // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  575. // FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
  576. // }
  577. //}
  578. //if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
  579. //{
  580. // string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
  581. // if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  582. // {
  583. // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  584. // FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
  585. // }
  586. //}
  587. //if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
  588. //{
  589. // string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
  590. // if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
  591. // {
  592. // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
  593. // FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
  594. // }
  595. //}
  596. #endregion
  597. string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
  598. string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
  599. string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
  600. string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
  601. string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
  602. if (!Directory.Exists("AccessFile//" + "Statistic"))
  603. Directory.CreateDirectory("AccessFile//" + "Statistic");
  604. if (File.Exists(p1))
  605. {
  606. using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
  607. {
  608. string time = sReader.ReadLine();
  609. string statistic = sReader.ReadLine();
  610. if (DateTime.Now.ToShortDateString() == time)
  611. {
  612. FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  613. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  614. }
  615. }
  616. }
  617. if (File.Exists(p2))
  618. {
  619. using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
  620. {
  621. string time = sReader.ReadLine();
  622. string statistic = sReader.ReadLine();
  623. if (DateTime.Now.ToShortDateString() == time)
  624. {
  625. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  626. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  627. }
  628. }
  629. }
  630. if (File.Exists(p3))
  631. {
  632. using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
  633. {
  634. string time = sReader.ReadLine();
  635. string statistic = sReader.ReadLine();
  636. if (DateTime.Now.ToShortDateString() == time)
  637. {
  638. FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  639. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  640. }
  641. }
  642. }
  643. if (File.Exists(p4))
  644. {
  645. using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
  646. {
  647. string time = sReader.ReadLine();
  648. string statistic = sReader.ReadLine();
  649. if (DateTime.Now.ToShortDateString() == time)
  650. {
  651. FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  652. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  653. }
  654. }
  655. }
  656. if (File.Exists(p5))
  657. {
  658. using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
  659. {
  660. string time = sReader.ReadLine();
  661. string statistic = sReader.ReadLine();
  662. if (DateTime.Now.ToShortDateString() == time)
  663. {
  664. FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
  665. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);
  666. }
  667. }
  668. }
  669. }
  670. /// <summary>
  671. /// AGV上下料上报数据解析
  672. /// </summary>
  673. /// <param name="obj"></param>
  674. private void AgvFeedBackUpReportDataAnalysis(object obj)
  675. {
  676. //if (obj != null && obj is byte[] datas)
  677. //{
  678. //string strData = Encoding.UTF8.GetString(datas);
  679. EventData objData = JsonConvert.DeserializeObject<EventData>(obj.ToString());
  680. if (objData != null)
  681. {
  682. AGVHelper.GetInstance.UpDownFeedBack(objData.agvCode, objData.jobId, objData.msgId);
  683. #region 线体到炒锅请求上下料
  684. //线体1请求上下料
  685. if (objData.equipmentId == 1 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  686. {
  687. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  688. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【1】号滚筒线上料请求");
  689. }
  690. if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  691. {
  692. globalVar.agvArriveUnLoad = true;//AGV到达下料位置
  693. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LOneFryPotSerial}】号炒锅下料请求");
  694. }
  695. //线体2请求上下料
  696. if (objData.equipmentId == 2 && objData.command == "LOAD")
  697. {
  698. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  699. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【2】号滚筒线上料请求");
  700. }
  701. if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  702. {
  703. globalVar.LTwoagvArriveUnLoad = true;//AGV到达下料位置
  704. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LTwoFryPotSerial}】号炒锅下料请求");
  705. }
  706. //线体3请求上下料
  707. if (objData.equipmentId == 3 && objData.command == "LOAD")
  708. {
  709. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  710. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【3】号滚筒线上料请求");
  711. }
  712. if (objData.equipmentId == 7 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  713. {
  714. globalVar.LThreeagvArriveUnLoad = true;//AGV到达下料位置
  715. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【{globalVar.LThreeFryPotSerial}】号炒锅下料请求");
  716. }
  717. #endregion
  718. #region 炒锅到线体4请求上下料
  719. //炒锅1,4到线体4
  720. if ((objData.equipmentId == 5 || objData.equipmentId == 8) && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  721. {
  722. globalVar.agvArriveUpLoad = true;//AGV到达上料位置
  723. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置");
  724. AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//发送AGV到位信号
  725. }
  726. if (objData.equipmentId == 40 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  727. {
  728. globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置
  729. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
  730. }
  731. //炒锅2,5到线体4
  732. if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "LOAD")
  733. {
  734. globalVar.agvArriveLTwoUpLoad = true;//AGV到达上料位置
  735. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅空桶上料位置");
  736. AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//发送AGV到位信号
  737. }
  738. if (objData.equipmentId == 41 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  739. {
  740. globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置
  741. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
  742. }
  743. //炒锅3到线体4
  744. if (objData.equipmentId == 7 && objData.command == "LOAD")
  745. {
  746. globalVar.agvArriveLThreeUpLoad = true;//AGV到达上料位置
  747. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.agvCode}】AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置");
  748. AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//发送AGV到位信号
  749. }
  750. if (objData.equipmentId == 42 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  751. {
  752. globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置
  753. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
  754. }
  755. #endregion
  756. #region 线体123到清洗台请求上下料
  757. //线体1到清洗台
  758. if (objData.equipmentId == 11 && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料
  759. {
  760. globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置
  761. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【1】号滚筒线上料请求");
  762. }
  763. if (objData.equipmentId == 10 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  764. {
  765. globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//AGV到达下料位置
  766. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
  767. }
  768. //线体2到清洗台
  769. if (objData.equipmentId == 22 && objData.command == "LOAD")
  770. {
  771. globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置
  772. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【2】号滚筒线上料请求");
  773. }
  774. if (objData.equipmentId == 20 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  775. {
  776. globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;//AGV到达下料位置
  777. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
  778. }
  779. if (objData.equipmentId == 33 && objData.command == "LOAD")
  780. {
  781. globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置
  782. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV【3】号滚筒线上料请求");
  783. }
  784. if (objData.equipmentId == 30 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
  785. {
  786. globalVar.rollerLineThree.agvArriveCleanUnLoad = true;//AGV到达下料位置
  787. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机下料请求");
  788. }
  789. #endregion
  790. #region 清洗台到线体4请求上下料
  791. if (objData.equipmentId == 10 && objData.command == "LOAD")
  792. {
  793. globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置
  794. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV洗桶机上料请求");
  795. }
  796. if (objData.equipmentId == 44 && objData.command == "UNLOAD")
  797. {
  798. globalVar.agvArriveLineFour = true;//agv到达线体4下料位置
  799. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
  800. }
  801. #endregion
  802. }
  803. }
  804. /// <summary>
  805. /// AGV搬运任务上报数据解析
  806. /// </summary>
  807. /// <param name="obj"></param>
  808. private void AgvTaskUpReportDataAnalysis(object obj)
  809. {
  810. TaskEventData objData;
  811. try
  812. {
  813. objData = JsonConvert.DeserializeObject<TaskEventData>(obj.ToString());
  814. }
  815. catch (Exception)
  816. {
  817. MessageNotify.GetInstance.ShowRunLog("Agv任务回报数据异常");
  818. objData = null;
  819. }
  820. if (objData != null)
  821. {
  822. if (objData.state == "ABNORMAL_COMPLETED")
  823. {
  824. if (objData.robotJobId == LOnerobotJobId)
  825. {
  826. globalVar.LineOneRobotTaskError = true;
  827. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  828. }
  829. if (objData.robotJobId == LTworobotJobId)
  830. {
  831. globalVar.LineTwoRobotTaskError = true;
  832. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  833. }
  834. if (objData.robotJobId == LThreerobotJobId)
  835. {
  836. globalVar.LineThreeRobotTaskError = true;
  837. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  838. }
  839. if (objData.robotJobId == LFourrobotJobId)
  840. {
  841. globalVar.LineFourRobotTaskError = true;
  842. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  843. }
  844. if (objData.robotJobId == LFiverobotJobId)
  845. {
  846. globalVar.LineFiveRobotTaskError = true;
  847. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  848. }
  849. if (objData.robotJobId == LSixrobotJobId)
  850. {
  851. globalVar.LineSixRobotTaskError = true;
  852. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  853. }
  854. if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
  855. {
  856. globalVar.LineSevenRobotTaskError = true;
  857. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  858. }
  859. if (LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
  860. {
  861. globalVar.LineEightRobotTaskError = true;
  862. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  863. }
  864. if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
  865. {
  866. globalVar.LineNineRobotTaskError = true;
  867. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  868. }
  869. if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null)
  870. {
  871. globalVar.LineTenRobotTaskError = true;
  872. MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入");
  873. }
  874. }
  875. #region 线体上下料任务信息回报
  876. //线体1任务上报
  877. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")// AGV正在上料,指线体上料
  878. {
  879. }
  880. //线体2任务上报
  881. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")// AGV正在上料,指线体上料
  882. {
  883. //日志
  884. }
  885. //线体3任务上报
  886. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")// AGV正在上料,指线体上料
  887. {
  888. //日志
  889. }
  890. //线体1任务上报
  891. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体上料
  892. {
  893. DeviceOperate.GetInstance.WritePlcData("D1052", 0);
  894. globalVar.agvLineOneLoadCom = true;
  895. AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
  896. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  897. if (globalVar.LOneFryPotSerial == 1)
  898. {
  899. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_1);
  900. }
  901. else if (globalVar.LOneFryPotSerial == 4)
  902. {
  903. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_4);
  904. }
  905. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→炒锅【{globalVar.LOneFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  906. }
  907. //线体2任务上报
  908. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体上料
  909. {
  910. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  911. globalVar.agvLineTwoLoadCom = true;
  912. AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
  913. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  914. if (globalVar.LTwoFryPotSerial == 2)
  915. {
  916. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_2);
  917. }
  918. else if (globalVar.LTwoFryPotSerial == 5)
  919. {
  920. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_5);
  921. }
  922. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→炒锅【{globalVar.LTwoFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  923. }
  924. //线体3任务上报
  925. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体上料
  926. {
  927. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  928. globalVar.agvLineThreeLoadCom = true;
  929. AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
  930. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes);
  931. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_3_3);
  932. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→炒锅【{globalVar.LThreeFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  933. }
  934. //线体1任务上报
  935. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料点正在下料,指线体到炒锅下料
  936. {
  937. }
  938. //线体2任务上报
  939. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "PChS6R" || objData.jobData.targetPointCode == "sxSX88"))//指定下料点正在下料,指线体到炒锅下料
  940. {
  941. }
  942. //线体3任务上报
  943. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料点正在下料,指线体到炒锅下料
  944. {
  945. }
  946. //线体1任务上报
  947. if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && (objData.jobData.targetPointCode == "DXDnMJ" || objData.jobData.targetPointCode == "naFssQ"))//指定下料位置下料完成,指线体到炒锅下料
  948. {
  949. if (objData.jobData.targetPointCode == "DXDnMJ")
  950. {
  951. DeviceOperate.GetInstance.WritePlcData("D1055", 0);
  952. }
  953. else
  954. {
  955. DeviceOperate.GetInstance.WritePlcData("D1058", 0);
  956. }
  957. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  958. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  959. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  960. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  961. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
  962. }
  963. //线体2任务上报
  964. if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && (objData.jobData.targetPointCode == "CDPGde" || objData.jobData.targetPointCode == "sxSX88"))//指定下料位置下料完成,指线体到炒锅下料
  965. {
  966. if (objData.jobData.targetPointCode == "CDPGde")
  967. {
  968. DeviceOperate.GetInstance.WritePlcData("D1056", 0);
  969. }
  970. else
  971. {
  972. DeviceOperate.GetInstance.WritePlcData("D1059", 0);
  973. }
  974. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  975. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  976. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  977. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  978. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LTwoFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
  979. }
  980. //线体3任务上报
  981. if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "biZG87")//指定下料位置下料完成,指线体到炒锅下料
  982. {
  983. DeviceOperate.GetInstance.WritePlcData("D1057", 0);
  984. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  985. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj);
  986. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  987. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  988. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LThreeFryPotSerial}】下料完成信号,任务号【{objData.robotJobId}】");
  989. }
  990. #endregion
  991. #region 炒锅空桶上下料任务信息回报
  992. //线体1任务上报
  993. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))// AGV正在上料,指炒锅空桶上料
  994. {
  995. //日志
  996. }
  997. //线体2任务上报
  998. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))// AGV正在上料,指炒锅空桶上料
  999. {
  1000. //日志
  1001. }
  1002. //线体3任务上报
  1003. if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")// AGV正在上料,指炒锅空桶上料
  1004. {
  1005. //日志
  1006. }
  1007. //线体1任务上报
  1008. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFourrobotJobId && (objData.jobData.startPointCode == "DXDnMJ" || objData.jobData.startPointCode == "naFssQ"))//指定上料点上料完成,这里指炒锅空桶上料
  1009. {
  1010. if (objData.jobData.startPointCode == "DXDnMJ")
  1011. {
  1012. DeviceOperate.GetInstance.WritePlcData("D1060", 0);
  1013. }
  1014. else
  1015. {
  1016. DeviceOperate.GetInstance.WritePlcData("D1063", 0);
  1017. }
  1018. globalVar.agvFryPotEmptyRollerArrive = true;
  1019. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1020. if (globalVar.LOneFryPotSerial == 1)
  1021. {
  1022. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_1);
  1023. }
  1024. else if (globalVar.LOneFryPotSerial == 4)
  1025. {
  1026. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);
  1027. }
  1028. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  1029. }
  1030. //线体2任务上报
  1031. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LFiverobotJobId && (objData.jobData.startPointCode == "CDPGde" || objData.jobData.startPointCode == "sxSX88"))//指定上料点上料完成,这里指炒锅空桶上料
  1032. {
  1033. if (objData.jobData.startPointCode == "CDPGde")
  1034. {
  1035. DeviceOperate.GetInstance.WritePlcData("D1061", 0);
  1036. }
  1037. else
  1038. {
  1039. DeviceOperate.GetInstance.WritePlcData("D1064", 0);
  1040. }
  1041. globalVar.LTwoagvFryPotEmptyRollerArrive = true;
  1042. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1043. if (globalVar.LTwoFryPotSerial == 2)
  1044. {
  1045. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_2);
  1046. }
  1047. else if (globalVar.LTwoFryPotSerial == 5)
  1048. {
  1049. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_5);
  1050. }
  1051. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LTwoFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  1052. }
  1053. //线体3任务上报
  1054. if (objData.state == "LOAD_COMPLETED" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "biZG87")//指定上料点上料完成,这里指炒锅空桶上料
  1055. {
  1056. DeviceOperate.GetInstance.WritePlcData("D1062", 0);
  1057. globalVar.LThreeagvFryPotEmptyRollerArrive = true;
  1058. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1059. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_3);
  1060. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LThreeFryPotSerial}】上料完成信号,任务号【{objData.robotJobId}】");
  1061. }
  1062. //线体1任务上报
  1063. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
  1064. {
  1065. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  1066. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1067. }
  1068. //线体2任务上报
  1069. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
  1070. {
  1071. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  1072. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1073. }
  1074. //线体3任务上报
  1075. if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料点正在下料,指炒锅空桶下料
  1076. {
  1077. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  1078. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1079. }
  1080. //线体1任务上报
  1081. if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
  1082. {
  1083. MessageNotify.GetInstance.ShowRunLog("1号线炒锅空桶在4号线卸桶完成");
  1084. DeviceOperate.GetInstance.WritePlcData("D1067", 0);
  1085. if (globalVar.LFourRollerNum >= 8)
  1086. {
  1087. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  1088. }
  1089. else
  1090. {
  1091. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  1092. }
  1093. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  1094. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  1095. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1096. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV炒锅【{globalVar.LOneFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
  1097. }
  1098. //线体2任务上报
  1099. if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
  1100. {
  1101. MessageNotify.GetInstance.ShowRunLog("2号线炒锅空桶在4号线卸桶完成");
  1102. DeviceOperate.GetInstance.WritePlcData("D1067", 0);
  1103. if (globalVar.LFourRollerNum >= 8)
  1104. {
  1105. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  1106. }
  1107. else
  1108. {
  1109. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  1110. }
  1111. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  1112. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  1113. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1114. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV【{globalVar.LTwoFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
  1115. }
  1116. //线体3任务上报
  1117. if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指炒锅空桶下料
  1118. {
  1119. MessageNotify.GetInstance.ShowRunLog("3号线炒锅空桶在4号线卸桶完成");
  1120. DeviceOperate.GetInstance.WritePlcData("D1067", 0);
  1121. if (globalVar.LFourRollerNum >= 8)
  1122. {
  1123. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  1124. }
  1125. else
  1126. {
  1127. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  1128. }
  1129. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  1130. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  1131. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1132. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV【{globalVar.LThreeFryPotSerial}】→回桶线下料完成信号,任务号【{objData.robotJobId}】");
  1133. }
  1134. #endregion
  1135. #region 线体123空桶到清戏台
  1136. //线体1任务上报
  1137. if (objData.state == "LOAD_COMPLETED" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "sTEwzw")//指定上料点上料完成,这里指线体1空桶上料
  1138. {
  1139. DeviceOperate.GetInstance.WritePlcData("D1052", 0);
  1140. globalVar.agvArriveLineOneLoadCom = true;
  1141. AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString());
  1142. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1143. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_1);
  1144. //到清洗处
  1145. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
  1146. }
  1147. //线体2任务上报
  1148. if (objData.state == "LOAD_COMPLETED" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "PChS6R")//指定上料点上料完成,这里指线体2空桶上料
  1149. {
  1150. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  1151. globalVar.agvArriveLineTwoLoadCom = true;
  1152. AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString());
  1153. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1154. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_2);
  1155. //到清洗处
  1156. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
  1157. }
  1158. //线体3任务上报
  1159. if (objData.state == "LOAD_COMPLETED" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "HHif8Z")//指定上料点上料完成,这里指线体3空桶上料
  1160. {
  1161. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  1162. globalVar.agvArriveLineThreeLoadCom = true;
  1163. AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString());
  1164. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1165. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_3);
  1166. //到清洗处
  1167. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→洗桶机上料完成信号,任务号【{objData.robotJobId}】");
  1168. }
  1169. if (objData.state == "DONE" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体1到清戏台空桶下料
  1170. {
  1171. DeviceOperate.GetInstance.WritePlcData("D1065", 0);
  1172. LSevenrobotJobId.Remove(objData.robotJobId);
  1173. MessageNotify.GetInstance.ShowRunLog("线体【1】空桶在清洗台卸桶完成");
  1174. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1175. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1176. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1177. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1178. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体1→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
  1179. }
  1180. if (objData.state == "DONE" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体2到清戏台空桶下料
  1181. {
  1182. DeviceOperate.GetInstance.WritePlcData("D1065", 0);
  1183. LEightrobotJobId.Remove(objData.robotJobId);
  1184. MessageNotify.GetInstance.ShowRunLog("线体【2】空桶在清洗台卸桶完成");
  1185. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1186. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1187. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1188. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1189. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体2→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
  1190. }
  1191. if (objData.state == "DONE" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料位置下料完成,指从线体3到清戏台空桶下料
  1192. {
  1193. DeviceOperate.GetInstance.WritePlcData("D1065", 0);
  1194. LNinerobotJobId.Remove(objData.robotJobId);
  1195. MessageNotify.GetInstance.ShowRunLog("线体【3】空桶在清洗台卸桶完成");
  1196. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1197. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj);
  1198. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1199. AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum);
  1200. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV线体3→洗桶机下料完成信号,任务号【{objData.robotJobId}】");
  1201. }
  1202. #endregion
  1203. #region 清洗台到线体4
  1204. if (objData.state == "LOAD_COMPLETED" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "TitRYC")//指定上料位置上料完成,指清戏台空桶到上料
  1205. {
  1206. DeviceOperate.GetInstance.WritePlcData("D1066", 0);
  1207. // globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志
  1208. MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成");
  1209. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes);
  1210. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_4);//去四号空桶线
  1211. AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum);
  1212. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV洗桶机上料完成信号,任务号【{objData.robotJobId}】");
  1213. }
  1214. if (objData.state == "ROLLER_UNLOAD_DOING" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "TitRYC")//指定下料点正在下料,指清洗台空桶到线体4下料
  1215. {
  1216. AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start);
  1217. MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.jobData.agvCode}】AGV回桶线下料完成信号,任务号【{objData.robotJobId}】");
  1218. }
  1219. if (objData.state == "DONE" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "w2jZhM")//指定下料位置下料完成,指清戏台空桶到线体4下料
  1220. {
  1221. DeviceOperate.GetInstance.WritePlcData("D1067", 0);
  1222. LTenrobotJobId.Remove(objData.robotJobId);
  1223. MessageNotify.GetInstance.ShowRunLog("【4】号线空桶回桶完成");
  1224. if (globalVar.LFourRollerNum >= 8)
  1225. {
  1226. AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
  1227. }
  1228. else
  1229. {
  1230. AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString());
  1231. }
  1232. AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No);
  1233. AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj"));
  1234. AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]);
  1235. AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes);
  1236. }
  1237. #endregion
  1238. }
  1239. }
  1240. /// <summary>
  1241. /// 主任务重启
  1242. /// </summary>
  1243. private void ResetProgram()
  1244. {
  1245. ThreadManage.GetInstance().StartLong(new Action(() =>
  1246. {
  1247. if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
  1248. {
  1249. MessageNotify.GetInstance.ShowUserLog("主任务正在重启");
  1250. ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
  1251. {
  1252. //ActionManage.GetInstance.CancelRegister("RecipeSetDown");
  1253. //ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
  1254. // ActionManage.GetInstance.Send("ClearRecipes");
  1255. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1256. {
  1257. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1258. {
  1259. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1260. {
  1261. globalVar = null;
  1262. globalVar = new GlobalVariable();
  1263. ReicpeNum = 0;
  1264. ReadPlcData();
  1265. MainTask();
  1266. MessageNotify.GetInstance.ShowUserLog("主任务重启完成");
  1267. }));
  1268. }));
  1269. }));
  1270. }));
  1271. }
  1272. Thread.Sleep(10);
  1273. }), "ResetProgram");
  1274. }
  1275. public void LineOneTaskRestart()
  1276. {
  1277. ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
  1278. {
  1279. WritePlcData("D1101", 0);//复位开始执行指令
  1280. ActionManage.GetInstance.Send("ClearOneRecipes");
  1281. //globalVar.rollerLineOne = null;
  1282. //globalVar.rollerLineOne = new RollerLineOne();
  1283. //globalVar.fryPotOne = null;
  1284. //globalVar.fryPotOne = new FryPotOne();
  1285. //globalVar.fryPotFour = null;
  1286. //globalVar.fryPotFour = new FryPotFour();
  1287. globalVar.rollerLineOne.RecipeComMidSingle = 1;
  1288. globalVar.rollerLineOne.LowSignalJude = false;
  1289. globalVar.rollerLineOne.NextStart = false;
  1290. globalVar.rollerLineOne.IsEpmtyBefore = false;
  1291. globalVar.rollerLineOne.CanRun = true;
  1292. globalVar.ExitLineOneTask = false;
  1293. globalVar.LOneCurrentRecipeName = string.Empty;
  1294. globalVar.AllowAgvToLineLoadRoller = true;
  1295. globalVar.InOrOutputLock = false;
  1296. globalVar.LoadRoller = false;
  1297. globalVar.AgvToFryPot = false;
  1298. globalVar.PotOneInputMaterialArrive = false;
  1299. globalVar.PotOneOutputRollerArrive = false;
  1300. globalVar.AgvArrivePot = false;
  1301. globalVar.LOneMaterialNum = 0;
  1302. globalVar.LOneCurrentCookingStep = 0;
  1303. globalVar.LFourCurrentCookingStep = 0;
  1304. globalVar.agvArriveUpLoad = false;
  1305. globalVar.agvArriveUnLoad = false;
  1306. globalVar.agvFryPotEmptyRollerArrive = false;
  1307. globalVar.rollerLineOne.agvArriveLineFour = false;
  1308. globalVar.agvLineOneLoadCom = false;
  1309. ErrorRecipe = false;
  1310. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  1311. MessageNotify.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
  1312. }));
  1313. }
  1314. public void LineTwoTaskRestart()
  1315. {
  1316. ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
  1317. {
  1318. WritePlcData("D1102", 0);//复位开始执行指令
  1319. ActionManage.GetInstance.Send("ClearTwoRecipes");
  1320. //globalVar.rollerLineTwo = null;
  1321. //globalVar.rollerLineTwo = new RollerLineTwo();
  1322. //globalVar.fryPotTwo = null;
  1323. //globalVar.fryPotTwo = new FryPotTwo();
  1324. //globalVar.fryPotFive = null;
  1325. //globalVar.fryPotFive = new FryPotFive();
  1326. globalVar.rollerLineTwo.RecipeComMidSingle = 1;
  1327. globalVar.rollerLineTwo.LowSignalJude = false;
  1328. globalVar.rollerLineTwo.NextStart = false;
  1329. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  1330. globalVar.rollerLineTwo.CanRun = true;
  1331. globalVar.ExitLineTwoTask = false;
  1332. globalVar.LTwoCurrentRecipeName = string.Empty;
  1333. globalVar.AllowAgvToLineTwoLoadRoller = true;
  1334. globalVar.LTwoInOrOutputLock = false;
  1335. globalVar.LTwoLoadRoller = false;
  1336. globalVar.LTwoAgvToFryPot = false;
  1337. globalVar.LTwoPotInputMaterialArrive = false;
  1338. globalVar.LTwoPotOutputRollerArrive = false;
  1339. globalVar.LTwoAgvArrivePot = false;
  1340. globalVar.LTwoMaterialNum = 0;
  1341. globalVar.LTwoCurrentCookingStep = 0;
  1342. globalVar.LFiveCurrentCookingStep = 0;
  1343. globalVar.agvArriveLTwoUpLoad = false;
  1344. globalVar.LTwoagvArriveUnLoad = false;
  1345. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  1346. globalVar.rollerLineTwo.agvArriveLineFour = false;
  1347. globalVar.agvLineTwoLoadCom = false;
  1348. LTwoErrorRecipe = false;
  1349. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  1350. MessageNotify.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
  1351. }));
  1352. }
  1353. public void LineThreeTaskRestart()
  1354. {
  1355. ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
  1356. {
  1357. WritePlcData("D1103", 0);//复位开始执行指令
  1358. ActionManage.GetInstance.Send("ClearThreeRecipes");
  1359. //globalVar.rollerLineThree = null;
  1360. //globalVar.rollerLineThree = new RollerLineThree();
  1361. //globalVar.fryPotThree = null;
  1362. //globalVar.fryPotThree = new FryPotThree();
  1363. globalVar.rollerLineTwo.RecipeComMidSingle = 1;
  1364. globalVar.rollerLineTwo.LowSignalJude = false;
  1365. globalVar.rollerLineTwo.NextStart = false;
  1366. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  1367. globalVar.rollerLineTwo.CanRun = true;
  1368. globalVar.ExitLineThreeTask = false;
  1369. globalVar.AllowAgvToLineThreeLoadRoller = true;
  1370. globalVar.LThreeInOrOutputLock = false;
  1371. globalVar.LThreeCurrentRecipeName = string.Empty;
  1372. globalVar.LThreeLoadRoller = false;
  1373. globalVar.LThreeAgvToFryPot = false;
  1374. globalVar.LThreePotInputMaterialArrive = false;
  1375. globalVar.LThreePotOutputRollerArrive = false;
  1376. globalVar.LThreeAgvArrivePot = false;
  1377. globalVar.LThreeMaterialNum = 0;
  1378. globalVar.LThreeCurrentCookingStep = 0;
  1379. globalVar.agvArriveLThreeUpLoad = false;
  1380. globalVar.LThreeagvArriveUnLoad = false;
  1381. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  1382. globalVar.rollerLineThree.agvArriveLineFour = false;
  1383. globalVar.agvLineThreeLoadCom = false;
  1384. LThreeErrorRecipe = false;
  1385. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  1386. MessageNotify.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
  1387. }));
  1388. }
  1389. public void LineOneEmptyRollerCleanTaskRestart()
  1390. {
  1391. ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() =>
  1392. {
  1393. globalVar.rollerLineOne.StationEight = 0;
  1394. globalVar.ExitLineOneTask = false;
  1395. //globalVar.rollerLineOne.EmptyRollerNums.Clear();
  1396. globalVar.rollerLineOne.IsEpmtyBefore = false;
  1397. globalVar.rollerLineOne.CanRun = true;
  1398. globalVar.agvArriveLineFour = false;
  1399. globalVar.agvArriveCleanLoad = false;
  1400. globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
  1401. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  1402. globalVar.agvArriveLineOneLoadCom = false;
  1403. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
  1404. MessageNotify.GetInstance.ShowUserLog("滚筒线【1】空桶清洗任务重启成功");
  1405. }));
  1406. }
  1407. public void LineTwoEmptyRollerCleanTaskRestart()
  1408. {
  1409. ThreadManage.GetInstance().StopTask("滚筒线2空桶清洗任务线程", new Action(() =>
  1410. {
  1411. globalVar.rollerLineTwo.StationEight = 0;
  1412. globalVar.ExitLineTwoTask = false;
  1413. // globalVar.rollerLineTwo.EmptyRollerNums.Clear();
  1414. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  1415. globalVar.rollerLineTwo.CanRun = true;
  1416. globalVar.agvArriveLineFour = false;
  1417. globalVar.agvArriveCleanLoad = false;
  1418. globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
  1419. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  1420. globalVar.agvArriveLineTwoLoadCom = false;
  1421. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
  1422. MessageNotify.GetInstance.ShowUserLog("滚筒线【2】空桶清洗任务重启成功");
  1423. }));
  1424. }
  1425. public void LineThreeEmptyRollerCleanTaskRestart()
  1426. {
  1427. ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() =>
  1428. {
  1429. globalVar.rollerLineThree.StationEight = 0;
  1430. globalVar.ExitLineThreeTask = false;
  1431. // globalVar.rollerLineThree.EmptyRollerNums.Clear();
  1432. globalVar.rollerLineThree.IsEpmtyBefore = false;
  1433. globalVar.rollerLineThree.CanRun = true;
  1434. globalVar.agvArriveLineFour = false;
  1435. globalVar.agvArriveCleanLoad = false;
  1436. globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
  1437. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  1438. globalVar.agvArriveLineThreeLoadCom = false;
  1439. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
  1440. MessageNotify.GetInstance.ShowUserLog("滚筒线【3】空桶清洗任务重启成功");
  1441. }));
  1442. }
  1443. /// <summary>
  1444. /// 实时获取plc数据
  1445. /// </summary>
  1446. public void ReadPlcData()
  1447. {
  1448. ThreadManage.GetInstance().StartLong(new Action(() =>
  1449. {
  1450. GetAddressData("D2001", new Action<ushort[]>((data) =>
  1451. {
  1452. try
  1453. {
  1454. if (data.Count() > 0)
  1455. {
  1456. globalVar.rollerLineOne.StationOne = data[0];
  1457. globalVar.rollerLineOne.StationTwo = data[1];
  1458. globalVar.rollerLineOne.StationThree = data[2];
  1459. globalVar.rollerLineOne.StationFour = data[3];
  1460. globalVar.rollerLineOne.StationFive = data[4];
  1461. globalVar.rollerLineOne.StationSix = data[5];
  1462. globalVar.rollerLineOne.StationSeven = data[6];
  1463. globalVar.rollerLineOne.StationEight = data[7];
  1464. }
  1465. }
  1466. catch (Exception)
  1467. {
  1468. // throw;
  1469. }
  1470. }));
  1471. GetAddressData("D2011", new Action<ushort[]>((data) =>
  1472. {
  1473. try
  1474. {
  1475. if (data.Count() > 0)
  1476. {
  1477. globalVar.rollerLineTwo.StationOne = data[0];
  1478. globalVar.rollerLineTwo.StationTwo = data[1];
  1479. globalVar.rollerLineTwo.StationThree = data[2];
  1480. globalVar.rollerLineTwo.StationFour = data[3];
  1481. globalVar.rollerLineTwo.StationFive = data[4];
  1482. globalVar.rollerLineTwo.StationSix = data[5];
  1483. globalVar.rollerLineTwo.StationSeven = data[6];
  1484. globalVar.rollerLineTwo.StationEight = data[7];
  1485. }
  1486. }
  1487. catch (Exception)
  1488. {
  1489. // throw;
  1490. }
  1491. }));
  1492. GetAddressData("D2021", new Action<ushort[]>((data) =>
  1493. {
  1494. try
  1495. {
  1496. if (data.Count() > 0)
  1497. {
  1498. globalVar.rollerLineThree.StationOne = data[0];
  1499. globalVar.rollerLineThree.StationTwo = data[1];
  1500. globalVar.rollerLineThree.StationThree = data[2];
  1501. globalVar.rollerLineThree.StationFour = data[3];
  1502. globalVar.rollerLineThree.StationFive = data[4];
  1503. globalVar.rollerLineThree.StationSix = data[5];
  1504. globalVar.rollerLineThree.StationSeven = data[6];
  1505. globalVar.rollerLineThree.StationEight = data[7];
  1506. }
  1507. }
  1508. catch (Exception)
  1509. {
  1510. //throw;
  1511. }
  1512. }));
  1513. GetAddressData("D2031", new Action<ushort[]>((data) =>
  1514. {
  1515. //globalVar.rollerLineOne.OutMaterialingSingle = data[3];
  1516. //globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
  1517. //globalVar.rollerLineThree.OutMaterialingSingle = data[5];
  1518. //AlarmHelper<AlarmInfo>.GetInstance().LineOneRollerRunning = data[3];
  1519. //AlarmHelper<AlarmInfo>.GetInstance().LineTwoRollerRunning = data[4];
  1520. //AlarmHelper<AlarmInfo>.GetInstance().LineThreeRollerRunning = data[5];
  1521. try
  1522. {
  1523. if (data.Count() > 0)
  1524. {
  1525. AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble = data[6];
  1526. AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble = data[7];
  1527. AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble = data[8];
  1528. }
  1529. }
  1530. catch (Exception)
  1531. {
  1532. // throw;
  1533. }
  1534. }));
  1535. //GetAddressData("D2040", new Action<ushort[]>((data) =>
  1536. //{
  1537. // globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
  1538. // globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
  1539. // globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
  1540. // globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
  1541. // globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
  1542. // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerRunning = data[0];
  1543. // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerRunning = data[1];
  1544. // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerRunning = data[2];
  1545. // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerRunning = data[3];
  1546. // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerRunning = data[4];
  1547. //}));
  1548. GetAddressData("D2045", new Action<ushort[]>((data) =>
  1549. {
  1550. try
  1551. {
  1552. if (data.Count() > 0)
  1553. {
  1554. globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
  1555. globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
  1556. globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
  1557. globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
  1558. globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
  1559. }
  1560. }
  1561. catch (Exception)
  1562. {
  1563. // throw;
  1564. }
  1565. }));
  1566. GetAddressData("D2050", new Action<ushort[]>((data) =>
  1567. {
  1568. try
  1569. {
  1570. if (data.Count() > 0)
  1571. {
  1572. globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
  1573. globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
  1574. globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
  1575. globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
  1576. globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
  1577. }
  1578. }
  1579. catch (Exception)
  1580. {
  1581. //throw;
  1582. }
  1583. }));
  1584. //GetAddressData("D2065", new Action<ushort[]>((data) =>
  1585. //{
  1586. // globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
  1587. // globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
  1588. // globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
  1589. // globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
  1590. // globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
  1591. // AlarmHelper<AlarmInfo>.GetInstance().FryPotOneEmptyRollerRunning = data[0];
  1592. // AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoEmptyRollerRunning = data[1];
  1593. // AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeEmptyRollerRunning = data[2];
  1594. // AlarmHelper<AlarmInfo>.GetInstance().FryPotFourEmptyRollerRunning = data[3];
  1595. // AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveEmptyRollerRunning = data[4];
  1596. //}));
  1597. GetAddressData("D2070", new Action<ushort[]>((data) =>
  1598. {
  1599. //globalVar.fryPotOne.RollerTroubleSingle = data[0];
  1600. //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
  1601. //globalVar.fryPotThree.RollerTroubleSingle = data[2];
  1602. //globalVar.fryPotFour.RollerTroubleSingle = data[3];
  1603. //globalVar.fryPotFive.RollerTroubleSingle = data[4];
  1604. try
  1605. {
  1606. if (data.Count() > 0)
  1607. {
  1608. AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble = data[0];
  1609. AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble = data[1];
  1610. AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble = data[2];
  1611. AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble = data[3];
  1612. AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble = data[4];
  1613. }
  1614. }
  1615. catch (Exception)
  1616. {
  1617. // throw;
  1618. }
  1619. }));
  1620. //GetAddressData("D2078", new Action<ushort[]>(data =>
  1621. //{
  1622. // //globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
  1623. // //globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
  1624. // //globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
  1625. //}));
  1626. GetAddressData("D2075", new Action<ushort[]>(data =>
  1627. {
  1628. try
  1629. {
  1630. if (data.Count() > 0)
  1631. {
  1632. AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning = data[0];
  1633. globalVar.CleadBarrelEnterSingle = data[0];
  1634. }
  1635. }
  1636. catch (Exception)
  1637. {
  1638. // throw;
  1639. }
  1640. }));
  1641. GetAddressData("D2076", new Action<ushort[]>(data =>
  1642. {
  1643. try
  1644. {
  1645. if (data.Count() > 0)
  1646. globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号
  1647. }
  1648. catch (Exception)
  1649. {
  1650. //throw;
  1651. }
  1652. }));
  1653. GetAddressData("D2077", new Action<ushort[]>(data =>
  1654. {
  1655. try
  1656. {
  1657. if (data.Count() > 0)
  1658. {
  1659. AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning = data[0];
  1660. globalVar.CleadBarrelExitSingle = data[0];
  1661. }
  1662. }
  1663. catch (Exception)
  1664. {
  1665. // throw;
  1666. }
  1667. }));
  1668. //滚筒线123开始信号
  1669. GetAddressData("D2101", new Action<ushort[]>(data =>
  1670. {
  1671. try
  1672. {
  1673. if (data.Count() > 0)
  1674. {
  1675. globalVar.rollerLineOne.ExcuteIsConfirm = data[0];
  1676. globalVar.rollerLineTwo.ExcuteIsConfirm = data[1];
  1677. globalVar.rollerLineThree.ExcuteIsConfirm = data[2];
  1678. }
  1679. }
  1680. catch (Exception)
  1681. {
  1682. //throw;
  1683. }
  1684. }));
  1685. GetAddressData("D4400", new Action<ushort[]>(data =>
  1686. {
  1687. try
  1688. {
  1689. if (data.Count() > 0)
  1690. globalVar.rollerLineOne.EmptyRollerNum = data[0];
  1691. }
  1692. catch (Exception)
  1693. {
  1694. // throw;
  1695. }
  1696. }));
  1697. GetAddressData("D4410", new Action<ushort[]>(data =>
  1698. {
  1699. try
  1700. {
  1701. if (data.Count() > 0)
  1702. globalVar.rollerLineTwo.EmptyRollerNum = data[0];
  1703. }
  1704. catch (Exception)
  1705. {
  1706. //throw;
  1707. }
  1708. }));
  1709. GetAddressData("D4420", new Action<ushort[]>(data =>
  1710. {
  1711. try
  1712. {
  1713. if (data.Count() > 0)
  1714. globalVar.rollerLineThree.EmptyRollerNum = data[0];
  1715. }
  1716. catch (Exception)
  1717. {
  1718. //throw;
  1719. }
  1720. }));
  1721. GetAddressData("D2111", new Action<ushort[]>(data =>
  1722. {
  1723. try
  1724. {
  1725. if (data.Count() > 0)
  1726. {
  1727. globalVar.rollerLineOne.WashEmptyRollerModel = data[0];
  1728. globalVar.rollerLineTwo.WashEmptyRollerModel = data[1];
  1729. globalVar.rollerLineThree.WashEmptyRollerModel = data[2];
  1730. globalVar.rollerLineOne.WashRollerArriveSignal = data[3];
  1731. globalVar.rollerLineTwo.WashRollerArriveSignal = data[4];
  1732. globalVar.rollerLineThree.WashRollerArriveSignal = data[5];
  1733. }
  1734. }
  1735. catch (Exception)
  1736. {
  1737. // throw;
  1738. }
  1739. }));
  1740. //炒锅1状态数据
  1741. GetFryOneData("D0258", new Action<ushort[]>(data =>
  1742. {
  1743. try
  1744. {
  1745. if (data.Count() > 0)
  1746. FryPotMonitorManage.GetInstance.fryOne.Temperature = data[0] / 10.0;
  1747. }
  1748. catch (Exception)
  1749. {
  1750. // throw;
  1751. }
  1752. }));
  1753. GetFryOneData("D0510", new Action<ushort[]>(data =>
  1754. {
  1755. try
  1756. {
  1757. if (data.Count() > 0)
  1758. FryPotMonitorManage.GetInstance.fryOne.SmallFire = data[0];
  1759. }
  1760. catch (Exception)
  1761. {
  1762. //throw;
  1763. }
  1764. }));
  1765. GetFryOneData("D0512", new Action<ushort[]>(data =>
  1766. {
  1767. try
  1768. {
  1769. if (data.Count() > 0)
  1770. FryPotMonitorManage.GetInstance.fryOne.MidFire = data[0];
  1771. }
  1772. catch (Exception)
  1773. {
  1774. //throw;
  1775. }
  1776. }));
  1777. GetFryOneData("D0514", new Action<ushort[]>(data =>
  1778. {
  1779. try
  1780. {
  1781. if (data.Count() > 0)
  1782. FryPotMonitorManage.GetInstance.fryOne.BigFire = data[0];
  1783. }
  1784. catch (Exception)
  1785. {
  1786. // throw;
  1787. }
  1788. }));
  1789. GetFryOneData("D0516", new Action<ushort[]>(data =>
  1790. {
  1791. try
  1792. {
  1793. if (data.Count() > 0)
  1794. FryPotMonitorManage.GetInstance.fryOne.StrongFire = data[0];
  1795. }
  1796. catch (Exception)
  1797. {
  1798. // throw;
  1799. }
  1800. }));
  1801. GetFryOneData("D2500", new Action<ushort[]>(data =>
  1802. {
  1803. try
  1804. {
  1805. if (data.Count() > 0)
  1806. FryPotMonitorManage.GetInstance.fryOne.Speed = data[0] / 10.0;
  1807. }
  1808. catch (Exception)
  1809. {
  1810. // throw;
  1811. }
  1812. }));
  1813. GetFryOneData("D0600", new Action<ushort[]>(data =>
  1814. {
  1815. try
  1816. {
  1817. if (data.Count() > 0)
  1818. FryPotMonitorManage.GetInstance.fryOne.FryPotWeight = data[0] / 10.0;
  1819. }
  1820. catch (Exception)
  1821. {
  1822. //throw;
  1823. }
  1824. }));
  1825. GetFryOneData("D3000", new Action<ushort[]>(data =>
  1826. {
  1827. try
  1828. {
  1829. if (data.Count() > 0)
  1830. {
  1831. FryPotMonitorManage.GetInstance.fryOne.Step = data[0];
  1832. globalVar.fryPotOne.ProcessStep = data[0];
  1833. }
  1834. }
  1835. catch (Exception)
  1836. {
  1837. //throw;
  1838. }
  1839. }));
  1840. GetFryOneData("D3301", new Action<ushort[]>(data =>
  1841. {
  1842. try
  1843. {
  1844. if (data.Count() > 0)
  1845. globalVar.fryPotOne.RecipeCompleteSingle = data[0];
  1846. }
  1847. catch (Exception)
  1848. {
  1849. //throw;
  1850. }
  1851. }));
  1852. ////炒锅2状态数据
  1853. GetFryTwoData("D0258", new Action<ushort[]>(data =>
  1854. {
  1855. try
  1856. {
  1857. if (data.Count() > 0)
  1858. FryPotMonitorManage.GetInstance.fryTwo.Temperature = data[0] / 10.0;
  1859. }
  1860. catch (Exception)
  1861. {
  1862. //throw;
  1863. }
  1864. }));
  1865. GetFryTwoData("D0510", new Action<ushort[]>(data =>
  1866. {
  1867. try
  1868. {
  1869. if (data.Count() > 0)
  1870. FryPotMonitorManage.GetInstance.fryTwo.SmallFire = data[0];
  1871. }
  1872. catch (Exception)
  1873. {
  1874. //throw;
  1875. }
  1876. }));
  1877. GetFryTwoData("D0512", new Action<ushort[]>(data =>
  1878. {
  1879. try
  1880. {
  1881. if (data.Count() > 0)
  1882. FryPotMonitorManage.GetInstance.fryTwo.MidFire = data[0];
  1883. }
  1884. catch (Exception)
  1885. {
  1886. // throw;
  1887. }
  1888. }));
  1889. GetFryTwoData("D0514", new Action<ushort[]>(data =>
  1890. {
  1891. try
  1892. {
  1893. if (data.Count() > 0)
  1894. FryPotMonitorManage.GetInstance.fryTwo.BigFire = data[0];
  1895. }
  1896. catch (Exception)
  1897. {
  1898. // throw;
  1899. }
  1900. }));
  1901. GetFryTwoData("D0516", new Action<ushort[]>(data =>
  1902. {
  1903. try
  1904. {
  1905. if (data.Count() > 0)
  1906. FryPotMonitorManage.GetInstance.fryTwo.StrongFire = data[0];
  1907. }
  1908. catch (Exception)
  1909. {
  1910. //throw;
  1911. }
  1912. }));
  1913. GetFryTwoData("D2500", new Action<ushort[]>(data =>
  1914. {
  1915. try
  1916. {
  1917. if (data.Count() > 0)
  1918. FryPotMonitorManage.GetInstance.fryTwo.Speed = data[0] / 10.0;
  1919. }
  1920. catch (Exception)
  1921. {
  1922. //throw;
  1923. }
  1924. }));
  1925. GetFryTwoData("D0600", new Action<ushort[]>(data =>
  1926. {
  1927. try
  1928. {
  1929. if (data.Count() > 0)
  1930. FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight = data[0] / 10.0;
  1931. }
  1932. catch (Exception)
  1933. {
  1934. //throw;
  1935. }
  1936. }));
  1937. GetFryTwoData("D3000", new Action<ushort[]>(data =>
  1938. {
  1939. try
  1940. {
  1941. if (data.Count() > 0)
  1942. {
  1943. FryPotMonitorManage.GetInstance.fryTwo.Step = data[0];
  1944. globalVar.fryPotTwo.ProcessStep = data[0];
  1945. }
  1946. }
  1947. catch (Exception)
  1948. {
  1949. // throw;
  1950. }
  1951. }));
  1952. GetFryTwoData("D3302", new Action<ushort[]>(data =>
  1953. {
  1954. try
  1955. {
  1956. if (data.Count() > 0)
  1957. globalVar.fryPotTwo.RecipeCompleteSingle = data[0];
  1958. }
  1959. catch (Exception)
  1960. {
  1961. // throw;
  1962. }
  1963. }));
  1964. ////炒锅3状态数据
  1965. GetFryThreeData("D0258", new Action<ushort[]>(data =>
  1966. {
  1967. try
  1968. {
  1969. if (data.Count() > 0)
  1970. FryPotMonitorManage.GetInstance.fryThree.Temperature = data[0] / 10.0;
  1971. }
  1972. catch (Exception)
  1973. {
  1974. //throw;
  1975. }
  1976. }));
  1977. GetFryThreeData("D0510", new Action<ushort[]>(data =>
  1978. {
  1979. try
  1980. {
  1981. if (data.Count() > 0)
  1982. FryPotMonitorManage.GetInstance.fryThree.SmallFire = data[0];
  1983. }
  1984. catch (Exception)
  1985. {
  1986. // throw;
  1987. }
  1988. }));
  1989. GetFryThreeData("D0512", new Action<ushort[]>(data =>
  1990. {
  1991. try
  1992. {
  1993. if (data.Count() > 0)
  1994. FryPotMonitorManage.GetInstance.fryThree.MidFire = data[0];
  1995. }
  1996. catch (Exception)
  1997. {
  1998. // throw;
  1999. }
  2000. }));
  2001. GetFryThreeData("D0514", new Action<ushort[]>(data =>
  2002. {
  2003. try
  2004. {
  2005. if (data.Count() > 0)
  2006. FryPotMonitorManage.GetInstance.fryThree.BigFire = data[0];
  2007. }
  2008. catch (Exception)
  2009. {
  2010. //throw;
  2011. }
  2012. }));
  2013. GetFryThreeData("D0516", new Action<ushort[]>(data =>
  2014. {
  2015. try
  2016. {
  2017. if (data.Count() > 0)
  2018. FryPotMonitorManage.GetInstance.fryThree.StrongFire = data[0];
  2019. }
  2020. catch (Exception)
  2021. {
  2022. //throw;
  2023. }
  2024. }));
  2025. GetFryThreeData("D2500", new Action<ushort[]>(data =>
  2026. {
  2027. try
  2028. {
  2029. if (data.Count() > 0)
  2030. FryPotMonitorManage.GetInstance.fryThree.Speed = data[0] / 10.0;
  2031. }
  2032. catch (Exception)
  2033. {
  2034. //throw;
  2035. }
  2036. }));
  2037. GetFryThreeData("D0600", new Action<ushort[]>(data =>
  2038. {
  2039. try
  2040. {
  2041. if (data.Count() > 0)
  2042. FryPotMonitorManage.GetInstance.fryThree.FryPotWeight = data[0] / 10.0;
  2043. }
  2044. catch (Exception)
  2045. {
  2046. // throw;
  2047. }
  2048. }));
  2049. GetFryThreeData("D3000", new Action<ushort[]>(data =>
  2050. {
  2051. try
  2052. {
  2053. if (data.Count() > 0)
  2054. {
  2055. FryPotMonitorManage.GetInstance.fryThree.Step = data[0];
  2056. globalVar.fryPotThree.ProcessStep = data[0];
  2057. }
  2058. }
  2059. catch (Exception)
  2060. {
  2061. // throw;
  2062. }
  2063. }));
  2064. GetFryThreeData("D3303", new Action<ushort[]>(data =>
  2065. {
  2066. try
  2067. {
  2068. if (data.Count() > 0)
  2069. globalVar.fryPotThree.RecipeCompleteSingle = data[0];
  2070. }
  2071. catch (Exception)
  2072. {
  2073. //throw;
  2074. }
  2075. }));
  2076. //}));
  2077. ////炒锅4状态数据
  2078. GetFryFourData("D0258", new Action<ushort[]>(data =>
  2079. {
  2080. try
  2081. {
  2082. if (data.Count() > 0)
  2083. FryPotMonitorManage.GetInstance.fryFour.Temperature = data[0] / 10.0;
  2084. }
  2085. catch (Exception)
  2086. {
  2087. //throw;
  2088. }
  2089. }));
  2090. GetFryFourData("D0510", new Action<ushort[]>(data =>
  2091. {
  2092. try
  2093. {
  2094. if (data.Count() > 0)
  2095. FryPotMonitorManage.GetInstance.fryFour.SmallFire = data[0];
  2096. }
  2097. catch (Exception)
  2098. {
  2099. // throw;
  2100. }
  2101. }));
  2102. GetFryFourData("D0512", new Action<ushort[]>(data =>
  2103. {
  2104. try
  2105. {
  2106. if (data.Count() > 0)
  2107. FryPotMonitorManage.GetInstance.fryFour.MidFire = data[0];
  2108. }
  2109. catch (Exception)
  2110. {
  2111. //throw;
  2112. }
  2113. }));
  2114. GetFryFourData("D0514", new Action<ushort[]>(data =>
  2115. {
  2116. try
  2117. {
  2118. if (data.Count() > 0)
  2119. FryPotMonitorManage.GetInstance.fryFour.BigFire = data[0];
  2120. }
  2121. catch (Exception)
  2122. {
  2123. //throw;
  2124. }
  2125. }));
  2126. GetFryFourData("D0516", new Action<ushort[]>(data =>
  2127. {
  2128. try
  2129. {
  2130. if (data.Count() > 0)
  2131. FryPotMonitorManage.GetInstance.fryFour.StrongFire = data[0];
  2132. }
  2133. catch (Exception)
  2134. {
  2135. // throw;
  2136. }
  2137. }));
  2138. GetFryFourData("D2500", new Action<ushort[]>(data =>
  2139. {
  2140. try
  2141. {
  2142. if (data.Count() > 0)
  2143. FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0;
  2144. }
  2145. catch (Exception)
  2146. {
  2147. // throw;
  2148. }
  2149. }));
  2150. GetFryFourData("D0600", new Action<ushort[]>(data =>
  2151. {
  2152. try
  2153. {
  2154. if (data.Count() > 0)
  2155. FryPotMonitorManage.GetInstance.fryFour.FryPotWeight = data[0] / 10.0;
  2156. }
  2157. catch (Exception)
  2158. {
  2159. //throw;
  2160. }
  2161. }));
  2162. GetFryFourData("D3000", new Action<ushort[]>(data =>
  2163. {
  2164. try
  2165. {
  2166. if (data.Count() > 0)
  2167. {
  2168. FryPotMonitorManage.GetInstance.fryFour.Step = data[0];
  2169. globalVar.fryPotFour.ProcessStep = data[0];
  2170. }
  2171. }
  2172. catch (Exception)
  2173. {
  2174. //throw;
  2175. }
  2176. }));
  2177. GetFryFourData("D3304", new Action<ushort[]>(data =>
  2178. {
  2179. try
  2180. {
  2181. if(data.Count()>0)
  2182. globalVar.fryPotFour.RecipeCompleteSingle = data[0];
  2183. }
  2184. catch (Exception)
  2185. {
  2186. //throw;
  2187. }
  2188. }));
  2189. //}));
  2190. ////炒锅5状态数据
  2191. GetFryFiveData("D0258", new Action<ushort[]>(data =>
  2192. {
  2193. try
  2194. {
  2195. if (data.Count() > 0)
  2196. FryPotMonitorManage.GetInstance.fryFive.Temperature = data[0] / 10.0;
  2197. }
  2198. catch (Exception)
  2199. {
  2200. //throw;
  2201. }
  2202. }));
  2203. GetFryFiveData("D0510", new Action<ushort[]>(data =>
  2204. {
  2205. try
  2206. {
  2207. if (data.Count() > 0)
  2208. FryPotMonitorManage.GetInstance.fryFive.SmallFire = data[0];
  2209. }
  2210. catch (Exception)
  2211. {
  2212. // throw;
  2213. }
  2214. }));
  2215. GetFryFiveData("D0512", new Action<ushort[]>(data =>
  2216. {
  2217. try
  2218. {
  2219. if (data.Count() > 0)
  2220. FryPotMonitorManage.GetInstance.fryFive.MidFire = data[0];
  2221. }
  2222. catch (Exception)
  2223. {
  2224. //throw;
  2225. }
  2226. }));
  2227. GetFryFiveData("D0514", new Action<ushort[]>(data =>
  2228. {
  2229. try
  2230. {
  2231. if (data.Count() > 0)
  2232. FryPotMonitorManage.GetInstance.fryFive.BigFire = data[0];
  2233. }
  2234. catch (Exception)
  2235. {
  2236. //throw;
  2237. }
  2238. }));
  2239. GetFryFiveData("D0516", new Action<ushort[]>(data =>
  2240. {
  2241. try
  2242. {
  2243. if (data.Count() > 0)
  2244. FryPotMonitorManage.GetInstance.fryFive.StrongFire = data[0];
  2245. }
  2246. catch (Exception)
  2247. {
  2248. //throw;
  2249. }
  2250. }));
  2251. GetFryFiveData("D2500", new Action<ushort[]>(data =>
  2252. {
  2253. try
  2254. {
  2255. if (data.Count() > 0)
  2256. FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0;
  2257. }
  2258. catch (Exception)
  2259. {
  2260. // throw;
  2261. }
  2262. }));
  2263. GetFryFiveData("D0600", new Action<ushort[]>(data =>
  2264. {
  2265. try
  2266. {
  2267. if (data.Count() > 0)
  2268. FryPotMonitorManage.GetInstance.fryFive.FryPotWeight = data[0] / 10.0;
  2269. }
  2270. catch (Exception)
  2271. {
  2272. //throw;
  2273. }
  2274. }));
  2275. GetFryFiveData("D3000", new Action<ushort[]>(data =>
  2276. {
  2277. try
  2278. {
  2279. if (data.Count() > 0)
  2280. {
  2281. FryPotMonitorManage.GetInstance.fryFive.Step = data[0];
  2282. globalVar.fryPotFive.ProcessStep = data[0];
  2283. }
  2284. }
  2285. catch (Exception)
  2286. {
  2287. // throw;
  2288. }
  2289. }));
  2290. GetFryFiveData("D3305", new Action<ushort[]>(data =>
  2291. {
  2292. try
  2293. {
  2294. if (data.Count() > 0)
  2295. globalVar.fryPotFive.RecipeCompleteSingle = data[0];
  2296. }
  2297. catch (Exception)
  2298. {
  2299. //throw;
  2300. }
  2301. }));
  2302. //}));
  2303. //线体上放空桶
  2304. if (globalVar.rollerLineOne.EmptyRollerNum != 0)
  2305. {
  2306. if (RollerNum.Contains(globalVar.rollerLineOne.EmptyRollerNum))
  2307. {
  2308. if (!globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.EmptyRollerNum))
  2309. {
  2310. globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
  2311. ++globalVar.LOneMaterialNum;
  2312. }
  2313. }
  2314. //是否手动复位PLC
  2315. }
  2316. if (globalVar.rollerLineTwo.EmptyRollerNum != 0)
  2317. {
  2318. if (RollerNum.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
  2319. {
  2320. if (!globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.EmptyRollerNum))
  2321. {
  2322. globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum);
  2323. ++globalVar.LTwoMaterialNum;
  2324. }
  2325. }
  2326. //是否手动复位PLC
  2327. }
  2328. if (globalVar.rollerLineThree.EmptyRollerNum != 0)
  2329. {
  2330. if (RollerNum.Contains(globalVar.rollerLineThree.EmptyRollerNum))
  2331. {
  2332. if (!globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.EmptyRollerNum))
  2333. {
  2334. globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
  2335. ++globalVar.LThreeMaterialNum;
  2336. }
  2337. }
  2338. //是否手动复位PLC
  2339. }
  2340. ////炒锅状态数据
  2341. //if (globalVar.fryPotOne.OilConfirm == 1)
  2342. //{
  2343. // FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
  2344. // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
  2345. //}
  2346. //if (globalVar.fryPotTwo.OilConfirm == 1)
  2347. //{
  2348. // FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
  2349. // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
  2350. //}
  2351. //if (globalVar.fryPotThree.OilConfirm == 1)
  2352. //{
  2353. // FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
  2354. // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
  2355. //}
  2356. //if (globalVar.fryPotFour.OilConfirm == 1)
  2357. //{
  2358. // FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
  2359. // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
  2360. //}
  2361. //if (globalVar.fryPotFive.OilConfirm == 1)
  2362. //{
  2363. // FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
  2364. // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
  2365. //}
  2366. //炒锅状态实时显示
  2367. FryPotStatusDisplay();
  2368. RollerLineStatusDisplay();
  2369. Thread.Sleep(10);
  2370. }), "MainViewReadPlcData");
  2371. }
  2372. /// <summary>
  2373. /// 炒锅状态实时显示
  2374. /// </summary>
  2375. private void FryPotStatusDisplay()
  2376. {
  2377. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
  2378. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.SmallFire.ToString();
  2379. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.MidFire.ToString();
  2380. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.BigFire.ToString();
  2381. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.StrongFire.ToString();
  2382. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
  2383. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
  2384. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Step.ToString();
  2385. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
  2386. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
  2387. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();
  2388. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
  2389. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.SmallFire.ToString();
  2390. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.MidFire.ToString();
  2391. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.BigFire.ToString();
  2392. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.StrongFire.ToString();
  2393. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
  2394. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
  2395. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Step.ToString();
  2396. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
  2397. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
  2398. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();
  2399. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
  2400. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.SmallFire.ToString();
  2401. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.MidFire.ToString();
  2402. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.BigFire.ToString();
  2403. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.StrongFire.ToString();
  2404. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
  2405. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
  2406. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Step.ToString();
  2407. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
  2408. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
  2409. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();
  2410. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
  2411. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.SmallFire.ToString();
  2412. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.MidFire.ToString();
  2413. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.BigFire.ToString();
  2414. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.StrongFire.ToString();
  2415. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
  2416. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
  2417. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Step.ToString();
  2418. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
  2419. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
  2420. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();
  2421. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
  2422. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.SmallFire.ToString();
  2423. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.MidFire.ToString();
  2424. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.BigFire.ToString();
  2425. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.StrongFire.ToString();
  2426. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
  2427. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
  2428. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Step.ToString();
  2429. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
  2430. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
  2431. FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();
  2432. //FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
  2433. //FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
  2434. //FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
  2435. //FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
  2436. //FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
  2437. //FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
  2438. //FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
  2439. }
  2440. /// <summary>
  2441. /// 炒锅状态数据保存到二进制文件
  2442. /// </summary>
  2443. public void FryPotDataSaveToBinaryFile()
  2444. {
  2445. #region 炒锅1状态数据保存
  2446. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据"))
  2447. {
  2448. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
  2449. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  2450. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  2451. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  2452. {
  2453. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2454. {
  2455. writeStream.Position = writeStream.Length;
  2456. PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, 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") };
  2457. BinaryFormatter bf = new BinaryFormatter();
  2458. bf.Serialize(writeStream, p1);
  2459. }
  2460. }
  2461. }
  2462. else
  2463. {
  2464. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
  2465. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
  2466. if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
  2467. {
  2468. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2469. {
  2470. writeStream.Position = writeStream.Length;
  2471. PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, 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") };
  2472. BinaryFormatter bf = new BinaryFormatter();
  2473. bf.Serialize(writeStream, p1);
  2474. }
  2475. }
  2476. }
  2477. #endregion
  2478. #region 炒锅2状态数据保存
  2479. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据"))
  2480. {
  2481. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
  2482. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  2483. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  2484. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  2485. {
  2486. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2487. {
  2488. writeStream.Position = writeStream.Length;
  2489. PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, 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") };
  2490. BinaryFormatter bf = new BinaryFormatter();
  2491. bf.Serialize(writeStream, p1);
  2492. }
  2493. }
  2494. }
  2495. else
  2496. {
  2497. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
  2498. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
  2499. if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
  2500. {
  2501. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2502. {
  2503. writeStream.Position = writeStream.Length;
  2504. PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, 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") };
  2505. BinaryFormatter bf = new BinaryFormatter();
  2506. bf.Serialize(writeStream, p1);
  2507. }
  2508. }
  2509. }
  2510. #endregion
  2511. #region 炒锅3状态数据保存
  2512. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据"))
  2513. {
  2514. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
  2515. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  2516. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  2517. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  2518. {
  2519. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2520. {
  2521. writeStream.Position = writeStream.Length;
  2522. PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, 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") };
  2523. BinaryFormatter bf = new BinaryFormatter();
  2524. bf.Serialize(writeStream, p1);
  2525. }
  2526. }
  2527. }
  2528. else
  2529. {
  2530. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
  2531. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
  2532. if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
  2533. {
  2534. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2535. {
  2536. writeStream.Position = writeStream.Length;
  2537. PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, 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") };
  2538. BinaryFormatter bf = new BinaryFormatter();
  2539. bf.Serialize(writeStream, p1);
  2540. }
  2541. }
  2542. }
  2543. #endregion
  2544. #region 炒锅4状态数据保存
  2545. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据"))
  2546. {
  2547. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
  2548. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  2549. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  2550. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  2551. {
  2552. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2553. {
  2554. writeStream.Position = writeStream.Length;
  2555. PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire, 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") };
  2556. BinaryFormatter bf = new BinaryFormatter();
  2557. bf.Serialize(writeStream, p1);
  2558. }
  2559. }
  2560. }
  2561. else
  2562. {
  2563. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
  2564. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
  2565. if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
  2566. {
  2567. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2568. {
  2569. writeStream.Position = writeStream.Length;
  2570. PotFourStatus p1 = new PotFourStatus
  2571. {
  2572. Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature,
  2573. SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire,
  2574. MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire,
  2575. BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire,
  2576. StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire,
  2577. Speed = FryPotMonitorManage.GetInstance.fryFour.Speed,
  2578. FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight,
  2579. OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity,
  2580. TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy,
  2581. TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct,
  2582. RecipeName = fryFourRecipe,
  2583. Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm")
  2584. };
  2585. BinaryFormatter bf = new BinaryFormatter();
  2586. bf.Serialize(writeStream, p1);
  2587. }
  2588. }
  2589. }
  2590. #endregion
  2591. #region 炒锅5状态数据保存
  2592. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据"))
  2593. {
  2594. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
  2595. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  2596. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  2597. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  2598. {
  2599. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2600. {
  2601. writeStream.Position = writeStream.Length;
  2602. PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, 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") };
  2603. BinaryFormatter bf = new BinaryFormatter();
  2604. bf.Serialize(writeStream, p1);
  2605. }
  2606. }
  2607. }
  2608. else
  2609. {
  2610. if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
  2611. Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
  2612. if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
  2613. {
  2614. using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
  2615. {
  2616. writeStream.Position = writeStream.Length;
  2617. PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, 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") };
  2618. BinaryFormatter bf = new BinaryFormatter();
  2619. bf.Serialize(writeStream, p1);
  2620. }
  2621. }
  2622. }
  2623. #endregion
  2624. }
  2625. /// <summary>
  2626. /// 滚筒线运行状态显示
  2627. /// </summary>
  2628. private void RollerLineStatusDisplay()
  2629. {
  2630. hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
  2631. hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
  2632. hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
  2633. hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
  2634. hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
  2635. hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
  2636. hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
  2637. hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
  2638. if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
  2639. {
  2640. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  2641. }
  2642. else
  2643. {
  2644. hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  2645. }
  2646. if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
  2647. {
  2648. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  2649. }
  2650. else
  2651. {
  2652. hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  2653. }
  2654. hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
  2655. hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
  2656. hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
  2657. hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
  2658. hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
  2659. hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
  2660. hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
  2661. hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
  2662. if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)
  2663. {
  2664. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  2665. }
  2666. else
  2667. {
  2668. hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  2669. }
  2670. if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
  2671. {
  2672. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  2673. }
  2674. else
  2675. {
  2676. hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  2677. }
  2678. hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
  2679. hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
  2680. hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
  2681. hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
  2682. hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
  2683. hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
  2684. hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
  2685. hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
  2686. if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)
  2687. {
  2688. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
  2689. }
  2690. else
  2691. {
  2692. hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
  2693. }
  2694. if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
  2695. {
  2696. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
  2697. }
  2698. else
  2699. {
  2700. hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
  2701. }
  2702. //滚筒线4
  2703. }
  2704. /// <summary>
  2705. /// 返回滚筒线PLC指定地址指定长度的数据
  2706. /// </summary>
  2707. /// <param name="address"></param>
  2708. /// <returns></returns>
  2709. public void GetAddressData(string address, Action<ushort[]> action)
  2710. {
  2711. PlcReadData = DeviceOperate.GetInstance.GetAllData();
  2712. if (PlcReadData.ContainsKey(address))
  2713. {
  2714. action((ushort[])(PlcReadData[address]));
  2715. }
  2716. }
  2717. public void GetFryOneData(string address, Action<ushort[]> action)
  2718. {
  2719. FryOneData = DeviceOperate.GetInstance.GetFryOneData();
  2720. if (FryOneData.ContainsKey(address))
  2721. {
  2722. action((ushort[])(FryOneData[address]));
  2723. }
  2724. }
  2725. public void GetFryTwoData(string address, Action<ushort[]> action)
  2726. {
  2727. FryTwoData = DeviceOperate.GetInstance.GetFryTwoData();
  2728. if (FryTwoData.ContainsKey(address))
  2729. {
  2730. action((ushort[])(FryTwoData[address]));
  2731. }
  2732. }
  2733. public void GetFryThreeData(string address, Action<ushort[]> action)
  2734. {
  2735. FryThreeData = DeviceOperate.GetInstance.GetFryThreeData();
  2736. if (FryThreeData.ContainsKey(address))
  2737. {
  2738. action((ushort[])(FryThreeData[address]));
  2739. }
  2740. }
  2741. public void GetFryFourData(string address, Action<ushort[]> action)
  2742. {
  2743. FryFourData = DeviceOperate.GetInstance.GetFryFourData();
  2744. if (FryFourData.ContainsKey(address))
  2745. {
  2746. action((ushort[])(FryFourData[address]));
  2747. }
  2748. }
  2749. public void GetFryFiveData(string address, Action<ushort[]> action)
  2750. {
  2751. FryFiveData = DeviceOperate.GetInstance.GetFryFiveData();
  2752. if (FryFiveData.ContainsKey(address))
  2753. {
  2754. action((ushort[])(FryFiveData[address]));
  2755. }
  2756. }
  2757. /// <summary>
  2758. /// 滚筒线写Plc数据
  2759. /// </summary>
  2760. /// <param name="address"></param>
  2761. /// <param name="Value"></param>
  2762. public void WritePlcData(string address, ushort Value)
  2763. {
  2764. DeviceOperate.GetInstance.WritePlcData(address, Value);
  2765. }
  2766. /// <summary>
  2767. /// 炒锅写Plc数据
  2768. /// </summary>
  2769. /// <param name="potNum"></param>
  2770. /// <param name="address"></param>
  2771. /// <param name="value"></param>
  2772. public void WritePotData(int potNum, string address, ushort value)
  2773. {
  2774. switch (potNum)
  2775. {
  2776. case 1: DeviceOperate.GetInstance.WritePotOnePlcData(address, value); break;
  2777. case 2: DeviceOperate.GetInstance.WritePotTwoPlcData(address, value); break;
  2778. case 3: DeviceOperate.GetInstance.WritePotThreePlcData(address, value); break;
  2779. case 4: DeviceOperate.GetInstance.WritePotFourPlcData(address, value); break;
  2780. case 5: DeviceOperate.GetInstance.WritePotFivePlcData(address, value); break;
  2781. }
  2782. }
  2783. /// <summary>
  2784. /// 炒锅写float类型Plc数据
  2785. /// </summary>
  2786. public void WritePotRealData(int potNum, string address, float value)
  2787. {
  2788. switch (potNum)
  2789. {
  2790. case 1: DeviceOperate.GetInstance.WritePotOneRealPlcData(address, value); break;
  2791. case 2: DeviceOperate.GetInstance.WritePotTwoRealPlcData(address, value); break;
  2792. case 3: DeviceOperate.GetInstance.WritePotThreeRealPlcData(address, value); break;
  2793. case 4: DeviceOperate.GetInstance.WritePotFourRealPlcData(address, value); break;
  2794. case 5: DeviceOperate.GetInstance.WritePotFiveRealPlcData(address, value); break;
  2795. }
  2796. }
  2797. /// <summary>
  2798. /// 配方数据接收
  2799. /// </summary>
  2800. public void RecipeDataParse(object obj)
  2801. {
  2802. Task.Run(new Action(() =>
  2803. {
  2804. if (obj != null && obj is NewRecipeModel[] recipes)
  2805. {
  2806. ReicpeNum = ReicpeNum + recipes.Length;
  2807. MessageNotify.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
  2808. for (int i = 0; i < recipes.Length; i++)
  2809. {
  2810. int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100;
  2811. if (res != null)
  2812. {
  2813. switch (res)
  2814. {
  2815. case 1:
  2816. case 4: RecipeQuene.Enqueue(recipes[i]); break;
  2817. case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break;
  2818. case 2:
  2819. case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break;
  2820. }
  2821. }
  2822. }
  2823. }
  2824. }));
  2825. }
  2826. /// <summary>
  2827. /// 开启主任务
  2828. /// </summary>
  2829. public void MainTask()
  2830. {
  2831. ////RecipeDataToPlc();
  2832. //LOneRecipeDataToPlc();
  2833. //LTwoRecipeDataToPlc();
  2834. //LThreeRecipeDataToPlc();
  2835. ////AgvLoadRoller();
  2836. //LOneLoadRoller();
  2837. //LTwoAgvLoadRoller();
  2838. //LThreeAgvLoadRoller();
  2839. //// FryPotInputMaterial();
  2840. //LOneFryPotInputMaterial();
  2841. //LTwoFryPotInputMaterial();
  2842. //LThreeFryPotInputMaterial();
  2843. ////FryPotOutputMaterial();
  2844. //LOneFryPotOutputMaterial();
  2845. //LTwoFryPotOutputMaterial();
  2846. //LThreeFryPotOutputMaterial();
  2847. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
  2848. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
  2849. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
  2850. ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程");
  2851. ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程");
  2852. ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程");
  2853. ThreadManage.GetInstance().StartLong(new Action(() => { ToLineFourFromCleanPlate(); Thread.Sleep(10); }), "清洗台空桶回桶任务线程");
  2854. ThreadManage.GetInstance().StartLong(new Action(() => { EmptyRollerToLinFourFromPot(); Thread.Sleep(10); }), "炒锅空桶回桶任务线程");
  2855. }
  2856. /// <summary>
  2857. /// 线体1的执行流程
  2858. /// </summary>
  2859. public void LineOneProcessExecute()
  2860. {
  2861. LOneFryPotStepDisplay();
  2862. LOneRecipeDataToPlc();
  2863. LineOneRecipeExecuteConfirm();
  2864. LOneLoadRoller();
  2865. LOneFryPotInputMaterial();
  2866. LOneFallMaterial();
  2867. LOneFryPotOutputMaterial();
  2868. LOneEmptyOperate();
  2869. // globalVar.LOneTaskLock = false;
  2870. //}
  2871. }
  2872. /// <summary>
  2873. /// 线体2的执行流程
  2874. /// </summary>
  2875. public void LineTwoProcessExecute()
  2876. {
  2877. LTwoFryPotStepDisplay();
  2878. LTwoRecipeDataToPlc();
  2879. LineTwoRecipeExecuteConfirm();
  2880. LTwoAgvLoadRoller();
  2881. LTwoFryPotInputMaterial();
  2882. LTwoFallMaterial();
  2883. LTwoFryPotOutputMaterial();
  2884. LTwoEmptyOperate();
  2885. // globalVar.LTwoTaskLock = false;
  2886. //}
  2887. }
  2888. /// <summary>
  2889. /// 线体3的执行流程
  2890. /// </summary>
  2891. public void LineThreeProcessExecute()
  2892. {
  2893. LThreeFryPotStepDisplay();
  2894. LThreeRecipeDataToPlc();
  2895. LineThreeRecipeExecuteConfirm();
  2896. LThreeAgvLoadRoller();
  2897. LThreeFryPotInputMaterial();
  2898. LThreeFallMaterial();
  2899. LThreeFryPotOutputMaterial();
  2900. LThreeEmptyOperate();
  2901. // globalVar.LThreeTaskLock = false;
  2902. //}
  2903. }
  2904. private void LineOneToCleanProcessExecute()
  2905. {
  2906. //线体1到清洗台
  2907. AgvFromLineOneToCleanPlate();
  2908. AgvArriveCleanPlateFromLineOne();
  2909. }
  2910. public void LineTwoToCleanProcessExecute()
  2911. {
  2912. //线体2到清洗台
  2913. AgvFromLineTwoToCleanPlate();
  2914. AgvArriveCleanPlateFromLineTwo();
  2915. }
  2916. public void LineThreeToCleanProcessExecute()
  2917. {
  2918. //线体3到清洗台
  2919. AgvFromLineThreeToCleanPlate();
  2920. AgvArriveCleanPlateFromLineThree();
  2921. }
  2922. private void ToLineFourFromCleanPlate()
  2923. {
  2924. //空桶到线体4
  2925. CallAgvToLineFour();
  2926. CleanPlateUpLoad();
  2927. EmptyRollerToLinFourFromClean();
  2928. }
  2929. private void CleanPlateUpLoad()
  2930. {
  2931. if (globalVar.agvArriveCleanLoad)
  2932. {
  2933. globalVar.agvArriveCleanLoad = false;
  2934. MessageNotify.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置");
  2935. //plc交互
  2936. WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
  2937. //erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 0)
  2938. // {
  2939. // //plc交互
  2940. // WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
  2941. // }
  2942. // else//有故障
  2943. // {
  2944. // while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 1)
  2945. // {
  2946. // Thread.Sleep(1000);
  2947. // if (globalVar.ExitLineOneTask)
  2948. // return;
  2949. // }
  2950. // MessageNotify.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!");
  2951. // goto erp;
  2952. // }
  2953. }
  2954. }
  2955. /// <summary>
  2956. /// 线体1到清洗台
  2957. /// </summary>
  2958. private void AgvFromLineOneToCleanPlate()
  2959. {
  2960. if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
  2961. {
  2962. if (TTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
  2963. {
  2964. MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为普通洗桶模式");
  2965. }
  2966. if (globalVar.rollerLineOne.WashEmptyRollerModel == 0)
  2967. {
  2968. try
  2969. {
  2970. lock (Obj_Lock)
  2971. {
  2972. //线体1到清洗台
  2973. if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineOne.EmptyRollerNums.Count > 0)
  2974. {
  2975. var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  2976. if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶
  2977. {
  2978. LOneCurrentRollerNum = globalVar.rollerLineOne.StationEight;
  2979. //下发AGV去空桶线洗桶任务
  2980. e: string id = Guid.NewGuid().ToString("D");
  2981. 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)
  2982. goto e;
  2983. string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  2984. LSevenrobotJobId.Add(id);
  2985. // Thread.Sleep(500);
  2986. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
  2987. {
  2988. WritePlcData("D1250", LOneCurrentRollerNum);//下发空桶桶号到洗桶机
  2989. globalVar.rollerLineOne.IsEpmtyBefore = true;
  2990. globalVar.AllowNextEmptyRollerToClean = false;
  2991. }
  2992. else
  2993. {
  2994. LSevenrobotJobId.Remove(id);
  2995. Thread.Sleep(5000);
  2996. }
  2997. }
  2998. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  2999. }
  3000. else
  3001. {
  3002. AgvFromLineOneToClean(LOneCurrentRollerNum);//AGV从线体1到清洗处
  3003. }
  3004. }
  3005. }
  3006. catch (Exception)
  3007. {
  3008. // throw;
  3009. }
  3010. }
  3011. else //统一洗桶模式
  3012. {
  3013. if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel)))
  3014. MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为统一洗桶模式");
  3015. lock (Obj_Lock)
  3016. {
  3017. if (globalVar.rollerLineOne.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
  3018. {
  3019. //下发AGV去空桶线洗桶任务
  3020. e: string id = Guid.NewGuid().ToString("D");
  3021. 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)
  3022. goto e;
  3023. string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  3024. LSevenrobotJobId.Add(id);
  3025. // Thread.Sleep(500);
  3026. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功
  3027. {
  3028. globalVar.AllowNextEmptyRollerToClean = false;
  3029. }
  3030. else
  3031. {
  3032. LSevenrobotJobId.Remove(id);
  3033. Thread.Sleep(5000);
  3034. }
  3035. }
  3036. else
  3037. {
  3038. AgvFromLineOneToClean();//AGV从线体1到清洗处
  3039. }
  3040. }
  3041. }
  3042. }
  3043. }
  3044. /// <summary>
  3045. /// 线体2到清洗台
  3046. /// </summary>
  3047. private void AgvFromLineTwoToCleanPlate()
  3048. {
  3049. // 线体2到清洗台
  3050. if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
  3051. {
  3052. if (TTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
  3053. {
  3054. MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为普通洗桶模式");
  3055. }
  3056. if (globalVar.rollerLineTwo.WashEmptyRollerModel == 0)
  3057. {
  3058. try
  3059. {
  3060. lock (Obj_Lock)
  3061. {
  3062. if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0)
  3063. {
  3064. var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  3065. if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶
  3066. {
  3067. LTwoCurrentRollerNum = globalVar.rollerLineTwo.StationEight;
  3068. //下发AGV去空桶线洗桶任务
  3069. e: string id = Guid.NewGuid().ToString("D");
  3070. 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)
  3071. goto e;
  3072. string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  3073. LEightrobotJobId.Add(id);
  3074. //Thread.Sleep(500);
  3075. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
  3076. {
  3077. WritePlcData("D1250", LTwoCurrentRollerNum);//下发空桶桶号到洗桶机
  3078. globalVar.rollerLineTwo.IsEpmtyBefore = true;
  3079. globalVar.AllowNextEmptyRollerToClean = false;
  3080. }
  3081. else
  3082. {
  3083. LEightrobotJobId.Remove(id);
  3084. Thread.Sleep(5000);
  3085. }
  3086. //AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  3087. }
  3088. }
  3089. else
  3090. {
  3091. AgvFromLineTwoToClean(LTwoCurrentRollerNum);//AGV从线体1到清洗处
  3092. }
  3093. }
  3094. }
  3095. catch (Exception)
  3096. {
  3097. // throw;
  3098. }
  3099. }
  3100. else
  3101. {
  3102. if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel)))
  3103. MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为统一洗桶模式");
  3104. lock (Obj_Lock)
  3105. {
  3106. if (globalVar.rollerLineTwo.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
  3107. {
  3108. //下发AGV去空桶线洗桶任务
  3109. e: string id = Guid.NewGuid().ToString("D");
  3110. 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)
  3111. goto e;
  3112. string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  3113. LEightrobotJobId.Add(id);
  3114. //Thread.Sleep(500);
  3115. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2))
  3116. {
  3117. globalVar.AllowNextEmptyRollerToClean = false;
  3118. }
  3119. else
  3120. {
  3121. LEightrobotJobId.Remove(id);
  3122. Thread.Sleep(5000);
  3123. }
  3124. }
  3125. else
  3126. {
  3127. AgvFromLineTwoToClean();//AGV从线体1到清洗处
  3128. }
  3129. }
  3130. }
  3131. }
  3132. }
  3133. /// <summary>
  3134. /// 线体3到清洗台
  3135. /// </summary>
  3136. private void AgvFromLineThreeToCleanPlate()
  3137. {
  3138. //线体3到清洗台
  3139. if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
  3140. {
  3141. if (TTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
  3142. {
  3143. MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为普通洗桶模式");
  3144. }
  3145. if (globalVar.rollerLineThree.WashEmptyRollerModel == 0)
  3146. {
  3147. try
  3148. {
  3149. lock (Obj_Lock)
  3150. {
  3151. if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineThree.EmptyRollerNums.Count > 0)
  3152. {
  3153. var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  3154. if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶
  3155. {
  3156. LThreeCurrentRollerNum = globalVar.rollerLineThree.StationEight;
  3157. //下发AGV去空桶线洗桶任务
  3158. e: string id = Guid.NewGuid().ToString("D");
  3159. 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)
  3160. goto e;
  3161. string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  3162. LNinerobotJobId.Add(id);
  3163. //Thread.Sleep(500);
  3164. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
  3165. {
  3166. WritePlcData("D1250", LThreeCurrentRollerNum);//下发空桶桶号到洗桶机
  3167. globalVar.rollerLineThree.IsEpmtyBefore = true;
  3168. globalVar.AllowNextEmptyRollerToClean = false;
  3169. }
  3170. else//呼叫失败
  3171. {
  3172. LNinerobotJobId.Remove(id);
  3173. Thread.Sleep(5000);
  3174. }
  3175. //AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  3176. }
  3177. }
  3178. else
  3179. {
  3180. AgvFromLineThreeToClean(LThreeCurrentRollerNum);//AGV从线体3到清洗处
  3181. }
  3182. }
  3183. }
  3184. catch (Exception)
  3185. {
  3186. // throw;
  3187. }
  3188. }
  3189. else
  3190. {
  3191. if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel)))
  3192. MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为统一洗桶模式");
  3193. lock (Obj_Lock)
  3194. {
  3195. if (globalVar.rollerLineThree.WashRollerArriveSignal == 1 && globalVar.AllowNextEmptyRollerToClean)//1号线空桶洗桶就位
  3196. {
  3197. //下发AGV去空桶线洗桶任务
  3198. e: string id = Guid.NewGuid().ToString("D");
  3199. 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)
  3200. goto e;
  3201. string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  3202. LNinerobotJobId.Add(id);
  3203. //Thread.Sleep(500);
  3204. if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功
  3205. {
  3206. globalVar.rollerLineThree.IsEpmtyBefore = true;
  3207. globalVar.AllowNextEmptyRollerToClean = false;
  3208. }
  3209. else//呼叫失败
  3210. {
  3211. LNinerobotJobId.Remove(id);
  3212. Thread.Sleep(5000);
  3213. }
  3214. }
  3215. else
  3216. {
  3217. AgvFromLineThreeToClean();//AGV从线体3到清洗处
  3218. }
  3219. }
  3220. }
  3221. }
  3222. }
  3223. /// <summary>
  3224. /// AGV从线体1到达清洗台下料位置
  3225. /// </summary>
  3226. private void AgvArriveCleanPlateFromLineOne()
  3227. {
  3228. if (globalVar.rollerLineOne.agvArriveCleanUnLoad || globalVar.LineSevenRobotTaskError)
  3229. {
  3230. globalVar.rollerLineOne.agvArriveCleanUnLoad = false;
  3231. MessageNotify.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶");
  3232. erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
  3233. {
  3234. globalVar.LineSevenRobotTaskError = false;//AGV故障信号复位
  3235. //plc交互
  3236. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  3237. }
  3238. else//有故障
  3239. {
  3240. while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
  3241. {
  3242. Thread.Sleep(1000);
  3243. if (globalVar.ExitLineOneTask)
  3244. return;
  3245. }
  3246. MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  3247. goto erp;
  3248. }
  3249. }
  3250. }
  3251. /// <summary>
  3252. /// AGV从线体2到达清洗台下料位置
  3253. /// </summary>
  3254. private void AgvArriveCleanPlateFromLineTwo()
  3255. {
  3256. if (globalVar.rollerLineTwo.agvArriveCleanUnLoad || globalVar.LineEightRobotTaskError)
  3257. {
  3258. globalVar.rollerLineTwo.agvArriveCleanUnLoad = false;
  3259. MessageNotify.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶");
  3260. erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
  3261. {
  3262. globalVar.LineEightRobotTaskError = false;//AGV故障信号复位
  3263. //plc交互
  3264. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  3265. }
  3266. else//有故障
  3267. {
  3268. while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
  3269. {
  3270. Thread.Sleep(1000);
  3271. if (globalVar.ExitLineTwoTask)
  3272. return;
  3273. }
  3274. MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  3275. goto erp;
  3276. }
  3277. }
  3278. }
  3279. /// <summary>
  3280. /// AGV从线体3到达清洗台下料位置
  3281. /// </summary>
  3282. private void AgvArriveCleanPlateFromLineThree()
  3283. {
  3284. if (globalVar.rollerLineThree.agvArriveCleanUnLoad || globalVar.LineNineRobotTaskError)
  3285. {
  3286. globalVar.rollerLineThree.agvArriveCleanUnLoad = false;
  3287. MessageNotify.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶");
  3288. erp: if (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0)
  3289. {
  3290. globalVar.LineNineRobotTaskError = false;//AGV故障信号复位
  3291. //plc交互
  3292. WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  3293. }
  3294. else//有故障
  3295. {
  3296. while (AlarmHelper<AlarmInfo>.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1)
  3297. {
  3298. Thread.Sleep(1000);
  3299. if (globalVar.ExitLineThreeTask)
  3300. return;
  3301. }
  3302. MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!");
  3303. goto erp;
  3304. }
  3305. ////plc交互
  3306. //WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
  3307. //if (globalVar.CleadBarrelEnterSingle == 0)
  3308. //{
  3309. // MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!");
  3310. //}
  3311. }
  3312. }
  3313. /// <summary>
  3314. /// 呼叫Agv从清洗台运洗好的空桶到四号线体
  3315. /// </summary>
  3316. public void CallAgvToLineFour()
  3317. {
  3318. if (RTrig.GetInstance("呼叫AGV").Start(Convert.ToBoolean(globalVar.CleanComplete)))
  3319. {
  3320. globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志
  3321. e: string id = Guid.NewGuid().ToString("D");
  3322. 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)
  3323. goto e;
  3324. string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id);
  3325. LTenrobotJobId.Add(id);
  3326. //Thread.Sleep(500);
  3327. MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶");
  3328. if (!CleanToLineCarryTaskErrorCodeAnalysis(info, 4))
  3329. {
  3330. LTenrobotJobId.Remove(id);
  3331. MessageNotify.GetInstance.ShowRunLog("清洗台呼叫AGV取桶失败");
  3332. }
  3333. }
  3334. }
  3335. /// <summary>
  3336. /// 3号滚筒线数据下发 2022/7/4 新增
  3337. /// </summary>
  3338. /// <exception cref="NotImplementedException"></exception>
  3339. private void LThreeRecipeDataToPlc()
  3340. {
  3341. if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe)
  3342. {
  3343. globalVar.rollerLineThree.RecipeComMidSingle = 1;
  3344. if (globalVar.LThreeCurrentRecipeName != string.Empty)
  3345. {
  3346. MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方所有料桶已送达炒锅");
  3347. // ResetPotData(3);
  3348. WritePlcData("D2103", 0);
  3349. WritePlcData("D1103", 0);//复位开始执行指令
  3350. PlcLineThreeRecipeDataReset();
  3351. if (globalVar.LThreeFryPotSerial == 3)
  3352. {
  3353. FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
  3354. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
  3355. {
  3356. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  3357. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
  3358. }
  3359. //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() });//向表中新增数据
  3360. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  3361. }
  3362. globalVar.LThreeCurrentRecipeName = string.Empty;
  3363. // Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
  3364. }
  3365. }
  3366. if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle)))
  3367. {
  3368. ResetPotData(3);
  3369. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
  3370. ActionManage.GetInstance.Send("炒锅工艺流程更新", 3);
  3371. MessageNotify.GetInstance.ShowRunLog("炒锅3配方制作完成");
  3372. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
  3373. Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
  3374. }
  3375. if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.WashEmptyRollerModel == 0)//后续添加其它限制条件
  3376. {
  3377. if (globalVar.fryPotThree.RecipeCompleteSingle == 1 || globalVar.fryPotThree.ProcessStep == 0)
  3378. {
  3379. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
  3380. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
  3381. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
  3382. ResetPotData(3);
  3383. WritePlcData("D2103", 0);
  3384. WritePlcData("D1103", 0);//复位开始执行指令
  3385. //清空配方数据队列
  3386. PlcLineThreeRecipeDataReset();//PLC复位
  3387. Thread.Sleep(800);
  3388. if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
  3389. {
  3390. potThreeCurrentRecipe = result;
  3391. LThreeErrorRecipe = false;
  3392. int headNum = result.materialCollection[0].MaterialLoc / 100;
  3393. globalVar.LThreeMaterialNum = result.materialCollection.Count;
  3394. globalVar.LThreeFryPotSerial = headNum;
  3395. globalVar.LThreeCurrentRecipeName = result.RecipeName;
  3396. AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
  3397. MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
  3398. fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
  3399. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
  3400. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  3401. {
  3402. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
  3403. {
  3404. //将配方中原料加入新的队列
  3405. LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
  3406. {
  3407. materialType = result.materialCollection[i],
  3408. materialId = result.RecipeId
  3409. });
  3410. RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发
  3411. }
  3412. else
  3413. {
  3414. MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3415. MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3416. LThreeInputMaterialQuene.Clear();
  3417. LThreeRecipeQuene.Clear();
  3418. LThreeErrorRecipe = true;
  3419. return;
  3420. }
  3421. }
  3422. #region 炒股用油量记录
  3423. try
  3424. {
  3425. if (result.FlowProcess.fpModels.Count > 0)
  3426. {
  3427. FryPotMonitorManage.GetInstance.fryThree.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
  3428. FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryThree.OilCapacity;
  3429. FryPotRecipeSetDown(headNum, result);//炒锅工艺数据下发
  3430. }
  3431. else
  3432. {
  3433. MessageNotify.GetInstance.ShowUserLog($"3号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
  3434. LThreeRecipeQuene.Clear();
  3435. LThreeInputMaterialQuene.Clear();
  3436. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
  3437. return;
  3438. }
  3439. }
  3440. catch (Exception)
  3441. {
  3442. LThreeRecipeQuene.Clear();
  3443. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
  3444. return;
  3445. //throw;
  3446. }
  3447. #endregion
  3448. DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
  3449. // globalVar.rollerLineThree.RecipeComMidSingle = 0;
  3450. WritePlcData("D1103", 1);//配方开始执行命令
  3451. globalVar.rollerLineThree.LowSignalJude = true;
  3452. globalVar.LThreeCurrentCookingStep = 0;
  3453. PotThreestep = 0;
  3454. if (LThreeRecipeQuene.Count > 0)
  3455. LThreeRecipeQuene.Clear();
  3456. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
  3457. }
  3458. }
  3459. else
  3460. {
  3461. LThreeRecipeQuene.Clear();
  3462. MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线配方完成前禁止再次下发订单");
  3463. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线配方完成前禁止再次下发订单"); }));
  3464. }
  3465. }
  3466. else if (globalVar.rollerLineThree.WashEmptyRollerModel == 1 && LThreeRecipeQuene.Count > 0)
  3467. {
  3468. MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线处于集中洗桶模式,无法下发配方");
  3469. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线处于集中洗桶模式,无法下发配方"); }));
  3470. LThreeRecipeQuene.Clear();
  3471. }
  3472. else if(LThreeRecipeQuene.Count > 0)
  3473. {
  3474. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
  3475. LThreeRecipeQuene.Clear();
  3476. }
  3477. }
  3478. /// <summary>
  3479. /// 2号滚筒线数据下发 2022/7/4 新增
  3480. /// </summary>
  3481. /// <exception cref="NotImplementedException"></exception>
  3482. private void LTwoRecipeDataToPlc()
  3483. {
  3484. if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe)
  3485. {
  3486. globalVar.rollerLineTwo.RecipeComMidSingle = 1;
  3487. if (globalVar.LTwoCurrentRecipeName != string.Empty)
  3488. {
  3489. MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方所有料桶已送达炒锅");
  3490. // ResetPotData(globalVar.LTwoFryPotSerial);
  3491. WritePlcData("D2102", 0);
  3492. WritePlcData("D1102", 0);//复位开始执行指令
  3493. PlcLineTwoRecipeDataReset();
  3494. if (globalVar.LTwoFryPotSerial == 2)
  3495. {
  3496. FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
  3497. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
  3498. {
  3499. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  3500. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
  3501. }
  3502. //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() });//向表中新增数据
  3503. //Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  3504. }
  3505. if (globalVar.LTwoFryPotSerial == 5)
  3506. {
  3507. FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
  3508. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
  3509. {
  3510. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  3511. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
  3512. }
  3513. //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() });//向表中新增数据
  3514. //Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  3515. }
  3516. globalVar.LTwoCurrentRecipeName = string.Empty;
  3517. // Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
  3518. }
  3519. }
  3520. if (RTrig.GetInstance("炒锅2配方完成").Start(Convert.ToBoolean(globalVar.fryPotTwo.RecipeCompleteSingle)))
  3521. {
  3522. ResetPotData(2);
  3523. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
  3524. ActionManage.GetInstance.Send("炒锅工艺流程更新", 2);
  3525. MessageNotify.GetInstance.ShowRunLog("炒锅2配方制作完成");
  3526. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  3527. Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; });
  3528. }
  3529. if (RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle)))
  3530. {
  3531. ResetPotData(5);
  3532. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
  3533. ActionManage.GetInstance.Send("炒锅工艺流程更新", 5);
  3534. MessageNotify.GetInstance.ShowRunLog("炒锅5配方制作完成");
  3535. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  3536. Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; });
  3537. }
  3538. if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.WashEmptyRollerModel == 0)//后续添加其它限制条件
  3539. {
  3540. if ((LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 2 && globalVar.fryPotTwo.RecipeCompleteSingle == 1) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 5 && globalVar.fryPotFive.RecipeCompleteSingle == 1) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 2 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotTwo.ProcessStep == 0) || (globalVar.LTwoFryPotSerial == 0 && globalVar.fryPotTwo.ProcessStep == 0 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 2 && globalVar.fryPotTwo.ProcessStep == 0))
  3541. {
  3542. if (globalVar.LTwoFryPotSerial == 2)
  3543. {
  3544. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; }));
  3545. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection<WorkflowModel>(); }));
  3546. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  3547. Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; });
  3548. }
  3549. if (globalVar.LTwoFryPotSerial == 5)
  3550. {
  3551. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; }));
  3552. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
  3553. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
  3554. Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; });
  3555. }
  3556. //if (globalVar.LTwoCurrentRecipeName != string.Empty)
  3557. // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
  3558. WritePlcData("D2102", 0);
  3559. WritePlcData("D1102", 0);//复位开始执行指令
  3560. //清空配方数据队列
  3561. PlcLineTwoRecipeDataReset();//PLC复位
  3562. if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
  3563. {
  3564. LTwoErrorRecipe = false;
  3565. int headNum = result.materialCollection[0].MaterialLoc / 100;
  3566. globalVar.LTwoMaterialNum = result.materialCollection.Count;
  3567. globalVar.LTwoFryPotSerial = headNum;
  3568. globalVar.LTwoCurrentRecipeName = result.RecipeName;
  3569. AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
  3570. MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
  3571. if (headNum == 2)//炒锅2
  3572. {
  3573. potTwoCurrentRecipe = result;
  3574. globalVar.LTwoCurrentCookingStep = 0;
  3575. PotTwostep = 0;
  3576. fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
  3577. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
  3578. }
  3579. else//炒锅5
  3580. {
  3581. potFiveCurrentRecipe = result;
  3582. PotFivestep = 0;
  3583. globalVar.LFiveCurrentCookingStep = 0;
  3584. fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
  3585. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
  3586. }
  3587. ResetPotData(globalVar.LTwoFryPotSerial);
  3588. Thread.Sleep(800);
  3589. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  3590. {
  3591. if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5))
  3592. {
  3593. //将配方中原料加入新的队列
  3594. LTwoInputMaterialQuene.Enqueue(new MaterialInfo()
  3595. {
  3596. materialType = result.materialCollection[i],
  3597. materialId = result.RecipeId
  3598. });
  3599. RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发
  3600. }
  3601. else
  3602. {
  3603. MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3604. MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3605. LTwoInputMaterialQuene.Clear();
  3606. LTwoRecipeQuene.Clear();
  3607. LTwoErrorRecipe = true;
  3608. return;
  3609. }
  3610. }
  3611. #region 炒股用油量记录
  3612. if (headNum == 2)
  3613. {
  3614. try
  3615. {
  3616. if (result.FlowProcess.fpModels.Count > 0)
  3617. {
  3618. FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
  3619. FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryTwo.OilCapacity;
  3620. FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
  3621. }
  3622. else
  3623. {
  3624. MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
  3625. LTwoRecipeQuene.Clear();
  3626. LTwoInputMaterialQuene.Clear();
  3627. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
  3628. return;
  3629. }
  3630. }
  3631. catch (Exception)
  3632. {
  3633. LTwoRecipeQuene.Clear();
  3634. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
  3635. return;
  3636. // throw;
  3637. }
  3638. }
  3639. else
  3640. {
  3641. try
  3642. {
  3643. if (result.FlowProcess.fpModels.Count > 0)
  3644. {
  3645. FryPotMonitorManage.GetInstance.fryFive.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
  3646. FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFive.OilCapacity;
  3647. FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
  3648. }
  3649. else
  3650. {
  3651. MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
  3652. LTwoRecipeQuene.Clear();
  3653. LTwoInputMaterialQuene.Clear();
  3654. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
  3655. return;
  3656. }
  3657. }
  3658. catch (Exception)
  3659. {
  3660. LTwoRecipeQuene.Clear();
  3661. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
  3662. return;
  3663. // throw;
  3664. }
  3665. }
  3666. #endregion
  3667. DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据
  3668. //globalVar.rollerLineTwo.RecipeComMidSingle = 0;
  3669. WritePlcData("D1102", 1);//配方开始执行命令
  3670. globalVar.rollerLineTwo.LowSignalJude = true;
  3671. if (LTwoRecipeQuene.Count > 0)
  3672. LTwoRecipeQuene.Clear();
  3673. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
  3674. }
  3675. }
  3676. else
  3677. {
  3678. LTwoRecipeQuene.Clear();
  3679. MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线配方完成前禁止再次下发订单");
  3680. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线配方完成前禁止再次下发订单"); }));
  3681. }
  3682. }
  3683. else if (globalVar.rollerLineTwo.WashEmptyRollerModel == 1 && LTwoRecipeQuene.Count > 0)
  3684. {
  3685. MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方");
  3686. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); }));
  3687. LTwoRecipeQuene.Clear();
  3688. }
  3689. else if(LTwoRecipeQuene.Count > 0)
  3690. {
  3691. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
  3692. LTwoRecipeQuene.Clear();
  3693. }
  3694. }
  3695. /// <summary>
  3696. /// 1号滚筒线数据下发 2022/7/4 新增
  3697. /// </summary>
  3698. private void LOneRecipeDataToPlc()
  3699. {
  3700. if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe)
  3701. {
  3702. globalVar.rollerLineOne.RecipeComMidSingle = 1;
  3703. if (globalVar.LOneCurrentRecipeName != string.Empty)
  3704. {
  3705. MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方所有料桶已送达炒锅");
  3706. // ResetPotData(globalVar.LOneFryPotSerial);
  3707. WritePlcData("D2101", 0);
  3708. WritePlcData("D1101", 0);//复位开始执行指令
  3709. PlcLineOneRecipeDataReset();
  3710. if (globalVar.LOneFryPotSerial == 1)
  3711. {
  3712. FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
  3713. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
  3714. {
  3715. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  3716. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
  3717. }
  3718. //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() });//向表中新增数据
  3719. //Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
  3720. }
  3721. if (globalVar.LOneFryPotSerial == 4)
  3722. {
  3723. FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
  3724. using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
  3725. {
  3726. txtWriter.WriteLine(DateTime.Now.ToShortDateString());
  3727. txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
  3728. }
  3729. //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() });//向表中新增数据
  3730. //Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
  3731. }
  3732. globalVar.LOneCurrentRecipeName = string.Empty;
  3733. // Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
  3734. }
  3735. }
  3736. if (RTrig.GetInstance("炒锅1配方完成").Start(Convert.ToBoolean(globalVar.fryPotOne.RecipeCompleteSingle)))
  3737. {
  3738. ResetPotData(1);
  3739. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
  3740. ActionManage.GetInstance.Send("炒锅工艺流程更新", 1);
  3741. MessageNotify.GetInstance.ShowRunLog("炒锅1配方制作完成");
  3742. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  3743. Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; });
  3744. }
  3745. if (RTrig.GetInstance("炒锅4配方完成").Start(Convert.ToBoolean(globalVar.fryPotFour.RecipeCompleteSingle)))
  3746. {
  3747. ResetPotData(4);
  3748. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); }));
  3749. ActionManage.GetInstance.Send("炒锅工艺流程更新", 4);
  3750. MessageNotify.GetInstance.ShowRunLog("炒锅4配方制作完成");
  3751. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  3752. Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; });
  3753. }
  3754. if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.WashEmptyRollerModel == 0)//后续添加其它限制条件
  3755. {
  3756. if ((RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 1 && globalVar.fryPotOne.RecipeCompleteSingle == 1) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 4 && globalVar.fryPotFour.RecipeCompleteSingle == 1) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotOne.ProcessStep == 0) || (globalVar.LOneFryPotSerial == 0 && globalVar.fryPotOne.ProcessStep == 0 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotOne.ProcessStep == 0)) //炒锅空闲才能下配方
  3757. {
  3758. if (globalVar.LOneFryPotSerial == 1)
  3759. {
  3760. globalVar.LOneCurrentCookingStep = 0;
  3761. PotOnestep = 0;
  3762. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; }));
  3763. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection<WorkflowModel>(); }));
  3764. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  3765. Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; });
  3766. }
  3767. if (globalVar.LOneFryPotSerial == 4)
  3768. {
  3769. globalVar.LFourCurrentCookingStep = 0;
  3770. PotFourstep = 0;
  3771. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; }));
  3772. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection<WorkflowModel>(); }));
  3773. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop);
  3774. Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; });
  3775. }
  3776. WritePlcData("D2101", 0);
  3777. WritePlcData("D1101", 0);//复位开始执行指令
  3778. //清空配方数据队列
  3779. PlcLineOneRecipeDataReset();//PLC复位
  3780. if (RecipeQuene.TryDequeue(out NewRecipeModel result))
  3781. {
  3782. ErrorRecipe = false;
  3783. int headNum = result.materialCollection[0].MaterialLoc / 100;
  3784. globalVar.LOneMaterialNum = result.materialCollection.Count;
  3785. globalVar.LOneFryPotSerial = headNum;
  3786. globalVar.LOneCurrentRecipeName = result.RecipeName;
  3787. AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
  3788. MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
  3789. if (headNum == 1)//炒锅1
  3790. {
  3791. potOneCurrentRecipe = result;
  3792. fryOneRecipe = result.RecipeName;//炒锅状态开始记录
  3793. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
  3794. }
  3795. else//炒锅4
  3796. {
  3797. potFourCurrentRecipe = result;
  3798. fryFourRecipe = result.RecipeName;//炒锅状态开始记录
  3799. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
  3800. }
  3801. ResetPotData(globalVar.LOneFryPotSerial);
  3802. Thread.Sleep(800);
  3803. for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
  3804. {
  3805. if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
  3806. {
  3807. //将配方中原料加入新的队列
  3808. InputMaterialQuene.Enqueue(new MaterialInfo()
  3809. {
  3810. materialType = result.materialCollection[i],
  3811. materialId = result.RecipeId
  3812. });
  3813. RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发
  3814. }
  3815. else
  3816. {
  3817. MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3818. MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
  3819. InputMaterialQuene.Clear();
  3820. RecipeQuene.Clear();
  3821. ErrorRecipe = true;
  3822. return;
  3823. }
  3824. }
  3825. #region 炒股用油量记录及工艺下发
  3826. if (headNum == 1)
  3827. {
  3828. try
  3829. {
  3830. if (result.FlowProcess.fpModels.Count > 0)
  3831. {
  3832. FryPotMonitorManage.GetInstance.fryOne.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
  3833. FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryOne.OilCapacity;
  3834. FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
  3835. }
  3836. else
  3837. {
  3838. MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
  3839. RecipeQuene.Clear();
  3840. InputMaterialQuene.Clear();
  3841. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
  3842. return;
  3843. }
  3844. }
  3845. catch (Exception)
  3846. {
  3847. RecipeQuene.Clear();
  3848. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒股工艺异常,配方下发失败"); }));
  3849. return;
  3850. // throw;
  3851. }
  3852. }
  3853. else
  3854. {
  3855. try
  3856. {
  3857. if (result.FlowProcess.fpModels.Count > 0)
  3858. {
  3859. FryPotMonitorManage.GetInstance.fryFour.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json<FlowProcessNames>.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key)?.FryWeight;
  3860. FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFour.OilCapacity;
  3861. FryPotRecipeSetDown(headNum, result);//炒锅工艺下发
  3862. }
  3863. else
  3864. {
  3865. MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消");
  3866. RecipeQuene.Clear();
  3867. InputMaterialQuene.Clear();
  3868. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); }));
  3869. return;
  3870. }
  3871. }
  3872. catch (Exception)
  3873. {
  3874. RecipeQuene.Clear();
  3875. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"炒锅工艺异常,配方下发失败"); }));
  3876. return;
  3877. //throw;
  3878. }
  3879. }
  3880. #endregion
  3881. DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据
  3882. WritePlcData("D1101", 1);//线体1配方开始执行命令
  3883. globalVar.rollerLineOne.LowSignalJude = true;
  3884. if (RecipeQuene.Count > 0)
  3885. RecipeQuene.Clear();
  3886. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }));
  3887. }
  3888. }
  3889. else
  3890. {
  3891. RecipeQuene.Clear();
  3892. MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线配方完成前禁止再次下发订单");
  3893. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线配方完成前禁止再次下发订单"); }));
  3894. }
  3895. }
  3896. else if (globalVar.rollerLineOne.WashEmptyRollerModel == 1 && RecipeQuene.Count > 0)
  3897. {
  3898. MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线处于集中洗桶模式,无法下发配方");
  3899. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); }));
  3900. RecipeQuene.Clear();
  3901. }
  3902. else if (RecipeQuene.Count>0)
  3903. {
  3904. Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"配方下发失败"); }));
  3905. RecipeQuene.Clear();
  3906. }
  3907. }
  3908. /// <summary>
  3909. /// 线体1配方执行等待下位确认
  3910. /// </summary>
  3911. public void LineOneRecipeExecuteConfirm()
  3912. {
  3913. if (globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.LowSignalJude)
  3914. {
  3915. if (globalVar.rollerLineOne.ExcuteIsConfirm == 1) //收到下位执行信号
  3916. {
  3917. WritePlcData("D2101", 0);
  3918. globalVar.rollerLineOne.NextStart = true;
  3919. globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0
  3920. globalVar.rollerLineOne.LowSignalJude = false;
  3921. }
  3922. else if (globalVar.rollerLineOne.ExcuteIsConfirm == 2) //收到下位取消执行命令
  3923. {
  3924. RecipeQuene.Clear();
  3925. OutputMaterialQuene.Clear();
  3926. globalVar.rollerLineOne.NextStart = false;
  3927. ResetPotData(globalVar.LOneFryPotSerial);
  3928. WritePlcData("D2101", 0);
  3929. WritePlcData("D1101", 0);//复位开始执行指令
  3930. //清空配方数据队列
  3931. PlcLineOneRecipeDataReset();//PLC复位
  3932. InputMaterialQuene.Clear();
  3933. MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
  3934. MessageNotify.GetInstance.ShowRunLog($"1号滚筒线所有配方已清除");
  3935. MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【1】号线体【{globalVar.LOneCurrentRecipeName}】配方的制作");
  3936. MessageNotify.GetInstance.ShowUserLog($"1号滚筒线所有配方已清除");
  3937. globalVar.LOneCurrentRecipeName = string.Empty;
  3938. globalVar.rollerLineOne.LowSignalJude = false;
  3939. }
  3940. else //未收到下位执行信号
  3941. {
  3942. globalVar.rollerLineOne.NextStart = false;
  3943. }
  3944. }
  3945. }
  3946. /// <summary>
  3947. /// 线体2配方执行等待下位确认
  3948. /// </summary>
  3949. public void LineTwoRecipeExecuteConfirm()
  3950. {
  3951. if (globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.LowSignalJude)
  3952. {
  3953. if (globalVar.rollerLineTwo.ExcuteIsConfirm == 1) //收到下位执行信号
  3954. {
  3955. WritePlcData("D2102", 0);
  3956. globalVar.rollerLineTwo.NextStart = true;
  3957. globalVar.rollerLineTwo.RecipeComMidSingle = 0;//配方完成的中转信号置0
  3958. globalVar.rollerLineTwo.LowSignalJude = false;
  3959. }
  3960. else if (globalVar.rollerLineTwo.ExcuteIsConfirm == 2) //收到下位取消执行命令
  3961. {
  3962. LTwoRecipeQuene.Clear();
  3963. LTwoOutputMaterialQuene.Clear();
  3964. globalVar.rollerLineTwo.NextStart = false;
  3965. ResetPotData(globalVar.LTwoFryPotSerial);
  3966. WritePlcData("D2102", 0);
  3967. WritePlcData("D1102", 0);//复位开始执行指令
  3968. //清空配方数据队列
  3969. PlcLineTwoRecipeDataReset();//PLC复位
  3970. LTwoInputMaterialQuene.Clear();
  3971. MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
  3972. MessageNotify.GetInstance.ShowRunLog($"2号滚筒线所有配方已清除");
  3973. MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【2】号线体【{globalVar.LTwoCurrentRecipeName}】配方的制作");
  3974. MessageNotify.GetInstance.ShowUserLog($"2号滚筒线所有配方已清除");
  3975. globalVar.LTwoCurrentRecipeName = string.Empty;
  3976. globalVar.rollerLineTwo.LowSignalJude = false;
  3977. }
  3978. else //未收到下位执行信号
  3979. {
  3980. globalVar.rollerLineTwo.NextStart = false;
  3981. }
  3982. }
  3983. }
  3984. /// <summary>
  3985. /// 线体3配方执行等待下位确认
  3986. /// </summary>
  3987. public void LineThreeRecipeExecuteConfirm()
  3988. {
  3989. if (globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.LowSignalJude)
  3990. {
  3991. if (globalVar.rollerLineThree.ExcuteIsConfirm == 1) //收到下位执行信号
  3992. {
  3993. WritePlcData("D2103", 0);
  3994. globalVar.rollerLineThree.NextStart = true;
  3995. globalVar.rollerLineThree.RecipeComMidSingle = 0;//配方完成的中转信号置0
  3996. globalVar.rollerLineThree.LowSignalJude = false;
  3997. }
  3998. else if (globalVar.rollerLineThree.ExcuteIsConfirm == 2) //收到下位取消执行命令
  3999. {
  4000. LThreeRecipeQuene.Clear();
  4001. LThreeOutputMaterialQuene.Clear();
  4002. globalVar.rollerLineThree.NextStart = false;
  4003. ResetPotData(globalVar.LThreeFryPotSerial);
  4004. WritePlcData("D2103", 0);
  4005. WritePlcData("D1103", 0);//复位开始执行指令
  4006. //清空配方数据队列
  4007. PlcLineThreeRecipeDataReset();//PLC复位
  4008. LThreeInputMaterialQuene.Clear();
  4009. MessageNotify.GetInstance.ShowRunLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
  4010. MessageNotify.GetInstance.ShowRunLog($"3号滚筒线所有配方已清除");
  4011. MessageNotify.GetInstance.ShowUserLog($"下位机操作员取消【3】号线体【{globalVar.LThreeCurrentRecipeName}】配方的制作");
  4012. MessageNotify.GetInstance.ShowUserLog($"3号滚筒线所有配方已清除");
  4013. globalVar.LThreeCurrentRecipeName = string.Empty;
  4014. globalVar.rollerLineThree.LowSignalJude = false;
  4015. }
  4016. else //未收到下位执行信号
  4017. {
  4018. globalVar.rollerLineThree.NextStart = false;
  4019. }
  4020. }
  4021. }
  4022. /// <summary>
  4023. /// AGV到配方线体1装桶以及出料到炒锅
  4024. /// </summary>
  4025. public void LOneLoadRoller()
  4026. {
  4027. if (InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.NextStart)
  4028. {
  4029. AgvToLineOneLoadRoller();
  4030. AgvFromLineOneToFryPot();//AGV到1号线体装桶
  4031. }
  4032. AgvLineOneLoadRollerCom();
  4033. }
  4034. /// <summary>
  4035. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  4036. /// </summary>
  4037. /// <exception cref="NotImplementedException"></exception>
  4038. private void AgvLineOneLoadRollerCom()
  4039. {
  4040. if ((globalVar.agvLineOneLoadCom || globalVar.LineOneRobotTaskError)&& globalVar.AgvToFryPot)
  4041. {
  4042. if (globalVar.LineOneRobotTaskError)
  4043. DeviceOperate.GetInstance.WritePlcData("D1052", 0);//就位信号复位
  4044. globalVar.rollerLineOne.CanRun = true;
  4045. globalVar.agvLineOneLoadCom = false;
  4046. MessageNotify.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
  4047. }
  4048. }
  4049. /// <summary>
  4050. /// AGV到配方线体2装桶以及出料到炒锅
  4051. /// </summary>
  4052. public void LTwoAgvLoadRoller()
  4053. {
  4054. if (LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.NextStart)
  4055. {
  4056. AgvToLineTwoLoadRoller();
  4057. AgvFromLineTwoToFryPot();//AGV到2号线体装桶
  4058. }
  4059. AgvLineTwoLoadRollerCom();
  4060. }
  4061. /// <summary>
  4062. /// 判断agv在2号线体是否上料完成,作为线体空桶能否开始运输的条件
  4063. /// </summary>
  4064. private void AgvLineTwoLoadRollerCom()
  4065. {
  4066. if ((globalVar.agvLineTwoLoadCom || globalVar.LineTwoRobotTaskError)&&globalVar.LTwoAgvToFryPot)
  4067. {
  4068. if (globalVar.LineTwoRobotTaskError)
  4069. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  4070. globalVar.rollerLineTwo.CanRun = true;
  4071. globalVar.agvLineTwoLoadCom = false;
  4072. MessageNotify.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
  4073. }
  4074. }
  4075. /// <summary>
  4076. /// AGV到配方线体3装桶以及出料到炒锅
  4077. /// </summary>
  4078. public void LThreeAgvLoadRoller()
  4079. {
  4080. if (LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.NextStart)
  4081. {
  4082. AgvToLineThreeLoadRoller();
  4083. AgvFromLineThreeToFryPot();//AGV到2号线体装桶
  4084. }
  4085. AgvLineThreeLoadRollerCom();
  4086. }
  4087. /// <summary>
  4088. /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
  4089. /// </summary>
  4090. private void AgvLineThreeLoadRollerCom()
  4091. {
  4092. if ((globalVar.agvLineThreeLoadCom || globalVar.LineThreeRobotTaskError)&&globalVar.LThreeAgvToFryPot)
  4093. {
  4094. if (globalVar.LineThreeRobotTaskError)
  4095. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  4096. globalVar.rollerLineThree.CanRun = true;
  4097. globalVar.agvLineThreeLoadCom = false;
  4098. MessageNotify.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
  4099. }
  4100. }
  4101. /// <summary>
  4102. /// AGV从炒锅送料位置到倒料过程处理
  4103. /// </summary>
  4104. //public void FryPotInputMaterial()
  4105. //{
  4106. // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
  4107. // {
  4108. // while (!agvArriveUnLoad)//等待agv到达炒锅位置
  4109. // {
  4110. // Thread.Sleep(5);
  4111. // if (globalVar.ExitMainTask)
  4112. // return;
  4113. // }
  4114. // AgvArriveFryPotSingleSetDown();
  4115. // FryPotRollerTroubleCheck();
  4116. // if (FryPotAlarm == 1)//炒锅滚筒无故障
  4117. // {
  4118. // //炒锅滚筒进料运行到位处理
  4119. // FryPotInputMaterialRollerOperate();
  4120. // globalVar.InOrOutputLock = true;
  4121. // }
  4122. // }
  4123. //}
  4124. /// <summary>
  4125. /// 线体1的AGV从炒锅送料位置到倒料过程处理
  4126. /// </summary>
  4127. public void LOneFryPotInputMaterial()
  4128. {
  4129. if (OutputMaterialQuene.Count > 0 && (globalVar.agvArriveUnLoad || globalVar.LineOneRobotTaskError) && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
  4130. {
  4131. //if (globalVar.LOneFryPotSerial == 1)
  4132. //{
  4133. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1);
  4134. //}
  4135. //else if (globalVar.LOneFryPotSerial == 4)
  4136. //{
  4137. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4);
  4138. //}
  4139. MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
  4140. AgvArriveFryPotOneOrFourSingleSetDown();
  4141. globalVar.agvArriveUnLoad = false;
  4142. globalVar.PotOneInputMaterialArrive = true;
  4143. globalVar.LineOneRobotTaskError = false;//AGV故障信号复位
  4144. FryPotOneRollerTroubleCheck();
  4145. }
  4146. }
  4147. public void LOneFallMaterial()
  4148. {
  4149. if (!globalVar.InOrOutputLock && ((globalVar.fryPotOne.InputMaterialArrivedSingle == 1 && globalVar.LOneFryPotSerial == 1) || (globalVar.fryPotFour.InputMaterialArrivedSingle == 1 && globalVar.LOneFryPotSerial == 4)) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
  4150. {
  4151. //FryPotOneRollerTroubleCheck();
  4152. if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1) || (FryPotFourAlarm == 1 && globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障
  4153. {
  4154. if (globalVar.LOneFryPotSerial == 1)
  4155. {
  4156. DeviceOperate.GetInstance.WritePlcData("D1055", 0);
  4157. //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
  4158. }
  4159. else
  4160. {
  4161. DeviceOperate.GetInstance.WritePlcData("D1058", 0);
  4162. // Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
  4163. }
  4164. //炒锅滚筒进料运行到位处理
  4165. FryPotOneOrFourInputMaterialRollerOperate();
  4166. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start);
  4167. FryPotOneRollerTroubleCheck();
  4168. globalVar.InOrOutputLock = true;
  4169. globalVar.PotOneOutputRollerArrive = true;
  4170. }
  4171. }
  4172. }
  4173. /// <summary>
  4174. /// 线体2的AGV从炒锅送料位置到倒料过程处理
  4175. /// </summary>
  4176. public void LTwoFryPotInputMaterial()
  4177. {
  4178. if (LTwoOutputMaterialQuene.Count > 0 && (globalVar.LTwoagvArriveUnLoad || globalVar.LineTwoRobotTaskError) && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
  4179. {
  4180. //if (globalVar.LTwoFryPotSerial == 2)
  4181. //{
  4182. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
  4183. //}
  4184. //else if (globalVar.LTwoFryPotSerial == 5)
  4185. //{
  4186. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
  4187. //}
  4188. MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LTwoFryPotSerial}】号炒锅下料位置");
  4189. AgvArriveFryPotTwoOrFiveSingleSetDown();
  4190. globalVar.LTwoagvArriveUnLoad = false;
  4191. globalVar.LTwoPotInputMaterialArrive = true;
  4192. globalVar.LineTwoRobotTaskError = false;//agv故障信号复位
  4193. FryPotTwoRollerTroubleCheck();
  4194. }
  4195. }
  4196. public void LTwoFallMaterial()
  4197. {
  4198. if (!globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 2) || (globalVar.fryPotFive.InputMaterialArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 5) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive))
  4199. {
  4200. //if (globalVar.LTwoFryPotSerial == 2)
  4201. //{
  4202. // 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() });//向表中新增数据
  4203. // Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
  4204. //}
  4205. //else
  4206. //{
  4207. // 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() });//向表中新增数据
  4208. // Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
  4209. //}
  4210. if ((FryPotTwoAlarm == 1 && globalVar.LTwoFryPotSerial == 2) || (FryPotFiveAlarm == 1 && globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障
  4211. {
  4212. if (globalVar.LTwoFryPotSerial == 2)
  4213. {
  4214. DeviceOperate.GetInstance.WritePlcData("D1056", 0);
  4215. //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
  4216. }
  4217. else
  4218. {
  4219. DeviceOperate.GetInstance.WritePlcData("D1059", 0);
  4220. //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
  4221. }
  4222. //炒锅滚筒进料运行到位处理
  4223. FryPotTwoOrFiveInputMaterialRollerOperate();
  4224. AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start);
  4225. FryPotTwoRollerTroubleCheck();
  4226. globalVar.LTwoInOrOutputLock = true;
  4227. globalVar.LTwoPotOutputRollerArrive = true;
  4228. }
  4229. }
  4230. }
  4231. /// <summary>
  4232. /// 线体3的AGV从炒锅送料位置到倒料过程处理
  4233. /// </summary>
  4234. public void LThreeFryPotInputMaterial()
  4235. {
  4236. if (LThreeOutputMaterialQuene.Count > 0 && (globalVar.LThreeagvArriveUnLoad || globalVar.LineThreeRobotTaskError) && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
  4237. {
  4238. // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
  4239. MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置");
  4240. AgvArriveFryPotThreeSingleSetDown();
  4241. globalVar.LThreeagvArriveUnLoad = false;
  4242. globalVar.LThreePotInputMaterialArrive = true;
  4243. globalVar.LineThreeRobotTaskError = false;//agv故障信号复位
  4244. FryPotThreeRollerTroubleCheck();
  4245. }
  4246. }
  4247. public void LThreeFallMaterial()
  4248. {
  4249. if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
  4250. {
  4251. //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() });//向表中新增数据
  4252. //Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
  4253. if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
  4254. {
  4255. DeviceOperate.GetInstance.WritePlcData("D1057", 0);
  4256. //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); }));
  4257. //炒锅滚筒进料运行到位处理
  4258. FryPotThreeInputMaterialRollerOperate();
  4259. AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start);
  4260. FryPotThreeRollerTroubleCheck();
  4261. globalVar.LThreeInOrOutputLock = true;
  4262. globalVar.LThreePotOutputRollerArrive = true;
  4263. }
  4264. }
  4265. }
  4266. /// <summary>
  4267. /// 炒锅出桶
  4268. /// </summary>
  4269. //public void FryPotOutputMaterial()
  4270. //{
  4271. // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
  4272. // {
  4273. // AgvFromFryPotToClean();//上游下发搬运任务给AGV
  4274. // while (!agvArriveUpLoad)//等待agv到达炒锅位置
  4275. // {
  4276. // Thread.Sleep(5);
  4277. // if (globalVar.ExitMainTask)
  4278. // return;
  4279. // }
  4280. // agvArriveUpLoad = false;
  4281. // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
  4282. // FryPotRollerTroubleCheck();
  4283. // if (FryPotAlarm == 1)//无故障
  4284. // {
  4285. // FryPotOutEmpetyRollerOperate();
  4286. // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  4287. // {
  4288. // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
  4289. // {
  4290. // Thread.Sleep(5);agvFryPotEmptyRollerArrive
  4291. // if (globalVar.ExitMainTask)
  4292. // return;
  4293. // }
  4294. // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  4295. // globalVar.AllowAgvToLineLoadRoller = true;
  4296. // globalVar.InOrOutputLock = false;
  4297. // }
  4298. // }
  4299. // }
  4300. //}
  4301. /// <summary>
  4302. /// 线体1对应炒锅出桶
  4303. /// </summary>
  4304. public void LOneFryPotOutputMaterial()
  4305. {
  4306. if (((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 && globalVar.LOneFryPotSerial == 1) || (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1 && globalVar.LOneFryPotSerial == 4)) && OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
  4307. {
  4308. //上游下发搬运任务给AGV
  4309. if (AgvFromFryPotOneOrFourToClean())
  4310. {
  4311. globalVar.AgvArrivePot = true;
  4312. }
  4313. else
  4314. {
  4315. Thread.Sleep(5000);
  4316. }
  4317. }
  4318. }
  4319. public void LOneEmptyOperate()
  4320. {
  4321. if ((globalVar.agvArriveUpLoad || globalVar.LineFourRobotTaskError) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot)
  4322. {
  4323. if (globalVar.agvFryPotEmptyRollerArrive || globalVar.LineFourRobotTaskError)//炒锅上料完成
  4324. {
  4325. if (globalVar.LineFourRobotTaskError)
  4326. {
  4327. if (globalVar.LOneFryPotSerial == 1)
  4328. {
  4329. DeviceOperate.GetInstance.WritePlcData("D1060", 0);
  4330. }
  4331. else
  4332. {
  4333. DeviceOperate.GetInstance.WritePlcData("D1063", 0);
  4334. }
  4335. }
  4336. FryPotOneOrFourOutEmpetyRollerOperate();
  4337. if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  4338. {
  4339. //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
  4340. //if (globalVar.LOneFryPotSerial == 1)
  4341. //{
  4342. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1);
  4343. //}
  4344. //else if (globalVar.LOneFryPotSerial == 4)
  4345. //{
  4346. // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4);
  4347. //}
  4348. globalVar.agvArriveUpLoad = false;
  4349. globalVar.agvFryPotEmptyRollerArrive = false;
  4350. globalVar.InOrOutputLock = false;
  4351. MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  4352. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  4353. globalVar.AllowAgvToLineLoadRoller = true;
  4354. globalVar.LoadRoller = false;
  4355. globalVar.AgvToFryPot = false;
  4356. globalVar.PotOneInputMaterialArrive = false;
  4357. globalVar.PotOneOutputRollerArrive = false;
  4358. globalVar.AgvArrivePot = false;
  4359. }
  4360. }
  4361. //}
  4362. }
  4363. }
  4364. /// <summary>
  4365. /// 线体2对应炒锅出桶
  4366. /// </summary>
  4367. public void LTwoFryPotOutputMaterial()
  4368. {
  4369. if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 2) || (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1 && globalVar.LTwoFryPotSerial == 5)) && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
  4370. {
  4371. //上游下发搬运任务给AGV
  4372. if (AgvFromFryPotTwoOrFiveToClean())
  4373. {
  4374. globalVar.LTwoAgvArrivePot = true;
  4375. }
  4376. else
  4377. {
  4378. Thread.Sleep(5000);
  4379. }
  4380. }
  4381. }
  4382. public void LTwoEmptyOperate()
  4383. {
  4384. if ((globalVar.agvArriveLTwoUpLoad || globalVar.LineFiveRobotTaskError) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
  4385. {
  4386. //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
  4387. //{
  4388. if (globalVar.LTwoagvFryPotEmptyRollerArrive || globalVar.LineFiveRobotTaskError)
  4389. {
  4390. if (globalVar.LineFiveRobotTaskError)
  4391. {
  4392. if (globalVar.LTwoFryPotSerial == 2)
  4393. {
  4394. DeviceOperate.GetInstance.WritePlcData("D1061", 0);
  4395. }
  4396. else
  4397. {
  4398. DeviceOperate.GetInstance.WritePlcData("D1064", 0);
  4399. }
  4400. }
  4401. FryPotTwoOrFiveOutEmpetyRollerOperate();
  4402. if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  4403. {
  4404. //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
  4405. //if (globalVar.LTwoFryPotSerial == 2)
  4406. //{
  4407. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
  4408. //}
  4409. //else if (globalVar.LTwoFryPotSerial == 5)
  4410. //{
  4411. // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
  4412. //}
  4413. globalVar.agvArriveLTwoUpLoad = false;
  4414. globalVar.LTwoagvFryPotEmptyRollerArrive = false;
  4415. globalVar.LTwoInOrOutputLock = false;
  4416. MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  4417. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  4418. globalVar.AllowAgvToLineTwoLoadRoller = true;
  4419. globalVar.LTwoLoadRoller = false;
  4420. globalVar.LTwoAgvToFryPot = false;
  4421. globalVar.LTwoPotInputMaterialArrive = false;
  4422. globalVar.LTwoPotOutputRollerArrive = false;
  4423. globalVar.LTwoAgvArrivePot = false;
  4424. }
  4425. }
  4426. //}
  4427. }
  4428. }
  4429. /// <summary>
  4430. /// 线体3对应炒锅出桶
  4431. /// </summary>
  4432. public void LThreeFryPotOutputMaterial()
  4433. {
  4434. if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
  4435. {
  4436. //上游下发搬运任务给AGV
  4437. if (AgvFromFryPotThreeToClean())
  4438. {
  4439. globalVar.LThreeAgvArrivePot = true;
  4440. }
  4441. else
  4442. {
  4443. Thread.Sleep(5000);
  4444. }
  4445. }
  4446. }
  4447. public void LThreeEmptyOperate()
  4448. {
  4449. if ((globalVar.agvArriveLThreeUpLoad || globalVar.LineSixRobotTaskError) && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
  4450. {
  4451. //if (FryPotThreeAlarm == 1)//无故障
  4452. //{
  4453. if (globalVar.LThreeagvFryPotEmptyRollerArrive || globalVar.LineSixRobotTaskError)
  4454. {
  4455. if (globalVar.LineSixRobotTaskError)
  4456. DeviceOperate.GetInstance.WritePlcData("D1062", 0);
  4457. //FryPotThreeOutEmpetyRollerOperate();
  4458. MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成");
  4459. if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
  4460. {
  4461. //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
  4462. //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
  4463. globalVar.agvArriveLThreeUpLoad = false;
  4464. globalVar.LThreeagvFryPotEmptyRollerArrive = false;
  4465. globalVar.LThreeInOrOutputLock = false;
  4466. MessageNotify.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线");
  4467. //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
  4468. globalVar.AllowAgvToLineThreeLoadRoller = true;
  4469. globalVar.LThreeLoadRoller = false;
  4470. globalVar.LThreeAgvToFryPot = false;
  4471. globalVar.LThreePotInputMaterialArrive = false;
  4472. globalVar.LThreePotOutputRollerArrive = false;
  4473. globalVar.LThreeAgvArrivePot = false;
  4474. }
  4475. }
  4476. // }
  4477. }
  4478. }
  4479. /// <summary>
  4480. /// 清洗台到4号线体下料
  4481. /// </summary>
  4482. public void EmptyRollerToLinFourFromClean()
  4483. {
  4484. if (globalVar.agvArriveLineFour || globalVar.LineTenRobotTaskError)//agv到达线体4下料位置
  4485. {
  4486. if (globalVar.LineTenRobotTaskError)
  4487. DeviceOperate.GetInstance.WritePlcData("D1066", 0);
  4488. globalVar.agvArriveLineFour = false;
  4489. globalVar.LineTenRobotTaskError = false;//AGV故障信号复位
  4490. //线体四信号交互
  4491. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4492. MessageNotify.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶");
  4493. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4494. }
  4495. }
  4496. public void EmptyRollerToLinFourFromPot()
  4497. {
  4498. if (globalVar.rollerLineOne.agvArriveLineFour || globalVar.LineFourRobotTaskError)//agv到达线体4下料位置
  4499. {
  4500. globalVar.rollerLineOne.agvArriveLineFour = false;
  4501. //线体四信号交互
  4502. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4503. globalVar.LineFourRobotTaskError = false;//AGV故障信号复位
  4504. MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LOneFryPotSerial}】号炒锅到达【4】号回收线体,准备卸桶");
  4505. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4506. }
  4507. if (globalVar.rollerLineTwo.agvArriveLineFour || globalVar.LineFiveRobotTaskError)//agv到达线体4下料位置
  4508. {
  4509. globalVar.rollerLineTwo.agvArriveLineFour = false;
  4510. //线体四信号交互
  4511. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4512. globalVar.LineFiveRobotTaskError = false;//AGV故障信号复位
  4513. MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LTwoFryPotSerial}】炒锅到达【4】号回收线体,准备卸桶");
  4514. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4515. }
  4516. if (globalVar.rollerLineThree.agvArriveLineFour || globalVar.LineSixRobotTaskError)//agv到达线体4下料位置
  4517. {
  4518. globalVar.rollerLineThree.agvArriveLineFour = false;
  4519. //线体四信号交互
  4520. WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4521. globalVar.LineSixRobotTaskError = false;//AGV故障信号复位
  4522. MessageNotify.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
  4523. // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4524. }
  4525. }
  4526. ///// <summary>
  4527. ///// 线体1对应炒锅到4号线体下料
  4528. ///// </summary>
  4529. //public void EmptyRollerToLinFourFromLineOne()
  4530. //{
  4531. // if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置
  4532. // {
  4533. // globalVar.rollerLineOne.agvArriveLineFour = false;
  4534. // //线体四信号交互
  4535. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4536. // MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶");
  4537. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4538. // }
  4539. //}
  4540. ///// <summary>
  4541. /////线体2对应炒锅到4号线体下料
  4542. ///// </summary>
  4543. //public void EmptyRollerToLinFourFromLineTwo()
  4544. //{
  4545. // if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置
  4546. // {
  4547. // globalVar.rollerLineTwo.agvArriveLineFour = false;
  4548. // //线体四信号交互
  4549. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4550. // MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶");
  4551. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4552. // }
  4553. //}
  4554. ///// <summary>
  4555. ///// 线体3对应炒锅到4号线体下料
  4556. ///// </summary>
  4557. //public void EmptyRollerToLinFourFromLineThree()
  4558. //{
  4559. // if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置
  4560. // {
  4561. // globalVar.rollerLineThree.agvArriveLineFour = false;
  4562. // //线体四信号交互
  4563. // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC
  4564. // MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶");
  4565. // // MessageLog.GetInstance.ShowRunLog("卸桶完成");
  4566. // }
  4567. //}
  4568. /// <summary>
  4569. /// 炒锅1,4滚筒进料运行到位处理
  4570. /// </summary>
  4571. public void FryPotOneOrFourInputMaterialRollerOperate()
  4572. {
  4573. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4574. {
  4575. case 1:
  4576. //while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
  4577. //{
  4578. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4579. // return;
  4580. //}
  4581. MessageNotify.GetInstance.ShowRunLog($"炒锅【1】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  4582. case 4:
  4583. //while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
  4584. //{
  4585. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4586. // return;
  4587. //}
  4588. MessageNotify.GetInstance.ShowRunLog($"炒锅【4】:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  4589. }
  4590. }
  4591. /// <summary>
  4592. /// 炒锅2,5滚筒进料运行到位处理
  4593. /// </summary>
  4594. public void FryPotTwoOrFiveInputMaterialRollerOperate()
  4595. {
  4596. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4597. {
  4598. case 2:
  4599. //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
  4600. //{
  4601. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4602. // return;
  4603. //}
  4604. MessageNotify.GetInstance.ShowRunLog($"炒锅【2】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  4605. case 5:
  4606. //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
  4607. //{
  4608. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4609. // return;
  4610. //}
  4611. MessageNotify.GetInstance.ShowRunLog($"炒锅【5】:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
  4612. }
  4613. }
  4614. public void FryPotThreeInputMaterialRollerOperate()
  4615. {
  4616. //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
  4617. //{
  4618. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4619. // return;
  4620. //}
  4621. MessageNotify.GetInstance.ShowRunLog($"炒锅【3】:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
  4622. }
  4623. /// <summary>
  4624. /// 炒锅滚筒空桶出桶处理
  4625. /// </summary>
  4626. //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
  4627. //{
  4628. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  4629. // {
  4630. // case 1:
  4631. // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  4632. // {
  4633. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4634. // return;
  4635. // }
  4636. // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  4637. // case 2:
  4638. // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  4639. // {
  4640. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4641. // return;
  4642. // }
  4643. // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  4644. // case 3:
  4645. // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  4646. // {
  4647. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4648. // return;
  4649. // }
  4650. // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  4651. // case 4:
  4652. // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  4653. // {
  4654. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4655. // return;
  4656. // }
  4657. // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  4658. // case 5:
  4659. // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  4660. // {
  4661. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4662. // return;
  4663. // }
  4664. // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
  4665. // }
  4666. //}
  4667. /// <summary>
  4668. /// 炒锅1,4滚筒空桶出桶处理
  4669. /// </summary>
  4670. public void FryPotOneOrFourOutEmpetyRollerOperate()
  4671. {
  4672. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4673. {
  4674. case 1:
  4675. //while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
  4676. //{
  4677. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4678. // return;
  4679. //}
  4680. MessageNotify.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
  4681. case 4:
  4682. //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
  4683. //{
  4684. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4685. // return;
  4686. //}
  4687. MessageNotify.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
  4688. }
  4689. }
  4690. /// <summary>
  4691. /// 炒锅2,5滚筒空桶出桶处理
  4692. /// </summary>
  4693. public void FryPotTwoOrFiveOutEmpetyRollerOperate()
  4694. {
  4695. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4696. {
  4697. case 2:
  4698. //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
  4699. //{
  4700. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4701. // return;
  4702. //}
  4703. MessageNotify.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
  4704. case 5:
  4705. //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
  4706. //{
  4707. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4708. // return;
  4709. //}
  4710. MessageNotify.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break;
  4711. }
  4712. }
  4713. /// <summary>
  4714. /// 炒锅3滚筒空桶出桶处理
  4715. /// </summary>
  4716. public void FryPotThreeOutEmpetyRollerOperate()
  4717. {
  4718. //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
  4719. //{
  4720. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  4721. // return;
  4722. //}
  4723. MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成");
  4724. }
  4725. /// <summary>
  4726. /// 发送agv送料就位信号至PLC(线体到炒锅)
  4727. /// </summary>
  4728. public void AgvArriveFryPotSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  4729. {
  4730. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  4731. {
  4732. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  4733. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  4734. case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
  4735. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  4736. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  4737. }
  4738. }
  4739. /// <summary>
  4740. /// 发送agv送料就位信号至PLC(线体1到炒锅)
  4741. /// </summary>
  4742. public void AgvArriveFryPotOneOrFourSingleSetDown()
  4743. {
  4744. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4745. {
  4746. case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
  4747. case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
  4748. }
  4749. }
  4750. /// <summary>
  4751. /// 发送agv送料就位信号至PLC(线体2到炒锅)
  4752. /// </summary>
  4753. public void AgvArriveFryPotTwoOrFiveSingleSetDown()
  4754. {
  4755. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4756. {
  4757. case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
  4758. case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
  4759. }
  4760. }
  4761. /// <summary>
  4762. /// 发送agv送料就位信号至PLC(线体3到炒锅)
  4763. /// </summary>
  4764. public void AgvArriveFryPotThreeSingleSetDown()
  4765. {
  4766. DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号
  4767. }
  4768. /// <summary>
  4769. /// 发送agv回桶就位信号至PLC
  4770. /// </summary>
  4771. public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue<MaterialInfo> queue)
  4772. {
  4773. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  4774. {
  4775. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  4776. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  4777. case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
  4778. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  4779. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  4780. }
  4781. }
  4782. public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown()
  4783. {
  4784. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4785. {
  4786. case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
  4787. case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
  4788. }
  4789. }
  4790. public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown()
  4791. {
  4792. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4793. {
  4794. case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
  4795. case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
  4796. }
  4797. }
  4798. public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown()
  4799. {
  4800. DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号
  4801. }
  4802. ///// <summary>
  4803. ///// AGV离开炒锅运送空桶任务
  4804. ///// </summary>
  4805. //public void AgvFromFryPotToClean(ConcurrentQueue<MaterialInfo> queue)
  4806. //{
  4807. // switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  4808. // {
  4809. // case 1:
  4810. // erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
  4811. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId)
  4812. // {
  4813. // goto erp;
  4814. // }
  4815. // string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  4816. // LOnerobotJobId = id;
  4817. // FryCarryTaskErrorCodeAnalysis(info, 1); break;
  4818. // case 2:
  4819. // erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
  4820. // if (id1 == LTworobotJobId)
  4821. // {
  4822. // goto erp1;
  4823. // }
  4824. // string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  4825. // LTworobotJobId = id1;
  4826. // FryCarryTaskErrorCodeAnalysis(info1, 2); break;
  4827. // case 3:
  4828. // erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
  4829. // if (id2 == LThreerobotJobId)
  4830. // {
  4831. // goto erp2;
  4832. // }
  4833. // string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  4834. // LThreerobotJobId = id2;
  4835. // FryCarryTaskErrorCodeAnalysis(info2, 3); break;
  4836. // case 4:
  4837. // erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
  4838. // if (id3 == LOnerobotJobId)
  4839. // {
  4840. // goto erp3;
  4841. // }
  4842. // string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  4843. // LOnerobotJobId = id3;
  4844. // FryCarryTaskErrorCodeAnalysis(info3, 4); break;
  4845. // case 5:
  4846. // erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
  4847. // if (id4 == LTworobotJobId)
  4848. // {
  4849. // goto erp4;
  4850. // }
  4851. // string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  4852. // LTworobotJobId = id4;
  4853. // FryCarryTaskErrorCodeAnalysis(info4, 5); break;
  4854. // }
  4855. //}
  4856. /// <summary>
  4857. /// AGV离开炒锅1,4运送空桶任务
  4858. /// </summary>
  4859. public bool AgvFromFryPotOneOrFourToClean()
  4860. {
  4861. bool result = true;
  4862. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4863. {
  4864. case 1:
  4865. erp: string id = Guid.NewGuid().ToString("D");//上游唯一ID
  4866. 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)
  4867. {
  4868. goto erp;
  4869. }
  4870. MessageNotify.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务");
  4871. string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
  4872. LFourrobotJobId = id;
  4873. if (!FryCarryTaskErrorCodeAnalysis(info, 1))
  4874. {
  4875. id = String.Empty;
  4876. result = false;
  4877. }
  4878. break;
  4879. case 4:
  4880. erp3: string id3 = Guid.NewGuid().ToString("D");//上游唯一ID
  4881. 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)
  4882. {
  4883. goto erp3;
  4884. }
  4885. MessageNotify.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务");
  4886. string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
  4887. LFourrobotJobId = id3;
  4888. if (!FryCarryTaskErrorCodeAnalysis(info3, 4))
  4889. {
  4890. id3 = String.Empty;
  4891. result = false;
  4892. }
  4893. break;
  4894. }
  4895. return result;
  4896. }
  4897. /// <summary>
  4898. /// AGV离开炒锅2,5运送空桶任务
  4899. /// </summary>
  4900. public bool AgvFromFryPotTwoOrFiveToClean()
  4901. {
  4902. bool result = true;
  4903. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  4904. {
  4905. case 2:
  4906. erp1: string id1 = Guid.NewGuid().ToString("D");//上游唯一ID
  4907. 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)
  4908. {
  4909. goto erp1;
  4910. }
  4911. MessageNotify.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务");
  4912. string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
  4913. LFiverobotJobId = id1;
  4914. if (!FryCarryTaskErrorCodeAnalysis(info1, 2))
  4915. {
  4916. id1 = String.Empty;
  4917. result = false;
  4918. }
  4919. break;
  4920. case 5:
  4921. erp4: string id4 = Guid.NewGuid().ToString("D");//上游唯一ID
  4922. 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)
  4923. {
  4924. goto erp4;
  4925. }
  4926. MessageNotify.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务");
  4927. string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
  4928. LFiverobotJobId = id4;
  4929. if (!FryCarryTaskErrorCodeAnalysis(info4, 5))
  4930. {
  4931. id4 = String.Empty;
  4932. result = false;
  4933. }
  4934. break;
  4935. }
  4936. return result;
  4937. }
  4938. /// <summary>
  4939. /// AGV离开炒锅3运送空桶任务
  4940. /// </summary>
  4941. public bool AgvFromFryPotThreeToClean()
  4942. {
  4943. bool result = true;
  4944. erp2: string id2 = Guid.NewGuid().ToString("D");//上游唯一ID
  4945. 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)
  4946. {
  4947. goto erp2;
  4948. }
  4949. MessageNotify.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务");
  4950. string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
  4951. LSixrobotJobId = id2;
  4952. if (!FryCarryTaskErrorCodeAnalysis(info2, 3))
  4953. {
  4954. id2 = string.Empty;
  4955. result = false;
  4956. }
  4957. return result;
  4958. }
  4959. /// <summary>
  4960. /// 处理agv从线体1到送料到炒锅的条件
  4961. /// </summary>
  4962. /// <param name="lineAlarm"></param>
  4963. public void AgvFromLineOneToFryPot()
  4964. {
  4965. erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)
  4966. {
  4967. if ((globalVar.agvArriveUpLoad || globalVar.LineOneRobotTaskError) && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
  4968. {
  4969. MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  4970. AgvArriveLineSingelSetDown(InputMaterialQuene);
  4971. if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  4972. {
  4973. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  4974. //if (materialInfo.materialType.MaterialLoc / 100 == 1)
  4975. //{
  4976. // globalVar.LOneCurrentCookingStep++;
  4977. //}
  4978. //else
  4979. //{
  4980. // globalVar.LFourCurrentCookingStep++;
  4981. //}
  4982. OutputMaterialQuene.Enqueue(materialInfo);
  4983. globalVar.agvArriveUpLoad = false;
  4984. globalVar.AgvToFryPot = true;
  4985. //原料到位,agv到位,agv自行运料到炒锅
  4986. }
  4987. }
  4988. }
  4989. else//有故障
  4990. {
  4991. while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
  4992. {
  4993. Thread.Sleep(1000);
  4994. if (globalVar.ExitLineOneTask)
  4995. return;
  4996. }
  4997. MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  4998. //lineAlarm = 1;
  4999. goto erp;
  5000. }
  5001. }
  5002. /// <summary>
  5003. /// Agv从1号线体运空桶到清洗处
  5004. /// </summary>
  5005. public void AgvFromLineOneToClean(ushort emptyRollerNum = 0)
  5006. {
  5007. erp: if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//无故障
  5008. {
  5009. if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
  5010. {
  5011. MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
  5012. DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
  5013. if (emptyRollerNum != 0)
  5014. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  5015. globalVar.agvArriveLineOneLoadEmptyRoller = false;
  5016. //原料到位,agv到位,agv自行运料到清洗处
  5017. }
  5018. if (globalVar.agvArriveLineOneLoadCom || globalVar.LineSevenRobotTaskError)//上料完成
  5019. {
  5020. if (globalVar.LineSevenRobotTaskError)
  5021. DeviceOperate.GetInstance.WritePlcData("D1052", 0);
  5022. if (emptyRollerNum != 0)
  5023. globalVar.rollerLineOne.EmptyRollerNums.Remove(emptyRollerNum);
  5024. globalVar.agvArriveLineOneLoadCom = false;
  5025. globalVar.rollerLineOne.IsEpmtyBefore = false;
  5026. if (emptyRollerNum != 0)
  5027. MessageNotify.GetInstance.ShowRunLog($"AGV在【1】号线体完成【{emptyRollerNum}】号空料桶装载");
  5028. }
  5029. }
  5030. else//有故障
  5031. {
  5032. while (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 1)
  5033. {
  5034. Thread.Sleep(1000);
  5035. if (globalVar.ExitLineOneTask)
  5036. return;
  5037. }
  5038. MessageNotify.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
  5039. //lineAlarm = 1;
  5040. goto erp;
  5041. }
  5042. }
  5043. /// <summary>
  5044. /// 处理agv从线体2到送料到炒锅的条件
  5045. /// </summary>
  5046. /// <param name="lineAlarm"></param>
  5047. public void AgvFromLineTwoToFryPot()
  5048. {
  5049. erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
  5050. {
  5051. if ((globalVar.agvArriveLTwoUpLoad || globalVar.LineTwoRobotTaskError) && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
  5052. {
  5053. MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  5054. AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
  5055. if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  5056. {
  5057. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  5058. //if (materialInfo.materialType.MaterialLoc / 100 == 2)
  5059. //{
  5060. // globalVar.LTwoCurrentCookingStep++;
  5061. //}
  5062. //else
  5063. //{
  5064. // globalVar.LFiveCurrentCookingStep++;
  5065. //}
  5066. LTwoOutputMaterialQuene.Enqueue(materialInfo);
  5067. globalVar.agvArriveLTwoUpLoad = false;
  5068. globalVar.LTwoAgvToFryPot = true;
  5069. //原料到位,agv到位,agv自行运料到炒锅
  5070. }
  5071. }
  5072. }
  5073. else//有故障
  5074. {
  5075. while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
  5076. {
  5077. Thread.Sleep(1000);
  5078. if (globalVar.ExitLineTwoTask)
  5079. return;
  5080. }
  5081. MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  5082. // lineAlarm = 1;
  5083. goto erp;
  5084. }
  5085. }
  5086. /// <summary>
  5087. /// Agv从2号线体运空桶到清洗处
  5088. /// </summary>
  5089. public void AgvFromLineTwoToClean(ushort emptyRollerNum = 0)
  5090. {
  5091. erp: if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障
  5092. {
  5093. if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
  5094. {
  5095. MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
  5096. DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
  5097. if (emptyRollerNum != 0)
  5098. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  5099. globalVar.agvArriveLineTwoLoadEmptyRoller = false;
  5100. //原料到位,agv到位,agv自行运料到清洗处
  5101. }
  5102. if (globalVar.agvArriveLineTwoLoadCom || globalVar.LineEightRobotTaskError)//上料完成
  5103. {
  5104. if (globalVar.LineEightRobotTaskError)
  5105. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  5106. if (emptyRollerNum != 0)
  5107. globalVar.rollerLineTwo.EmptyRollerNums.Remove(emptyRollerNum);
  5108. globalVar.agvArriveLineTwoLoadCom = false;
  5109. globalVar.rollerLineTwo.IsEpmtyBefore = false;
  5110. if (emptyRollerNum != 0)
  5111. MessageNotify.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
  5112. }
  5113. }
  5114. else//有故障
  5115. {
  5116. while (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1)
  5117. {
  5118. Thread.Sleep(1000);
  5119. if (globalVar.ExitLineTwoTask)
  5120. return;
  5121. }
  5122. MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
  5123. //lineAlarm = 1;
  5124. goto erp;
  5125. }
  5126. }
  5127. /// <summary>
  5128. /// 处理agv从线体3到送料到炒锅的条件
  5129. /// </summary>
  5130. /// <param name="lineAlarm"></param>
  5131. public void AgvFromLineThreeToFryPot()
  5132. {
  5133. erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
  5134. {
  5135. if ((globalVar.agvArriveLThreeUpLoad || globalVar.LineThreeRobotTaskError) && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
  5136. {
  5137. MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  5138. AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
  5139. if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
  5140. {
  5141. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
  5142. // globalVar.LThreeCurrentCookingStep++;
  5143. LThreeOutputMaterialQuene.Enqueue(materialInfo);
  5144. globalVar.agvArriveLThreeUpLoad = false;
  5145. globalVar.LThreeAgvToFryPot = true;
  5146. //原料到位,agv到位,agv自行运料到炒锅
  5147. }
  5148. }
  5149. }
  5150. else //有故障
  5151. {
  5152. while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
  5153. {
  5154. Thread.Sleep(1000);
  5155. if (globalVar.ExitLineThreeTask)
  5156. return;
  5157. }
  5158. MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  5159. // lineAlarm = 1;
  5160. goto erp;
  5161. }
  5162. }
  5163. /// <summary>
  5164. /// Agv从3号线体运空桶到清洗处
  5165. /// </summary>
  5166. public void AgvFromLineThreeToClean(ushort emptyRollerNum = 0)
  5167. {
  5168. erp: if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障
  5169. {
  5170. if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
  5171. {
  5172. MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
  5173. DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
  5174. if (emptyRollerNum != 0)
  5175. MessageNotify.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶");
  5176. globalVar.agvArriveLineThreeLoadEmptyRoller = false;
  5177. // globalVar.rollerLineThree.IsEpmtyBefore = false;
  5178. //原料到位,agv到位,agv自行运料到清洗处
  5179. }
  5180. if (globalVar.agvArriveLineThreeLoadCom || globalVar.LineNineRobotTaskError)//上料完成
  5181. {
  5182. if (globalVar.LineNineRobotTaskError)
  5183. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  5184. if (emptyRollerNum != 0)
  5185. globalVar.rollerLineThree.EmptyRollerNums.Remove(emptyRollerNum);
  5186. globalVar.agvArriveLineThreeLoadCom = false;
  5187. globalVar.rollerLineThree.IsEpmtyBefore = false;
  5188. if (emptyRollerNum != 0)
  5189. MessageNotify.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
  5190. }
  5191. }
  5192. else//有故障
  5193. {
  5194. while (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1)
  5195. {
  5196. Thread.Sleep(1000);
  5197. if (globalVar.ExitLineThreeTask)
  5198. return;
  5199. }
  5200. MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
  5201. //lineAlarm = 1;
  5202. goto erp;
  5203. }
  5204. }
  5205. /// <summary>
  5206. /// 线体到炒锅搬运任务错误码分析
  5207. /// </summary>
  5208. /// <param name="errorCode"></param>
  5209. /// <param name="num"></param>
  5210. public bool LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  5211. {
  5212. if (errorCode == "SUCCESS")
  5213. {
  5214. MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
  5215. return true;
  5216. }
  5217. else if (errorCode == "Analysis Error")
  5218. {
  5219. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  5220. return false;
  5221. }
  5222. else
  5223. {
  5224. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  5225. return false;
  5226. }
  5227. }
  5228. /// <summary>
  5229. /// 线体到清洗台搬运任务错误码分析
  5230. /// </summary>
  5231. /// <param name="errorCode"></param>
  5232. /// <param name="num"></param>
  5233. public bool LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num)
  5234. {
  5235. if (errorCode == "SUCCESS")
  5236. {
  5237. MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装空桶");
  5238. return true;
  5239. }
  5240. else if (errorCode == "Analysis Error")
  5241. {
  5242. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
  5243. return false;
  5244. }
  5245. else
  5246. {
  5247. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}");
  5248. return false;
  5249. }
  5250. }
  5251. /// <summary>
  5252. /// 清洗台到线体搬运任务错误码分析
  5253. /// </summary>
  5254. /// <param name="errorCode"></param>
  5255. /// <param name="num"></param>
  5256. public bool CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num)
  5257. {
  5258. if (errorCode == "SUCCESS")
  5259. {
  5260. MessageNotify.GetInstance.ShowRunLog($"AGV从清洗台到{num}号滚筒线卸桶");
  5261. return true;
  5262. }
  5263. else if (errorCode == "Analysis Error")
  5264. {
  5265. MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线API调用失败,请检查请求报文");
  5266. return false;
  5267. }
  5268. else
  5269. {
  5270. MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线失败,错误码:{errorCode}");
  5271. return false;
  5272. }
  5273. }
  5274. /// <summary>
  5275. /// 炒锅搬运任务错误码分析
  5276. /// </summary>
  5277. /// <param name="errorCode"></param>
  5278. /// <param name="num"></param>
  5279. public bool FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
  5280. {
  5281. if (errorCode == "SUCCESS")
  5282. {
  5283. MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号炒锅");
  5284. return true;
  5285. }
  5286. else if (errorCode == "Analysis Error")
  5287. {
  5288. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅接口调用失败,请检查");
  5289. return false;
  5290. }
  5291. else
  5292. {
  5293. MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅失败,错误码:{errorCode}");
  5294. return false;
  5295. }
  5296. }
  5297. public void AgvToLineOneLoadRoller()
  5298. {
  5299. if (AlarmHelper<AlarmInfo>.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障
  5300. {
  5301. if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && !globalVar.LoadRoller)
  5302. {
  5303. if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
  5304. {
  5305. globalVar.rollerLineOne.CanRun = false;
  5306. e: string id = Guid.NewGuid().ToString("D");//32位
  5307. 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)
  5308. goto e;
  5309. string info;
  5310. if (globalVar.LOneFryPotSerial == 1)
  5311. {
  5312. info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
  5313. }
  5314. else
  5315. {
  5316. info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id);
  5317. }
  5318. LOnerobotJobId = id;
  5319. if (LineCarryTaskErrorCodeAnalysis(info, 1))
  5320. {
  5321. globalVar.AllowAgvToLineLoadRoller = false;
  5322. globalVar.LoadRoller = true;
  5323. }
  5324. else
  5325. {
  5326. Thread.Sleep(5000);
  5327. }
  5328. }
  5329. //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  5330. //{
  5331. // globalVar.rollerLineOne.CanRun = true;
  5332. //}
  5333. //else // 工位8上面不是配方料桶或没有桶时
  5334. //{
  5335. // if (!globalVar.rollerLineOne.IsEpmtyBefore)
  5336. // {
  5337. // var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
  5338. // if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
  5339. // {
  5340. // //下发AGV去空桶线洗桶任务
  5341. // e: string id = Guid.NewGuid().ToString("D");
  5342. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  5343. // goto e;
  5344. // string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处
  5345. // LFourrobotJobId = id;
  5346. // Thread.Sleep(500);
  5347. // LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
  5348. // globalVar.rollerLineOne.IsEpmtyBefore = true;
  5349. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  5350. // }
  5351. // }
  5352. // else
  5353. // {
  5354. // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  5355. // }
  5356. //}
  5357. }
  5358. }
  5359. //else
  5360. //{
  5361. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
  5362. // // lineAlarm = -1;
  5363. //}
  5364. //// lineAlarm = 1;
  5365. }
  5366. public void AgvToLineTwoLoadRoller()
  5367. {
  5368. if (AlarmHelper<AlarmInfo>.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障
  5369. {
  5370. if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && !globalVar.LTwoLoadRoller)
  5371. {
  5372. if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
  5373. {
  5374. globalVar.rollerLineTwo.CanRun = false;
  5375. e: string id = Guid.NewGuid().ToString("D");
  5376. 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)
  5377. goto e;
  5378. string info;
  5379. if (globalVar.LTwoFryPotSerial == 2)
  5380. {
  5381. info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
  5382. }
  5383. else
  5384. {
  5385. info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id);
  5386. }
  5387. LTworobotJobId = id;
  5388. //Thread.Sleep(500);
  5389. if (LineCarryTaskErrorCodeAnalysis(info, 2))
  5390. {
  5391. globalVar.LTwoLoadRoller = true;
  5392. globalVar.AllowAgvToLineTwoLoadRoller = false;
  5393. }
  5394. else
  5395. {
  5396. Thread.Sleep(5000);
  5397. }
  5398. }
  5399. //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  5400. //{
  5401. // globalVar.rollerLineTwo.CanRun = true;
  5402. //}
  5403. }
  5404. //else// 工位8上面不是配方料桶或没有桶时
  5405. //{
  5406. // if (!globalVar.rollerLineTwo.IsEpmtyBefore)
  5407. // {
  5408. // var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
  5409. // if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  5410. // {
  5411. // //下发AGV去空桶线洗桶任务
  5412. // e: string id = Guid.NewGuid().ToString("D");
  5413. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  5414. // goto e;
  5415. // string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处
  5416. // LFiverobotJobId = id;
  5417. // Thread.Sleep(500);
  5418. // LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
  5419. // globalVar.rollerLineTwo.IsEpmtyBefore = true;
  5420. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
  5421. // }
  5422. // }
  5423. // else
  5424. // {
  5425. // AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
  5426. // }
  5427. //}
  5428. }
  5429. }
  5430. public void AgvToLineThreeLoadRoller()
  5431. {
  5432. if (AlarmHelper<AlarmInfo>.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障
  5433. {
  5434. if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && !globalVar.LThreeLoadRoller)
  5435. {
  5436. if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
  5437. {
  5438. globalVar.rollerLineThree.CanRun = false;
  5439. e: string id = Guid.NewGuid().ToString("D");
  5440. 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)
  5441. goto e;
  5442. string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  5443. LThreerobotJobId = id;
  5444. //Thread.Sleep(500);
  5445. if (LineCarryTaskErrorCodeAnalysis(info, 3))
  5446. {
  5447. globalVar.LThreeLoadRoller = true;
  5448. globalVar.AllowAgvToLineThreeLoadRoller = false;
  5449. }
  5450. else
  5451. {
  5452. Thread.Sleep(5000);
  5453. }
  5454. }
  5455. //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
  5456. //{
  5457. // globalVar.rollerLineThree.CanRun = true;
  5458. //}
  5459. //else // 工位8上面不是配方料桶或没有桶时
  5460. //{
  5461. // if (!globalVar.rollerLineThree.IsEpmtyBefore)
  5462. // {
  5463. // var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
  5464. // if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
  5465. // {
  5466. // //下发AGV去空桶线洗桶任务
  5467. // e: string id = Guid.NewGuid().ToString("D");
  5468. // if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
  5469. // goto e;
  5470. // string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处
  5471. // LSixrobotJobId = id;
  5472. // Thread.Sleep(500);
  5473. // LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
  5474. // globalVar.rollerLineThree.IsEpmtyBefore = true;
  5475. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  5476. // }
  5477. // }
  5478. // else
  5479. // {
  5480. // AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
  5481. // }
  5482. //}
  5483. }
  5484. }
  5485. //if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
  5486. //{
  5487. // if (LThreeInputMaterialQuene.Count > 0)
  5488. // {
  5489. // while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
  5490. // {
  5491. // Thread.Sleep(5);
  5492. // if (globalVar.ExitMainTask)
  5493. // return;
  5494. // }
  5495. // g: string id = Guid.NewGuid().ToString();
  5496. // if (id == LThreerobotJobId)
  5497. // goto g;
  5498. // string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
  5499. // // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
  5500. // LThreerobotJobId = id;
  5501. // Thread.Sleep(500);
  5502. // LineCarryTaskErrorCodeAnalysis(info, 3);
  5503. // }
  5504. //}
  5505. //else
  5506. //{
  5507. // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
  5508. // // lineAlarm = -1;
  5509. //}
  5510. }
  5511. /// <summary>
  5512. /// 1号线体数据下发
  5513. /// </summary>
  5514. /// <param name="count"></param>
  5515. /// <param name="materialLoc"></param>
  5516. /// <param name="materialWeight"></param>
  5517. public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
  5518. {
  5519. switch (count)
  5520. {
  5521. case 0:
  5522. DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
  5523. DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶1重量
  5524. DeviceOperate.GetInstance.WriteRealPlcData("D1200", materialOffset);//桶重1量偏差
  5525. break;
  5526. case 1:
  5527. DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
  5528. DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
  5529. DeviceOperate.GetInstance.WriteRealPlcData("D1202", materialOffset);//桶2重量偏差
  5530. break;
  5531. case 2:
  5532. DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
  5533. DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
  5534. DeviceOperate.GetInstance.WriteRealPlcData("D1204", materialOffset);//桶3重量偏差
  5535. break;
  5536. case 3:
  5537. DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
  5538. DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
  5539. DeviceOperate.GetInstance.WriteRealPlcData("D1206", materialOffset);//桶4重量偏差
  5540. break;
  5541. case 4:
  5542. DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
  5543. DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
  5544. DeviceOperate.GetInstance.WriteRealPlcData("D1208", materialOffset);//桶5重量偏差
  5545. break;
  5546. case 5:
  5547. DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
  5548. DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
  5549. DeviceOperate.GetInstance.WriteRealPlcData("D1210", materialOffset);//桶6重量偏差
  5550. break;
  5551. case 6:
  5552. DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
  5553. DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
  5554. DeviceOperate.GetInstance.WriteRealPlcData("D1212", materialOffset);//桶7重量偏差
  5555. break;
  5556. case 7:
  5557. DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
  5558. DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
  5559. DeviceOperate.GetInstance.WriteRealPlcData("D1214", materialOffset);//桶8重量偏差
  5560. break;
  5561. }
  5562. }
  5563. /// <summary>
  5564. /// 2号线体数据下发
  5565. /// </summary>
  5566. /// <param name="count"></param>
  5567. /// <param name="materialLoc"></param>
  5568. /// <param name="materialWeight"></param>
  5569. public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
  5570. {
  5571. switch (count)
  5572. {
  5573. case 0:
  5574. DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
  5575. DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
  5576. DeviceOperate.GetInstance.WriteRealPlcData("D1216", materialOffset);//桶重1量偏差
  5577. break;
  5578. case 1:
  5579. DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
  5580. DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
  5581. DeviceOperate.GetInstance.WriteRealPlcData("D1218", materialOffset);//桶重2量偏差
  5582. break;
  5583. case 2:
  5584. DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
  5585. DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
  5586. DeviceOperate.GetInstance.WriteRealPlcData("D1220", materialOffset);//桶重3量偏差
  5587. break;
  5588. case 3:
  5589. DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
  5590. DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
  5591. DeviceOperate.GetInstance.WriteRealPlcData("D1222", materialOffset);//桶重4量偏差
  5592. break;
  5593. case 4:
  5594. DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
  5595. DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
  5596. DeviceOperate.GetInstance.WriteRealPlcData("D1224", materialOffset);//桶重5量偏差
  5597. break;
  5598. case 5:
  5599. DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
  5600. DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
  5601. DeviceOperate.GetInstance.WriteRealPlcData("D1226", materialOffset);//桶重6量偏差
  5602. break;
  5603. case 6:
  5604. DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
  5605. DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
  5606. DeviceOperate.GetInstance.WriteRealPlcData("D1228", materialOffset);//桶重7量偏差
  5607. break;
  5608. case 7:
  5609. DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
  5610. DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
  5611. DeviceOperate.GetInstance.WriteRealPlcData("D1230", materialOffset);//桶重8量偏差
  5612. break;
  5613. }
  5614. }
  5615. /// <summary>
  5616. /// 3号线体数据下发
  5617. /// </summary>
  5618. /// <param name="count"></param>
  5619. /// <param name="materialLoc"></param>
  5620. /// <param name="materialWeight"></param>
  5621. public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight, float materialOffset)
  5622. {
  5623. switch (count)
  5624. {
  5625. case 0:
  5626. DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
  5627. DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶1重量
  5628. DeviceOperate.GetInstance.WriteRealPlcData("D1232", materialOffset);//桶重1量偏差
  5629. break;
  5630. case 1:
  5631. DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
  5632. DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
  5633. DeviceOperate.GetInstance.WriteRealPlcData("D1234", materialOffset);//桶重2量偏差
  5634. break;
  5635. case 2:
  5636. DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
  5637. DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
  5638. DeviceOperate.GetInstance.WriteRealPlcData("D1236", materialOffset);//桶重3量偏差
  5639. break;
  5640. case 3:
  5641. DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
  5642. DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
  5643. DeviceOperate.GetInstance.WriteRealPlcData("D1238", materialOffset);//桶重4量偏差
  5644. break;
  5645. case 4:
  5646. DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
  5647. DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
  5648. DeviceOperate.GetInstance.WriteRealPlcData("D1240", materialOffset);//桶重5量偏差
  5649. break;
  5650. case 5:
  5651. DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
  5652. DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
  5653. DeviceOperate.GetInstance.WriteRealPlcData("D1242", materialOffset);//桶重6量偏差
  5654. break;
  5655. case 6:
  5656. DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
  5657. DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
  5658. DeviceOperate.GetInstance.WriteRealPlcData("D1244", materialOffset);//桶重7量偏差
  5659. break;
  5660. case 7:
  5661. DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
  5662. DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
  5663. DeviceOperate.GetInstance.WriteRealPlcData("D1246", materialOffset);//桶重8量偏差
  5664. break;
  5665. }
  5666. }
  5667. /// <summary>
  5668. /// AGV线体进料就位信号下发至PLC
  5669. /// </summary>
  5670. public void AgvArriveLineSingelSetDown(ConcurrentQueue<MaterialInfo> queue)
  5671. {
  5672. switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
  5673. {
  5674. case 1:
  5675. case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
  5676. case 2:
  5677. case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
  5678. case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
  5679. }
  5680. }
  5681. /// <summary>
  5682. /// 炒锅滚筒信号检测
  5683. /// </summary>
  5684. //public void FryPotRollerTroubleCheck()
  5685. //{
  5686. // FryPotAlarm = 0;
  5687. // FryPotTwoAlarm = 0;
  5688. // FryPotThreeAlarm = 0;
  5689. // FryPotFourAlarm = 0;
  5690. // FryPotFiveAlarm = 0;
  5691. // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  5692. // {
  5693. // case 1:
  5694. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
  5695. // {
  5696. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  5697. // return;
  5698. // }
  5699. // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  5700. // FryPotAlarm = 1; break;
  5701. // case 2:
  5702. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
  5703. // {
  5704. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  5705. // return;
  5706. // }
  5707. // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
  5708. // FryPotTwoAlarm = 1; break;
  5709. // case 3:
  5710. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
  5711. // {
  5712. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  5713. // return;
  5714. // }
  5715. // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  5716. // FryPotThreeAlarm = 1; break;
  5717. // case 4:
  5718. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
  5719. // {
  5720. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  5721. // return;
  5722. // }
  5723. // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  5724. // FryPotFourAlarm = 1; break;
  5725. // case 5:
  5726. // if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
  5727. // {
  5728. // Thread.Sleep(5); if (globalVar.ExitMainTask)
  5729. // return;
  5730. // }
  5731. // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
  5732. // FryPotFiveAlarm = 1; break;
  5733. // }
  5734. //}
  5735. /// <summary>
  5736. /// 炒锅1,4滚筒信号检测
  5737. /// </summary>
  5738. public void FryPotOneRollerTroubleCheck()
  5739. {
  5740. FryPotAlarm = 0;
  5741. FryPotFourAlarm = 0;
  5742. switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  5743. {
  5744. case 1:
  5745. if (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
  5746. {
  5747. FryPotAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障");
  5748. }
  5749. else
  5750. {
  5751. FryPotAlarm = 1; return;
  5752. }
  5753. while (AlarmHelper<AlarmInfo>.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble == 1)
  5754. {
  5755. Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
  5756. return;
  5757. }
  5758. MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  5759. FryPotAlarm = 1; break;
  5760. case 4:
  5761. if (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble == 1)
  5762. {
  5763. Thread.Sleep(1000); if (globalVar.ExitLineOneTask)
  5764. return;
  5765. }
  5766. MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  5767. FryPotFourAlarm = 1; break;
  5768. }
  5769. }
  5770. /// <summary>
  5771. /// 炒锅2,5滚筒信号检测
  5772. /// </summary>
  5773. public void FryPotTwoRollerTroubleCheck()
  5774. {
  5775. FryPotTwoAlarm = 0;
  5776. FryPotFiveAlarm = 0;
  5777. switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
  5778. {
  5779. case 2:
  5780. if (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble == 1)
  5781. {
  5782. Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
  5783. return;
  5784. }
  5785. MessageNotify.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
  5786. FryPotTwoAlarm = 1; break;
  5787. case 5:
  5788. if (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble == 1)
  5789. {
  5790. Thread.Sleep(1000); if (globalVar.ExitLineTwoTask)
  5791. return;
  5792. }
  5793. MessageNotify.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
  5794. FryPotFiveAlarm = 1; break;
  5795. }
  5796. }
  5797. /// <summary>
  5798. /// 炒锅3滚筒信号检测
  5799. /// </summary>
  5800. public void FryPotThreeRollerTroubleCheck()
  5801. {
  5802. FryPotThreeAlarm = 0;
  5803. if (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageNotify.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble == 1)
  5804. {
  5805. Thread.Sleep(1000); if (globalVar.ExitLineThreeTask)
  5806. return;
  5807. }
  5808. MessageNotify.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
  5809. FryPotThreeAlarm = 1;
  5810. }
  5811. /// <summary>
  5812. /// PLC线体1配方数据复位功能
  5813. /// </summary>
  5814. public void PlcLineOneRecipeDataReset()
  5815. {
  5816. //复位桶号,桶重,,工序
  5817. WritePlcData("D1001", 0);
  5818. WritePlcData("D1002", 0);
  5819. WritePlcData("D1003", 0);
  5820. WritePlcData("D1004", 0);
  5821. WritePlcData("D1005", 0);
  5822. WritePlcData("D1006", 0);
  5823. WritePlcData("D1007", 0);
  5824. WritePlcData("D1008", 0);
  5825. WritePlcData("D1009", 0);
  5826. WritePlcData("D1010", 0);
  5827. WritePlcData("D1011", 0);
  5828. WritePlcData("D1012", 0);
  5829. WritePlcData("D1013", 0);
  5830. WritePlcData("D1014", 0);
  5831. WritePlcData("D1015", 0);
  5832. WritePlcData("D1016", 0);
  5833. WritePlcData("D1017", 0);
  5834. //桶偏差
  5835. DeviceOperate.GetInstance.WriteRealPlcData("D1200", 0.0F);
  5836. DeviceOperate.GetInstance.WriteRealPlcData("D1202", 0.0F);
  5837. DeviceOperate.GetInstance.WriteRealPlcData("D1204", 0.0F);
  5838. DeviceOperate.GetInstance.WriteRealPlcData("D1206", 0.0F);
  5839. DeviceOperate.GetInstance.WriteRealPlcData("D1208", 0.0F);
  5840. DeviceOperate.GetInstance.WriteRealPlcData("D1210", 0.0F);
  5841. DeviceOperate.GetInstance.WriteRealPlcData("D1212", 0.0F);
  5842. DeviceOperate.GetInstance.WriteRealPlcData("D1214", 0.0F);
  5843. }
  5844. /// <summary>
  5845. /// PLC线体2配方数据复位功能
  5846. /// </summary>
  5847. public void PlcLineTwoRecipeDataReset()
  5848. {
  5849. WritePlcData("D1018", 0);
  5850. WritePlcData("D1019", 0);
  5851. WritePlcData("D1020", 0);
  5852. WritePlcData("D1021", 0);
  5853. WritePlcData("D1022", 0);
  5854. WritePlcData("D1023", 0);
  5855. WritePlcData("D1024", 0);
  5856. WritePlcData("D1025", 0);
  5857. WritePlcData("D1026", 0);
  5858. WritePlcData("D1027", 0);
  5859. WritePlcData("D1028", 0);
  5860. WritePlcData("D1029", 0);
  5861. WritePlcData("D1030", 0);
  5862. WritePlcData("D1031", 0);
  5863. WritePlcData("D1032", 0);
  5864. WritePlcData("D1033", 0);
  5865. WritePlcData("D1034", 0);
  5866. DeviceOperate.GetInstance.WriteRealPlcData("D1216", 0.0F);
  5867. DeviceOperate.GetInstance.WriteRealPlcData("D1218", 0.0F);
  5868. DeviceOperate.GetInstance.WriteRealPlcData("D1220", 0.0F);
  5869. DeviceOperate.GetInstance.WriteRealPlcData("D1222", 0.0F);
  5870. DeviceOperate.GetInstance.WriteRealPlcData("D1224", 0.0F);
  5871. DeviceOperate.GetInstance.WriteRealPlcData("D1226", 0.0F);
  5872. DeviceOperate.GetInstance.WriteRealPlcData("D1228", 0.0F);
  5873. DeviceOperate.GetInstance.WriteRealPlcData("D1230", 0.0F);
  5874. }
  5875. /// <summary>
  5876. /// PLC线体3配方数据复位功能
  5877. /// </summary>
  5878. public void PlcLineThreeRecipeDataReset()
  5879. {
  5880. WritePlcData("D1035", 0);
  5881. WritePlcData("D1036", 0);
  5882. WritePlcData("D1037", 0);
  5883. WritePlcData("D1038", 0);
  5884. WritePlcData("D1039", 0);
  5885. WritePlcData("D1040", 0);
  5886. WritePlcData("D1041", 0);
  5887. WritePlcData("D1042", 0);
  5888. WritePlcData("D1043", 0);
  5889. WritePlcData("D1044", 0);
  5890. WritePlcData("D1045", 0);
  5891. WritePlcData("D1046", 0);
  5892. WritePlcData("D1047", 0);
  5893. WritePlcData("D1048", 0);
  5894. WritePlcData("D1049", 0);
  5895. WritePlcData("D1050", 0);
  5896. WritePlcData("D1051", 0);
  5897. DeviceOperate.GetInstance.WriteRealPlcData("D1232", 0.0F);
  5898. DeviceOperate.GetInstance.WriteRealPlcData("D1234", 0.0F);
  5899. DeviceOperate.GetInstance.WriteRealPlcData("D1236", 0.0F);
  5900. DeviceOperate.GetInstance.WriteRealPlcData("D1238", 0.0F);
  5901. DeviceOperate.GetInstance.WriteRealPlcData("D1240", 0.0F);
  5902. DeviceOperate.GetInstance.WriteRealPlcData("D1242", 0.0F);
  5903. DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F);
  5904. DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F);
  5905. }
  5906. /// <summary>
  5907. /// 累加重量计算
  5908. /// </summary>
  5909. /// <param name="collect"></param>
  5910. public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length)
  5911. {
  5912. ushort total = 0;
  5913. if (collect.Count >= length)
  5914. {
  5915. for (int i = 0; i < length; i++)
  5916. {
  5917. total += collect.ElementAt(i).TargeWeight;
  5918. }
  5919. }
  5920. return total;
  5921. }
  5922. /// <summary>
  5923. /// 炒锅配方下发
  5924. /// </summary>
  5925. /// <param name="PotNum"></param>
  5926. /// <param name="result"></param>
  5927. public void FryPotRecipeSetDown(int potNum, NewRecipeModel result)
  5928. {
  5929. lock (Pot_Lock)
  5930. {
  5931. Json<FlowProcessNames>.Read();
  5932. #region 炒锅工艺下发
  5933. int length = 0;
  5934. WritePotData(potNum,"D3920",Convert.ToUInt16(result.FlowProcess.targetWeightOffset*10));//目标重量偏差下发
  5935. if (result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == "清洗") != null)
  5936. {
  5937. WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count - 1));//工序数量
  5938. if (result.FlowProcess.fpModels.Count < 12)
  5939. {
  5940. length = result.FlowProcess.fpModels.Count - 1;
  5941. WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryTemperature * 10));
  5942. WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime * 600));
  5943. WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryWeight * 10));//炒制重量
  5944. WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).SmallFirePercent));
  5945. WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).MidFirePercent));
  5946. WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).BigFirePercent));
  5947. WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).StrongFirePercent));
  5948. WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FrySpeed * 10));
  5949. WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight*10)));//清洗目标重量
  5950. }
  5951. else
  5952. {
  5953. length = result.FlowProcess.fpModels.Count;
  5954. }
  5955. }
  5956. else//没有编辑清洗
  5957. {
  5958. length = result.FlowProcess.fpModels.Count;
  5959. WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count));//工序数量
  5960. }
  5961. for (int i = 0; i < length; i++)
  5962. {
  5963. bool can = ushort.TryParse(result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum, out ushort res);
  5964. //按工序下发数据
  5965. #region 工序1
  5966. if (i == 0)
  5967. {
  5968. if (can)//是桶号
  5969. {
  5970. //发送桶号对应的ID以及物料重量
  5971. switch (res % 100)
  5972. {
  5973. case 1: WritePotData(potNum, "D3001", 2); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  5974. case 2: WritePotData(potNum, "D3001", 3); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  5975. case 3: WritePotData(potNum, "D3001", 4); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  5976. case 4: WritePotData(potNum, "D3001", 5); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  5977. case 5: WritePotData(potNum, "D3001", 6); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  5978. case 6: WritePotData(potNum, "D3001", 7); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  5979. case 7: WritePotData(potNum, "D3001", 8); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  5980. case 8: WritePotData(potNum, "D3001", 9); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  5981. }
  5982. }
  5983. else
  5984. {
  5985. WritePotData(potNum, "D3001", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  5986. WritePotData(potNum, "D3004", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  5987. }
  5988. WritePotData(potNum, "D3002", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  5989. WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  5990. WritePotData(potNum, "D3005", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  5991. WritePotData(potNum, "D3006", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  5992. WritePotData(potNum, "D3007", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  5993. WritePotData(potNum, "D3008", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  5994. WritePotData(potNum, "D3009", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  5995. WritePotData(potNum, "D4011", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序1目标重量
  5996. continue;
  5997. }
  5998. #endregion
  5999. #region 工序2
  6000. if (i == 1)
  6001. {
  6002. if (can)//是桶号
  6003. {
  6004. //发送桶号对应的ID以及物料重量
  6005. switch (res % 100)
  6006. {
  6007. case 1: WritePotData(potNum, "D3011", 2); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6008. case 2: WritePotData(potNum, "D3011", 3); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6009. case 3: WritePotData(potNum, "D3011", 4); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6010. case 4: WritePotData(potNum, "D3011", 5); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6011. case 5: WritePotData(potNum, "D3011", 6); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6012. case 6: WritePotData(potNum, "D3011", 7); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6013. case 7: WritePotData(potNum, "D3011", 8); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6014. case 8: WritePotData(potNum, "D3011", 9); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6015. }
  6016. }
  6017. else
  6018. {
  6019. WritePotData(potNum, "D3011", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6020. WritePotData(potNum, "D3014", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6021. }
  6022. WritePotData(potNum, "D3012", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6023. WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6024. WritePotData(potNum, "D3015", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6025. WritePotData(potNum, "D3016", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6026. WritePotData(potNum, "D3017", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6027. WritePotData(potNum, "D3018", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6028. WritePotData(potNum, "D3019", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6029. WritePotData(potNum, "D4021", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序2目标重量
  6030. continue;
  6031. }
  6032. #endregion
  6033. #region 工序3
  6034. if (i == 2)
  6035. {
  6036. if (can)//是桶号
  6037. {
  6038. //发送桶号对应的ID以及物料重量
  6039. switch (res % 100)
  6040. {
  6041. case 1: WritePotData(potNum, "D3021", 2); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6042. case 2: WritePotData(potNum, "D3021", 3); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6043. case 3: WritePotData(potNum, "D3021", 4); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6044. case 4: WritePotData(potNum, "D3021", 5); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6045. case 5: WritePotData(potNum, "D3021", 6); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6046. case 6: WritePotData(potNum, "D3021", 7); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6047. case 7: WritePotData(potNum, "D3021", 8); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6048. case 8: WritePotData(potNum, "D3021", 9); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6049. }
  6050. }
  6051. else
  6052. {
  6053. WritePotData(potNum, "D3021", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6054. WritePotData(potNum, "D3024", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6055. }
  6056. WritePotData(potNum, "D3022", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6057. WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6058. WritePotData(potNum, "D3025", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6059. WritePotData(potNum, "D3026", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6060. WritePotData(potNum, "D3027", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6061. WritePotData(potNum, "D3028", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6062. WritePotData(potNum, "D3029", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6063. WritePotData(potNum, "D4031", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序3目标重量
  6064. continue;
  6065. }
  6066. #endregion
  6067. #region 工序4
  6068. if (i == 3)
  6069. {
  6070. if (can)//是桶号
  6071. {
  6072. //发送桶号对应的ID以及物料重量
  6073. switch (res % 100)
  6074. {
  6075. case 1: WritePotData(potNum, "D3031", 2); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6076. case 2: WritePotData(potNum, "D3031", 3); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6077. case 3: WritePotData(potNum, "D3031", 4); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6078. case 4: WritePotData(potNum, "D3031", 5); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6079. case 5: WritePotData(potNum, "D3031", 6); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6080. case 6: WritePotData(potNum, "D3031", 7); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6081. case 7: WritePotData(potNum, "D3031", 8); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6082. case 8: WritePotData(potNum, "D3031", 9); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6083. }
  6084. }
  6085. else
  6086. {
  6087. WritePotData(potNum, "D3031", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6088. WritePotData(potNum, "D3034", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6089. }
  6090. WritePotData(potNum, "D3032", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6091. WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6092. WritePotData(potNum, "D3035", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6093. WritePotData(potNum, "D3036", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6094. WritePotData(potNum, "D3037", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6095. WritePotData(potNum, "D3038", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6096. WritePotData(potNum, "D3039", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6097. WritePotData(potNum, "D4041", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序4目标重量
  6098. continue;
  6099. }
  6100. #endregion
  6101. #region 工序5
  6102. if (i == 4)
  6103. {
  6104. if (can)//是桶号
  6105. {
  6106. //发送桶号对应的ID以及物料重量
  6107. switch (res % 100)
  6108. {
  6109. case 1: WritePotData(potNum, "D3041", 2); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6110. case 2: WritePotData(potNum, "D3041", 3); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6111. case 3: WritePotData(potNum, "D3041", 4); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6112. case 4: WritePotData(potNum, "D3041", 5); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6113. case 5: WritePotData(potNum, "D3041", 6); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6114. case 6: WritePotData(potNum, "D3041", 7); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6115. case 7: WritePotData(potNum, "D3041", 8); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6116. case 8: WritePotData(potNum, "D3041", 9); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6117. }
  6118. }
  6119. else
  6120. {
  6121. WritePotData(potNum, "D3041", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6122. WritePotData(potNum, "D3044", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6123. }
  6124. WritePotData(potNum, "D3042", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6125. WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6126. WritePotData(potNum, "D3045", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6127. WritePotData(potNum, "D3046", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6128. WritePotData(potNum, "D3047", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6129. WritePotData(potNum, "D3048", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6130. WritePotData(potNum, "D3049", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6131. WritePotData(potNum, "D4051", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序5目标重量
  6132. continue;
  6133. }
  6134. #endregion
  6135. #region 工序6
  6136. if (i == 5)
  6137. {
  6138. if (can)//是桶号
  6139. {
  6140. //发送桶号对应的ID以及物料重量
  6141. switch (res % 100)
  6142. {
  6143. case 1: WritePotData(potNum, "D3051", 2); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6144. case 2: WritePotData(potNum, "D3051", 3); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6145. case 3: WritePotData(potNum, "D3051", 4); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6146. case 4: WritePotData(potNum, "D3051", 5); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6147. case 5: WritePotData(potNum, "D3051", 6); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6148. case 6: WritePotData(potNum, "D3051", 7); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6149. case 7: WritePotData(potNum, "D3051", 8); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6150. case 8: WritePotData(potNum, "D3051", 9); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6151. }
  6152. }
  6153. else
  6154. {
  6155. WritePotData(potNum, "D3051", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6156. WritePotData(potNum, "D3054", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6157. }
  6158. WritePotData(potNum, "D3052", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6159. WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6160. WritePotData(potNum, "D3055", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6161. WritePotData(potNum, "D3056", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6162. WritePotData(potNum, "D3057", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6163. WritePotData(potNum, "D3058", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6164. WritePotData(potNum, "D3059", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6165. WritePotData(potNum, "D4061", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序6目标重量
  6166. continue;
  6167. }
  6168. #endregion
  6169. #region 工序7
  6170. if (i == 6)
  6171. {
  6172. if (can)//是桶号
  6173. {
  6174. //发送桶号对应的ID以及物料重量
  6175. switch (res % 100)
  6176. {
  6177. case 1: WritePotData(potNum, "D3061", 2); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6178. case 2: WritePotData(potNum, "D3061", 3); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6179. case 3: WritePotData(potNum, "D3061", 4); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6180. case 4: WritePotData(potNum, "D3061", 5); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6181. case 5: WritePotData(potNum, "D3061", 6); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6182. case 6: WritePotData(potNum, "D3061", 7); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6183. case 7: WritePotData(potNum, "D3061", 8); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6184. case 8: WritePotData(potNum, "D3061", 9); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6185. }
  6186. }
  6187. else
  6188. {
  6189. WritePotData(potNum, "D3061", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6190. WritePotData(potNum, "D3064", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6191. }
  6192. WritePotData(potNum, "D3062", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6193. WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6194. WritePotData(potNum, "D3065", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6195. WritePotData(potNum, "D3066", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6196. WritePotData(potNum, "D3067", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6197. WritePotData(potNum, "D3068", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6198. WritePotData(potNum, "D3069", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6199. WritePotData(potNum, "D4071", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序7目标重量
  6200. continue;
  6201. }
  6202. #endregion
  6203. #region 工序8
  6204. if (i == 7)
  6205. {
  6206. if (can)//是桶号
  6207. {
  6208. //发送桶号对应的ID以及物料重量
  6209. switch (res % 100)
  6210. {
  6211. case 1: WritePotData(potNum, "D3071", 2); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6212. case 2: WritePotData(potNum, "D3071", 3); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6213. case 3: WritePotData(potNum, "D3071", 4); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6214. case 4: WritePotData(potNum, "D3071", 5); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6215. case 5: WritePotData(potNum, "D3071", 6); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6216. case 6: WritePotData(potNum, "D3071", 7); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6217. case 7: WritePotData(potNum, "D3071", 8); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6218. case 8: WritePotData(potNum, "D3071", 9); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6219. }
  6220. }
  6221. else
  6222. {
  6223. WritePotData(potNum, "D3071", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6224. WritePotData(potNum, "D3074", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6225. }
  6226. WritePotData(potNum, "D3072", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6227. WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6228. WritePotData(potNum, "D3075", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6229. WritePotData(potNum, "D3076", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6230. WritePotData(potNum, "D3077", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6231. WritePotData(potNum, "D3078", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6232. WritePotData(potNum, "D3079", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6233. WritePotData(potNum, "D4081", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序8目标重量
  6234. continue;
  6235. }
  6236. #endregion
  6237. #region 工序9
  6238. if (i == 8)
  6239. {
  6240. if (can)//是桶号
  6241. {
  6242. //发送桶号对应的ID以及物料重量
  6243. switch (res % 100)
  6244. {
  6245. case 1: WritePotData(potNum, "D3081", 2); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6246. case 2: WritePotData(potNum, "D3081", 3); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6247. case 3: WritePotData(potNum, "D3081", 4); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6248. case 4: WritePotData(potNum, "D3081", 5); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6249. case 5: WritePotData(potNum, "D3081", 6); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6250. case 6: WritePotData(potNum, "D3081", 7); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6251. case 7: WritePotData(potNum, "D3081", 8); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6252. case 8: WritePotData(potNum, "D3081", 9); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6253. }
  6254. }
  6255. else
  6256. {
  6257. WritePotData(potNum, "D3081", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6258. WritePotData(potNum, "D3084", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6259. }
  6260. WritePotData(potNum, "D3082", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6261. WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6262. WritePotData(potNum, "D3085", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6263. WritePotData(potNum, "D3086", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6264. WritePotData(potNum, "D3087", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6265. WritePotData(potNum, "D3088", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6266. WritePotData(potNum, "D3089", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6267. WritePotData(potNum, "D4091", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序9目标重量
  6268. continue;
  6269. }
  6270. #endregion
  6271. #region 工序10
  6272. if (i == 9)
  6273. {
  6274. if (can)//是桶号
  6275. {
  6276. //发送桶号对应的ID以及物料重量
  6277. switch (res % 100)
  6278. {
  6279. case 1: WritePotData(potNum, "D3091", 2); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6280. case 2: WritePotData(potNum, "D3091", 3); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6281. case 3: WritePotData(potNum, "D3091", 4); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6282. case 4: WritePotData(potNum, "D3091", 5); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6283. case 5: WritePotData(potNum, "D3091", 6); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6284. case 6: WritePotData(potNum, "D3091", 7); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6285. case 7: WritePotData(potNum, "D3091", 8); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6286. case 8: WritePotData(potNum, "D3091", 9); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6287. }
  6288. }
  6289. else
  6290. {
  6291. WritePotData(potNum, "D3091", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6292. WritePotData(potNum, "D3094", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6293. }
  6294. WritePotData(potNum, "D3092", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6295. WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6296. WritePotData(potNum, "D3095", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6297. WritePotData(potNum, "D3096", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6298. WritePotData(potNum, "D3097", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6299. WritePotData(potNum, "D3098", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6300. WritePotData(potNum, "D3099", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6301. WritePotData(potNum, "D4101", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序10目标重量
  6302. continue;
  6303. }
  6304. #endregion
  6305. #region 工序11
  6306. if (i == 10)
  6307. {
  6308. if (can)//是桶号
  6309. {
  6310. //发送桶号对应的ID以及物料重量
  6311. switch (res % 100)
  6312. {
  6313. case 1: WritePotData(potNum, "D3101", 2); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6314. case 2: WritePotData(potNum, "D3101", 3); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6315. case 3: WritePotData(potNum, "D3101", 4); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6316. case 4: WritePotData(potNum, "D3101", 5); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6317. case 5: WritePotData(potNum, "D3101", 6); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6318. case 6: WritePotData(potNum, "D3101", 7); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6319. case 7: WritePotData(potNum, "D3101", 8); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6320. case 8: WritePotData(potNum, "D3101", 9); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6321. }
  6322. }
  6323. else
  6324. {
  6325. WritePotData(potNum, "D3101", Convert.ToUInt16(Json<FlowProcessNames>.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum]));
  6326. WritePotData(potNum, "D3104", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6327. }
  6328. WritePotData(potNum, "D3102", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6329. WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6330. WritePotData(potNum, "D3105", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6331. WritePotData(potNum, "D3106", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6332. WritePotData(potNum, "D3107", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6333. WritePotData(potNum, "D3108", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6334. WritePotData(potNum, "D3109", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6335. WritePotData(potNum, "D4111", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序11目标重量
  6336. continue;
  6337. }
  6338. #endregion
  6339. #region 工序12
  6340. if (i == 11)
  6341. {
  6342. //if (can)//是桶号
  6343. //{
  6344. // //发送桶号对应的ID以及物料重量
  6345. // switch (res % 100)
  6346. // {
  6347. // case 1: WritePotData(potNum, "D3111", 2); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break;
  6348. // case 2: WritePotData(potNum, "D3111", 3); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break;
  6349. // case 3: WritePotData(potNum, "D3111", 4); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break;
  6350. // case 4: WritePotData(potNum, "D3111", 5); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break;
  6351. // case 5: WritePotData(potNum, "D3111", 6); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break;
  6352. // case 6: WritePotData(potNum, "D3111", 7); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break;
  6353. // case 7: WritePotData(potNum, "D3111", 8); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break;
  6354. // case 8: WritePotData(potNum, "D3111", 9); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break;
  6355. // }
  6356. //}
  6357. //else
  6358. //{
  6359. //}
  6360. if (result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum == "清洗")
  6361. {
  6362. WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10));
  6363. WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600));
  6364. WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量
  6365. WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent));
  6366. WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent));
  6367. WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent));
  6368. WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent));
  6369. WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10));
  6370. WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight * 10)));//清洗目标重量
  6371. }
  6372. continue;
  6373. }
  6374. #endregion
  6375. }
  6376. #endregion
  6377. }
  6378. }
  6379. /// <summary>
  6380. /// 清除炒锅工艺数据
  6381. /// </summary>
  6382. /// <param name="PotNum"></param>
  6383. public void ResetPotData(int PotNum)
  6384. {
  6385. lock (this)
  6386. {
  6387. if (PotNum == 1 || PotNum == 2 || PotNum == 3 || PotNum == 4 || PotNum == 5)
  6388. {
  6389. for (int i = 1; i < 10; i++)
  6390. {
  6391. WritePotData(PotNum, "D300" + i, 0);
  6392. }
  6393. for (int i = 11; i < 20; i++)
  6394. {
  6395. WritePotData(PotNum, "D30" + i, 0);
  6396. }
  6397. for (int i = 21; i < 30; i++)
  6398. {
  6399. WritePotData(PotNum, "D30" + i, 0);
  6400. }
  6401. for (int i = 31; i < 40; i++)
  6402. {
  6403. WritePotData(PotNum, "D30" + i, 0);
  6404. }
  6405. for (int i = 41; i < 50; i++)
  6406. {
  6407. WritePotData(PotNum, "D30" + i, 0);
  6408. }
  6409. for (int i = 51; i < 60; i++)
  6410. {
  6411. WritePotData(PotNum, "D30" + i, 0);
  6412. }
  6413. for (int i = 61; i < 70; i++)
  6414. {
  6415. WritePotData(PotNum, "D30" + i, 0);
  6416. }
  6417. for (int i = 71; i < 80; i++)
  6418. {
  6419. WritePotData(PotNum, "D30" + i, 0);
  6420. }
  6421. for (int i = 81; i < 90; i++)
  6422. {
  6423. WritePotData(PotNum, "D30" + i, 0);
  6424. }
  6425. for (int i = 91; i < 100; i++)
  6426. {
  6427. WritePotData(PotNum, "D30" + i, 0);
  6428. }
  6429. for (int i = 101; i < 110; i++)
  6430. {
  6431. WritePotData(PotNum, "D3" + i, 0);
  6432. }
  6433. #region 目标重量清零
  6434. for (int i = 1; i < 10; i++)
  6435. {
  6436. WritePotData(PotNum, "D40" + i + "1", 0);
  6437. }
  6438. for (int i = 0; i < 3; i++)
  6439. {
  6440. WritePotData(PotNum, "D41" + i + "1", 0);
  6441. }
  6442. #endregion
  6443. WritePotData(PotNum, "D3120", 0);
  6444. WritePotData(PotNum,"D3920",0);//目标重量清零
  6445. }
  6446. }
  6447. }
  6448. int PotOnestep = 0;
  6449. int PotFourstep = 0;
  6450. int PotTwostep = 0;
  6451. int PotFivestep = 0;
  6452. int PotThreestep = 0;
  6453. public void LOneFryPotStepDisplay()
  6454. {
  6455. try
  6456. {
  6457. if (PotOnestep != globalVar.fryPotOne.ProcessStep && globalVar.fryPotOne.ProcessStep != 0 && potOneCurrentRecipe != null)
  6458. {
  6459. if (globalVar.fryPotOne.ProcessStep == 20)
  6460. {
  6461. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
  6462. }
  6463. else
  6464. {
  6465. if (potOneCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotOne.ProcessStep != 12 && globalVar.fryPotOne.ProcessStep != 13)
  6466. {
  6467. try
  6468. {
  6469. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = potOneCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotOne.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
  6470. }
  6471. catch (Exception)
  6472. {
  6473. //throw;
  6474. }
  6475. }
  6476. else if (globalVar.fryPotOne.ProcessStep == 12)
  6477. {
  6478. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
  6479. }
  6480. globalVar.LOneCurrentCookingStep++;
  6481. }
  6482. PotOnestep = globalVar.fryPotOne.ProcessStep;
  6483. }
  6484. if (PotFourstep != globalVar.fryPotFour.ProcessStep && globalVar.fryPotFour.ProcessStep != 0 && potFourCurrentRecipe != null)
  6485. {
  6486. if (globalVar.fryPotFour.ProcessStep == 20)
  6487. {
  6488. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
  6489. }
  6490. else
  6491. {
  6492. if (potFourCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFour.ProcessStep != 12 && globalVar.fryPotFour.ProcessStep != 13)
  6493. {
  6494. try
  6495. {
  6496. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = potFourCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFour.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
  6497. }
  6498. catch (Exception)
  6499. {
  6500. // throw;
  6501. }
  6502. }
  6503. else if (globalVar.fryPotFour.ProcessStep == 12)
  6504. {
  6505. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
  6506. }
  6507. globalVar.LFourCurrentCookingStep++;
  6508. }
  6509. PotFourstep = globalVar.fryPotFour.ProcessStep;
  6510. }
  6511. }
  6512. catch (Exception)
  6513. {
  6514. // throw;
  6515. }
  6516. }
  6517. public void LTwoFryPotStepDisplay()
  6518. {
  6519. try
  6520. {
  6521. if (PotTwostep != globalVar.fryPotTwo.ProcessStep && globalVar.fryPotTwo.ProcessStep != 0 && potTwoCurrentRecipe != null)
  6522. {
  6523. if (globalVar.fryPotTwo.ProcessStep == 20)
  6524. {
  6525. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
  6526. }
  6527. else
  6528. {
  6529. if (potTwoCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotTwo.ProcessStep != 12 && globalVar.fryPotTwo.ProcessStep != 13)
  6530. {
  6531. try
  6532. {
  6533. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = potTwoCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotTwo.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
  6534. }
  6535. catch (Exception)
  6536. {
  6537. //throw;
  6538. }
  6539. }
  6540. else if (globalVar.fryPotTwo.ProcessStep == 12)
  6541. {
  6542. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
  6543. }
  6544. globalVar.LTwoCurrentCookingStep++;
  6545. }
  6546. PotTwostep = globalVar.fryPotTwo.ProcessStep;
  6547. }
  6548. if (PotFivestep != globalVar.fryPotFive.ProcessStep && globalVar.fryPotFive.ProcessStep != 0 && potFiveCurrentRecipe != null)
  6549. {
  6550. if (globalVar.fryPotFive.ProcessStep == 20)
  6551. {
  6552. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
  6553. globalVar.LFiveCurrentCookingStep++;
  6554. }
  6555. else
  6556. {
  6557. if (potFiveCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFive.ProcessStep != 12 && globalVar.fryPotFive.ProcessStep != 13)
  6558. {
  6559. try
  6560. {
  6561. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = potFiveCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFive.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
  6562. }
  6563. catch (Exception)
  6564. {
  6565. //throw;
  6566. }
  6567. }
  6568. else if (globalVar.fryPotFive.ProcessStep == 12)
  6569. {
  6570. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
  6571. }
  6572. globalVar.LFiveCurrentCookingStep++;
  6573. }
  6574. PotFivestep = globalVar.fryPotFive.ProcessStep;
  6575. }
  6576. }
  6577. catch (Exception)
  6578. {
  6579. //throw;
  6580. }
  6581. }
  6582. public void LThreeFryPotStepDisplay()
  6583. {
  6584. try
  6585. {
  6586. if (PotThreestep != globalVar.fryPotThree.ProcessStep && globalVar.fryPotThree.ProcessStep != 0 && potThreeCurrentRecipe != null)
  6587. {
  6588. if (globalVar.fryPotThree.ProcessStep == 20)
  6589. {
  6590. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); }));
  6591. }
  6592. else
  6593. {
  6594. if (potThreeCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotThree.ProcessStep != 12 && globalVar.fryPotThree.ProcessStep != 13)
  6595. {
  6596. try
  6597. {
  6598. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = potThreeCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotThree.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); }));
  6599. }
  6600. catch (Exception)
  6601. {
  6602. //throw;
  6603. }
  6604. }
  6605. else if (globalVar.fryPotThree.ProcessStep == 12)
  6606. {
  6607. Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); }));
  6608. }
  6609. globalVar.LThreeCurrentCookingStep++;
  6610. }
  6611. PotThreestep = globalVar.fryPotThree.ProcessStep;
  6612. }
  6613. }
  6614. catch (Exception)
  6615. {
  6616. //throw;
  6617. }
  6618. }
  6619. }
  6620. }