123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540 |
- using FurnaceUI.Models;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.Ctrlib.Controls;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Input;
- namespace FurnaceUI.Views.Jobs
- {
- public class SpecifiedMapViewModel : FurnaceModuleUIViewModelBase
- {
- public int point1Count { get; set; }
- public int point2Count { get; set; }
- public int point3Count { get; set; }
- public int point4Count { get; set; }
- public int point5Count { get; set; }
- public int point6Count { get; set; }
- public int point7Count { get; set; }
- public int point8Count { get; set; }
- public int point9Count { get; set; }
- public int point10Count { get; set; }
- public int point11Count { get; set; }
- public int point12Count { get; set; }
- public int point13Count { get; set; }
- public int point14Count { get; set; }
- public int point15Count { get; set; }
- public int point16Count { get; set; }
- public int point17Count { get; set; }
- public int point18Count { get; set; }
- public int point19Count { get; set; }
- public int point20Count { get; set; }
- public int point21Count { get; set; }
- public int point22Count { get; set; }
- public int point23Count { get; set; }
- public int point24Count { get; set; }
- public int point25Count { get; set; }
- public ModuleInfo WaferItem { get; set; }
- private int _SlotCount;
- public int SlotCount
- {
- get => _SlotCount;
- set
- {
- _SlotCount = value;
- NotifyOfPropertyChange("SlotCount");
- }
- }
- private string _waferType;
- public string WaferType
- {
- get => _waferType;
- set
- {
- _waferType = value;
- NotifyOfPropertyChange(nameof(WaferType));
- }
- }
- public ObservableCollection<SlotItem> SlotNoList { get; set; } = new ObservableCollection<SlotItem>();
- public string SlotMap { get; set; }
- protected override void OnInitialize()
- {
- base.OnInitialize();
- for (int i = 0; i < 25; i++)
- {
- SlotNoList.Add(new SlotItem() { SlotNoEnable = false, SlotNoExist = "None" });
- }
- WaferItem = new ModuleInfo("Specified", "SpecifiedModule", "SpecifiedWafers", true, false);
- for (int i = 0; i < 25; i++)
- {
- WaferItem.WaferManager.Wafers.Add(new WaferInfo()
- {
- SlotID = 25 - i,
- SlotIndex = 25 - i
- });
- }
- WaferItem.IsInstalled = true;
- }
- public void ClosedCmd(string cmdPar)
- {
- (GetView() as Window).DialogResult = false; ;
- }
- public void EXECCmd()
- {
- for (int i = WaferItem.WaferManager.Wafers.Count - 1; i >= 0; i--)
- {
- SlotMap += WaferItem.WaferManager.Wafers[i].WaferStatus;
- }
- (GetView() as Window).DialogResult = true;
- }
- public override void OnMouseUp(object sender, MouseButtonEventArgs e)
- {
- base.OnMouseUp(sender, e);
- if (e.ChangedButton == MouseButton.Left)
- {
- if (sender is Slot slot)
- {
- if (WaferItem.WaferManager.Wafers[25-slot.SlotID].WaferStatus == 0)
- { WaferItem.WaferManager.Wafers[25 - slot.SlotID ].WaferStatus = 1; }
- else
- {
- WaferItem.WaferManager.Wafers[25 - slot.SlotID].WaferStatus = 0;
- }
- if (slot.WaferStatus == 0)
- {
- SlotNoList[slot.SlotID - 1].SlotNoEnable = false;
- SlotNoList[slot.SlotID - 1].SlotNoExist = "None";
- }
- else if (slot.WaferStatus == 1)
- {
- SlotNoList[slot.SlotID - 1].SlotNoEnable = true;
- SlotNoList[slot.SlotID - 1].SlotNoExist = "Exist";
- }
- int pointCount = (int)this.GetType().GetProperty($"point{slot.SlotID}Count").GetValue(this);
- this.GetType().GetProperty($"point{slot.SlotID}Count").SetValue(this, ++pointCount);
- }
- SlotCount = SlotNoList.Where(s => s.SlotNoEnable == true).Count();
- }
- }
- public void SlotNoCheck(string SlotNo)
- {
- switch (SlotNo)
- {
- case "1":
- point1Count++;
- if (point1Count % 2 == 0)
- {
- SlotNoList[0].SlotNoEnable = false;
- SlotNoList[0].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[0].SlotNoEnable = true;
- SlotNoList[0].SlotNoExist = "Exist";
- }
- break;
- case "2":
- point2Count++;
- if (point2Count % 2 == 0)
- {
- SlotNoList[1].SlotNoEnable = false;
- SlotNoList[1].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[1].SlotNoEnable = true;
- SlotNoList[1].SlotNoExist = "Exist";
- }
- break;
- case "3":
- point3Count++;
- if (point3Count % 2 == 0)
- {
- SlotNoList[2].SlotNoEnable = false;
- SlotNoList[2].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[2].SlotNoEnable = true;
- SlotNoList[2].SlotNoExist = "Exist";
- }
- break;
- case "4":
- point4Count++;
- if (point4Count % 2 == 0)
- {
- SlotNoList[3].SlotNoEnable = false;
- SlotNoList[3].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[3].SlotNoEnable = true;
- SlotNoList[3].SlotNoExist = "Exist";
- }
- break;
- case "5":
- point5Count++;
- if (point5Count % 2 == 0)
- {
- SlotNoList[4].SlotNoEnable = false;
- SlotNoList[4].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[4].SlotNoEnable = true;
- SlotNoList[4].SlotNoExist = "Exist";
- }
- break;
- case "6":
- point6Count++;
- if (point6Count % 2 == 0)
- {
- SlotNoList[5].SlotNoEnable = false;
- SlotNoList[5].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[5].SlotNoEnable = true;
- SlotNoList[5].SlotNoExist = "Exist";
- }
- break;
- case "7":
- point7Count++;
- if (point7Count % 2 == 0)
- {
- SlotNoList[6].SlotNoEnable = false;
- SlotNoList[6].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[6].SlotNoEnable = true;
- SlotNoList[6].SlotNoExist = "Exist";
- }
- break;
- case "8":
- point8Count++;
- if (point8Count % 2 == 0)
- {
- SlotNoList[7].SlotNoEnable = false;
- SlotNoList[7].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[7].SlotNoEnable = true;
- SlotNoList[7].SlotNoExist = "Exist";
- }
- break;
- case "9":
- point9Count++;
- if (point9Count % 2 == 0)
- {
- SlotNoList[8].SlotNoEnable = false;
- SlotNoList[8].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[8].SlotNoEnable = true;
- SlotNoList[8].SlotNoExist = "Exist";
- }
- break;
- case "10":
- point10Count++;
- if (point10Count % 2 == 0)
- {
- SlotNoList[9].SlotNoEnable = false;
- SlotNoList[9].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[9].SlotNoEnable = true;
- SlotNoList[9].SlotNoExist = "Exist";
- }
- break;
- case "11":
- point11Count++;
- if (point11Count % 2 == 0)
- {
- SlotNoList[10].SlotNoEnable = false;
- SlotNoList[10].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[10].SlotNoEnable = true;
- SlotNoList[10].SlotNoExist = "Exist";
- }
- break;
- case "12":
- point12Count++;
- if (point12Count % 2 == 0)
- {
- SlotNoList[11].SlotNoEnable = false;
- SlotNoList[11].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[11].SlotNoEnable = true;
- SlotNoList[11].SlotNoExist = "Exist";
- }
- break;
- case "13":
- point13Count++;
- if (point13Count % 2 == 0)
- {
- SlotNoList[12].SlotNoEnable = false;
- SlotNoList[12].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[12].SlotNoEnable = true;
- SlotNoList[12].SlotNoExist = "Exist";
- }
- break;
- case "14":
- point14Count++;
- if (point14Count % 2 == 0)
- {
- SlotNoList[13].SlotNoEnable = false;
- SlotNoList[13].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[13].SlotNoEnable = true;
- SlotNoList[13].SlotNoExist = "Exist";
- }
- break;
- case "15":
- point15Count++;
- if (point15Count % 2 == 0)
- {
- SlotNoList[14].SlotNoEnable = false;
- SlotNoList[14].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[14].SlotNoEnable = true;
- SlotNoList[14].SlotNoExist = "Exist";
- }
- break;
- case "16":
- point16Count++;
- if (point16Count % 2 == 0)
- {
- SlotNoList[15].SlotNoEnable = false;
- SlotNoList[15].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[15].SlotNoEnable = true;
- SlotNoList[15].SlotNoExist = "Exist";
- }
- break;
- case "17":
- point17Count++;
- if (point17Count % 2 == 0)
- {
- SlotNoList[16].SlotNoEnable = false;
- SlotNoList[16].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[16].SlotNoEnable = true;
- SlotNoList[16].SlotNoExist = "Exist";
- }
- break;
- case "18":
- point18Count++;
- if (point18Count % 2 == 0)
- {
- SlotNoList[17].SlotNoEnable = false;
- SlotNoList[17].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[17].SlotNoEnable = true;
- SlotNoList[17].SlotNoExist = "Exist";
- }
- break;
- case "19":
- point19Count++;
- if (point19Count % 2 == 0)
- {
- SlotNoList[18].SlotNoEnable = false;
- SlotNoList[18].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[18].SlotNoEnable = true;
- SlotNoList[18].SlotNoExist = "Exist";
- }
- break;
- case "20":
- point20Count++;
- if (point20Count % 2 == 0)
- {
- SlotNoList[19].SlotNoEnable = false;
- SlotNoList[19].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[19].SlotNoEnable = true;
- SlotNoList[19].SlotNoExist = "Exist";
- }
- break;
- case "21":
- point21Count++;
- if (point21Count % 2 == 0)
- {
- SlotNoList[20].SlotNoEnable = false;
- SlotNoList[20].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[20].SlotNoEnable = true;
- SlotNoList[20].SlotNoExist = "Exist";
- }
- break;
- case "22":
- point22Count++;
- if (point22Count % 2 == 0)
- {
- SlotNoList[21].SlotNoEnable = false;
- SlotNoList[21].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[21].SlotNoEnable = true;
- SlotNoList[21].SlotNoExist = "Exist";
- }
- break;
- case "23":
- point23Count++;
- if (point23Count % 2 == 0)
- {
- SlotNoList[22].SlotNoEnable = false;
- SlotNoList[22].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[22].SlotNoEnable = true;
- SlotNoList[22].SlotNoExist = "Exist";
- }
- break;
- case "24":
- point24Count++;
- if (point24Count % 2 == 0)
- {
- SlotNoList[23].SlotNoEnable = false;
- SlotNoList[23].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[23].SlotNoEnable = true;
- SlotNoList[23].SlotNoExist = "Exist";
- }
- break;
- case "25":
- point25Count++;
- if (point25Count % 2 == 0)
- {
- SlotNoList[24].SlotNoEnable = false;
- SlotNoList[24].SlotNoExist = "None";
- }
- else
- {
- SlotNoList[24].SlotNoEnable = true;
- SlotNoList[24].SlotNoExist = "Exist";
- }
- break;
- case "All":
- for (int i = 0; i < SlotNoList.Count; i++)
- {
- SlotNoList[i].SlotNoEnable = true;
- SlotNoList[i].SlotNoExist = "Exist";
- }
- break;
- case "None":
- for (int i = 0; i < SlotNoList.Count; i++)
- {
- SlotNoList[i].SlotNoEnable = false;
- SlotNoList[i].SlotNoExist = "None";
- }
- break;
- }
- if (SlotNo == "All")
- {
- for (int i = 0; i < WaferItem.WaferManager.Wafers.Count; i++)
- {
- WaferItem.WaferManager.Wafers[i].WaferType = Aitex.Core.Common.WaferType.P;
- WaferItem.WaferManager.Wafers[i].WaferStatus = 1;
- this.GetType().GetProperty($"point{WaferItem.WaferManager.Wafers[i].SlotID}Count").SetValue(this, 1);
- }
- }
- else if (SlotNo == "None")
- {
- for (int i = 0; i < WaferItem.WaferManager.Wafers.Count; i++)
- {
- WaferItem.WaferManager.Wafers[i].WaferType = Aitex.Core.Common.WaferType.None;
- WaferItem.WaferManager.Wafers[i].WaferStatus = 0;
- this.GetType().GetProperty($"point{WaferItem.WaferManager.Wafers[i].SlotID}Count").SetValue(this, 0);
- }
- }
- else
- {
- int pointCount = (int)this.GetType().GetProperty($"point{SlotNo}Count").GetValue(this);
- if (pointCount % 2 == 0)
- {
- WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferType = Aitex.Core.Common.WaferType.None;
- WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferStatus = 0;
- }
- else
- {
- WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferType = Aitex.Core.Common.WaferType.P;
- WaferItem.WaferManager.Wafers.Where(x => x.SlotIndex == int.Parse(SlotNo)).FirstOrDefault().WaferStatus = 1;
- }
- }
- SlotCount = SlotNoList.Where(s => s.SlotNoEnable == true).Count();
- }
- }
- public class SlotItem : FurnaceModuleUIViewModelBase
- {
- private bool _SlotNoEnable;
- public bool SlotNoEnable
- {
- get => _SlotNoEnable;
- set
- {
- _SlotNoEnable = value;
- NotifyOfPropertyChange("SlotNoEnable");
- }
- }
- private string _SlotNoExist;
- public string SlotNoExist
- {
- get => _SlotNoExist;
- set
- {
- _SlotNoExist = value;
- NotifyOfPropertyChange("SlotNoExist");
- }
- }
- }
- }
|