PlcMessageShowBindingClass.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 bool bottleFeedingWheelEnableCompletion;
  160. public bool BottleFeedingWheelEnableCompletion
  161. {
  162. get { return bottleFeedingWheelEnableCompletion; }
  163. set
  164. {
  165. bottleFeedingWheelEnableCompletion = value;
  166. OnPropertyChanged("BottleFeedingWheelEnableCompletion");
  167. }
  168. }
  169. /// <summary>
  170. /// 送瓶轮停止完成
  171. /// </summary>
  172. private bool bottleFeedingWheelStopCompletion;
  173. public bool BottleFeedingWheelStopCompletion
  174. {
  175. get { return bottleFeedingWheelStopCompletion; }
  176. set
  177. {
  178. bottleFeedingWheelStopCompletion = value;
  179. OnPropertyChanged("BottleFeedingWheelStopCompletion");
  180. }
  181. }
  182. /// <summary>
  183. /// 速度模式运行速度
  184. /// </summary>
  185. private float speedModeRunningSpeed;
  186. public string SpeedModeRunningSpeed
  187. {
  188. get { return speedModeRunningSpeed.ToString("F2"); }
  189. set
  190. {
  191. if (float.TryParse(value, out float result))
  192. {
  193. speedModeRunningSpeed = result;
  194. PlcSettingMessageBus.pLCManagement.WriteSpeedModeRunningSpeed(result);
  195. OnPropertyChanged("SpeedModeRunningSpeed");
  196. }
  197. }
  198. }
  199. /// <summary>
  200. /// 点动速度
  201. /// </summary>
  202. private float jogSpeed;
  203. public string JogSpeed
  204. {
  205. get { return jogSpeed.ToString("F2"); }
  206. set
  207. {
  208. if (float.TryParse(value, out float result))
  209. {
  210. jogSpeed = result;
  211. PlcSettingMessageBus.pLCManagement.WriteJogSpeed(result);
  212. OnPropertyChanged("JogSpeed");
  213. }
  214. }
  215. }
  216. /// <summary>
  217. /// 瓶装设定值
  218. /// </summary>
  219. private UInt16 bottValueSet;
  220. public UInt16 BottValueSet
  221. {
  222. get { return bottValueSet; }
  223. set
  224. {
  225. bottValueSet = value;
  226. PlcSettingMessageBus.pLCManagement.WriteBottValueSet(value);
  227. OnPropertyChanged("BottValueSet");
  228. }
  229. }
  230. /// <summary>
  231. /// 中转阀打开速度
  232. /// </summary>
  233. private float transferValveOpeningSpeed;
  234. public string TransferValveOpeningSpeed
  235. {
  236. get { return transferValveOpeningSpeed.ToString("F2"); }
  237. set
  238. {
  239. if (float.TryParse(value, out float result))
  240. {
  241. transferValveOpeningSpeed = result;
  242. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningSpeed(result);
  243. OnPropertyChanged("TransferValveOpeningSpeed");
  244. }
  245. }
  246. }
  247. /// <summary>
  248. /// 中转阀打开时间
  249. /// </summary>
  250. private UInt32 transferValveOpeningTime;
  251. public UInt32 TransferValveOpeningTime
  252. {
  253. get { return transferValveOpeningTime; }
  254. set
  255. {
  256. transferValveOpeningTime = value;
  257. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningTime(value);
  258. OnPropertyChanged("TransferValveOpeningTime");
  259. }
  260. }
  261. /// <summary>
  262. /// 罐装减速值
  263. /// </summary>
  264. private UInt16 bottingDecelerationValue;
  265. public UInt16 BottingDecelerationValue
  266. {
  267. get { return bottingDecelerationValue; }
  268. set
  269. {
  270. bottingDecelerationValue = value;
  271. PlcSettingMessageBus.pLCManagement.WriteBottingDecelerationValue(value);
  272. OnPropertyChanged("BottingDecelerationValue");
  273. }
  274. }
  275. /// <summary>
  276. /// 缓存减速值
  277. /// </summary>
  278. private UInt16 cacheDecelerationValue { get; set;}
  279. public UInt16 CacheDecelerationValue
  280. {
  281. get { return cacheDecelerationValue; }
  282. set
  283. {
  284. cacheDecelerationValue = value;
  285. PlcSettingMessageBus.pLCManagement.WriteCacheDecelerationValue(value);
  286. OnPropertyChanged("CacheDecelerationValue");
  287. }
  288. }
  289. /// <summary>
  290. /// 缓存计数延迟时间
  291. /// </summary>
  292. private UInt32 cacheCountDelayTiming;
  293. public UInt32 CacheCountDelayTiming
  294. {
  295. get { return cacheCountDelayTiming; }
  296. set
  297. {
  298. cacheCountDelayTiming = value;
  299. PlcSettingMessageBus.pLCManagement.WriteCacheCountDelayTiming(value);
  300. OnPropertyChanged("CacheCountDelayTiming");
  301. }
  302. }
  303. /// <summary>
  304. /// 缓存停机值
  305. /// </summary>
  306. private UInt16 cacheShutdownValue;
  307. public UInt16 CacheShutdownValue
  308. {
  309. get { return cacheShutdownValue; }
  310. set
  311. {
  312. cacheShutdownValue = value;
  313. PlcSettingMessageBus.pLCManagement.WriteCacheShutdownValue(value);
  314. OnPropertyChanged("CacheShutdownValue");
  315. }
  316. }
  317. /// <summary>
  318. /// 罐装料筒震台高速值
  319. /// </summary>
  320. private UInt16 bottingMaterialCylinderVibrationTableHighSpeedValue;
  321. public UInt16 BottingMaterialCylinderVibrationTableHighSpeedValue
  322. {
  323. get { return bottingMaterialCylinderVibrationTableHighSpeedValue; }
  324. set
  325. {
  326. bottingMaterialCylinderVibrationTableHighSpeedValue = value;
  327. PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableHighSpeedValue(value);
  328. OnPropertyChanged("BottingMaterialCylinderVibrationTableHighSpeedValue");
  329. }
  330. }
  331. /// <summary>
  332. /// 罐装过滤震台高速值
  333. /// </summary>
  334. private UInt16 bottingFilterVibrationTableHighSpeedValue;
  335. public UInt16 BottingFilterVibrationTableHighSpeedValue
  336. {
  337. get { return bottingFilterVibrationTableHighSpeedValue; }
  338. set
  339. {
  340. bottingFilterVibrationTableHighSpeedValue = value;
  341. PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableHighSpeedValue(value);
  342. OnPropertyChanged("BottingFilterVibrationTableHighSpeedValue");
  343. }
  344. }
  345. /// <summary>
  346. /// 罐装计数震台高速值
  347. /// </summary>
  348. private UInt16 bottingCountVibrationTableHighSpeedValue;
  349. public UInt16 BottingCountVibrationTableHighSpeedValue
  350. {
  351. get { return bottingCountVibrationTableHighSpeedValue; }
  352. set
  353. {
  354. bottingCountVibrationTableHighSpeedValue = value;
  355. PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableHighSpeedValue(value);
  356. OnPropertyChanged("BottingCountVibrationTableHighSpeedValue");
  357. }
  358. }
  359. /// <summary>
  360. /// 罐装料筒震台减速值
  361. /// </summary>
  362. private UInt16 bottingMaterialCylinderVibrationTableDecelerationSpeedValue;
  363. public UInt16 BottingMaterialCylinderVibrationTableDecelerationSpeedValue
  364. {
  365. get { return bottingMaterialCylinderVibrationTableDecelerationSpeedValue; }
  366. set
  367. {
  368. bottingMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  369. PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableDecelerationSpeedValue(value);
  370. OnPropertyChanged("BottingMaterialCylinderVibrationTableDecelerationSpeedValue");
  371. }
  372. }
  373. /// <summary>
  374. /// 罐装过滤震台减速值
  375. /// </summary>
  376. private UInt16 bottingFilterVibrationTableDecelerationSpeedValue;
  377. public UInt16 BottingFilterVibrationTableDecelerationSpeedValue
  378. {
  379. get { return bottingFilterVibrationTableDecelerationSpeedValue; }
  380. set
  381. {
  382. bottingFilterVibrationTableDecelerationSpeedValue = value;
  383. PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableDecelerationSpeedValue(value);
  384. OnPropertyChanged("BottingFilterVibrationTableDecelerationSpeedValue");
  385. }
  386. }
  387. /// <summary>
  388. /// 罐装计数震台减速值
  389. /// </summary>
  390. private UInt16 bottingCountVibrationTableDecelerationSpeedValue;
  391. public UInt16 BottingCountVibrationTableDecelerationSpeedValue
  392. {
  393. get { return bottingCountVibrationTableDecelerationSpeedValue; }
  394. set
  395. {
  396. bottingCountVibrationTableDecelerationSpeedValue = value;
  397. PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableDecelerationSpeedValue(value);
  398. OnPropertyChanged("BottingCountVibrationTableDecelerationSpeedValue");
  399. }
  400. }
  401. /// <summary>
  402. /// 缓存料筒震台高速值
  403. /// </summary>
  404. private UInt16 cacheMaterialCylinderVibrationTableHighSpeedValue;
  405. public UInt16 CacheMaterialCylinderVibrationTableHighSpeedValue
  406. {
  407. get { return cacheMaterialCylinderVibrationTableHighSpeedValue; }
  408. set
  409. {
  410. cacheMaterialCylinderVibrationTableHighSpeedValue = value;
  411. PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableHighSpeedValue(value);
  412. OnPropertyChanged("CacheMaterialCylinderVibrationTableHighSpeedValue");
  413. }
  414. }
  415. /// <summary>
  416. /// 缓存过滤震台高速值
  417. /// </summary>
  418. private UInt16 cacheFilterVibrationTableHighSpeedValue;
  419. public UInt16 CacheFilterVibrationTableHighSpeedValue
  420. {
  421. get { return cacheFilterVibrationTableHighSpeedValue; }
  422. set
  423. {
  424. cacheFilterVibrationTableHighSpeedValue = value;
  425. PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableHighSpeedValue(value);
  426. OnPropertyChanged("CacheFilterVibrationTableHighSpeedValue");
  427. }
  428. }
  429. /// <summary>
  430. /// 缓存计数震台高速值
  431. /// </summary>
  432. private UInt16 cacheCountVibrationTableHighSpeedValue;
  433. public UInt16 CacheCountVibrationTableHighSpeedValue
  434. {
  435. get { return cacheCountVibrationTableHighSpeedValue; }
  436. set
  437. {
  438. cacheCountVibrationTableHighSpeedValue = value;
  439. PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableHighSpeedValue(value);
  440. OnPropertyChanged("CacheCountVibrationTableHighSpeedValue");
  441. }
  442. }
  443. /// <summary>
  444. /// 缓存料筒震台减速值
  445. /// </summary>
  446. private UInt16 cacheMaterialCylinderVibrationTableDecelerationSpeedValue;
  447. public UInt16 CacheMaterialCylinderVibrationTableDecelerationSpeedValue
  448. {
  449. get { return cacheMaterialCylinderVibrationTableDecelerationSpeedValue; }
  450. set
  451. {
  452. cacheMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  453. PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableDecelerationSpeedValue(value);
  454. OnPropertyChanged("CacheMaterialCylinderVibrationTableDecelerationSpeedValue");
  455. }
  456. }
  457. /// <summary>
  458. /// 缓存过滤震台减速值
  459. /// </summary>
  460. private UInt16 cacheFilterVibrationTableDecelerationSpeedValue;
  461. public UInt16 CacheFilterVibrationTableDecelerationSpeedValue
  462. {
  463. get { return cacheFilterVibrationTableDecelerationSpeedValue; }
  464. set
  465. {
  466. cacheFilterVibrationTableDecelerationSpeedValue = value;
  467. PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableDecelerationSpeedValue(value);
  468. OnPropertyChanged("CacheFilterVibrationTableDecelerationSpeedValue");
  469. }
  470. }
  471. /// <summary>
  472. /// 缓存计数震台减速值
  473. /// </summary>
  474. private UInt16 cacheCountVibrationTableDecelerationSpeedValue;
  475. public UInt16 CacheCountVibrationTableDecelerationSpeedValue
  476. {
  477. get { return cacheCountVibrationTableDecelerationSpeedValue; }
  478. set
  479. {
  480. cacheCountVibrationTableDecelerationSpeedValue = value;
  481. PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableDecelerationSpeedValue(value);
  482. OnPropertyChanged("CacheCountVibrationTableDecelerationSpeedValue");
  483. }
  484. }
  485. /// <summary>
  486. /// 阀门打开延时
  487. /// </summary>
  488. private UInt32 gateOpeningDelay;
  489. public UInt32 GateOpeningDelay
  490. {
  491. get { return gateOpeningDelay; }
  492. set
  493. {
  494. gateOpeningDelay = value;
  495. PlcSettingMessageBus.pLCManagement.WriteGateOpeningDelay(value);
  496. OnPropertyChanged("GateOpeningDelay");
  497. }
  498. }
  499. /// <summary>
  500. /// 回零偏移值
  501. /// </summary>
  502. private float returnToZeroOffsetValue;
  503. public string ReturnToZeroOffsetValue
  504. {
  505. get { return returnToZeroOffsetValue.ToString("F2"); }
  506. set
  507. {
  508. if (float.TryParse(value, out float result))
  509. {
  510. returnToZeroOffsetValue = result;
  511. PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetValue(result);
  512. OnPropertyChanged("ReturnToZeroOffsetValue");
  513. }
  514. }
  515. }
  516. /// <summary>
  517. /// 回零偏移速度
  518. /// </summary>
  519. private float returnToZeroOffsetSpeed;
  520. public string ReturnToZeroOffsetSpeed
  521. {
  522. get { return returnToZeroOffsetSpeed.ToString("F2"); }
  523. set
  524. {
  525. if (float.TryParse(value, out float result))
  526. {
  527. returnToZeroOffsetSpeed = result;
  528. PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetSpeed(result);
  529. OnPropertyChanged("ReturnToZeroOffsetSpeed");
  530. }
  531. }
  532. }
  533. /// <summary>
  534. /// 中转阀关闭速度
  535. /// </summary>
  536. private float transferValveClosingSpeed;
  537. public string TransferValveClosingSpeed
  538. {
  539. get { return transferValveClosingSpeed.ToString("F2"); }
  540. set
  541. {
  542. if (float.TryParse(value, out float result))
  543. {
  544. transferValveClosingSpeed = result;
  545. PlcSettingMessageBus.pLCManagement.WriteTransferValveClosingSpeed(result);
  546. OnPropertyChanged("TransferValveClosingSpeed");
  547. }
  548. }
  549. }
  550. /// <summary>
  551. /// 中转阀开位置
  552. /// </summary>
  553. private float transferValveOpenPosition;
  554. public string TransferValveOpenPosition
  555. {
  556. get { return transferValveOpenPosition.ToString("F2"); }
  557. set
  558. {
  559. if (float.TryParse(value, out float result))
  560. {
  561. transferValveOpenPosition = result;
  562. PlcSettingMessageBus.pLCManagement.WriteTransferValveOpenPosition(result);
  563. OnPropertyChanged("TransferValveOpenPosition");
  564. }
  565. }
  566. }
  567. /// <summary>
  568. /// 中转阀关位置
  569. /// </summary>
  570. private float transferValveClosePosition;
  571. public string TransferValveClosePosition
  572. {
  573. get { return transferValveClosePosition.ToString("F2"); }
  574. set
  575. {
  576. if (float.TryParse(value, out float result))
  577. {
  578. transferValveClosePosition = result;
  579. PlcSettingMessageBus.pLCManagement.WriteTransferValveClosePosition(result);
  580. OnPropertyChanged("TransferValveClosePosition");
  581. }
  582. }
  583. }
  584. /// <summary>
  585. /// 气阀开延时
  586. /// </summary>
  587. private UInt32 airValveOpeningDelay;
  588. public UInt32 AirValveOpeningDelay
  589. {
  590. get { return airValveOpeningDelay; }
  591. set
  592. {
  593. airValveOpeningDelay = value;
  594. PlcSettingMessageBus.pLCManagement.WriteAirValveOpeningDelay(value);
  595. OnPropertyChanged("AirValveOpeningDelay");
  596. }
  597. }
  598. /// <summary>
  599. /// 装瓶停机值
  600. /// </summary>
  601. private UInt16 bottlingShutdownValue;
  602. public UInt16 BottlingShutdownValue
  603. {
  604. get { return bottlingShutdownValue; }
  605. set
  606. {
  607. bottlingShutdownValue = value;
  608. PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownValue(value);
  609. OnPropertyChanged("BottlingShutdownValue");
  610. }
  611. }
  612. /// <summary>
  613. /// 装瓶停机时间
  614. /// </summary>
  615. private UInt32 bottlingShutdownTime;
  616. public UInt32 BottlingShutdownTime
  617. {
  618. get { return bottlingShutdownTime; }
  619. set
  620. {
  621. bottlingShutdownTime = value;
  622. PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownTime(value);
  623. OnPropertyChanged("BottlingShutdownTime");
  624. }
  625. }
  626. //数据绑定核心实现
  627. public event PropertyChangedEventHandler PropertyChanged;
  628. protected void OnPropertyChanged(string propertyName)
  629. {
  630. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  631. }
  632. }
  633. }