Browse Source

1.Recipe 添加给eap recipe的内容
2。efem 界面功能优化

lixiang 11 months ago
parent
commit
5a4c70257b

+ 34 - 0
Venus/Venus_Core/Recipe.cs

@@ -7,6 +7,7 @@ using System.IO;
 using System.Linq;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Converters;
+using Newtonsoft.Json.Linq;
 using Venus_Core.Attributes;
 
 namespace Venus_Core
@@ -250,6 +251,7 @@ namespace Venus_Core
 
         private int m_StepNo = 1;
         [IsOnlyRead]
+        [JsonIgnore]
         public int StepNo
         {
             get { return m_StepNo; }
@@ -571,6 +573,38 @@ namespace Venus_Core
             return recipe;
         }
 
+
+        public static string ShowEAPRecipe(string recipeContent, ObservableCollection<RecipeStep> Steps)
+        {
+            JObject jobject = JObject.Parse(recipeContent);
+            JArray Firsttokenselect = jobject.SelectToken("Steps") as JArray;
+            if (Firsttokenselect != null)
+            {
+                foreach (JObject firstItem in Firsttokenselect)
+                {
+                    JArray Secondtokenselect = firstItem.SelectToken("LstUnit") as JArray;
+                    foreach (JObject secondItem in Secondtokenselect)
+                    {
+                        for (int i = 0; i < Steps.Count; i++)
+                        {
+                            for (int j = 0; j < Steps[i].LstUnit.Count; j++)
+                            {
+                                Type type = Steps[i].LstUnit[j].GetType();
+                                foreach (var propertyInfo in type.GetProperties())
+                                {
+                                    object[] toleranceAttrs = propertyInfo.GetCustomAttributes(typeof(IsTolerance), true);
+                                    if (toleranceAttrs.Length > 0)
+                                    {
+                                        secondItem.Remove(propertyInfo.Name);
+                                    }
+                                }
+                            } 
+                        }
+                    }
+                }
+            }
+            return jobject.ToString();
+        }
         public bool Validate()
         {
             return true;

+ 1 - 51
Venus/Venus_MainPages/ViewModels/EfemViewModel.cs

@@ -543,57 +543,7 @@ namespace Venus_MainPages.ViewModels
                     PlaceSoltSelectedIndex = 0;
                     break;
 
-                //case "Extend":
-                //    ExtendSoltItemsSource.Clear();
-                //    switch (ExtendSelectedModule)
-                //    {
-                //        case EFEMModule.LLA:
-                //        case EFEMModule.LLB:
-                //            ExtendSoltItemsSource.Add(1);
-                //            ExtendSoltItemsSource.Add(2);
-                //            break;
-                //        case EFEMModule.LP1:
-                //        case EFEMModule.LP2:
-                //        case EFEMModule.LP3:
-
-                //            for (int i = 1; i < 26; i++)
-                //            {
-                //                ExtendSoltItemsSource.Add(i);
-                //            }
-                //            break;
-
-                //        default:
-                //            ExtendSoltItemsSource.Add(1);
-                //            break;
-                //    }
-                //    ExtendSoltSelectedIndex = 0;
-                //    break;
-
-                //case "Retract":
-                //    RetractSoltItemsSource.Clear();
-                //    switch (RetractSelectedModule)
-                //    {
-                //        case EFEMModule.LLA:
-                //        case EFEMModule.LLB:
-                //            RetractSoltItemsSource.Add(1);
-                //            RetractSoltItemsSource.Add(2);
-                //            break;
-                //        case EFEMModule.LP1:
-                //        case EFEMModule.LP2:
-                //        case EFEMModule.LP3:
-
-                //            for (int i = 1; i < 26; i++)
-                //            {
-                //                RetractSoltItemsSource.Add(i);
-                //            }
-                //            break;
-
-                //        default:
-                //            RetractSoltItemsSource.Add(1);
-                //            break;
-                //    }
-                //    RetractSoltSelectedIndex = 0;
-                //    break;
+              
             }
 
         }

+ 27 - 1
Venus/Venus_MainPages/ViewModels/RecipeViewModel.cs

@@ -6,10 +6,12 @@ using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.OperationCenter;
 using Microsoft.VisualBasic;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Prism.Commands;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -234,8 +236,29 @@ namespace Venus_MainPages.ViewModels
                 di.Create();
             }
             //File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(CurrentRecipe),Encoding.UTF8);
-            SaveRecipe(CurrentRecipe.Header.Name, CurrentRecipe.Header.Type.ToString(), RecipeUnity.RecipeToString(CurrentRecipe));
+
+            string recipeContent = RecipeUnity.RecipeToString(CurrentRecipe);
+            SaveRecipe(CurrentRecipe.Header.Name, CurrentRecipe.Header.Type.ToString(), recipeContent);
             LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
