duheng
2024-03-27 dc97e187c607119bbd2945b9a277db8da15f8dc0
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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)
                    {
 
                    }
                }
            }
        }
    }
}