ToolLoader.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Common.Util;
  4. using Aitex.Core.RT.ConfigCenter;
  5. using Aitex.Core.RT.DataCenter;
  6. using Aitex.Core.RT.DataCollection;
  7. using Aitex.Core.RT.DBCore;
  8. using Aitex.Core.RT.Event;
  9. using Aitex.Core.RT.Log;
  10. using Aitex.Core.RT.OperationCenter;
  11. using Aitex.Core.RT.RecipeCenter;
  12. using Aitex.Core.Util;
  13. using Aitex.Core.WCF;
  14. using MECF.Framework.Common.Account;
  15. using MECF.Framework.Common.Communications;
  16. using MECF.Framework.Common.Equipment;
  17. using MECF.Framework.Common.FAServices;
  18. using MECF.Framework.Common.IOCore;
  19. using MECF.Framework.Common.SCCore;
  20. using MECF.Framework.Common.SubstrateTrackings;
  21. using MECF.Framework.RT.Core.Applications;
  22. using MECF.Framework.RT.Core.Backend;
  23. using MECF.Framework.RT.Core.IoProviders;
  24. using System.IO;
  25. using EfemDualRT.Equipments.Systems;
  26. using JetVirgoPM.PMs.RecipeExecutors;
  27. using Aitex.Core.RT.SCCore;
  28. using SecsGem.Core.Application;
  29. using Aitex.Core.RT.Device;
  30. using EfemDualRT.Resources;
  31. namespace EfemDualRT.Instances
  32. {
  33. class ToolLoader : IRtLoader
  34. {
  35. public void Initialize()
  36. {
  37. Singleton<LogManager>.Instance.Initialize();
  38. string s1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.Combine(PathManager.GetAppDir(), "EfemDualRT.exe")).ProductVersion;
  39. LOG.Write($"RT {s1} launch ...");
  40. Singleton<ConfigManager>.Instance.Initialize();
  41. Singleton<DatabaseManager>.Instance.Initialize(
  42. System.Configuration.ConfigurationManager.ConnectionStrings["PostgreSQL"].ConnectionString
  43. , RtInstance.DatabaseName
  44. , PathManager.GetCfgDir() + "DBModel.sql");
  45. Singleton<EventManager>.Instance.Initialize(PathManager.GetCfgDir() + "EventDefine.xml");
  46. Singleton<OperationManager>.Instance.Initialize();
  47. Singleton<SystemConfigManager>.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg");
  48. Singleton<LogManager>.Instance.InitLogDirectory();
  49. Singleton<DataManager>.Instance.Initialize();
  50. RecipeFileManager.Instance.Initialize(new JetVirgoPMRecipeFileContext());
  51. AccountExManager.Instance.Initialize(true);
  52. ConnectionManager.Instance.Initialize();
  53. WaferManager.Instance.Initialize();
  54. DataCollectionManager.Instance.Initialize( RtInstance.DatabaseName);
  55. RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView());
  56. Singleton<EfemDualEquipment>.Instance.Initialize();
  57. //Singleton<FAJobController>.Instance.Initialize(RtInstance.SystemName, SC.GetLPInstalledCount());
  58. //Singleton<FAJobController>.Instance.JobCallBack = Singleton<EfemDualEquipment>.Instance;
  59. SecGemApplication.Instance.Initialize(PathManager.GetCfgDir() + "EquipmentVariables.xml",3);
  60. SecGemApplication.Instance.EquipmentCommand = Singleton<EfemDualEquipment>.Instance;
  61. Singleton<EventManager>.Instance.SubscribeOperationAndData();
  62. Singleton<EventManager>.Instance.FireEvent += InstanceOnOnEvent;
  63. CustomFAEvents.Initialize();
  64. //VIDManager.Instance.Initialize(RtInstance.SystemName, false, true);
  65. Singleton<ResourceMonitor>.Instance.Initialize();
  66. }
  67. private void InstanceOnOnEvent(EventItem obj)
  68. {
  69. if (obj.Level != EventLevel.Alarm)
  70. {
  71. SecGemApplication.Instance.NotifyEvent(obj.EventEnum, obj.DVID, obj.ObjDVID);
  72. }
  73. else
  74. {
  75. SecGemApplication.Instance.NotifyAlarm(obj.EventEnum, obj.DVID, obj.ObjDVID);
  76. }
  77. }
  78. public void Terminate()
  79. {
  80. Singleton<ResourceMonitor>.Instance.Terminate();
  81. Singleton<EfemDualEquipment>.Instance.Terminate();
  82. DEVICE.Managers.ForEach(p=>p.Terminate());
  83. IoProviderManager.Instance.Terminate();
  84. Singleton<SystemConfigManager>.Instance.Terminate();
  85. DataCollectionManager.Instance.Terminate();
  86. Singleton<WcfServiceManager>.Instance.Terminate();
  87. Singleton<EventManager>.Instance.Terminate();
  88. Singleton<LogManager>.Instance.Terminate();
  89. Singleton<DatabaseManager>.Instance.Terminate();
  90. }
  91. }
  92. }