123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- using Aitex.Core.Common;
- using Aitex.Core.Util;
- using Caliburn.Micro.Core;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.ClientBase;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using FurnaceUI.Models;
- using FurnaceUI.Views.Editors;
- namespace FurnaceUI.Views.Operations
- {
- public class BoatModifyViewModel : FurnaceUIViewModelBase
- {
- public BoatModifyViewModel(string module)
- {
- ModuleName = module;
- for (int i = 1; i <= 21; i++)
- {
- OriginModuleItems.Add($"Stocker{i}");
- }
- var count = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
- for (int i = count; i > 0; i--)
- {
- BoatWaferInfoItems.Add(new WaferInfoItem() { SlotID = i });
- BoatMapWafers.Add("");
- }
- }
- public string ModuleName { set; get; }
- public List<string> OriginModuleItems { get; set; } = new List<string>();
- private int? _boatSlotFrom = 1;
- public int? BoatSlotFrom
- {
- get => _boatSlotFrom;
- set
- {
- _boatSlotFrom = value;
- NotifyOfPropertyChange(nameof(BoatSlotFrom));
- }
- }
- private int? _boatSlotTo = 1;
- public int? BoatSlotTo
- {
- get => _boatSlotTo;
- set
- {
- _boatSlotTo = value;
- NotifyOfPropertyChange(nameof(BoatSlotTo));
- }
- }
- private string _originSelectModule = "Stocker1";
- public string OriginSelectModule
- {
- get => _originSelectModule;
- set
- {
- _originSelectModule = value;
- NotifyOfPropertyChange(nameof(OriginSelectModule));
- }
- }
- private int? _originSlot = 1;
- public int? OriginSlot
- {
- get => _originSlot;
- set
- {
- _originSlot = value;
- NotifyOfPropertyChange(nameof(OriginSlot));
- }
- }
- public bool SDIsChecked { get; set; } = true;
- public bool EDIsChecked { get; set; }
- public bool PIsChecked { get; set; }
- public bool M1IsChecked { get; set; }
- public bool M2IsChecked { get; set; }
- public bool XDIsChecked { get; set; }
- [Subscription("Stocker1.CassettePresent")]
- public bool IsCassettePresent { get; set; }
- [Subscription("Rt.Status")]
- public string RtStatus { get; set; }
- [Subscription("PM1.Status")]
- public string PM1Status { get; set; }
- public bool IsBoatModifyEnabled
- {
- get
- {
- return (PM1Status == "Init" || PM1Status == "Idle" || PM1Status == "Error") && (RtStatus == "Init" || RtStatus == "Idle" || RtStatus == "Error");
- }
- }
- private List<string> _boatMapWafers = new List<string>();
- public List<string> BoatMapWafers
- {
- get => _boatMapWafers;
- set
- {
- _boatMapWafers = value;
- NotifyOfPropertyChange(nameof(BoatMapWafers));
- }
- }
- private ObservableCollection<WaferInfoItem> _boatWaferInfoItems = new ObservableCollection<WaferInfoItem>();
- public ObservableCollection<WaferInfoItem> BoatWaferInfoItems
- {
- get => _boatWaferInfoItems;
- set
- {
- _boatWaferInfoItems = value;
- NotifyOfPropertyChange(nameof(BoatWaferInfoItems));
- }
- }
- private int _upperSDNum = 0;
- public int UpperSDNum
- {
- get => _upperSDNum;
- set
- {
- _upperSDNum = value;
- NotifyOfPropertyChange(nameof(UpperSDNum));
- }
- }
- private int _productNum = 0;
- public int ProductNum
- {
- get => _productNum;
- set
- {
- _productNum = value;
- NotifyOfPropertyChange(nameof(ProductNum));
- }
- }
- private int _monitorNum1 = 0;
- public int MonitorNum1
- {
- get => _monitorNum1;
- set
- {
- _monitorNum1 = value;
- NotifyOfPropertyChange(nameof(MonitorNum1));
- }
- }
- private int _monitorNum2 = 0;
- public int MonitorNum2
- {
- get => _monitorNum2;
- set
- {
- _monitorNum2 = value;
- NotifyOfPropertyChange(nameof(MonitorNum2));
- }
- }
- private int _lowerSDNum = 0;
- public int LowerSDNum
- {
- get => _lowerSDNum;
- set
- {
- _lowerSDNum = value;
- NotifyOfPropertyChange(nameof(LowerSDNum));
- }
- }
- private int _lowerSideDummyNum = 9;
- private Tuple<int, int> ComputSD(List<string> dataSource)
- {
- List<string> otherSlot = dataSource.Where(a => a != "SD" && !string.IsNullOrEmpty(a)).ToList().Distinct().ToList();
- if (dataSource == null || dataSource.Count == 0)
- {
- return new Tuple<int, int>(0, 0);
- }
- List<int> minList = new List<int>();
- for (int i = 0; i < dataSource.Count; i++)
- {
- var item = dataSource[i];
- if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
- {
- break;
- }
- if (string.IsNullOrEmpty(item))
- {
- continue;
- }
- minList.Add(i);
- }
- dataSource.Reverse();
- List<int> maxList = new List<int>();
- for (int i = 0; i < dataSource.Count; i++)
- {
- var item = dataSource[i];
- if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))
- {
- break;
- }
- if (string.IsNullOrEmpty(item))
- {
- continue;
- }
- maxList.Add(i);
- }
- return new Tuple<int, int>(minList.Count(), maxList.Count());
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- RefreshCassetteDataTask();
- if (null != BoatMapWafers && BoatMapWafers.Count > 0)
- {
- BoatMapWafers.Reverse();
- UpperSDNum = BoatMapWafers.Where(x => x == "SD").Count();
- LowerSDNum = BoatMapWafers.Where(x => x == "ED").Count();
- ProductNum = BoatMapWafers.Where(x => x.StartsWith("P")).Count();
- MonitorNum1 = BoatMapWafers.Where(x => x == "M1").Count();
- MonitorNum2 = BoatMapWafers.Where(x => x == "M2").Count();
- }
- }
- private void RefreshCassetteDataTask()
- {
- var wafers = ModuleManager.ModuleInfos[ModuleName].WaferManager.Wafers;
- if (wafers != null)
- {
- int iIndex = 0;
- for (int i = 0; i < wafers.Count; i++)
- {
- if (wafers[i].WaferStatus != 0)
- {
- BoatWaferInfoItems[iIndex].ModuleID = wafers[i].ModuleID;
- if (string.IsNullOrEmpty(wafers[i].LotId))
- BoatWaferInfoItems[iIndex].SourceName = wafers[i].SourceName;
- else
- BoatWaferInfoItems[iIndex].SourceName = wafers[i].LotId + "-" + wafers[i].SourceName;
- BoatWaferInfoItems[iIndex].WaferStatus = wafers[i].WaferStatus;
- BoatWaferInfoItems[iIndex].WaferType = wafers[i].WaferType.ToString();
- BoatWaferInfoItems[iIndex].UseCount = wafers[i].UseCount.ToString();
- BoatWaferInfoItems[iIndex].UseTime = wafers[i].UseTime.ToString();
- BoatWaferInfoItems[iIndex].UseThick = wafers[i].UseThick.ToString();
- }
- else
- {
- BoatWaferInfoItems[iIndex].ModuleID = "";
- BoatWaferInfoItems[iIndex].SourceName = "";
- BoatWaferInfoItems[iIndex].WaferStatus = 0;
- BoatWaferInfoItems[iIndex].WaferType = "";
- BoatWaferInfoItems[iIndex].UseCount = "";
- BoatWaferInfoItems[iIndex].UseTime = "";
- BoatWaferInfoItems[iIndex].UseThick = "";
- }
- iIndex++;
- }
- BoatMapWafers = BoatWaferInfoItems.Select(a => a.WaferType).ToList();
- }
- }
- public void CreateWafer()
- {
- WaferType waferType = WaferType.None;
- if (SDIsChecked)
- waferType = WaferType.SD;
- else if (EDIsChecked)
- waferType = WaferType.ED;
- else if (PIsChecked)
- waferType = WaferType.P;
- else if (M1IsChecked)
- waferType = WaferType.M1;
- else if (XDIsChecked)
- waferType = WaferType.XD;
- else if (M2IsChecked)
- waferType = WaferType.M2;
- if (BoatSlotFrom > BoatSlotTo || BoatSlotTo > (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount") || BoatSlotFrom < 1)
- {
- DialogBox.ShowWarning($"BoatSlot input error,can not create,input range 1 to {(int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount")}");
- return;
- }
- if (OriginSlot < 1 || OriginSlot > (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount"))
- {
- DialogBox.ShowWarning($"OriginSlot input error,can not create,input range 1 to {(int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount")}");
- return;
- }
- InvokeClient.Instance.Service.DoOperation("CreateWaferFromTo", $"{ModuleName}", BoatSlotFrom, BoatSlotTo, new string[] { waferType.ToString(), OriginSelectModule, (OriginSlot - 1).ToString() });
- // InvokeClient.Instance.Service.DoOperation("CreateWafer", $"{ModuleName}", BoatSlotFrom, waferType.ToString(), OriginSelectModule, OriginSlot - 1);
- }
- public void DeleteWafer()
- {
- if (BoatSlotFrom < 1 || BoatSlotTo > (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount"))
- {
- DialogBox.ShowWarning($"BoatSlot input error,can not delete,input range 1 to {(int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount")}");
- return;
- }
- //InvokeClient.Instance.Service.DoOperation("DeleteWafer", $"{ModuleName}", BoatSlot);
- InvokeClient.Instance.Service.DoOperation("DeleteWaferFromTo", $"{ModuleName}", BoatSlotFrom, BoatSlotTo);
- }
- public void CassetteClose()
- {
- ((Window)GetView()).DialogResult = false;
- }
- }
- }
|