| | |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Drawing; |
| | |
| | | namespace WIDESEAWCS_QuartzJob |
| | | { |
| | | /// <summary> |
| | | /// 静态变脸存储区,可使用静态变量,也可注入使用 |
| | | /// 静态变量存储区,可使用静态变量,也可注入使用 |
| | | /// </summary> |
| | | public class Storage |
| | | { |
| | | /// <summary> |
| | | /// 已连接设备对象集合 |
| | | /// 已连接设备对象集合(线程安全) |
| | | /// </summary> |
| | | public static List<IDevice> Devices = new List<IDevice>(); |
| | | public static ConcurrentBag<IDevice> Devices = new ConcurrentBag<IDevice>(); |
| | | |
| | | /// <summary> |
| | | /// 设备对象 |
| | |
| | | /// <summary> |
| | | /// 获取设备 |
| | | /// </summary> |
| | | /// <param name="deviceCode"></param> |
| | | /// <returns></returns> |
| | | /// <param name="deviceCode">设备编码</param> |
| | | /// <returns>设备实例,未找到返回 null</returns> |
| | | public IDevice? GetDevice(string deviceCode) |
| | | { |
| | | return Pro_Devices.FirstOrDefault(x => x.DeviceCode == deviceCode); |
| | |
| | | /// <summary> |
| | | /// 获取设备 |
| | | /// </summary> |
| | | /// <param name="deviceCodes"></param> |
| | | /// <returns></returns> |
| | | /// <param name="deviceCodes">设备编码列表</param> |
| | | /// <returns>匹配的设备列表</returns> |
| | | public List<IDevice> GetDevices(List<string> deviceCodes) |
| | | { |
| | | return Pro_Devices.Where(x => deviceCodes.Contains(x.DeviceCode)).ToList(); |