using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.Calculation.DispatchAna
{
///
/// 长兴泵站调度方案计算器
///
internal class Calculator_Current_SHYS_陈行一输: CalculatorBase_SHYS_陈行一输, IGetCurrentRecord
{
public Calculator_Current_SHYS_陈行一输()
{
}
///
/// 获取当前调度信息
///
///
///
///
///
public Model.CurrentRecordBundle GetCurrentRecord(long CorpID, long StationID, out string error_info)
{
error_info = null;
List monitor_ids = new List() {
_monitor_id_液位1,_monitor_id_液位2,_monitor_id_液位3,
_monitor_id_一号管压力, _monitor_id_二号管压力 , _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();
var water_level1 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_液位1);
if (water_level1 != null)
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位1", water_level1, 4));
}
else
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位1", 0 ));
}
var water_level2 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_液位2);
if (water_level2 != null)
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位2", water_level2, 4));
}
else
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位2", 0));
}
var water_level3 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_液位3);
if (water_level3 != null)
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位3", water_level3, 4));
}
else
{
bundle.WaterLevelList.Add(new Model.CurrentRecordBundle.RecordValue("液位3", 0));
}
var pipe_press1 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_一号管压力 );
var pipe_press2 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_二号管压力 );
var pipe_press3 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_三号管压力 );
if (pipe_press1 != null && pipe_press2 != null && pipe_press3 != null)
{
bundle.PressList = new List();
bundle.PressList.Add(new Model.CurrentRecordBundle.RecordValue("一号出口管", pipe_press1, 4));
bundle.PressList.Add(new Model.CurrentRecordBundle.RecordValue("二号出口管", pipe_press2, 4));
bundle.PressList.Add(new Model.CurrentRecordBundle.RecordValue("三号出口管", pipe_press3, 4));
}
var pipe_flow1 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_一号管流量 );
var pipe_flow2 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_二号管流量 );
var pipe_flow3 = monitor_records.Find(x => x.MonitorPointID == _monitor_id_三号管流量 );
if (pipe_flow1 != null && pipe_flow2 != null && pipe_flow3 != null)
{
bundle.FlowList = new List();
bundle.FlowList.Add(new Model.CurrentRecordBundle.RecordValue("一号出口管", pipe_flow1, 0));
bundle.FlowList.Add(new Model.CurrentRecordBundle.RecordValue("二号出口管", pipe_flow2, 0));
bundle.FlowList.Add(new Model.CurrentRecordBundle.RecordValue("三号出口管", pipe_flow3, 0));
}
return bundle;
}
}
}