Преглед на файлове

add robotcycle precheck

chenzk преди 4 седмици
родител
ревизия
dadd411645
променени са 3 файла, в които са добавени 201 реда и са изтрити 11 реда
  1. 10 5
      CyberX8_MainPages/Views/EfemView.xaml
  2. 5 5
      CyberX8_MainPages/Views/OperationOverView.xaml
  3. 186 1
      CyberX8_RT/Modules/EFEM/CycleRobotCycleNewRoutine.cs

+ 10 - 5
CyberX8_MainPages/Views/EfemView.xaml

@@ -37,22 +37,26 @@
         <userControls:FOUPFrontView UnitData="{Binding LP1ModuleInfo}"
                                     IsCassettePlaced="{Binding RtDataValues[LP1.CassettePlaced]}"
                                     Canvas.Top="70" Canvas.Left="20"/>
-        <TextBlock Text="LP1" Canvas.Top="470" Canvas.Left="70" FontSize="12"></TextBlock>
+        <TextBlock Text="LP1" Canvas.Top="470" Canvas.Left="70" FontSize="12"
+                   Visibility="{Binding RtDataValues[LP1.CassettePlaced],Converter={StaticResource BoolToVisibility2}}"></TextBlock>
         <userControls:FOUPFrontView UnitData="{Binding LP2ModuleInfo}"
                                     IsCassettePlaced="{Binding RtDataValues[LP2.CassettePlaced]}"
                                     Canvas.Top="70" Canvas.Left="160"/>
-        <TextBlock Text="LP2" Canvas.Top="470" Canvas.Left="210" FontSize="12"></TextBlock>
+        <TextBlock Text="LP2" Canvas.Top="470" Canvas.Left="210" FontSize="12"
+                   Visibility="{Binding RtDataValues[LP2.CassettePlaced],Converter={StaticResource BoolToVisibility2}}"></TextBlock>
         <userControls:FOUPFrontView UnitData="{Binding LP3ModuleInfo}"
                                     IsCassettePlaced="{Binding RtDataValues[LP3.CassettePlaced]}"
                                     Canvas.Top="70" Canvas.Left="300"/>
-        <TextBlock Text="LP3" Canvas.Top="470" Canvas.Left="350" FontSize="12"></TextBlock>
+        <TextBlock Text="LP3" Canvas.Top="470" Canvas.Left="350" FontSize="12"
+                   Visibility="{Binding RtDataValues[LP3.CassettePlaced],Converter={StaticResource BoolToVisibility2}}"></TextBlock>
 
 
         <StackPanel Canvas.Top="15" Canvas.Left="1700">
             <userControls:FOUPFrontView UnitData="{Binding Dummy2ModuleInfo}"
                                         IsCassettePlaced="{Binding RtDataValues[Dummy2.CassettePlaced]}"
                                         ShowTitle="False" IsEnabled="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
-            <TextBlock Text="Dummy2" HorizontalAlignment="Center" Margin="0,5,0,20" FontSize="12">
+            <TextBlock Text="Dummy2" HorizontalAlignment="Center" Margin="0,5,0,20" FontSize="12"
+                       Visibility="{Binding RtDataValues[Dummy2.CassettePlaced],Converter={StaticResource BoolToVisibility2}}">
             </TextBlock>
         
         </StackPanel>
@@ -60,7 +64,8 @@
             <userControls:FOUPFrontView UnitData="{Binding Dummy1ModuleInfo}"
                                         IsCassettePlaced="{Binding RtDataValues[Dummy1.CassettePlaced]}"
                                         ShowTitle="False" IsEnabled="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
-            <TextBlock Text="Dummy1" HorizontalAlignment="Center" Margin="0,5,0,0" FontSize="12">
+            <TextBlock Text="Dummy1" HorizontalAlignment="Center" Margin="0,5,0,0" FontSize="12"
+                       Visibility="{Binding RtDataValues[Dummy1.CassettePlaced],Converter={StaticResource BoolToVisibility2}}">
             </TextBlock>
         </StackPanel>
         <userControls:SRDFrontView UnitData1="{Binding Srd2ModuleInfo}" UnitData2="{Binding Srd1ModuleInfo}" Title="SRD"  Canvas.Top="80" Canvas.Left="1040"/>

+ 5 - 5
CyberX8_MainPages/Views/OperationOverView.xaml

@@ -95,7 +95,7 @@
                 <TabPanel Canvas.Left="1170"  Canvas.Top="140" Visibility="{Binding ElementName=CarrierRadioButton,Path=IsChecked,Converter={StaticResource boolToVisibility2}}">
                     <Border BorderBrush="Gray" BorderThickness="1">
                         <StackPanel Orientation="Horizontal" >
