123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.UI.MVVM;
- using Caliburn.Micro;
- using MECF.Framework.Common.CommonData.Metal;
- using MECF.Framework.Common.CommonData.PlatingCell;
- using MECF.Framework.Common.CommonData.PowerSupplier;
- using MECF.Framework.Common.CommonData.Reservoir;
- using MECF.Framework.Common.CommonData.SRD;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.Common.Persistent.Reservoirs;
- using MECF.Framework.Common.Persistent.SRD;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.ToolLayout;
- using MECF.Framework.Common.Utilities;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms.VisualStyles;
- using System.Windows.Input;
- using System.Windows.Threading;
- namespace PunkHPX8_MainPages.ViewModels
- {
- public class PlatingCellHomePageViewModel : BindableBase
- {
- #region 常量
- private const string PERSISTENT_VALUE = "PersistentValue";
- private const string PLATINGCELLDATA = "PlatingCellData";
- #endregion
- #region 内部变量
- #region Common
- /// <summary>
- /// 模块名称
- /// </summary>
- private string _module;
- /// <summary>
- /// 当前选择Recipe节点
- /// </summary>
- private RecipeNode _selectedRecipeNode;
- /// <summary>
- /// PlatingCellData
- /// </summary>
- private PlatingCellData _platingCellCommonData;
- /// <summary>
- /// ReservoirData
- /// </summary>
- private ReservoirData _reservoirCommonData;
- /// <summary>
- /// Persistent
- /// </summary>
- private PlatingCellPersistentValue _platingCellPersistent;
- /// <summary>
- /// platingCellItem
- /// </summary>
- private PlatingCellItem _metalItem;
- /// <summary>
- /// WaferSize
- /// </summary>
- private int _selectedWaferSize = 0;
- /// <summary>
- /// Wafer Size List
- /// </summary>
- private List<int> _waferSizeList = new List<int>();
- /// <summary>
- /// 页面功能启用
- /// </summary>
- private bool _isEnabled;
- /// <summary>
- /// UI左边部分启用
- /// </summary>
- private bool _isLeftEnabled;
- /// <summary>
- /// AutoMode页面功能启用
- /// </summary>
- private bool _isAutoEnabled;
- /// <summary>
- /// 对应reservoir的name
- /// </summary>
- private string _reservoirName;
- #endregion
-
- /// <summary>
- /// SeqRecipe
- /// </summary>
- private string _seqRecipe;
- #region 系统数据
- /// <summary>
- /// 定时器
- /// </summary>
- DispatcherTimer _timer;
- /// <summary>
- /// 查询后台数据集合
- /// </summary>
- private List<string> _rtDataKeys = new List<string>();
- /// <summary>
- /// rt查询key数值字典
- /// </summary>
- private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
- #endregion
- #region platingCell
- /// <summary>
- /// RecipeContent
- /// </summary>
- private string _recipeContent;
- /// <summary>
- /// TimeRemaining
- /// </summary>
- private double _timeRemaining;
- /// <summary>
- /// OfTotalTime
- /// </summary>
- private double _totalTime;
- /// <summary>
- /// OperatingMode
- /// </summary>
- private string _operatingMode;
- /// <summary>
- /// State
- /// </summary>
- private string _state;
- /// <summary>
- /// RecipeMode
- /// </summary>
- private string _recipeMode;
- #endregion
- #region dep recipe
- /// <summary>
- /// RecipeModuleName
- /// </summary>
- private string _recipeModuleName;
- /// <summary>
- /// RecipeType
- /// </summary>
- private string _recipeType;
- /// <summary>
- /// AchievedRunRecipeCycle
- /// </summary>
- private int _achievedRunRecipeCycle;
- /// <summary>
- /// 当前Recipe
- /// </summary>
- private string _currentRecipe;
- /// <summary>
- /// 当前Recipe的化学液
- /// </summary>
- private string _chemistry;
- #endregion
- #region UI Related
- /// <summary>
- /// IsErrorState
- /// </summary>
- private bool _isErrorState;
- #endregion
- #region PowerSupplier
- /// <summary>
- /// PowerSuplier数据
- /// </summary>
- private PowerSupplierData _powerSupplierData;
- #endregion
- #region 属性
- #region Common
- /// <summary>
- /// PlatingCellData
- /// </summary>
- public PlatingCellData PlatingCellCommonData
- {
- get { return _platingCellCommonData; }
- set { SetProperty(ref _platingCellCommonData, value); }
-
- }
- /// <summary>
- /// PlatingCellData
- /// </summary>
- public ReservoirData ReservoirCommonData
- {
- get { return _reservoirCommonData; }
- set { SetProperty(ref _reservoirCommonData, value); }
- }
- /// <summary>
- /// Persistent
- /// </summary>
- public PlatingCellPersistentValue PlatingCellPersistent
- {
- get { return _platingCellPersistent; }
- set { SetProperty(ref _platingCellPersistent, value); }
- }
- /// <summary>
- /// 模块名称
- /// </summary>
- public string Module
- {
- get { return _module; }
- set { SetProperty(ref _module, value); }
- }
- /// <summary>
- /// 当前选择Recipe节点
- /// </summary>
- public RecipeNode SelectedRecipeNode
- {
- get { return _selectedRecipeNode; }
- set { SetProperty(ref _selectedRecipeNode, value); }
- }
- /// <summary>
- /// WaferSize
- /// </summary>
- public int SelectedWaferSize
- {
- get { return _selectedWaferSize; }
- set { SetProperty(ref _selectedWaferSize, value); }
- }
- /// <summary>
- /// WaferSizeList
- /// </summary>
- public List<int> WaferSizeList
- {
- get { return _waferSizeList; }
- set { SetProperty(ref _waferSizeList, value); }
- }
- /// <summary>
- /// 页面功能启用
- /// </summary>
- public bool IsEnabled
- {
- get { return _isEnabled; }
- set { SetProperty(ref _isEnabled, value); }
- }
- /// <summary>
- /// 页面ui左边功能启用
- /// </summary>
- public bool IsLeftEnabled
- {
- get { return _isLeftEnabled; }
- set { SetProperty(ref _isLeftEnabled, value); }
- }
- /// <summary>
- /// AutoMode页面功能启用
- /// </summary>
- public bool IsAutoEnabled
- {
- get { return _isAutoEnabled; }
- set { SetProperty(ref _isAutoEnabled, value); }
- }
- /// <summary>
- /// Reservoir Name
- /// </summary>
- public string ReservoirName
- {
- get { return _reservoirName; }
- set { SetProperty(ref _reservoirName, value); }
- }
- #endregion
- /// SeqRecipe
- /// </summary>
- public string SeqRecipe
- {
- get { return _seqRecipe; }
- set { SetProperty(ref _seqRecipe, value); }
- }
- #region PlatingCell
- /// <summary>
- /// RecipeContent
- /// </summary>
- public string RecipeContent
- {
- get { return _recipeContent; }
- set { SetProperty(ref _recipeContent, value); }
- }
- /// <summary>
- /// TimeRemaining
- /// </summary>
- public double TimeRemaining
- {
- get { return _timeRemaining; }
- set { SetProperty(ref _timeRemaining, value); }
- }
- /// <summary>
- /// TotalTime
- /// </summary>
- public double TotalTime
- {
- get { return _totalTime; }
- set { SetProperty(ref _totalTime, value); }
- }
- /// <summary>
- /// OperatingMode
- /// </summary>
- public string OperatingMode
- {
- get { return _operatingMode; }
- set { SetProperty(ref _operatingMode, value); }
- }
- /// <summary>
- /// State
- /// </summary>
- public string State
- {
- get { return _state; }
- set { SetProperty(ref _state, value); }
- }
- /// <summary>
- /// RecipeMode
- /// </summary>
- public string RecipeMode
- {
- get { return _recipeMode; }
- set { SetProperty(ref _recipeMode, value); }
- }
- #endregion
- #region Metal recipe
- /// <summary>
- /// RecipeModuleName
- /// </summary>
- public string RecipeModuleName
- {
- get { return _recipeModuleName; }
- set { SetProperty(ref _recipeModuleName, value); }
- }
- /// <summary>
- /// RecipeType
- /// </summary>
- public string RecipeType
- {
- get { return _recipeType; }
- set { SetProperty(ref _recipeType, value); }
- }
- /// <summary>
- /// Run Recipe已经完成的次数
- /// </summary>
- public int AchievedRunRecipeCycle
- {
- get { return _achievedRunRecipeCycle; }
- set { SetProperty(ref _achievedRunRecipeCycle, value); }
- }
- /// <summary>
- /// 当前Recipe
- /// </summary>
- public string CurrentRecipe
- {
- get { return _currentRecipe; }
- set { SetProperty(ref _currentRecipe, value); }
- }
- /// <summary>
- /// 当前Recipe
- /// </summary>
- public string Chemistry
- {
- get { return _chemistry; }
- set { SetProperty(ref _chemistry, value); }
- }
- #endregion
- #region UI Related
- /// <summary>
- /// IsErrorState
- /// </summary>
- public bool IsErrorState
- {
- get { return _isErrorState; }
- set { SetProperty(ref _isErrorState, value); }
- }
- #endregion
- /// <summary>
- /// SidA PowerSuplier数据
- /// </summary>
- public PowerSupplierData PowerSupplierData
- {
- get { return _powerSupplierData; }
- set { SetProperty(ref _powerSupplierData, value); }
- }
- #endregion
-
- #endregion
- #region Command指令
- public ICommand InitializeCommand { get; set; }
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- public PlatingCellHomePageViewModel()
- {
- InitializeCommand = new DelegateCommand<object>(InitializeAction);
- WaferSizeList.Add((int)WaferSize.WS6);
- WaferSizeList.Add((int)WaferSize.WS8);
- WaferSizeList.Add((int)WaferSize.WS12);
- }
- /// <summary>
- /// 加载数据
- /// </summary>
- public void LoadData(string systemName)
- {
- Module = systemName;
- if (!String.IsNullOrEmpty(Module) && ("PlatingCell1".Equals(Module) || "PlatingCell3".Equals(Module)))
- {
- IsLeftEnabled = true;
- }
- else
- {
- IsLeftEnabled= false;
- }
- RecipeModuleName = "DEP Recipe";
- RecipeType = "dep";
- _rtDataKeys.Clear();
- _rtDataKeys.Add($"{Module}.FsmState");
- _rtDataKeys.Add($"{Module}.{PERSISTENT_VALUE}");
- _rtDataKeys.Add($"{Module}.CurrentRecipe");
- _rtDataKeys.Add($"{Module}.TotalTime");
- _rtDataKeys.Add($"{Module}.TimeRemain");
- _rtDataKeys.Add($"{Module}.{PLATINGCELLDATA}");
- _rtDataKeys.Add($"{Module}.ReservoirCommonData");
- _rtDataKeys.Add($"{Module}.ReservoirName");
- _rtDataKeys.Add($"{Module}.Chemistry");
- if (_timer == null)
- {
- _timer = new DispatcherTimer();
- _timer.Interval = TimeSpan.FromMilliseconds(200);
- _timer.Tick += Timer_Tick;
- }
- _timer.Start();
- }
- /// <summary>
- /// 定时器执行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Timer_Tick(object sender, EventArgs e)
- {
- if (_rtDataKeys.Count != 0)
- {
- _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
- if (_rtDataValueDic != null)
- {
- PlatingCellPersistent = CommonFunction.GetValue<PlatingCellPersistentValue>(_rtDataValueDic, $"{Module}.{PERSISTENT_VALUE}");
- State = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.FsmState");
- CurrentRecipe = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.CurrentRecipe");
- TotalTime = CommonFunction.GetValue<int>(_rtDataValueDic, $"{Module}.TotalTime");
- TimeRemaining = CommonFunction.GetValue<int>(_rtDataValueDic, $"{Module}.TimeRemain");
- PlatingCellCommonData = CommonFunction.GetValue<PlatingCellData>(_rtDataValueDic, $"{Module}.{PLATINGCELLDATA}");
- ReservoirCommonData = CommonFunction.GetValue<ReservoirData>(_rtDataValueDic, $"{Module}.ReservoirCommonData");
- Chemistry = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.Chemistry");
- ReservoirName = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.ReservoirName");
- }
- }
- }
- /// <summary>
- /// 隐藏
- /// </summary>
- public void Hide()
- {
- if (_timer != null)
- {
- _timer.Stop();
- }
- }
- /// <summary>
- /// Initialize Action
- /// </summary>
- /// <param name="param"></param>
- private void InitializeAction(object param)
- {
- InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
- }
- }
- }
|