using DevExpress.Office.Utils;
|
using DevExpress.Xpo.Helpers;
|
using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using Yw.EPAnet;
|
using Yw.WinFrmUI.Q3d;
|
|
namespace Yw.WinFrmUI
|
{
|
public partial class HydroEnergyTotalViewCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public HydroEnergyTotalViewCtrl()
|
{
|
InitializeComponent();
|
this.layoutControl1.SetupLayoutControl();
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult)
|
{
|
if (hydroInfo == null)
|
{
|
return;
|
}
|
if (calcuResult == null)
|
{
|
return;
|
}
|
if (!calcuResult.Succeed)
|
{
|
return;
|
}
|
|
var allCalcuResultVisualDict = calcuResult.GetVisualDict();
|
SetBindingData(hydroInfo, allCalcuResultVisualDict);
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
|
{
|
if (hydroInfo == null)
|
{
|
return;
|
}
|
if (allCalcuResultVisualDict == null || allCalcuResultVisualDict.Count < 1)
|
{
|
return;
|
}
|
|
double? totalQ = null;
|
double? totalP = null;
|
var allEfficiList = new List<double>();
|
if (hydroInfo.Pumps != null && hydroInfo.Pumps.Count > 0)
|
{
|
foreach (var pump in hydroInfo.Pumps)
|
{
|
if (!allCalcuResultVisualDict.ContainsKey(pump.Code))
|
{
|
continue;
|
}
|
var calcuResult = allCalcuResultVisualDict[pump.Code] as HydroCalcuPumpResult;
|
if (calcuResult == null)
|
{
|
continue;
|
}
|
if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open)
|
{
|
if (calcuResult.CalcuQ.HasValue)
|
{
|
if (!totalQ.HasValue)
|
{
|
totalQ = 0;
|
}
|
totalQ += calcuResult.CalcuQ.Value;
|
}
|
if (calcuResult.CalcuP.HasValue)
|
{
|
if (!totalP.HasValue)
|
{
|
totalP = 0;
|
}
|
totalP += calcuResult.CalcuP.Value;
|
}
|
if (calcuResult.CalcuE.HasValue)
|
{
|
allEfficiList.Add(calcuResult.CalcuE.Value);
|
}
|
}
|
}
|
}
|
if (totalQ.HasValue)
|
{
|
this.txtQ.EditValue = $"{Math.Round(totalQ.Value, 1)}m³/h";
|
}
|
if (totalP.HasValue)
|
{
|
this.txtP.EditValue = $"{Math.Round(totalP.Value, 1)}kW";
|
}
|
if (allEfficiList.Count > 0)
|
{
|
this.txtE.EditValue = $"{Math.Round(allEfficiList.Average(), 1)}%";
|
}
|
}
|
|
}
|
}
|