TMViewModel.cs 48 KB

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