|
@@ -1,14 +1,17 @@
|
|
|
using Aitex.Core.UI.MVVM;
|
|
|
-using PunkHPX8_Core;
|
|
|
-using PunkHPX8_MainPages.Roles;
|
|
|
-using PunkHPX8_MainPages.Views;
|
|
|
+using Aitex.Sorter.Common;
|
|
|
+using MECF.Framework.Common.CommonData;
|
|
|
using MECF.Framework.Common.ControlDataContext;
|
|
|
using MECF.Framework.Common.DataCenter;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
using MECF.Framework.Common.OperationCenter;
|
|
|
using MECF.Framework.Common.Utilities;
|
|
|
+using Newtonsoft.Json;
|
|
|
using OpenSEMI.ClientBase.Command;
|
|
|
using Prism.Mvvm;
|
|
|
+using PunkHPX8_Core;
|
|
|
+using PunkHPX8_MainPages.Roles;
|
|
|
+using PunkHPX8_MainPages.Views;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
@@ -17,10 +20,9 @@ using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Forms;
|
|
|
+using System.Windows.Forms.VisualStyles;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Threading;
|
|
|
-using MECF.Framework.Common.CommonData;
|
|
|
-using Newtonsoft.Json;
|
|
|
|
|
|
namespace PunkHPX8_MainPages.ViewModels
|
|
|
{
|
|
@@ -29,45 +31,21 @@ namespace PunkHPX8_MainPages.ViewModels
|
|
|
|
|
|
#region 内部变量
|
|
|
/// <summary>
|
|
|
- /// 选择的LP
|
|
|
- /// </summary>
|
|
|
- private ModuleName _selectedLPName = ModuleName.LP1;
|
|
|
- private ModuleName _selectedAlignerName = ModuleName.Aligner1;
|
|
|
- /// <summary>
|
|
|
- /// 选择的Dummy
|
|
|
- /// </summary>
|
|
|
- private ModuleName _selectedDummyName = ModuleName.Dummy1;
|
|
|
- private ModuleName _selectedSrdName = ModuleName.SRD1;
|
|
|
- private ModuleName _selectedPufName = ModuleName.PUF1;
|
|
|
- /// <summary>
|
|
|
/// 输入的Cycle次数
|
|
|
/// </summary>
|
|
|
private int _inPutCycleTimes = 1;
|
|
|
/// <summary>
|
|
|
- /// Align调整角度度数
|
|
|
+ /// Aligner旋转的角度
|
|
|
/// </summary>
|
|
|
- private int _inPutAlignDegree = 0;
|
|
|
+ private int _alignerAngle = 0;
|
|
|
/// <summary>
|
|
|
/// 当前正在执行第几次Cycle
|
|
|
/// </summary>
|
|
|
private int _currentCycle;
|
|
|
/// <summary>
|
|
|
- /// 是否选中dummy
|
|
|
- /// </summary>
|
|
|
- private bool _isDummySelected = false;
|
|
|
- /// <summary>
|
|
|
- /// 是否选中srd
|
|
|
- /// </summary>
|
|
|
- private bool _isSrdSelected = false ;
|
|
|
- /// <summary>
|
|
|
- /// 是否选中puf
|
|
|
+ /// 是否可以输入参数
|
|
|
/// </summary>
|
|
|
- private bool _isPufSelected = false;
|
|
|
-
|
|
|
- private bool _isSrd1Checked = true;
|
|
|
- private bool _isSrd2Checked = false;
|
|
|
- private bool _isDummy1Checked = true;
|
|
|
- private bool _isDummy2Checked = false;
|
|
|
+ private bool _isInputParameterEnable;
|
|
|
#region 系统数据
|
|
|
/// <summary>
|
|
|
/// 定时器
|
|
@@ -85,235 +63,247 @@ namespace PunkHPX8_MainPages.ViewModels
|
|
|
#endregion
|
|
|
|
|
|
#region 属性
|
|
|
- public ModuleName SelectedLPName
|
|
|
- {
|
|
|
- get { return _selectedLPName; }
|
|
|
- set { SetProperty(ref _selectedLPName, value); }
|
|
|
- }
|
|
|
- public ModuleName SelectedAlignerName
|
|
|
- {
|
|
|
- get { return _selectedAlignerName; }
|
|
|
- set { SetProperty(ref _selectedAlignerName, value); }
|
|
|
- }
|
|
|
- public ModuleName SelectedDummyName
|
|
|
- {
|
|
|
- get { return _selectedDummyName; }
|
|
|
- set { SetProperty(ref _selectedDummyName, value); }
|
|
|
- }
|
|
|
- public ModuleName SelectedSrdName
|
|
|
- {
|
|
|
- get { return _selectedSrdName; }
|
|
|
- set { SetProperty(ref _selectedSrdName, value); }
|
|
|
- }
|
|
|
- public ModuleName SelectedPufName
|
|
|
- {
|
|
|
- get { return _selectedPufName; }
|
|
|
- set { SetProperty(ref _selectedPufName, value); }
|
|
|
- }
|
|
|
+
|
|
|
public int InPutCycleTimes
|
|
|
{
|
|
|
get { return _inPutCycleTimes; }
|
|
|
set { SetProperty(ref _inPutCycleTimes, value); }
|
|
|
}
|
|
|
+ public int AlignerAngle
|
|
|
+ {
|
|
|
+ get { return _alignerAngle; }
|
|
|
+ set { SetProperty(ref _alignerAngle, value); }
|
|
|
+ }
|
|
|
public int CurrentCycle
|
|
|
{
|
|
|
get { return _currentCycle; }
|
|
|
set { SetProperty(ref _currentCycle, value); }
|
|
|
}
|
|
|
- public int InPutAlignDegree
|
|
|
+ public bool IsInputParameterEnable
|
|
|
{
|
|
|
- get { return _inPutAlignDegree; }
|
|
|
- set { SetProperty(ref _inPutAlignDegree, value); }
|
|
|
+ get { return _isInputParameterEnable; }
|
|
|
+ set { SetProperty(ref _isInputParameterEnable, value); }
|
|
|
}
|
|
|
|
|
|
- public bool IsDummySelected
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ public class PositionItem
|
|
|
{
|
|
|
- get { return _isDummySelected; }
|
|
|
- set { SetProperty(ref _isDummySelected, value); }
|
|
|
+ public string ModuleType { get; set; }
|
|
|
+ public ModuleName ModuleName { get; set; }
|
|
|
+ public string Parameter { get; set; }
|
|
|
+ public Hand RobotHand { get; set; }
|
|
|
+ public Flip RobotFlip { get; set; }
|
|
|
}
|
|
|
- public bool IsSrdSelected
|
|
|
+
|
|
|
+ private ObservableCollection<PositionItem> _positions = new ObservableCollection<PositionItem>();
|
|
|
+ public ObservableCollection<PositionItem> Positions
|
|
|
{
|
|
|
- get { return _isSrdSelected; }
|
|
|
- set { SetProperty(ref _isSrdSelected, value); }
|
|
|
+ get { return _positions; }
|
|
|
+ set { SetProperty(ref _positions, value); }
|
|
|
}
|
|
|
- public bool IsPufSelected
|
|
|
+
|
|
|
+ public ObservableCollection<string> PositionTypes { get; } = new ObservableCollection<string>
|
|
|
+ {
|
|
|
+ "LP", "Aligner", "Dummy", "SRD", "VPW","PlatingCell"
|
|
|
+ };
|
|
|
+
|
|
|
+ public ObservableCollection<string> HandsTypes { get; } = new ObservableCollection<string>
|
|
|
{
|
|
|
- get { return _isPufSelected; }
|
|
|
- set { SetProperty(ref _isPufSelected, value); }
|
|
|
+ "Blade1", "Blade2"
|
|
|
+ };
|
|
|
+ public ObservableCollection<string> FlipTypes { get; } = new ObservableCollection<string>
|
|
|
+ {
|
|
|
+ "NoFlip", "Flip"
|
|
|
+ };
|
|
|
+
|
|
|
+ private string _selectedPositionType;
|
|
|
+ public string SelectedPositionType
|
|
|
+ {
|
|
|
+ get { return _selectedPositionType; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _selectedPositionType, value);
|
|
|
+ UpdateAvailableSelections();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public bool IsSrd1Checkd
|
|
|
+ public ObservableCollection<ModuleName> AvailableSelections { get; } = new ObservableCollection<ModuleName>();
|
|
|
+
|
|
|
+ private ModuleName _selectedSelection;
|
|
|
+ public ModuleName SelectedSelection
|
|
|
{
|
|
|
- get { return _isSrd1Checked; }
|
|
|
- set { SetProperty(ref _isSrd1Checked, value); }
|
|
|
+ get { return _selectedSelection; }
|
|
|
+ set { SetProperty(ref _selectedSelection, value); }
|
|
|
}
|
|
|
- public bool IsSrd2Checkd
|
|
|
+
|
|
|
+ private string _parameter;
|
|
|
+ public string Parameter
|
|
|
{
|
|
|
- get { return _isSrd2Checked; }
|
|
|
- set { SetProperty(ref _isSrd2Checked, value); }
|
|
|
+ get { return _parameter; }
|
|
|
+ set { SetProperty(ref _parameter, value); }
|
|
|
}
|
|
|
- public bool IsDummy1Checkd
|
|
|
+
|
|
|
+ private Hand _robotHand;
|
|
|
+ public Hand RobotHand
|
|
|
{
|
|
|
- get { return _isDummy1Checked; }
|
|
|
- set { SetProperty(ref _isDummy1Checked, value); }
|
|
|
+ get { return _robotHand; }
|
|
|
+ set { SetProperty(ref _robotHand, value); }
|
|
|
}
|
|
|
- public bool IsDummy2Checkd
|
|
|
+
|
|
|
+ private Flip _robotFlip;
|
|
|
+ public Flip RobotFlip
|
|
|
{
|
|
|
- get { return _isDummy2Checked; }
|
|
|
- set { SetProperty(ref _isDummy2Checked, value); }
|
|
|
+ get { return _robotFlip; }
|
|
|
+ set { SetProperty(ref _robotFlip, value); }
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
#region 命令
|
|
|
|
|
|
public ICommand RobotCycleStartCommand { get; set; }
|
|
|
-
|
|
|
+
|
|
|
public ICommand RobotCycleAbortCommand { get; set; }
|
|
|
|
|
|
- public ICommand LPChangeCommand { get; set; }
|
|
|
-
|
|
|
- public ICommand AlignerChangeCommand { get; set; }
|
|
|
-
|
|
|
- public ICommand PufChangeCommand { get; set; }
|
|
|
-
|
|
|
- public ICommand DummyChangeCommand { get; set; }
|
|
|
-
|
|
|
- public ICommand SrdChangeCommand { get; set; }
|
|
|
- #endregion
|
|
|
+ public ICommand AddPositionCommand { get; set; }
|
|
|
+
|
|
|
+ public ICommand MoveUpCommand { get; set; }
|
|
|
+
|
|
|
+ public ICommand MoveDownCommand { get; set; }
|
|
|
|
|
|
+ public ICommand RemoveCommand { get; set; }
|
|
|
+ #endregion
|
|
|
/// <summary>
|
|
|
/// 构造器
|
|
|
/// </summary>
|
|
|
- public RobotCycleViewModel()
|
|
|
+ public RobotCycleViewModel()
|
|
|
{
|
|
|
RobotCycleStartCommand = new DelegateCommand<object>(RobotCycleStartAction);
|
|
|
RobotCycleAbortCommand = new DelegateCommand<object>(RobotCycleAbortAction);
|
|
|
- LPChangeCommand = new DelegateCommand<object>(LPChangeAction);
|
|
|
- AlignerChangeCommand = new DelegateCommand<object>(AlignerChangeAction);
|
|
|
- //PufChangeCommand = new DelegateCommand<object>(PufChangeAction);
|
|
|
- //DummyChangeCommand = new DelegateCommand<object>(DummyChangeAction);
|
|
|
- //SrdChangeCommand = new DelegateCommand<object>(SrdChangeAction);
|
|
|
+
|
|
|
+ AddPositionCommand = new DelegateCommand<object>(AddPosition);
|
|
|
+ MoveUpCommand = new DelegateCommand<object>(MovePositionUp);
|
|
|
+ MoveDownCommand = new DelegateCommand<object>(MovePositionDown);
|
|
|
+ RemoveCommand = new DelegateCommand<object>(RemovePosition);
|
|
|
+ SelectedPositionType = PositionTypes.FirstOrDefault();
|
|
|
+ RobotHand = Hand.Blade1;
|
|
|
+ RobotFlip = Flip.NoFlip;
|
|
|
}
|
|
|
|
|
|
- private void RobotCycleStartAction(object param)
|
|
|
+ private void UpdateAvailableSelections()
|
|
|
{
|
|
|
- if (!IsDummySelected)
|
|
|
+ AvailableSelections.Clear();
|
|
|
+ switch (SelectedPositionType)
|
|
|
{
|
|
|
- SelectedDummyName = ModuleName.Unknown;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (IsDummy1Checkd)
|
|
|
- {
|
|
|
- SelectedDummyName = ModuleName.Dummy1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SelectedDummyName = ModuleName.Dummy2;
|
|
|
- }
|
|
|
+ case "LP":
|
|
|
+ AvailableSelections.Add(ModuleName.LP1);
|
|
|
+ AvailableSelections.Add(ModuleName.LP2);
|
|
|
+ break;
|
|
|
+ case "Aligner":
|
|
|
+ AvailableSelections.Add(ModuleName.Aligner1);
|
|
|
+ Parameter = "0"; // 默认角度
|
|
|
+ break;
|
|
|
+ case "Dummy":
|
|
|
+ AvailableSelections.Add(ModuleName.Dummy1);
|
|
|
+ AvailableSelections.Add(ModuleName.Dummy2);
|
|
|
+ break;
|
|
|
+ case "SRD":
|
|
|
+ AvailableSelections.Add(ModuleName.SRD1);
|
|
|
+ AvailableSelections.Add(ModuleName.SRD2);
|
|
|
+ break;
|
|
|
+ case "VPW":
|
|
|
+ AvailableSelections.Add(ModuleName.VPW1);
|
|
|
+ AvailableSelections.Add(ModuleName.VPW2);
|
|
|
+ break;
|
|
|
+ case "PlatingCell":
|
|
|
+ AvailableSelections.Add(ModuleName.PlatingCell1);
|
|
|
+ AvailableSelections.Add(ModuleName.PlatingCell2);
|
|
|
+ AvailableSelections.Add(ModuleName.PlatingCell3);
|
|
|
+ AvailableSelections.Add(ModuleName.PlatingCell4);
|
|
|
+ break;
|
|
|
}
|
|
|
+ SelectedSelection = AvailableSelections.FirstOrDefault();
|
|
|
+ RobotHand = Hand.Blade1;
|
|
|
+ RobotFlip = Flip.NoFlip;
|
|
|
+ }
|
|
|
|
|
|
- if (!IsSrdSelected)
|
|
|
+ private void AddPosition(object obj)
|
|
|
+ {
|
|
|
+ if ("Aligner".Equals(SelectedPositionType)) //目前就aligner的条目需要参数
|
|
|
{
|
|
|
- SelectedSrdName = ModuleName.Unknown;
|
|
|
+ Positions.Add(new PositionItem
|
|
|
+ {
|
|
|
+ ModuleType = SelectedPositionType,
|
|
|
+ ModuleName = SelectedSelection,
|
|
|
+ Parameter = Parameter,
|
|
|
+ RobotHand = RobotHand,
|
|
|
+ RobotFlip = RobotFlip
|
|
|
+ });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (IsSrd1Checkd)
|
|
|
- {
|
|
|
- SelectedSrdName = ModuleName.SRD1;
|
|
|
- }
|
|
|
- else
|
|
|
+ Positions.Add(new PositionItem
|
|
|
{
|
|
|
- SelectedSrdName = ModuleName.SRD2;
|
|
|
- }
|
|
|
+ ModuleType = SelectedPositionType,
|
|
|
+ ModuleName = SelectedSelection,
|
|
|
+ RobotHand = RobotHand,
|
|
|
+ RobotFlip = RobotFlip
|
|
|
+ });
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- if (!IsPufSelected)
|
|
|
- {
|
|
|
- SelectedPufName = ModuleName.Unknown;
|
|
|
- }
|
|
|
- else
|
|
|
+ private void MovePositionUp(object obj)
|
|
|
+ {
|
|
|
+ if (obj is PositionItem item)
|
|
|
{
|
|
|
- SelectedPufName = ModuleName.PUF1;
|
|
|
+ int index = Positions.IndexOf(item);
|
|
|
+ if (index > 0)
|
|
|
+ {
|
|
|
+ Positions.Move(index, index - 1);
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- if (!IsDummySelected && !IsSrdSelected)
|
|
|
- {
|
|
|
- MessageBox.Show("Selected at least on module between srd and dummy!");
|
|
|
- return;
|
|
|
- }
|
|
|
- List<string> sequences = new List<string>();
|
|
|
- sequences.Add(SelectedLPName.ToString());
|
|
|
- sequences.Add(SelectedAlignerName.ToString());
|
|
|
- if (SelectedPufName != ModuleName.Unknown)
|
|
|
- {
|
|
|
- sequences.Add(SelectedPufName.ToString());
|
|
|
- }
|
|
|
- if (SelectedSrdName != ModuleName.Unknown)
|
|
|
- {
|
|
|
- sequences.Add(SelectedSrdName.ToString());
|
|
|
- }
|
|
|
- if (SelectedDummyName != ModuleName.Unknown)
|
|
|
+ private void MovePositionDown(object obj)
|
|
|
+ {
|
|
|
+ if (obj is PositionItem item)
|
|
|
{
|
|
|
- sequences.Add(SelectedDummyName.ToString());
|
|
|
+ int index = Positions.IndexOf(item);
|
|
|
+ if (index < Positions.Count - 1)
|
|
|
+ {
|
|
|
+ Positions.Move(index, index + 1);
|
|
|
+ }
|
|
|
}
|
|
|
- List<RobotCycleParameter> parameters = new List<RobotCycleParameter>();
|
|
|
- RobotCycleParameter lpParameter = new RobotCycleParameter();
|
|
|
- lpParameter.ModuleName = SelectedLPName;
|
|
|
- parameters.Add(lpParameter);
|
|
|
- InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.RobotCycle}",JsonConvert.SerializeObject(parameters), InPutCycleTimes, InPutAlignDegree);
|
|
|
}
|
|
|
- private void RobotCycleAbortAction(object param)
|
|
|
- {
|
|
|
- InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
|
|
|
- }
|
|
|
- private void LPChangeAction(object param)
|
|
|
+
|
|
|
+ private void RemovePosition(object obj)
|
|
|
{
|
|
|
- if ("LP1".Equals((string)param))
|
|
|
+ if (obj is PositionItem item)
|
|
|
{
|
|
|
- SelectedLPName = ModuleName.LP1;
|
|
|
+ Positions.Remove(item);
|
|
|
}
|
|
|
- else if ("LP2".Equals((string)param))
|
|
|
- {
|
|
|
- SelectedLPName = ModuleName.LP2;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SelectedLPName = ModuleName.LP3;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- private void AlignerChangeAction(object param)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- private void PufChangeAction(object param)
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
- private void DummyChangeAction(object param)
|
|
|
+
|
|
|
+
|
|
|
+ private void RobotCycleStartAction(object param)
|
|
|
{
|
|
|
- if ("Dummy1".Equals((string)param))
|
|
|
- {
|
|
|
- SelectedDummyName = ModuleName.Dummy1;
|
|
|
- }
|
|
|
- else
|
|
|
+ List<RobotCycleParameter> parameters = new List<RobotCycleParameter>();
|
|
|
+ foreach(var parameter in Positions)
|
|
|
{
|
|
|
- SelectedDummyName = ModuleName.Dummy2;
|
|
|
+ RobotCycleParameter robotCycleParameter = new RobotCycleParameter();
|
|
|
+ robotCycleParameter.ModuleName = parameter.ModuleName;
|
|
|
+ robotCycleParameter.RobotArm = parameter.RobotHand;
|
|
|
+ robotCycleParameter.RobotFlip = parameter.RobotFlip;
|
|
|
+ robotCycleParameter.Parameter = parameter.Parameter;
|
|
|
+ parameters.Add(robotCycleParameter);
|
|
|
}
|
|
|
+ InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.RobotCycle}", JsonConvert.SerializeObject(parameters), InPutCycleTimes);
|
|
|
}
|
|
|
- private void SrdChangeAction(object param)
|
|
|
+ private void RobotCycleAbortAction(object param)
|
|
|
{
|
|
|
- if ("SRD1".Equals((string)param))
|
|
|
- {
|
|
|
- SelectedSrdName = ModuleName.SRD1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SelectedSrdName = ModuleName.SRD2;
|
|
|
- }
|
|
|
+ InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -341,6 +331,10 @@ namespace PunkHPX8_MainPages.ViewModels
|
|
|
{
|
|
|
if (_rtDataKeys.Count != 0)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+ IsInputParameterEnable = "Aligner".Equals(SelectedPositionType) ? true : false;
|
|
|
+
|
|
|
_rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
|
|
|
if (_rtDataValueDic != null)
|
|
|
{
|