using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using MECF.Framework.Common.OperationCenter;
using Prism.Mvvm;
using Prism.Commands;
using Aitex.Core.RT.DataCenter;
using MECF.Framework.Common.CommonData.PUF;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Utilities;
using MECF.Framework.Common.RecipeCenter;
using System.Collections.ObjectModel;
using CyberX8_MainPages.PMs;
using Aitex.Core.Utilities;
using CyberX8_Core;
using System.Windows.Documents;
using System.Windows;
using MECF.Framework.Common.WaferHolder;
using MECF.Framework.Common.CommonData.Prewet;
using MECF.Framework.Common.Persistent.Prewet;
using MECF.Framework.Common.Device.LinMot;
using Aitex.Core.RT.RecipeCenter;
using MECF.Framework.Common.Device.ResistivityProbe;
using MECF.Framework.Common.Equipment;
namespace CyberX8_MainPages.ViewModels
{
internal class PrewetHomePageViewModel : BindableBase
{
#region 常量
private const string PUMP_DATA = "PumpData";
private const string PWT = "pwt";
private const string PERSISTENT_VALUE = "PersistentValue";
#endregion
#region 内部变量
#region Common
///
/// 模块名称
///
private string _module;
///
/// StateMachine
///
private string _stateMachine;
///
/// Status
///
private string _status;
///
/// 数据
///
private PrewetPumpData _prewetPumpData;
///
/// Threshold
///
private PrewetPersistentValue _prewetPersistent;
///
/// KepWetLimitTime
///
private int _keepWetLimitTime;
///
/// 当前选择Recipe节点
///
private RecipeNode _selectedRecipeNode;
///
/// 选中的Recipe文件的Linmot扫描次数
///
private int _numberOfRecipeScans;
///
/// Linmot RunRecipeTotalScanComplete
///
private int _scanComplete;
///
/// 是否是Manual模式
///
private bool _isManualOperationMode;
#endregion
#region Motion
///
/// 当前位置
///
private double _linmotCurrentPosition;
///
/// Linmot ScanCount
///
private int _scanCount;
///
/// Linmot StatusWord
///
private short _statusWord;
///
/// UpMaxSpeed
///
private double _upMaxSpeed;
///
/// LinmotDeviceData
///
private LinMotDeviceData _linMotDeviceData;
///
/// LinmotName
///
private string _linmotName;
#endregion
#region UI
///
/// Linmot UI Y轴位置
///
private double _uiLinmotYPosition = 60.0;
///
/// IsErrorState 用于腔体变红
///
private bool _isErrorState;
///
/// 页面功能启用
///
private bool _isEnabled;
///
/// AutoMode页面功能启用
///
private bool _isAutoEnabled;
///
/// 是否存在WaferHolder
///
private bool _isWaferHolder;
#endregion
#region Wafer Holder
///
/// Wafer Holder属性
///
private WaferHolderInfo _waferHolderInfo;
///
/// SeqRecipe
///
private string _seqRecipe;
#endregion
#region 系统数据
///
/// 定时器
///
DispatcherTimer _timer;
///
/// 查询后台数据集合
///
private List _rtDataKeys = new List();
///
/// rt查询key数值字典
///
private Dictionary _rtDataValueDic = new Dictionary();
#endregion
#region PreWet1
///
/// RecipeContent
///
private string _recipeContent;
///
/// TimeRemaining
///
private int _timeRemaining;
///
/// OfTotalTime
///
private int _totalTime;
///
/// OperatingMode
///
private string _operatingMode;
///
/// State Machine
///
private string _state;
///
/// RecipeMode
///
private string _recipeMode;
#endregion
#region PWT recipe
///
/// RecipeModuleName
///
private string _recipeModuleName;
///
/// RecipeType
///
private string _recipeType;
///
/// AchievedRunRecipeCycle
///
private int _achievedRunRecipeCycle;
///
/// 当前Recipe
///
private string _currentRecipe;
#endregion
#endregion
#region 属性
#region Common
///
/// 模块名称
///
public string Module { get { return _module; } set { SetProperty(ref _module, value); } }
///
/// StateMachine
///
public string StateMachine { get { return _stateMachine; } set { SetProperty(ref _stateMachine, value); } }
///
/// Status
///
public string Status { get { return _status; } set { SetProperty(ref _status, value); } }
///
/// Commondata
///
public PrewetPumpData PrewetPumpData
{
get { return _prewetPumpData; }
set { SetProperty(ref _prewetPumpData, value); }
}
///
/// KeepWetLimitTime
///
public int KeepWetLimitTime { get { return _keepWetLimitTime; } set { SetProperty(ref _keepWetLimitTime, value); } }
///
/// 选中的Recipe文件的Linmot扫描次数
///
public int NumberOfRecipeScans { get { return _numberOfRecipeScans; } set { SetProperty(ref _numberOfRecipeScans, value); } }
///
/// Linmot RunRecipeTotalScanComplete
///
public int ScanComplete { get { return _scanComplete; } set { SetProperty(ref _scanComplete, value); } }
///
/// Threshold
///
public PrewetPersistentValue PrewetPersistent
{
get { return _prewetPersistent; }
set { SetProperty(ref _prewetPersistent, value); }
}
public RecipeNode SelectedRecipeNode
{
get { return _selectedRecipeNode; }
set { SetProperty(ref _selectedRecipeNode, value); }
}
///
/// 是否是Manual模式
///
public bool IsManualOperationMode { get { return _isManualOperationMode; } set { SetProperty(ref _isManualOperationMode, value); } }
#endregion
#region Motion
///
/// 当前位置
///
public double LinmotCurrentPosition { get { return _linmotCurrentPosition; } set { SetProperty(ref _linmotCurrentPosition, value); } }
///
/// Linmot Scan次数
///
public int ScanCount { get { return _scanCount; } set { SetProperty(ref _scanCount, value); } }
///
/// Linmot StatusWord
///
public short StatusWord { get { return _statusWord; } set { SetProperty(ref _statusWord, value); } }
///
/// LinMotDeviceData
///
public LinMotDeviceData LinmotDeviceCommonData { get { return _linMotDeviceData; } set { SetProperty(ref _linMotDeviceData, value); } }
///
/// UpMaxSpeed
///
public double UpMaxSpeed { get { return _upMaxSpeed; } set { SetProperty(ref _upMaxSpeed, value); } }
///
/// LinmotName
///
public string LinmotName { get { return _linmotName; } set { SetProperty(ref _linmotName, value); } }
#endregion
#region UI
///
/// Linmot UI Y轴位置
///
public double UILinmotYPosition { get { return _uiLinmotYPosition; } set { SetProperty(ref _uiLinmotYPosition, value); } }
///
/// IsErrorState
///
public bool IsErrorState { get { return _isErrorState; } set { SetProperty(ref _isErrorState, value); } }
///
/// 页面功能启用
///
public bool IsEnabled
{
get { return _isEnabled; }
set { SetProperty(ref _isEnabled, value); }
}
///
/// AutoMode页面功能启用
///
public bool IsAutoEnabled
{
get { return _isAutoEnabled; }
set { SetProperty(ref _isAutoEnabled, value); }
}
///
/// 是否存在WaferHolder
///
public bool IsWaferHolder { get { return _isWaferHolder; } set { SetProperty(ref _isWaferHolder, value); } }
#endregion
#region Prewet1
///
/// RecipeContent
///
public string RecipeContent
{
get { return _recipeContent; }
set { SetProperty(ref _recipeContent, value); }
}
///
/// TimeRemaining
///
public int TimeRemaining
{
get { return _timeRemaining; }
set { SetProperty(ref _timeRemaining, value); }
}
///
/// TotalTime
///
public int TotalTime
{
get { return _totalTime; }
set { SetProperty(ref _totalTime, value); }
}
///
/// OperatingMode
///
public string OperatingMode
{
get { return _operatingMode; }
set { SetProperty(ref _operatingMode, value); }
}
///
/// State
///
public string State
{
get { return _state; }
set { SetProperty(ref _state, value); }
}
///
/// RecipeMode
///
public string RecipeMode
{
get { return _recipeMode; }
set { SetProperty(ref _recipeMode, value); }
}
#endregion
#region PWT recipe
///
/// RecipeModuleName
///
public string RecipeModuleName
{
get { return _recipeModuleName; }
set { SetProperty(ref _recipeModuleName, value); }
}
///
/// RecipeType
///
public string RecipeType
{
get { return _recipeType; }
set { SetProperty(ref _recipeType, value); }
}
public int AchievedRunRecipeCycle
{
get { return _achievedRunRecipeCycle; }
set { SetProperty(ref _achievedRunRecipeCycle, value); }
}
///
/// 当前运行的Recipe
///
public string CurrentRecipe
{
get { return _currentRecipe; }
set { SetProperty(ref _currentRecipe, value); }
}
#endregion
#region Wafer Holder
///
/// Wafer Holder属性
///
public WaferHolderInfo WaferHolderInfo { get { return _waferHolderInfo; } set { SetProperty(ref _waferHolderInfo, value); } }
///
/// SeqRecipe
///
public string SeqRecipe
{
get { return _seqRecipe; }
set { SetProperty(ref _seqRecipe, value); }
}
#endregion
#endregion
#region Command指令
public ICommand InitializeCommand { get; set; }
#endregion
///
/// 构造函数
///
public PrewetHomePageViewModel()
{
InitializeCommand = new DelegateCommand