ToolLoader.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.Device;
  11. using Aitex.Core.RT.Device.Unit;
  12. using Aitex.Core.RT.Event;
  13. using Aitex.Core.RT.Key;
  14. using Aitex.Core.RT.Log;
  15. using Aitex.Core.RT.OperationCenter;
  16. using Aitex.Core.RT.RecipeCenter;
  17. using Aitex.Core.Util;
  18. using Aitex.Core.WCF;
  19. using MECF.Framework.Common.Account;
  20. using MECF.Framework.Common.Equipment;
  21. using MECF.Framework.Common.IOCore;
  22. using MECF.Framework.Common.SCCore;
  23. using MECF.Framework.Common.SubstrateTrackings;
  24. using MECF.Framework.RT.Core.Applications;
  25. using MECF.Framework.RT.Core.Backend;
  26. using MECF.Framework.RT.Core.IoProviders;
  27. using SorterRT.Modules;
  28. using Virgo_DCommon;
  29. using Virgo_DRT.Backends;
  30. using Virgo_DRT.Modules;
  31. namespace Virgo_DRT.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<DataManager>.Instance.Initialize();
  46. RecipeFileManager.Instance.Initialize(null);
  47. Singleton<SystemConfigManager>.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg");
  48. IoProviderManager.Instance.Initialize(PathManager.GetCfgDir() + "IoProviderConfig.xml");
  49. IoManager.Instance.Initialize(PathManager.GetCfgDir() + "Interlock.Virgo_D.xml");
  50. WaferManager.Instance.Initialize();
  51. AccountExManager.Instance.Initialize(true);
  52. // Device manager
  53. Singleton<DeviceManager>.Instance.Initialize();
  54. Singleton<DeviceEntity>.Instance.Initialize();
  55. DataCollectionManager.Instance.Initialize(RtInstance.DatabaseName);
  56. KeyManager.Instance.Initialize(DEVICE.GetDevice<IoPlcDateTime>($"PMA.{Virgo_DDevice.PlcDateTime}"));
  57. RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView());
  58. RtSystemManager.Instance.AddCustomBackend("IO", new IOView());
  59. RtSystemManager.Instance.AddCustomBackend("FSM", new FSMView());
  60. RtSystemManager.Instance.AddCustomBackend("License", new LicenseView());
  61. Singleton<RouteManager>.Instance.Initialize();
  62. LOG.Info("Virgo_DRT succeed to Launch");
  63. }
  64. public void Terminate()
  65. {
  66. Singleton<DeviceEntity>.Instance.Terminate();
  67. Singleton<DeviceManager>.Instance.Terminate();
  68. IoProviderManager.Instance.Terminate();
  69. Singleton<SystemConfigManager>.Instance.Terminate();
  70. DataCollectionManager.Instance.Terminate();
  71. Singleton<WcfServiceManager>.Instance.Terminate();
  72. Singleton<EventManager>.Instance.Terminate();
  73. Singleton<LogManager>.Instance.Terminate();
  74. Singleton<DatabaseManager>.Instance.Terminate();
  75. }
  76. }
  77. }