Przeglądaj źródła

1.sequence和recipe修改日志输出格式
2.气缸增加信号反转输出日志

yangdb 1 rok temu
rodzic
commit
045eae5c75

+ 7 - 7
Venus/Framework/Common/RecipeCenter/DefaultRecipeFileContext.cs

@@ -3,6 +3,7 @@ using Aitex.Core.RT.Event;
 using Aitex.Core.RT.Log;
 using Aitex.Core.RT.RecipeCenter;
 using Aitex.Core.RT.SCCore;
+using MECF.Framework.Common.Equipment;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -190,17 +191,17 @@ namespace MECF.Framework.Common.RecipeCenter
 
         public void PostInfoEvent(string message)
         {
-            EV.PostMessage("System", EventEnum.GeneralInfo, message);
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, message);
         }
 
         public void PostWarningEvent(string message)
         {
-            EV.PostMessage("System", EventEnum.DefaultWarning, message);
+            LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, message);
         }
 
         public void PostAlarmEvent(string message)
         {
-            EV.PostMessage("System", EventEnum.DefaultAlarm, message);
+            LOG.Write(eEvent.ERR_SEQUENCE, ModuleName.System, message);
         }
 
         public void PostDialogEvent(string message)
@@ -210,21 +211,20 @@ namespace MECF.Framework.Common.RecipeCenter
 
         public void PostInfoDialogMessage(string message)
         {
-            EV.PostMessage("System", EventEnum.GeneralInfo, message);
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, message);
 
             EV.PostPopDialogMessage(EventLevel.Information, "System Information", message);
         }
 
         public void PostWarningDialogMessage(string message)
         {
-            EV.PostMessage("System", EventEnum.GeneralInfo, message);
-
+            LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, message);
             EV.PostPopDialogMessage(EventLevel.Warning, "System Warning", message);
         }
 
         public void PostAlarmDialogMessage(string message)
         {
-            EV.PostMessage("System", EventEnum.GeneralInfo, message);
+            LOG.Write(eEvent.ERR_SEQUENCE, ModuleName.System, message);
 
             EV.PostPopDialogMessage(EventLevel.Alarm, "System Alarm", message);
         }

+ 0 - 1
Venus/Framework/Common/RecipeCenter/DefaultSequenceFileContext.cs

@@ -48,7 +48,6 @@ namespace MECF.Framework.Common.RecipeCenter
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog("Recipe", "sequence file not valid, "+ex.Message);
                 return false;
             }
         }

+ 14 - 19
Venus/Framework/Common/RecipeCenter/RecipeFileManager.cs

@@ -4,6 +4,7 @@ using Aitex.Core.RT.Log;
 using Aitex.Core.Util;
 using Aitex.Core.Utilities;
 using Aitex.Core.WCF;
+using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.Properties;
 using MECF.Framework.Common.RecipeCenter;
 using System;
@@ -681,7 +682,7 @@ namespace Aitex.Core.RT.RecipeCenter
                 }
                 else
                 {
-                    EV.PostMessage("System", EventEnum.GeneralInfo, string.Format(Resources.RecipeFileManager_MoveRecipe_RecipeFile0MoveCompleted, recipeName));
+                    LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format(Resources.RecipeFileManager_MoveRecipe_RecipeFile0MoveCompleted, recipeName));
                 }
             }
             catch (Exception ex)
@@ -867,14 +868,13 @@ namespace Aitex.Core.RT.RecipeCenter
                 }
                 if (needValidation && !_seqContext.Validation(seq))
                 {
-                    EV.PostWarningLog(SourceModule, $"Read {sequenceName} failed, validation failed");
+                    LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"Read {sequenceName} failed, validation failed");
                     seq = string.Empty;
                 }
             }
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog(SourceModule, $"Read {sequenceName} failed, " + ex.Message);
                 seq = string.Empty;
             }
             return seq;
