using System.Collections.Generic; using System; using System.Drawing.Drawing2D; using System.IO; using System.Text; using System.Linq; using System.Runtime.InteropServices.ComTypes; using DevExpress.XtraCharts.Native; using DevExpress.Utils.MVVM; using IStation.BLL; using static IStation.Common.PumpHistoryDataFileHelper; namespace IStation.WinFrmUI.Monitor { public partial class SearchHistoryData : DocumentPage { public SearchHistoryData() { InitializeComponent(); this.PageTitle.Caption = "查询数据"; this.SurfaceGuid = new SurfaceGuid() { Modular = eModular.Basic, Function = this.PageTitle.Caption }; } //初始化 private void SearchHistoryData_Load(object sender, EventArgs e) { spinEditYear.Text = DateTime.Today.Year.ToString(); comboBoxMonth.Text = DateTime.Today.Month.ToString(); RefreshList(); listBoxDay.SelectedIndex = DateTime.Today.Day - 1; } private void listBoxDay_SelectedIndexChanged(object sender, EventArgs e) { } private void listBoxDay_CustomItemDisplayText(object sender, DevExpress.XtraEditors.CustomItemDisplayTextEventArgs e) { } public class RunParasData { /// /// 数据日期 /// public DateTime DateTime { get; set; } /// /// 泵运行状态 /// public List Blocks1 { get; set; } public List Blocks2 { get; set; } public List Blocks3 { get; set; } public List Blocks4 { get; set; } public List Blocks5 { get; set; } /// /// 总取水量 /// public double FlowIn { get; set; } /// /// 总用电量 /// public double Electric { get; set; } /// /// 总电费 /// public double Money { get; set; } } private void RefreshList() { int year = Convert.ToInt32(spinEditYear.Text); int month = Convert.ToInt32(comboBoxMonth.Text); int day_count = DateTime.DaysInMonth(year, month); listBoxDay.Items.Clear(); for (int i = 1; i <= day_count; i++) { listBoxDay.Items.Add(i.ToString()); } dict = BLL.AnaPrj.GetExistStatus(year, month); } Dictionary dict = null; RunParasData _qunian = null; RunParasData _real = null; CalcModel.AnaPrj _ana = null; private void RefreshByDay() { var bll = new BLL.PumpRunHelper(); // var OneHistoryPumpParas= bll.GetPumpRunParasOneDay(this.StartTimeEidt.DateTime,out string error ); } //年变化 private void spinEditYear_EditValueChanged(object sender, EventArgs e) { RefreshList(); } //月变化 private void comboBoxMonth_EditValueChanged(object sender, EventArgs e) { RefreshList(); } private void listBoxDay_SelectedIndexChanged_1(object sender, EventArgs e) { var bll = new BLL.PumpRunHelper(); if (listBoxDay.SelectedIndex < 0) return; if (listBoxDay.Items.Count == 0) return; int year = Convert.ToInt32(spinEditYear.Text); int month = Convert.ToInt32(comboBoxMonth.Text); int day = listBoxDay.SelectedIndex + 1; _ana = IStation.BLL.AnaPrj.GetPrj(new DateTime(year, month, day)); // OneHistoryPumpParas = bll.GetByHistoryOneData(new DateTime(year, month, day).AddDays(-365), out string error); //调用运行参数Api this.resultChartControl1.SetBindingData(new DateTime(year, month, day)); var historydata = new HistoryDataAPiHelper(); } private void listBoxDay_CustomItemDisplayText_1(object sender, DevExpress.XtraEditors.CustomItemDisplayTextEventArgs e) { if (dict == null) return; if (e.Item == null) return; if (!dict[e.Index + 1]) { e.DisplayText = string.Format("{0} (无)", e.Value); } } } }