From f97b3ccbfd63b62ec875223fcc417633f6ce2989 Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期一, 09 十二月 2024 17:38:26 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/18-exchanger/ExchangerSingleMatchingCtrl.cs |  136 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/18-exchanger/ExchangerSingleMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/18-exchanger/ExchangerSingleMatchingCtrl.cs
new file mode 100644
index 0000000..96c9ed3
--- /dev/null
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/18-exchanger/ExchangerSingleMatchingCtrl.cs
@@ -0,0 +1,136 @@
+锘縰sing HStation.WinFrmUI.PhartRelation;
+using HStation.WinFrmUI.Xhs;
+
+namespace HStation.WinFrmUI
+{
+    public partial class ExchangerSingleMatchingCtrl : DevExpress.XtraEditors.XtraUserControl
+    {
+        public ExchangerSingleMatchingCtrl()
+        {
+            InitializeComponent();
+            this.gridView1.SetNormalView();
+            this.gridView3.SetNormalView();
+        }
+
+        public class PhartViewModel
+        {
+            public long ID { get; set; }
+            public string OtherName { get; set; }
+            public int Importance { get; set; }
+            public int SortCode { get; set; }
+        }
+
+        public class CurvieInfo
+        {
+            public long? Dbid { get; set; }
+            public long? Curveid { get; set; }
+            //   public Vmo.XhsExchangerMainPhartMappingExtensions Curveinfo { get; set; }
+        }
+
+        private List<ExchangerSingleMatchingViewModel> _allBindingList = null;
+
+        private BLL.AssetsExchangerMain _ExchangerBll = null;
+
+        private List<PhartViewModel> _allPhartList = null;
+        private readonly Lazy<BLL.AssetsExchangerCoefficient> _bll_ex = new();
+
+        private HydroExchangerMatchingViewModel _pumpMatchingViewModel;
+
+        private List<HydroCurvePointViewModel> _currentCurvePoint;
+
+        public async void SetBindingData(HydroExchangerMatchingViewModel ExchangerMatchingViewModel)
+        {
+            _pumpMatchingViewModel = ExchangerMatchingViewModel;
+            _allBindingList = new List<ExchangerSingleMatchingViewModel>();
+            _ExchangerBll = new BLL.AssetsExchangerMain();
+            var allAssetsPumpMain = await _ExchangerBll.GetAll();
+            if (allAssetsPumpMain != null)
+            {
+                foreach (var Main in allAssetsPumpMain)
+                {
+                    _allBindingList.Add(new ExchangerSingleMatchingViewModel(Main));
+                }
+            }
+            this.ExchangerSingleMatchingViewModelBindingSource.DataSource = _allBindingList;
+            this.searchControl1.Text = _pumpMatchingViewModel.ModelType;
+            for (int i = 0; i < _allBindingList.Count; i++)
+            {
+                if (long.TryParse(ExchangerMatchingViewModel.DbId, out long dbID))
+                {
+                    if (_allBindingList[i].ID == dbID)
+                    {
+                        this.gridView3.FocusedRowHandle = i;
+                    }
+                }
+            }
+            _currentCurvePoint = new List<HydroCurvePointViewModel>();
+        }
+
+        //闃�闂ㄥ瀷鍙峰垪琛ㄩ�夋嫨椤瑰垏鎹簨浠�
+        private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
+        {
+            _allPhartList = new List<PhartViewModel>();
+            var vm = this.gridView3.GetCurrentViewModel(_allBindingList);
+            if (vm != null)
+            {
+                _pumpMatchingViewModel.MatchingDbId = vm.ID.ToString();
+                _pumpMatchingViewModel.MatchingModelType = vm.Name.ToString();
+                /*  _valveMatchingViewModel.MatchingMinorLoss = vm.Coefficient;
+                 _valveMatchingViewModel.MatchingMaterial = vm.Material;
+                 _valveMatchingViewModel.MatchingExchangerType = (eExchangerType?)vm.SeriesType;
+                 _valveMatchingViewModel.MatchingExchangerSetting = vm.ExchangerSetting;*/
+                var list = await _bll_ex.Value.GetByMainID(vm.ID);
+                if (list != null && list.Any())
+                {
+                    foreach (var item in list)
+                    {
+                        _allPhartList.Add(new PhartViewModel { ID = item.ID });
+                    }
+                }
+            }
+            if (_pumpMatchingViewModel.MatchingCurveDbId != null)
+            {
+                for (int i = 0; i < _allPhartList.Count; i++)
+                {
+                    if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingCurveDbId)
+                    {
+                        gridView1.FocusedRowHandle = i;
+                    }
+                }
+            }
+            this.gridControl1.DataSource = _allPhartList;
+            this.gridView1.FocusInvalidRow();
+        }
+
+        //鏌ョ湅鏇茬嚎
+        private async void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
+        {
+            if (e.Column == this.ColShowChart)
+            {
+                var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
+
+                var vmo = await _bll_ex.Value.GetByID(vm.ID);
+                if (vmo != null)
+                {
+                    var dlg = new ExchangerChartShowDlg();
+                    dlg.InitChart(vmo.MinorLossCurve);
+                    dlg.ShowDialog();
+                }
+                return;
+            }
+        }
+
+        private async void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
+        {
+            var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
+            _currentCurvePoint.Clear();
+            if (vm == null)
+                return;
+            var vmo = await _bll_ex.Value.GetByID(vm.ID);
+            if (vmo != null)
+            {
+                _pumpMatchingViewModel.MatchingCurveDbId = vm.ID.ToString();
+            }
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3