ToolLoader.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Aitex.Common.Util;
  5. using Aitex.Core.Account;
  6. using Aitex.Core.RT.ConfigCenter;
  7. using Aitex.Core.RT.DataCenter;
  8. using Aitex.Core.RT.DataCollection;
  9. using Aitex.Core.RT.DBCore;
  10. using Aitex.Core.RT.Event;
  11. using Aitex.Core.RT.Log;
  12. using Aitex.Core.RT.OperationCenter;
  13. using Aitex.Core.RT.RecipeCenter;
  14. using Aitex.Core.Util;
  15. using Aitex.Core.WCF;
  16. using MECF.Framework.Common.Account;
  17. using MECF.Framework.Common.Equipment;
  18. using MECF.Framework.Common.IOCore;
  19. using MECF.Framework.Common.RecipeCenter;
  20. using MECF.Framework.Common.SCCore;
  21. using MECF.Framework.Common.SubstrateTrackings;
  22. using MECF.Framework.RT.Core.Applications;
  23. using MECF.Framework.RT.Core.Backend;
  24. using MECF.Framework.RT.Core.IoProviders;
  25. using Venus_RT.Modules;
  26. //using VirgoCommon;
  27. using Venus_RT.Backends;
  28. using Venus_RT.HostWrapper;
  29. //using Venus_RT.Modules;
  30. using Venus_RT.Modules.PMs;
  31. using MECF.Framework.Common.OperationCenter;
  32. using MECF.Framework.Common.DataCenter;
  33. namespace Venus_RT.Instances
  34. {
  35. class ToolLoader : IRtLoader
  36. {
  37. public void Initialize()
  38. {
  39. //WcfServiceManager.Instance.Initialize(new Type[]
  40. // {
  41. // typeof (AccountService), typeof (InvokeService),
  42. // typeof (QueryDataService),typeof (RecipeService)
  43. // });
  44. WcfServiceManager.Instance.Initialize(new Type[]
  45. {
  46. typeof (RecipeService)
  47. });
  48. Singleton<LogManager>.Instance.Initialize();
  49. Singleton<ConfigManager>.Instance.Initialize();
  50. //Singleton<DatabaseManager>.Instance.Initialize(
  51. // System.Configuration.ConfigurationManager.ConnectionStrings["PostgreSQL"].ConnectionString
  52. // , RtInstance.DatabaseName
  53. // , PathManager.GetCfgDir() + "DBModel.sql");
  54. //Singleton<EventManager>.Instance.Initialize(PathManager.GetCfgDir() + "EventDefine.xml");
  55. //Singleton<OperationManager>.Instance.Initialize();
  56. //Singleton<DataManager>.Instance.Initialize();
  57. RecipeFileManager.Instance.Initialize(new VirgoRecipeFileContext(), new VirgoSequenceFileContext(), true);
  58. Singleton<SystemConfigManager>.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg");
  59. //IoProviderManager.Instance.Initialize(PathManager.GetCfgDir() + "IoProviderConfig.xml");
  60. //IoManager.Instance.Initialize(PathManager.GetCfgDir() + "Interlock.Virgo.xml");
  61. //WaferManager.Instance.Initialize();
  62. //AccountExManager.Instance.Initialize(true);
  63. // Device manager
  64. //Singleton<DeviceManager>.Instance.Initialize();
  65. //Singleton<DeviceEntity>.Instance.Initialize();
  66. //Singleton<FaManager>.Instance.Initialize();
  67. //DataCollectionManager.Instance.Initialize(RtInstance.DatabaseName);
  68. RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView());
  69. RtSystemManager.Instance.AddCustomBackend("IO", new IOView());
  70. RtSystemManager.Instance.AddCustomBackend("FSM", new FSMView());
  71. //Singleton<RouteManager>.Instance.Initialize();
  72. //Singleton<EventManager>.Instance.FireEvent += InstanceOnOnEvent;
  73. string s1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.Combine(PathManager.GetAppDir(), "Venus_RT.exe")).ProductVersion;
  74. LOG.Info($"Venus_RT {s1} succeed to Launch");
  75. }
  76. private void InstanceOnOnEvent(EventItem obj)
  77. {
  78. if (obj.Level != EventLevel.Alarm)
  79. {
  80. Singleton<FaManager>.Instance.NotifyEvent(obj.EventEnum, obj.DVID, obj.ObjDVID);
  81. }
  82. else
  83. {
  84. Singleton<FaManager>.Instance.NotifyAlarm(obj.EventEnum, obj.DVID, obj.ObjDVID, obj.Description);
  85. }
  86. }
  87. public void Terminate()
  88. {
  89. Singleton<DeviceEntity>.Instance.Terminate();
  90. Singleton<DeviceManager>.Instance.Terminate();
  91. Singleton<FaManager>.Instance.Terminate();
  92. IoProviderManager.Instance.Terminate();
  93. Singleton<SystemConfigManager>.Instance.Terminate();
  94. DataCollectionManager.Instance.Terminate();
  95. Singleton<WcfServiceManager>.Instance.Terminate();
  96. Singleton<EventManager>.Instance.Terminate();
  97. Singleton<LogManager>.Instance.Terminate();
  98. Singleton<DatabaseManager>.Instance.Terminate();
  99. }
  100. }
  101. }