TMViewModel.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. using Aitex.Sorter.Common;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.Common.Schedulers;
  7. using OpenSEMI.ClientBase;
  8. using Prism.Commands;
  9. using Prism.Mvvm;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Collections.ObjectModel;
  13. using System.Linq;
  14. using System.Threading.Tasks;
  15. using System.Windows.Threading;
  16. using Venus_Core;
  17. using Venus_MainPages.Unity;
  18. using Venus_Themes.CustomControls;
  19. using Venus_Themes.Unity;
  20. namespace Venus_MainPages.ViewModels
  21. {
  22. public enum TMModule
  23. {
  24. PMA, PMB, PMC, PMD, LLA, LLB
  25. }
  26. public enum TMBlade
  27. {
  28. Blade1, Blade2
  29. }
  30. internal class TMViewModel : BindableBase
  31. {
  32. #region 私有字段
  33. //private ModuleInfo m_PMAWafer;
  34. private ModuleInfo m_LLAModuleInfo;
  35. private ModuleInfo m_LLBModuleInfo;
  36. private ModuleInfo m_TMModuleInfo;
  37. private bool m_TMIsOFFline;
  38. private bool m_LLIsOFFline;
  39. private WaferInfo m_PMAWafer;
  40. private WaferInfo m_PMBWafer;
  41. private WaferInfo m_PMCWafer;
  42. private WaferInfo m_PMDWafer;
  43. private WaferInfo m_LLAWafer;
  44. private WaferInfo m_LLBWafer;
  45. private WaferInfo m_BladeAWafer;
  46. private WaferInfo m_BladeBWafer;
  47. private bool m_PMADoorIsOpen;
  48. //private bool m_PMBDoorIsOpen;
  49. //private bool m_PMCDoorIsOpen;
  50. //private bool m_PMDDoorIsOpen;
  51. private bool m_LLADoorIsOpen;
  52. private WaferRobotTAction m_WaferRobotTAction;
  53. private WaferRobotTAction m_Robot1TAction;
  54. private WaferRobotXAction m_Robot1XAction;
  55. private WaferRobotTAction m_Robot2TAction;
  56. private WaferRobotXAction m_Robot2XAction;
  57. private TMModule m_PickSelectedModule;
  58. private TMModule m_PlaceSelectedModule;
  59. private TMModule m_ExtendSelectedModule;
  60. private TMModule m_RetractSelectedModule;
  61. private TMBlade m_PickSelectedBlade;
  62. private TMBlade m_PlaceSelectedBlade;
  63. private TMBlade m_ExtendSelectedBlade;
  64. private TMBlade m_RetractSelectedBlade;
  65. private TMBlade m_GoToSelectedBlade;
  66. private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
  67. private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
  68. private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
  69. private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
  70. private int m_PickSoltSelectedIndex;
  71. private int m_PlaceSoltSelectedIndex;
  72. private int m_ExtendSoltSelectedIndex;
  73. private int m_RetractSoltSelectedIndex;
  74. private List<string> m_RtDataKeys=new List<string> ();
  75. private Dictionary<string, object> m_RtDataValues;
  76. private string m_ModuleCheckedName="TM";
  77. private string m_RobotAction;
  78. private string m_RobotTarget;
  79. private string m_RobotArm;
  80. private bool m_PMAIsInstalled;
  81. private bool m_PMBIsInstalled;
  82. private bool m_PMCIsInstalled;
  83. private bool m_PMDIsInstalled;
  84. private bool m_LLAIsInstalled;
  85. private bool m_LLBIsInstalled;
  86. private bool m_TMIsInstalled;
  87. private List<string> m_OriginalCycle=new List<string> ();
  88. private List<string> m_ToCycle = new List<string>();
  89. private List<TMModule> m_TMModules= new List<TMModule>();
  90. private bool m_CycleEnable;
  91. private string m_OriginalCycleSelectedItem;
  92. private string m_ToCycleSelectedItem;
  93. private bool m_PMAIsCycle;
  94. private bool m_PMBIsCycle;
  95. private bool m_PMCIsCycle;
  96. private bool m_PMDIsCycle;
  97. private int m_CycleCount;
  98. private PressureType m_PressureType;
  99. private bool m_firstFlag = true;
  100. #endregion
  101. #region 属性
  102. public PressureType PressureType
  103. {
  104. get { return m_PressureType; }
  105. set { SetProperty(ref m_PressureType, value); }
  106. }
  107. public List<string> OriginalCycle
  108. {
  109. get { return m_OriginalCycle; }
  110. set { SetProperty(ref m_OriginalCycle, value); }
  111. }
  112. public List<string> ToCycle
  113. {
  114. get { return m_ToCycle; }
  115. set { SetProperty(ref m_ToCycle, value); }
  116. }
  117. public string RobotAction2
  118. {
  119. get { return m_RobotAction; }
  120. set
  121. {
  122. //RobotActiont(m_RobotAction, value);
  123. SetProperty(ref m_RobotAction, value);
  124. }
  125. }
  126. public RobotMoveInfo m_robotMoveInfo;
  127. public RobotMoveInfo RobotMoveInfo
  128. {
  129. get { return m_robotMoveInfo; }
  130. set
  131. {
  132. RobotMoveInfoChanged(m_robotMoveInfo, value);
  133. m_robotMoveInfo = value;
  134. }
  135. }
  136. public string RobotTarget
  137. {
  138. get { return m_RobotTarget; }
  139. set
  140. {
  141. SetProperty(ref m_RobotTarget, value);
  142. }
  143. }
  144. public string RobotArm
  145. {
  146. get { return m_RobotArm; }
  147. set
  148. {
  149. SetProperty(ref m_RobotArm, value);
  150. }
  151. }
  152. int arm1oldWaferStatus = 100;
  153. int arm2oldWaferStatus = 100;
  154. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  155. {
  156. string RobotTarget;
  157. if (oldValue == null || newValue == null)
  158. {
  159. return;
  160. }
  161. #region Rotating
  162. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  163. {
  164. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  165. if (TMRobotMoveActionBladeTarget != null)
  166. {
  167. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  168. }
  169. else
  170. {
  171. return;
  172. }
  173. var values = RobotTarget.Split('.');
  174. var arm = values[0];
  175. var module = values[1];
  176. if (arm == "ArmA")
  177. {
  178. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  179. }
  180. else if (arm == "ArmB")
  181. {
  182. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  183. }
  184. }
  185. #endregion
  186. #region pick 和 place LL
  187. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  188. {
  189. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  190. if (TMRobotMoveActionBladeTarget != null)
  191. {
  192. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  193. }
  194. else
  195. {
  196. return;
  197. }
  198. var values = RobotTarget.Split('.');
  199. var arm = values[0];
  200. var module = values[1];
  201. if (arm == "ArmA")
  202. {
  203. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  204. if (waferRobotTAction != Robot1TAction)
  205. {
  206. Robot1TAction = waferRobotTAction;
  207. }
  208. else
  209. {
  210. //await Task.Delay(100);
  211. }
  212. await Task.Delay(600);
  213. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  214. //await Task.Delay(600);
  215. Robot1XAction = WaferRobotXAction.Extend;
  216. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  217. {
  218. await Task.Delay(100);
  219. }
  220. Robot1XAction = WaferRobotXAction.Retract;
  221. }
  222. else if (arm == "ArmB")
  223. {
  224. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  225. if (waferRobotTAction != Robot2TAction)
  226. {
  227. Robot2TAction = waferRobotTAction;
  228. }
  229. else
  230. {
  231. //await Task.Delay(100);
  232. }
  233. await Task.Delay(600);
  234. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  235. //await Task.Delay(600);
  236. Robot2XAction = WaferRobotXAction.Extend;
  237. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  238. {
  239. await Task.Delay(100);
  240. }
  241. Robot2XAction = WaferRobotXAction.Retract;
  242. }
  243. }
  244. #endregion
  245. #region pick 和 place pm
  246. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  247. {
  248. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  249. if (TMRobotMoveActionBladeTarget != null)
  250. {
  251. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  252. }
  253. else
  254. {
  255. return;
  256. }
  257. var values = RobotTarget.Split('.');
  258. var arm = values[0];
  259. var module = values[1];
  260. if (arm == "ArmA")
  261. {
  262. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  263. if (waferRobotTAction != Robot1TAction)
  264. {
  265. Robot1TAction = waferRobotTAction;
  266. }
  267. else
  268. {
  269. // await Task.Delay(100);
  270. }
  271. await Task.Delay(600);
  272. Robot1XAction = WaferRobotXAction.Extend;
  273. }
  274. else if (arm == "ArmB")
  275. {
  276. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  277. if (waferRobotTAction != Robot2TAction)
  278. {
  279. Robot2TAction = waferRobotTAction;
  280. }
  281. else
  282. {
  283. // await Task.Delay(100);
  284. }
  285. await Task.Delay(600);
  286. Robot2XAction = WaferRobotXAction.Extend;
  287. }
  288. }
  289. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  290. {
  291. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  292. if (TMRobotMoveActionBladeTarget != null)
  293. {
  294. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  295. }
  296. else
  297. {
  298. return;
  299. }
  300. var values = RobotTarget.Split('.');
  301. var arm = values[0];
  302. if (arm == "ArmA")
  303. {
  304. Robot1XAction = WaferRobotXAction.Retract;
  305. }
  306. else if (arm == "ArmB")
  307. {
  308. Robot2XAction = WaferRobotXAction.Retract;
  309. }
  310. }
  311. #endregion
  312. #region Home
  313. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  314. {
  315. if (Robot1XAction == WaferRobotXAction.Extend)
  316. {
  317. Robot1XAction = WaferRobotXAction.Retract;
  318. }
  319. if (Robot2XAction == WaferRobotXAction.Extend)
  320. {
  321. Robot2XAction = WaferRobotXAction.Retract;
  322. }
  323. await Task.Delay(2000);
  324. if (Robot1TAction != WaferRobotTAction.T_Origin)
  325. {
  326. Robot1TAction = WaferRobotTAction.T_Origin;
  327. }
  328. if (Robot2TAction != WaferRobotTAction.T_Origin)
  329. {
  330. Robot2TAction = WaferRobotTAction.T_Origin;
  331. }
  332. }
  333. #endregion
  334. }
  335. private async void RobotActiont(string oldValue,string newValue)
  336. {
  337. if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus==1)
  338. {
  339. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  340. if (TMRobotMoveActionBladeTarget != null)
  341. {
  342. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  343. }
  344. else
  345. {
  346. return;
  347. }
  348. var values = RobotTarget.Split('.');
  349. var arm = values[0];
  350. var module = values[1];
  351. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  352. await Task.Delay(1500);
  353. Robot1XAction = WaferRobotXAction.Extend;
  354. if (arm == "ArmA")
  355. {
  356. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  357. await Task.Delay(1500);
  358. Robot1XAction = WaferRobotXAction.Extend;
  359. }
  360. else if (arm == "ArmB")
  361. {
  362. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  363. await Task.Delay(1500);
  364. Robot2XAction = WaferRobotXAction.Extend;
  365. }
  366. }
  367. if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 1)
  368. {
  369. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  370. if (TMRobotMoveActionBladeTarget != null)
  371. {
  372. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  373. }
  374. else
  375. {
  376. return;
  377. }
  378. var values = RobotTarget.Split('.');
  379. var arm = values[0];
  380. var module = values[1];
  381. if (arm == "ArmA")
  382. {
  383. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  384. await Task.Delay(1500);
  385. Robot1XAction = WaferRobotXAction.Extend;
  386. }
  387. else if (arm == "ArmB")
  388. {
  389. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  390. await Task.Delay(1500);
  391. Robot2XAction = WaferRobotXAction.Extend;
  392. }
  393. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  394. //await Task.Delay(1500);
  395. //Robot2XAction = WaferRobotXAction.Extend;
  396. }
  397. if (arm1oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus)
  398. {
  399. Robot1XAction = WaferRobotXAction.Retract;
  400. }
  401. if (arm2oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus)
  402. {
  403. Robot2XAction = WaferRobotXAction.Retract;
  404. }
  405. if (oldValue == "None" && newValue == "Picking" && ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus == 0)
  406. {
  407. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  408. if (TMRobotMoveActionBladeTarget != null)
  409. {
  410. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  411. }
  412. else
  413. {
  414. return;
  415. }
  416. var values = RobotTarget.Split('.');
  417. var arm = values[0];
  418. var module = values[1];
  419. if (arm == "ArmA")
  420. {
  421. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  422. await Task.Delay(1500);
  423. Robot1XAction = WaferRobotXAction.Extend;
  424. }
  425. else if (arm == "ArmB")
  426. {
  427. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  428. await Task.Delay(1500);
  429. Robot2XAction = WaferRobotXAction.Extend;
  430. }
  431. }
  432. #region pick 和 place pm
  433. if (oldValue == "None" && newValue == "Extending")
  434. {
  435. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  436. if (TMRobotMoveActionBladeTarget != null)
  437. {
  438. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  439. }
  440. else
  441. {
  442. return;
  443. }
  444. var values = RobotTarget.Split('.');
  445. var arm = values[0];
  446. var module = values[1];
  447. if (arm == "ArmA")
  448. {
  449. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  450. await Task.Delay(1500);
  451. Robot1XAction = WaferRobotXAction.Extend;
  452. }
  453. else if (arm == "ArmB")
  454. {
  455. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  456. await Task.Delay(1500);
  457. Robot2XAction = WaferRobotXAction.Extend;
  458. }
  459. }
  460. if (oldValue == "None" && newValue == "Retracting")
  461. {
  462. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  463. if (TMRobotMoveActionBladeTarget != null)
  464. {
  465. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  466. }
  467. else
  468. {
  469. return;
  470. }
  471. var values = RobotTarget.Split('.');
  472. var arm = values[0];
  473. if (arm == "ArmA")
  474. {
  475. Robot1XAction = WaferRobotXAction.Retract;
  476. }
  477. else if (arm == "ArmB")
  478. {
  479. Robot2XAction = WaferRobotXAction.Retract;
  480. }
  481. }
  482. #endregion
  483. arm1oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus;
  484. arm2oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus;
  485. }
  486. public WaferInfo LLAWafer
  487. {
  488. get { return m_LLAWafer; }
  489. set { SetProperty(ref m_LLAWafer, value); }
  490. }
  491. public WaferInfo LLBWafer
  492. {
  493. get { return m_LLBWafer; }
  494. set { SetProperty(ref m_LLBWafer, value); }
  495. }
  496. public WaferInfo PMAWafer
  497. {
  498. get { return m_PMAWafer; }
  499. set { SetProperty(ref m_PMAWafer, value); }
  500. }
  501. public WaferInfo PMBWafer
  502. {
  503. get { return m_PMBWafer; }
  504. set { SetProperty(ref m_PMBWafer, value); }
  505. }
  506. public WaferInfo PMCWafer
  507. {
  508. get { return m_PMCWafer; }
  509. set { SetProperty(ref m_PMCWafer, value); }
  510. }
  511. public WaferInfo PMDWafer
  512. {
  513. get { return m_PMDWafer; }
  514. set { SetProperty(ref m_PMDWafer, value); }
  515. }
  516. public WaferInfo BladeAWafer
  517. {
  518. get { return m_BladeAWafer; }
  519. set { SetProperty(ref m_BladeAWafer, value); }
  520. }
  521. public WaferInfo BladeBWafer
  522. {
  523. get { return m_BladeBWafer; }
  524. set { SetProperty(ref m_BladeBWafer, value); }
  525. }
  526. public ModuleInfo LLAModuleInfo
  527. {
  528. get { return m_LLAModuleInfo; }
  529. set { SetProperty(ref m_LLAModuleInfo, value); }
  530. }
  531. public ModuleInfo LLBModuleInfo
  532. {
  533. get { return m_LLBModuleInfo; }
  534. set { SetProperty(ref m_LLBModuleInfo, value); }
  535. }
  536. public ModuleInfo TMModuleInfo
  537. {
  538. get { return m_TMModuleInfo; }
  539. set { SetProperty(ref m_TMModuleInfo, value); }
  540. }
  541. public bool TMIsOFFline
  542. {
  543. get { return m_TMIsOFFline; }
  544. set { SetProperty(ref m_TMIsOFFline, value); }
  545. }
  546. public bool LLIsOFFline
  547. {
  548. get { return m_LLIsOFFline; }
  549. set { SetProperty(ref m_LLIsOFFline, value); }
  550. }
  551. public bool PMADoorIsOpen
  552. {
  553. get { return m_PMADoorIsOpen; }
  554. set { SetProperty(ref m_PMADoorIsOpen, value); }
  555. }
  556. public bool LLADoorIsOpen
  557. {
  558. get { return m_LLADoorIsOpen; }
  559. set { SetProperty(ref m_LLADoorIsOpen, value); }
  560. }
  561. public WaferRobotTAction WaferRobotTAction
  562. {
  563. get { return m_WaferRobotTAction; }
  564. set { SetProperty(ref m_WaferRobotTAction, value); }
  565. }
  566. public WaferRobotTAction Robot1TAction
  567. {
  568. get { return m_Robot1TAction; }
  569. set { SetProperty(ref m_Robot1TAction, value); }
  570. }
  571. public WaferRobotXAction Robot1XAction
  572. {
  573. get { return m_Robot1XAction; }
  574. set { SetProperty(ref m_Robot1XAction, value); }
  575. }
  576. public WaferRobotTAction Robot2TAction
  577. {
  578. get { return m_Robot2TAction; }
  579. set { SetProperty(ref m_Robot2TAction, value); }
  580. }
  581. public WaferRobotXAction Robot2XAction
  582. {
  583. get { return m_Robot2XAction; }
  584. set { SetProperty(ref m_Robot2XAction, value); }
  585. }
  586. public TMModule PickSelectedModule
  587. {
  588. get { return m_PickSelectedModule; }
  589. set { SetProperty(ref m_PickSelectedModule, value); }
  590. }
  591. public TMModule PlaceSelectedModule
  592. {
  593. get { return m_PlaceSelectedModule; }
  594. set { SetProperty(ref m_PlaceSelectedModule, value); }
  595. }
  596. public TMModule ExtendSelectedModule
  597. {
  598. get { return m_ExtendSelectedModule; }
  599. set { SetProperty(ref m_ExtendSelectedModule, value); }
  600. }
  601. public TMModule RetractSelectedModule
  602. {
  603. get { return m_RetractSelectedModule; }
  604. set { SetProperty(ref m_RetractSelectedModule, value); }
  605. }
  606. public TMBlade PickSelectedBlade
  607. {
  608. get { return m_PickSelectedBlade; }
  609. set { SetProperty(ref m_PickSelectedBlade, value); }
  610. }
  611. public TMBlade PlaceSelectedBlade
  612. {
  613. get { return m_PlaceSelectedBlade; }
  614. set { SetProperty(ref m_PlaceSelectedBlade, value); }
  615. }
  616. public TMBlade ExtendSelectedBlade
  617. {
  618. get { return m_ExtendSelectedBlade; }
  619. set { SetProperty(ref m_ExtendSelectedBlade, value); }
  620. }
  621. public TMBlade RetractSelectedBlade
  622. {
  623. get { return m_RetractSelectedBlade; }
  624. set { SetProperty(ref m_RetractSelectedBlade, value); }
  625. }
  626. public TMBlade GoToSelectedBlade
  627. {
  628. get { return m_GoToSelectedBlade; }
  629. set { SetProperty(ref m_GoToSelectedBlade, value); }
  630. }
  631. public ObservableCollection<int> PickSoltItemsSource
  632. {
  633. get { return m_PickSoltItemsSource; }
  634. set { SetProperty(ref m_PickSoltItemsSource, value); }
  635. }
  636. public ObservableCollection<int> PlaceSoltItemsSource
  637. {
  638. get { return m_PlaceSoltItemsSource; }
  639. set { SetProperty(ref m_PlaceSoltItemsSource, value); }
  640. }
  641. public ObservableCollection<int> ExtendSoltItemsSource
  642. {
  643. get { return m_ExtendSoltItemsSource; }
  644. set { SetProperty(ref m_ExtendSoltItemsSource, value); }
  645. }
  646. public ObservableCollection<int> RetractSoltItemsSource
  647. {
  648. get { return m_RetractSoltItemsSource; }
  649. set { SetProperty(ref m_RetractSoltItemsSource, value); }
  650. }
  651. public int PickSoltSelectedIndex
  652. {
  653. get { return m_PickSoltSelectedIndex; }
  654. set { SetProperty(ref m_PickSoltSelectedIndex, value); }
  655. }
  656. public int PlaceSoltSelectedIndex
  657. {
  658. get { return m_PlaceSoltSelectedIndex; }
  659. set { SetProperty(ref m_PlaceSoltSelectedIndex, value); }
  660. }
  661. public int ExtendSoltSelectedIndex
  662. {
  663. get { return m_ExtendSoltSelectedIndex; }
  664. set { SetProperty(ref m_ExtendSoltSelectedIndex, value); }
  665. }
  666. public int RetractSoltSelectedIndex
  667. {
  668. get { return m_RetractSoltSelectedIndex; }
  669. set { SetProperty(ref m_RetractSoltSelectedIndex, value); }
  670. }
  671. public Dictionary<string, object> RtDataValues
  672. {
  673. get { return m_RtDataValues; }
  674. set { SetProperty(ref m_RtDataValues, value); }
  675. }
  676. public bool PMAIsInstalled
  677. {
  678. get { return m_PMAIsInstalled; }
  679. set { SetProperty(ref m_PMAIsInstalled, value); }
  680. }
  681. public bool PMBIsInstalled
  682. {
  683. get { return m_PMBIsInstalled; }
  684. set { SetProperty(ref m_PMBIsInstalled, value); }
  685. }
  686. public bool PMCIsInstalled
  687. {
  688. get { return m_PMCIsInstalled; }
  689. set { SetProperty(ref m_PMCIsInstalled, value); }
  690. }
  691. public bool PMDIsInstalled
  692. {
  693. get { return m_PMDIsInstalled; }
  694. set { SetProperty(ref m_PMDIsInstalled, value); }
  695. }
  696. public bool LLAIsInstalled
  697. {
  698. get { return m_LLAIsInstalled; }
  699. set { SetProperty(ref m_LLAIsInstalled, value); }
  700. }
  701. public bool LLBIsInstalled
  702. {
  703. get { return m_LLBIsInstalled; }
  704. set { SetProperty(ref m_LLBIsInstalled, value); }
  705. }
  706. public bool TMIsInstalled
  707. {
  708. get { return m_TMIsInstalled; }
  709. set { SetProperty(ref m_TMIsInstalled, value); }
  710. }
  711. public List<TMModule> TMModules
  712. {
  713. get { return m_TMModules; }
  714. set { SetProperty(ref m_TMModules, value); }
  715. }
  716. public bool CycleEnable
  717. {
  718. get { return m_CycleEnable; }
  719. set { SetProperty(ref m_CycleEnable, value); }
  720. }
  721. public string OriginalCycleSelectedItem
  722. {
  723. get { return m_OriginalCycleSelectedItem; }
  724. set { SetProperty(ref m_OriginalCycleSelectedItem, value); }
  725. }
  726. public string ToCycleSelectedItem
  727. {
  728. get { return m_ToCycleSelectedItem; }
  729. set { SetProperty(ref m_ToCycleSelectedItem, value); }
  730. }
  731. public bool PMAIsCycle
  732. {
  733. get { return m_PMAIsCycle; }
  734. set { SetProperty(ref m_PMAIsCycle, value); }
  735. }
  736. public bool PMBIsCycle
  737. {
  738. get { return m_PMBIsCycle; }
  739. set { SetProperty(ref m_PMBIsCycle, value); }
  740. }
  741. public bool PMCIsCycle
  742. {
  743. get { return m_PMCIsCycle; }
  744. set { SetProperty(ref m_PMCIsCycle, value); }
  745. }
  746. public bool PMDIsCycle
  747. {
  748. get { return m_PMDIsCycle; }
  749. set { SetProperty(ref m_PMDIsCycle, value); }
  750. }
  751. public int CycleCount
  752. {
  753. get { return m_CycleCount; }
  754. set { SetProperty(ref m_CycleCount, value); }
  755. }
  756. #endregion
  757. #region 命令
  758. private DelegateCommand _RobotHomeCommand;
  759. public DelegateCommand RobotHomeCommand =>
  760. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  761. private DelegateCommand _GotoCommand;
  762. public DelegateCommand GotoCommand =>
  763. _GotoCommand ?? (_GotoCommand = new DelegateCommand(OnGoto));
  764. private DelegateCommand _ExtendCommand;
  765. public DelegateCommand ExtendCommand =>
  766. _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
  767. private DelegateCommand _RetractCommand;
  768. public DelegateCommand RetractCommand =>
  769. _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
  770. private DelegateCommand<object> _ModuleChangeCommand;
  771. public DelegateCommand<object> ModuleChangeCommand =>
  772. _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(OnModuleChange));
  773. private DelegateCommand _PickCommand;
  774. public DelegateCommand PickCommand =>
  775. _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick));
  776. private DelegateCommand _PlaceCommand;
  777. public DelegateCommand PlaceCommand =>
  778. _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace));
  779. private DelegateCommand _HomeCommand;
  780. public DelegateCommand HomeCommand =>
  781. _HomeCommand ?? (_HomeCommand = new DelegateCommand(OnHome));
  782. private DelegateCommand _VentCommand;
  783. public DelegateCommand VentCommand =>
  784. _VentCommand ?? (_VentCommand = new DelegateCommand(OnVent));
  785. private DelegateCommand _PumpCommand;
  786. public DelegateCommand PumpCommand =>
  787. _PumpCommand ?? (_PumpCommand = new DelegateCommand(OnPump));
  788. private DelegateCommand _PurgeCommand;
  789. public DelegateCommand PurgeCommand =>
  790. _PurgeCommand ?? (_PurgeCommand = new DelegateCommand(OnPurge));
  791. private DelegateCommand<object> _ModuleCheckedCommand;
  792. public DelegateCommand<object> ModuleCheckedCommand =>
  793. _ModuleCheckedCommand ?? (_ModuleCheckedCommand = new DelegateCommand<object>(OnModuleChecked));
  794. private DelegateCommand _AbortCommand;
  795. public DelegateCommand AbortCommand =>
  796. _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
  797. private DelegateCommand _StartCycleCommand;
  798. public DelegateCommand StartCycleCommand =>
  799. _StartCycleCommand ?? (_StartCycleCommand = new DelegateCommand(OnStartCycle));
  800. private DelegateCommand _StopCycleCommand;
  801. public DelegateCommand StopCycleCommand =>
  802. _StopCycleCommand ?? (_StopCycleCommand = new DelegateCommand(OnStopCycle));
  803. private DelegateCommand _SystemHomeCommand;
  804. public DelegateCommand SystemHomeCommand =>
  805. _SystemHomeCommand ?? (_SystemHomeCommand = new DelegateCommand(OnSystemHome));
  806. private DelegateCommand<object> _ChamberDoorOpenCommand;
  807. public DelegateCommand<object> ChamberDoorOpenCommand =>
  808. _ChamberDoorOpenCommand ?? (_ChamberDoorOpenCommand = new DelegateCommand<object>(OnChamberDoorOpen));
  809. private DelegateCommand<object> _ChamberDoorCloseCommand;
  810. public DelegateCommand<object> ChamberDoorCloseCommand =>
  811. _ChamberDoorCloseCommand ?? (_ChamberDoorCloseCommand = new DelegateCommand<object>(OnChamberDoorClose));
  812. private DelegateCommand _LoadCommand;
  813. public DelegateCommand LoadCommand =>
  814. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  815. #endregion
  816. #region 构造函数
  817. public TMViewModel()
  818. {
  819. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  820. PMAIsInstalled = allModules.Contains("PMA");
  821. PMBIsInstalled = allModules.Contains("PMB");
  822. PMCIsInstalled = allModules.Contains("PMC");
  823. PMDIsInstalled = allModules.Contains("PMD");
  824. LLAIsInstalled = allModules.Contains("LLA");
  825. LLBIsInstalled = allModules.Contains("LLB");
  826. TMIsInstalled= allModules.Contains("TM");
  827. if (PMAIsInstalled == true)
  828. {
  829. TMModules.Add(TMModule.PMA);
  830. }
  831. if (PMBIsInstalled == true)
  832. {
  833. TMModules.Add(TMModule.PMB);
  834. }
  835. if (PMCIsInstalled == true)
  836. {
  837. TMModules.Add(TMModule.PMC);
  838. }
  839. if (PMDIsInstalled == true)
  840. {
  841. TMModules.Add(TMModule.PMD);
  842. }
  843. if (LLAIsInstalled == true)
  844. {
  845. OriginalCycle.Add("LLA");
  846. ToCycle.Add("LLA");
  847. TMModules.Add(TMModule.LLA);
  848. }
  849. if (LLBIsInstalled == true)
  850. {
  851. OriginalCycle.Add("LLB");
  852. ToCycle.Add("LLB");
  853. TMModules.Add(TMModule.LLB);
  854. }
  855. addDataKeys();
  856. DispatcherTimer timer = new DispatcherTimer();
  857. timer.Interval = TimeSpan.FromSeconds(0.1);
  858. timer.Tick += Timer_Tick;
  859. timer.Start();
  860. PickSoltItemsSource.Add(1);
  861. PlaceSoltItemsSource.Add(1);
  862. ExtendSoltItemsSource.Add(1);
  863. RetractSoltItemsSource.Add(1);
  864. //Robot1TAction = WaferRobotTAction.PMA;
  865. //Robot2TAction = WaferRobotTAction.PMD;
  866. //UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  867. //UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  868. //UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  869. }
  870. private void Timer_Tick(object sender, EventArgs e)
  871. {
  872. if (LLAIsInstalled == true)
  873. {
  874. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x=>x.WaferStatus!=0);
  875. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  876. }
  877. if (LLBIsInstalled == true)
  878. {
  879. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  880. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  881. }
  882. if (PMAIsInstalled == true)
  883. {
  884. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  885. }
  886. if (PMBIsInstalled == true)
  887. {
  888. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  889. }
  890. if (PMCIsInstalled == true)
  891. {
  892. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  893. }
  894. if (PMDIsInstalled == true)
  895. {
  896. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  897. }
  898. if (TMIsInstalled == true)
  899. {
  900. BladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  901. BladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  902. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  903. }
  904. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  905. var TMRobotMoveActionArmTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.ArmTarget");
  906. if (TMRobotMoveActionArmTarget != null)
  907. {
  908. RobotArm = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus.ToString();
  909. }
  910. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  911. if (TMRobotMoveActionBladeTarget != null)
  912. {
  913. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  914. }
  915. var TMRobotMoveActionRobotAction = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.RobotAction");
  916. if (TMRobotMoveActionRobotAction != null)
  917. {
  918. RobotAction2 = TMRobotMoveActionRobotAction.ToString();
  919. }
  920. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  921. }
  922. #endregion
  923. #region 命令方法
  924. private void OnRobotHome()
  925. {
  926. InvokeClient.Instance.Service.DoOperation($"TM.RobotHome", "TMRobot");
  927. }
  928. private void OnGoto()
  929. {
  930. //if (GoToSelectedBlade == TMBlade.Blade1)
  931. //{
  932. // Robot1TAction = WaferRobotTAction;
  933. //}
  934. //else if (GoToSelectedBlade == TMBlade.Blade2)
  935. //{
  936. // Robot2TAction = WaferRobotTAction;
  937. //}
  938. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), WaferRobotTAction.ToString(), true);
  939. var selectedHand = (Hand)Enum.Parse(typeof(Hand), GoToSelectedBlade.ToString(), true);
  940. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Goto}", moduleName, 0, selectedHand);
  941. }
  942. private void OnExtend()
  943. {
  944. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  945. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  946. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Extend}", moduleName, 0, selectedHand);
  947. }
  948. private void OnRetract()
  949. {
  950. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  951. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  952. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Retract}", moduleName, 0, selectedHand);
  953. }
  954. private void OnModuleChange(object obj)
  955. {
  956. var value = obj.ToString();
  957. switch (value)
  958. {
  959. case "Pick":
  960. PickSoltItemsSource.Clear();
  961. if ((int)PickSelectedModule == 4)
  962. {
  963. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  964. {
  965. PickSoltItemsSource.Add(i);
  966. }
  967. }
  968. else if ((int)PickSelectedModule == 5)
  969. {
  970. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  971. {
  972. PickSoltItemsSource.Add(i);
  973. }
  974. }
  975. else
  976. {
  977. PickSoltItemsSource.Add(1);
  978. }
  979. PickSoltSelectedIndex = 0;
  980. break;
  981. case "Place":
  982. PlaceSoltItemsSource.Clear();
  983. if ((int)PlaceSelectedModule == 4)
  984. {
  985. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  986. {
  987. PlaceSoltItemsSource.Add(i);
  988. }
  989. }
  990. else if ((int)PlaceSelectedModule == 5)
  991. {
  992. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  993. {
  994. PlaceSoltItemsSource.Add(i);
  995. }
  996. }
  997. else
  998. {
  999. PlaceSoltItemsSource.Add(1);
  1000. }
  1001. PlaceSoltSelectedIndex = 0;
  1002. break;
  1003. case "Extend":
  1004. ExtendSoltItemsSource.Clear();
  1005. if ((int)ExtendSelectedModule == 4)
  1006. {
  1007. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  1008. {
  1009. ExtendSoltItemsSource.Add(i);
  1010. }
  1011. }
  1012. else if ((int)ExtendSelectedModule == 5)
  1013. {
  1014. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  1015. {
  1016. ExtendSoltItemsSource.Add(i);
  1017. }
  1018. }
  1019. else
  1020. {
  1021. ExtendSoltItemsSource.Add(1);
  1022. }
  1023. ExtendSoltSelectedIndex = 0;
  1024. break;
  1025. case "Retract":
  1026. RetractSoltItemsSource.Clear();
  1027. if ((int)RetractSelectedModule == 4)
  1028. {
  1029. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  1030. {
  1031. RetractSoltItemsSource.Add(i);
  1032. }
  1033. //RetractSoltItemsSource = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
  1034. }
  1035. else if ((int)RetractSelectedModule == 5)
  1036. {
  1037. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  1038. {
  1039. RetractSoltItemsSource.Add(i);
  1040. }
  1041. }
  1042. else
  1043. {
  1044. RetractSoltItemsSource.Add(1);
  1045. }
  1046. RetractSoltSelectedIndex = 0;
  1047. break;
  1048. }
  1049. }
  1050. private void OnPick()
  1051. {
  1052. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  1053. var moduleName= (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true);
  1054. var selectedHand= (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true);
  1055. MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex] - 1, 0, 0, selectedHand);
  1056. moveItems.Enqueue(moveItem);
  1057. if ((int)PickSelectedModule > 3)
  1058. {
  1059. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPick}", moveItems);
  1060. }
  1061. else
  1062. {
  1063. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPick}", moveItems);
  1064. }
  1065. }
  1066. private void OnPlace()
  1067. {
  1068. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  1069. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  1070. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  1071. MoveItem moveItem = new MoveItem(0,0,moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex]-1, selectedHand);
  1072. moveItems.Enqueue(moveItem);
  1073. if ((int)PlaceSelectedModule > 3)
  1074. {
  1075. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPlace}", moveItems);
  1076. }
  1077. else
  1078. {
  1079. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPlace}", moveItems);
  1080. }
  1081. }
  1082. private void OnHome()
  1083. {
  1084. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.Home");
  1085. }
  1086. private void OnVent()
  1087. {
  1088. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Vent}");
  1089. }
  1090. private void OnPump()
  1091. {
  1092. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Pump}");
  1093. }
  1094. private void OnPurge()
  1095. {
  1096. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Purge}");
  1097. }
  1098. private void OnModuleChecked(object obj)
  1099. {
  1100. m_ModuleCheckedName=obj.ToString();
  1101. }
  1102. private void OnAbort()
  1103. {
  1104. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Abort}");
  1105. }
  1106. private void OnStartCycle()
  1107. {
  1108. if (CycleEnable == false)
  1109. {
  1110. return;
  1111. }
  1112. List<string> strings = new List<string>();
  1113. if (OriginalCycleSelectedItem != "")
  1114. {
  1115. strings.Add(OriginalCycleSelectedItem);
  1116. }
  1117. else
  1118. {
  1119. return;
  1120. }
  1121. if (PMAIsCycle==true)
  1122. {
  1123. strings.Add("PMA");
  1124. }
  1125. if (PMBIsCycle == true)
  1126. {
  1127. strings.Add("PMB");
  1128. }
  1129. if (PMCIsCycle == true)
  1130. {
  1131. strings.Add("PMC");
  1132. }
  1133. if (PMDIsCycle == true)
  1134. {
  1135. strings.Add("PMD");
  1136. }
  1137. if (ToCycleSelectedItem != "")
  1138. {
  1139. strings.Add(ToCycleSelectedItem);
  1140. }
  1141. else
  1142. {
  1143. return;
  1144. }
  1145. InvokeClient.Instance.Service.DoOperation("TMCycle.Start", strings.ToArray(),CycleCount);
  1146. }
  1147. private void OnStopCycle()
  1148. {
  1149. InvokeClient.Instance.Service.DoOperation("TMCycle.Abort");
  1150. }
  1151. private void OnSystemHome()
  1152. {
  1153. InvokeClient.Instance.Service.DoOperation("System.Home");
  1154. }
  1155. private void OnChamberDoorOpen(object obj)
  1156. {
  1157. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Open");
  1158. }
  1159. private void OnChamberDoorClose(object obj)
  1160. {
  1161. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Close");
  1162. }
  1163. private void OnLoad()
  1164. {
  1165. if (m_firstFlag)
  1166. {
  1167. object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
  1168. PressureType = (PressureType)Convert.ToInt32(obj);
  1169. m_firstFlag = false;
  1170. }
  1171. }
  1172. #endregion
  1173. #region 私有方法
  1174. private void addDataKeys()
  1175. {
  1176. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1177. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1178. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1179. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1180. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1181. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1182. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1183. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1184. m_RtDataKeys.Add("TMCycle.CycleIndex");
  1185. m_RtDataKeys.Add("PMA.CalculationPressure");
  1186. m_RtDataKeys.Add("PMB.CalculationPressure");
  1187. m_RtDataKeys.Add("PMC.CalculationPressure");
  1188. m_RtDataKeys.Add("PMD.CalculationPressure");
  1189. }
  1190. #endregion
  1191. }
  1192. }