Pārlūkot izejas kodu

1.完成FA模块的功能开发

# Conflicts:
#	Venus/Venus_MainPages/Views/TopView.xaml
Intern01 2 gadi atpakaļ
vecāks
revīzija
23c59d3c86

+ 1 - 0
Venus/Venus_Core/EventDefine.cs

@@ -59,6 +59,7 @@ namespace Aitex.Core.RT.Log{
 		INFO_Sensor = 1026,
 		WARN_Sensor = 1027,
 		ERR_Sensor = 1028,
+		INFO_FA = 1029,
 		ERR_TM = 2000,
 		INFO_TM = 2001,
 		WARN_TM = 2002,

+ 270 - 0
Venus/Venus_MainPages/ViewModels/FaViewModel.cs

@@ -7,13 +7,283 @@ using Prism.Mvvm;
 using Venus_MainPages.Unity;
 using Venus_MainPages.Views;
 using System.Threading.Tasks;
+using Aitex.Core.Util;
+using FabConnect.SecsGemInterface.GemModel;
+using MECF.Framework.Common.OperationCenter;
+using Aitex.Core.RT.OperationCenter;
+using System.Windows.Threading;
+using Aitex.Core.Common.DeviceData;
+using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.Equipment;
+using Aitex.Core.RT.Log;
 
 namespace Venus_MainPages.ViewModels
 {
     public class FaViewModel:BindableBase
     {
+        private readonly GEMController _gem = new GEMController();
+        private List<string> m_RtDataKeys = new List<string>();
+        private Dictionary<string, object> m_RtDataValues;
+        private string m_HostCommunicationStatus;
+        private string m_HostControlStatus;
+        private int m_SpoolingState;
+        private string m_SpoolingActual;
+        private string m_SpoolingTotal;
+        private string m_SpoolingFullTime;
+        private string m_SpoolingStartTime;
+        private  bool  m_IsSpoolingEnable;
         #region 私有变量
+        public enum ConmmunicationState
+        {
+            Disabled,
+            Enabled,
+            EnabledNotCommunicating,
+            EnabledCommunicating,
+            WaitCRA,
+            WaitDelay,
+            WaitCRFromHost,
+        }
+        public enum ControlState
+        {
+            Unknown,
+            EquipmentOffline,
+            AttemptOnline,
+            HostOffline,
+            OnlineLocal,
+            OnlineRemote,
+        }
 
         #endregion
+
+        #region 命令
+      
+        private DelegateCommand _FaEnableCommand;
+        public DelegateCommand FaEnableCommand =>
+        _FaEnableCommand ?? (_FaEnableCommand = new DelegateCommand(FaEnable));
+        private DelegateCommand _FaDisableCommand;
+        public DelegateCommand FaDisableCommand =>
+        _FaDisableCommand ?? (_FaDisableCommand = new DelegateCommand(FaDisable));
+        private DelegateCommand _FaOnlineCommand;
+        public DelegateCommand FaOnlineCommand =>
+        _FaOnlineCommand ?? (_FaOnlineCommand = new DelegateCommand(FaOnline));
+        private DelegateCommand _FaOfflineCommand;
+        public DelegateCommand FaOfflineCommand =>
+        _FaOfflineCommand ?? (_FaOfflineCommand = new DelegateCommand(FaOffline));
+        private DelegateCommand _FaLocalCommand;
+        public DelegateCommand FaLocalCommand =>
+        _FaLocalCommand ?? (_FaLocalCommand = new DelegateCommand(FaLocal));
+
+        private DelegateCommand _FaRemoteCommand;
+        public DelegateCommand FaRemoteCommand =>
+        _FaRemoteCommand ?? (_FaRemoteCommand = new DelegateCommand(FaRemote));
+        private DelegateCommand _FaEnableSpoolingCommand;
+        public DelegateCommand FaEnableSpoolingCommand =>
+        _FaEnableSpoolingCommand ?? (_FaEnableSpoolingCommand = new DelegateCommand(FaEnableSpooling));
+        private DelegateCommand _FaDisableSpoolingCommand;
+        public DelegateCommand FaDisableSpoolingCommand =>
+        _FaDisableSpoolingCommand ?? (_FaDisableSpoolingCommand = new DelegateCommand(FaDisableSpooling));
+        #endregion
+
+        #region 属性
+        public string HostCommunicationStatus
+        {
+            get { return m_HostCommunicationStatus; }
+            set { SetProperty(ref m_HostCommunicationStatus, value); }
+        }
+        public string HostControlStatus 
+        {
+            get { return m_HostControlStatus; }
+            set { SetProperty(ref m_HostControlStatus, value); }
+        }
+
+        public int SpoolingState 
+        {
+            get { return m_SpoolingState; }
+            set { SetProperty(ref m_SpoolingState, value); }
+        }
+        public string SpoolingActual 
+        {
+            get { return m_SpoolingActual; }
+            set { SetProperty(ref m_SpoolingActual, value); }
+        }
+
+        public string SpoolingTotal 
+        { 
+          get { return m_SpoolingTotal; }   
+          set { SetProperty(ref m_SpoolingTotal, value); }
+        }
+        public string SpoolingFullTime 
+        {
+         get { return m_SpoolingFullTime; }
+         set { SetProperty(ref m_SpoolingFullTime, value); }
+        }
+        public string SpoolingStartTime 
+        {
+         get { return m_SpoolingStartTime; } 
+         set { SetProperty(ref m_SpoolingStartTime, value); }
+        }
+
+        public bool IsSpoolingEnable
+        { 
+          get { return m_IsSpoolingEnable; }
+          set { SetProperty(ref m_IsSpoolingEnable, value); }
+        }
+        public Dictionary<string, object> RtDataValues
+        {
+            get { return m_RtDataValues; }
+            set { SetProperty(ref m_RtDataValues, value); }
+        }
+        public CommunicationState FACommunicationState
+        {
+            get
+            {
+                return string.IsNullOrEmpty(HostCommunicationStatus) ? CommunicationState.Disabled
+                    : (CommunicationState)Enum.Parse(typeof(CommunicationState), HostCommunicationStatus);
+            }
+        }
+        public ControlState FAControlState
+        {
+            get
+            {
+                return string.IsNullOrEmpty(HostControlStatus) ? ControlState.Unknown
+                    : (ControlState)Enum.Parse(typeof(ControlState), HostControlStatus);
+            }
+        }
+        public bool _IsDisableEnable;
+        public bool IsEnableEnable
+        {
+            get { return _IsDisableEnable; }
+            set {  SetProperty(ref _IsDisableEnable, value);}    
+        }
+        public bool _IsEnableDisable;
+        public bool IsEnableDisable
+        {
+            get { return _IsEnableDisable; }
+            set { SetProperty(ref _IsEnableDisable, value); }
+        }
+        public bool _IsEnableOnline;
+        public bool IsEnableOnline
+        {
+            get { return _IsEnableOnline; }
+            set { SetProperty(ref _IsEnableOnline, value); }
+        }
+        public bool _IsEnableOffline;
+        public bool IsEnableOffline
+        {
+            get { return _IsEnableOffline; }
+            set { SetProperty(ref _IsEnableOffline, value); }
+        }
+        public bool _IsEnableLocal;
+        public bool IsEnableLocal
+        {
+            get { return _IsEnableLocal; }
+            set { SetProperty(ref _IsEnableLocal, value); }
+        }
+        public bool _IsEnableRemote;
+        public bool IsEnableRemote
+        {
+            get { return _IsEnableRemote; }
+            set { SetProperty(ref _IsEnableRemote, value); }
+        }
+        public bool _IsEnableEnableSpooling;
+        public bool IsEnableEnableSpooling
+        {
+            get { return _IsEnableEnableSpooling; }
+            set { SetProperty(ref _IsEnableEnableSpooling, value); }
+        }
+        public bool IsEnableDisableSpooling
+        {
+            get
+            {
+                return IsSpoolingEnable;
+            }
+        }
+        #endregion
+
+        #region 构造函数
+        public FaViewModel()
+        {
+            addDataKeys();
+            DispatcherTimer timer = new DispatcherTimer();
+            timer.Interval = TimeSpan.FromSeconds(0.5);
+            timer.Tick += timer_Tick;
+            timer.Start();
+            
+        }
+        #endregion
+
+        #region
+        void timer_Tick(object sender, EventArgs e)
+        {   
+            IsEnableEnable = FACommunicationState == CommunicationState.Disabled;
+            IsEnableDisable= FACommunicationState != CommunicationState.Disabled;
+            IsEnableOnline = FAControlState == ControlState.Unknown || FAControlState == ControlState.EquipmentOffline;
+            IsEnableOffline = FAControlState == ControlState.Unknown || FAControlState != ControlState.EquipmentOffline;
+            IsEnableRemote = FAControlState == ControlState.OnlineLocal;
+            IsEnableLocal = FAControlState == ControlState.OnlineRemote;
+            IsEnableEnableSpooling = !IsSpoolingEnable;
+            RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
+            HostCommunicationStatus = CommonFunction.GetValue<String>(RtDataValues, "System.CommunicationStatus");
+            HostControlStatus = CommonFunction.GetValue<String>(RtDataValues, "System.ControlStatus");
+            SpoolingState = CommonFunction.GetValue<int>(RtDataValues, "System.SpoolingState");
+            SpoolingActual = CommonFunction.GetValue<string>(RtDataValues, "System.SpoolingActual");
+            SpoolingTotal= CommonFunction.GetValue<string>(RtDataValues, "System.SpoolingTotal");
+            SpoolingFullTime = CommonFunction.GetValue<string>(RtDataValues, "System.SpoolingFullTime");
+            SpoolingStartTime = CommonFunction.GetValue<string>(RtDataValues, "System.SpoolingStartTime");
+            IsSpoolingEnable = CommonFunction.GetValue<bool>(RtDataValues, "System.IsSpoolingEnable");
+        }
+        private void addDataKeys()
+        {
+            m_RtDataKeys.Add("System.CommunicationStatus");
+            m_RtDataKeys.Add("System.ControlStatus");
+            m_RtDataKeys.Add("System.SpoolingState");
+            m_RtDataKeys.Add("System.SpoolingActual");
+            m_RtDataKeys.Add("System.SpoolingTotal");
+            m_RtDataKeys.Add("System.SpoolingFullTime");
+            m_RtDataKeys.Add("System.SpoolingStartTime");
+            m_RtDataKeys.Add("System.IsSpoolingEnable");   
+        }
+            public void FaEnable()
+        {
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FAEnable");
+        }
+        public void FaDisable()
+        {
+            
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FADisable");
+        }
+        public void FaOnline()
+        {
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FAOnline");
+        }
+
+        public void FaOffline()
+        {
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FAOffline");
+        }
+        public void FaLocal()
+        {
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FALocal");
+        }
+
+        public void FaRemote()
+        {
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FARemote");
+        }
+        public void FaEnableSpooling()
+        {
+            
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FAEnableSpooling");
+        }
+
+        public void FaDisableSpooling()
+        {
+           
+            InvokeClient.Instance.Service.DoOperation("System.FACommand", "FADisableSpooling");
+        }
+ 
+        #endregion
+
+
     }
 }

+ 0 - 1
Venus/Venus_MainPages/ViewModels/ProcessHistoryViewModel.cs

@@ -128,7 +128,6 @@ namespace Venus_MainPages.ViewModels
             this.view.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
             this.LoadRecipeCheckBox();
         }
