LoaderSetupViewModel.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. using Aitex.Core.Common;
  2. using Aitex.Core.UI.MVVM;
  3. using Aitex.Core.Util;
  4. using Aitex.Core.Utilities;
  5. using LiveCharts;
  6. using MECF.Framework.Common.Beckhoff.AxisProvider;
  7. using MECF.Framework.Common.Beckhoff.Station;
  8. using MECF.Framework.Common.CommonData.Loader;
  9. using MECF.Framework.Common.CommonData.PUF;
  10. using MECF.Framework.Common.DataCenter;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.OperationCenter;
  13. using MECF.Framework.Common.Utilities;
  14. using OpenSEMI.ClientBase;
  15. using CyberX8_MainPages.Unity;
  16. using Prism.Mvvm;
  17. using System;
  18. using System.Collections.Generic;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Threading.Tasks;
  22. using System.Timers;
  23. using System.Windows;
  24. using System.Windows.Documents;
  25. using System.Windows.Input;
  26. using System.Windows.Threading;
  27. using WaferInfo = OpenSEMI.ClientBase.WaferInfo;
  28. namespace CyberX8_MainPages.ViewModels
  29. {
  30. public class LoaderSetupViewModel : BindableBase
  31. {
  32. #region 常量
  33. private const string MOTION_DATA = "MotionData";
  34. private const string IS_SWITCH_ON = "IsSwitchOn";
  35. private const string CURRENT_STATION = "CurrentStation";
  36. private const string SIDE_DATA = "SideData";
  37. private const string COMMON_DATA = "CommonData";
  38. private const string MOTOR_POSITION = "MotorPosition";
  39. private const string CURRENT_OPERATION = "CurrentOperation";
  40. private const double LOADER_ROTATION_DIFFER = 90;
  41. #endregion
  42. #region 内部变量
  43. #region shuttleA
  44. /// <summary>
  45. /// shuttleA模块名称
  46. /// </summary>
  47. private string _shuttleAModuleName;
  48. /// <summary>
  49. /// shuttleA运动数据
  50. /// </summary>
  51. private CommandMotionData _shuttleAMotorData;
  52. /// <summary>
  53. /// shuttleA当前位置
  54. /// </summary>
  55. private string _shuttleACurrentStation;
  56. #endregion
  57. #region TiltA
  58. /// <summary>
  59. /// tiltA模块名称
  60. /// </summary>
  61. private string _tiltAModuleName;
  62. /// <summary>
  63. /// tiltA运动数据
  64. /// </summary>
  65. private CommandMotionData _tiltAMotorData;
  66. /// <summary>
  67. /// tiltA当前位置
  68. /// </summary>
  69. private string _tiltACurrentStation;
  70. /// <summary>
  71. /// Loader1 TiltA实际位置数据
  72. /// </summary>
  73. private double _loader1TiltAMotorPosition;
  74. #endregion
  75. #region CRSA
  76. /// <summary>
  77. /// crsA模块名称
  78. /// </summary>
  79. private string _crsAModuleName;
  80. /// <summary>
  81. /// CRSA运动数据
  82. /// </summary>
  83. private CommandMotionData _crsAMotorData;
  84. /// <summary>
  85. /// crsA当前位置
  86. /// </summary>
  87. private string _crsACurrentStation;
  88. #endregion
  89. #region Rotation
  90. /// <summary>
  91. /// rotation模块名称
  92. /// </summary>
  93. private string _rotationModuleName;
  94. /// <summary>
  95. /// rotation运动数据
  96. /// </summary>
  97. private CommandMotionData _rotationMotorData;
  98. /// <summary>
  99. /// rotation当前位置
  100. /// </summary>
  101. private string _rotationCurrentStation;
  102. /// <summary>
  103. /// Loader1 Rotation UI对应位置
  104. /// </summary>
  105. private double _loader1RotationPosition;
  106. /// <summary>
  107. /// Loader1 Rotation实际位置数据
  108. /// </summary>
  109. private double _loader1RotationMotorPosition;
  110. #endregion
  111. #region shuttleB
  112. /// <summary>
  113. /// shuttleB模块名称
  114. /// </summary>
  115. private string _shuttleBModuleName;
  116. /// <summary>
  117. /// shuttleB运动数据
  118. /// </summary>
  119. private CommandMotionData _shuttleBMotorData;
  120. /// <summary>
  121. /// shuttleB当前位置
  122. /// </summary>
  123. private string _shuttleBCurrentStation;
  124. #endregion
  125. #region TiltB
  126. /// <summary>
  127. /// tiltB模块名称
  128. /// </summary>
  129. private string _tiltBModuleName;
  130. /// <summary>
  131. /// tiltB运动数据
  132. /// </summary>
  133. private CommandMotionData _tiltBMotorData;
  134. /// <summary>
  135. /// tiltB当前位置
  136. /// </summary>
  137. private string _tiltBCurrentStation;
  138. /// <summary>
  139. /// Loader1 TiltB实际位置数据
  140. /// </summary>
  141. private double _loader1TiltBMotorPosition;
  142. #endregion
  143. #region CRSB
  144. /// <summary>
  145. /// crsB模块名称
  146. /// </summary>
  147. private string _crsBModuleName;
  148. /// <summary>
  149. /// crsB运动数据
  150. /// </summary>
  151. private CommandMotionData _crsBMotorData;
  152. /// <summary>
  153. /// crsB当前位置
  154. /// </summary>
  155. private string _crsBCurrentStation;
  156. #endregion
  157. #region SideA
  158. /// <summary>
  159. /// Side A模块名称
  160. /// </summary>
  161. private string _sideAModuleName;
  162. /// <summary>
  163. /// Side A数据
  164. /// </summary>
  165. private LoaderSideData _sideAData;
  166. #endregion
  167. #region SideB
  168. /// <summary>
  169. /// Side B模块名称
  170. /// </summary>
  171. private string _sideBModuleName;
  172. /// <summary>
  173. /// Side B数据
  174. /// </summary>
  175. private LoaderSideData _sideBData;
  176. #endregion
  177. #region Common
  178. /// <summary>
  179. /// Common模块名称
  180. /// </summary>
  181. private string _commonModuleName;
  182. /// <summary>
  183. /// 公共模块数据
  184. /// </summary>
  185. public LoaderCommonData _commonData;
  186. #endregion
  187. #region 系统数据
  188. /// <summary>
  189. /// WaferA尺寸
  190. /// </summary>
  191. private int _waferSizeA = 100;
  192. /// <summary>
  193. /// WaferB尺寸
  194. /// </summary>
  195. private int _waferSizeB = 100;
  196. /// <summary>
  197. /// 查询后台数据集合
  198. /// </summary>
  199. private List<string> _rtDataKeys = new List<string>();
  200. /// <summary>
  201. /// Busy状态
  202. /// </summary>
  203. private bool _isBusy;
  204. /// <summary>
  205. /// CRSH状态
  206. /// </summary>
  207. private bool _isCRSH;
  208. /// <summary>
  209. /// label系列
  210. /// </summary>
  211. private ChartValues<string> _labelSeries;
  212. /// <summary>
  213. /// Value系列
  214. /// </summary>
  215. private ChartValues<double> _valueSeries;
  216. /// <summary>
  217. /// 定时器
  218. /// </summary>
  219. DispatcherTimer _timer;
  220. /// <summary>
  221. /// rt查询key数值字典
  222. /// </summary>
  223. private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
  224. /// <summary>
  225. /// PlateOutCamera Enable
  226. /// </summary>
  227. private Visibility _plateOutCameraVisibility = Visibility.Hidden;
  228. /// <summary>
  229. /// Loader的sideA开启状态
  230. /// </summary>
  231. private bool m_loaderWaferVisibleA = false;
  232. /// <summary>
  233. /// Loader的sideB开启状态
  234. /// </summary>
  235. private bool m_loaderWaferVisibleB = false;
  236. /// <summary>
  237. /// WaferA信息
  238. /// </summary>
  239. private WaferInfo m_loaderWaferA;
  240. /// <summary>
  241. /// WaferB信息
  242. /// </summary>
  243. private WaferInfo m_loaderWaferB;
  244. /// <summary>
  245. /// Loader模块信息
  246. /// </summary>
  247. private ModuleInfo _loaderModuleInfo;
  248. /// <summary>
  249. /// Loader是否安装
  250. /// </summary>
  251. private bool _loaderInstalled;
  252. /// <summary>
  253. /// 当前SideA操作
  254. /// </summary>
  255. private string _currentSideAOperation;
  256. /// <summary>
  257. /// 当前SideA操作
  258. /// </summary>
  259. private string _currentSideBOperation;
  260. #endregion
  261. #endregion
  262. #region 属性
  263. #region 系统数据
  264. public string Module { get; set; }
  265. /// <summary>
  266. /// WaferA尺寸大小
  267. /// </summary>
  268. public int WaferSizeA { get { return _waferSizeA; } set { SetProperty(ref _waferSizeA, value); } }
  269. /// <summary>
  270. /// WaferA尺寸大小
  271. /// </summary>
  272. public int WaferSizeB { get { return _waferSizeB; } set { SetProperty(ref _waferSizeB, value); } }
  273. /// <summary>
  274. /// Busy状态
  275. /// </summary>
  276. public bool IsBusy { get { return _isBusy; } set { SetProperty(ref _isBusy, value); } }
  277. /// <summary>
  278. /// CRSH状态
  279. /// </summary>
  280. public bool IsCRSH { get { return _isCRSH; } set { SetProperty(ref _isCRSH, value); } }
  281. /// <summary>
  282. /// Label系列
  283. /// </summary>
  284. public ChartValues<string> LabelSeries { get { return _labelSeries; } set { SetProperty(ref _labelSeries, value); } }
  285. /// <summary>
  286. /// Value系列
  287. /// </summary>
  288. public ChartValues<double> ValueSeries { get { return _valueSeries; } set { SetProperty(ref _valueSeries, value); } }
  289. /// <summary>
  290. /// Loader的sideA开启状态
  291. /// </summary>
  292. public bool LoaderWaferVisibleA
  293. {
  294. get { return m_loaderWaferVisibleA; }
  295. set { SetProperty(ref m_loaderWaferVisibleA, value); }
  296. }
  297. /// <summary>
  298. /// Loader的sideB开启状态
  299. /// </summary>
  300. public bool LoaderWaferVisibleB
  301. {
  302. get { return m_loaderWaferVisibleB; }
  303. set { SetProperty(ref m_loaderWaferVisibleB, value); }
  304. }
  305. /// <summary>
  306. /// WaferA信息
  307. /// </summary>
  308. public WaferInfo LoaderWaferA
  309. {
  310. get { return m_loaderWaferA; }
  311. set { SetProperty(ref m_loaderWaferA, value); }
  312. }
  313. /// <summary>
  314. /// WaferB信息
  315. /// </summary>
  316. public WaferInfo LoaderWaferB
  317. {
  318. get { return m_loaderWaferB; }
  319. set { SetProperty(ref m_loaderWaferB, value); }
  320. }
  321. /// <summary>
  322. /// Loader模块信息
  323. /// </summary>
  324. public ModuleInfo LoaderModuleInfo
  325. {
  326. get { return _loaderModuleInfo; }
  327. set { SetProperty(ref _loaderModuleInfo, value); }
  328. }
  329. /// <summary>
  330. /// Loader是否安装
  331. /// </summary>
  332. public bool LoaderIsInstalled
  333. {
  334. get { return _loaderInstalled; }
  335. set { SetProperty(ref _loaderInstalled, value); }
  336. }
  337. /// <summary>
  338. /// 当前SideA操作
  339. /// </summary>
  340. public string CurrentSideAOperation
  341. {
  342. get { return _currentSideAOperation; }
  343. set { SetProperty(ref _currentSideAOperation, value); }
  344. }
  345. /// <summary>
  346. /// 当前SideB操作
  347. /// </summary>
  348. public string CurrentSideBOperation
  349. {
  350. get { return _currentSideBOperation; }
  351. set { SetProperty(ref _currentSideBOperation, value); }
  352. }
  353. #endregion
  354. #region shuttleA
  355. /// <summary>
  356. /// shuttleA名称
  357. /// </summary>
  358. public string ShuttleAModuleName
  359. {
  360. get { return _shuttleAModuleName; }
  361. set { SetProperty(ref _shuttleAModuleName, value); }
  362. }
  363. /// <summary>
  364. /// shuttleA运动数据
  365. /// </summary>
  366. public CommandMotionData ShuttleAMotionData
  367. {
  368. get { return _shuttleAMotorData; }
  369. set { SetProperty(ref _shuttleAMotorData, value); }
  370. }
  371. /// <summary>
  372. /// shuttleA当前位置
  373. /// </summary>
  374. public string ShuttleACurrentStation
  375. {
  376. get { return _shuttleACurrentStation; }
  377. set { SetProperty(ref _shuttleACurrentStation, value); }
  378. }
  379. #endregion
  380. #region TiltA
  381. /// <summary>
  382. /// TiltA名称
  383. /// </summary>
  384. public string TiltAModuleName
  385. {
  386. get { return _tiltAModuleName; }
  387. set { SetProperty(ref _tiltAModuleName, value); }
  388. }
  389. /// <summary>
  390. /// TiltA运动数据
  391. /// </summary>
  392. public CommandMotionData TiltAMotionData
  393. {
  394. get { return _tiltAMotorData; }
  395. set { SetProperty(ref _tiltAMotorData, value); }
  396. }
  397. /// <summary>
  398. /// TiltA当前位置
  399. /// </summary>
  400. public string TiltACurrentStation
  401. {
  402. get { return _tiltACurrentStation; }
  403. set { SetProperty(ref _tiltACurrentStation, value); }
  404. }
  405. /// <summary>
  406. /// Loader1 TiltA实际位置数据
  407. /// </summary>
  408. public double Loader1TiltAMotorPosition
  409. {
  410. get { return _loader1TiltAMotorPosition; }
  411. set { SetProperty(ref _loader1TiltAMotorPosition, value); }
  412. }
  413. #endregion
  414. #region CRSA
  415. /// <summary>
  416. /// CRSA名称
  417. /// </summary>
  418. public string CRSAModuleName
  419. {
  420. get { return _crsAModuleName; }
  421. set { SetProperty(ref _crsAModuleName, value); }
  422. }
  423. /// <summary>
  424. /// CRSA运动数据
  425. /// </summary>
  426. public CommandMotionData CRSAMotionData
  427. {
  428. get { return _crsAMotorData; }
  429. set { SetProperty(ref _crsAMotorData, value); }
  430. }
  431. /// <summary>
  432. /// CRSA当前位置
  433. /// </summary>
  434. public string CRSACurrentStation
  435. {
  436. get { return _crsACurrentStation; }
  437. set { SetProperty(ref _crsACurrentStation, value); }
  438. }
  439. #endregion
  440. #region Rotation
  441. /// <summary>
  442. /// Rotation名称
  443. /// </summary>
  444. public string RotationModuleName
  445. {
  446. get { return _rotationModuleName; }
  447. set { SetProperty(ref _rotationModuleName, value); }
  448. }
  449. /// <summary>
  450. /// Rotation运动数据
  451. /// </summary>
  452. public CommandMotionData RotationMotionData
  453. {
  454. get { return _rotationMotorData; }
  455. set { SetProperty(ref _rotationMotorData, value); }
  456. }
  457. /// <summary>
  458. /// Loader1 Rotation UI对应位置
  459. /// </summary>
  460. public double Loader1RotationPosition
  461. {
  462. get { return _loader1RotationPosition; }
  463. set { SetProperty(ref _loader1RotationPosition, value); }
  464. }
  465. /// <summary>
  466. /// Rotation当前位置
  467. /// </summary>
  468. public string RotationCurrentStation
  469. {
  470. get { return _rotationCurrentStation; }
  471. set { SetProperty(ref _rotationCurrentStation, value); }
  472. }
  473. /// <summary>
  474. /// Loader1 Rotation实际位置数据
  475. /// </summary>
  476. public double Loader1RotationMotorPosition
  477. {
  478. get { return _loader1RotationMotorPosition; }
  479. set { SetProperty(ref _loader1RotationMotorPosition, value); }
  480. }
  481. #endregion
  482. #region shuttleB
  483. /// <summary>
  484. /// shuttleB名称
  485. /// </summary>
  486. public string ShuttleBModuleName
  487. {
  488. get { return _shuttleBModuleName; }
  489. set { SetProperty(ref _shuttleBModuleName, value); }
  490. }
  491. /// <summary>
  492. /// shuttleB运动数据
  493. /// </summary>
  494. public CommandMotionData ShuttleBMotionData
  495. {
  496. get { return _shuttleBMotorData; }
  497. set { SetProperty(ref _shuttleBMotorData, value); }
  498. }
  499. /// <summary>
  500. /// shuttleB当前位置
  501. /// </summary>
  502. public string ShuttleBCurrentStation
  503. {
  504. get { return _shuttleBCurrentStation; }
  505. set { SetProperty(ref _shuttleBCurrentStation, value); }
  506. }
  507. #endregion
  508. #region TiltB
  509. /// <summary>
  510. /// TiltB名称
  511. /// </summary>
  512. public string TiltBModuleName
  513. {
  514. get { return _tiltBModuleName; }
  515. set { SetProperty(ref _tiltBModuleName, value); }
  516. }
  517. /// <summary>
  518. /// TiltB运动数据
  519. /// </summary>
  520. public CommandMotionData TiltBMotionData
  521. {
  522. get { return _tiltBMotorData; }
  523. set { SetProperty(ref _tiltBMotorData, value); }
  524. }
  525. /// <summary>
  526. /// TiltB当前位置
  527. /// </summary>
  528. public string TiltBCurrentStation
  529. {
  530. get { return _tiltBCurrentStation; }
  531. set { SetProperty(ref _tiltBCurrentStation, value); }
  532. }
  533. /// <summary>
  534. /// Loader1 TiltB实际位置数据
  535. /// </summary>
  536. public double Loader1TiltBMotorPosition
  537. {
  538. get { return _loader1TiltBMotorPosition; }
  539. set { SetProperty(ref _loader1TiltBMotorPosition, value); }
  540. }
  541. #endregion
  542. #region CRSB
  543. /// <summary>
  544. /// CRSB名称
  545. /// </summary>
  546. public string CRSBModuleName
  547. {
  548. get { return _crsBModuleName; }
  549. set { SetProperty(ref _crsBModuleName, value); }
  550. }
  551. /// <summary>
  552. /// CRSB运动数据
  553. /// </summary>
  554. public CommandMotionData CRSBMotionData
  555. {
  556. get { return _crsBMotorData; }
  557. set { SetProperty(ref _crsBMotorData, value); }
  558. }
  559. /// <summary>
  560. /// CRSB当前位置
  561. /// </summary>
  562. public string CRSBCurrentStation
  563. {
  564. get { return _crsBCurrentStation; }
  565. set { SetProperty(ref _crsBCurrentStation, value); }
  566. }
  567. #endregion
  568. #region Side A
  569. /// <summary>
  570. /// Side A模块名称
  571. /// </summary>
  572. public string SideAModuleName
  573. {
  574. get { return _sideAModuleName; }
  575. set { SetProperty(ref _sideAModuleName, value); }
  576. }
  577. /// <summary>
  578. /// Side A数据
  579. /// </summary>
  580. public LoaderSideData SideAData
  581. {
  582. get { return _sideAData; }
  583. set { SetProperty(ref _sideAData, value); }
  584. }
  585. #endregion
  586. #region Side B
  587. /// <summary>
  588. /// Side B模块名称
  589. /// </summary>
  590. public string SideBModuleName
  591. {
  592. get { return _sideBModuleName; }
  593. set { SetProperty(ref _sideBModuleName, value); }
  594. }
  595. /// <summary>
  596. /// Side B数据
  597. /// </summary>
  598. public LoaderSideData SideBData
  599. {
  600. get { return _sideBData; }
  601. set { SetProperty(ref _sideBData, value); }
  602. }
  603. #endregion
  604. #region Common
  605. /// <summary>
  606. /// Common模块名称
  607. /// </summary>
  608. public string CommonModuleName
  609. {
  610. get { return _commonModuleName; }
  611. set { SetProperty(ref _commonModuleName, value); }
  612. }
  613. /// <summary>
  614. /// 公共数据
  615. /// </summary>
  616. public LoaderCommonData CommonData
  617. {
  618. get { return _commonData; }
  619. set { SetProperty(ref _commonData, value);}
  620. }
  621. /// <summary>
  622. /// PlateOut Camera Enable
  623. /// </summary>
  624. public Visibility PlateOutCameraVisibility
  625. {
  626. get { return _plateOutCameraVisibility; }
  627. set { SetProperty(ref _plateOutCameraVisibility, value);}
  628. }
  629. #endregion
  630. #endregion
  631. #region 指令
  632. [IgnorePropertyChange]
  633. public ICommand SideALoadCommand
  634. {
  635. get;
  636. private set;
  637. }
  638. [IgnorePropertyChange]
  639. public ICommand SideAUnloadCommand
  640. {
  641. get;
  642. private set;
  643. }
  644. [IgnorePropertyChange]
  645. public ICommand SideAInstallCRSCommand
  646. {
  647. get;private set;
  648. }
  649. [IgnorePropertyChange]
  650. public ICommand SideBLoadCommand
  651. {
  652. get;
  653. private set;
  654. }
  655. [IgnorePropertyChange]
  656. public ICommand SideBUnloadCommand
  657. {
  658. get;
  659. private set;
  660. }
  661. [IgnorePropertyChange]
  662. public ICommand SideBInstallCRSCommand
  663. {
  664. get; private set;
  665. }
  666. #endregion
  667. /// <summary>
  668. /// 构造函数
  669. /// </summary>
  670. public LoaderSetupViewModel()
  671. {
  672. SideALoadCommand=new DelegateCommand<object>(SideALoadAction);
  673. SideAUnloadCommand = new DelegateCommand<object>(SideAUnloadAction);
  674. SideAInstallCRSCommand = new DelegateCommand<object>(SideAInstallCRSAction);
  675. SideBLoadCommand = new DelegateCommand<object>(SideBLoadAction);
  676. SideBUnloadCommand = new DelegateCommand<object>(SideBUnloadAction);
  677. SideBInstallCRSCommand = new DelegateCommand<object>(SideBInstallCRSAction);
  678. }
  679. /// <summary>
  680. /// 加载数据
  681. /// </summary>
  682. public void LoadData(string systemName)
  683. {
  684. Module = systemName;
  685. ShuttleAModuleName = $"{Module}.ShuttleA";
  686. TiltAModuleName = $"{Module}.TiltA";
  687. CRSAModuleName = $"{Module}.LSA";
  688. RotationModuleName = $"{Module}.Rotation";
  689. ShuttleBModuleName = $"{Module}.ShuttleB";
  690. TiltBModuleName = $"{Module}.TiltB";
  691. CRSBModuleName = $"{Module}.LSB";
  692. SideAModuleName = $"{Module}.SideA";
  693. SideBModuleName = $"{Module}.SideB";
  694. CommonModuleName = $"{Module}.Common";
  695. bool plateOutCameraEnable= (bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName.Loader1}.PlateOutCameraEnable");
  696. if(plateOutCameraEnable)
  697. {
  698. PlateOutCameraVisibility = Visibility.Visible;
  699. }
  700. else
  701. {
  702. PlateOutCameraVisibility = Visibility.Hidden;
  703. }
  704. //LoaderIsinstalled
  705. Dictionary<string, object> allModulesDictionary = QueryDataClient.Instance.Service.PollData(new List<string>() { "System.InstalledModules" });
  706. if (allModulesDictionary != null)
  707. {
  708. List<string> allModules = CommonFunction.GetValue<List<string>>(allModulesDictionary, "System.InstalledModules");
  709. LoaderIsInstalled = allModules.Contains(ModuleName.Loader1.ToString());
  710. }
  711. WaferSizeA = (int)QueryDataClient.Instance.Service.GetConfig("Loader1.SideAWaferSize");
  712. WaferSizeB = (int)QueryDataClient.Instance.Service.GetConfig("Loader1.SideBWaferSize");
  713. AddDataKeys();
  714. ValueSeries = new ChartValues<double>();
  715. LabelSeries = new ChartValues<string>();
  716. if (_timer == null)
  717. {
  718. _timer = new DispatcherTimer();
  719. _timer.Interval = TimeSpan.FromMilliseconds(100);
  720. _timer.Tick += Timer_Tick;
  721. }
  722. _timer.Start();
  723. }
  724. /// <summary>
  725. /// 定时器
  726. /// </summary>
  727. /// <param name="sender"></param>
  728. /// <param name="e"></param>
  729. private void Timer_Tick(object sender, EventArgs e)
  730. {
  731. LoaderModuleInfo = ModuleManager.ModuleInfos["Loader1"];
  732. if (LoaderIsInstalled && LoaderModuleInfo != null)
  733. {
  734. if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
  735. {
  736. LoaderWaferA = LoaderModuleInfo.WaferManager.Wafers[0];
  737. }
  738. if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
  739. {
  740. LoaderWaferB = LoaderModuleInfo.WaferManager.Wafers[1];
  741. }
  742. }
  743. if (_rtDataKeys.Count != 0)
  744. {
  745. _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
  746. if (_rtDataValueDic != null)
  747. {
  748. //SRD Wafer信息
  749. if (ModuleManager.ModuleInfos[$"{Module}"].WaferManager.Wafers.Count != 0)
  750. {
  751. LoaderWaferA = ModuleManager.ModuleInfos[$"{Module}"].WaferManager.Wafers[0];
  752. LoaderWaferB = ModuleManager.ModuleInfos[$"{Module}"].WaferManager.Wafers[1];
  753. }
  754. ShuttleAMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{ShuttleAModuleName}.{MOTION_DATA}");
  755. ShuttleACurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{ShuttleAModuleName}.{CURRENT_STATION}"), ShuttleAModuleName);
  756. ShuttleBMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{ShuttleBModuleName}.{MOTION_DATA}");
  757. ShuttleBCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{ShuttleBModuleName}.{CURRENT_STATION}"), ShuttleBModuleName);
  758. TiltAMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{TiltAModuleName}.{MOTION_DATA}");
  759. TiltACurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{TiltAModuleName}.{CURRENT_STATION}"), TiltAModuleName);
  760. TiltBMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{TiltBModuleName}.{MOTION_DATA}");
  761. TiltBCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{TiltBModuleName}.{CURRENT_STATION}"), TiltBModuleName);
  762. CRSAMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{CRSAModuleName}.{MOTION_DATA}");
  763. CRSACurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{CRSAModuleName}.{CURRENT_STATION}"), CRSAModuleName);
  764. CRSBMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{CRSBModuleName}.{MOTION_DATA}");
  765. CRSBCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{CRSBModuleName}.{CURRENT_STATION}"), CRSBModuleName);
  766. RotationMotionData = CommonFunction.GetValue<CommandMotionData>(_rtDataValueDic, $"{RotationModuleName}.{MOTION_DATA}");
  767. RotationCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(_rtDataValueDic, $"{RotationModuleName}.{CURRENT_STATION}"), RotationModuleName);
  768. SideAData = CommonFunction.GetValue<LoaderSideData>(_rtDataValueDic, $"{SideAModuleName}.{SIDE_DATA}");
  769. SideBData = CommonFunction.GetValue<LoaderSideData>(_rtDataValueDic, $"{SideBModuleName}.{SIDE_DATA}");
  770. CommonData = CommonFunction.GetValue<LoaderCommonData>(_rtDataValueDic, $"{Module}.{COMMON_DATA}");
  771. if (CommonData!=null&&CommonData.FlowValues != null && CommonData.FlowValues.Count != 0)
  772. {
  773. if (ValueSeries.Count < CommonData.FlowValues.Count)
  774. {
  775. InitialValueSeries(CommonData.FlowValues);
  776. }
  777. }
  778. else
  779. {
  780. ValueSeries.Clear();
  781. LabelSeries.Clear();
  782. }
  783. Loader1TiltAMotorPosition = TiltBMotionData.MotorPosition;
  784. Loader1TiltBMotorPosition = TiltAMotionData.MotorPosition;
  785. Loader1RotationMotorPosition = RotationMotionData.MotorPosition;
  786. //计Loader Rotation UI位置
  787. Loader1RotationPosition = -Loader1RotationMotorPosition - LOADER_ROTATION_DIFFER;
  788. //判断Loader1的TiltA水平状态
  789. if (TiltACurrentStation == "HORI")
  790. {
  791. LoaderWaferVisibleA = true;
  792. }
  793. else if (TiltACurrentStation == "VERT")
  794. {
  795. LoaderWaferVisibleA = false;
  796. }
  797. //判断Loader1的TiltB水平状态
  798. if (TiltBCurrentStation == "HORI")
  799. {
  800. LoaderWaferVisibleB = true;
  801. }
  802. else if (TiltBCurrentStation == "VERT")
  803. {
  804. LoaderWaferVisibleB = false;
  805. }
  806. CurrentSideAOperation = CommonFunction.GetValue<string>(_rtDataValueDic, $"{SideAModuleName}.{CURRENT_OPERATION}");
  807. CurrentSideBOperation = CommonFunction.GetValue<string>(_rtDataValueDic, $"{SideBModuleName}.{CURRENT_OPERATION}");
  808. }
  809. }
  810. }
  811. /// <summary>
  812. /// 隐藏
  813. /// </summary>
  814. public void Hide()
  815. {
  816. if (_timer != null)
  817. {
  818. _timer.Stop();
  819. }
  820. }
  821. /// <summary>
  822. /// 初始化查询数据集合
  823. /// </summary>
  824. private void AddDataKeys()
  825. {
  826. _rtDataKeys.Clear();
  827. _rtDataKeys.Add($"{ShuttleAModuleName}.{MOTION_DATA}");
  828. _rtDataKeys.Add($"{ShuttleAModuleName}.{IS_SWITCH_ON}");
  829. _rtDataKeys.Add($"{ShuttleAModuleName}.{CURRENT_STATION}");
  830. _rtDataKeys.Add($"{ShuttleBModuleName}.{MOTION_DATA}");
  831. _rtDataKeys.Add($"{ShuttleBModuleName}.{IS_SWITCH_ON}");
  832. _rtDataKeys.Add($"{ShuttleBModuleName}.{CURRENT_STATION}");
  833. _rtDataKeys.Add($"{TiltAModuleName}.{MOTION_DATA}");
  834. _rtDataKeys.Add($"{TiltAModuleName}.{IS_SWITCH_ON}");
  835. _rtDataKeys.Add($"{TiltAModuleName}.{CURRENT_STATION}");
  836. _rtDataKeys.Add($"{TiltBModuleName}.{MOTION_DATA}");
  837. _rtDataKeys.Add($"{TiltBModuleName}.{IS_SWITCH_ON}");
  838. _rtDataKeys.Add($"{TiltBModuleName}.{CURRENT_STATION}");
  839. _rtDataKeys.Add($"{CRSAModuleName}.{MOTION_DATA}");
  840. _rtDataKeys.Add($"{CRSAModuleName}.{IS_SWITCH_ON}");
  841. _rtDataKeys.Add($"{CRSAModuleName}.{CURRENT_STATION}");
  842. _rtDataKeys.Add($"{CRSBModuleName}.{MOTION_DATA}");
  843. _rtDataKeys.Add($"{CRSBModuleName}.{IS_SWITCH_ON}");
  844. _rtDataKeys.Add($"{CRSBModuleName}.{CURRENT_STATION}");
  845. _rtDataKeys.Add($"{RotationModuleName}.{MOTION_DATA}");
  846. _rtDataKeys.Add($"{RotationModuleName}.{IS_SWITCH_ON}");
  847. _rtDataKeys.Add($"{RotationModuleName}.{CURRENT_STATION}");
  848. _rtDataKeys.Add($"{SideAModuleName}.{SIDE_DATA}");
  849. _rtDataKeys.Add($"{SideBModuleName}.{SIDE_DATA}");
  850. _rtDataKeys.Add($"{Module}.{COMMON_DATA}");
  851. _rtDataKeys.Add($"{SideAModuleName}.{CURRENT_OPERATION}");
  852. _rtDataKeys.Add($"{SideBModuleName}.{CURRENT_OPERATION}");
  853. }
  854. private void InitialValueSeries(List<LoaderFlowLotTrackData> datas)
  855. {
  856. foreach(LoaderFlowLotTrackData item in datas)
  857. {
  858. ValueSeries.Add(item.FlowValue);
  859. LabelSeries.Add(item.Time);
  860. }
  861. }
  862. #region 指令Action
  863. /// <summary>
  864. /// Load Action
  865. /// </summary>
  866. /// <param name="obj"></param>
  867. private void SideALoadAction(object obj)
  868. {
  869. InvokeClient.Instance.Service.DoOperation($"{Module}.SideA.Load");
  870. }
  871. /// <summary>
  872. /// Unload Action
  873. /// </summary>
  874. /// <param name="obj"></param>
  875. private void SideAUnloadAction(object obj)
  876. {
  877. InvokeClient.Instance.Service.DoOperation($"{Module}.SideA.Unload");
  878. }
  879. /// <summary>
  880. /// Install CRS Action
  881. /// </summary>
  882. /// <param name="obj"></param>
  883. private void SideAInstallCRSAction(object obj)
  884. {
  885. InvokeClient.Instance.Service.DoOperation($"{Module}.SideA.InstallCRS");
  886. }
  887. /// <summary>
  888. /// SideB Load Action
  889. /// </summary>
  890. /// <param name="obj"></param>
  891. private void SideBLoadAction(object obj)
  892. {
  893. InvokeClient.Instance.Service.DoOperation($"{Module}.SideB.Load");
  894. }
  895. /// <summary>
  896. /// SideB Unload Action
  897. /// </summary>
  898. /// <param name="obj"></param>
  899. private void SideBUnloadAction(object obj)
  900. {
  901. InvokeClient.Instance.Service.DoOperation($"{Module}.SideB.Unload");
  902. }
  903. /// <summary>
  904. /// SideB Install CRS Action
  905. /// </summary>
  906. /// <param name="obj"></param>
  907. private void SideBInstallCRSAction(object obj)
  908. {
  909. InvokeClient.Instance.Service.DoOperation($"{Module}.SideB.InstallCRS");
  910. }
  911. #endregion
  912. }
  913. }