wanshenmean
2025-04-15 21cd52c5592aad3687be74599a932012d9dd77a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Quartz;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Communicator;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DeviceEnum;
 
namespace WIDESEAWCS_QuartzJob
{
    /// <summary>
    /// 静态变脸存储区,可使用静态变量,也可注入使用
    /// </summary>
    public class Storage
    {
        /// <summary>
        /// 已连接设备对象集合
        /// </summary>
        public static List<IDevice> Devices = new List<IDevice>();
 
        /// <summary>
        /// 设备对象
        /// </summary>
        public List<IDevice> Pro_Devices { get; set; }
 
        /// <summary>
        /// 构造函数
        /// </summary>
        public Storage()
        {
            Pro_Devices = new List<IDevice>();
        }
 
        /// <summary>
        /// 获取设备
        /// </summary>
        /// <param name="deviceCode"></param>
        /// <returns></returns>
        public IDevice? GetDevice(string deviceCode)
        {
            return Pro_Devices.FirstOrDefault(x => x.DeviceCode == deviceCode);
        }
 
        /// <summary>
        /// 获取设备
        /// </summary>
        /// <param name="deviceCodes"></param>
        /// <returns></returns>
        public List<IDevice> GetDevices(List<string> deviceCodes)
        {
            return Pro_Devices.Where(x => deviceCodes.Contains(x.DeviceCode)).ToList();
        }
 
    }
}