-                            <StackPanel>
+                            <StackPanel Visibility="{Binding RtDataValues[LP1.CassettePlaced],Converter={StaticResource boolToVisibility2}}">
                                 <TextBox Background="{DynamicResource Table_BG_Title}"  Text="LP1" Width="Auto" Height="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                                      IsReadOnly="True" FontSize="10"/>
                                 <ctrls:FOUPFrontView UnitData="{Binding LP1ModuleInfo}"
@@ -117,7 +117,7 @@
 
 
                             </StackPanel>
-                            <StackPanel>
+                            <StackPanel Visibility="{Binding RtDataValues[LP2.CassettePlaced],Converter={StaticResource boolToVisibility2}}">
                                 <TextBox Background="{DynamicResource Table_BG_Title}" Text="LP2" Width="Auto" Height="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                                      IsReadOnly="True" FontSize="10"/>
                                 <ctrls:FOUPFrontView UnitData="{Binding LP2ModuleInfo}" 
@@ -139,7 +139,7 @@
 
                             </StackPanel>
 
-                            <StackPanel>
+                            <StackPanel Visibility="{Binding RtDataValues[LP1.CassettePlaced],Converter={StaticResource boolToVisibility2}}">
                                 <TextBox Background="{DynamicResource Table_BG_Title}" Text="LP3" Width="Auto" Height="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                                      IsReadOnly="True" FontSize="10"/>
                                 <ctrls:FOUPFrontView UnitData="{Binding LP3ModuleInfo}" 
@@ -160,7 +160,7 @@
 
 
                             </StackPanel>
-                            <StackPanel>
+                            <StackPanel Visibility="{Binding RtDataValues[Dummy1.CassettePlaced],Converter={StaticResource boolToVisibility2}}">
                                 <TextBox Background="{DynamicResource Table_BG_Title}" Text="Dummy1" Width="Auto" Height="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                                      IsReadOnly="True" FontSize="10"/>
                                 <ctrls:FOUPFrontView UnitData="{Binding Dummy1ModuleInfo}" 
@@ -174,7 +174,7 @@
                                     </TextBlock.Text>
                                 </TextBlock>
                             </StackPanel>
-                            <StackPanel>
+                            <StackPanel Visibility="{Binding RtDataValues[Dummy2.CassettePlaced],Converter={StaticResource boolToVisibility2}}">
                                 <TextBox Background="{DynamicResource Table_BG_Title}" Text="Dummy2" Width="Auto" Height="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                                      IsReadOnly="True" FontSize="10"/>
                                 <ctrls:FOUPFrontView UnitData="{Binding Dummy2ModuleInfo}"

+ 186 - 1
CyberX8_RT/Modules/EFEM/CycleRobotCycleNewRoutine.cs

@@ -1,9 +1,12 @@
 using Aitex.Core.Common;
+using Aitex.Core.RT.Device;
 using Aitex.Core.RT.Log;
 using Aitex.Core.RT.Routine;
 using Aitex.Core.Util;
 using CyberX8_Core;
+using CyberX8_RT.Devices.AXIS;
 using CyberX8_RT.Devices.EFEM;
+using CyberX8_RT.Modules.LPs;
 using CyberX8_RT.Modules.Rinse;
 using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.Routine;
@@ -15,6 +18,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static Mono.Security.X509.X520;
 
 namespace CyberX8_RT.Modules.EFEM
 {
@@ -57,6 +61,10 @@ namespace CyberX8_RT.Modules.EFEM
             {
                 _sequences.Add((ModuleName)Enum.Parse(typeof(ModuleName), item));
             }
+            if(!CheckRobotCyclePreCondiction(_sequences))
+            {
+                return RState.Failed;
+            }
             _cycleTimes=(int)objs[1];
             _alignerAngle = (int)objs[2];
             _actions = new List<EfemCycleAction>();
@@ -66,7 +74,6 @@ namespace CyberX8_RT.Modules.EFEM
                 LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Input Robot Cycle Times{_cycleTimes} error");
                 return RState.Failed;
             }
-            
             return Runner.Start(Module, "Start CycleRobotCycleRoutine");
         }
         private void GenerateCycleAction()
@@ -194,6 +201,184 @@ namespace CyberX8_RT.Modules.EFEM
         {
             return _currentCycle;
         }
