TMViewModel.cs 49 KB

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