using DevExpress.XtraCharts; using DevExpress.XtraEditors; using IStation.Unit; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace IStation.WinFrmUI.CalcErQu { public partial class RiverWaterLevelDropByFlowCtrl : XtraUserControl { public RiverWaterLevelDropByFlowCtrl() { InitializeComponent(); //this.mainChart.BoxSelCompleteEvent += TimeValueEasyChartView1_BoxSelCompleteEvent; } public class ChartViewModel { public double Flow { get; set; } public double RiverHeight { get; set; } public double BoxHeight { get; set; } public double Drop { get; set; } } List _allBindList1 = null; List _listRiverWaterLevelDrop = null; List _allPacketList = null; /// /// 绑定数据 /// public void SetBindingData(List allPacketList) { this._allPacketList = allPacketList; //var monitorPoints = new BLL.MonitorPoint().GetAll(); //if (monitorPoints!=null&&monitorPoints.Any()) //{ // var cjsw = monitorPoints.Find(x=>x.TagName== "_0402010205002020001"); // var chqsk= monitorPoints.Find(x => x.TagName == "_0402010204089903001"); // // var records = new BLL.MonitorDataSet().GetSignalRecordPacket(); //} if (_allBindList1 == null) _allBindList1 = new List(); else _allBindList1.Clear(); _listRiverWaterLevelDrop = BLL.RiverWaterLevelDrop.GetList(); foreach (var packet in _allPacketList) { foreach (var r in packet.StationSignalRecords) { if (r.PumpRunCount <= 0) continue; if (r.ChangJiangWL == null) continue; if (r.QianChiWL == null) continue; if (r.ChangJiangWL <= -100) continue; if (r.QianChiWL <= -100) continue; var b = new ChartViewModel() { RiverHeight = r.ChangJiangWL.Value, BoxHeight = r.QianChiWL.Value, }; b.Drop = Math.Round(b.RiverHeight - b.BoxHeight, 2); if (b.Drop > 8.5) continue; foreach (var p in r.PumpSignalRecords) b.Flow += p.FlowRate == null ? 0 : p.FlowRate.Value; if (b.Flow < 20000) continue; b.Flow = (int)(b.Flow / 1000) * 1000; _allBindList1.Add(b); } } this.bindingSourceChart.DataSource = _allBindList1; if (_listRiverWaterLevelDrop == null || _listRiverWaterLevelDrop.Count() == 0) { } else { this.bindingSourceGrid.DataSource = _listRiverWaterLevelDrop; } } private void groupControl1_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { BLL.RiverWaterLevelDrop.SaveList(_listRiverWaterLevelDrop); MessageBox.Show("已保存"); } private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { this.bindingSourceGrid.ResetBindings(false); } } }