using MECF.Framework.Common.CommonData; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using OpenSEMI.ClientBase; using Prism.Commands; using Prism.Mvvm; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Threading; using CyberX8_MainPages.Unity; using MECF.Framework.Common.Utilities; using MECF.Framework.Common.Jobs; using CyberX8_MainPages.PMs; using MECF.Framework.Common.RecipeCenter; using System.Collections.ObjectModel; using System.Windows.Media.Animation; namespace CyberX8_MainPages.ViewModels { internal class JobOperationViewModel : BindableBase { #region 私有字段 /// /// LP1的Wafer相关信息 /// private WaferAssociationInfo _lp1WaferAssociation; /// /// LP2的Wafer相关信息 /// private WaferAssociationInfo _lp2WaferAssociation; /// /// LP3的Wafer相关信息 /// private WaferAssociationInfo _lp3WaferAssociation; /// /// LP1的Wafer数量 /// private int m_LP1WaferCount; /// /// LP2的Wafer数量 /// private int m_LP2WaferCount; /// /// LP3的Wafer数量 /// private int m_LP3WaferCount; /// /// RT查询数据字典 /// private Dictionary m_RtDataValues; /// /// RT查询Key列表 /// private List m_RtDataKeys = new List(); /// /// Sequence数据列表 LP1 /// private ObservableCollection m_SequenceSelectedItemsSource1 = new ObservableCollection(); /// /// Sequence数据列表 LP2 /// private ObservableCollection m_SequenceSelectedItemsSource2 = new ObservableCollection(); /// /// Sequence数据列表 LP3 /// private ObservableCollection m_SequenceSelectedItemsSource3 = new ObservableCollection(); /// /// LP1Sequence名称 /// private string m_LP1SequenceName; /// /// LP2Sequence名称 /// private string m_LP2SequenceName; /// /// LP3Sequence名称 /// private string m_LP3SequenceName; /// /// UiRecipeManager /// private UiRecipeManager _uiRecipeManager = new UiRecipeManager(); /// /// 定时器 /// DispatcherTimer _timer; /// /// LP1界面Enable /// private bool m_ButtonIsEnableLP1; /// /// LP2界面Enable /// private bool m_ButtonIsEnableLP2; /// /// LP3界面Enable /// private bool m_ButtonIsEnableLP3; /// /// LP1 SequenceName Buffer /// private string _LP1SequenceNameBuffer; /// /// LP2 SequenceName Buffer /// private string _LP2SequenceNameBuffer; /// /// LP3 SequenceName Buffer /// private string _LP3SequenceNameBuffer; private bool _isLp1Unable; private bool _isLp2Unable; private bool _isLp3Unable; private bool _lp1Unable; private bool _lp2Unable; private bool _lp3Unable; private bool _isLP1AutoStoped = true; private bool _isLP2AutoStoped = true; private bool _isLP3AutoStoped = true; private bool _isLP1AutoStarted = false; private bool _isLP2AutoStarted = false; private bool _isLP3AutoStarted = false; private bool _isLP1CanCreatedJob = false; private bool _isLP2CanCreatedJob = false; private bool _isLP3CanCreatedJob = false; /// /// LP1 RecipeMode /// private bool _lp1RecipeMode; /// /// LP2 RecipeMode /// private bool _lp2RecipeMode; /// /// LP3 RecipeMode /// private bool _lp3RecipeMode; /// /// LP1 Docked /// private bool _isLP1Docked; /// /// LP2 Docked /// private bool _isLP2Docked; /// /// LP3 Docked /// private bool _isLP3Docked; #endregion #region 属性 /// /// RT查询数据字典 /// public Dictionary RtDataValues { get { return m_RtDataValues; } set { SetProperty(ref m_RtDataValues, value); } } /// /// LP1的Wafer相关信息 /// public WaferAssociationInfo LP1WaferAssociation { get { return _lp1WaferAssociation; } set { SetProperty(ref _lp1WaferAssociation, value); } } /// /// LP2的Wafer相关信息 /// public WaferAssociationInfo LP2WaferAssociation { get { return _lp2WaferAssociation; } set { SetProperty(ref _lp2WaferAssociation, value); } } /// /// LP3的Wafer相关信息 /// public WaferAssociationInfo LP3WaferAssociation { get { return _lp3WaferAssociation; } set { SetProperty(ref _lp3WaferAssociation, value); } } /// /// LP1的Wafer数量 /// public int LP1WaferCount { get { return m_LP1WaferCount; } set { SetProperty(ref m_LP1WaferCount, value); } } /// /// LP2的Wafer数量 /// public int LP2WaferCount { get { return m_LP2WaferCount; } set { SetProperty(ref m_LP2WaferCount, value); } } /// /// LP3的Wafer数量 /// public int LP3WaferCount { get { return m_LP3WaferCount; } set { SetProperty(ref m_LP3WaferCount, value); } } /// /// Sequence数据列表 LP1 /// public ObservableCollection SequenceSelectedItemsSource1 { get { return m_SequenceSelectedItemsSource1; } set { SetProperty(ref m_SequenceSelectedItemsSource1, value); } } /// /// Sequence数据列表 LP2 /// public ObservableCollection SequenceSelectedItemsSource2 { get { return m_SequenceSelectedItemsSource2; } set { SetProperty(ref m_SequenceSelectedItemsSource2, value); } } /// /// Sequence数据列表 LP3 /// public ObservableCollection SequenceSelectedItemsSource3 { get { return m_SequenceSelectedItemsSource3; } set { SetProperty(ref m_SequenceSelectedItemsSource3, value); } } /// /// LP1Sequence名称 /// public string LP1SequenceName { get { return m_LP1SequenceName; } set { SetProperty(ref m_LP1SequenceName, value); } } /// /// LP2Sequence名称 /// public string LP2SequenceName { get { return m_LP2SequenceName; } set { SetProperty(ref m_LP2SequenceName, value); } } /// /// LP3Sequence名称 /// public string LP3SequenceName { get { return m_LP3SequenceName; } set { SetProperty(ref m_LP3SequenceName, value); } } /// /// LP1界面Enable /// public bool ButtonIsEnableLP1 { get { return m_ButtonIsEnableLP1; } set { SetProperty(ref m_ButtonIsEnableLP1, value); } } /// /// LP2界面Enable /// public bool ButtonIsEnableLP2 { get { return m_ButtonIsEnableLP2; } set { SetProperty(ref m_ButtonIsEnableLP2, value); } } /// /// LP3界面Enable /// public bool ButtonIsEnableLP3 { get { return m_ButtonIsEnableLP3; } set { SetProperty(ref m_ButtonIsEnableLP3, value); } } /// /// Created job 按钮可用性 /// public bool IsLP1CanCreatedJob { get { return _isLP1CanCreatedJob; } set { SetProperty(ref _isLP1CanCreatedJob, value); } } public bool IsLP2CanCreatedJob { get { return _isLP2CanCreatedJob; } set { SetProperty(ref _isLP2CanCreatedJob, value); } } public bool IsLP3CanCreatedJob { get { return _isLP3CanCreatedJob; } set { SetProperty(ref _isLP3CanCreatedJob, value); } } public bool IsLP1AutoStoped { get { return _isLP1AutoStoped; } set { SetProperty(ref _isLP1AutoStoped, value); } } public bool IsLP2AutoStoped { get { return _isLP2AutoStoped; } set { SetProperty(ref _isLP2AutoStoped, value); } } public bool IsLP3AutoStoped { get { return _isLP3AutoStoped; } set { SetProperty(ref _isLP3AutoStoped, value); } } public bool IsLP1AutoStarted { get { return _isLP1AutoStarted; } set { SetProperty(ref _isLP1AutoStarted, value); } } public bool IsLP2AutoStarted { get { return _isLP2AutoStarted; } set { SetProperty(ref _isLP2AutoStarted, value); } } public bool IsLP3AutoStarted { get { return _isLP3AutoStarted; } set { SetProperty(ref _isLP3AutoStarted, value); } } public bool IsLP1Unable { get { return _isLp1Unable; } set { SetProperty(ref _isLp1Unable, value); } } public bool IsLP2Unable { get { return _isLp2Unable; } set { SetProperty(ref _isLp2Unable, value); } } public bool IsLP3Unable { get { return _isLp3Unable; } set { SetProperty(ref _isLp3Unable, value); } } public bool LP1Unable { get { return _lp1Unable; } set { SetProperty(ref _lp1Unable, value); } } public bool LP2Unable { get { return _lp2Unable; } set { SetProperty(ref _lp2Unable, value); } } public bool LP3Unable { get { return _lp3Unable; } set { SetProperty(ref _lp3Unable, value); } } /// /// LP1 RecipeMode(Engineering:true, Production:false) /// public bool LP1RecipeMode { get { return _lp1RecipeMode; } set { SetProperty(ref _lp1RecipeMode, value); } } /// /// LP2 RecipeMode(Engineering:true, Production:false) /// public bool LP2RecipeMode { get { return _lp2RecipeMode; } set { SetProperty(ref _lp2RecipeMode, value); } } /// /// LP3 RecipeMode(Engineering:true, Production:false) /// public bool LP3RecipeMode { get { return _lp3RecipeMode; } set { SetProperty(ref _lp3RecipeMode, value); } } #endregion #region 命令 private DelegateCommand _SelectAllCommand; public DelegateCommand SelectAllCommand => _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand(OnSelectAll)); private DelegateCommand _UnSelectAllCommand; public DelegateCommand UnSelectAllCommand => _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand(OnUnSelectAll)); private DelegateCommand _CreateJobCommand; public DelegateCommand CreateJobCommand => _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand(OnCreateJob)); private DelegateCommand _AbortJobCommand; public DelegateCommand AbortJobCommand => _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand(OnAbortJob)); private DelegateCommand _StartCommand; public DelegateCommand StartCommand => _StartCommand ?? (_StartCommand = new DelegateCommand(OnStart)); private DelegateCommand _StopCommand; public DelegateCommand StopCommand => _StopCommand ?? (_StopCommand = new DelegateCommand(OnStop)); private DelegateCommand _AbortCommand; public DelegateCommand AbortCommand => _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort)); private DelegateCommand _SelectionChangedCommand; public DelegateCommand SelectionChangedCommand => _SelectionChangedCommand ?? (_SelectionChangedCommand = new DelegateCommand(OnSelectionChanged)); private DelegateCommand _SetSequenceCommand; public DelegateCommand SetSequenceCommand => _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand(OnSetSequence)); private DelegateCommand _LPLoadCommand; public DelegateCommand LPLoadCommand => _LPLoadCommand ?? (_LPLoadCommand = new DelegateCommand(OnLPLoad)); private DelegateCommand _LPUnLoadCommand; public DelegateCommand LPUnLoadCommand => _LPUnLoadCommand ?? (_LPUnLoadCommand = new DelegateCommand(OnLPUnLoad)); private DelegateCommand _SeqTypeChangeCommand; public DelegateCommand SeqTypeChangeCommand => _SeqTypeChangeCommand ?? (_SeqTypeChangeCommand = new DelegateCommand(OnSeqTypeChange)); #endregion #region /// /// 构造函数 /// public JobOperationViewModel() { LP1WaferAssociation = new WaferAssociationInfo(); LP3WaferAssociation = new WaferAssociationInfo(); LP2WaferAssociation = new WaferAssociationInfo(); SequenceSelectedItemsSource1 = new ObservableCollection(); SequenceSelectedItemsSource2 = new ObservableCollection(); SequenceSelectedItemsSource3 = new ObservableCollection(); LP1WaferCount = 0; LP2WaferCount = 0; LP3WaferCount = 0; _LP1SequenceNameBuffer = null; _LP2SequenceNameBuffer = null; _LP3SequenceNameBuffer = null; LP1RecipeMode = true; LP2RecipeMode = true; LP3RecipeMode = true; addDataKeys(); } #endregion #region 方法 /// /// 加载数据 /// public void LoadData(string systemName) { if (_timer == null) { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(100); _timer.Tick += Timer_Tick; ; } _timer.Start(); LP1WaferAssociation.SequenceType = LP1RecipeMode ? "Production" : "Engineering"; LP2WaferAssociation.SequenceType = LP2RecipeMode ? "Production" : "Engineering"; LP3WaferAssociation.SequenceType = LP3RecipeMode ? "Production" : "Engineering"; //获取Sequence列表 var seqitems1 = RecipeClient.Instance.Service.GetSequenceList("seq", LP1WaferAssociation.SequenceType); SequenceSelectedItemsSource1.Clear(); foreach (var seqitem in seqitems1) { SequenceSelectedItemsSource1.Add(seqitem); } var seqitems2 = RecipeClient.Instance.Service.GetSequenceList("seq", LP2WaferAssociation.SequenceType); SequenceSelectedItemsSource2.Clear(); foreach (var seqitem in seqitems2) { SequenceSelectedItemsSource2.Add(seqitem); } var seqitems3 = RecipeClient.Instance.Service.GetSequenceList("seq", LP3WaferAssociation.SequenceType); SequenceSelectedItemsSource3.Clear(); foreach (var seqitem in seqitems3) { SequenceSelectedItemsSource3.Add(seqitem); } } /// /// 隐藏 /// public void Hide() { _timer.Stop(); } /// /// 定时器执行 /// private void Timer_Tick(object sender, EventArgs e) { LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"]; LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"]; LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"]; IsLP1Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable") && ButtonIsEnableLP1; IsLP2Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable") && ButtonIsEnableLP2; IsLP3Unable = !(bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable") && ButtonIsEnableLP3; LP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable"); LP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable"); LP3Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable"); RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys); if (RtDataValues == null || RtDataValues.Count == 0) { return; } ControlJobInfo lp1Cj = CommonFunction.GetValue(RtDataValues, "LP1.CurrentControlJob"); if (lp1Cj == null) { ButtonIsEnableLP1 = true; LP1WaferAssociation.JobStatus = ""; } else { ButtonIsEnableLP1 = false; UPdateWaferAssociation(LP1WaferAssociation, lp1Cj); } ControlJobInfo lp2Cj = CommonFunction.GetValue(RtDataValues, "LP2.CurrentControlJob"); if (lp2Cj == null) { ButtonIsEnableLP2 = true; LP2WaferAssociation.JobStatus = ""; } else { ButtonIsEnableLP2 = false; UPdateWaferAssociation(LP2WaferAssociation, lp2Cj); } ControlJobInfo lp3Cj = CommonFunction.GetValue(RtDataValues, "LP3.CurrentControlJob"); if (lp3Cj == null) { ButtonIsEnableLP3 = true; LP3WaferAssociation.JobStatus = ""; } else { ButtonIsEnableLP3 = false; UPdateWaferAssociation(LP3WaferAssociation, lp3Cj); } LP1WaferCount = LP1WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count(); LP2WaferCount = LP2WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count(); LP3WaferCount = LP3WaferAssociation.ModuleData.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count(); _isLP1Docked = CommonFunction.GetValue(RtDataValues, "LP1.IsDocked"); if (!_isLP1Docked) { LP1WaferAssociation.SlotFrom = 1; LP1WaferAssociation.SlotTo = 25; LP1WaferAssociation.LotId = ""; LP1WaferAssociation.JobID = ""; LP1SequenceName = null; _LP1SequenceNameBuffer = null; LP1WaferAssociation.CycleNumber = 1; LP1WaferAssociation.IsEnableCycle = false; AssociateSequence(LP1WaferAssociation, false); } _isLP2Docked = CommonFunction.GetValue(RtDataValues, "LP2.IsDocked"); if (!_isLP2Docked) { LP2WaferAssociation.SlotFrom = 1; LP2WaferAssociation.SlotTo = 25; LP2WaferAssociation.LotId = ""; LP2WaferAssociation.JobID = ""; LP2SequenceName = null; _LP2SequenceNameBuffer = null; LP2WaferAssociation.CycleNumber = 1; LP2WaferAssociation.IsEnableCycle = false; AssociateSequence(LP2WaferAssociation, false); } _isLP3Docked = CommonFunction.GetValue(RtDataValues, "LP3.IsDocked"); if (!_isLP3Docked) { LP3WaferAssociation.SlotFrom = 1; LP3WaferAssociation.SlotTo = 25; LP3WaferAssociation.LotId = ""; LP3WaferAssociation.JobID = ""; LP3SequenceName = null; _LP3SequenceNameBuffer = null; LP3WaferAssociation.CycleNumber = 1; LP3WaferAssociation.IsEnableCycle = false; AssociateSequence(LP3WaferAssociation, false); } LP1WaferAssociation.SequenceType = LP1RecipeMode ? "Production" : "Engineering"; LP2WaferAssociation.SequenceType = LP2RecipeMode ? "Production" : "Engineering"; LP3WaferAssociation.SequenceType = LP3RecipeMode ? "Production" : "Engineering"; if ("Executing".Equals(LP1WaferAssociation.JobStatus)) { IsLP1AutoStoped = false; IsLP1AutoStarted = true; } else if ("WaitingForStart".Equals(LP1WaferAssociation.JobStatus)) { IsLP1AutoStoped = true; IsLP1AutoStarted = false; } else if (string.IsNullOrEmpty(LP1WaferAssociation.JobStatus)) { IsLP1AutoStoped = false; IsLP1AutoStarted = false; } if ("Executing".Equals(LP2WaferAssociation.JobStatus)) { IsLP2AutoStoped = false; IsLP2AutoStarted = true; } else if ("WaitingForStart".Equals(LP2WaferAssociation.JobStatus)) { IsLP2AutoStoped = true; IsLP2AutoStarted = false; } else if (string.IsNullOrEmpty(LP2WaferAssociation.JobStatus)) { IsLP2AutoStoped = false; IsLP2AutoStarted = false; } if ("Executing".Equals(LP3WaferAssociation.JobStatus)) { IsLP3AutoStoped = false; IsLP3AutoStarted = true; } else if ("WaitingForStart".Equals(LP3WaferAssociation.JobStatus)) { IsLP3AutoStoped = true; IsLP3AutoStarted = false; } else if (string.IsNullOrEmpty(LP3WaferAssociation.JobStatus)) { IsLP3AutoStoped = false; IsLP3AutoStarted = false; } if (string.IsNullOrEmpty(LP1WaferAssociation.JobStatus)) { IsLP1CanCreatedJob = true; } else { IsLP1CanCreatedJob = false; } if (string.IsNullOrEmpty(LP2WaferAssociation.JobStatus)) { IsLP2CanCreatedJob = true; } else { IsLP2CanCreatedJob = false; } if (string.IsNullOrEmpty(LP3WaferAssociation.JobStatus)) { IsLP3CanCreatedJob = true; } else { IsLP3CanCreatedJob = false; } } /// /// 选择所有Wafer /// private void OnSelectAll(object obj) { var info = obj as WaferAssociationInfo; var module = info.ModuleData.ModuleID; if (CommonFunction.GetValue(RtDataValues, $"{module}.IsLoaded")) { info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, true); } } /// /// 取消选择所有Wafer /// private void OnUnSelectAll(object obj) { var info = obj as WaferAssociationInfo; var module = info.ModuleData.ModuleID; info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, false); } /// /// 创建任务 /// private void OnCreateJob(object obj) { var info = obj as WaferAssociationInfo; List slotSequence = new List(); info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); }); if (info.LotId == "" && info.JobID != "") info.LotId = info.JobID; if (info.LotId != "" && info.JobID == "") info.JobID = info.LotId; info.LotIdSaved = true; Dictionary param = new Dictionary() { {"JobId", info.JobID}, {"LotId", info.LotId}, {"Module", info.ModuleData.ModuleID}, {"SlotSequence", slotSequence.ToArray()}, {"AutoStart", true}, {"CycleNumber",info.CycleNumber}, {"SequenceType", info.SequenceType} }; if(info.JobID != "" || info.LotId != "") { InvokeClient.Instance.Service.DoOperation("System.CreateJob", param); } } /// /// 取消任务 /// private void OnAbortJob(object obj) { InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString()); } /// /// 开始 /// private void OnStart(object obj) { var info = obj as WaferAssociationInfo; InvokeClient.Instance.Service.DoOperation("System.StartJob", info.JobID); //LOG.Info("System,Start Job"); } /// /// 停止 /// private void OnStop(object obj) { var info = obj as WaferAssociationInfo; InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID); //LOG.Info($"System,Stop Job{info.JobID}"); } /// /// 取消 /// private void OnAbort(object obj) { var info = obj as WaferAssociationInfo; InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID); //LOG.Info($"System,Stop Job{info.JobID}"); } /// /// Sequence Combox的SelectionChanged事件 /// private void OnSelectionChanged(object obj) { var moduleName = obj.ToString(); switch (moduleName) { case "LP1": if (!string.IsNullOrEmpty(_LP1SequenceNameBuffer) && LP1SequenceName == null) LP1SequenceName = _LP1SequenceNameBuffer; _LP1SequenceNameBuffer = LP1SequenceName; LP1WaferAssociation.SequenceName = LP1SequenceName; break; case "LP2": if (!string.IsNullOrEmpty(_LP2SequenceNameBuffer) && LP2SequenceName == null) LP2SequenceName = _LP2SequenceNameBuffer; _LP2SequenceNameBuffer = LP2SequenceName; LP2WaferAssociation.SequenceName = LP2SequenceName; break; case "LP3": if (!string.IsNullOrEmpty(_LP3SequenceNameBuffer) && LP3SequenceName == null) LP3SequenceName = _LP3SequenceNameBuffer; _LP3SequenceNameBuffer = LP3SequenceName; LP3WaferAssociation.SequenceName = LP3SequenceName; break; default: break; } } /// /// ListBox中设置单个Wafer的Sequence /// /// private void OnSetSequence(object obj) { var info = obj as WaferInfo; bool flag = info.SequenceName != "" ? false : true; if (info.ModuleID == "LP1" && (CommonFunction.GetValue(RtDataValues, "LP1.IsLoaded"))) { AssociateSequence(LP1WaferAssociation, flag, info.SlotID); } else if (info.ModuleID == "LP2" && (CommonFunction.GetValue(RtDataValues, "LP2.IsLoaded"))) { AssociateSequence(LP2WaferAssociation, flag, info.SlotID); } else if (info.ModuleID == "LP3" && (CommonFunction.GetValue(RtDataValues, "LP3.IsLoaded"))) { AssociateSequence(LP3WaferAssociation, flag, info.SlotID); } } /// /// Sequence设置 /// /// /// /// private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1) { List wafers = info.ModuleData.WaferManager.Wafers; if (slot >= 0) //by wafer { int index = wafers.Count - slot - 1; if (index < wafers.Count) { if (flag && HasWaferOnSlot(wafers, index)) wafers[index].SequenceName = info.SequenceName; else wafers[index].SequenceName = string.Empty; } } else //by from-to { for (int i = info.SlotFrom - 1; i < info.SlotTo; i++) { int index = wafers.Count - i - 1; if (index < wafers.Count) { if (flag && HasWaferOnSlot(wafers, index)) wafers[index].SequenceName = info.SequenceName; else wafers[index].SequenceName = string.Empty; } } } switch (info.ModuleData.ModuleID) { case "LP1": LP1WaferAssociation = info; break; case "LP2": LP2WaferAssociation = info; break; case "LP3": LP3WaferAssociation = info; break; } } /// /// 检查Slot中的Wafer是否存在 /// /// /// /// private bool HasWaferOnSlot(List wafers, int index) { if (wafers[index].WaferStatus == 0) return false; return true; } /// /// 添加RT查询key /// private void addDataKeys() { m_RtDataKeys.Add("LP1.IsLoaded"); m_RtDataKeys.Add("LP2.IsLoaded"); m_RtDataKeys.Add("LP3.IsLoaded"); m_RtDataKeys.Add("LP1.CassettePlaced"); m_RtDataKeys.Add("LP2.CassettePlaced"); m_RtDataKeys.Add("LP3.CassettePlaced"); m_RtDataKeys.Add("LP1.CurrentControlJob"); m_RtDataKeys.Add("LP2.CurrentControlJob"); m_RtDataKeys.Add("LP3.CurrentControlJob"); m_RtDataKeys.Add("System.IsAutoMode"); m_RtDataKeys.Add("System.IsBusy"); m_RtDataKeys.Add("LP1.CycledCount"); m_RtDataKeys.Add("LP1.CycledWafer"); m_RtDataKeys.Add("LP1.CycleSetPoint"); m_RtDataKeys.Add("LP1.Throughput"); m_RtDataKeys.Add("LP2.CycledCount"); m_RtDataKeys.Add("LP2.CycledWafer"); m_RtDataKeys.Add("LP2.CycleSetPoint"); m_RtDataKeys.Add("LP2.Throughput"); m_RtDataKeys.Add("LP3.CycledCount"); m_RtDataKeys.Add("LP3.CycledWafer"); m_RtDataKeys.Add("LP3.CycleSetPoint"); m_RtDataKeys.Add("LP3.Throughput"); m_RtDataKeys.Add("LP1.IsDocked"); m_RtDataKeys.Add("LP2.IsDocked"); m_RtDataKeys.Add("LP3.IsDocked"); } /// /// 更新Wafer情况 /// /// /// private void UPdateWaferAssociation(WaferAssociationInfo info, ControlJobInfo cjInfo) { if (info == null) { return; } if (cjInfo != null) { info.LotId = cjInfo.LotName; info.JobID = cjInfo.Name; info.JobStatus = cjInfo.State.ToString(); if (cjInfo.SequenceNameList != null) { for (int i = 0; i < cjInfo.SequenceNameList.Length; i++) { info.ModuleData.WaferManager.Wafers[24 - i].SequenceName = cjInfo.SequenceNameList[i]; } } } else { if (!string.IsNullOrEmpty(info.JobID)) { info.LotId = ""; info.JobID = ""; info.JobStatus = ""; AssociateSequence(info, false); } } } private void OnLPLoad(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load"); } private void OnLPUnLoad(object obj) { var info = obj as WaferAssociationInfo; var module = info.ModuleData.ModuleID; InvokeClient.Instance.Service.DoOperation($"{module}.Unload"); } private void OnSeqTypeChange(object obj) { var info = obj as WaferAssociationInfo; //获取Sequence列表 List seqitems; switch (info.ModuleData.ModuleID) { case "LP1": info.SequenceType = LP1RecipeMode ? "Production" : "Engineering"; seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType); SequenceSelectedItemsSource1.Clear(); foreach (var seqitem in seqitems) { SequenceSelectedItemsSource1.Add(seqitem); } break; case "LP2": info.SequenceType = LP2RecipeMode ? "Production" : "Engineering"; seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType); SequenceSelectedItemsSource2.Clear(); foreach (var seqitem in seqitems) { SequenceSelectedItemsSource2.Add(seqitem); } break; case "LP3": info.SequenceType = LP3RecipeMode ? "Production" : "Engineering"; seqitems = RecipeClient.Instance.Service.GetSequenceList("seq", info.SequenceType); SequenceSelectedItemsSource3.Clear(); foreach (var seqitem in seqitems) { SequenceSelectedItemsSource3.Add(seqitem); } break; default: break; } } #endregion } }