| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 | 
							- using Caliburn.Micro;
 
- using Caliburn.Micro.Core;
 
- using MECF.Framework.Common.CommonData;
 
- using MECF.Framework.UI.Client.CenterViews.Controls;
 
- using MECF.Framework.UI.Client.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 System.Windows.Media;
 
- namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
 
- {
 
-     public class BatchDetailViewModel : ModuleUiViewModelBase
 
-     {
 
-         public List<BoatWaferItem> BoatWafers { get; set; } = new List<BoatWaferItem>();
 
-         public ObservableCollection<BatchDetailItem> BatchDetailItems { get; set; } = new ObservableCollection<BatchDetailItem>();
 
-         private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _PBk = new SolidColorBrush(Colors.SkyBlue);
 
-         private SolidColorBrush _SDBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _EDBk = new SolidColorBrush(Colors.Yellow);
 
-         private SolidColorBrush _MBk = new SolidColorBrush(Colors.Pink);
 
-         private SolidColorBrush _XDBk = new SolidColorBrush(Colors.White);
 
-         private SolidColorBrush _TBk = new SolidColorBrush(Colors.DarkGreen);
 
-         private string _batchId;
 
-         public string BatchId
 
-         {
 
-             get => _batchId;
 
-             set
 
-             {
 
-                 _batchId = value;
 
-                 NotifyOfPropertyChange(nameof(BatchId));
 
-             }
 
-         }
 
-         private int _productionCount;
 
-         public int ProductionCount
 
-         {
 
-             get => _productionCount;
 
-             set
 
-             {
 
-                 _productionCount = value;
 
-                 NotifyOfPropertyChange(nameof(ProductionCount));
 
-             }
 
-         }
 
-         private int _monitor1Count;
 
-         public int Monitor1Count
 
-         {
 
-             get => _monitor1Count;
 
-             set
 
-             {
 
-                 _monitor1Count = value;
 
-                 NotifyOfPropertyChange(nameof(Monitor1Count));
 
-             }
 
-         }
 
-         private int _monitor2Count;
 
-         public int Monitor2Count
 
-         {
 
-             get => _monitor2Count;
 
-             set
 
-             {
 
-                 _monitor2Count = value;
 
-                 NotifyOfPropertyChange(nameof(Monitor2Count));
 
-             }
 
-         }
 
-         private int _dummyCount;
 
-         public int DummyCount
 
-         {
 
-             get => _dummyCount;
 
-             set
 
-             {
 
-                 _dummyCount = value;
 
-                 NotifyOfPropertyChange(nameof(DummyCount));
 
-             }
 
-         }
 
-         private int _extraDummyCount;
 
-         public int ExtraDummyCount
 
-         {
 
-             get => _extraDummyCount;
 
-             set
 
-             {
 
-                 _extraDummyCount = value;
 
-                 NotifyOfPropertyChange(nameof(ExtraDummyCount));
 
-             }
 
-         }
 
-         private int _etcCount;
 
-         public int EtcCount
 
-         {
 
-             get => _etcCount;
 
-             set
 
-             {
 
-                 _etcCount = value;
 
-                 NotifyOfPropertyChange(nameof(EtcCount));
 
-             }
 
-         }
 
-         private int _total;
 
-         public int Total
 
-         {
 
-             get => _total;
 
-             set
 
-             {
 
-                 _total = value;
 
-                 NotifyOfPropertyChange(nameof(Total));
 
-             }
 
-         }
 
-         public DateTime StartTime { get; set; }
 
-         public DateTime EndTime { get; set; }
 
-         private int _cassetteSelectIndex;
 
-         public int CassetteSelectIndex
 
-         {
 
-             get => _cassetteSelectIndex;
 
-             set
 
-             {
 
-                 _cassetteSelectIndex = value;
 
-                 NotifyOfPropertyChange(nameof(CassetteSelectIndex));
 
-             }
 
-         }
 
-         public BatchDetailViewModel()
 
-         {
 
-         }
 
-         public BatchDetailViewModel(DateTime startTime, DateTime endTime, string batchId, List<string> layoutData, int iSlotCount, List<string> waferData)
 
-         {
 
-             StartTime = startTime;
 
-             EndTime = endTime;
 
-             BatchId = batchId;
 
-             Total = iSlotCount;
 
-             for (int i = 0; i < iSlotCount; i++)
 
-             {
 
-                 BoatWaferItem item = new BoatWaferItem() { Slot = i + 1, Description = $"{layoutData[i]}" };
 
-                 BoatWafers.Add(item);
 
-             }
 
-             for (int i = 0; i < iSlotCount; i++)
 
-             {
 
-                 string waferType = BoatWafers[i].Description.Split('-').ToList()[0];
 
-                 switch (waferType)
 
-                 {
 
-                     case "P":
 
-                         BoatWafers[i].BkColor = _PBk;
 
-                         break;
 
-                     case "M":
 
-                         BoatWafers[i].BkColor = _MBk;
 
-                         break;
 
-                     case "SD":
 
-                         BoatWafers[i].BkColor = _SDBk;
 
-                         break;
 
-                     case "ED":
 
-                         BoatWafers[i].BkColor = _EDBk;
 
-                         break;
 
-                     default:
 
-                         BoatWafers[i].BkColor = _DefaultdBk;
 
-                         break;
 
-                 }
 
-                 var description = BoatWafers[i].Description;
 
-                 description = description.Substring(description.IndexOf('-') + 1);
 
-                 BoatWafers[i].Description = description;
 
-             }
 
-             BatchDetailParser(waferData);
 
-         }
 
-         private void BatchDetailParser(List<string> waferData)
 
-         {
 
-             ProductionCount = 0;
 
-             Monitor1Count = 0;
 
-             Monitor2Count = 0;
 
-             DummyCount = 0;
 
-             ExtraDummyCount = 0;
 
-             EtcCount = 0;
 
-             for (int i = 0; i < waferData.Count; i++)
 
-             {
 
-                 if (string.IsNullOrEmpty(waferData[i]))
 
-                     continue;
 
-                 var temp = waferData[i].Split(':').ToList();
 
-                 var wafertype = temp[0];
 
-                 var stockername = temp[1].Split('.')[0];
 
-                 var lotid = temp.Count > 2 ? temp[2] : "";
 
-                 switch (wafertype)
 
-                 {
 
-                     case "P":
 
-                         ProductionCount++;
 
-                         break;
 
-                     case "M1":
 
-                         Monitor1Count++;
 
-                         break;
 
-                     case "M2":
 
-                         Monitor2Count++;
 
-                         break;
 
-                     case "SD":
 
-                         DummyCount++;
 
-                         break;
 
-                     case "ED":
 
-                         ExtraDummyCount++;
 
-                         break;
 
-                 }
 
-                 BatchDetailItem detail = BatchDetailItems.Where(x => x.StockerName == stockername).FirstOrDefault();
 
-                 if (detail == null)
 
-                 {
 
-                     BatchDetailItem item = new BatchDetailItem();
 
-                     item.WaferType = wafertype;
 
-                     item.StockerName = stockername;
 
-                     item.LotId = lotid;
 
-                     item.WaferCount = 1;
 
-                     BatchDetailItems.Add(item);
 
-                 }
 
-                 else
 
-                 {
 
-                     BatchDetailItems.Where(x => x.StockerName == stockername).FirstOrDefault().WaferCount++;
 
-                 }
 
-             }
 
-             EtcCount = Total - ProductionCount - Monitor1Count - Monitor2Count - DummyCount - ExtraDummyCount;
 
-         }
 
-         public void CassetteDetail()
 
-         {
 
-             if (CassetteSelectIndex != -1 && BatchDetailItems.Count > 0)
 
-             {
 
-                 var windowManager = IoC.Get<IWindowManager>();
 
-                 CassetteDetailViewModel cassetteDetailViewModel = new CassetteDetailViewModel(StartTime, EndTime, BatchDetailItems[CassetteSelectIndex].LotId);
 
-                 (windowManager as WindowManager)?.ShowDialogWithTitle(cassetteDetailViewModel, null, "Cassette Detail");
 
-             }
 
-         }
 
-         public void CloseCmd()
 
-         {
 
-             ((Window)GetView()).Close();
 
-         }
 
-     }
 
-     public class BatchDetailItem : NotifiableItem
 
-     {
 
-         private string _waferType;
 
-         public string WaferType
 
-         {
 
-             get => _waferType;
 
-             set
 
-             {
 
-                 _waferType = value;
 
-                 InvokePropertyChanged(nameof(WaferType));
 
-             }
 
-         }
 
-         private string _stockerName;
 
-         public string StockerName
 
-         {
 
-             get => _stockerName;
 
-             set
 
-             {
 
-                 _stockerName = value;
 
-                 InvokePropertyChanged(nameof(StockerName));
 
-             }
 
-         }
 
-         private string _lotId;
 
-         public string LotId
 
-         {
 
-             get => _lotId;
 
-             set
 
-             {
 
-                 _lotId = value;
 
-                 InvokePropertyChanged(nameof(LotId));
 
-             }
 
-         }
 
-         private int _waferCount;
 
-         public int WaferCount
 
-         {
 
-             get => _waferCount;
 
-             set
 
-             {
 
-                 _waferCount = value;
 
-                 InvokePropertyChanged(nameof(WaferCount));
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |