Shuxia Ning
2024-08-28 1a8a81785470302fc7fbd6914a9df5d1094dac2a
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
66
67
68
69
70
using Yw;
 
namespace IStation
{
    /// <summary>
    /// 全局辅助类
    /// </summary>
    public class RealTimeScadaHelper
    {
        /// <summary>
        /// 众毅实时数据
        /// </summary>
        public class ZyRealTimeDataDto
        {
 
            /// <summary>
            /// 
            /// </summary>
            public string msg { get; set; }
 
            /// <summary>
            /// 
            /// </summary>
            public Dictionary<string, Dictionary<string, string>> data { get; set; }
 
            /// <summary>
            /// 
            /// </summary>
            public int status { get; set; }
        }
 
        /// <summary>
        /// 获取实时众毅Scada数据列表
        /// </summary>
        public static string GetRealTimeZyScadaList(out List<List<Model.ZyScada>> zy_scada_list_list)
        {
            zy_scada_list_list = new  List<List<Model.ZyScada>>(); 
            var foler_path = $"{AppDomain.CurrentDomain.BaseDirectory}Data\\实时数据";
            if (!Directory.Exists(foler_path))
            {
                return "!Directory.Exists(foler_path)";
            }
 
            var file_path_list = Directory.GetFiles(foler_path);
            if (file_path_list==null|| !file_path_list.Any())
            {
                return "file_path_list==null|| !file_path_list.Any()";
            }
 
            foreach (var file_path in file_path_list)
            {
                var file_json = File.ReadAllText(file_path);
                var zy_scada_list = JsonHelper.Json2Object<List<Model.ZyScada>>(file_json);
                if (zy_scada_list == null || !zy_scada_list.Any())
                {
                    continue;
                }
 
                zy_scada_list_list.Add(zy_scada_list);
            }
 
 
            return string.Empty;
        }
 
         
      
         
    }
}