Browse Source

UI界面添加Pause/Resume功能

lixiang 1 year ago
parent
commit
c3f0679404

+ 33 - 0
Venus/Venus_MainPages/Converters/IntToPathDataConverter.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace Venus_MainPages.Converters
+{
+    public class IntToPathDataConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            var item = (int)value;
+            if (item == 4)
+            {
+                return Application.Current.Resources["Icon_Pause"] as Geometry;
+            }
+            else
+            {
+                
+                return Application.Current.Resources["Icon_Resume"] as Geometry;
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

+ 1 - 0
Venus/Venus_MainPages/Venus_MainPages.csproj

@@ -128,6 +128,7 @@
     <Compile Include="Converters\EFEMStateConverter.cs" />
     <Compile Include="Converters\EventItemToStringConverter.cs" />
     <Compile Include="Converters\HeaterToStringConverter.cs" />
+    <Compile Include="Converters\IntToPathDataConverter.cs" />
     <Compile Include="Converters\IsOnlineToOpacityConverter.cs" />
     <Compile Include="Converters\IsOnlineToColorConverter.cs" />
     <Compile Include="Converters\LLStateConverter.cs" />

+ 37 - 7
Venus/Venus_MainPages/ViewModels/OperationOverViewModel.cs

@@ -88,7 +88,7 @@ namespace Venus_MainPages.ViewModels
 
         private float m_TMPressure;
 
-
+        private string m_RouteState;
 
         #endregion
 
@@ -387,6 +387,11 @@ namespace Venus_MainPages.ViewModels
             get { return m_TMPressure; }
             set { SetProperty(ref m_TMPressure, value); }
         }
+        public string RouteState
+        {
+            get { return m_RouteState; }
+            set { SetProperty(ref m_RouteState, value); }
+        }
         #endregion
 
         #region 命令
@@ -427,9 +432,10 @@ namespace Venus_MainPages.ViewModels
         public DelegateCommand HomeAllCommand =>
             _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
 
-        private DelegateCommand _PauseAllJobCommand;
-        public DelegateCommand PauseAllJobCommand =>
-            _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
+
+        private DelegateCommand _ResumeAllJobCommand;
+        public DelegateCommand ResumeAllJobCommand =>
+            _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
 
         private DelegateCommand _AbortAllCommand;
         public DelegateCommand AbortAllCommand =>
@@ -550,9 +556,23 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnPauseAllJob()
         {
-            InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
-            InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
-            InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
+           
+        }
+        private void OnResumeAllJob()
+        {
+            if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
+            {
+                InvokeClient.Instance.Service.DoOperation("System.ResumeJob", LP1WaferAssociation.JobID);
+                //InvokeClient.Instance.Service.DoOperation("System.ResumeJob", LP2WaferAssociation.JobID);
+                //InvokeClient.Instance.Service.DoOperation("System.ResumeJob", LP3WaferAssociation.JobID);
+            }
+            else
+            {
+                InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP1WaferAssociation.JobID);
+                //InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP2WaferAssociation.JobID);
+                //InvokeClient.Instance.Service.DoOperation("System.PauseJob", LP3WaferAssociation.JobID);
+
+            }
 
         }
         private void OnAbortAll()
@@ -708,6 +728,14 @@ namespace Venus_MainPages.ViewModels
             LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
             LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
             LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
+            if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
+            {
+                RouteState = "Resume";
+            }
+            else
+            {
+                RouteState = "Pause";
+            }
 
         }
         private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
@@ -1143,6 +1171,8 @@ namespace Venus_MainPages.ViewModels
             m_RtDataKeys.Add("Scheduler.CycledWafer");
             m_RtDataKeys.Add("Scheduler.CycleSetPoint");
             m_RtDataKeys.Add("Scheduler.Throughput");
+            m_RtDataKeys.Add("EquipmentStatus");
+
         }
         private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
         {

+ 6 - 7
Venus/Venus_MainPages/Views/OperationOverView.xaml

@@ -32,18 +32,17 @@
         <converters2:IsOnlineToOpacityConverter x:Key="IsOnlineToOpacityConverter"/>
         <converters:BoolToColor  x:Key="boolToColor"/>
         <converters:BoolToColor4 x:Key="boolToColor4"/>
+        <converters2:IntToPathDataConverter x:Key="IntToPathDataConverter"/>
     </UserControl.Resources>
     <Canvas>
         <Border BorderThickness="0,0,0,1" BorderBrush="Black" Canvas.Top="20" Canvas.Left="40">
             <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
-                <customControls:PathButton PathData="{StaticResource Icon_Home}"  DefaultFillBrush="White"  Command="{Binding HomeAllCommand}"  Width="120" Height="30" Content="Initialize"    Margin="10,0,0,0"/>
-
-
+                <customControls:PathButton PathData="{StaticResource Icon_Init}"  DefaultFillBrush="White"  Command="{Binding HomeAllCommand}"  Width="120" Height="30" Content="Initialize"    Margin="10,0,0,0"/>
                 <RadioButton Content="Manual"   FontSize="15"   Width="120" Height="28" Margin="50 0 5 0" Style="{StaticResource Button_RadioButton}"  Command="{Binding EnableManualCommand}" IsChecked="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
-                <RadioButton Content="Auto"    FontSize="15"   Width="120" Height="28" Margin="0 0 0 0" Style="{StaticResource Button_RadioButton}"     Command="{Binding EnableAutoCommand}"  IsChecked="{Binding RtDataValues[System.IsAutoMode]}"/>
-                <customControls:PathButton PathData="{StaticResource Icon_Abort}"   DefaultFillBrush="White" Width="130" Height="30" Content="Abort"          Command="{Binding AbortAllCommand}"         IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Margin="50 0 0 0"/>
-                <customControls:PathButton PathData="{StaticResource Icon_Pause}" DefaultFillBrush="White" Width="130" Height="30" Content="Pause"          Command="{Binding PauseAllJobCommand}"         IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Margin="50 0 0 0" />
-                <customControls:PathButton PathData="{StaticResource Icon_Return}" DefaultFillBrush="White" Width="146" Height="30" Content="Return Wafer"    Command="{Binding ReturnAllWaferCommand}"         Margin="50,0,0,0" IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" />
+                <RadioButton Content="Auto"     FontSize="15"   Width="120" Height="28" Margin="0 0 0 0" Style="{StaticResource Button_RadioButton}"     Command="{Binding EnableAutoCommand}"  IsChecked="{Binding RtDataValues[System.IsAutoMode]}"/>
+                <customControls:PathButton PathData="{StaticResource Icon_Abort}"   DefaultFillBrush="White" Width="130" Height="30" Content="Abort"           Command="{Binding AbortAllCommand}"               IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Margin="50 0 0 0"/>
+                <customControls:PathButton PathData="{Binding RtDataValues[EquipmentStatus],Converter={StaticResource IntToPathDataConverter}}"   DefaultFillBrush="White" Width="130" Height="30" Content="{Binding RouteState}"           Command="{Binding ResumeAllJobCommand}"            IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Margin="50 0 0 0" />
+                <customControls:PathButton PathData="{StaticResource Icon_Return}"  DefaultFillBrush="White" Width="146" Height="30" Content="Return Wafer"    Command="{Binding ReturnAllWaferCommand}"         IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Margin="50,0,0,0"/>
                 
                
             </StackPanel>

+ 1 - 1
Venus/Venus_RT/Devices/JetKepler2200APM.cs

@@ -428,7 +428,7 @@ namespace Venus_RT.Devices
             else if (
                 SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.Revtech)
             {
-                _Match = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VenusDevice.BiasMatch}");
+                _Match = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VenusDevice.Match}");
             }
 
 