+
+            SaveEAPRecipe(recipeContent, CurrentRecipe.Steps);
+
+        }
+
+        private void SaveEAPRecipe(string recipeContent, ObservableCollection<RecipeStep> Steps)
+        {
+            if (currentChamber == JetChamber.Kepler2200A || currentChamber == JetChamber.Kepler2200B)
+            {
+                var newrecipePath2 = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, $"{typeFolder}_EAP", CurrentRecipeName + ".rcp");
+                FileInfo fi2 = new FileInfo(newrecipePath2);
+                var di2 = fi2.Directory;
+                if (!di2.Exists)
+                {
+                    di2.Create();
+                }
+                var newContent = Recipe.ShowEAPRecipe(recipeContent, CurrentRecipe.Steps);
+                File.WriteAllText(newrecipePath2, newContent, Encoding.UTF8);
+            }     
         }
         private void OnSaveToRecipe(object obj)
         {
@@ -1530,6 +1553,9 @@ namespace Venus_MainPages.ViewModels
                 }
                 bodyStackPanel.Children.Add(deChuckGrid);
             }
+
+            string recipeContent = RecipeUnity.RecipeToString(CurrentRecipe);
+            SaveEAPRecipe(recipeContent, CurrentRecipe.Steps);
         }
 
         private void OnDeleteStep(int index)

File diff suppressed because it is too large
+ 376 - 394
Venus/Venus_MainPages/Views/EfemView.xaml


+ 78 - 0
Venus/Venus_RT/Modules/LPs/LoadPortDockRoutine.cs

@@ -0,0 +1,78 @@
+using System;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.SCCore;
+using MECF.Framework.Common.Equipment;
+using Venus_Core;
+
+namespace Venus_RT.Modules.LPs
+{
+    class LoadPortDockRoutine : ModuleRoutineBase, IRoutine
+    {
+        enum RoutineStep
+        {
+            WaitEFEMIdle,
+            Dock,
+            End,
+        }
+
+        private int _timeout = 0;
+
+        private LoadPortModule _lpModule;
+        public LoadPortDockRoutine(LoadPortModule lpModule) : base(ModuleHelper.Converter(lpModule.Module))
+        {
+            _lpModule = lpModule;
+
+            Name = "Dock";
+        }
+
+
+        public RState Start(params object[] objs)
+        {
+            Reset();
+
+            _timeout = SC.GetValue<int>("EFEM.LoadPort.MotionTimeout");
+
+            Notify($"Start");
+
+            return Runner.Start(Module, Name);
+        }
+
+
+        public RState Monitor()
+        {
+            Runner.Wait(RoutineStep.WaitEFEMIdle, () => _lpModule.IsRobotIdle, _delay_60s)
+                    .Run(RoutineStep.Dock, Dock, CheckDevice, _timeout * 1000)
+                    .End(RoutineStep.End, NullFun, _delay_1s);
+
+            return Runner.Status;
+        }
+
+
+        public bool Dock()
+        {
+            Notify($"Start unclamp {_lpModule.LPDevice.Module}");
+            _lpModule.LPDevice.Dock();
+
+            return true;
+        }
+
+        bool CheckDevice()
+        {
+            if (_lpModule.LPDevice.IsError)
+                return false;
+
+            if (_lpModule.LPDevice.IsBusy)
+                return false;
+
+            return true;
+        }
+
+        public void Abort()
+        {
+
+        }
+
+    }
+}

+ 14 - 15
Venus/Venus_RT/Modules/LPs/LoadPortModule.cs

@@ -118,7 +118,10 @@ namespace Venus_RT.Modules.LPs
         private LoadPortReadTagDataRoutine _readTag;
         private LoadPortWriteTagDataRoutine _writeTag;
         private LoadPortUnclampRoutine _unclamp;
-        //private LoadPortUndockRoutine _undock;
+
+        private LoadPortDockRoutine _dock;
+        private LoadPortUnDockRoutine _undock;
+
         private LoadPortLoadRoutine _load;
         private LoadPortUnloadRoutine _unload;
 
@@ -170,7 +173,7 @@ namespace Venus_RT.Modules.LPs
             _home = new LoadPortHomeRoutine(this);
             //_closeDoor = new LoadPortCloseDoorRoutine(this);
             _clamp = new LoadPortClampRoutine(this);