+        private bool CheckRobotCyclePreCondiction(List<ModuleName> lists)
+        {
+            bool result = true;
+            //Robot
+            if (!CheckRobotStatus()) 
+            {
+                return false;
+            }
+            //LP
+            if(lists.Contains(ModuleName.LP1))
+            {
+                if (!CheckLoadPortStatus(ModuleName.LP1))
+                {
+                    return false;
+                };
+            }
+            else if (lists.Contains(ModuleName.LP2))
+            {
+                if (!CheckLoadPortStatus(ModuleName.LP2))
+                {
+                    return false;
+                };
+            }
+            else
+            {
+                if (!CheckLoadPortStatus(ModuleName.LP2))
+                {
+                    return false;
+                };
+            }
+            //Dummy
+            if (lists.Contains(ModuleName.Dummy1))
+            {
+                if (!CheckDummyStatus(ModuleName.Dummy1))
+                {
+                    return false;
+                };
+            }
+            else if(lists.Contains(ModuleName.Dummy2))
+            {
+                if (!CheckDummyStatus(ModuleName.Dummy2))
+                {
+                    return false;
+                };
+            }
+            //Puf
+            if (lists.Contains(ModuleName.PUF1) && !CheckPufStatus(ModuleName.PUF1))
+            {
+                return false ;
+            }
+            //Srd
+            if (lists.Contains(ModuleName.SRD1))
+            {
+                if (!CheckSrdStatus(ModuleName.SRD1))
+                {
+                    return false;
+                };
+            }
+            else if(lists.Contains(ModuleName.SRD2))
+            {
+                if (!CheckSrdStatus(ModuleName.SRD2))
+                {
+                    return false;
+                };
+            }
+            return result;
+        }
+        //检查robot状态
+        private bool CheckRobotStatus()
+        {
+            bool result = true;
+            if (WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
+            {
+                Stop($"Efem robot arm already has a wafer, cannot do the RobotCycle action");
+                result =  false;
+            }
+            return result;
+        }
+        //检查loadport状态
+        private bool CheckLoadPortStatus(ModuleName loadpoartName)
+        {
+            bool result = true;
+            
+            if (ModuleHelper.IsInstalled(loadpoartName))
+            {
+                Loadport loadPort = GetLoadPort(loadpoartName);
+                if (loadPort == null)
+                {
+                    Stop($"{loadpoartName} is null");
+                    return false;
+                }
+                WaferInfo[] waferInfos = WaferManager.Instance.GetWafers(loadpoartName);
+                if (waferInfos.Length < 1)
+                {
+                    Stop($"there is no wafer in {loadpoartName}");
+                    return false;
+                }
+            }
+            else
+            {
+                Stop($"{loadpoartName} is not installed");
+                return false;
+            }
+            return result;
+        }
+        private Loadport GetLoadPort(ModuleName station)
+        {
+            LoadPortModule loadPortModule = Singleton<RouteManager>.Instance.EFEM.GetLoadportModule(station - ModuleName.LP1);
+            return loadPortModule.LPDevice;
+        }
+        //Dummy状态判断
+        private bool CheckDummyStatus(ModuleName dummyName)
+        {
+            bool result = true;
+            if (!ModuleHelper.IsInstalled(dummyName))
+            {
+                Stop($"{dummyName} is not installed");
+                return false;
+            }
+            //若dummy存在wafer,需要人工处理
+            DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(dummyName - ModuleName.Dummy1);
+            if (dummyDevice != null)
+            {
+                if (!dummyDevice.HasCassette)
+                {
+                    Stop($"{dummyName} dose not have cassette");
+                    return false;
+                }
+                WaferInfo[] waferInfos = WaferManager.Instance.GetWafers(dummyName);
+                if (waferInfos.Length > 0)
+                {
+                    foreach (var item in waferInfos)
+                    {
+                        if (item != null && !item.IsEmpty)
+                        {
+                            Stop($"There are wafers inside the {dummyName},cannot do the RobotCycle action");
+                            return false;
+                        }
+                    }
+                }
+            }
+            return result;
+        }
+        //检查puf
+        private bool CheckPufStatus(ModuleName pufName)
+        {
+            bool result = true;
+            if (!ModuleHelper.IsInstalled(pufName))
+            {
+                Stop($"{pufName} is not install");
+                return false;
+            }
+            JetAxisBase puf1RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Rotation");
+            if (puf1RotationAxis == null)
+            {
+                Stop("Puf1 Rotation Axis is null");
+                return false;
+            }
+            double puf1RotationPosition = puf1RotationAxis.MotionData.MotorPosition;
+            if ( !puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Robot"))
+            {
+                Stop($"PUF1 Rotation {puf1RotationPosition} is not in Robot");
+                return false;
+            }
+            return result;
+        }
+        //检查srd
+        private bool CheckSrdStatus(ModuleName SrdName)
+        { 
+            bool result = true;
+            if (!ModuleHelper.IsInstalled(SrdName))
+            {
+                Stop($"{SrdName} is not install");
+                return false;
+            }
+
+            return result;
+        }
     }
 }