From d321346f204a69b1929cc39098a5d88f44509e7b Mon Sep 17 00:00:00 2001
From: ningshuxia <ningshuxia0927@outlook.com>
Date: 星期一, 31 三月 2025 17:29:05 +0800
Subject: [PATCH] .netformwork 升级 .netcore

---
 02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/01-DataIntegration/DataIntegrationPage.cs |  187 +++++++++++++++++++++++++---------------------
 1 files changed, 101 insertions(+), 86 deletions(-)

diff --git a/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/01-DataIntegration/DataIntegrationPage.cs b/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/01-DataIntegration/DataIntegrationPage.cs
index e75a3b6..0a92ff8 100644
--- a/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/01-DataIntegration/DataIntegrationPage.cs
+++ b/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/01-DataIntegration/DataIntegrationPage.cs
@@ -1,9 +1,8 @@
 锘縰sing DevExpress.XtraEditors;
-using DevExpress.XtraGrid.Views.Grid.ViewInfo;
-using MathNet.Numerics;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
+using System.Drawing;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -15,12 +14,10 @@
         public DataIntegrationPage()
         {
             InitializeComponent();
-            this.PageTitle.Caption = "鏁版嵁鏁村悎";
-            this.stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent;
-            this.monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent;
-            this.gridView1.SetNormalView();
-            this.colTime.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
-            this.colTime.DisplayFormat.FormatString = "G";
+            PageTitle.Caption = "鏁版嵁鏁村悎";
+            stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent;
+            monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent;
+            timeValueSwiftPlotChartView1.SetTimeAxisX(DevExpress.XtraCharts.DateTimeMeasureUnit.Minute);
         }
 
         public class CurrentViewModel
@@ -50,15 +47,12 @@
         private BLL.StationSignalRecordPacket _bll = new BLL.StationSignalRecordPacket();
         private Model.Station _station = null;
         private Model.MonitorDataSources _monitorDataSources = null;
-        private List<CurrentViewModel> _allBindingList = null; 
 
         /// <summary>
         /// 娓呯┖鏁版嵁
         /// </summary>
         public void Clear()
         {
-            _allBindingList = new List<CurrentViewModel>();
-            this.currentViewModelBindingSource.DataSource = _allBindingList;
         }
 
         /// <summary>
@@ -66,8 +60,8 @@
         /// </summary>
         public override void InitialDataSource()
         {
-            this.stationListCtrl1.SetBindingData();
-            this.monitorDataSourcesTreeList1.SetBindingData();
+            stationListCtrl1.SetBindingData();
+            monitorDataSourcesTreeList1.SetBindingData();
         }
 
         //娉电珯鍙樻崲
