PlcMessageShowBindingClass.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. using CCDCount.DLL;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Security.Cryptography.X509Certificates;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CCDCountWpf
  10. {
  11. public class PlcMessageShowBindingClass : INotifyPropertyChanged
  12. {
  13. /// <summary>
  14. /// 使能完成
  15. /// </summary>
  16. private bool enableCompletion;
  17. public bool EnableCompletion
  18. {
  19. get { return enableCompletion; }
  20. set
  21. {
  22. enableCompletion = value;
  23. OnPropertyChanged("EnableCompletion");
  24. }
  25. }
  26. /// <summary>
  27. /// 归零完成
  28. /// </summary>
  29. private bool returnToZeroCompletion;
  30. public bool ReturnToZeroCompletion
  31. {
  32. get { return returnToZeroCompletion; }
  33. set
  34. {
  35. returnToZeroCompletion = value;
  36. OnPropertyChanged("ReturnToZeroCompletion");
  37. }
  38. }
  39. /// <summary>
  40. /// 停止完成
  41. /// </summary>
  42. private bool stopCompletion;
  43. public bool StopCompletion
  44. {
  45. get { return stopCompletion; }
  46. set
  47. {
  48. stopCompletion = value;
  49. OnPropertyChanged("StopCompletion");
  50. }
  51. }
  52. /// <summary>
  53. /// 速度运行
  54. /// </summary>
  55. private bool speedRunning;
  56. public bool SpeedRunning
  57. {
  58. get { return speedRunning; }
  59. set
  60. {
  61. speedRunning = value;
  62. OnPropertyChanged("SpeedRunning");
  63. }
  64. }
  65. /// <summary>
  66. /// 回零中
  67. /// </summary>
  68. private bool returnToZero;
  69. public bool ReturnToZero
  70. {
  71. get { return returnToZero; }
  72. set
  73. {
  74. returnToZero = value;
  75. OnPropertyChanged("ReturnToZero");
  76. }
  77. }
  78. /// <summary>
  79. /// 中转阀开定位完成
  80. /// </summary>
  81. private bool transferValveOpenCompletion;
  82. public bool TransferValveOpenCompletion
  83. {
  84. get { return transferValveOpenCompletion; }
  85. set
  86. {
  87. transferValveOpenCompletion = value;
  88. OnPropertyChanged("TransferValveOpenCompletion");
  89. }
  90. }
  91. /// <summary>
  92. /// 中转阀关定位完成
  93. /// </summary>
  94. private bool transferValveCloseCompletion;
  95. public bool TransferValveCloseCompletion
  96. {
  97. get { return transferValveCloseCompletion; }
  98. set
  99. {
  100. transferValveCloseCompletion = value;
  101. OnPropertyChanged("TransferValveCloseCompletion");
  102. }
  103. }
  104. /// <summary>
  105. /// 允许数据交换
  106. /// </summary>
  107. private bool allowsDataExchange;
  108. public bool AllowsDataExchange
  109. {
  110. get { return allowsDataExchange; }
  111. set
  112. {
  113. allowsDataExchange = value;
  114. OnPropertyChanged("AllowsDataExchange");
  115. }
  116. }
  117. /// <summary>
  118. /// 暂停数据交换
  119. /// </summary>
  120. private bool pauseDataExchange;
  121. public bool PauseDataExchange
  122. {
  123. get { return pauseDataExchange; }
  124. set
  125. {
  126. pauseDataExchange = value;
  127. OnPropertyChanged("PauseDataExchange");
  128. }
  129. }
  130. /// <summary>
  131. /// 缓存计数延迟完成
  132. /// </summary>
  133. private bool cacheCountDelayed;
  134. public bool CacheCountDelayed
  135. {
  136. get { return cacheCountDelayed; }
  137. set
  138. {
  139. cacheCountDelayed = value;
  140. OnPropertyChanged("CacheCountDelayed");
  141. }
  142. }
  143. /// <summary>
  144. /// 使能
  145. /// </summary>
  146. private bool enable;
  147. public bool Enable
  148. {
  149. get { return enable; }
  150. set
  151. {
  152. enable = value;
  153. OnPropertyChanged("Enable");
  154. }
  155. }
  156. /// <summary>
  157. /// 速度模式运行速度
  158. /// </summary>
  159. private float speedModeRunningSpeed;
  160. public string SpeedModeRunningSpeed
  161. {
  162. get { return speedModeRunningSpeed.ToString("F2"); }
  163. set
  164. {
  165. if (float.TryParse(value, out float result))
  166. {
  167. speedModeRunningSpeed = result;
  168. PlcSettingMessageBus.pLCManagement.WriteSpeedModeRunningSpeed(result);
  169. OnPropertyChanged("SpeedModeRunningSpeed");
  170. }
  171. }
  172. }
  173. /// <summary>
  174. /// 点动速度
  175. /// </summary>
  176. private float jogSpeed;
  177. public string JogSpeed
  178. {
  179. get { return jogSpeed.ToString("F2"); }
  180. set
  181. {
  182. if (float.TryParse(value, out float result))
  183. {
  184. jogSpeed = result;
  185. PlcSettingMessageBus.pLCManagement.WriteJogSpeed(result);
  186. OnPropertyChanged("JogSpeed");
  187. }
  188. }
  189. }
  190. /// <summary>
  191. /// 瓶装设定值
  192. /// </summary>
  193. private UInt16 bottValueSet;
  194. public UInt16 BottValueSet
  195. {
  196. get { return bottValueSet; }
  197. set
  198. {
  199. bottValueSet = value;
  200. PlcSettingMessageBus.pLCManagement.WriteBottValueSet(value);
  201. OnPropertyChanged("BottValueSet");
  202. }
  203. }
  204. /// <summary>
  205. /// 中转阀打开速度
  206. /// </summary>
  207. private float transferValveOpeningSpeed;
  208. public string TransferValveOpeningSpeed
  209. {
  210. get { return transferValveOpeningSpeed.ToString("F2"); }
  211. set
  212. {
  213. if (float.TryParse(value, out float result))
  214. {
  215. transferValveOpeningSpeed = result;
  216. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningSpeed(result);
  217. OnPropertyChanged("TransferValveOpeningSpeed");
  218. }
  219. }
  220. }
  221. /// <summary>
  222. /// 中转阀打开时间
  223. /// </summary>
  224. private UInt32 transferValveOpeningTime;
  225. public UInt32 TransferValveOpeningTime
  226. {
  227. get { return transferValveOpeningTime; }
  228. set
  229. {
  230. transferValveOpeningTime = value;
  231. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningTime(value);
  232. OnPropertyChanged("TransferValveOpeningTime");
  233. }
  234. }
  235. /// <summary>
  236. /// 罐装减速值
  237. /// </summary>
  238. private UInt16 bottingDecelerationValue;
  239. public UInt16 BottingDecelerationValue
  240. {
  241. get { return bottingDecelerationValue; }
  242. set
  243. {
  244. bottingDecelerationValue = value;
  245. PlcSettingMessageBus.pLCManagement.WriteBottingDecelerationValue(value);
  246. OnPropertyChanged("BottingDecelerationValue");
  247. }
  248. }
  249. /// <summary>
  250. /// 缓存减速值
  251. /// </summary>
  252. private UInt16 cacheDecelerationValue { get; set;}
  253. public UInt16 CacheDecelerationValue
  254. {
  255. get { return cacheDecelerationValue; }
  256. set
  257. {
  258. cacheDecelerationValue = value;
  259. PlcSettingMessageBus.pLCManagement.WriteCacheDecelerationValue(value);
  260. OnPropertyChanged("CacheDecelerationValue");
  261. }
  262. }
  263. /// <summary>
  264. /// 缓存计数延迟时间
  265. /// </summary>
  266. private UInt32 cacheCountDelayTiming;
  267. public UInt32 CacheCountDelayTiming
  268. {
  269. get { return cacheCountDelayTiming; }
  270. set
  271. {
  272. cacheCountDelayTiming = value;
  273. PlcSettingMessageBus.pLCManagement.WriteCacheCountDelayTiming(value);
  274. OnPropertyChanged("CacheCountDelayTiming");
  275. }
  276. }
  277. /// <summary>
  278. /// 缓存停机值
  279. /// </summary>
  280. private UInt16 cacheShutdownValue;
  281. public UInt16 CacheShutdownValue
  282. {
  283. get { return cacheShutdownValue; }
  284. set
  285. {
  286. cacheShutdownValue = value;
  287. PlcSettingMessageBus.pLCManagement.WriteCacheShutdownValue(value);
  288. OnPropertyChanged("CacheShutdownValue");
  289. }
  290. }
  291. /// <summary>
  292. /// 罐装料筒震台高速值
  293. /// </summary>
  294. private UInt16 bottingMaterialCylinderVibrationTableHighSpeedValue;
  295. public UInt16 BottingMaterialCylinderVibrationTableHighSpeedValue
  296. {
  297. get { return bottingMaterialCylinderVibrationTableHighSpeedValue; }
  298. set
  299. {
  300. bottingMaterialCylinderVibrationTableHighSpeedValue = value;
  301. PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableHighSpeedValue(value);
  302. OnPropertyChanged("BottingMaterialCylinderVibrationTableHighSpeedValue");
  303. }
  304. }
  305. /// <summary>
  306. /// 罐装过滤震台高速值
  307. /// </summary>
  308. private UInt16 bottingFilterVibrationTableHighSpeedValue;
  309. public UInt16 BottingFilterVibrationTableHighSpeedValue
  310. {
  311. get { return bottingFilterVibrationTableHighSpeedValue; }
  312. set
  313. {
  314. bottingFilterVibrationTableHighSpeedValue = value;
  315. PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableHighSpeedValue(value);
  316. OnPropertyChanged("BottingFilterVibrationTableHighSpeedValue");
  317. }
  318. }
  319. /// <summary>
  320. /// 罐装计数震台高速值
  321. /// </summary>
  322. private UInt16 bottingCountVibrationTableHighSpeedValue;
  323. public UInt16 BottingCountVibrationTableHighSpeedValue
  324. {
  325. get { return bottingCountVibrationTableHighSpeedValue; }
  326. set
  327. {
  328. bottingCountVibrationTableHighSpeedValue = value;
  329. PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableHighSpeedValue(value);
  330. OnPropertyChanged("BottingCountVibrationTableHighSpeedValue");
  331. }
  332. }
  333. /// <summary>
  334. /// 罐装料筒震台减速值
  335. /// </summary>
  336. private UInt16 bottingMaterialCylinderVibrationTableDecelerationSpeedValue;
  337. public UInt16 BottingMaterialCylinderVibrationTableDecelerationSpeedValue
  338. {
  339. get { return bottingMaterialCylinderVibrationTableDecelerationSpeedValue; }
  340. set
  341. {
  342. bottingMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  343. PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableDecelerationSpeedValue(value);
  344. OnPropertyChanged("BottingMaterialCylinderVibrationTableDecelerationSpeedValue");
  345. }
  346. }
  347. /// <summary>
  348. /// 罐装过滤震台减速值
  349. /// </summary>
  350. private UInt16 bottingFilterVibrationTableDecelerationSpeedValue;
  351. public UInt16 BottingFilterVibrationTableDecelerationSpeedValue
  352. {
  353. get { return bottingFilterVibrationTableDecelerationSpeedValue; }
  354. set
  355. {
  356. bottingFilterVibrationTableDecelerationSpeedValue = value;
  357. PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableDecelerationSpeedValue(value);
  358. OnPropertyChanged("BottingFilterVibrationTableDecelerationSpeedValue");
  359. }
  360. }
  361. /// <summary>
  362. /// 罐装计数震台减速值
  363. /// </summary>
  364. private UInt16 bottingCountVibrationTableDecelerationSpeedValue;
  365. public UInt16 BottingCountVibrationTableDecelerationSpeedValue
  366. {
  367. get { return bottingCountVibrationTableDecelerationSpeedValue; }
  368. set
  369. {
  370. bottingCountVibrationTableDecelerationSpeedValue = value;
  371. PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableDecelerationSpeedValue(value);
  372. OnPropertyChanged("BottingCountVibrationTableDecelerationSpeedValue");
  373. }
  374. }
  375. /// <summary>
  376. /// 缓存料筒震台高速值
  377. /// </summary>
  378. private UInt16 cacheMaterialCylinderVibrationTableHighSpeedValue;
  379. public UInt16 CacheMaterialCylinderVibrationTableHighSpeedValue
  380. {
  381. get { return cacheMaterialCylinderVibrationTableHighSpeedValue; }
  382. set
  383. {
  384. cacheMaterialCylinderVibrationTableHighSpeedValue = value;
  385. PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableHighSpeedValue(value);
  386. OnPropertyChanged("CacheMaterialCylinderVibrationTableHighSpeedValue");
  387. }
  388. }
  389. /// <summary>
  390. /// 缓存过滤震台高速值
  391. /// </summary>
  392. private UInt16 cacheFilterVibrationTableHighSpeedValue;
  393. public UInt16 CacheFilterVibrationTableHighSpeedValue
  394. {
  395. get { return cacheFilterVibrationTableHighSpeedValue; }
  396. set
  397. {
  398. cacheFilterVibrationTableHighSpeedValue = value;
  399. PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableHighSpeedValue(value);
  400. OnPropertyChanged("CacheFilterVibrationTableHighSpeedValue");
  401. }
  402. }
  403. /// <summary>
  404. /// 缓存计数震台高速值
  405. /// </summary>
  406. private UInt16 cacheCountVibrationTableHighSpeedValue;
  407. public UInt16 CacheCountVibrationTableHighSpeedValue
  408. {
  409. get { return cacheCountVibrationTableHighSpeedValue; }
  410. set
  411. {
  412. cacheCountVibrationTableHighSpeedValue = value;
  413. PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableHighSpeedValue(value);
  414. OnPropertyChanged("CacheCountVibrationTableHighSpeedValue");
  415. }
  416. }
  417. /// <summary>
  418. /// 缓存料筒震台减速值
  419. /// </summary>
  420. private UInt16 cacheMaterialCylinderVibrationTableDecelerationSpeedValue;
  421. public UInt16 CacheMaterialCylinderVibrationTableDecelerationSpeedValue
  422. {
  423. get { return cacheMaterialCylinderVibrationTableDecelerationSpeedValue; }
  424. set
  425. {
  426. cacheMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  427. PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableDecelerationSpeedValue(value);
  428. OnPropertyChanged("CacheMaterialCylinderVibrationTableDecelerationSpeedValue");
  429. }
  430. }
  431. /// <summary>
  432. /// 缓存过滤震台减速值
  433. /// </summary>
  434. private UInt16 cacheFilterVibrationTableDecelerationSpeedValue;
  435. public UInt16 CacheFilterVibrationTableDecelerationSpeedValue
  436. {
  437. get { return cacheFilterVibrationTableDecelerationSpeedValue; }
  438. set
  439. {
  440. cacheFilterVibrationTableDecelerationSpeedValue = value;
  441. PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableDecelerationSpeedValue(value);
  442. OnPropertyChanged("CacheFilterVibrationTableDecelerationSpeedValue");
  443. }
  444. }
  445. /// <summary>
  446. /// 缓存计数震台减速值
  447. /// </summary>
  448. private UInt16 cacheCountVibrationTableDecelerationSpeedValue;
  449. public UInt16 CacheCountVibrationTableDecelerationSpeedValue
  450. {
  451. get { return cacheCountVibrationTableDecelerationSpeedValue; }
  452. set
  453. {
  454. cacheCountVibrationTableDecelerationSpeedValue = value;
  455. PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableDecelerationSpeedValue(value);
  456. OnPropertyChanged("CacheCountVibrationTableDecelerationSpeedValue");
  457. }
  458. }
  459. /// <summary>
  460. /// 阀门打开延时
  461. /// </summary>
  462. private UInt32 gateOpeningDelay;
  463. public UInt32 GateOpeningDelay
  464. {
  465. get { return gateOpeningDelay; }
  466. set
  467. {
  468. gateOpeningDelay = value;
  469. PlcSettingMessageBus.pLCManagement.WriteGateOpeningDelay(value);
  470. OnPropertyChanged("GateOpeningDelay");
  471. }
  472. }
  473. /// <summary>
  474. /// 回零偏移值
  475. /// </summary>
  476. private float returnToZeroOffsetValue;
  477. public string ReturnToZeroOffsetValue
  478. {
  479. get { return returnToZeroOffsetValue.ToString("F2"); }
  480. set
  481. {
  482. if (float.TryParse(value, out float result))
  483. {
  484. returnToZeroOffsetValue = result;
  485. PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetValue(result);
  486. OnPropertyChanged("ReturnToZeroOffsetValue");
  487. }
  488. }
  489. }
  490. /// <summary>
  491. /// 回零偏移速度
  492. /// </summary>
  493. private float returnToZeroOffsetSpeed;
  494. public string ReturnToZeroOffsetSpeed
  495. {
  496. get { return returnToZeroOffsetSpeed.ToString("F2"); }
  497. set
  498. {
  499. if (float.TryParse(value, out float result))
  500. {
  501. returnToZeroOffsetSpeed = result;
  502. PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetSpeed(result);
  503. OnPropertyChanged("ReturnToZeroOffsetSpeed");
  504. }
  505. }
  506. }
  507. /// <summary>
  508. /// 中转阀关闭速度
  509. /// </summary>
  510. private float transferValveClosingSpeed;
  511. public string TransferValveClosingSpeed
  512. {
  513. get { return transferValveClosingSpeed.ToString("F2"); }
  514. set
  515. {
  516. if (float.TryParse(value, out float result))
  517. {
  518. transferValveClosingSpeed = result;
  519. PlcSettingMessageBus.pLCManagement.WriteTransferValveClosingSpeed(result);
  520. OnPropertyChanged("TransferValveClosingSpeed");
  521. }
  522. }
  523. }
  524. /// <summary>
  525. /// 中转阀开位置
  526. /// </summary>
  527. private float transferValveOpenPosition;
  528. public string TransferValveOpenPosition
  529. {
  530. get { return transferValveOpenPosition.ToString("F2"); }
  531. set
  532. {
  533. if (float.TryParse(value, out float result))
  534. {
  535. transferValveOpenPosition = result;
  536. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpenPosition(result);
  537. OnPropertyChanged("TransferValveOpenPosition");
  538. }
  539. }
  540. }
  541. /// <summary>
  542. /// 中转阀关位置
  543. /// </summary>
  544. private float transferValveClosePosition;
  545. public string TransferValveClosePosition
  546. {
  547. get { return transferValveClosePosition.ToString("F2"); }
  548. set
  549. {
  550. if (float.TryParse(value, out float result))
  551. {
  552. transferValveClosePosition = result;
  553. PlcSettingMessageBus.pLCManagement.WriteTransferValveClosePosition(result);
  554. OnPropertyChanged("TransferValveClosePosition");
  555. }
  556. }
  557. }
  558. /// <summary>
  559. /// 气阀开延时
  560. /// </summary>
  561. private UInt32 airValveOpeningDelay;
  562. public UInt32 AirValveOpeningDelay
  563. {
  564. get { return airValveOpeningDelay; }
  565. set
  566. {
  567. airValveOpeningDelay = value;
  568. PlcSettingMessageBus.pLCManagement.WriteAirValveOpeningDelay(value);
  569. OnPropertyChanged("AirValveOpeningDelay");
  570. }
  571. }
  572. /// <summary>
  573. /// 装瓶停机值
  574. /// </summary>
  575. private UInt16 bottlingShutdownValue;
  576. public UInt16 BottlingShutdownValue
  577. {
  578. get { return bottlingShutdownValue; }
  579. set
  580. {
  581. bottlingShutdownValue = value;
  582. PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownValue(value);
  583. OnPropertyChanged("BottlingShutdownValue");
  584. }
  585. }
  586. /// <summary>
  587. /// 装瓶停机时间
  588. /// </summary>
  589. private UInt32 bottlingShutdownTime;
  590. public UInt32 BottlingShutdownTime
  591. {
  592. get { return bottlingShutdownTime; }
  593. set
  594. {
  595. bottlingShutdownTime = value;
  596. PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownTime(value);
  597. OnPropertyChanged("BottlingShutdownTime");
  598. }
  599. }
  600. //数据绑定核心实现
  601. public event PropertyChangedEventHandler PropertyChanged;
  602. protected void OnPropertyChanged(string propertyName)
  603. {
  604. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  605. }
  606. }
  607. }