using DevExpress.XtraEditors;
|
using DevExpress.XtraGrid.Views.Grid;
|
using DevExpress.XtraGrid;
|
using DevExpress.XtraPrinting;
|
using IStation.Model;
|
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 static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
using IStation.BLL;
|
|
namespace IStation.WinFrmUI.Monitor
|
{
|
public partial class ResultChartControl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ResultChartControl()
|
{
|
InitializeComponent();
|
}
|
|
private class CurrentModel : HistoryDataHelper
|
{
|
/// <summary>
|
/// 名称
|
/// </summary>
|
public string Name { get; set; }
|
/// <summary>
|
/// 泵台数
|
/// </summary>
|
public string PumpCount { get; set; }
|
/// <summary>
|
/// 开机时间段
|
/// </summary>
|
public string Time { get; set; }
|
/// <summary>
|
/// 电费
|
/// </summary>
|
public double Electricity { get; set; }
|
}
|
|
|
List<CurrentModel> _currentModel = new List<CurrentModel>();
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
/// <param name="datetime"></param>
|
public void SetBindingData(DateTime datetime)
|
{
|
PumpRunHelper pumpRunHelper = new PumpRunHelper();
|
pumpRunHelper.GetPumpRunParasOneDay(datetime,out string error1);
|
pumpRunHelper.GetByHistoryOneData(new DateTime(2023,2,5),out string error);
|
|
}
|
|
|
|
//电费计算
|
private double electricityPirce(DateTime startTime, DateTime endTime, double electricity)
|
{
|
var ElePriceSetting = new BLL.ElecPrice().GetAll().First();
|
var MonthList = ElePriceSetting.Settings.MonthList;
|
var FindMonth = MonthList.Find(x => x.StartMonth <= startTime.Month && x.EndMonth >= startTime.Month);
|
foreach (var item in FindMonth.HourList)
|
{
|
if (startTime.Hour >= item.StartHour && endTime.Hour <= item.EndHour)
|
{
|
return Math.Round(item.Price * electricity, 2);
|
}
|
}
|
return 0;
|
}
|
|
|
|
private double GetElectrityData(DateTime Str, DateTime end)
|
{
|
return 0;
|
}
|
|
|
|
|
|
|
//表格点击事件
|
private void gridControl2_MouseDown(object sender, MouseEventArgs e)
|
{
|
GridView gridView = gridControl2.MainView as GridView;
|
if (gridView != null)
|
{
|
// 获取鼠标所在的单元格
|
DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo = gridView.CalcHitInfo(e.Location);
|
|
// 如果点击到单元格上
|
if (hitInfo.InRowCell)
|
{
|
// 获取点击的单元格的行和列
|
int rowHandle = hitInfo.RowHandle;
|
int columnHandle = hitInfo.Column.VisibleIndex;
|
object cellValue = gridView.GetRowCellValue(rowHandle, gridView.Columns[columnHandle]);
|
|
// 处理获取到的单元格数据
|
if (cellValue != null)
|
{
|
|
}
|
}
|
}
|
}
|
}
|
}
|