Shuxia Ning
2024-10-08 cf4967a0aebab18c5a37137f3e4c61b2d73a54bb
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
 
namespace IStation.BLL
{
    /// <summary>
    /// 
    /// </summary>
    public partial class CurveAnalyzePointPacket
    {
 
        private readonly DAL.CurveAnalyzePointPacket _dal = new DAL.CurveAnalyzePointPacket();
 
        /// <summary>
        /// 
        /// </summary> 
        /// <returns></returns>
        public List<Model.CurveAnalyzePointPacket> Get(long monitorDataSourcesId, long curveAnalyzeId)
        {
            return _dal.Get(monitorDataSourcesId, curveAnalyzeId);
        }
 
        /// <summary>
        /// 
        /// </summary> 
        /// <returns></returns>
        public List<Model.CurveAnalyzePointPacket> GetValid(long monitorDataSourcesId, long curveAnalyzeId)
        {
            return _dal.GetValid(monitorDataSourcesId, curveAnalyzeId);
        }
 
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param> 
        public bool Save(long monitorDataSourcesId, long curveAnalyzeId, List<Model.CurveAnalyzePointPacket> list)
        {
            return _dal.Save(monitorDataSourcesId, curveAnalyzeId, list);
        }
 
 
        /// <summary>
        /// 设置无效点
        /// </summary> 
        public bool SetInvalid(long monitorDataSourcesId, long curveAnalyzeId, List<DateTime> timeList)
        {
            if (timeList == null || timeList.Count() < 1)
                return default;
            var packets = _dal.Get(monitorDataSourcesId, curveAnalyzeId);
            if (packets == null || !packets.Any())
                return default;
            foreach (var packet in packets)
            {
                var all = packet.Points;
                if (all == null || !all.Any())
                    continue;
                for (int i = 0; i < all.Count(); i++)
                {
                    if (timeList.Contains(all[i].Time))
                    {
                        all[i].Status = Model.AnalyzePointStatus.Invalid;
                    }
                }
            }
            return _dal.Save(monitorDataSourcesId, curveAnalyzeId, packets);
        }
 
        /// <summary>
        /// 重置数据
        /// </summary> 
        public bool Reset(long monitorDataSourcesId, long curveAnalyzeId)
        {
            var packets = _dal.Get(monitorDataSourcesId, curveAnalyzeId);
            if (packets == null || !packets.Any())
                return default;
            foreach (var packet in packets)
            {
                var all = packet.Points;
                if (all == null || !all.Any())
                    continue;
                for (int i = 0; i < all.Count(); i++)
                {
                    all[i].Status = Model.AnalyzePointStatus.Valid;
                }
            }
            return _dal.Save(monitorDataSourcesId, curveAnalyzeId, packets);
        }
 
 
    }
}