StatesImp.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Log;
  7. using MECF.Framework.Common.DataCenter;
  8. using OpenSEMI.ClientBase.Handlers;
  9. namespace VirgoUI.Client.Models.Sys
  10. {
  11. public class StatesImp
  12. {
  13. public StatesImp(IQueryDataService dataService)
  14. {
  15. DataService = dataService;
  16. //all states list for the system
  17. this.Keys = new List<string>()
  18. {
  19. "Aligner.Status",
  20. "LP1.Status",
  21. "LP2.Status",
  22. "EFEM.Status",
  23. "LLA.Status",
  24. "LLB.Status",
  25. "TM.Status",
  26. "PM1.Status",
  27. "PM2.Status",
  28. "PM3.Status",
  29. "PM4.Status",
  30. "PM5.Status",
  31. "PM6.Status",
  32. "Rt.Status",
  33. "Fa.Status",
  34. "EfemRobot.BladeTarget",
  35. "EfemRobot.Arm1Extended",
  36. "EfemRobot.Arm2Extended",
  37. "TmRobot.BladeTarget",
  38. };
  39. }
  40. public List<State> GetStates(List<string> keys)
  41. {
  42. try
  43. {
  44. List<State> states = new List<State>();
  45. if (this.DataService.PollData(keys) != null)
  46. {
  47. this.DataService.PollData(keys).ToList().ForEach(kv =>
  48. {
  49. if (kv.Value != null)
  50. states.Add(new State() { Key = kv.Key, DisplayValue = kv.Value.ToString() });
  51. });
  52. }
  53. return states;
  54. }
  55. catch (Exception e)
  56. {
  57. LOG.Write(e);
  58. return null;
  59. }
  60. }
  61. public List<string> Keys { get; private set; }
  62. private IQueryDataService DataService;
  63. }
  64. }