GetDeviceSystem.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using WCS.Core;
  2. using WCS.Entity.Protocol.SRM;
  3. using WCS.Entity.Protocol.Station;
  4. using WCS.WorkEngineering.Extensions;
  5. using WCS.WorkEngineering.Protocol.BCR;
  6. using WCS.WorkEngineering.Worlds;
  7. namespace WCS.WorkEngineering.Systems
  8. {
  9. /// <summary>
  10. /// 设备信息写入接口
  11. /// </summary>
  12. [BelongTo(typeof(MainWorld))]
  13. public class GetDeviceSystem : ServiceSystem<string, object>
  14. {
  15. /// <summary>
  16. /// 所有的站台
  17. /// </summary>
  18. private List<Station> Convs;
  19. private List<SRM> Srms;
  20. private List<BCR> Bcrs;
  21. private List<Device<IStation523>> Device91;
  22. /// <summary>
  23. /// 构造函数
  24. /// </summary>
  25. public GetDeviceSystem()
  26. {
  27. Convs = Device.All.Where(v => v.HasProtocol<IStation523>()).Select(v => new Station(v, this.World)).ToList();
  28. Srms = Device.All.Where(v => v.HasProtocol<ISRM520>()).Select(v => new SRM(v, this.World)).ToList();
  29. Bcrs = Device.All.Where(v => v.HasProtocol<IBCR81>()).Select(v => new BCR(v, this.World)).ToList();
  30. Device91 = Device.All.Where(v => v.HasProtocol<IStation523>()).Select(v => new Device<IStation523>(v, this.World)).ToList();
  31. }
  32. protected override object Do(string info)
  33. {
  34. switch (info)
  35. {
  36. case "堆垛机":
  37. return Srms;
  38. case "输送机":
  39. return Convs;
  40. case "读码器":
  41. return Bcrs;
  42. case "外检":
  43. return Device91;
  44. default: return "未知设备类型";
  45. }
  46. }
  47. }
  48. }