1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using WCS.Core;
- using WCS.Entity.Protocol.BCR;
- using WCS.Entity.Protocol.SRM;
- using WCS.Entity.Protocol.Station;
- using WCS.WorkEngineering.Extensions;
- using WCS.WorkEngineering.Worlds;
- namespace WCS.WorkEngineering.Systems
- {
- /// <summary>
- /// 设备信息读取接口
- /// </summary>
- [BelongTo(typeof(MainWorld))]
- public class GetDeviceSystem : ServiceSystem<Tuple<string, string>, object>
- {
- /// <summary>
- /// 所有的站台
- /// </summary>
- private List<Station> Convs;
- private List<SRM> Srms;
- private List<BCR> Bcrs;
- private List<Device<IStation523>> Device91;
- /// <summary>
- /// 构造函数
- /// </summary>
- public GetDeviceSystem()
- {
- //Convs = Device.All.Where(v => v.HasProtocol<IStation523>()).Select(v => new Station(v, this.World)).ToList();
- Srms = Device.All.Where(v => v.HasProtocol<ISRM520>()).Select(v => new SRM(v, this.World)).ToList();
- Bcrs = Device.All.Where(v => v.HasProtocol<IBCR81>()).Select(v => new BCR(v, this.World)).ToList();
- Device91 = Device.All.Where(v => v.HasProtocol<IStation523>()).Select(v => new Device<IStation523>(v, this.World)).ToList();
- }
- protected override object Do(Tuple<string, string> tuple)
- {
- switch (tuple.Item1)
- {
- case "堆垛机":
- return Srms;
- case "输送机":
- return Convs;
- case "读码器":
- var b = Bcrs.FirstOrDefault(v => v.Entity.Code == tuple.Item2).Data.Content;
- var a = Bcrs.FirstOrDefault(v => v.Entity.Code == tuple.Item2).GetBCRCode();
- return Bcrs.FirstOrDefault(v => v.Entity.Code == tuple.Item2).GetBCRCode();
- case "外检":
- return Device91;
- default: return "未知设备类型";
- }
- //if (code.Contains("SRM")) return Device.All.Where(v => v.Code == code).Select(v => new SRM(v, this.World)).ToList();
- //else if (code.Contains("BCR")) return Device.All.Where(v => v.Code == code).Select(v => new BCR(v, this.World)).ToList();
- //else if (code.Contains("D91")) return Device.All.Where(v => v.Code == code).Select(v => new Device<IStation523>(v, this.World)).ToList();
- //return Device.All.Where(v => v.Code == code).Select(v => new Station(v, this.World)).ToList();
- }
- }
- }
|