tangxu
2022-10-31 8ea88fedd51e4961d0fd0aec6c2873a579fb6db8
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Calculation.DispatchAna
{
    /// <summary>
    /// 长兴泵站调度方案计算器
    /// </summary>
    internal class Calculator_Current_SHYS_五号沟金海方向: CalculatorBase_SHYS_五号沟金海方向, IGetCurrentRecord
    {
        /// <summary>
        /// 获取当前调度信息
        /// </summary>
        /// <param name="CorpID"></param>
        /// <param name="StationID"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public Model.CurrentRecordBundle GetCurrentRecord(long CorpID, long StationID, out string error_info)
        {
            error_info = null;
            List<long> monitor_ids = new List<long>() { _monitor_id_前池液位4, _monitor_id_前池液位5, _monitor_id_一号管压力,
                _monitor_id_二号管压力, _monitor_id_一号管流量, _monitor_id_二号管流量 };
            var monitor_records = new Service.MonitorRecord().GetLastRecord(_corpID, monitor_ids);
 
            Model.CurrentRecordBundle bundle = new Model.CurrentRecordBundle();
 
            bundle.WaterLevelList = new List<Model.CurrentRecordBundle.RecordValue>();
 
            var water_level4 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_前池液位4);
            if (water_level4 != null)
            { 
                bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("前池液位4", water_level4, 2));
            }
            var water_level5 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_前池液位5);
            if (water_level5 != null)
            {
                bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("前池液位5", water_level4, 2));
            }
 
            var pipe_press1 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_一号管压力);
            var pipe_press2 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_二号管压力);
            if (pipe_press1 != null && pipe_press2 != null)
            {
                bundle.PressList = new List<Model.CurrentRecordBundle.RecordValue>();
                bundle.PressList.Add(new Model.CurrentRecordBundle.RecordValue("一号管", pipe_press1, 4));
                bundle.PressList.Add(new Model.CurrentRecordBundle.RecordValue("二号管", pipe_press2, 4));
            }
 
            var pipe_flow1 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_一号管流量);
            var pipe_flow2 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_二号管流量);
            if (pipe_flow1 != null && pipe_flow2 != null)
            {
                bundle.FlowList = new List<Model.CurrentRecordBundle.RecordValue>();
                bundle.FlowList.Add(new Model.CurrentRecordBundle.RecordValue("一号管", pipe_flow1, 0));
                bundle.FlowList.Add(new Model.CurrentRecordBundle.RecordValue("二号管", pipe_flow2, 0));
            }
 
             
            return bundle;
        }
 
 
         
    }
}