using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.Common;
using Aitex.Core.UI.MVVM;
using Aitex.Core.UI.View.Common;
using Aitex.Core.Util;
using Aitex.Sorter.Common;
using Aitex.Sorter.UI.Controls;
using Aitex.Sorter.UI.Controls.Common;
using Aitex.Sorter.UI.ViewModel.Maintenance;
using EfemUI.Controls;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
namespace EfemUI.Views.Maintenance
{
///
/// RobotView.xaml 的交互逻辑
///
public partial class RobotView : UserControl, IBaseView
{
private RobotViewModel robotViewModel;
public RobotView()
{
InitializeComponent();
robotViewModel = new RobotViewModel2();
//efem.SubscribeKeys(robotViewModel);
//robotControl.Hands = new Hand[] { Hand.Blade1, Hand.Blade2 };
//robotControl.SubscribeKeys(robotViewModel);
DataContext = robotViewModel;
IsVisibleChanged += Robot_IsVisibleChanged;
}
private void Robot_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
robotViewModel.EnableTimer(IsVisible);
}
}
public class RobotViewModel2 : RobotViewModel
{
public bool EnablePageControl
{
get { return !IsOnlineMode; }
}
[Subscription("System.Robot.ReadCassetNumber")]
public string ReadCassetNumber { get; set; }
[Subscription("System.Robot.ReadSlotNumber")]
public string ReadSlotNumber { get; set; }
[Subscription("System.Robot.ReadBankNumber")]
public string ReadBankNumber { get; set; }
[Subscription("System.Robot.MappingFirstSlotPosition")]
public string MappingFirstSlotPosition { get; set; }
[Subscription("System.Robot.MappingGateWidth")]
public string MappingGateWidth { get; set; }
[Subscription("System.Robot.MappingMaxDetectWidth")]
public string MappingMaxDetectWidth { get; set; }
[Subscription("System.Robot.MappingMinDetectWidth")]
public string MappingMinDetectWidth { get; set; }
[Subscription("System.Robot.MappingSlotsNumber")]
public string MappingSlotsNumber { get; set; }
[Subscription("System.Robot.MappingSpeed")]
public string MappingSpeed { get; set; }
[Subscription("System.Robot.MappingStopPostion")]
public string MappingStopPostion { get; set; }
[Subscription("System.Robot.MappingTopSlotPostion")]
public string MappingTopSlotPostion { get; set; }
[Subscription("System.Robot.IsMappingSensorON")]
public string IsMappingSensorON { get; set; }
[Subscription("System.Robot.MappingWaferResult")]
public string MappingWaferResult { get; set; }
[Subscription("System.Robot.MappingWidthResult")]
public string MappingWidthResult { get; set; }
[Subscription("System.Robot.ReadParameterMax")]
public string ReadParameterMax { get; set; }
[Subscription("System.Robot.ReadParameterMin")]
public string ReadParameterMin { get; set; }
[Subscription("System.Robot.ReadParameterValue")]
public string ReadParameterValue { get; set; }
[Subscription("System.Robot.CurrentReadRoutine")]
public string CurrentReadRoutine { get; set; }
//[Subscription("System.Robot.CurrentReadSpeedData")]
//public int CurrentReadSpeedData { get; set; }
[Subscription("System.Robot.RobotSpeed")]
public int CurrentReadSpeedData { get; set; }
[Subscription("System.Robot.CurrentReadAData")]
public int CurrentReadAData { get; set; }
[Subscription("System.Robot.Axis1Postion")]
public string RobotPositionX
{
get;set;
}
[Subscription("System.Robot.Axis2Postion")]
public string RobotPositionY
{
get; set;
}
[Subscription("System.Robot.Axis3Postion")]
public string RobotPositionZ
{
get; set;
}
[Subscription("System.Robot.Axis4Postion")]
public string RobotPositionW
{
get; set;
}
[Subscription("System.Robot.LeftarmAndZaxisStatus")]
public string LeftarmAndZaxisStatus
{
get; set;
}
[Subscription("System.Robot.RightarmAndThetaarmStatus")]
public string RightarmAndThetaarmStatus
{
get; set;
}
[Subscription("System.Robot.IsLeftArmPressureSensorON")]
public bool IsLeftArmPressureSensorON
{
get; set;
}
[Subscription("System.Robot.IsRightArmPressureSensorON")]
public bool IsRightArmPressureSensorON
{
get; set;
}
[Subscription("System.Robot.CurrentCompoundCommandStatus")]
public string CurrentCompoundCommandStatus { get; set; }
[Subscription("System.Robot.CurrentExtParaValue")]
public string ExtendedParaValue
{
get;set;
}
[Subscription("System.Robot.State")]
public string RobotState
{
get; set;
}
[Subscription("System.Robot.RobotErrorCode")]
public string RobotErrorCode
{
get; set;
}
[Subscription("System.Robot.RobotIsOnline")]
public string RobotIsOnline
{
get; set;
}
[Subscription("System.Robot.RobotIsManual")]
public string RobotIsManual
{
get; set;
}
[Subscription("System.Robot.RobotIsAuto")]
public string RobotIsAuto
{
get; set;
}
[Subscription("System.Robot.RobotStopSignal")]
public string RobotStopSignal
{
get; set;
}
[Subscription("System.Robot.RobotEMSignal")]
public string RobotEMSignal
{
get; set;
}
[Subscription("System.Robot.RobotZaxisSaftyZone")]
public string RobotZaxisSaftyZone
{
get; set;
}
[Subscription("System.Robot.RobotPositioningCompleted")]
public string RobotPositioningCompleted
{
get; set;
}
[Subscription("System.Robot.RobotACalCompleted")]
public string RobotACalCompleted
{
get; set;
}
[Subscription("System.Robot.RobotExecutionCompleted")]
public string RobotExecutionCompleted
{
get; set;
}
[Subscription("System.Robot.ReadPosLeftArmPostion")]
public string RobotReadXPosition
{
get;set;
}
[Subscription("System.Robot.ReadPosRightArmPostion")]
public string RobotReadYPosition
{
get; set;
}
[Subscription("System.Robot.ReadPosZAxisPostion")]
public string RobotReadZPosition
{
get; set;
}
[Subscription("System.Robot.ReadPosThetaAxisPostion")]
public string RobotReadWPosition
{
get; set;
}
[Subscription("System.Robot.RobotMdata")]
public string RobotMdata
{
get; set;
}
[Subscription("System.Robot.RobotFCode")]
public string RobotFCode
{
get; set;
}
[Subscription("System.Robot.RobotSCode")]
public string RobotSCode
{
get; set;
}
[Subscription("System.Robot.ExtPara_MapWaferCount")]
public string ExtPara_MapWaferCount
{
get; set;
}
[Subscription("System.Robot.ExtPara_WaferThickness")]
public string ExtPara_WaferThickness
{
get; set;
}
[Subscription("System.Robot.ExtPara_PositionRange")]
public string ExtPara_PositionRange
{
get; set;
}
[Subscription("System.Robot.ExtPara_Pitch")]
public string ExtPara_Pitch
{
get; set;
}
[Subscription("System.Robot.ExtPara_Filter")]
public string ExtPara_Filter
{
get; set;
}
[Subscription("System.Robot.ExtPara_WaferMinThickness")]
public string ExtPara_MinThickness
{
get; set;
}
[Subscription("System.IsOnlineMode")]
public bool IsOnlineMode
{
get;
set;
}
[Subscription(ParamName.ModuleWaferList, DeviceName.Buffer1)]
public WaferInfo[] Buffer1Wafers
{
get;
set;
}
public WaferInfo Buffer1Wafer
{
get
{
if (Buffer1Wafers != null)
{
return Buffer1Wafers[0];
}
else
{
return null;
}
}
}
[Subscription(ParamName.IsAutoMode, "System")]
public bool IsAutoMode { get; set; }
[Subscription(ParamName.RTStatus, "System")]
public int RoutManagerState
{
get;
set;
}
public bool IsMaintenanceMode
{
get => RoutManagerState == (int)RtState.Maintenance;
}
public ICommand Command
{
get;
private set;
}
public RobotViewModel2() : base(4)
{
Command = new DelegateCommand(DoCommand, x => !IsMaintenanceMode && !IsAutoMode);
RobotMotionType = new List() { "A", "I", "U", "O" };
RobotTargetStation = new List() { "LP1", "LP2","Buffer1", "Buffer2", "LL1", "LL2" ,"CoolingBuffer1", "CoolingBuffer2" ,"Aligner1", "Aligner2" };
RobotActionType = new List() { "Pick", "Place", "Swap" };
RobotArmSelected = new List() { "Lower(Left)", "Upper(Right)"};
RobotSpeedType = new List() { "H(High speed)","L(Low speed)","S(Domain of Acc/Dec)","G(Acc/Dec speed",
"X(Magnification frequency)","D(Pulse position of manual slow down)" };
RobotSelectSlot = new List();
for (int i = 0; i < 25; i++) RobotSelectSlot.Add((i+1).ToString());
MappingParameterType = new List() { "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09" };
LoadPortList = new List() { "LP1", "LP2", "LP3", "LP4" };
JelCompaundCommandType = new List { "MainRoutine", "SubRoutine" };
JelMoveBaseType = new List { "0(Absolute position)", "1(Relative postion)" };
JelMoveSpeedType = new List { "(Normal)", "M(Manual slow down)", "L(Low Speed)" };
}
private void DoCommand(DependencyObject sender)
{
var command = CommandHelper.GetCommandItem(sender);
var lstParameter = new List