@@ -935,7 +935,6 @@ namespace Aitex.Core.RT.RecipeCenter
             catch(Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog(SourceModule, $"Read {sequenceName} failed, " + ex.Message);
                 seq = string.Empty;
             }
             return seq;
@@ -961,7 +960,6 @@ namespace Aitex.Core.RT.RecipeCenter
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog(SourceModule, "Get sequence list failed, " + ex.Message);
             }
 
             return result;
@@ -977,12 +975,11 @@ namespace Aitex.Core.RT.RecipeCenter
 
                 File.Delete(path);
 
-                EV.PostInfoLog(SourceModule, $"sequence {sequenceName} deleted");
+                LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, $"sequence {sequenceName} deleted");
             }
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog(SourceModule, $"delete {sequenceName} failed, " + ex.Message);
 
                 return false;
             }
@@ -1019,14 +1016,13 @@ namespace Aitex.Core.RT.RecipeCenter
                 }
                 else
                 {
-                    EV.PostInfoLog(SourceModule, $"Sequence {sequenceName} saved ");
+                    LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, $"Sequence {sequenceName} saved ");
                 }
             }
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
 
-                EV.PostWarningLog(SourceModule, $"save sequence {sequenceName} failed, " + ex.Message);
 
                 if (notifyUI)
                 {
@@ -1042,7 +1038,7 @@ namespace Aitex.Core.RT.RecipeCenter
             var path = GenerateSequenceFilePath(SequenceFolder, sequenceName);
             if (File.Exists(path))
             {
-                EV.PostWarningLog(SourceModule, $"save sequence {sequenceName} failed, already exist");
+                LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"save sequence {sequenceName} failed, already exist");
                 return false;
             }
             return SaveSequence(sequenceName, sequenceContent, false);
@@ -1058,20 +1054,19 @@ namespace Aitex.Core.RT.RecipeCenter
 
                 if (File.Exists(GenerateSequenceFilePath(SequenceFolder, newName)))
                 {
-                    EV.PostWarningLog(SourceModule, $"{newName} already exist, rename failed");
+                    LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"{newName} already exist, rename failed");
                     return false;
                 }
                 else
                 {
                     File.Move(path, GenerateSequenceFilePath(SequenceFolder, newName));
 
-                    EV.PostInfoLog(SourceModule, $"sequence {oldName} renamed to {newName}");
+                    LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, $"sequence {oldName} renamed to {newName}");
                 }
             }
             catch (Exception ex)
             {
                 LOG.WriteExeption(ex);
-                EV.PostWarningLog(SourceModule, $"rename {oldName} failed, " + ex.Message);
 
                 return false;
             }
@@ -1091,12 +1086,12 @@ namespace Aitex.Core.RT.RecipeCenter
             {
                 Directory.Delete(PathManager.GetRecipeDir() + SequenceFolder + "\\" + folderName, true);
 
-                EV.PostInfoLog(SourceModule, "Folder " + folderName + "deleted");
+                LOG.Write(eEvent.EV_SEQUENCE,ModuleName.System,  "Folder " + folderName + "deleted");
             }
             catch (Exception ex)
             {
                 //LOG.Write(ex, "delete sequence folder exception");
-                EV.PostWarningLog(SourceModule, $"can not delete folder {folderName}, {ex.Message}");
+                LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"can not delete folder {folderName}, {ex.Message}");
                 return false;
             }
             return true;
@@ -1108,12 +1103,12 @@ namespace Aitex.Core.RT.RecipeCenter
             {
                 Directory.CreateDirectory(PathManager.GetRecipeDir() + SequenceFolder + "\\" + folderName);
 
-                EV.PostInfoLog(SourceModule, "Folder " + folderName + "created");
+                LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, "Folder " + folderName + "created");
             }
             catch (Exception ex)
             {
                 //LOG.Write(ex, "sequence folder create exception");
-                EV.PostWarningLog(SourceModule, $"can not create folder {folderName}, {ex.Message}");
+                LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"can not create folder {folderName}, {ex.Message}");
                 return false;
             }
             return true;
