using Aitex.Core.Common; using Aitex.Core.Util; 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.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using FurnaceUI.Models; namespace FurnaceUI.Views.Operations { public class CassetteViewModel : FurnaceUIViewModelBase { public CassetteViewModel(string module) { ModuleName = module; _cassetteSlot = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount"); _eDUseWarningLimit = (int)QueryDataClient.Instance.Service.GetConfig("PM1.WaferCycleTime.EDCountWarning"); _eDUseAlarmLimit = (int)QueryDataClient.Instance.Service.GetConfig("PM1.WaferCycleTime.EDCountAlarm"); for (int i = _cassetteSlot; i > 0; i--) { CassetteWaferInfoItems.Add(new WaferInfoItem() { SlotID = i }); } } double _eDUseWarningLimit; double _eDUseAlarmLimit; public string FontColor { get; set; } public string ModuleName { set; get; } private string _lotID = ""; public string LotID { get { return _lotID; } set { _lotID = value; NotifyOfPropertyChange("LotID"); } } [Subscription("Stocker1.CassettePresent")] public bool IsCassettePresent { get; set; } private Visibility _IsPMShow; public Visibility IsPMShow { get { return _IsPMShow; } set { _IsPMShow = value; NotifyOfPropertyChange("IsPMShow"); } } private Visibility _IsEDSDShow; public Visibility IsEDSDShow { get { return _IsEDSDShow; } set { _IsEDSDShow = value; NotifyOfPropertyChange("IsEDSDShow"); } } private string _WaferType; public string WaferType { get { return _WaferType; } set { _WaferType = value; NotifyOfPropertyChange("WaferType"); } } private string _ControlWidth; public string ControlWidth { get { return _ControlWidth; } set { _ControlWidth = value; NotifyOfPropertyChange("ControlWidth"); } } private int _cassetteSlot = 0; private ObservableCollection _cassetteWaferInfoItems = new ObservableCollection(); public ObservableCollection CassetteWaferInfoItems { get => _cassetteWaferInfoItems; set { _cassetteWaferInfoItems = value; NotifyOfPropertyChange(nameof(CassetteWaferInfoItems)); } } protected override void OnInitialize() { base.OnInitialize(); if (WaferType.Contains("P") || WaferType.Contains("M")) { IsPMShow = Visibility.Visible; IsEDSDShow = Visibility.Hidden; ControlWidth = "500"; } else { IsPMShow = Visibility.Hidden; IsEDSDShow = Visibility.Visible; ControlWidth = "800"; } } protected override void InvokeAfterUpdateProperty(Dictionary data) { RefreshCassetteDataTask(); } private void RefreshCassetteDataTask() { var wafers = ModuleManager.ModuleInfos[ModuleName].WaferManager.Wafers; if (wafers != null) { for (int i = 0; i < wafers.Count; i++) { if (wafers[i].WaferStatus != 0) { CassetteWaferInfoItems[i].ModuleID = wafers[i].ModuleID; CassetteWaferInfoItems[i].SourceName = wafers[i].SourceName; CassetteWaferInfoItems[i].WaferStatus = wafers[i].WaferStatus; CassetteWaferInfoItems[i].WaferType = wafers[i].WaferType.ToString(); CassetteWaferInfoItems[i].UseCount = wafers[i].UseCount.ToString(); CassetteWaferInfoItems[i].UseTime = wafers[i].UseTime.ToString(); CassetteWaferInfoItems[i].UseThick = wafers[i].UseThick.ToString(); if (wafers[i].UseCount >= _eDUseAlarmLimit) { CassetteWaferInfoItems[i].BgColor = "Red"; } if (wafers[i].UseCount >= _eDUseWarningLimit) { CassetteWaferInfoItems[i].BgColor = "Yellow"; } } else { CassetteWaferInfoItems[i].ModuleID = ""; CassetteWaferInfoItems[i].SourceName = ""; CassetteWaferInfoItems[i].WaferStatus = 0; CassetteWaferInfoItems[i].WaferType = ""; CassetteWaferInfoItems[i].UseCount = ""; CassetteWaferInfoItems[i].UseTime = ""; CassetteWaferInfoItems[i].UseThick = ""; //CassetteWaferInfoItems[i].BgColor = "Red"; } } } } public void CassetteClose() { ((Window)GetView()).DialogResult = false; } } }