-        
         private void LoadRecipeCheckBox()
         {
             List<string> chamber = new List<string>() { "PMA","PMB","PMC","PMD"};

+ 74 - 5
Venus/Venus_MainPages/ViewModels/TopViewModel.cs

@@ -40,6 +40,7 @@ namespace Venus_MainPages.ViewModels
 
         private int logMaxCount = 50;//log在ui最多显示数量
         private AITSignalTowerData m_SignalTowerData;
+        private string m_HostCommunicationStatus;
 
         private JetChamber m_SelectedJetChamber = JetChamber.None;
 
@@ -91,6 +92,56 @@ namespace Venus_MainPages.ViewModels
             get { return m_SignalTowerData; }
             set { SetProperty(ref m_SignalTowerData, value); }
         }
+        public string HostCommunicationStatusBackground
+        {
+            get
+            {
+                switch (HostCommunicationStatus)
+                {
+                    case "Disabled":
+                        return "Yellow";
+                    case "Enabled":
+                    case "EnabledNotCommunicating":
+                    case "WaitCRA":
+                    case "WaitDelay":
+                    case "WaitCRFromHost":
+                        return "Transparent";
+                    case "EnabledCommunicating":
+                        return "LawnGreen";
+                    default:
+                        return "Yellow";
+                }
+            }
+        }
+        public string m_HostBack;
+        public string HostBack
+        {
+            get { return m_HostBack; }
+            set { SetProperty(ref m_HostBack, value); }
+        }
+        public string HostCommunicationStatus
+        {
+            get { return m_HostCommunicationStatus; }
+            set { SetProperty(ref m_HostCommunicationStatus, value); }
+        }
+        public bool IsEnableFAEnable
+        {
+            get
+            {
+                return HostCommunicationStatus == "Disabled";
+            }
+
+        }
+
+
+        public bool IsDisableFAEnable
+        {
+            get
+            {
+                return HostCommunicationStatus != "Disabled";
+            }
+
+        }
         #endregion
 
         #region 命令
