JobOperationViewModel.cs 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  1. using MECF.Framework.Common.CommonData;
  2. using MECF.Framework.Common.DataCenter;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.OperationCenter;
  5. using OpenSEMI.ClientBase;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Windows.Threading;
  12. using CyberX8_MainPages.Unity;
  13. using MECF.Framework.Common.Utilities;
  14. using MECF.Framework.Common.Jobs;
  15. using CyberX8_MainPages.PMs;
  16. using MECF.Framework.Common.RecipeCenter;
  17. using System.Collections.ObjectModel;
  18. using System.Windows.Media.Animation;
  19. namespace CyberX8_MainPages.ViewModels
  20. {
  21. internal class JobOperationViewModel : BindableBase
  22. {
  23. #region 私有字段
  24. /// <summary>
  25. /// LP1的Wafer相关信息
  26. /// </summary>
  27. private WaferAssociationInfo _lp1WaferAssociation;
  28. /// <summary>
  29. /// LP2的Wafer相关信息
  30. /// </summary>
  31. private WaferAssociationInfo _lp2WaferAssociation;
  32. /// <summary>
  33. /// LP3的Wafer相关信息
  34. /// </summary>
  35. private WaferAssociationInfo _lp3WaferAssociation;
  36. /// <summary>
  37. /// LP1的Wafer数量
  38. /// </summary>
  39. private int m_LP1WaferCount;
  40. /// <summary>
  41. /// LP2的Wafer数量
  42. /// </summary>
  43. private int m_LP2WaferCount;
  44. /// <summary>
  45. /// LP3的Wafer数量
  46. /// </summary>
  47. private int m_LP3WaferCount;
  48. /// <summary>
  49. /// RT查询数据字典
  50. /// </summary>
  51. private Dictionary<string, object> m_RtDataValues;
  52. /// <summary>
  53. /// RT查询Key列表
  54. /// </summary>
  55. private List<string> m_RtDataKeys = new List<string>();
  56. /// <summary>
  57. /// Sequence数据列表 LP1
  58. /// </summary>
  59. private ObservableCollection<string> m_SequenceSelectedItemsSource1 = new ObservableCollection<string>();
  60. /// <summary>
  61. /// Sequence数据列表 LP2
  62. /// </summary>
  63. private ObservableCollection<string> m_SequenceSelectedItemsSource2 = new ObservableCollection<string>();
  64. /// <summary>
  65. /// Sequence数据列表 LP3
  66. /// </summary>
  67. private ObservableCollection<string> m_SequenceSelectedItemsSource3 = new ObservableCollection<string>();
  68. /// <summary>
  69. /// LP1Sequence名称
  70. /// </summary>
  71. private string m_LP1SequenceName;
  72. /// <summary>
  73. /// LP2Sequence名称
  74. /// </summary>
  75. private string m_LP2SequenceName;
  76. /// <summary>
  77. /// LP3Sequence名称
  78. /// </summary>
  79. private string m_LP3SequenceName;
  80. /// <summary>
  81. /// UiRecipeManager
  82. /// </summary>
  83. private UiRecipeManager _uiRecipeManager = new UiRecipeManager();
  84. /// <summary>
  85. /// 定时器
  86. /// </summary>
  87. DispatcherTimer _timer;
  88. /// <summary>
  89. /// LP1界面Enable
  90. /// </summary>
  91. private bool m_ButtonIsEnableLP1;
  92. /// <summary>
  93. /// LP2界面Enable
  94. /// </summary>
  95. private bool m_ButtonIsEnableLP2;
  96. /// <summary>
  97. /// LP3界面Enable
  98. /// </summary>
  99. private bool m_ButtonIsEnableLP3;
  100. /// <summary>
  101. /// LP1 SequenceName Buffer
  102. /// </summary>
  103. private string _LP1SequenceNameBuffer;
  104. /// <summary>
  105. /// LP2 SequenceName Buffer
  106. /// </summary>
  107. private string _LP2SequenceNameBuffer;
  108. /// <summary>
  109. /// LP3 SequenceName Buffer
  110. /// </summary>
  111. private string _LP3SequenceNameBuffer;
  112. private bool _isLp1Unable;
  113. private bool _isLp2Unable;
  114. private bool _isLp3Unable;
  115. private bool _lp1Unable;
  116. private bool _lp2Unable;
  117. private bool _lp3Unable;
  118. private bool _isLP1AutoStoped = true;
  119. private bool _isLP2AutoStoped = true;
  120. private bool _isLP3AutoStoped = true;
  121. private bool _isLP1AutoStarted = false;
  122. private bool _isLP2AutoStarted = false;
  123. private bool _isLP3AutoStarted = false;
  124. private bool _isLP1CanCreatedJob = false;
  125. private bool _isLP2CanCreatedJob = false;
  126. private bool _isLP3CanCreatedJob = false;
  127. /// <summary>
  128. /// LP1 RecipeMode
  129. /// </summary>
  130. private bool _lp1RecipeMode;
  131. /// <summary>
  132. /// LP2 RecipeMode
  133. /// </summary>
  134. private bool _lp2RecipeMode;
  135. /// <summary>
  136. /// LP3 RecipeMode
  137. /// </summary>
  138. private bool _lp3RecipeMode;
  139. /// <summary>
  140. /// LP1 Docked
  141. /// </summary>
  142. private bool _isLP1CassettePlaced;
  143. /// <summary>
  144. /// LP2 Docked
  145. /// </summary>
  146. private bool _isLP2CassettePlaced;
  147. /// <summary>
  148. /// LP3 Docked
  149. /// </summary>
  150. private bool _isLP3CassettePlaced;
  151. #endregion
  152. #region 属性
  153. /// <summary>
  154. /// RT查询数据字典
  155. /// </summary>
  156. public Dictionary<string, object> RtDataValues
  157. {
  158. get { return m_RtDataValues; }
  159. set { SetProperty(ref m_RtDataValues, value); }
  160. }
  161. /// <summary>
  162. /// LP1的Wafer相关信息
  163. /// </summary>
  164. public WaferAssociationInfo LP1WaferAssociation
  165. {
  166. get { return _lp1WaferAssociation; }
  167. set { SetProperty(ref _lp1WaferAssociation, value); }
  168. }
  169. /// <summary>
  170. /// LP2的Wafer相关信息
  171. /// </summary>
  172. public WaferAssociationInfo LP2WaferAssociation
  173. {
  174. get { return _lp2WaferAssociation; }
  175. set { SetProperty(ref _lp2WaferAssociation, value); }
  176. }
  177. /// <summary>
  178. /// LP3的Wafer相关信息
  179. /// </summary>
  180. public WaferAssociationInfo LP3WaferAssociation
  181. {
  182. get { return _lp3WaferAssociation; }
  183. set { SetProperty(ref _lp3WaferAssociation, value); }
  184. }
  185. /// <summary>
  186. /// LP1的Wafer数量
  187. /// </summary>
  188. public int LP1WaferCount
  189. {
  190. get { return m_LP1WaferCount; }
  191. set { SetProperty(ref m_LP1WaferCount, value); }
  192. }
  193. /// <summary>
  194. /// LP2的Wafer数量
  195. /// </summary>
  196. public int LP2WaferCount
  197. {
  198. get { return m_LP2WaferCount; }
  199. set { SetProperty(ref m_LP2WaferCount, value); }
  200. }
  201. /// <summary>
  202. /// LP3的Wafer数量
  203. /// </summary>
  204. public int LP3WaferCount
  205. {
  206. get { return m_LP3WaferCount; }
  207. set { SetProperty(ref m_LP3WaferCount, value); }
  208. }
  209. /// <summary>
  210. /// Sequence数据列表 LP1
  211. /// </summary>
  212. public ObservableCollection<string> SequenceSelectedItemsSource1
  213. {
  214. get { return m_SequenceSelectedItemsSource1; }
  215. set { SetProperty(ref m_SequenceSelectedItemsSource1, value); }
  216. }
  217. /// <summary>
  218. /// Sequence数据列表 LP2
  219. /// </summary>
  220. public ObservableCollection<string> SequenceSelectedItemsSource2
  221. {
  222. get { return m_SequenceSelectedItemsSource2; }
  223. set { SetProperty(ref m_SequenceSelectedItemsSource2, value); }
  224. }
  225. /// <summary>
  226. /// Sequence数据列表 LP3
  227. /// </summary>
  228. public ObservableCollection<string> SequenceSelectedItemsSource3
  229. {
  230. get { return m_SequenceSelectedItemsSource3; }
  231. set { SetProperty(ref m_SequenceSelectedItemsSource3, value); }
  232. }
  233. /// <summary>
  234. /// LP1Sequence名称
  235. /// </summary>
  236. public string LP1SequenceName
  237. {
  238. get { return m_LP1SequenceName; }
  239. set { SetProperty(ref m_LP1SequenceName, value); }
  240. }
  241. /// <summary>
  242. /// LP2Sequence名称
  243. /// </summary>
  244. public string LP2SequenceName
  245. {
  246. get { return m_LP2SequenceName; }
  247. set { SetProperty(ref m_LP2SequenceName, value); }
  248. }
  249. /// <summary>
  250. /// LP3Sequence名称
  251. /// </summary>
  252. public string LP3SequenceName
  253. {
  254. get { return m_LP3SequenceName; }
  255. set { SetProperty(ref m_LP3SequenceName, value); }
  256. }
  257. /// <summary>
  258. /// LP1界面Enable
  259. /// </summary>
  260. public bool ButtonIsEnableLP1
  261. {
  262. get { return m_ButtonIsEnableLP1; }
  263. set { SetProperty(ref m_ButtonIsEnableLP1, value); }
  264. }
  265. /// <summary>
  266. /// LP2界面Enable
  267. /// </summary>
  268. public bool ButtonIsEnableLP2
  269. {
  270. get { return m_ButtonIsEnableLP2; }
  271. set { SetProperty(ref m_ButtonIsEnableLP2, value); }
  272. }
  273. /// <summary>
  274. /// LP3界面Enable
  275. /// </summary>
  276. public bool ButtonIsEnableLP3
  277. {
  278. get { return m_ButtonIsEnableLP3; }
  279. set { SetProperty(ref m_ButtonIsEnableLP3, value); }
  280. }
  281. /// <summary>
  282. /// Created job 按钮可用性
  283. /// </summary>
  284. public bool IsLP1CanCreatedJob
  285. {
  286. get { return _isLP1CanCreatedJob; }
  287. set { SetProperty(ref _isLP1CanCreatedJob, value); }
  288. }
  289. public bool IsLP2CanCreatedJob
  290. {
  291. get { return _isLP2CanCreatedJob; }
  292. set { SetProperty(ref _isLP2CanCreatedJob, value); }
  293. }
  294. public bool IsLP3CanCreatedJob
  295. {
  296. get { return _isLP3CanCreatedJob; }
  297. set { SetProperty(ref _isLP3CanCreatedJob, value); }
  298. }
  299. public bool IsLP1AutoStoped
  300. {
  301. get { return _isLP1AutoStoped; }
  302. set { SetProperty(ref _isLP1AutoStoped, value); }
  303. }
  304. public bool IsLP2AutoStoped
  305. {
  306. get { return _isLP2AutoStoped; }
  307. set { SetProperty(ref _isLP2AutoStoped, value); }
  308. }
  309. public bool IsLP3AutoStoped
  310. {
  311. get { return _isLP3AutoStoped; }
  312. set { SetProperty(ref _isLP3AutoStoped, value); }
  313. }
  314. public bool IsLP1AutoStarted
  315. {
  316. get { return _isLP1AutoStarted; }
  317. set { SetProperty(ref _isLP1AutoStarted, value); }
  318. }
  319. public bool IsLP2AutoStarted
  320. {
  321. get { return _isLP2AutoStarted; }
  322. set { SetProperty(ref _isLP2AutoStarted, value); }
  323. }
  324. public bool IsLP3AutoStarted
  325. {
  326. get { return _isLP3AutoStarted; }
  327. set { SetProperty(ref _isLP3AutoStarted, value); }
  328. }
  329. public bool IsLP1Unable
  330. {
  331. get { return _isLp1Unable; }
  332. set { SetProperty(ref _isLp1Unable, value); }
  333. }
  334. public bool IsLP2Unable
  335. {
  336. get { return _isLp2Unable; }
  337. set { SetProperty(ref _isLp2Unable, value); }
  338. }
  339. public bool IsLP3Unable
  340. {
  341. get { return _isLp3Unable; }
  342. set { SetProperty(ref _isLp3Unable, value); }
  343. }
  344. public bool LP1Unable
  345. {
  346. get { return _lp1Unable; }
  347. set { SetProperty(ref _lp1Unable, value); }
  348. }
  349. public bool LP2Unable
  350. {
  351. get { return _lp2Unable; }
  352. set { SetProperty(ref _lp2Unable, value); }
  353. }
  354. public bool LP3Unable
  355. {
  356. get { return _lp3Unable; }
  357. set { SetProperty(ref _lp3Unable, value); }
  358. }
  359. /// <summary>
  360. /// LP1 RecipeMode(Engineering:true, Production:false)
  361. /// </summary>
  362. public bool LP1RecipeMode
  363. {
  364. get { return _lp1RecipeMode; }
  365. set { SetProperty(ref _lp1RecipeMode, value); }
  366. }
  367. /// <summary>
  368. /// LP2 RecipeMode(Engineering:true, Production:false)
  369. /// </summary>
  370. public bool LP2RecipeMode
  371. {
  372. get { return _lp2RecipeMode; }
  373. set { SetProperty(ref _lp2RecipeMode, value); }
  374. }
  375. /// <summary>
  376. /// LP3 RecipeMode(Engineering:true, Production:false)
  377. /// </summary>
  378. public bool LP3RecipeMode
  379. {
  380. get { return _lp3RecipeMode; }
  381. set { SetProperty(ref _lp3RecipeMode, value); }
  382. }
  383. #endregion
  384. #region 命令
  385. private DelegateCommand<object> _SelectAllCommand;
  386. public DelegateCommand<object> SelectAllCommand =>
  387. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  388. private DelegateCommand<object> _UnSelectAllCommand;
  389. public DelegateCommand<object> UnSelectAllCommand =>
  390. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
  391. private DelegateCommand<object> _CreateJobCommand;
  392. public DelegateCommand<object> CreateJobCommand =>
  393. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  394. private DelegateCommand<object> _AbortJobCommand;
  395. public DelegateCommand<object> AbortJobCommand =>
  396. _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand<object>(OnAbortJob));
  397. private DelegateCommand<object> _StartCommand;
  398. public DelegateCommand<object> StartCommand =>
  399. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  400. private DelegateCommand<object> _StopCommand;
  401. public DelegateCommand<object> StopCommand =>
  402. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  403. private DelegateCommand<object> _AbortCommand;
  404. public DelegateCommand<object> AbortCommand =>
  405. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  406. private DelegateCommand<object> _SelectionChangedCommand;
  407. public DelegateCommand<object> SelectionChangedCommand
  408. =>
  409. _SelectionChangedCommand ?? (_SelectionChangedCommand = new DelegateCommand<object>(OnSelectionChanged));
  410. private DelegateCommand<object> _SetSequenceCommand;
  411. public DelegateCommand<object> SetSequenceCommand =>
  412. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  413. private DelegateCommand<object> _LPMapCommand;
  414. public DelegateCommand<object> LPMapCommand =>
  415. _LPMapCommand ?? (_LPMapCommand = new DelegateCommand<object>(OnLPMap));
  416. private DelegateCommand<object> _SeqTypeChangeCommand;
  417. public DelegateCommand<object> SeqTypeChangeCommand =>
  418. _SeqTypeChangeCommand ?? (_SeqTypeChangeCommand = new DelegateCommand<object>(OnSeqTypeChange));
  419. #endregion
  420. #region
  421. /// <summary>
  422. /// 构造函数
  423. /// </summary>
  424. public JobOperationViewModel()
  425. {
  426. LP1WaferAssociation = new WaferAssociationInfo();
  427. LP3WaferAssociation = new WaferAssociationInfo();
  428. LP2WaferAssociation = new WaferAssociationInfo();
  429. SequenceSelectedItemsSource1 = new ObservableCollection<string>();
  430. SequenceSelectedItemsSource2 = new ObservableCollection<string>();
  431. SequenceSelectedItemsSource3 = new ObservableCollection<string>();
  432. LP1WaferCount = 0;
  433. LP2WaferCount = 0;
  434. LP3WaferCount = 0;
  435. _LP1SequenceNameBuffer = null;
  436. _LP2SequenceNameBuffer = null;
  437. _LP3SequenceNameBuffer = null;
  438. LP1RecipeMode = true;
  439. LP2RecipeMode = true;
  440. LP3RecipeMode = true;
  441. addDataKeys();
  442. }
  443. #endregion
  444. #region 方法
  445. /// <summary>
  446. /// 加载数据
  447. /// </summary>
  448. public void LoadData(string systemName)
  449. {
  450. if (_timer == null)
  451. {
  452. _timer = new DispatcherTimer();
  453. _timer.Interval = TimeSpan.FromMilliseconds(100);
  454. _timer.Tick += Timer_Tick; ;
  455. }
  456. _timer.Start();
  457. LP1WaferAssociation.SequenceType = LP1RecipeMode ? "Production" : "Engineering";
  458. LP2WaferAssociation.SequenceType = LP2RecipeMode ? "Production" : "Engineering";
  459. LP3WaferAssociation.SequenceType = LP3RecipeMode ? "Production" : "Engineering";
  460. //获取Sequence列表
  461. var seqitems1 = RecipeClient.Instance.Service.GetSequenceList("seq", LP1WaferAssociation.SequenceType);
  462. SequenceSelectedItemsSource1.Clear();
  463. foreach (var seqitem in seqitems1)
  464. {
  465. SequenceSelectedItemsSource1.Add(seqitem);
  466. }
  467. var seqitems2 = RecipeClient.Instance.Service.GetSequenceList("seq", LP2WaferAssociation.SequenceType);
  468. SequenceSelectedItemsSource2.Clear();
  469. foreach (var seqitem in seqitems2)
  470. {
  471. SequenceSelectedItemsSource2.Add(seqitem);
  472. }
  473. var seqitems3 = RecipeClient.Instance.Service.GetSequenceList("seq", LP3WaferAssociation.SequenceType);
  474. SequenceSelectedItemsSource3.Clear();
  475. foreach (var seqitem in seqitems3)
  476. {
  477. SequenceSelectedItemsSource3.Add(seqitem);
  478. }
  479. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  480. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  481. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  482. if (LP1WaferAssociation.ModuleData.WaferManager.IsReset)
  483. {
  484. ClearInfo(ref _lp1WaferAssociation);
  485. _LP1SequenceNameBuffer = null;
  486. LP1SequenceName = null;
  487. }
  488. if (LP2WaferAssociation.ModuleData.WaferManager.IsReset)
  489. {
  490. ClearInfo(ref _lp2WaferAssociation);
  491. _LP2SequenceNameBuffer = null;
  492. LP2SequenceName = null;
  493. }
  494. if (LP3WaferAssociation.ModuleData.WaferManager.IsReset)
  495. {
  496. ClearInfo(ref _lp3WaferAssociation);
  497. _LP3SequenceNameBuffer = null;
  498. LP3SequenceName = null;
  499. }
  500. }
  501. /// <summary>
  502. /// 隐藏
  503. /// </summary>
  504. public void Hide()
  505. {
  506. _timer.Stop();
  507. }
  508. /// <summary>
  509. /// 定时器执行
  510. /// </summary>
  511. private void Timer_Tick(object sender, EventArgs e)
  512. {
  513. LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
  514. LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
  515. LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
  516. IsLP1Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable") && ButtonIsEnableLP1;
  517. IsLP2Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable") && ButtonIsEnableLP2;
  518. IsLP3Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable") && ButtonIsEnableLP3;
  519. LP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
  520. LP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
  521. LP3Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable");
  522. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  523. if (RtDataValues == null || RtDataValues.Count == 0)
  524. {
  525. return;
  526. }
  527. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  528. if (lp1Cj == null)
  529. {
  530. ButtonIsEnableLP1 = true;
  531. LP1WaferAssociation.JobStatus = "";
  532. }
  533. else
  534. {
  535. ButtonIsEnableLP1 = false;
  536. UPdateWaferAssociation(LP1WaferAssociation, lp1Cj);
  537. }
  538. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  539. if (lp2Cj == null)
  540. {
  541. ButtonIsEnableLP2 = true;
  542. LP2WaferAssociation.JobStatus = "";
  543. }
  544. else
  545. {
  546. ButtonIsEnableLP2 = false;
  547. UPdateWaferAssociation(LP2WaferAssociation, lp2Cj);
  548. }
  549. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  550. if (lp3Cj == null)
  551. {
  552. ButtonIsEnableLP3 = true;
  553. LP3WaferAssociation.JobStatus = "";
  554. }
  555. else
  556. {
  557. ButtonIsEnableLP3 = false;
  558. UPdateWaferAssociation(LP3WaferAssociation, lp3Cj);
  559. }
  560. LP1WaferCount = LP1WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  561. LP2WaferCount = LP2WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  562. LP3WaferCount = LP3WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  563. _isLP1CassettePlaced = CommonFunction.GetValue<bool>(RtDataValues, "LP1.CassettePlaced");
  564. if (!_isLP1CassettePlaced && LP1WaferCount == 0)
  565. {
  566. LP1WaferAssociation.SlotFrom = 1;
  567. LP1WaferAssociation.SlotTo = 25;
  568. LP1WaferAssociation.LotId = "";
  569. LP1WaferAssociation.JobID = "";
  570. LP1SequenceName = null;
  571. _LP1SequenceNameBuffer = null;
  572. LP1WaferAssociation.CycleNumber = 1;
  573. LP1WaferAssociation.IsEnableCycle = false;
  574. AssociateSequence(LP1WaferAssociation, false);
  575. LP1WaferAssociation.ModuleData.WaferManager.IsReset = false;
  576. }
  577. _isLP2CassettePlaced = CommonFunction.GetValue<bool>(RtDataValues, "LP2.CassettePlaced");
  578. if (!_isLP2CassettePlaced && LP2WaferCount == 0)
  579. {
  580. LP2WaferAssociation.SlotFrom = 1;
  581. LP2WaferAssociation.SlotTo = 25;
  582. LP2WaferAssociation.LotId = "";
  583. LP2WaferAssociation.JobID = "";
  584. LP2SequenceName = null;
  585. _LP2SequenceNameBuffer = null;
  586. LP2WaferAssociation.CycleNumber = 1;
  587. LP2WaferAssociation.IsEnableCycle = false;
  588. AssociateSequence(LP2WaferAssociation, false);
  589. LP2WaferAssociation.ModuleData.WaferManager.IsReset = false;
  590. }
  591. _isLP3CassettePlaced = CommonFunction.GetValue<bool>(RtDataValues, "LP3.CassettePlaced");
  592. if (!_isLP3CassettePlaced && LP3WaferCount == 0)
  593. {
  594. LP3WaferAssociation.SlotFrom = 1;
  595. LP3WaferAssociation.SlotTo = 25;
  596. LP3WaferAssociation.LotId = "";
  597. LP3WaferAssociation.JobID = "";
  598. LP3SequenceName = null;
  599. _LP3SequenceNameBuffer = null;
  600. LP3WaferAssociation.CycleNumber = 1;
  601. LP3WaferAssociation.IsEnableCycle = false;
  602. AssociateSequence(LP3WaferAssociation, false);
  603. LP3WaferAssociation.ModuleData.WaferManager.IsReset = false;
  604. }
  605. LP1WaferAssociation.SequenceType = LP1RecipeMode ? "Production" : "Engineering";
  606. LP2WaferAssociation.SequenceType = LP2RecipeMode ? "Production" : "Engineering";
  607. LP3WaferAssociation.SequenceType = LP3RecipeMode ? "Production" : "Engineering";
  608. if ("Executing".Equals(LP1WaferAssociation.JobStatus))
  609. {
  610. IsLP1AutoStoped = false;
  611. IsLP1AutoStarted = true;
  612. }
  613. else if ("WaitingForStart".Equals(LP1WaferAssociation.JobStatus))
  614. {
  615. IsLP1AutoStoped = true;
  616. IsLP1AutoStarted = false;
  617. }
  618. else if (string.IsNullOrEmpty(LP1WaferAssociation.JobStatus))
  619. {
  620. IsLP1AutoStoped = false;
  621. IsLP1AutoStarted = false;
  622. }
  623. if ("Executing".Equals(LP2WaferAssociation.JobStatus))
  624. {
  625. IsLP2AutoStoped = false;
  626. IsLP2AutoStarted = true;
  627. }
  628. else if ("WaitingForStart".Equals(LP2WaferAssociation.JobStatus))
  629. {
  630. IsLP2AutoStoped = true;
  631. IsLP2AutoStarted = false;
  632. }
  633. else if (string.IsNullOrEmpty(LP2WaferAssociation.JobStatus))
  634. {
  635. IsLP2AutoStoped = false;
  636. IsLP2AutoStarted = false;
  637. }
  638. if ("Executing".Equals(LP3WaferAssociation.JobStatus))
  639. {
  640. IsLP3AutoStoped = false;
  641. IsLP3AutoStarted = true;
  642. }
  643. else if ("WaitingForStart".Equals(LP3WaferAssociation.JobStatus))
  644. {
  645. IsLP3AutoStoped = true;
  646. IsLP3AutoStarted = false;
  647. }
  648. else if (string.IsNullOrEmpty(LP3WaferAssociation.JobStatus))
  649. {
  650. IsLP3AutoStoped = false;
  651. IsLP3AutoStarted = false;
  652. }
  653. if (string.IsNullOrEmpty(LP1WaferAssociation.JobStatus))
  654. {
  655. IsLP1CanCreatedJob = true;
  656. }
  657. else
  658. {
  659. IsLP1CanCreatedJob = false;
  660. }
  661. if (string.IsNullOrEmpty(LP2WaferAssociation.JobStatus))
  662. {
  663. IsLP2CanCreatedJob = true;
  664. }
  665. else
  666. {
  667. IsLP2CanCreatedJob = false;
  668. }
  669. if (string.IsNullOrEmpty(LP3WaferAssociation.JobStatus))
  670. {
  671. IsLP3CanCreatedJob = true;
  672. }
  673. else
  674. {
  675. IsLP3CanCreatedJob = false;
  676. }
  677. }
  678. /// <summary>
  679. /// 选择所有Wafer
  680. /// </summary>
  681. private void OnSelectAll(object obj)
  682. {
  683. var info = obj as WaferAssociationInfo;
  684. var module = info.ModuleData.ModuleID;
  685. if (CommonFunction.GetValue<bool>(RtDataValues, $"{module}.IsLoaded"))
  686. {
  687. info.SlotFrom = 1;
  688. info.SlotTo = 25;
  689. AssociateSequence(info, true);
  690. }
  691. }
  692. /// <summary>
  693. /// 取消选择所有Wafer
  694. /// </summary>
  695. private void OnUnSelectAll(object obj)
  696. {
  697. var info = obj as WaferAssociationInfo;
  698. var module = info.ModuleData.ModuleID;
  699. info.SlotFrom = 1;
  700. info.SlotTo = 25;
  701. AssociateSequence(info, false);
  702. }
  703. /// <summary>
  704. /// 创建任务
  705. /// </summary>
  706. private void OnCreateJob(object obj)
  707. {
  708. var info = obj as WaferAssociationInfo;
  709. List<string> slotSequence = new List<string>();
  710. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  711. if (info.LotId == "" && info.JobID != "") info.LotId = info.JobID;
  712. if (info.LotId != "" && info.JobID == "") info.JobID = info.LotId;
  713. info.LotIdSaved = true;
  714. Dictionary<string, object> param = new Dictionary<string, object>()
  715. {
  716. {"JobId", info.JobID},
  717. {"LotId", info.LotId},
  718. {"Module", info.ModuleData.ModuleID},
  719. {"SlotSequence", slotSequence.ToArray()},
  720. {"AutoStart", true},
  721. {"CycleNumber",info.CycleNumber},
  722. {"SequenceType", info.SequenceType}
  723. };
  724. if (info.JobID != "" || info.LotId != "")
  725. {
  726. InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
  727. }
  728. }
  729. /// <summary>
  730. /// 取消任务
  731. /// </summary>
  732. private void OnAbortJob(object obj)
  733. {
  734. InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString());
  735. }
  736. /// <summary>
  737. /// 开始
  738. /// </summary>
  739. private void OnStart(object obj)
  740. {
  741. var info = obj as WaferAssociationInfo;
  742. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.JobID);
  743. //LOG.Info("System,Start Job");
  744. }
  745. /// <summary>
  746. /// 停止
  747. /// </summary>
  748. private void OnStop(object obj)
  749. {
  750. var info = obj as WaferAssociationInfo;
  751. InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID);
  752. //LOG.Info($"System,Stop Job{info.JobID}");
  753. }
  754. /// <summary>
  755. /// 取消
  756. /// </summary>
  757. private void OnAbort(object obj)
  758. {
  759. var info = obj as WaferAssociationInfo;
  760. InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID);
  761. //LOG.Info($"System,Stop Job{info.JobID}");
  762. }
  763. /// <summary>
  764. /// Sequence Combox的SelectionChanged事件
  765. /// </summary>
  766. private void OnSelectionChanged(object obj)
  767. {
  768. var moduleName = obj.ToString();
  769. switch (moduleName)
  770. {
  771. case "LP1":
  772. if (!string.IsNullOrEmpty(_LP1SequenceNameBuffer) && LP1SequenceName == null) LP1SequenceName = _LP1SequenceNameBuffer;
  773. _LP1SequenceNameBuffer = LP1SequenceName;
  774. LP1WaferAssociation.SequenceName = LP1SequenceName;
  775. break;
  776. case "LP2":
  777. if (!string.IsNullOrEmpty(_LP2SequenceNameBuffer) && LP2SequenceName == null) LP2SequenceName = _LP2SequenceNameBuffer;
  778. _LP2SequenceNameBuffer = LP2SequenceName;
  779. LP2WaferAssociation.SequenceName = LP2SequenceName;
  780. break;
  781. case "LP3":
  782. if (!string.IsNullOrEmpty(_LP3SequenceNameBuffer) && LP3SequenceName == null) LP3SequenceName = _LP3SequenceNameBuffer;
  783. _LP3SequenceNameBuffer = LP3SequenceName;
  784. LP3WaferAssociation.SequenceName = LP3SequenceName;
  785. break;
  786. default:
  787. break;
  788. }
  789. }
  790. /// <summary>
  791. /// ListBox中设置单个Wafer的Sequence
  792. /// </summary>
  793. /// <param name="obj"></param>
  794. private void OnSetSequence(object obj)
  795. {
  796. var info = obj as WaferInfo;
  797. bool flag = info.SequenceName != "" ? false : true;
  798. if (info.ModuleID == "LP1" && (CommonFunction.GetValue<bool>(RtDataValues, "LP1.IsLoaded")))
  799. {
  800. AssociateSequence(LP1WaferAssociation, flag, info.SlotID);
  801. }
  802. else if (info.ModuleID == "LP2" && (CommonFunction.GetValue<bool>(RtDataValues, "LP2.IsLoaded")))
  803. {
  804. AssociateSequence(LP2WaferAssociation, flag, info.SlotID);
  805. }
  806. else if (info.ModuleID == "LP3" && (CommonFunction.GetValue<bool>(RtDataValues, "LP3.IsLoaded")))
  807. {
  808. AssociateSequence(LP3WaferAssociation, flag, info.SlotID);
  809. }
  810. }
  811. /// <summary>
  812. /// Sequence设置
  813. /// </summary>
  814. /// <param name="info"></param>
  815. /// <param name="flag"></param>
  816. /// <param name="slot"></param>
  817. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  818. {
  819. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  820. if (slot >= 0) //by wafer
  821. {
  822. int index = wafers.Count - slot - 1;
  823. if (index < wafers.Count)
  824. {
  825. if (flag && HasWaferOnSlot(wafers, index))
  826. wafers[index].SequenceName = info.SequenceName;
  827. else
  828. wafers[index].SequenceName = string.Empty;
  829. }
  830. }
  831. else //by from-to
  832. {
  833. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  834. {
  835. int index = wafers.Count - i - 1;
  836. if (index < wafers.Count)
  837. {
  838. if (flag && HasWaferOnSlot(wafers, index))
  839. wafers[index].SequenceName = info.SequenceName;
  840. else
  841. wafers[index].SequenceName = string.Empty;
  842. }
  843. }
  844. }
  845. switch (info.ModuleData.ModuleID)
  846. {
  847. case "LP1":
  848. LP1WaferAssociation = info;
  849. break;
  850. case "LP2":
  851. LP2WaferAssociation = info;
  852. break;
  853. case "LP3":
  854. LP3WaferAssociation = info;
  855. break;
  856. }
  857. }
  858. /// <summary>
  859. /// 检查Slot中的Wafer是否存在
  860. /// </summary>
  861. /// <param name="wafers"></param>
  862. /// <param name="index"></param>
  863. /// <returns></returns>
  864. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  865. {
  866. if (wafers[index].WaferStatus == 0)
  867. return false;
  868. return true;
  869. }
  870. /// <summary>
  871. /// 添加RT查询key
  872. /// </summary>
  873. private void addDataKeys()
  874. {
  875. m_RtDataKeys.Add("LP1.IsLoaded");
  876. m_RtDataKeys.Add("LP2.IsLoaded");
  877. m_RtDataKeys.Add("LP3.IsLoaded");
  878. m_RtDataKeys.Add("LP1.CassettePlaced");
  879. m_RtDataKeys.Add("LP2.CassettePlaced");
  880. m_RtDataKeys.Add("LP3.CassettePlaced");
  881. m_RtDataKeys.Add("LP1.CurrentControlJob");
  882. m_RtDataKeys.Add("LP2.CurrentControlJob");
  883. m_RtDataKeys.Add("LP3.CurrentControlJob");
  884. m_RtDataKeys.Add("System.IsAutoMode");
  885. m_RtDataKeys.Add("System.IsBusy");
  886. m_RtDataKeys.Add("LP1.CycledCount");
  887. m_RtDataKeys.Add("LP1.CycledWafer");
  888. m_RtDataKeys.Add("LP1.CycleSetPoint");
  889. m_RtDataKeys.Add("LP1.Throughput");
  890. m_RtDataKeys.Add("LP2.CycledCount");
  891. m_RtDataKeys.Add("LP2.CycledWafer");
  892. m_RtDataKeys.Add("LP2.CycleSetPoint");
  893. m_RtDataKeys.Add("LP2.Throughput");
  894. m_RtDataKeys.Add("LP3.CycledCount");
  895. m_RtDataKeys.Add("LP3.CycledWafer");
  896. m_RtDataKeys.Add("LP3.CycleSetPoint");
  897. m_RtDataKeys.Add("LP3.Throughput");
  898. m_RtDataKeys.Add("LP1.IsDocked");
  899. m_RtDataKeys.Add("LP2.IsDocked");
  900. m_RtDataKeys.Add("LP3.IsDocked");
  901. m_RtDataKeys.Add("LP1.WaferSize");
  902. m_RtDataKeys.Add("LP2.WaferSize");
  903. m_RtDataKeys.Add("LP3.WaferSize");
  904. }
  905. /// <summary>
  906. /// 更新Wafer情况
  907. /// </summary>
  908. /// <param name="info"></param>
  909. /// <param name="cjInfo"></param>
  910. private void UPdateWaferAssociation(WaferAssociationInfo info, ControlJobInfo cjInfo)
  911. {
  912. if (info == null)
  913. {
  914. return;
  915. }
  916. if (cjInfo != null)
  917. {
  918. info.LotId = cjInfo.LotName;
  919. info.JobID = cjInfo.Name;
  920. info.JobStatus = cjInfo.State.ToString();
  921. if (cjInfo.SequenceNameList != null)
  922. {
  923. for (int i = 0; i < cjInfo.SequenceNameList.Length; i++)
  924. {
  925. info.ModuleData.WaferManager.Wafers[24 - i].SequenceName = cjInfo.SequenceNameList[i];
  926. }
  927. }
  928. }
  929. else
  930. {
  931. if (!string.IsNullOrEmpty(info.JobID))
  932. {
  933. info.LotId = "";
  934. info.JobID = "";
  935. info.JobStatus = "";
  936. AssociateSequence(info, false);
  937. }
  938. }
  939. }
  940. private void OnLPMap(object obj)
  941. {
  942. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Map");
  943. }
  944. private void OnSeqTypeChange(object obj)
  945. {
  946. var info = obj as WaferAssociationInfo;
  947. //获取Sequence列表
  948. List<string> seqitems;
  949. switch (info.ModuleData.ModuleID)
  950. {
  951. case "LP1":
  952. info.SequenceType = LP1RecipeMode ? "Production" : "Engineering";
  953. seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType);
  954. SequenceSelectedItemsSource1.Clear();
  955. foreach (var seqitem in seqitems)
  956. {
  957. SequenceSelectedItemsSource1.Add(seqitem);
  958. }
  959. break;
  960. case "LP2":
  961. info.SequenceType = LP2RecipeMode ? "Production" : "Engineering";
  962. seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType);
  963. SequenceSelectedItemsSource2.Clear();
  964. foreach (var seqitem in seqitems)
  965. {
  966. SequenceSelectedItemsSource2.Add(seqitem);
  967. }
  968. break;
  969. case "LP3":
  970. info.SequenceType = LP3RecipeMode ? "Production" : "Engineering";
  971. seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType);
  972. SequenceSelectedItemsSource3.Clear();
  973. foreach (var seqitem in seqitems)
  974. {
  975. SequenceSelectedItemsSource3.Add(seqitem);
  976. }
  977. break;
  978. default:
  979. break;
  980. }
  981. }
  982. /// <summary>
  983. /// 清除信息
  984. /// </summary>
  985. /// <param name="info"></param>
  986. private void ClearInfo(ref WaferAssociationInfo info)
  987. {
  988. info.LotId = "";
  989. info.JobID = "";
  990. info.SequenceName = "";
  991. info.CycleNumber = 1;
  992. info.IsEnableCycle = false;
  993. info.ModuleData.WaferManager.IsReset = false;
  994. }
  995. #endregion
  996. }
  997. }