@@ -1127,12 +1122,12 @@ namespace Aitex.Core.RT.RecipeCenter
                 string newPath = PathManager.GetRecipeDir() + SequenceFolder + "\\" + newName;
                 Directory.Move(oldPath, newPath);
 
-                EV.PostInfoLog(SourceModule, $"rename folder  from {oldName} to {newName}");
+                LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, $"rename folder  from {oldName} to {newName}");
             }
             catch (Exception ex)
             {
                 //LOG.Write(ex, "rename sequence folder failed");
-                EV.PostWarningLog(SourceModule, $"can not rename folder {oldName}, {ex.Message}");
+                LOG.Write(eEvent.WARN_SEQUENCE, ModuleName.System, $"can not rename folder {oldName}, {ex.Message}");
                 return false;
             }
             return true;

+ 25 - 41
Venus/Framework/Common/RecipeCenter/RecipeService.cs

@@ -6,6 +6,7 @@ using Aitex.Core.RT.Key;
 using Aitex.Core.RT.OperationCenter;
 using Aitex.Core.RT.RecipeCenter;
 using MECF.Framework.Common.Equipment;
+using Aitex.Core.RT.Log;
 
 namespace MECF.Framework.Common.RecipeCenter
 {
@@ -19,7 +20,7 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public string LoadRecipe(ModuleName chamId, string recipeName)
         {
-            EV.PostInfoLog(chamId.ToString(), string.Format("Read {0} recipe {1}。",chamId, recipeName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Read {0} recipe {1}", chamId, recipeName));
 
             return RecipeFileManager.Instance.LoadRecipe(chamId.ToString(), recipeName, false);
         }
@@ -32,13 +33,10 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool DeleteRecipe(ModuleName chamId, string recipeName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
             //if (!ChamberOperationService.IsSuperEnter()) return false;
-            EV.PostInfoLog(chamId.ToString(), string.Format("Delete {0} recipe {1}。",chamId, recipeName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Delete {0} recipe {1}", chamId, recipeName));
             return RecipeFileManager.Instance.DeleteRecipe(chamId.ToString(), recipeName);
         }
 
@@ -75,12 +73,9 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool RenameRecipe(ModuleName chamId, string oldName, string newName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Rename {0} recipe {1}为{2}。",chamId, oldName, newName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Rename {0} recipe {1}为{2}", chamId, oldName, newName));
             //if (!ChamberOperationService.IsSuperEnter()) return false;
             return RecipeFileManager.Instance.RenameRecipe(chamId.ToString(), oldName, newName);
         }
@@ -93,13 +88,10 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool DeleteFolder(ModuleName chamId, string folderName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
             //if (!ChamberOperationService.IsSuperEnter()) return false;
-            EV.PostInfoLog(chamId.ToString(), string.Format("Delete {0} recipe folder {1}。",chamId, folderName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Delete {0} recipe folder {1}", chamId, folderName));
             return RecipeFileManager.Instance.DeleteFolder(chamId.ToString(), folderName);
         }
 
@@ -112,12 +104,9 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Modify and save {0} recipe {1}。",chamId, recipeName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Modify and save {0} recipe {1}", chamId, recipeName));
             return RecipeFileManager.Instance.SaveRecipe(chamId.ToString(), recipeName, recipeContent, false, false);
         }
 
@@ -129,12 +118,9 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool MoveRecipeFile(ModuleName chamId, string recipeName, string tragetFolderName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Move {0} recipe {1}。", chamId, recipeName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Move {0} recipe {1}", chamId, recipeName));
             return RecipeFileManager.Instance.MoveRecipeFile(chamId.ToString(), recipeName, tragetFolderName, false, false);
         }
 
@@ -147,12 +133,9 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Modify and save as {0} recipe {1}。",chamId, recipeName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Modify and save as {0} recipe {1}", chamId, recipeName));
             return RecipeFileManager.Instance.SaveAsRecipe(chamId.ToString(), recipeName, recipeContent);
         }
 
