SpecifiedMapViewModel.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. using FurnaceUI.Models;
  2. using MECF.Framework.UI.Client.ClientBase;
  3. using OpenSEMI.Ctrlib.Controls;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Input;
  12. namespace FurnaceUI.Views.Jobs
  13. {
  14. public class SpecifiedMapViewModel : FurnaceModuleUIViewModelBase
  15. {
  16. public int point1Count { get; set; }
  17. public int point2Count { get; set; }
  18. public int point3Count { get; set; }
  19. public int point4Count { get; set; }
  20. public int point5Count { get; set; }
  21. public int point6Count { get; set; }
  22. public int point7Count { get; set; }
  23. public int point8Count { get; set; }
  24. public int point9Count { get; set; }
  25. public int point10Count { get; set; }
  26. public int point11Count { get; set; }
  27. public int point12Count { get; set; }
  28. public int point13Count { get; set; }
  29. public int point14Count { get; set; }
  30. public int point15Count { get; set; }
  31. public int point16Count { get; set; }
  32. public int point17Count { get; set; }
  33. public int point18Count { get; set; }
  34. public int point19Count { get; set; }
  35. public int point20Count { get; set; }
  36. public int point21Count { get; set; }
  37. public int point22Count { get; set; }
  38. public int point23Count { get; set; }
  39. public int point24Count { get; set; }
  40. public int point25Count { get; set; }
  41. public ModuleInfo WaferItem { get; set; }
  42. private int _SlotCount;
  43. public int SlotCount
  44. {
  45. get => _SlotCount;
  46. set
  47. {
  48. _SlotCount = value;
  49. NotifyOfPropertyChange("SlotCount");
  50. }
  51. }
  52. private string _waferType;
  53. public string WaferType
  54. {
  55. get => _waferType;
  56. set
  57. {
  58. _waferType = value;
  59. NotifyOfPropertyChange(nameof(WaferType));
  60. }
  61. }
  62. public ObservableCollection<SlotItem> SlotNoList { get; set; } = new ObservableCollection<SlotItem>();
  63. public string SlotMap { get; set; }
  64. protected override void OnInitialize()
  65. {
  66. base.OnInitialize();
  67. for (int i = 0; i < 25; i++)
  68. {
  69. SlotNoList.Add(new SlotItem() { SlotNoEnable = false, SlotNoExist = "None" });
  70. }
  71. WaferItem = new ModuleInfo("Specified", "SpecifiedModule", "SpecifiedWafers", true, false);
  72. for (int i = 0; i < 25; i++)
  73. {
  74. WaferItem.WaferManager.Wafers.Add(new WaferInfo()
  75. {
  76. SlotID = 25 - i,
  77. SlotIndex = 25 - i
  78. });
  79. }
  80. WaferItem.IsInstalled = true;
  81. }
  82. public void ClosedCmd(string cmdPar)
  83. {
  84. (GetView() as Window).DialogResult = false; ;
  85. }
  86. public void EXECCmd()
  87. {
  88. for (int i = WaferItem.WaferManager.Wafers.Count - 1; i >= 0; i--)
  89. {
  90. SlotMap += WaferItem.WaferManager.Wafers[i].WaferStatus;
  91. }
  92. (GetView() as Window).DialogResult = true;
  93. }
  94. public override void OnMouseUp(object sender, MouseButtonEventArgs e)
  95. {
  96. base.OnMouseUp(sender, e);
  97. if (e.ChangedButton == MouseButton.Left)
  98. {
  99. if (sender is Slot slot)
  100. {
  101. if (WaferItem.WaferManager.Wafers[25-slot.SlotID].WaferStatus == 0)
  102. { WaferItem.WaferManager.Wafers[25 - slot.SlotID ].WaferStatus = 1; }
  103. else
  104. {
  105. WaferItem.WaferManager.Wafers[25 - slot.SlotID].WaferStatus = 0;
  106. }
  107. if (slot.WaferStatus == 0)
  108. {
  109. SlotNoList[slot.SlotID - 1].SlotNoEnable = false;
  110. SlotNoList[slot.SlotID - 1].SlotNoExist = "None";
  111. }
  112. else if (slot.WaferStatus == 1)
  113. {
  114. SlotNoList[slot.SlotID - 1].SlotNoEnable = true;
  115. SlotNoList[slot.SlotID - 1].SlotNoExist = "Exist";
  116. }
  117. int pointCount = (int)this.GetType().GetProperty($"point{slot.SlotID}Count").GetValue(this);
  118. this.GetType().GetProperty($"point{slot.SlotID}Count").SetValue(this, ++pointCount);
  119. }
  120. SlotCount = SlotNoList.Where(s => s.SlotNoEnable == true).Count();
  121. }
  122. }
  123. public void SlotNoCheck(string SlotNo)
  124. {
  125. switch (SlotNo)
  126. {
  127. case "1":
  128. point1Count++;
  129. if (point1Count % 2 == 0)
  130. {
  131. SlotNoList[0].SlotNoEnable = false;
  132. SlotNoList[0].SlotNoExist = "None";
  133. }
  134. else
  135. {
  136. SlotNoList[0].SlotNoEnable = true;
  137. SlotNoList[0].SlotNoExist = "Exist";
  138. }
  139. break;
  140. case "2":
  141. point2Count++;
  142. if (point2Count % 2 == 0)
  143. {
  144. SlotNoList[1].SlotNoEnable = false;
  145. SlotNoList[1].SlotNoExist = "None";
  146. }
  147. else
  148. {
  149. SlotNoList[1].SlotNoEnable = true;
  150. SlotNoList[1].SlotNoExist = "Exist";
  151. }
  152. break;
  153. case "3":
  154. point3Count++;
  155. if (point3Count % 2 == 0)
  156. {
  157. SlotNoList[2].SlotNoEnable = false;
  158. SlotNoList[2].SlotNoExist = "None";
  159. }
  160. else
  161. {
  162. SlotNoList[2].SlotNoEnable = true;
  163. SlotNoList[2].SlotNoExist = "Exist";
  164. }
  165. break;
  166. case "4":
  167. point4Count++;
  168. if (point4Count % 2 == 0)
  169. {
  170. SlotNoList[3].SlotNoEnable = false;
  171. SlotNoList[3].SlotNoExist = "None";
  172. }
  173. else
  174. {
  175. SlotNoList[3].SlotNoEnable = true;
  176. SlotNoList[3].SlotNoExist = "Exist";
  177. }
  178. break;
  179. case "5":
  180. point5Count++;
  181. if (point5Count % 2 == 0)
  182. {
  183. SlotNoList[4].SlotNoEnable = false;
  184. SlotNoList[4].SlotNoExist = "None";
  185. }
  186. else
  187. {
  188. SlotNoList[4].SlotNoEnable = true;
  189. SlotNoList[4].SlotNoExist = "Exist";
  190. }
  191. break;
  192. case "6":
  193. point6Count++;
  194. if (point6Count % 2 == 0)
  195. {
  196. SlotNoList[5].SlotNoEnable = false;
  197. SlotNoList[5].SlotNoExist = "None";
  198. }
  199. else
  200. {
  201. SlotNoList[5].SlotNoEnable = true;
  202. SlotNoList[5].SlotNoExist = "Exist";
  203. }
  204. break;
  205. case "7":
  206. point7Count++;
  207. if (point7Count % 2 == 0)
  208. {
  209. SlotNoList[6].SlotNoEnable = false;
  210. SlotNoList[6].SlotNoExist = "None";
  211. }
  212. else
  213. {
  214. SlotNoList[6].SlotNoEnable = true;
  215. SlotNoList[6].SlotNoExist = "Exist";
  216. }
  217. break;
  218. case "8":
  219. point8Count++;
  220. if (point8Count % 2 == 0)
  221. {
  222. SlotNoList[7].SlotNoEnable = false;
  223. SlotNoList[7].SlotNoExist = "None";
  224. }
  225. else
  226. {
  227. SlotNoList[7].SlotNoEnable = true;
  228. SlotNoList[7].SlotNoExist = "Exist";
  229. }
  230. break;
  231. case "9":
  232. point9Count++;
  233. if (point9Count % 2 == 0)
  234. {
  235. SlotNoList[8].SlotNoEnable = false;
  236. SlotNoList[8].SlotNoExist = "None";
  237. }
  238. else
  239. {
  240. SlotNoList[8].SlotNoEnable = true;
  241. SlotNoList[8].SlotNoExist = "Exist";
  242. }
  243. break;
  244. case "10":
  245. point10Count++;
  246. if (point10Count % 2 == 0)
  247. {
  248. SlotNoList[9].SlotNoEnable = false;
  249. SlotNoList[9].SlotNoExist = "None";
  250. }
  251. else
  252. {
  253. SlotNoList[9].SlotNoEnable = true;
  254. SlotNoList[9].SlotNoExist = "Exist";
  255. }
  256. break;
  257. case "11":
  258. point11Count++;
  259. if (point11Count % 2 == 0)
  260. {
  261. SlotNoList[10].SlotNoEnable = false;
  262. SlotNoList[10].SlotNoExist = "None";
  263. }
  264. else
  265. {
  266. SlotNoList[10].SlotNoEnable = true;
  267. SlotNoList[10].SlotNoExist = "Exist";
  268. }
  269. break;
  270. case "12":
  271. point12Count++;
  272. if (point12Count % 2 == 0)
  273. {
  274. SlotNoList[11].SlotNoEnable = false;
  275. SlotNoList[11].SlotNoExist = "None";
  276. }
  277. else
  278. {
  279. SlotNoList[11].SlotNoEnable = true;
  280. SlotNoList[11].SlotNoExist = "Exist";
  281. }
  282. break;
  283. case "13":
  284. point13Count++;
  285. if (point13Count % 2 == 0)
  286. {
  287. SlotNoList[12].SlotNoEnable = false;
  288. SlotNoList[12].SlotNoExist = "None";
  289. }
  290. else
  291. {
  292. SlotNoList[12].SlotNoEnable = true;
  293. SlotNoList[12].SlotNoExist = "Exist";
  294. }
  295. break;
  296. case "14":
  297. point14Count++;
  298. if (point14Count % 2 == 0)
  299. {
  300. SlotNoList[13].SlotNoEnable = false;
  301. SlotNoList[13].SlotNoExist = "None";
  302. }
  303. else
  304. {
  305. SlotNoList[13].SlotNoEnable = true;
  306. SlotNoList[13].SlotNoExist = "Exist";
  307. }
  308. break;
  309. case "15":
  310. point15Count++;
  311. if (point15Count % 2 == 0)
  312. {
  313. SlotNoList[14].SlotNoEnable = false;
  314. SlotNoList[14].SlotNoExist = "None";
  315. }
  316. else
  317. {
  318. SlotNoList[14].SlotNoEnable = true;
  319. SlotNoList[14].SlotNoExist = "Exist";
  320. }
  321. break;
  322. case "16":
  323. point16Count++;
  324. if (point16Count % 2 == 0)
  325. {
  326. SlotNoList[15].SlotNoEnable = false;
  327. SlotNoList[15].SlotNoExist = "None";
  328. }
  329. else
  330. {
  331. SlotNoList[15].SlotNoEnable = true;
  332. SlotNoList[15].SlotNoExist = "Exist";
  333. }
  334. break;
  335. case "17":
  336. point17Count++;
  337. if (point17Count % 2 == 0)
  338. {
  339. SlotNoList[16].SlotNoEnable = false;
  340. SlotNoList[16].SlotNoExist = "None";
  341. }
  342. else
  343. {
  344. SlotNoList[16].SlotNoEnable = true;
  345. SlotNoList[16].SlotNoExist = "Exist";
  346. }
  347. break;
  348. case "18":
  349. point18Count++;
  350. if (point18Count % 2 == 0)
  351. {
  352. SlotNoList[17].SlotNoEnable = false;
  353. SlotNoList[17].SlotNoExist = "None";
  354. }
  355. else
  356. {
  357. SlotNoList[17].SlotNoEnable = true;
  358. SlotNoList[17].SlotNoExist = "Exist";
  359. }
  360. break;
  361. case "19":
  362. point19Count++;
  363. if (point19Count % 2 == 0)
  364. {
  365. SlotNoList[18].SlotNoEnable = false;
  366. SlotNoList[18].SlotNoExist = "None";
  367. }
  368. else
  369. {
  370. SlotNoList[18].SlotNoEnable = true;
  371. SlotNoList[18].SlotNoExist = "Exist";
  372. }
  373. break;
  374. case "20":
  375. point20Count++;
  376. if (point20Count % 2 == 0)
  377. {
  378. SlotNoList[19].SlotNoEnable = false;
  379. SlotNoList[19].SlotNoExist = "None";
  380. }
  381. else
  382. {
  383. SlotNoList[19].SlotNoEnable = true;
  384. SlotNoList[19].SlotNoExist = "Exist";
  385. }
  386. break;
  387. case "21":
  388. point21Count++;
  389. if (point21Count % 2 == 0)
  390. {
  391. SlotNoList[20].SlotNoEnable = false;
  392. SlotNoList[20].SlotNoExist = "None";
  393. }
  394. else
  395. {
  396. SlotNoList[20].SlotNoEnable = true;
  397. SlotNoList[20].SlotNoExist = "Exist";
  398. }
  399. break;
  400. case "22":
  401. point22Count++;
  402. if (point22Count % 2 == 0)
  403. {
  404. SlotNoList[21].SlotNoEnable = false;
  405. SlotNoList[21].SlotNoExist = "None";
  406. }
  407. else
  408. {
  409. SlotNoList[21].SlotNoEnable = true;
  410. SlotNoList[21].SlotNoExist = "Exist";
  411. }
  412. break;
  413. case "23":
  414. point23Count++;
  415. if (point23Count % 2 == 0)
  416. {
  417. SlotNoList[22].SlotNoEnable = false;
  418. SlotNoList[22].SlotNoExist = "None";
  419. }
  420. else
  421. {
  422. SlotNoList[22].SlotNoEnable = true;
  423. SlotNoList[22].SlotNoExist = "Exist";
  424. }
  425. break;
  426. case "24":
  427. point24Count++;
  428. if (point24Count % 2 == 0)
  429. {
  430. SlotNoList[23].SlotNoEnable = false;
  431. SlotNoList[23].SlotNoExist = "None";
  432. }
  433. else
  434. {
  435. SlotNoList[23].SlotNoEnable = true;
  436. SlotNoList[23].SlotNoExist = "Exist";
  437. }
  438. break;
  439. case "25":
  440. point25Count++;
  441. if (point25Count % 2 == 0)
  442. {
  443. SlotNoList[24].SlotNoEnable = false;
  444. SlotNoList[24].SlotNoExist = "None";
  445. }
  446. else
  447. {
  448. SlotNoList[24].SlotNoEnable = true;
  449. SlotNoList[24].SlotNoExist = "Exist";
  450. }
  451. break;
  452. case "All":
  453. for (int i = 0; i < SlotNoList.Count; i++)
  454. {
  455. SlotNoList[i].SlotNoEnable = true;
  456. SlotNoList[i].SlotNoExist = "Exist";
  457. }
  458. break;
  459. case "None":
  460. for (int i = 0; i < SlotNoList.Count; i++)
  461. {
  462. SlotNoList[i].SlotNoEnable = false;
  463. SlotNoList[i].SlotNoExist = "None";
  464. }
  465. break;
  466. }
  467. if (SlotNo == "All")
  468. {
  469. for (int i = 0; i < WaferItem.WaferManager.Wafers.Count; i++)
  470. {
  471. WaferItem.WaferManager.Wafers[i].WaferType = Aitex.Core.Common.WaferType.P;
  472. WaferItem.WaferManager.Wafers[i].WaferStatus = 1;
  473. this.GetType().GetProperty($"point{WaferItem.WaferManager.Wafers[i].SlotID}Count").SetValue(this, 1);
  474. }
  475. }
  476. else if (SlotNo == "None")
  477. {
  478. for (int i = 0; i < WaferItem.WaferManager.Wafers.Count; i++)
  479. {
  480. WaferItem.WaferManager.Wafers[i].WaferType = Aitex.Core.Common.WaferType.None;
  481. WaferItem.WaferManager.Wafers[i].WaferStatus = 0;
  482. this.GetType().GetProperty($"point{WaferItem.WaferManager.Wafers[i].SlotID}Count").SetValue(this, 0);
  483. }
  484. }
  485. else
  486. {
  487. int pointCount = (int)this.GetType().GetProperty($"point{SlotNo}Count").GetValue(this);
  488. if (pointCount % 2 == 0)
  489. {
  490. WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferType = Aitex.Core.Common.WaferType.None;
  491. WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferStatus = 0;
  492. }
  493. else
  494. {
  495. WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferType = Aitex.Core.Common.WaferType.P;
  496. WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferStatus = 1;
  497. }
  498. }
  499. SlotCount = SlotNoList.Where(s => s.SlotNoEnable == true).Count();
  500. }
  501. }
  502. public class SlotItem : FurnaceModuleUIViewModelBase
  503. {
  504. private bool _SlotNoEnable;
  505. public bool SlotNoEnable
  506. {
  507. get => _SlotNoEnable;
  508. set
  509. {
  510. _SlotNoEnable = value;
  511. NotifyOfPropertyChange("SlotNoEnable");
  512. }
  513. }
  514. private string _SlotNoExist;
  515. public string SlotNoExist
  516. {
  517. get => _SlotNoExist;
  518. set
  519. {
  520. _SlotNoExist = value;
  521. NotifyOfPropertyChange("SlotNoExist");
  522. }
  523. }
  524. }
  525. }