-            //_dock = new LoadPortDockRoutine(this);
+            _dock = new LoadPortDockRoutine(this);
             //_map = new LoadPortMapRoutine(this);
             //_openDoor = new LoadPortOpenDoorRoutine(this);
             _readCarrierId = new LoadPortReadCarrierIdRoutine(this);
@@ -178,7 +181,7 @@ namespace Venus_RT.Modules.LPs
             _readTag = new LoadPortReadTagDataRoutine(this);
             _writeTag = new LoadPortWriteTagDataRoutine(this);
             _unclamp = new LoadPortUnclampRoutine(this);
-            //_undock = new LoadPortUndockRoutine(this);
+            _undock = new LoadPortUnDockRoutine(this);
             //_MapDT = new LoadPortGetMapInfoRoutine(this);
             _load = new LoadPortLoadRoutine(this);
             _unload = new LoadPortUnloadRoutine(this);
@@ -366,26 +369,22 @@ namespace Venus_RT.Modules.LPs
 
         private bool FsmStartUndock(object[] param)
         {
-            QueueRoutine.Clear();
-
-            QueueRoutine.Enqueue(_unload);
-
-            _clamp.IsUnloadClamp = true;
-             QueueRoutine.Enqueue(_clamp);
-
-             RState ret = StartRoutine();
-
+            RState ret = StartRoutine(_undock);
             if (ret == RState.Failed || ret == RState.End)
+            {
                 return false;
+            }
             return ret == RState.Running;
         }
 
         private bool FsmStartDock(object[] param)
         {
-            //Result ret = StartRoutine(_dock);
-            //if (ret == Result.FAIL || ret == Result.DONE)
+            RState ret = StartRoutine(_dock);
+            if (ret == RState.Failed || ret == RState.End)
+            { 
                 return false;
-            //return ret == Result.RUN;
+            }
+            return ret == RState.Running;
         }
 
         private bool FsmStartUnclamp(object[] param)

+ 78 - 0
Venus/Venus_RT/Modules/LPs/LoadPortUncDockRoutine.cs

@@ -0,0 +1,78 @@
+using System;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.SCCore;
+using MECF.Framework.Common.Equipment;
+using Venus_Core;
+
+namespace Venus_RT.Modules.LPs
+{
+    class LoadPortUnDockRoutine : ModuleRoutineBase, IRoutine
+    {
+        enum RoutineStep
+        {
+            WaitEFEMIdle,
+            UnDock,
+            End,
+        }
+
+        private int _timeout = 0;
+ 
+        private LoadPortModule _lpModule;
+        public LoadPortUnDockRoutine(LoadPortModule lpModule) : base(ModuleHelper.Converter(lpModule.Module))
+        {
+            _lpModule = lpModule;
+
+            Name = "UnDock";
+        }
+ 
+ 
+        public RState Start(params object[] objs)
+        {
+            Reset();
+
+            _timeout = SC.GetValue<int>("EFEM.LoadPort.MotionTimeout");
+
+            Notify($"Start");
+
+            return Runner.Start(Module, Name);
+        }
+
+
+        public RState Monitor()
+        {
+            Runner.Wait(RoutineStep.WaitEFEMIdle,       () => _lpModule.IsRobotIdle,    _delay_60s)
+                    .Run(RoutineStep.UnDock,           Unclamp,                        CheckDevice,    _timeout * 1000)
+                    .End(RoutineStep.End,               NullFun,                        _delay_1s);
+
+            return Runner.Status;
+        }
+
+
+        public bool Unclamp()
+        {
+            Notify($"Start unclamp {_lpModule.LPDevice.Module}");
+            _lpModule.LPDevice.Undock();
+
+            return true;
+        }
+
+        bool CheckDevice()
+        {
+            if (_lpModule.LPDevice.IsError)
+                return false;
+
+            if (_lpModule.LPDevice.IsBusy)
+                return false;
+
+            return true;
+        }
+
+        public void Abort()
+        {
+            
+        }
+ 
+    }
+}

+ 2 - 0
Venus/Venus_RT/Venus_RT.csproj

@@ -236,6 +236,8 @@
     <Compile Include="Devices\LzMatch_Ethercat.cs" />
     <Compile Include="Modules\DVIDName.cs" />
     <Compile Include="Modules\EntityErrorRaiseTrigger.cs" />
+    <Compile Include="Modules\LPs\LoadPortDockRoutine.cs" />
+    <Compile Include="Modules\LPs\LoadPortUncDockRoutine.cs" />
     <Compile Include="Modules\PMs\Fdc.cs" />
     <Compile Include="Modules\PMs\PMHeatRoutine.cs" />
     <Compile Include="Modules\PMs\VenusVentRoutine.cs" />