@@ -113,7 +164,14 @@ namespace Venus_MainPages.ViewModels
         private DelegateCommand _BuzzerOffCommand;
         public DelegateCommand BuzzerOffCommand =>
                  _BuzzerOffCommand ?? (_BuzzerOffCommand = new DelegateCommand(OnBuzzerOff));
-        
+
+        private DelegateCommand _FADisableCommand;
+        public DelegateCommand FADisableCommand =>
+                 _FADisableCommand ?? (_FADisableCommand = new DelegateCommand(FaDisable));
+        private DelegateCommand _FAEnableCommand;
+        public DelegateCommand FAEnableCommand =>
+                 _FAEnableCommand ?? (_FAEnableCommand = new DelegateCommand(FaEnable));
+
         #endregion
 
         #region 构造函数
@@ -130,7 +188,7 @@ namespace Venus_MainPages.ViewModels
             timer.Interval = TimeSpan.FromSeconds(1);
             timer.Tick += timer_Tick;
             timer.Start();
-
+            
             EventClient.Instance.OnEvent += Instance_OnEvent;
             EventClient.Instance.Start();
 
@@ -141,9 +199,11 @@ namespace Venus_MainPages.ViewModels
 
         void timer_Tick(object sender, EventArgs e)
         {
-            RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
-            
+            RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);           
             SignalTowerData = CommonFunction.GetValue<AITSignalTowerData>(RtDataValues, $"{ModuleName}.SignalTower.DeviceData");