+ 18 - 14
Venus/Venus_RT/Devices/RevtechMatch.cs

@@ -32,7 +32,7 @@ namespace Venus_RT.Devices
         private AsyncSerialPort _serial;
         private MatchCommunicationType _matchCommunicationType;
         private string _address;
-        public int WorkMode { get; set; } = -1;//1是auto,0是manual
+        public string WorkMode { get; set; } = "";
         public RevtechMatch(ModuleName mod, VenusDevice venusDevice, MatchCommunicationType matchCommunicationType) : base(mod.ToString(), venusDevice.ToString())
         {
             _matchCommunicationType = matchCommunicationType;
@@ -53,6 +53,8 @@ namespace Venus_RT.Devices
                 var address = SC.GetStringValue($"{mod}.{venusDevice}.IPAddress");
                 _address = address;
                 _socket = new AsyncSocketDevice(address);
+                _socket.OnDataChanged +=new AsyncSocketDevice.MessageHandler(OnDataChanged);
+                _socket.OnErrorHappened += _socket_OnErrorHappened;
             }
 
             SerachCommandList = new List<string>()
@@ -64,6 +66,11 @@ namespace Venus_RT.Devices
             baseTimer.Enabled = true;
         }
 
+        private void _socket_OnErrorHappened(ErrorEventArgsDevice args)
+        {
+            LOG.Write(eEvent.ERR_RF, Module, $"{Module} Comet RF Error {args.Reason}");
+        }
+
         public override bool Initialize()
         {
             base.Initialize();
@@ -82,21 +89,14 @@ namespace Venus_RT.Devices
             }
             else if (_matchCommunicationType == MatchCommunicationType.Ethernet)
             {
-                //_socket?.Connect(_address);
 
-                if (_socket?.IsConnected == true)
-                {
-                    LOG.Write(eEvent.INFO_MATCH, Module, $"{Name} 网口连接成功");
-                }
-                else
-                {
-                    LOG.Write(eEvent.INFO_MATCH, Module, $"{Name} 网口连接失败");
-                }
+                _socket?.Connect(_address);
+
             }
 
             DATA.Subscribe($"{Module}.{Name}.C1", () => TunePosition1);
             DATA.Subscribe($"{Module}.{Name}.C2", () => TunePosition2);
-            DATA.Subscribe($"{Module}.{Name}.WorkMode", () => WorkMode == 1 ? "Manual" : "Auto");
+            DATA.Subscribe($"{Module}.{Name}.WorkMode", () => WorkMode);
 
 
 
@@ -141,23 +141,27 @@ namespace Venus_RT.Devices
         private void OnDataChanged(byte[] obj)
         {
             string data = System.Text.Encoding.ASCII.GetString(obj);
+
+
             if (data.Length < 10)
             {
                 return;
             }
-            string[] matchData = data.Split(',');
+            string[] matchData = data.Split(',');        
+
             if (matchData.Length > 9)
             {
-                WorkMode = Convert.ToInt32(matchData[0]);
+                WorkMode = matchData[0];
                 TunePosition1 = Convert.ToSingle(matchData[7]);
                 TunePosition2 = Convert.ToSingle(matchData[8]);
             }
         }
         private void RevtechMatch_sendDataChangedEvent(string obj)
         {
-            if ((_matchCommunicationType == MatchCommunicationType.Ethernet && _socket?.IsConnected == true))
+            if ((_matchCommunicationType == MatchCommunicationType.Ethernet))
             {
                 byte[] value = Encoding.ASCII.GetBytes(obj);
+
                 _socket?.Write(value);
             }
             else if ((_matchCommunicationType == MatchCommunicationType.RS232 && _serial?.IsOpen() == true))

File diff suppressed because it is too large
+ 5 - 3
Venus/Venus_Themes/Themes/Generic.xaml