@@ -164,12 +147,9 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool CreateFolder(ModuleName chamId, string folderName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Create {0} recipe foler {1}。",chamId, folderName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Create {0} recipe foler {1}", chamId, folderName));
             return RecipeFileManager.Instance.CreateFolder(chamId.ToString(), folderName);
         }
 
@@ -182,15 +162,19 @@ namespace MECF.Framework.Common.RecipeCenter
         /// <returns></returns>
         public bool RenameFolder(ModuleName chamId, string oldName, string newName)
         {
-            if (KeyManager.Instance.IsExpired)
-            {
-                EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
+            if (CheckSoftwareExpired())
                 return false;
-            }
-            EV.PostInfoLog(chamId.ToString(), string.Format("Rename {0} recipe folder {1} to {2}。",chamId, oldName, newName));
+            LOG.Write(eEvent.EV_SEQUENCE, ModuleName.System, string.Format("Rename {0} recipe folder {1} to {2}", chamId, oldName, newName));
             return RecipeFileManager.Instance.RenameFolder(chamId.ToString(), oldName, newName);
         }
 
+        private bool CheckSoftwareExpired()
+        {
+            bool isExpired = KeyManager.Instance.IsExpired;
+            if (isExpired)
+                LOG.Write(eEvent.WARN_SEQUENCE,ModuleName.System, "Software is expired. Can not do the operation");
+            return isExpired;
+        }
 
         /// <summary>
         /// get reactor's recipe format define file

+ 4 - 0
Venus/Venus_Core/EventDefine.cs

