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

DeviceOperate.cs 27 KiB

2 年前
1年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. 
  2. using BPASmartClient.CustomResource.Pages.Model;
  3. using BPA.Helper;
  4. using BPASmartClient.Modbus;
  5. using FryPot_DosingSystem.Model;
  6. using System;
  7. using System.Collections.Concurrent;
  8. using System.Collections.Generic;
  9. using System.Collections.ObjectModel;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading;
  13. using System.Threading.Tasks;
  14. namespace FryPot_DosingSystem.Control
  15. {
  16. internal class DeviceOperate
  17. {
  18. private static DeviceOperate _instance;
  19. public static DeviceOperate GetInstance => _instance ??(_instance= new DeviceOperate());
  20. public bool IsConfig { get; set; }//设备plc数据是否配置
  21. ModbusTcp modbus = new ModbusTcp();//滚筒线Modbus通讯对象
  22. ModbusTcp fryOneModbus = new ModbusTcp();//炒锅1Modbus通讯对象
  23. ModbusTcp fryTwoModbus = new ModbusTcp();//炒锅2Modbus通讯对象
  24. ModbusTcp fryThreeModbus = new ModbusTcp();//炒锅3Modbus通讯对象
  25. ModbusTcp fryFourModbus = new ModbusTcp();//炒锅4Modbus通讯对象
  26. ModbusTcp fryFiveModbus = new ModbusTcp();//炒锅5Modbus通讯对象
  27. // private string Ip { get; set; }
  28. // private string Port { get; set; }
  29. public bool Connected { get; set; }
  30. public bool FryOneConnected { get; set; }
  31. public bool FryTwoConnected { get; set; }
  32. public bool FryThreeConnected { get; set; }
  33. public bool FryFourConnected { get; set; }
  34. public bool FryFiveConnected { get; set; }
  35. // private string DeviceName { get; set; }
  36. public ConcurrentDictionary<string, object> Data { get; set; } = new ConcurrentDictionary<string, object>();
  37. public ConcurrentDictionary<string, object> FryOneData { get; set; } = new ConcurrentDictionary<string, object>();
  38. public ConcurrentDictionary<string, object> FryTwoData { get; set; } = new ConcurrentDictionary<string, object>();
  39. public ConcurrentDictionary<string, object> FryThreeData { get; set; } = new ConcurrentDictionary<string, object>();
  40. public ConcurrentDictionary<string, object> FryFourData { get; set; } = new ConcurrentDictionary<string, object>();
  41. public ConcurrentDictionary<string, object> FryFiveData { get; set; } = new ConcurrentDictionary<string, object>();
  42. public ObservableCollection<PlcVariableModel> Variables { get; set; } = new ObservableCollection<PlcVariableModel>();
  43. public ObservableCollection<PlcVariableModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableModel>();
  44. public ObservableCollection<PlcVariableModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableModel>();
  45. public ObservableCollection<PlcVariableModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableModel>();
  46. public ObservableCollection<PlcVariableModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableModel>();
  47. public ObservableCollection<PlcVariableModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableModel>();
  48. public DeviceOperate()
  49. {
  50. Init();
  51. Connect();
  52. ReadData();
  53. }
  54. public void Init()
  55. {
  56. Variables.Clear();
  57. FryOneVariables.Clear();
  58. FryTwoVariables.Clear();
  59. FryThreeVariables.Clear();
  60. FryFourVariables.Clear();
  61. FryFiveVariables.Clear();
  62. Json<PlcVariableInfoManage>.Read();
  63. if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count > 0)
  64. {
  65. try
  66. {
  67. if (Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"].Count > 0)
  68. {
  69. //foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒运输线"])
  70. //{
  71. // Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  72. //}
  73. foreach (KeyValuePair<string, ObservableCollection<PlcVariableInfoModel>> dic in Json<PlcVariableInfoManage>.Data.VariablesInfo)
  74. {
  75. if (string.Equals(dic.Key, "滚筒输送线"))
  76. {
  77. foreach (var item in dic.Value)
  78. {
  79. Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  80. }
  81. }
  82. if (string.Equals(dic.Key, "炒锅1"))
  83. {
  84. foreach (var item in dic.Value)
  85. {
  86. FryOneVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  87. }
  88. }
  89. if (string.Equals(dic.Key, "炒锅2"))
  90. {
  91. foreach (var item in dic.Value)
  92. {
  93. FryTwoVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  94. }
  95. }
  96. if (string.Equals(dic.Key, "炒锅3"))
  97. {
  98. foreach (var item in dic.Value)
  99. {
  100. FryThreeVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  101. }
  102. }
  103. if (string.Equals(dic.Key, "炒锅4"))
  104. {
  105. foreach (var item in dic.Value)
  106. {
  107. FryFourVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  108. }
  109. }
  110. if (string.Equals(dic.Key, "炒锅5"))
  111. {
  112. foreach (var item in dic.Value)
  113. {
  114. FryFiveVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
  115. }
  116. }
  117. }
  118. }
  119. IsConfig = true;
  120. MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载成功");
  121. }
  122. catch (Exception)
  123. {
  124. IsConfig = false;
  125. MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载错误,请重新配置并重启软件");
  126. //throw;
  127. }
  128. }
  129. else
  130. {
  131. IsConfig = false;
  132. MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载失败:文件无数据,请重新配置并重启软件");
  133. }
  134. //消息注册
  135. modbus.ShowEx += new Action<string>((s) =>
  136. {
  137. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  138. });
  139. fryOneModbus.ShowEx += new Action<string>((s) =>
  140. {
  141. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  142. });
  143. fryTwoModbus.ShowEx += new Action<string>((s) =>
  144. {
  145. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  146. });
  147. fryThreeModbus.ShowEx += new Action<string>((s) =>
  148. {
  149. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  150. });
  151. fryFourModbus.ShowEx += new Action<string>((s) =>
  152. {
  153. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  154. });
  155. fryFiveModbus.ShowEx += new Action<string>((s) =>
  156. {
  157. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  158. });
  159. modbus.Show += new Action<string>((s) =>
  160. {
  161. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  162. });
  163. fryOneModbus.Show += new Action<string>((s) =>
  164. {
  165. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  166. });
  167. fryTwoModbus.Show += new Action<string>((s) =>
  168. {
  169. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  170. });
  171. fryThreeModbus.Show += new Action<string>((s) =>
  172. {
  173. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  174. });
  175. fryFourModbus.Show += new Action<string>((s) =>
  176. {
  177. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  178. });
  179. fryFiveModbus.Show += new Action<string>((s) =>
  180. {
  181. if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
  182. });
  183. }
  184. public void Connect()
  185. {
  186. if (IsConfig)
  187. {
  188. Json<DeviceManage>.Read();
  189. DeviceManage devices = Json<DeviceManage>.Data;
  190. if (devices != null)
  191. {
  192. if (devices.Devices.Count > 0)
  193. {
  194. for (int i = 0; i < devices.Devices.Count; i++)
  195. {
  196. string Ip = devices.Devices[i].Ip;
  197. string Port = devices.Devices[i].Port;
  198. string DeviceName = devices.Devices[i].DeviceName;
  199. switch (DeviceName)
  200. {
  201. case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  202. case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  203. case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  204. case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  205. case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  206. case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break;
  207. }
  208. }
  209. if (modbus.Connected)
  210. MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功");
  211. if (fryOneModbus.Connected)
  212. MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功");
  213. if (fryTwoModbus.Connected)
  214. MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功");
  215. if (fryThreeModbus.Connected)
  216. MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功");
  217. if (fryFourModbus.Connected)
  218. MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功");
  219. if (fryFiveModbus.Connected)
  220. MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功");
  221. }
  222. }
  223. }
  224. }
  225. public void ReadData()
  226. {
  227. if (IsConfig)
  228. {
  229. TaskManage.GetInstance.StartLong(new Action(() =>
  230. {
  231. //滚筒线
  232. try
  233. {
  234. Connected = modbus.Connected;
  235. if (Connected)
  236. {
  237. foreach (var item in Variables)
  238. {
  239. var res = modbus.Read(item.Address, item.Length);//读取plc数据
  240. if (Data.ContainsKey(item.Address))
  241. {
  242. Data[item.Address] = res;
  243. }
  244. else
  245. {
  246. Data.TryAdd(item.Address, res);
  247. }
  248. }
  249. }
  250. else
  251. {
  252. DeviceManage devices = Json<DeviceManage>.Data;
  253. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "滚筒输送线");
  254. if (res != null)
  255. modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  256. Thread.Sleep(10000);
  257. }
  258. }
  259. catch (Exception)
  260. {
  261. // throw;
  262. }
  263. Thread.Sleep(10);
  264. }), $"滚筒线实时数据读取线程");
  265. TaskManage.GetInstance.StartLong(new Action(() =>
  266. {
  267. try
  268. {
  269. //炒锅1
  270. FryOneConnected = fryOneModbus.Connected;
  271. if (FryOneConnected)
  272. {
  273. foreach (var item in FryOneVariables)
  274. {
  275. var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据
  276. if (FryOneData.ContainsKey(item.Address))
  277. {
  278. FryOneData[item.Address] = res;
  279. }
  280. else
  281. {
  282. FryOneData.TryAdd(item.Address, res);
  283. }
  284. }
  285. //Thread.Sleep(50);
  286. }
  287. else
  288. {
  289. DeviceManage devices = Json<DeviceManage>.Data;
  290. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1");
  291. if (res != null)
  292. fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  293. Thread.Sleep(10000);
  294. }
  295. }
  296. catch (Exception)
  297. {
  298. //throw;
  299. }
  300. Thread.Sleep(10);
  301. }), $"炒锅1实时数据读取线程");
  302. TaskManage.GetInstance.StartLong(new Action(() =>
  303. {
  304. try
  305. {
  306. //炒锅2
  307. FryTwoConnected = fryTwoModbus.Connected;
  308. if (FryTwoConnected)
  309. {
  310. foreach (var item in FryTwoVariables)
  311. {
  312. var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据
  313. if (FryTwoData.ContainsKey(item.Address))
  314. {
  315. FryTwoData[item.Address] = res;
  316. }
  317. else
  318. {
  319. FryTwoData.TryAdd(item.Address, res);
  320. }
  321. }
  322. }
  323. else
  324. {
  325. DeviceManage devices = Json<DeviceManage>.Data;
  326. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2");
  327. if (res != null)
  328. fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  329. Thread.Sleep(10000);
  330. }
  331. }
  332. catch (Exception)
  333. {
  334. //throw;
  335. }
  336. Thread.Sleep(10);
  337. }), $"炒锅2实时数据读取线程");
  338. TaskManage.GetInstance.StartLong(new Action(() =>
  339. {
  340. //炒锅3
  341. try
  342. {
  343. FryThreeConnected = fryThreeModbus.Connected;
  344. if (FryThreeConnected)
  345. {
  346. foreach (var item in FryThreeVariables)
  347. {
  348. var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据
  349. if (FryThreeData.ContainsKey(item.Address))
  350. {
  351. FryThreeData[item.Address] = res;
  352. }
  353. else
  354. {
  355. FryThreeData.TryAdd(item.Address, res);
  356. }
  357. }
  358. //Thread.Sleep(50);
  359. }
  360. else
  361. {
  362. DeviceManage devices = Json<DeviceManage>.Data;
  363. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3");
  364. if (res != null)
  365. fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  366. Thread.Sleep(10000);
  367. }
  368. }
  369. catch (Exception)
  370. {
  371. //throw;
  372. }
  373. Thread.Sleep(10);
  374. }), $"炒锅3实时数据读取线程");
  375. TaskManage.GetInstance.StartLong(new Action(() =>
  376. {
  377. try
  378. {
  379. //炒锅4
  380. FryFourConnected = fryFourModbus.Connected;
  381. if (FryFourConnected)
  382. {
  383. foreach (var item in FryFourVariables)
  384. {
  385. var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据
  386. if (FryFourData.ContainsKey(item.Address))
  387. {
  388. FryFourData[item.Address] = res;
  389. }
  390. else
  391. {
  392. FryFourData.TryAdd(item.Address, res);
  393. }
  394. }
  395. //Thread.Sleep(50);
  396. }
  397. else
  398. {
  399. DeviceManage devices = Json<DeviceManage>.Data;
  400. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4");
  401. if (res != null)
  402. fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  403. Thread.Sleep(10000);
  404. }
  405. }
  406. catch (Exception)
  407. {
  408. //throw;
  409. }
  410. Thread.Sleep(10);
  411. }), $"炒锅4实时数据读取线程");
  412. TaskManage.GetInstance.StartLong(new Action(() =>
  413. {
  414. try
  415. {
  416. //炒锅5
  417. FryFiveConnected = fryFiveModbus.Connected;
  418. if (FryFiveConnected)
  419. {
  420. foreach (var item in FryFiveVariables)
  421. {
  422. var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据
  423. if (FryFiveData.ContainsKey(item.Address))
  424. {
  425. FryFiveData[item.Address] = res;
  426. }
  427. else
  428. {
  429. FryFiveData.TryAdd(item.Address, res);
  430. }
  431. }
  432. // Thread.Sleep(50);
  433. }
  434. else
  435. {
  436. DeviceManage devices = Json<DeviceManage>.Data;
  437. var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5");
  438. if (res != null)
  439. fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port));
  440. Thread.Sleep(10000);
  441. }
  442. }
  443. catch (Exception)
  444. {
  445. // throw;
  446. }
  447. Thread.Sleep(10);
  448. }), $"炒锅5实时数据读取线程");
  449. }
  450. }
  451. /// <summary>
  452. /// 滚筒线写ushort数据
  453. /// </summary>
  454. /// <param name="address"></param>
  455. /// <param name="value"></param>
  456. public void WritePlcData(string address, ushort value)
  457. {
  458. lock (this)
  459. {
  460. modbus.Write(address, value);
  461. }
  462. }
  463. /// <summary>
  464. /// 滚筒线写float数据
  465. /// </summary>
  466. /// <param name="address"></param>
  467. /// <param name="value"></param>
  468. public void WriteRealPlcData(string address, float value)
  469. {
  470. lock (this)
  471. {
  472. modbus.SetReal(address,value);
  473. }
  474. }
  475. /// <summary>
  476. /// 炒锅1工艺数据
  477. /// </summary>
  478. /// <param name="address"></param>
  479. /// <param name="value"></param>
  480. public void WritePotOnePlcData(string address,ushort value )
  481. {
  482. fryOneModbus.Write(address,value);
  483. }
  484. /// <summary>
  485. /// 炒锅1工艺目标重量偏差
  486. /// </summary>
  487. /// <param name="address"></param>
  488. /// <param name="value"></param>
  489. public void WritePotOneRealPlcData(string address, float value)
  490. {
  491. fryOneModbus.SetReal(address, value);
  492. }
  493. /// <summary>
  494. /// 炒锅2工艺数据
  495. /// </summary>
  496. /// <param name="address"></param>
  497. /// <param name="value"></param>
  498. public void WritePotTwoPlcData(string address, ushort value)
  499. {
  500. fryTwoModbus.Write(address, value);
  501. }
  502. /// <summary>
  503. /// 炒锅2工艺目标重量偏差
  504. /// </summary>
  505. /// <param name="address"></param>
  506. /// <param name="value"></param>
  507. public void WritePotTwoRealPlcData(string address, float value)
  508. {
  509. fryTwoModbus.SetReal(address, value);
  510. }
  511. /// <summary>
  512. /// 炒锅3工艺数据
  513. /// </summary>
  514. /// <param name="address"></param>
  515. /// <param name="value"></param>
  516. public void WritePotThreePlcData(string address, ushort value)
  517. {
  518. fryThreeModbus.Write(address, value);
  519. }
  520. /// <summary>
  521. /// 炒锅3工艺目标重量偏差
  522. /// </summary>
  523. /// <param name="address"></param>
  524. /// <param name="value"></param>
  525. public void WritePotThreeRealPlcData(string address, float value)
  526. {
  527. fryThreeModbus.SetReal(address, value);
  528. }
  529. /// <summary>
  530. /// 炒锅4工艺数据
  531. /// </summary>
  532. /// <param name="address"></param>
  533. /// <param name="value"></param>
  534. public void WritePotFourPlcData(string address, ushort value)
  535. {
  536. fryFourModbus.Write(address,value);
  537. }
  538. /// <summary>
  539. /// 炒锅4工艺目标重量偏差
  540. /// </summary>
  541. /// <param name="address"></param>
  542. /// <param name="value"></param>
  543. public void WritePotFourRealPlcData(string address, float value)
  544. {
  545. fryFourModbus.SetReal(address, value);
  546. }
  547. /// <summary>
  548. /// 炒锅5工艺数据
  549. /// </summary>
  550. /// <param name="address"></param>
  551. /// <param name="value"></param>
  552. public void WritePotFivePlcData(string address, object value)
  553. {
  554. fryFiveModbus.Write(address, value);
  555. }
  556. /// <summary>
  557. /// 炒锅5工艺目标重量偏差
  558. /// </summary>
  559. /// <param name="address"></param>
  560. /// <param name="value"></param>
  561. public void WritePotFiveRealPlcData(string address, float value)
  562. {
  563. fryFiveModbus.SetReal(address, value);
  564. }
  565. public ConcurrentDictionary<string, object> GetAllData()
  566. {
  567. return Data;
  568. }
  569. public ConcurrentDictionary<string, object> GetFryOneData()
  570. {
  571. return FryOneData;
  572. }
  573. public ConcurrentDictionary<string, object> GetFryTwoData()
  574. {
  575. return FryTwoData;
  576. }
  577. public ConcurrentDictionary<string, object> GetFryThreeData()
  578. {
  579. return FryThreeData;
  580. }
  581. public ConcurrentDictionary<string, object> GetFryFourData()
  582. {
  583. return FryFourData;
  584. }
  585. public ConcurrentDictionary<string, object> GetFryFiveData()
  586. {
  587. return FryFiveData;
  588. }
  589. }
  590. }