+            HostCommunicationStatus= CommonFunction.GetValue<String>(RtDataValues,"System.CommunicationStatus");
+            HostBack = HostCommunicationStatusBackground;
+
         }
 
         private void OnSwitchLanguage()
@@ -185,7 +245,7 @@ namespace Venus_MainPages.ViewModels
             m_RtDataKeys.Add("TM.FsmState");
             m_RtDataKeys.Add("LLA.FsmState");
             m_RtDataKeys.Add("LLB.FsmState");
-
+            
 
             m_RtDataKeys.Add("EFEM.FsmState");
 
@@ -193,6 +253,7 @@ namespace Venus_MainPages.ViewModels
 
             m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
             m_RtDataKeys.Add($"{ModuleName}.SignalTower.DeviceData");
+            m_RtDataKeys.Add("System.CommunicationStatus");
         }
 
         private void Instance_OnEvent(EventItem eventItem)
@@ -266,6 +327,14 @@ namespace Venus_MainPages.ViewModels
         {
             InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SignalTower.SwitchOffBuzzer");
         }
+        public void FaDisable()
+        {
+            InvokeClient.Instance.Service.DoOperation($"System.FACommand", "FADisable");
+        }
+        public void FaEnable()
+        {
+            InvokeClient.Instance.Service.DoOperation($"System.FACommand", "FAEnable");
+        }
         #endregion
 
     }

+ 11 - 9
Venus/Venus_MainPages/Views/FaView.xaml

@@ -5,8 +5,10 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
              xmlns:local="clr-namespace:Venus_MainPages.Views"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:ctrls="clr-namespace:Venus_Themes.UserControls;assembly=Venus_Themes"
-             mc:Ignorable="d" 
+             mc:Ignorable="d" IsEnabled="{Binding PageEnabled}"
              d:DesignHeight="1024" d:DesignWidth="1580">
 
     <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
@@ -39,9 +41,9 @@
                         <TextBlock Text="{Binding HostCommunicationStatus}" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="16" FontFamily="Arial" VerticalAlignment="Center"/>
                     </Border>
                     <StackPanel Orientation="Horizontal" Grid.Row="1"  Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,80,0,10" >
-                        <Button Content="Enable" Command="{Binding FaEnable}" Width="90" Height="30" VerticalAlignment="Center"   IsEnabled="{Binding IsEnableEnable}" >
+                        <Button Content="Enable" Command="{Binding FaEnableCommand}" Width="90" Height="30" VerticalAlignment="Center"   IsEnabled="{Binding IsEnableEnable}" >
                         </Button>
