using Aitex.Core.Common;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.DBCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.Common.WaferHolder;
using OpenSEMI.ClientBase;
using CyberX8_MainPages.Model;
using Prism.Common;
using Prism.Mvvm;
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.Input;
using Unity;
using WPF.Themes.UserControls;
using MECF.Framework.Common.Layout;
using MECF.Framework.Common.Utilities;
using Aitex.Core.UI.ControlDataContext;
using System.Reflection;
using System.Windows.Threading;
using Aitex.Core.Util;
using Aitex.Core.RT.Log;
namespace CyberX8_MainPages.ViewModels
{
public class WaferHolderViewModel : BindableBase
{
#region 局部变量
///
/// buffer数据
///
private ObservableCollection _bufferDatas = null;
///
/// 未使用的载具
///
private ObservableCollection _unusedWaferHoders = null;
///
/// 选择数据
///
private WaferHolderBufferData _selectedBufferData = null;
///
/// 选择未使用数据
///
private WaferHolderInfo _selectedUnusedWaferHolderInfo = null;
///
/// csr 类型集合
///
private List _crsTypeLst = null;
///
/// Wafer尺寸集合
///
private List _waferSizeLst = null;
///
/// 临时数据
///
private WaferHolderBufferData _tmpWaferHolderBufferData = null;
///
/// 化学液集合
///
private List _chemistryLst = null;
///
/// Location位置集合
///
private List _locationLst = new List();
///
/// Reservoir集合
///
private List _reservoirLst = new List();
///
/// 是否编辑
///
private bool _isEdit = false;
///
/// 是否编辑Current Location
///
private bool _isLocationEdit = false;
///
/// 是否启用SaveandCancel按钮
///
private bool _isSaveandCancelEdit = false;
///
/// 操作
///
///
/// 操作
///
private string operation = "";
///
/// 是否编辑载具Id
///
private bool _isEditWaferHolderId = false;
///
/// 定时器
///
DispatcherTimer _timer;
///
/// 查询后台数据集合
///
private List _rtDataKeys = new List();
///
/// rt查询key数值字典
///
private Dictionary _rtDataValueDic = new Dictionary();
///
/// ProcessTransporter是否Busy
///
private bool _isProcessTransBusy;
///
/// LoaderTransporter是否Busy
///
private bool _isLoaderTransBusy;
///
/// 是否在Auto模式下
///
private bool _isAutoMode;
#endregion
#region 属性
public List CrsTypeLst
{
get { return _crsTypeLst; }
set { SetProperty(ref _crsTypeLst, value); }
}
public List WaferSizeLst
{
get { return _waferSizeLst; }
set { SetProperty(ref _waferSizeLst, value); }
}
public List ChemistryLst
{
get { return _chemistryLst; }
set { SetProperty(ref _chemistryLst, value); }
}
///
/// Location位置集合
///
public List LocationLst
{
get { return _locationLst; }
set { SetProperty(ref _locationLst, value); }
}
public ObservableCollection BufferDatas
{
get { return _bufferDatas; }
set
{
SetProperty(ref _bufferDatas, value);
}
}
///
/// 未使用载具
///
public ObservableCollection UnusedWaferHolders
{
get { return _unusedWaferHoders; }
set
{
SetProperty(ref _unusedWaferHoders, value);
}
}
///
/// 选择
///
public WaferHolderBufferData SelectedBufferData
{
get { return _selectedBufferData; }
set
{
if(_selectedBufferData==null||(value!=null&&value.Id!=_selectedBufferData.Id))
{
BufferDataSelectedChanged(value);
}
SetProperty(ref _selectedBufferData, value);
}
}
///
/// 选择未使用的载具
///
public WaferHolderInfo SelectedUnusedWaferHolderInfo
{
get { return _selectedUnusedWaferHolderInfo; }
set
{
SetProperty(ref _selectedUnusedWaferHolderInfo, value);
}
}
///
/// 临时数据
///
public WaferHolderBufferData TmpBufferData
{
get { return _tmpWaferHolderBufferData; }
set { SetProperty(ref _tmpWaferHolderBufferData, value); }
}
///
/// 是否编辑
///
public bool IsEdit
{
get { return _isEdit; }
set
{
if(!value)
{
IsEditWaferHolderId = false;
}
SetProperty(ref _isEdit, value);
}
}
///
/// 是否编辑Current Location
///
public bool IsLocationEdit
{
get { return _isLocationEdit; }
set
{
SetProperty(ref _isLocationEdit, value);
}
}
///
/// 是否启用Save和Cancel
///
public bool IsSaveandCancelEdit
{
get { return _isSaveandCancelEdit; }
set
{
SetProperty(ref _isSaveandCancelEdit, value);
}
}
///
/// 是否编辑载具Id
///
public bool IsEditWaferHolderId
{
get { return _isEditWaferHolderId; }
set { SetProperty(ref _isEditWaferHolderId, value); }
}
#endregion
#region 按钮事件
[IgnorePropertyChange]
public ICommand EnableCommand
{
get;
private set;
}
[IgnorePropertyChange]
public ICommand DisableCommand
{
get;
private set;
}
///
/// 增加
///
public ICommand AddCommand
{ get; private set; }
///
/// 编辑
///
public ICommand EditCommand
{ get; private set; }
///
/// 保存
///
public ICommand SaveCommand { get; private set; }
///
/// 取消
///
public ICommand CancelCommand { get; private set; }
///
/// 移至Loader
///
public ICommand MoveToLoaderCommand { get; private set; }
///
/// 移出Loader
///
public ICommand MoveFromLoaderCommand { get; private set; }
///
/// 移除
///
public ICommand RemoveCommand { get; private set; }
///
/// MoveLocation
///
public ICommand MoveLocationCommand { get; private set; }
#endregion
///
/// 构造函数
///
public WaferHolderViewModel()
{
EnableCommand = new DelegateCommand