PlcMessageShowBindingClass.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988
  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. float oldValue = speedModeRunningSpeed;
  194. if (PlcSettingMessageBus.pLCManagement.WriteSpeedModeRunningSpeed(result))
  195. {
  196. speedModeRunningSpeed = result;
  197. if (oldValue != result)
  198. FaultLog.RecordValueChangeMessage($"速度模式运行速度从{oldValue}修改为{result}");
  199. }
  200. OnPropertyChanged("SpeedModeRunningSpeed");
  201. }
  202. }
  203. }
  204. /// <summary>
  205. /// 点动速度
  206. /// </summary>
  207. private float jogSpeed;
  208. public string JogSpeed
  209. {
  210. get { return jogSpeed.ToString("F2"); }
  211. set
  212. {
  213. if (float.TryParse(value, out float result))
  214. {
  215. float oldValue = jogSpeed;
  216. if(PlcSettingMessageBus.pLCManagement.WriteJogSpeed(result))
  217. {
  218. jogSpeed = result;
  219. if (oldValue != result)
  220. FaultLog.RecordValueChangeMessage($"点动速度从{oldValue}修改为{result}");
  221. }
  222. OnPropertyChanged("JogSpeed");
  223. }
  224. }
  225. }
  226. /// <summary>
  227. /// 瓶装设定值
  228. /// </summary>
  229. private ushort bottValueSet;
  230. public ushort BottValueSet
  231. {
  232. get { return bottValueSet; }
  233. set
  234. {
  235. float oldValue = bottValueSet;
  236. if(PlcSettingMessageBus.pLCManagement.WriteBottValueSet(value))
  237. {
  238. bottValueSet = value;
  239. if (oldValue != value)
  240. FaultLog.RecordValueChangeMessage($"瓶装设定值从{oldValue}修改为{value}");
  241. }
  242. OnPropertyChanged("BottValueSet");
  243. }
  244. }
  245. /// <summary>
  246. /// 中转阀打开速度
  247. /// </summary>
  248. private float transferValveOpeningSpeed;
  249. public string TransferValveOpeningSpeed
  250. {
  251. get { return transferValveOpeningSpeed.ToString("F2"); }
  252. set
  253. {
  254. if (float.TryParse(value, out float result))
  255. {
  256. float oldValue = transferValveOpeningSpeed;
  257. if(PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningSpeed(result))
  258. {
  259. transferValveOpeningSpeed = result;
  260. if (oldValue != result)
  261. FaultLog.RecordValueChangeMessage($"中转阀打开速度从{oldValue}修改为{result}");
  262. }
  263. OnPropertyChanged("TransferValveOpeningSpeed");
  264. }
  265. }
  266. }
  267. /// <summary>
  268. /// 中转阀打开时间
  269. /// </summary>
  270. private UInt32 transferValveOpeningTime;
  271. public UInt32 TransferValveOpeningTime
  272. {
  273. get { return transferValveOpeningTime; }
  274. set
  275. {
  276. UInt32 oldValue = transferValveOpeningTime;
  277. if (PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningTime(value))
  278. {
  279. transferValveOpeningTime = value;
  280. if (oldValue != value)
  281. FaultLog.RecordValueChangeMessage($"中转阀打开时间从{oldValue}修改为{value}");
  282. }
  283. OnPropertyChanged("TransferValveOpeningTime");
  284. }
  285. }
  286. /// <summary>
  287. /// 罐装减速值
  288. /// </summary>
  289. private ushort bottingDecelerationValue;
  290. public ushort BottingDecelerationValue
  291. {
  292. get { return bottingDecelerationValue; }
  293. set
  294. {
  295. ushort oldValue = bottingDecelerationValue;
  296. if (PlcSettingMessageBus.pLCManagement.WriteBottingDecelerationValue(value))
  297. {
  298. bottingDecelerationValue = value;
  299. if (oldValue != value)
  300. FaultLog.RecordValueChangeMessage($"罐装减速值从{oldValue}修改为{value}");
  301. }
  302. OnPropertyChanged("BottingDecelerationValue");
  303. }
  304. }
  305. /// <summary>
  306. /// 缓存减速值
  307. /// </summary>
  308. private UInt16 cacheDecelerationValue { get; set;}
  309. public UInt16 CacheDecelerationValue
  310. {
  311. get { return cacheDecelerationValue; }
  312. set
  313. {
  314. UInt16 oldValue = cacheDecelerationValue;
  315. if (PlcSettingMessageBus.pLCManagement.WriteCacheDecelerationValue(value))
  316. {
  317. cacheDecelerationValue = value;
  318. if (oldValue != value)
  319. FaultLog.RecordValueChangeMessage($"缓存减速值从{oldValue}修改为{value}");
  320. }
  321. OnPropertyChanged("CacheDecelerationValue");
  322. }
  323. }
  324. /// <summary>
  325. /// 缓存计数延迟时间
  326. /// </summary>
  327. private UInt32 cacheCountDelayTiming;
  328. public UInt32 CacheCountDelayTiming
  329. {
  330. get { return cacheCountDelayTiming; }
  331. set
  332. {
  333. UInt32 oldValue = cacheCountDelayTiming;
  334. if (PlcSettingMessageBus.pLCManagement.WriteCacheCountDelayTiming(value))
  335. {
  336. cacheCountDelayTiming = value;
  337. if (oldValue != value)
  338. FaultLog.RecordValueChangeMessage($"缓存计数延迟时间从{oldValue}修改为{value}");
  339. }
  340. OnPropertyChanged("CacheCountDelayTiming");
  341. }
  342. }
  343. /// <summary>
  344. /// 缓存停机值
  345. /// </summary>
  346. private ushort cacheShutdownValue;
  347. public ushort CacheShutdownValue
  348. {
  349. get { return cacheShutdownValue; }
  350. set
  351. {
  352. ushort oldValue = cacheShutdownValue;
  353. if (PlcSettingMessageBus.pLCManagement.WriteCacheShutdownValue(value))
  354. {
  355. cacheShutdownValue = value;
  356. if (oldValue != value)
  357. FaultLog.RecordValueChangeMessage($"缓存停机值从{oldValue}修改为{value}");
  358. }
  359. OnPropertyChanged("CacheShutdownValue");
  360. }
  361. }
  362. /// <summary>
  363. /// 罐装料筒震台高速值
  364. /// </summary>
  365. private ushort bottingMaterialCylinderVibrationTableHighSpeedValue;
  366. public ushort BottingMaterialCylinderVibrationTableHighSpeedValue
  367. {
  368. get { return bottingMaterialCylinderVibrationTableHighSpeedValue; }
  369. set
  370. {
  371. ushort oldValue = bottingMaterialCylinderVibrationTableHighSpeedValue;
  372. if (PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableHighSpeedValue(value))
  373. {
  374. bottingMaterialCylinderVibrationTableHighSpeedValue = value;
  375. if (oldValue != value)
  376. FaultLog.RecordValueChangeMessage($"罐装料筒震台高速值从{oldValue}修改为{value}");
  377. }
  378. OnPropertyChanged("BottingMaterialCylinderVibrationTableHighSpeedValue");
  379. }
  380. }
  381. /// <summary>
  382. /// 罐装过滤震台高速值
  383. /// </summary>
  384. private ushort bottingFilterVibrationTableHighSpeedValue;
  385. public ushort BottingFilterVibrationTableHighSpeedValue
  386. {
  387. get { return bottingFilterVibrationTableHighSpeedValue; }
  388. set
  389. {
  390. ushort oldValue = bottingFilterVibrationTableHighSpeedValue;
  391. if (PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableHighSpeedValue(value))
  392. {
  393. bottingFilterVibrationTableHighSpeedValue = value;
  394. if (oldValue != value)
  395. FaultLog.RecordValueChangeMessage($"罐装过滤震台高速值从{oldValue}修改为{value}");
  396. }
  397. OnPropertyChanged("BottingFilterVibrationTableHighSpeedValue");
  398. }
  399. }
  400. /// <summary>
  401. /// 罐装计数震台高速值
  402. /// </summary>
  403. private ushort bottingCountVibrationTableHighSpeedValue;
  404. public ushort BottingCountVibrationTableHighSpeedValue
  405. {
  406. get { return bottingCountVibrationTableHighSpeedValue; }
  407. set
  408. {
  409. ushort oldValue = bottingCountVibrationTableHighSpeedValue;
  410. if(PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableHighSpeedValue(value))
  411. {
  412. bottingCountVibrationTableHighSpeedValue = value;
  413. if (oldValue != value)
  414. FaultLog.RecordValueChangeMessage($"罐装计数震台高速值从{oldValue}修改为{value}");
  415. }
  416. OnPropertyChanged("BottingCountVibrationTableHighSpeedValue");
  417. }
  418. }
  419. /// <summary>
  420. /// 罐装料筒震台减速值
  421. /// </summary>
  422. private ushort bottingMaterialCylinderVibrationTableDecelerationSpeedValue;
  423. public ushort BottingMaterialCylinderVibrationTableDecelerationSpeedValue
  424. {
  425. get { return bottingMaterialCylinderVibrationTableDecelerationSpeedValue; }
  426. set
  427. {
  428. ushort oldValue = bottingMaterialCylinderVibrationTableDecelerationSpeedValue;
  429. if(PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableDecelerationSpeedValue(value))
  430. {
  431. bottingMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  432. if (oldValue != value)
  433. FaultLog.RecordValueChangeMessage($"罐装料筒震台减速值从{oldValue}修改为{value}");
  434. }
  435. OnPropertyChanged("BottingMaterialCylinderVibrationTableDecelerationSpeedValue");
  436. }
  437. }
  438. /// <summary>
  439. /// 罐装过滤震台减速值
  440. /// </summary>
  441. private ushort bottingFilterVibrationTableDecelerationSpeedValue;
  442. public ushort BottingFilterVibrationTableDecelerationSpeedValue
  443. {
  444. get { return bottingFilterVibrationTableDecelerationSpeedValue; }
  445. set
  446. {
  447. ushort oldValue = bottingFilterVibrationTableDecelerationSpeedValue;
  448. if(PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableDecelerationSpeedValue(value))
  449. {
  450. bottingFilterVibrationTableDecelerationSpeedValue = value;
  451. if (oldValue != value)
  452. FaultLog.RecordValueChangeMessage($"罐装过滤震台减速值从{oldValue}修改为{value}");
  453. }
  454. OnPropertyChanged("BottingFilterVibrationTableDecelerationSpeedValue");
  455. }
  456. }
  457. /// <summary>
  458. /// 罐装计数震台减速值
  459. /// </summary>
  460. private ushort bottingCountVibrationTableDecelerationSpeedValue;
  461. public ushort BottingCountVibrationTableDecelerationSpeedValue
  462. {
  463. get { return bottingCountVibrationTableDecelerationSpeedValue; }
  464. set
  465. {
  466. ushort oldValue = bottingCountVibrationTableDecelerationSpeedValue;
  467. if(PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableDecelerationSpeedValue(value))
  468. {
  469. bottingCountVibrationTableDecelerationSpeedValue = value;
  470. if (oldValue != value)
  471. FaultLog.RecordValueChangeMessage($"罐装计数震台减速值从{oldValue}修改为{value}");
  472. }
  473. OnPropertyChanged("BottingCountVibrationTableDecelerationSpeedValue");
  474. }
  475. }
  476. /// <summary>
  477. /// 缓存料筒震台高速值
  478. /// </summary>
  479. private ushort cacheMaterialCylinderVibrationTableHighSpeedValue;
  480. public ushort CacheMaterialCylinderVibrationTableHighSpeedValue
  481. {
  482. get { return cacheMaterialCylinderVibrationTableHighSpeedValue; }
  483. set
  484. {
  485. ushort oldValue = cacheMaterialCylinderVibrationTableHighSpeedValue;
  486. if(PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableHighSpeedValue(value))
  487. {
  488. cacheMaterialCylinderVibrationTableHighSpeedValue = value;
  489. if (oldValue != value)
  490. FaultLog.RecordValueChangeMessage($"缓存料筒震台高速值从{oldValue}修改为{value}");
  491. }
  492. OnPropertyChanged("CacheMaterialCylinderVibrationTableHighSpeedValue");
  493. }
  494. }
  495. /// <summary>
  496. /// 缓存过滤震台高速值
  497. /// </summary>
  498. private ushort cacheFilterVibrationTableHighSpeedValue;
  499. public ushort CacheFilterVibrationTableHighSpeedValue
  500. {
  501. get { return cacheFilterVibrationTableHighSpeedValue; }
  502. set
  503. {
  504. ushort oldValue = cacheFilterVibrationTableHighSpeedValue;
  505. if(PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableHighSpeedValue(value))
  506. {
  507. cacheFilterVibrationTableHighSpeedValue = value;
  508. if (oldValue != value)
  509. FaultLog.RecordValueChangeMessage($"缓存过滤震台高速值从{oldValue}修改为{value}");
  510. }
  511. OnPropertyChanged("CacheFilterVibrationTableHighSpeedValue");
  512. }
  513. }
  514. /// <summary>
  515. /// 缓存计数震台高速值
  516. /// </summary>
  517. private ushort cacheCountVibrationTableHighSpeedValue;
  518. public ushort CacheCountVibrationTableHighSpeedValue
  519. {
  520. get { return cacheCountVibrationTableHighSpeedValue; }
  521. set
  522. {
  523. ushort oldValue = cacheCountVibrationTableHighSpeedValue;
  524. if(PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableHighSpeedValue(value))
  525. {
  526. cacheCountVibrationTableHighSpeedValue = value;
  527. if (oldValue != value)
  528. FaultLog.RecordValueChangeMessage($"缓存计数震台高速值从{oldValue}修改为{value}");
  529. }
  530. OnPropertyChanged("CacheCountVibrationTableHighSpeedValue");
  531. }
  532. }
  533. /// <summary>
  534. /// 缓存料筒震台减速值
  535. /// </summary>
  536. private ushort cacheMaterialCylinderVibrationTableDecelerationSpeedValue;
  537. public ushort CacheMaterialCylinderVibrationTableDecelerationSpeedValue
  538. {
  539. get { return cacheMaterialCylinderVibrationTableDecelerationSpeedValue; }
  540. set
  541. {
  542. ushort oldValue = cacheMaterialCylinderVibrationTableDecelerationSpeedValue;
  543. if(PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableDecelerationSpeedValue(value))
  544. {
  545. cacheMaterialCylinderVibrationTableDecelerationSpeedValue = value;
  546. if (oldValue != value)
  547. FaultLog.RecordValueChangeMessage($"缓存料筒震台减速值从{oldValue}修改为{value}");
  548. }
  549. OnPropertyChanged("CacheMaterialCylinderVibrationTableDecelerationSpeedValue");
  550. }
  551. }
  552. /// <summary>
  553. /// 缓存过滤震台减速值
  554. /// </summary>
  555. private ushort cacheFilterVibrationTableDecelerationSpeedValue;
  556. public ushort CacheFilterVibrationTableDecelerationSpeedValue
  557. {
  558. get { return cacheFilterVibrationTableDecelerationSpeedValue; }
  559. set
  560. {
  561. ushort oldValue = cacheFilterVibrationTableDecelerationSpeedValue;
  562. if(PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableDecelerationSpeedValue(value))
  563. {
  564. cacheFilterVibrationTableDecelerationSpeedValue = value;
  565. if (oldValue != value)
  566. FaultLog.RecordValueChangeMessage($"缓存过滤震台减速值从{oldValue}修改为{value}");
  567. }
  568. OnPropertyChanged("CacheFilterVibrationTableDecelerationSpeedValue");
  569. }
  570. }
  571. /// <summary>
  572. /// 缓存计数震台减速值
  573. /// </summary>
  574. private ushort cacheCountVibrationTableDecelerationSpeedValue;
  575. public ushort CacheCountVibrationTableDecelerationSpeedValue
  576. {
  577. get { return cacheCountVibrationTableDecelerationSpeedValue; }
  578. set
  579. {
  580. ushort oldValue = cacheCountVibrationTableDecelerationSpeedValue;
  581. if(PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableDecelerationSpeedValue(value))
  582. {
  583. cacheCountVibrationTableDecelerationSpeedValue = value;
  584. if (oldValue != value)
  585. FaultLog.RecordValueChangeMessage($"缓存计数震台减速值从{oldValue}修改为{value}");
  586. }
  587. OnPropertyChanged("CacheCountVibrationTableDecelerationSpeedValue");
  588. }
  589. }
  590. /// <summary>
  591. /// 阀门打开延时
  592. /// </summary>
  593. private UInt32 gateOpeningDelay;
  594. public UInt32 GateOpeningDelay
  595. {
  596. get { return gateOpeningDelay; }
  597. set
  598. {
  599. UInt32 oldValue = gateOpeningDelay;
  600. if(PlcSettingMessageBus.pLCManagement.WriteGateOpeningDelay(value))
  601. {
  602. gateOpeningDelay = value;
  603. if (oldValue != value)
  604. FaultLog.RecordValueChangeMessage($"阀门打开延时从{oldValue}修改为{value}");
  605. }
  606. OnPropertyChanged("GateOpeningDelay");
  607. }
  608. }
  609. /// <summary>
  610. /// 回零偏移值
  611. /// </summary>
  612. private float returnToZeroOffsetValue;
  613. public string ReturnToZeroOffsetValue
  614. {
  615. get { return returnToZeroOffsetValue.ToString("F2"); }
  616. set
  617. {
  618. if (value == "-")
  619. {
  620. return;
  621. }
  622. if (float.TryParse(value, out float result))
  623. {
  624. float oldValue = returnToZeroOffsetValue;
  625. if (PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetValue(result))
  626. {
  627. returnToZeroOffsetValue = result;
  628. if (oldValue != result)
  629. FaultLog.RecordValueChangeMessage($"回零偏移值从{oldValue}修改为{result}");
  630. }
  631. OnPropertyChanged("ReturnToZeroOffsetValue");
  632. }
  633. }
  634. }
  635. /// <summary>
  636. /// 回零偏移速度
  637. /// </summary>
  638. private float returnToZeroOffsetSpeed;
  639. public string ReturnToZeroOffsetSpeed
  640. {
  641. get { return returnToZeroOffsetSpeed.ToString("F2"); }
  642. set
  643. {
  644. if (float.TryParse(value, out float result))
  645. {
  646. float oldValue = returnToZeroOffsetSpeed;
  647. if (PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetSpeed(result))
  648. {
  649. returnToZeroOffsetSpeed = result;
  650. if (oldValue != result)
  651. FaultLog.RecordValueChangeMessage($"回零偏移速度从{oldValue}修改为{result}");
  652. }
  653. OnPropertyChanged("ReturnToZeroOffsetSpeed");
  654. }
  655. }
  656. }
  657. /// <summary>
  658. /// 中转阀关闭速度
  659. /// </summary>
  660. private float transferValveClosingSpeed;
  661. public string TransferValveClosingSpeed
  662. {
  663. get { return transferValveClosingSpeed.ToString("F2"); }
  664. set
  665. {
  666. if (float.TryParse(value, out float result))
  667. {
  668. float oldValue = transferValveClosingSpeed;
  669. if(PlcSettingMessageBus.pLCManagement.WriteTransferValveClosingSpeed(result))
  670. {
  671. transferValveClosingSpeed = result;
  672. if (oldValue != result)
  673. FaultLog.RecordValueChangeMessage($"中转阀关闭速度从{oldValue}修改为{result}");
  674. }
  675. OnPropertyChanged("TransferValveClosingSpeed");
  676. }
  677. }
  678. }
  679. /// <summary>
  680. /// 中转阀开位置
  681. /// </summary>
  682. private float transferValveOpenPosition;
  683. public string TransferValveOpenPosition
  684. {
  685. get { return transferValveOpenPosition.ToString("F2"); }
  686. set
  687. {
  688. if (float.TryParse(value, out float result))
  689. {
  690. float oldValue = transferValveOpenPosition;
  691. if(PlcSettingMessageBus.pLCManagement.WriteTransferValveOpenPosition(result))
  692. {
  693. transferValveOpenPosition = result;
  694. if (oldValue != result)
  695. FaultLog.RecordValueChangeMessage($"中转阀开位置从{oldValue}修改为{result}");
  696. }
  697. OnPropertyChanged("TransferValveOpenPosition");
  698. }
  699. }
  700. }
  701. /// <summary>
  702. /// 中转阀关位置
  703. /// </summary>
  704. private float transferValveClosePosition;
  705. public string TransferValveClosePosition
  706. {
  707. get { return transferValveClosePosition.ToString("F2"); }
  708. set
  709. {
  710. if (float.TryParse(value, out float result))
  711. {
  712. float oldValue = transferValveClosePosition;
  713. if(PlcSettingMessageBus.pLCManagement.WriteTransferValveClosePosition(result))
  714. {
  715. transferValveClosePosition = result;
  716. if (oldValue != result)
  717. FaultLog.RecordValueChangeMessage($"中转阀关位置从{oldValue}修改为{result}");
  718. }
  719. OnPropertyChanged("TransferValveClosePosition");
  720. }
  721. }
  722. }
  723. /// <summary>
  724. /// 气阀开延时
  725. /// </summary>
  726. private UInt32 airValveOpeningDelay;
  727. public UInt32 AirValveOpeningDelay
  728. {
  729. get { return airValveOpeningDelay; }
  730. set
  731. {
  732. UInt32 oldValue = airValveOpeningDelay;
  733. if(PlcSettingMessageBus.pLCManagement.WriteAirValveOpeningDelay(value))
  734. {
  735. airValveOpeningDelay = value;
  736. if (oldValue != value)
  737. FaultLog.RecordValueChangeMessage($"气阀开延时从{oldValue}修改为{value}");
  738. }
  739. OnPropertyChanged("AirValveOpeningDelay");
  740. }
  741. }
  742. /// <summary>
  743. /// 装瓶停机值
  744. /// </summary>
  745. private UInt16 bottlingShutdownValue;
  746. public UInt16 BottlingShutdownValue
  747. {
  748. get { return bottlingShutdownValue; }
  749. set
  750. {
  751. UInt16 oldValue = bottlingShutdownValue;
  752. if(PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownValue(value))
  753. {
  754. bottlingShutdownValue = value;
  755. if (oldValue != value)
  756. FaultLog.RecordValueChangeMessage($"装瓶停机值从{oldValue}修改为{value}");
  757. }
  758. OnPropertyChanged("BottlingShutdownValue");
  759. }
  760. }
  761. /// <summary>
  762. /// 装瓶停机时间
  763. /// </summary>
  764. private UInt32 bottlingShutdownTime;
  765. public UInt32 BottlingShutdownTime
  766. {
  767. get { return bottlingShutdownTime; }
  768. set
  769. {
  770. UInt32 oldValue = bottlingShutdownTime;
  771. if(PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownTime(value))
  772. {
  773. bottlingShutdownTime = value;
  774. if (oldValue != value)
  775. FaultLog.RecordValueChangeMessage($"装瓶停机时间从{oldValue}修改为{value}");
  776. }
  777. OnPropertyChanged("BottlingShutdownTime");
  778. }
  779. }
  780. /// <summary>
  781. /// 送瓶轮运行速度
  782. /// </summary>
  783. private float bottleFeedingWheelRunningSpeed;
  784. public string BottleFeedingWheelRunningSpeed
  785. {
  786. get { return bottleFeedingWheelRunningSpeed.ToString("F2"); }
  787. set
  788. {
  789. if (float.TryParse(value, out float result))
  790. {
  791. float oldValue = bottleFeedingWheelRunningSpeed;
  792. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelRunningSpeed(result))
  793. {
  794. bottleFeedingWheelRunningSpeed = result;
  795. if (oldValue != result)
  796. FaultLog.RecordValueChangeMessage($"送瓶轮运行速度从{oldValue}修改为{result}");
  797. }
  798. OnPropertyChanged("BottleFeedingWheelRunningSpeed");
  799. }
  800. }
  801. }
  802. /// <summary>
  803. /// 送瓶轮点动速度
  804. /// </summary>
  805. private float bottleFeedingWheelJogRunningSpeed;
  806. public string BottleFeedingWheelJogRunningSpeed
  807. {
  808. get { return bottleFeedingWheelJogRunningSpeed.ToString("F2"); }
  809. set
  810. {
  811. if (float.TryParse(value, out float result))
  812. {
  813. float oldValue = bottleFeedingWheelJogRunningSpeed;
  814. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelJogRunningSpeed(result))
  815. {
  816. bottleFeedingWheelJogRunningSpeed = result;
  817. if (oldValue != result)
  818. FaultLog.RecordValueChangeMessage($"送瓶轮点动速度从{oldValue}修改为{result}");
  819. }
  820. OnPropertyChanged("BottleFeedingWheelJogRunningSpeed");
  821. }
  822. }
  823. }
  824. /// <summary>
  825. /// 送瓶轮回零偏移值
  826. /// </summary>
  827. private float bottleFeedingWheelReturnToZeroOffsetValue;
  828. public string BottleFeedingWheelReturnToZeroOffsetValue
  829. {
  830. get { return bottleFeedingWheelReturnToZeroOffsetValue.ToString("F2"); }
  831. set
  832. {
  833. if (float.TryParse(value, out float result))
  834. {
  835. float oldValue = bottleFeedingWheelReturnToZeroOffsetValue;
  836. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroOffsetValue(result))
  837. {
  838. bottleFeedingWheelReturnToZeroOffsetValue = result;
  839. if (oldValue != result)
  840. FaultLog.RecordValueChangeMessage($"送瓶轮回零偏移值从{oldValue}修改为{result}");
  841. }
  842. OnPropertyChanged("BottleFeedingWheelReturnToZeroOffsetValue");
  843. }
  844. }
  845. }
  846. /// <summary>
  847. /// 送瓶轮回零速度
  848. /// </summary>
  849. private float bottleFeedingWheelReturnToZeroSpeed;
  850. public string BottleFeedingWheelReturnToZeroSpeed
  851. {
  852. get { return bottleFeedingWheelReturnToZeroSpeed.ToString("F2"); }
  853. set
  854. {
  855. if (float.TryParse(value, out float result))
  856. {
  857. float oldValue = bottleFeedingWheelReturnToZeroSpeed;
  858. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroSpeed(result))
  859. {
  860. bottleFeedingWheelReturnToZeroSpeed = result;
  861. if (oldValue != result)
  862. FaultLog.RecordValueChangeMessage($"送瓶轮回零速度从{oldValue}修改为{result}");
  863. }
  864. OnPropertyChanged("BottleFeedingWheelReturnToZeroSpeed");
  865. }
  866. }
  867. }
  868. /// <summary>
  869. /// 送瓶轮定位长度
  870. /// </summary>
  871. private float bottleFeedingWheelPositionLength;
  872. public string BottleFeedingWheelPositionLength
  873. {
  874. get { return bottleFeedingWheelPositionLength.ToString("F2"); }
  875. set
  876. {
  877. if (float.TryParse(value, out float result))
  878. {
  879. float oldValue = bottleFeedingWheelPositionLength;
  880. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPositionLength(result))
  881. {
  882. bottleFeedingWheelPositionLength = result;
  883. if (oldValue != result)
  884. FaultLog.RecordValueChangeMessage($"送瓶轮定位长度从{oldValue}修改为{result}");
  885. }
  886. OnPropertyChanged("BottleFeedingWheelPositionLength");
  887. }
  888. }
  889. }
  890. /// <summary>
  891. /// 送瓶轮暂停时间
  892. /// </summary>
  893. private UInt32 bottleFeedingWheelPauseTime;
  894. public UInt32 BottleFeedingWheelPauseTime
  895. {
  896. get { return bottleFeedingWheelPauseTime; }
  897. set
  898. {
  899. UInt32 oldValue = bottleFeedingWheelPauseTime;
  900. if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPauseTime(value))
  901. {
  902. bottleFeedingWheelPauseTime = value;
  903. if (oldValue != value)
  904. FaultLog.RecordValueChangeMessage($"送瓶轮暂停时间从{oldValue}修改为{value}");
  905. }
  906. OnPropertyChanged("BottleFeedingWheelPauseTime");
  907. }
  908. }
  909. /// <summary>
  910. /// 下料延时
  911. /// </summary>
  912. private UInt32 delayBlanking;
  913. public UInt32 DelayBlanking
  914. {
  915. get { return delayBlanking; }
  916. set
  917. {
  918. UInt32 oldValue = delayBlanking;
  919. if (PlcSettingMessageBus.pLCManagement.WriteDelayBlanking(value))
  920. {
  921. delayBlanking = value;
  922. if (oldValue != value)
  923. FaultLog.RecordValueChangeMessage($"下料延时从{oldValue}修改为{value}");
  924. }
  925. OnPropertyChanged("DelayBlanking");
  926. }
  927. }
  928. //数据绑定核心实现
  929. public event PropertyChangedEventHandler PropertyChanged;
  930. protected void OnPropertyChanged(string propertyName)
  931. {
  932. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  933. }
  934. }
  935. }