PlcMessageShowBindingClass.cs 35 KB

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