-                        <Button Content="Disable" Command="{Binding FaDisable}"  Width="90" Height="30" Margin="10,0,0,0" VerticalAlignment="Center"    IsEnabled="{Binding IsEnableDisable}"  >
+                        <Button Content="Disable" Command="{Binding FaDisableCommand}"  Width="90" Height="30" Margin="10,0,0,0" VerticalAlignment="Center"    IsEnabled="{Binding IsEnableDisable }"  >
                         </Button>
                     </StackPanel>
                 </Grid>
@@ -73,16 +75,16 @@
                     </Border>
 
                     <UniformGrid Columns="2" Grid.Row="1"  Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,80,0,10" >
-                        <Button Content="Online" Command="{Binding FaOnline}"  Width="90" Height="30" Margin="0,0,10,5"  IsEnabled="{Binding IsEnableOnline}">
+                        <Button Content="Online" Command="{Binding FaOnlineCommand}"  Width="90" Height="30" Margin="0,0,10,5"  IsEnabled="{Binding IsEnableOnline}">
 
                         </Button>
-                        <Button Content="Offline" Command="{Binding FaOffline}" Width="90" Height="30" Margin="0,0,10,5"   IsEnabled="{Binding IsEnableOffline}" >
+                        <Button Content="Offline" Command="{Binding FaOfflineCommand}" Width="90" Height="30" Margin="0,0,10,5"   IsEnabled="{Binding IsEnableOffline}" >
 
                         </Button>
-                        <Button Content="Local" Command="{Binding FaLocal}" Width="90" Height="30" Margin="0,0,10,5"  IsEnabled="{Binding IsEnableLocal}" >
+                        <Button Content="Local" Command="{Binding FaLocalCommand}" Width="90" Height="30" Margin="0,0,10,5"  IsEnabled="{Binding IsEnableLocal}" >
 
                         </Button>
-                        <Button Content="Remote" Command="{Binding FaRemote}" Width="90" Height="30" Margin="0,0,10,5"     IsEnabled="{Binding IsEnableRemote}" >
+                        <Button Content="Remote" Command="{Binding FaRemoteCommand}" Width="90" Height="30" Margin="0,0,10,5"     IsEnabled="{Binding IsEnableRemote}" >
                         </Button>
                     </UniformGrid>
                 </Grid>
@@ -145,9 +147,9 @@
                     </Border>
 
                     <StackPanel Orientation="Horizontal" Grid.Row="5" Margin="0,10" Grid.ColumnSpan="2" HorizontalAlignment="Center">
-                        <Button Content="Enable" Command="{Binding FaEnableSpooling}"  Width="90" Height="30"   IsEnabled="{Binding IsEnableEnableSpooling}"  >
+                        <Button Content="Enable" Command="{Binding FaEnableSpoolingCommand}"  Width="90" Height="30"   IsEnabled="{Binding IsEnableEnableSpooling}">
                         </Button>
-                        <Button Content="Disable" Command="{Binding FaDisableSpooling}" Width="90" Height="30" Margin="10,0,0,0"   IsEnabled="{Binding IsEnableDisableSpooling}"  >
+                        <Button Content="Disable" Command="{Binding FaDisableSpoolingCommand}" Width="90" Height="30" Margin="10,0,0,0" IsEnabled="{Binding IsSpoolingEnable}"  >
                         </Button>
                     </StackPanel>
                 </Grid>

+ 9 - 0
Venus/Venus_RT/Config/LogDefine.json

@@ -523,6 +523,15 @@
     "Note": "Sensor Error"
   },
   {
+    "Id": 1029,
+    "Level": "Info",
+    "LogEnum": "INFO_FA",
+    "GlobalDescription_zh": "{0}",
+    "GlobalDescription_en": "{0}",
+    "Module": "FA",
+    "Note": "FA INFO"
+  },
+  {
     "Id": 2000,
     "Level": "Error",
     "LogEnum": "ERR_TM",

+ 3 - 0
Venus/Venus_RT/FAs/FaManager.cs

@@ -13,6 +13,7 @@ using MECF.Framework.Common.Equipment;
 //using Venus_RT.Devices.EFEM;
 using Venus_RT.FAs;
 using Venus_RT.Modules;
+using Aitex.Core.RT.Log;
 
 namespace Venus_RT.HostWrapper
 {
@@ -63,6 +64,8 @@ namespace Venus_RT.HostWrapper
 
         private bool InvokeFaCommand(string arg1, object[] arg2)
         {
+            LOG.Write(eEvent.INFO_FA, ModuleName.System, arg1 + ":" + arg2[0]);
+
             Invoke(arg2[0].ToString(), null);
             return true;
         }