ToolLoader.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 MECF.Framework.FA.Core.CommonTypes;
  28. using MECF.Framework.FA.Core.FAControl;
  29. namespace EfemDualRT.Instances
  30. {
  31. class ToolLoader : IRtLoader
  32. {
  33. public void Initialize()
  34. {
  35. Singleton<LogManager>.Instance.Initialize();
  36. string s1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.Combine(PathManager.GetAppDir(), "EfemDualRT.exe")).ProductVersion;
  37. LOG.Write($"RT {s1} launch ...");
  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<DataManager>.Instance.Initialize();
  46. RecipeFileManager.Instance.Initialize(new JetVirgoPMRecipeFileContext());
  47. AccountExManager.Instance.Initialize(true);
  48. Singleton<SystemConfigManager>.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg");
  49. ConnectionManager.Instance.Initialize();
  50. WaferManager.Instance.Initialize();
  51. DataCollectionManager.Instance.Initialize( RtInstance.DatabaseName);
  52. RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView());
  53. Singleton<EfemDualEquipment>.Instance.Initialize();
  54. Singleton<FAJobController>.Instance.Initialize(RtInstance.SystemName, 3);
  55. Singleton<FAJobController>.Instance.JobCallBack = Singleton<EfemDualEquipment>.Instance;
  56. Singleton<EventManager>.Instance.SubscribeOperationAndData();
  57. Singleton<EventManager>.Instance.FireEvent += InstanceOnOnEvent;
  58. //VIDManager.Instance.Initialize(RtInstance.SystemName, false, true);
  59. }
  60. private void InstanceOnOnEvent(EventItem obj)
  61. {
  62. if (obj.Level != EventLevel.Alarm)
  63. {
  64. Singleton<FAJobController>.Instance.NotifyEvent(obj.EventEnum, obj.DVID, obj.ObjDVID);
  65. }
  66. else
  67. {
  68. Singleton<FAJobController>.Instance.NotifyAlarm(obj.EventEnum, obj.DVID, obj.ObjDVID);
  69. }
  70. }
  71. public void Terminate()
  72. {
  73. Singleton<SystemConfigManager>.Instance.Terminate();
  74. DataCollectionManager.Instance.Terminate();
  75. Singleton<WcfServiceManager>.Instance.Terminate();
  76. Singleton<EventManager>.Instance.Terminate();
  77. Singleton<LogManager>.Instance.Terminate();
  78. Singleton<DatabaseManager>.Instance.Terminate();
  79. }
  80. }
  81. }