123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- using Aitex.Core.Common;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Utilities;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.UI.ViewModel;
- using MECF.Framework.Common.Equipment;
- 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.Controls;
- using System.Windows.Input;
- namespace Aitex.Sorter.UI.Controls
- {
- public class TransferSelectionViewModel : FoupListViewModelBase
- {
- public ObservableCollection<string> LoadPortList { get; set; }
- public TransferSelectionDialog MyTransferSelectionDialog { get; set; }
- public ICommand TransferCommand { get; set; }
- public ICommand OKCommand { get; set; }
- public ICommand CloseCommand { get; set; }
- public ICommand SelectionChangedCommand { get; set; }
- public ICommand QselectCommand { get; set; }
- public ICommand WaferTransferCommand { get; set; }
- public string TransferType { get; set; }
- public ObservableCollection<SorterRecipeTransferTableItem> TransferItems
- {
- get; set;
- }
- public void SetFoupCount(int foupCount)
- {
- LoadPortList = new ObservableCollection<string>();
- for (int i = 0; i < foupCount; i++)
- {
- LoadPortList.Add($"LP{ i + 1}");
- }
- }
- public string OriginalSelectedValue { get; set; }
- public string DestinationSelectedValue { get; set; }
- public TransferSelectionViewModel() : base("TransferSelection", 8)
- {
- TransferCommand = new DelegateCommand<string>(DoTransferCommand);
- OKCommand = new DelegateCommand<object>(DoOKCommand);
- CloseCommand = new DelegateCommand<object>(DoCloseCommand);
- SelectionChangedCommand = new DelegateCommand<object>(DoSelectionChangedCommand);
- QselectCommand=new DelegateCommand<object>(DoQselectCommand);
- WaferTransferCommand = new DelegateCommand<object>(DoWaferTransferCommand);
- TransferItems = new ObservableCollection<SorterRecipeTransferTableItem>();
- }
- private void DoWaferTransferCommand(object obj)
- {
- // TransferItems.Add(obj);
- }
- private void DoQselectCommand(object obj)
- {
-
- var placeMode = MyTransferSelectionDialog.CmbPlaceMode.Text;
- var cboOriginalTxt = MyTransferSelectionDialog.CboOriginal.Text;
- var cboDestination = MyTransferSelectionDialog.CboDestination.Text;
- if (placeMode != "")
- {
- switch (placeMode)
- {
- case "Opposite":
- foreach (var item in MyTransferSelectionDialog.OriginalFoupItem.Slots)
- {
- if (((WaferInfo)item).IsChecked)
- {
- var sorterRecipeTransferTableItem = new SorterRecipeTransferTableItem();
- sorterRecipeTransferTableItem.SourceStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboOriginalTxt);
- sorterRecipeTransferTableItem.SourceSlot = ((WaferInfo)item).Slot;
- sorterRecipeTransferTableItem.DestinationStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboDestination);
- sorterRecipeTransferTableItem.DestinationSlot =24- ((WaferInfo)item).Slot;
- TransferItems.Add(sorterRecipeTransferTableItem);
- }
- }
- break;
- case "Same":
- foreach (var item in MyTransferSelectionDialog.OriginalFoupItem.Slots)
- {
- if (((WaferInfo)item).IsChecked)
- {
- var sorterRecipeTransferTableItem = new SorterRecipeTransferTableItem();
- sorterRecipeTransferTableItem.SourceStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboOriginalTxt);
- sorterRecipeTransferTableItem.SourceSlot = ((WaferInfo)item).Slot;
- sorterRecipeTransferTableItem.DestinationStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboDestination);
- sorterRecipeTransferTableItem.DestinationSlot = ((WaferInfo)item).Slot;
- TransferItems.Add(sorterRecipeTransferTableItem);
- }
- }
- break;
- case "FromTop":
- int indexadd = 0;
- foreach (var item in MyTransferSelectionDialog.OriginalFoupItem.Slots)
- {
- if (((WaferInfo)item).IsChecked)
- {
- var sorterRecipeTransferTableItem = new SorterRecipeTransferTableItem();
- sorterRecipeTransferTableItem.SourceStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboOriginalTxt);
- sorterRecipeTransferTableItem.SourceSlot = ((WaferInfo)item).Slot;
- sorterRecipeTransferTableItem.DestinationStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboDestination);
- sorterRecipeTransferTableItem.DestinationSlot = indexadd;
- TransferItems.Add(sorterRecipeTransferTableItem);
- indexadd++;
- }
- }
- break;
- case "FromButtom":
- int indexsub = 24;
- foreach (var item in MyTransferSelectionDialog.OriginalFoupItem.Slots)
- {
- if (((WaferInfo)item).IsChecked)
- {
- var sorterRecipeTransferTableItem = new SorterRecipeTransferTableItem();
- sorterRecipeTransferTableItem.SourceStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboOriginalTxt);
- sorterRecipeTransferTableItem.SourceSlot = ((WaferInfo)item).Slot;
- sorterRecipeTransferTableItem.DestinationStation = (ModuleName)Enum.Parse(typeof(ModuleName), cboDestination);
- sorterRecipeTransferTableItem.DestinationSlot = indexsub;
- TransferItems.Add(sorterRecipeTransferTableItem);
- indexsub--;
- }
- }
- break;
- default:
- break;
- }
- }
-
- }
- private void DoSelectionChangedCommand(object obj)
- {
- ComboBox comboBox = (ComboBox)obj;
- if (comboBox.Name == "CboOriginal")
- {
- if (MyTransferSelectionDialog.OriginalFoupItem.Slots != null)
- {
- foreach (var item in MyTransferSelectionDialog.OriginalFoupItem.Slots)
- {
- ((WaferInfo)item).IsChecked = false;
- }
- }
- MyTransferSelectionDialog.OriginalFoupItem.Slots = FoupList[int.Parse(((string)comboBox.SelectedValue).Replace("LP", "")) - 1].WaferInfos;
- }
- if (((ComboBox)obj).Name == "CboDestination")
- {
- foreach (var item in MyTransferSelectionDialog.DestinationFoupItem.Slots)
- {
- ((WaferInfo)item).IsChecked = false;
- }
- MyTransferSelectionDialog.DestinationFoupItem.Slots = FoupList[int.Parse(((string)comboBox.SelectedValue).Replace("LP", "")) - 1].WaferInfos;
- }
- }
- private void DoCloseCommand(object obj)
- {
- MyTransferSelectionDialog.DialogResult = false;
- MyTransferSelectionDialog.Close();
- }
- private void DoOKCommand(object obj)
- {
- MyTransferSelectionDialog.DialogResult = true;
- MyTransferSelectionDialog.Close();
- }
- //直接执行函数
- private void DoTransferCommand(string obj)
- {
- TransferType = obj;
- //switch (obj)
- //{
- // case "Opposite":
- // break;
- // case "Same":
- // break;
- // case "FromTop":
- // break;
- // case "FromButtom":
- // break;
- // default:
- // break;
- //}
- }
- }
- }
|