@@ -30,6 +30,9 @@ namespace Aitex.Core.RT.Log{
 		EV_WAFER_MOVED = 29,
 		EV_WAFER_CREATE = 30,
 		EV_WAFER_DELETE = 31,
+		EV_SEQUENCE = 32,
+		WARN_SEQUENCE = 33,
+		ERR_SEQUENCE = 34,
 		INFO_DEVICE_IO_HEATER = 1000,
 		WARN_DEVICE_IO_HEATER = 1001,
 		ERR_DEVICE_IO_HEATER = 1002,
@@ -60,6 +63,7 @@ namespace Aitex.Core.RT.Log{
 		WARN_Sensor = 1027,
 		ERR_Sensor = 1028,
 		INFO_FA = 1029,
+		INFO_IOCYLINDER = 1030,
 		ERR_TM = 2000,
 		INFO_TM = 2001,
 		WARN_TM = 2002,

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

@@ -261,6 +261,33 @@
     "Note": "Wafer Deleted"
   },
   {
+    "Id": 32,
+    "Level": "Info",
+    "LogEnum": "EV_SEQUENCE",
+    "GlobalDescription_zh": "{0}。",
+    "GlobalDescription_en": "{0}.",
+    "Module": "System",
+    "Note": "Sequence Info"
+  },
+  {
+    "Id": 33,
+    "Level": "Warning",
+    "LogEnum": "WARN_SEQUENCE",
+    "GlobalDescription_zh": "{0}。",
+    "GlobalDescription_en": "{0}.",
+    "Module": "System",
+    "Note": "Sequence Warning"
+  },
+  {
+    "Id": 34,
+    "Level": "Error",
+    "LogEnum": "ERR_SEQUENCE",
+    "GlobalDescription_zh": "{0}。",
+    "GlobalDescription_en": "{0}.",
+    "Module": "System",
+    "Note": "Sequence Failed"
+  },
+  {
     "Id": 1000,
     "Level": "Info",
     "LogEnum": "INFO_DEVICE_IO_HEATER",
@@ -532,6 +559,15 @@
     "Note": "FA INFO"
   },
   {
+    "Id": 1030,
+    "Level": "Info",
+    "LogEnum": "INFO_IOCYLINDER",
+    "GlobalDescription_zh": "{0}",
+    "GlobalDescription_en": "{0}",
+    "Module": "PM",
+    "Note": "Cylinder INFO"
+  },
+  {
     "Id": 2000,
     "Level": "Error",
     "LogEnum": "ERR_TM",

+ 37 - 0
Venus/Venus_RT/Devices/IODevices/IoCylinder.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using System.Xml;
 using Aitex.Core.Common.DeviceData;
 using Aitex.Core.RT.DataCenter;
@@ -23,6 +24,10 @@ namespace Venus_RT.Devices
         private readonly DeviceTimer _timer = new DeviceTimer();
         private readonly R_TRIG _trigReset = new R_TRIG();
         private readonly R_TRIG _trigError = new R_TRIG();
+        private readonly R_TRIG _trigCylinderStateError = new R_TRIG();
+        private readonly R_TRIG _trigCylinderStateOpen = new R_TRIG();
+        private readonly R_TRIG _trigCylinderStateClose = new R_TRIG();
+        private readonly R_TRIG _trigCylinderStateUnknown = new R_TRIG();
         private int m_SetPoint;
 
         public bool EnableOpen { get; set; }
@@ -44,6 +49,16 @@ namespace Venus_RT.Devices
 
         }
 
+        private void SetOtherCylinderStateRst(R_TRIG curTrig)
+        {
+            List<R_TRIG> list = new List<R_TRIG>() { _trigCylinderStateError, _trigCylinderStateOpen, _trigCylinderStateClose, _trigCylinderStateUnknown };
+            if (curTrig != null)
+            {
+                list.Remove(curTrig);
+            }
+            list.ForEach(p => p.RST = true);
+        }
+
         public CylinderState State
         {
             get
@@ -51,13 +66,33 @@ namespace Venus_RT.Devices
                 if (_diON != null && _diOFF != null)
                 {
                     if (ONFeedback && _diOFF.Value)
+                    {
+                        _trigCylinderStateError.CLK = ONFeedback && _diOFF.Value;
+                        if (_trigCylinderStateError.Q) LOG.Write(eEvent.INFO_IOCYLINDER, Module, $"{Module} {Name} cylinder state error");
+                        SetOtherCylinderStateRst(_trigCylinderStateError);
                         return CylinderState.Error;
+                    }
                     if (ONFeedback && !_diOFF.Value)
+                    {
+                        _trigCylinderStateOpen.CLK = ONFeedback && !_diOFF.Value;
+                        if (_trigCylinderStateOpen.Q) LOG.Write(eEvent.INFO_IOCYLINDER, Module, $"{Module} {Name} cylinder state open");
+                        SetOtherCylinderStateRst(_trigCylinderStateOpen);
                         return CylinderState.Open;
+                    } 
                     if (!ONFeedback && _diOFF.Value)
+                    {
+                        _trigCylinderStateClose.CLK = !ONFeedback && _diOFF.Value;
+                        if (_trigCylinderStateClose.Q) LOG.Write(eEvent.INFO_IOCYLINDER, Module, $"{Module} {Name} cylinder state close");
+                        SetOtherCylinderStateRst(_trigCylinderStateClose);
                         return CylinderState.Close;
+                    }
                     if (!ONFeedback && !_diOFF.Value)
+                    {
+                        _trigCylinderStateUnknown.CLK = !ONFeedback && !_diOFF.Value;
+                        if (_trigCylinderStateUnknown.Q) LOG.Write(eEvent.INFO_IOCYLINDER, Module, $"{Module} {Name} cylinder state unknown");
+                        SetOtherCylinderStateRst(_trigCylinderStateUnknown);
                         return CylinderState.Unknown;
+                    }
                 }
                 return CylinderState.Unknown;
             }
@@ -268,6 +303,8 @@ namespace Venus_RT.Devices
         {
             _trigReset.RST = true;
             _trigError.RST = true;
+
+            SetOtherCylinderStateRst(null);
         }
     }
 }