ToolLoader.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 SorterRT.Modules;
  26. using VirgoCommon;
  27. using VirgoRT.Backends;
  28. using VirgoRT.HostWrapper;
  29. using VirgoRT.Modules;
  30. using VirgoRT.Modules.PMs;
  31. namespace VirgoRT.Instances
  32. {
  33. class ToolLoader : IRtLoader
  34. {
  35. public void Initialize()
  36. {
  37. Singleton<LogManager>.Instance.Initialize();
  38. Singleton<ConfigManager>.Instance.Initialize();
  39. Singleton<DatabaseManager>.Instance.Initialize(
  40. System.Configuration.ConfigurationManager.ConnectionStrings["PostgreSQL"].ConnectionString
  41. , RtInstance.DatabaseName
  42. , PathManager.GetCfgDir() + "DBModel.sql");
  43. Singleton<EventManager>.Instance.Initialize(PathManager.GetCfgDir() + "EventDefine.xml");
  44. Singleton<OperationManager>.Instance.Initialize();
  45. Singleton<SystemConfigManager>.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg");
  46. Singleton<DataManager>.Instance.Initialize();
  47. RecipeFileManager.Instance.Initialize(new VirgoRecipeFileContext(), new VirgoSequenceFileContext(), true);
  48. IoProviderManager.Instance.Initialize(PathManager.GetCfgDir() + "IoProviderConfig.xml");
  49. IoManager.Instance.Initialize(PathManager.GetCfgDir() + "Interlock.Virgo.xml");
  50. WaferManager.Instance.Initialize();
  51. AccountExManager.Instance.Initialize(true);
  52. // Device manager
  53. Singleton<DeviceManager>.Instance.Initialize();
  54. Singleton<DeviceEntity>.Instance.Initialize();
  55. Singleton<FaManager>.Instance.Initialize();
  56. DataCollectionManager.Instance.Initialize(RtInstance.DatabaseName);
  57. RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView());
  58. RtSystemManager.Instance.AddCustomBackend("IO", new IOView());
  59. RtSystemManager.Instance.AddCustomBackend("FSM", new FSMView());
  60. Singleton<RouteManager>.Instance.Initialize();
  61. Singleton<EventManager>.Instance.FireEvent += InstanceOnOnEvent;
  62. //Singleton<RouteManager>.Instance.Initialize();
  63. string s1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.Combine(PathManager.GetAppDir(), "VirgoRT.exe")).ProductVersion;
  64. LOG.Info($"VirgoRT {s1} succeed to Launch");
  65. }
  66. private void InstanceOnOnEvent(EventItem obj)
  67. {
  68. if (obj.Level != EventLevel.Alarm)
  69. {
  70. Singleton<FaManager>.Instance.NotifyEvent(obj.EventEnum, obj.DVID, obj.ObjDVID);
  71. }
  72. else
  73. {
  74. Singleton<FaManager>.Instance.NotifyAlarm(obj.EventEnum, obj.DVID, obj.ObjDVID, obj.Description);
  75. }
  76. }
  77. public void Terminate()
  78. {
  79. Singleton<DeviceEntity>.Instance.Terminate();
  80. Singleton<DeviceManager>.Instance.Terminate();
  81. Singleton<FaManager>.Instance.Terminate();
  82. IoProviderManager.Instance.Terminate();
  83. Singleton<SystemConfigManager>.Instance.Terminate();
  84. DataCollectionManager.Instance.Terminate();
  85. Singleton<WcfServiceManager>.Instance.Terminate();
  86. Singleton<EventManager>.Instance.Terminate();
  87. Singleton<LogManager>.Instance.Terminate();
  88. Singleton<DatabaseManager>.Instance.Terminate();
  89. }
  90. }
  91. }