using Aitex.Core.Common; using Aitex.Core.UI.MVVM; using Aitex.Core.Util; using Aitex.Core.Utilities; using Aitex.Sorter.Common; using Aitex.Sorter.UI.Controls; using Aitex.Sorter.UI.Controls.Common; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using System; using System.Collections.Generic; 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.ViewModel { class OperationViewSubModel : OperationMultiLPViewModel { private static int loadPortCount = 4; public ICommand StartCycleCommand { get; set; } public ICommand MapCommand { get; set; } [IgnorePropertyChange] public string BatchIDSetPoint { get; set; } [IgnorePropertyChange] public ComboBoxItem CycleFrom { get; set; } [IgnorePropertyChange] public ComboBoxItem CycleTo { get; set; } [Subscription(ParamName.ModuleWaferList, DeviceName.TurnOverStation)] public WaferInfo[] TurnOverStationWafers { get; set; } public WaferInfo TurnOverStationWafer => TurnOverStationWafers?[0]; [Subscription("System.TurnoverStation.IsPlacement")] public bool TurnoverStationWaferDetector { get => !_turnoverStationWaferDetector; set => _turnoverStationWaferDetector = value; } private bool _turnoverStationWaferDetector; [Subscription("LP1.InfoPadCarrierType")] public string LP1CarrierType { get => _lp1CarrierType; set => _lp1CarrierType = value; } private string _lp1CarrierType; [Subscription("LP2.InfoPadCarrierType")] public string LP2CarrierType { get => _lp2CarrierType; set => _lp2CarrierType = value; } private string _lp2CarrierType; [Subscription("LP3.InfoPadCarrierType")] public string LP3CarrierType { get => _lp3CarrierType; set => _lp3CarrierType = value; } private string _lp3CarrierType; [Subscription("LP4.InfoPadCarrierType")] public string LP4CarrierType { get => _lp4CarrierType; set => _lp4CarrierType = value; } private string _lp4CarrierType; public OperationViewSubModel() : base(loadPortCount) { WaferTransferOptionCommand = new DelegateCommand(BeforeTransfer); StartCycleCommand = new DelegateCommand(StartCycle); MapCommand = new DelegateCommand(DoLoadPortCmd, x => { if (x != null) { var target = CommandHelper.GetTarget(x); if (target != null) { var loadport = FoupList.Single(l => l.DeviceName == target.ToString()); switch (loadport.Station) { case ModuleName.LP1: return loadport.Present && loadport.Placement && (_lp1CarrierType != null && !_lp1CarrierType.Contains("FOUP")); case ModuleName.LP2: return loadport.Present && loadport.Placement && (_lp2CarrierType != null && !_lp2CarrierType.Contains("FOUP"));// && LoadPort_LoadPort2CassetteType != "Type1"; case ModuleName.LP3: return loadport.Present && loadport.Placement && (_lp3CarrierType != null && !_lp3CarrierType.Contains("FOUP")); case ModuleName.LP4: return loadport.Present && loadport.Placement && (_lp4CarrierType != null && !_lp4CarrierType.Contains("FOUP")); } return loadport.Present && loadport.Placement; } } return false; }); } protected override void Poll() { base.Poll(); } private void StartCycle(object obj) { if (CycleFrom == null || CycleTo == null) return; InvokeClient.Instance.Service.DoOperation("System.StartCycle", (string)CycleFrom.Content, (string)CycleTo.Content); } public ICommand WaferTransferOptionCommand { get; set; } protected virtual void BeforeTransfer(WaferTransferOption option) { option.Setting.ShowAlign = true; option.Setting.ShowLaserMarker = true; option.Setting.ShowT7Code = true; option.Setting.ShowTurnOver = true; } protected override void InitFoupList() { foreach (var item in FoupList) { item.FoupType = Controls.FoupType.LoadportMapButtonControl; } base.InitFoupList(); } } }