| | |
| | | public DataIntegrationPage() |
| | | { |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "数据整合"; |
| | | this.stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent; |
| | | this.monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent; |
| | | this.timeValueSwiftPlotChartView1.SetTimeAxisX( DevExpress.XtraCharts.DateTimeMeasureUnit.Minute); |
| | | PageTitle.Caption = "数据整合"; |
| | | stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent; |
| | | monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent; |
| | | timeValueSwiftPlotChartView1.SetTimeAxisX(DevExpress.XtraCharts.DateTimeMeasureUnit.Minute); |
| | | } |
| | | |
| | | public class CurrentViewModel |
| | |
| | | |
| | | private BLL.StationSignalRecordPacket _bll = new BLL.StationSignalRecordPacket(); |
| | | private Model.Station _station = null; |
| | | private Model.MonitorDataSources _monitorDataSources = null; |
| | | private Model.MonitorDataSources _monitorDataSources = null; |
| | | |
| | | /// <summary> |
| | | /// 清空数据 |
| | | /// </summary> |
| | | public void Clear() |
| | | { |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public override void InitialDataSource() |
| | | { |
| | | this.stationListCtrl1.SetBindingData(); |
| | | this.monitorDataSourcesTreeList1.SetBindingData(); |
| | | stationListCtrl1.SetBindingData(); |
| | | monitorDataSourcesTreeList1.SetBindingData(); |
| | | } |
| | | |
| | | //泵站变换 |
| | |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(Model.MonitorDataSources monitorDataSources, Model.Station station) |
| | | { |
| | | { |
| | | if (monitorDataSources == null || station == null) |
| | | { |
| | | return; |
| | | } |
| | | if (this.barCekLoad.Checked) |
| | | if (barCekLoad.Checked) |
| | | { |
| | | return; |
| | | } |
| | |
| | | /// </summary> |
| | | public void SetBindingData(List<Model.StationSignalRecordPacket> packets) |
| | | { |
| | | WaitFrmHelper.ShowWaitForm(); |
| | | this.timeValueSwiftPlotChartView1.ClearSeries(); |
| | | WaitFrmHelper.ShowWaitForm(); |
| | | timeValueSwiftPlotChartView1.ClearSeries(); |
| | | if (packets != null && packets.Any()) |
| | | { |
| | | var total_flow_list = new List<TimeValue>(); |
| | |
| | | if (station_signal_records == null || !station_signal_records.Any()) |
| | | continue; |
| | | foreach (var station in station_signal_records) |
| | | { |
| | | { |
| | | var time = station.Time; |
| | | var total_flow = station.TotalFlow; |
| | | var total_pressure = station.TotalPressure; |
| | |
| | | { |
| | | continue; |
| | | } |
| | | if (total_flow<=0&& pump_total_flow<=0) |
| | | if (total_flow <= 0 && pump_total_flow <= 0) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if (pump_total_flow > 0 && Math.Abs(diff_flow) > 2000) |
| | | { |
| | | continue; |
| | |
| | | total_flow = Math.Round(total_flow, 1); |
| | | pump_total_flow = Math.Round(pump_total_flow, 1); |
| | | diff_flow = Math.Round(diff_flow, 1); |
| | | total_pressure = Math.Round(total_pressure,2); |
| | | total_pressure = Math.Round(total_pressure, 2); |
| | | |
| | | if (station.PumpSignalRecords.Exists(x=>x.Rpm<0)) |
| | | if (station.PumpSignalRecords.Exists(x => x.Rpm < 0)) |
| | | { |
| | | continue; |
| | | continue; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | total_flow_list.Add(new TimeValue(time, total_flow)); |
| | | pump_total_flow_list.Add(new TimeValue(time, pump_total_flow)); |
| | |
| | | //} |
| | | #endregion |
| | | } |
| | | this.timeValueSwiftPlotChartView1.SetAxisYTitle("流量"); |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries("总压力", Color.DarkGray, "总压力", "压力", total_pressure_list); |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries("总管流量", Color.Red, "总管流量", "流量", total_flow_list); |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries("泵总流量", Color.Blue, "泵总流量", "流量", pump_total_flow_list); |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries("偏差流量", Color.Black, "偏差流量", "流量", diff_flow_list); |
| | | timeValueSwiftPlotChartView1.SetAxisYTitle("流量"); |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries("总压力", Color.DarkGray, "总压力", "压力", total_pressure_list); |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries("总管流量", Color.Red, "总管流量", "流量", total_flow_list); |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries("泵总流量", Color.Blue, "泵总流量", "流量", pump_total_flow_list); |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries("偏差流量", Color.Black, "偏差流量", "流量", diff_flow_list); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | WaitFrmHelper.HideWaitForm(); |
| | | } |
| | | |
| | |
| | | { |
| | | Task.Run(() => |
| | | { |
| | | this.Invoke(new Action(() => |
| | | Invoke(new Action(() => |
| | | { |
| | | AlertTool.ShowInfo(Application.OpenForms[0], "提示", "开始整合!"); |
| | | })); |
| | | var packets = _bll.AnalysisAndSave(_monitorDataSources.ID, _station.ID, timeStep); |
| | | this.Invoke(new Action(() => |
| | | Invoke(new Action(() => |
| | | { |
| | | SetBindingData(packets); |
| | | AlertTool.ShowInfo(Application.OpenForms[0], "提示", "整合完成!"); |
| | |
| | | { |
| | | SetBindingData(_monitorDataSources, _station); |
| | | } |
| | | |
| | | |
| | | |
| | | #region 菜单 |
| | | |
| | |
| | | private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | InitialDataSource(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |