123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.UI.Controls.Common;
- using MECF.Framework.Common.OperationCenter;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Input;
- namespace Aitex.Sorter.UI.ViewModel.Maintenance
- {
- public class LoadPortViewModel : UIViewModelBase
- {
- public LoadPortViewModel() : base("LoadPortView")
- {
- OperationCommand = new DelegateCommand<DependencyObject>(Operation, x => !IsMaintenanceMode && !IsAutoMode);
- Command = new DelegateCommand<DependencyObject>(DoCommand, x => !IsMaintenanceMode && !IsAutoMode);
- }
- [Subscription(ParamName.IndicatiorLoad, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatiorLoad
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorUnload, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatiorUnload
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorPresence, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatiorPresence
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorPlacement, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatiorPlacement
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorOpAccess, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatiorOpAccess
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorLoad, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatiorLoad
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorUnload, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatiorUnload
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorPresence, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatiorPresence
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorPlacement, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatiorPlacement
- {
- get;
- set;
- }
- [Subscription(ParamName.IndicatiorOpAccess, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatiorOpAccess
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.LoadportA)]
- public string LPAFoupID
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.LoadportB)]
- public string LPBFoupID
- {
- get;
- set;
- }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportA)]
- public LoadportCassetteState LPACassetteState { get; set; }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportA)]
- public FoupClampState LPAClampState { get; set; }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportA)]
- public FoupDoorState LPADoorState { get; set; }
- [Subscription(ParamName.IndicatiorAlarm, DeviceName.LoadportA)]
- public IndicatorState LPAIndicatorAlarm { get; set; }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportB)]
- public LoadportCassetteState LPBCassetteState { get; set; }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportB)]
- public FoupClampState LPBClampState { get; set; }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportB)]
- public FoupDoorState LPBDoorState { get; set; }
- [Subscription(ParamName.IndicatiorAlarm, DeviceName.LoadportB)]
- public IndicatorState LPBIndicatorAlarm { get; set; }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportA)]
- public DeviceState LPAStatus { get; set; }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportB)]
- public DeviceState LPBStatus { get; set; }
- [Subscription(ParamName.RIDReaderState, DeviceName.RFIDReaderA)]
- public string RFIDReader1Status { get; set; }
- [Subscription(ParamName.RIDReaderState, DeviceName.RFIDReaderB)]
- public string RFIDReader2Status { get; set; }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderA)]
- public string FoupAID
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderB)]
- public string FoupBID
- {
- get;
- set;
- }
- [Subscription(ParamName.RTStatus, SystemStateModule)]
- public int RoutManagerState
- {
- get;
- set;
- }
- public bool IsMaintenanceMode
- {
- get => RoutManagerState == (int)RtState.Maintenance;
- }
- [Subscription(ParamName.IsAutoMode, SystemStateModule)]
- public bool IsAutoMode { get; set; }
- public ICommand OperationCommand
- {
- get;
- private set;
- }
- public ICommand Command
- {
- get;
- private set;
- }
- void Operation(DependencyObject sender)
- {
- var command = CommandHelper.GetCommandItem(sender);
- InvokeClient.Instance.Service.DoOperation(command.CommandName, command.Parameters);
- }
- private void DoCommand(DependencyObject sender)
- {
- var command = CommandHelper.GetCommandItem(sender);
- var lstParameter = new List<object>(command.Parameters);
- lstParameter.Insert(0, command.Target);
- lstParameter.Insert(1, command.CommandName);
- InvokeClient.Instance.Service.DoOperation(OperationName.DeviceOperation, lstParameter.ToArray());
- }
- }
- }
|