@@ -89,13 +83,11 @@
         /// </summary>
         public void SetBindingData(Model.MonitorDataSources monitorDataSources, Model.Station station)
         {
-            _allBindingList = new List<CurrentViewModel>();
-            this.currentViewModelBindingSource.DataSource = _allBindingList;
             if (monitorDataSources == null || station == null)
             {
                 return;
             }
-            if (this.barCekLoad.Checked)
+            if (barCekLoad.Checked)
             {
                 return;
             }
@@ -109,52 +101,103 @@
         public void SetBindingData(List<Model.StationSignalRecordPacket> packets)
         {
             WaitFrmHelper.ShowWaitForm();
-            _allBindingList = new List<CurrentViewModel>();
+            timeValueSwiftPlotChartView1.ClearSeries();
             if (packets != null && packets.Any())
-            { 
+            {
+                var total_flow_list = new List<TimeValue>();
+                var total_pressure_list = new List<TimeValue>();
+                var pump_total_flow_list = new List<TimeValue>();
+                var diff_flow_list = new List<TimeValue>();
                 foreach (var packet in packets)
                 {
                     var station_signal_records = packet.StationSignalRecords;
                     if (station_signal_records == null || !station_signal_records.Any())
                         continue;
-                    var year_month = $"{packet.Year}-{packet.Month}";
-                    foreach (var record in station_signal_records)
+                    foreach (var station in station_signal_records)
                     {
-                        var pump_signal_records = record.PumpSignalRecords;
-                        if (pump_signal_records == null || !pump_signal_records.Any())
+                        var time = station.Time;
+                        var total_flow = station.TotalFlow;
+                        var total_pressure = station.TotalPressure;
+                        var pump_total_flow = station.PumpSignalRecords.Sum(x => x.FlowRate);
+                        var diff_flow = station.DiffFlow;
+                        if (total_pressure < 0)
+                        {
                             continue;
-                        pump_signal_records = pump_signal_records.OrderBy(x => x.Flag).ToList();
-
-                        var total_power = pump_signal_records.Sum(x => x.InstantaneousPower);
-                        var run_flags = pump_signal_records.Select(x => x.Flag).ToList();
-                        var rpm_list = pump_signal_records.Select(x =>
+                        }
+                        if (total_flow <= 0 && pump_total_flow <= 0)
                         {
-                            if (x.Rpm == 0 && (x.Flag == 15 || x.Flag == 16))
-                            {
-                                return 590;
-                            }
-                            return x.Rpm;
-                        }).ToList();
-                        var head_list = pump_signal_records.Select(x =>
+                            continue;
+                        }
+                        if (pump_total_flow > 0 && Math.Abs(diff_flow) > 2000)
                         {
-                            return Math.Round(x.Head, 2);
-                        }).ToList();
+                            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);
+
+                        if (station.PumpSignalRecords.Exists(x => x.Rpm < 0))
+                        {
+                            continue;
+                        }
 
 
-                        var vm = new CurrentViewModel();
-                        vm.YearMonth = year_month;
-                        vm.Time = record.Time;
-                        vm.RunFlags = IStation.Untity.IntListHelper.ToString(run_flags);
-                        vm.RpmList = IStation.Untity.DoubleListHelper.ToString(rpm_list);
-                        vm.HeadList = IStation.Untity.DoubleListHelper.ToString(head_list); 
-                        vm.TotalPower = Math.Round(total_power, 1);
-                        _allBindingList.Add(vm);
+
+                        total_flow_list.Add(new TimeValue(time, total_flow));
+                        pump_total_flow_list.Add(new TimeValue(time, pump_total_flow));
+                        diff_flow_list.Add(new TimeValue(time, diff_flow));
+                        total_pressure_list.Add(new TimeValue(time, total_pressure));
+
+
                     }
+
+                    #region MyRegion
+
+                    //var year_month = $"{packet.Year}-{packet.Month}";
+                    //foreach (var record in station_signal_records)
+                    //{
+                    //    var pump_signal_records = record.PumpSignalRecords;
+                    //    if (pump_signal_records == null || !pump_signal_records.Any())
+                    //        continue;
+                    //    pump_signal_records = pump_signal_records.OrderBy(x => x.Flag).ToList();
+
+                    //    var total_power = pump_signal_records.Sum(x => x.InstantaneousPower);
+                    //    var run_flags = pump_signal_records.Select(x => x.Flag).ToList();
+                    //    var rpm_list = pump_signal_records.Select(x =>
+                    //    {
+                    //        if (x.Rpm == 0 && (x.Flag == 15 || x.Flag == 16))
+                    //        {
+                    //            return 590;
+                    //        }
+                    //        return x.Rpm;
+                    //    }).ToList();
+                    //    var head_list = pump_signal_records.Select(x =>
+                    //    {
+                    //        return Math.Round(x.Head, 2);
+                    //    }).ToList();
+
+
+                    //    var vm = new CurrentViewModel();
+                    //    vm.YearMonth = year_month;
+                    //    vm.Time = record.Time;
+                    //    vm.RunFlags = IStation.Untity.IntListHelper.ToString(run_flags);
+                    //    vm.RpmList = IStation.Untity.DoubleListHelper.ToString(rpm_list);
+                    //    vm.HeadList = IStation.Untity.DoubleListHelper.ToString(head_list); 
+                    //    vm.TotalPower = Math.Round(total_power, 1);
+                    //    _allBindingList.Add(vm);
+                    //} 
+                    #endregion
                 }
+                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);
+
             }
 
 
-            this.currentViewModelBindingSource.DataSource = _allBindingList;
             WaitFrmHelper.HideWaitForm();
         }
 
@@ -168,12 +211,12 @@
             {
                 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], "鎻愮ず", "鏁村悎瀹屾垚锛�");
@@ -191,51 +234,14 @@
             SetBindingData(_monitorDataSources, _station);
         }
 
-        //鑷畾涔夌粍鍚�
-        private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
-        { 
-            var vm = this.gridView1.GetRow(e.RowHandle) as CurrentViewModel;
-            var grid = e.Info as GridGroupRowInfo;
-            if (grid.Level == 0)
-            {    grid.GroupText = vm.YearMonth;
-            }
-            else if (grid.Level == 1)
-            { 
-                grid.GroupText = vm.RunFlags;
-            } 
-        }
 
-        #region 鑿滃崟 
-
-        //鍏ㄩ儴灞曞紑
-        private void barBtnExpandAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            this.gridView1.ExpandAllGroups();
-        }
-
-        //鍏ㄩ儴鎶樺彔
-        private void barBtnCollapseAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            this.gridView1.CollapseAllGroups();
-        }
-
-        //妫�绱�
-        private void barCekSearch_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            if (this.barCekSearch.Checked)
-                this.gridView1.ShowFindPanel();
-            else
-                this.gridView1.HideFindPanel();
-        }
+        #region 鑿滃崟  
 
         // 鍒锋柊鏁版嵁
         private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             InitialDataSource();
         }
-
-
-
 
         #endregion
 
@@ -281,9 +287,18 @@
             dlg.ShowDialog();
         }
 
+
         #endregion
 
-
+        private void barBtnExportEta_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_monitorDataSources == null || _station == null)
+            {
+                XtraMessageBox.Show("鏃犳暟鎹�!");
+                return;
+            }
+            EtaExportHelper.Export(_monitorDataSources.ID);
+        }
     }
 }
 

--
Gitblit v1.9.3