From 4999c3c3884084c10c8a4bb2426e92cb63600166 Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期六, 09 十一月 2024 09:58:22 +0800
Subject: [PATCH] 冲突

---
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/07-threelink/HydroThreelinkListCtrl.cs |  286 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 158 insertions(+), 128 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/07-threelink/HydroThreelinkListCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/07-threelink/HydroThreelinkListCtrl.cs
similarity index 79%
rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/07-threelink/HydroThreelinkListCtrl.cs
rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/07-threelink/HydroThreelinkListCtrl.cs
index 8054e2f..c84bbde 100644
--- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/07-threelink/HydroThreelinkListCtrl.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/07-threelink/HydroThreelinkListCtrl.cs
@@ -1,9 +1,8 @@
-锘縰sing DevExpress.XtraEditors;
-using Yw.Model;
+锘縰sing Yw.Model;
 
 namespace Yw.WinFrmUI
 {
-    public partial class HydroThreelinkListCtrl : DevExpress.XtraEditors.XtraUserControl, IHydroParterList
+    public partial class HydroThreelinkListCtrl : DevExpress.XtraEditors.XtraUserControl, IHydroVisualList
     {
         public HydroThreelinkListCtrl()
         {
@@ -13,15 +12,22 @@
             this.layoutControl1.SetupLayoutControl();
         }
 
-
         /// <summary>
         /// 姘村姏鐐瑰嚮浜嬩欢
         /// </summary>
-        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
+        public event Action<Yw.Model.HydroVisualInfo> HydroClickInfoEvent;
+        /// <summary>
+        /// 姘村姏鐐瑰嚮瑙嗗浘浜嬩欢
+        /// </summary>
+        public event Action<HydroVisualViewModel> HydroClickViewEvent;
         /// <summary>
         /// 姘村姏鏀瑰彉浜嬩欢
         /// </summary>
-        public event Action<List<HydroParterInfo>> HydroChangedEvent;
+        public event Action<List<Yw.Model.HydroVisualInfo>> HydroChangedInfoEvent;
+        /// <summary>
+        /// 姘村姏鏀瑰彉瑙嗗浘浜嬩欢
+        /// </summary>
+        public event Action<List<HydroVisualViewModel>> HydroChangedViewEvent;
 
         /// <summary>
         /// 鏄剧ず鏌ヨ闈㈡澘
@@ -36,7 +42,7 @@
         }
 
         /// <summary>
-        /// 鏄惁鎷ユ湁姘村埄鍒楄〃
+        /// 鏄惁鎷ユ湁姘村姏鍒楄〃
         /// </summary>
         public bool HasHydroList
         {
@@ -56,9 +62,9 @@
             _allList = new List<HydroThreelinkViewModel>();
             if (hydroInfo != null && hydroInfo.Threelinks != null && hydroInfo.Threelinks.Count > 0)
             {
-                foreach (var threelink in hydroInfo.Threelinks)
+                foreach (var visual in hydroInfo.Threelinks)
                 {
-                    var vm = new HydroThreelinkViewModel(threelink, hydroInfo);
+                    var vm = new HydroThreelinkViewModel(visual, hydroInfo);
                     _allList.Add(vm);
                 }
             }
@@ -73,10 +79,10 @@
             _allList = new List<HydroThreelinkViewModel>();
             if (hydroInfo != null && hydroInfo.Threelinks != null && hydroInfo.Threelinks.Count > 0)
             {
-                foreach (var threelink in hydroInfo.Threelinks)
+                foreach (var visual in hydroInfo.Threelinks)
                 {
-                    var vm = new HydroThreelinkViewModel(threelink, hydroInfo);
-                    var calcuResult = allCalcuResultList?.Find(x => x.Code == threelink.Code);
+                    var vm = new HydroThreelinkViewModel(visual, hydroInfo);
+                    var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code);
                     if (calcuResult != null)
                     {
                         vm.UpdateCalcuProperty(calcuResult);
@@ -85,6 +91,30 @@
                 }
             }
             Search();
+        }
+
+        /// <summary>
+        /// 缁戝畾鏁版嵁
+        /// </summary>
+        public void SetBindingData(List<HydroVisualViewModel> allVisualViewModelList)
+        {
+            _allList = new List<HydroThreelinkViewModel>();
+            allVisualViewModelList?.ForEach(x =>
+            {
+                if (x.Catalog == HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Threelink))
+                {
+                    _allList.Add(x as HydroThreelinkViewModel);
+                }
+            });
+            Search();
+        }
+
+        /// <summary>
+        /// 鏇存柊缁戝畾
+        /// </summary>
+        public void UpdateBindingData()
+        {
+            this.hydroThreelinkViewModelBindingSource.ResetBindings(false);
         }
 
         /// <summary>
@@ -103,17 +133,17 @@
         /// <summary>
         /// 鏇存柊灞炴��
         /// </summary>
-        public void UpdateProperty(Yw.Model.HydroParterInfo parter)
+        public void UpdateProperty(Yw.Model.HydroVisualInfo visual)
         {
             if (_allList == null || _allList.Count < 1)
             {
                 return;
             }
-            if (parter == null)
+            if (visual == null)
             {
                 return;
             }
-            var vm = _allList.Find(x => x.Code == parter.Code);
+            var vm = _allList.Find(x => x.Code == visual.Code);
             if (vm == null)
             {
                 return;
@@ -125,17 +155,17 @@
         /// <summary>
         /// 鏇存柊灞炴��
         /// </summary>
-        public void UpdateProperty(List<Yw.Model.HydroParterInfo> parterList)
+        public void UpdateProperty(List<Yw.Model.HydroVisualInfo> visualList)
         {
             if (_allList == null || _allList.Count < 1)
             {
                 return;
             }
-            if (parterList == null || parterList.Count < 1)
+            if (visualList == null || visualList.Count < 1)
             {
                 return;
             }
-            parterList.ForEach(x =>
+            visualList.ForEach(x =>
             {
                 var vm = _allList.Find(t => x.Code == x.Code);
                 if (vm != null)
@@ -155,115 +185,17 @@
             {
                 if (_allList != null && _allList.Count > 0)
                 {
-                    foreach (var parter in _allList)
+                    foreach (var visual in _allList)
                     {
-                        var calcuResult = allCalcuResultList.Find(x => x.Code == parter.Code);
+                        var calcuResult = allCalcuResultList.Find(x => x.Code == visual.Code);
                         if (calcuResult != null)
                         {
-                            parter.UpdateCalcuProperty(calcuResult);
+                            visual.UpdateCalcuProperty(calcuResult);
                         }
                     }
                     this.hydroThreelinkViewModelBindingSource.ResetBindings(false);
                 }
             }
-        }
-
-
-
-        /// <summary>
-        /// 璁剧疆绠�鍗曟樉绀烘ā寮�
-        /// </summary>
-        public void SetSimpleView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = true;
-            this.colCode.Visible = true;
-            this.colName.Visible = true;
-            this.colModelType.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colCaliber.Visible = true;
-            this.colRunningThroughLoss.Visible = false;
-            this.colBranchThroughLoss.Visible = false;
-            this.colElev.Visible = false;
-            this.colMinorLoss.Visible = false;
-            this.colCalcuPress.Visible = false;
-            this.colCalcuHead.Visible = false;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = false;
-        }
-
-        /// <summary>
-        /// 璁剧疆姝e父鏄剧ず妯″紡
-        /// </summary>
-        public void SetNormalView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = true;
-            this.colCode.Visible = true;
-            this.colName.Visible = true;
-            this.colModelType.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colCaliber.Visible = true;
-            this.colRunningThroughLoss.Visible = true;
-            this.colBranchThroughLoss.Visible = true;
-            this.colElev.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuPress.Visible = false;
-            this.colCalcuHead.Visible = false;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
-        }
-
-        /// <summary>
-        /// 璁剧疆璁$畻鏄剧ず妯″紡
-        /// </summary>
-        public void SetCalcuView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = true;
-            this.colCode.Visible = true;
-            this.colName.Visible = true;
-            this.colModelType.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colCaliber.Visible = true;
-            this.colRunningThroughLoss.Visible = true;
-            this.colBranchThroughLoss.Visible = true;
-            this.colElev.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuPress.Visible = true;
-            this.colCalcuHead.Visible = true;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
-        }
-
-        /// <summary>
-        /// 璁剧疆鎵归噺璁剧疆妯″紡
-        /// </summary>
-        public void SetBulkSetView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-            this.colDbLocked.Visible = true;
-            this.colCode.Visible = true;
-            this.colName.Visible = true;
-            this.colModelType.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colCaliber.Visible = true;
-            this.colRunningThroughLoss.Visible = true;
-            this.colBranchThroughLoss.Visible = true;
-            this.colElev.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuPress.Visible = false;
-            this.colCalcuHead.Visible = false;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
         }
 
         //鏌ヨ
@@ -308,20 +240,19 @@
             Search();
             if (_allBindingList == null || _allBindingList.Count < 1)
             {
-                XtraMessageBox.Show("鏃犲彲璁剧疆杩炴帴鑺傜偣鏁版嵁");
+                TipFormHelper.ShowWarn("鏃犳暟鎹紒");
                 return;
             }
             var dlg = new SetHydroThreelinkDlg();
             dlg.SetBindingData(_allBindingList.Select(x => x.Vmo).ToList());
             dlg.ReloadDataEvent += (list) =>
             {
-                _allBindingList.ForEach(x =>
-                {
-                    x.UpdateProperty();
-                });
+                _allBindingList.ForEach(x => x.UpdateProperty());
                 this.hydroThreelinkViewModelBindingSource.ResetBindings(false);
-                var allParterList = _allBindingList.Select(x => x.Vmo as Yw.Model.HydroParterInfo).ToList();
-                this.HydroChangedEvent?.Invoke(allParterList);
+                var allVisualViewModelList = _allBindingList.Select(x => x as HydroVisualViewModel).ToList();
+                this.HydroChangedViewEvent?.Invoke(allVisualViewModelList);
+                var allVisualInfoList = allVisualViewModelList.Select(x => x.Vmo).ToList();
+                this.HydroChangedInfoEvent?.Invoke(allVisualInfoList);
             };
             dlg.ShowDialog();
         }
@@ -360,16 +291,115 @@
                 {
                     row.UpdateProperty();
                     this.gridView1.RefreshRow(e.RowHandle);
-                    this.HydroChangedEvent?.Invoke(new List<Model.HydroParterInfo>() { row.Vmo });
+                    this.HydroChangedViewEvent?.Invoke(new List<HydroVisualViewModel>() { row });
+                    this.HydroChangedInfoEvent?.Invoke(new List<HydroVisualInfo>() { row.Vmo });
                 };
                 dlg.ShowDialog();
             }
             else
             {
-                this.HydroClickEvent?.Invoke(row.Vmo);
+                this.HydroClickViewEvent?.Invoke(row);
+                this.HydroClickInfoEvent?.Invoke(row.Vmo);
             }
         }
 
+        /// <summary>
+        /// 璁剧疆绠�鍗曟樉绀烘ā寮�
+        /// </summary>
+        public void SetSimpleView()
+        {
+            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            this.colDbLocked.Visible = false;
+            this.colName.Visible = true;
+            this.colCode.Visible = true;
+            this.colModelType.Visible = true;
+            this.colMaterial.Visible = true;
+            this.colCaliber.Visible = true;
+            this.colRunningThroughLoss.Visible = false;
+            this.colBranchThroughLoss.Visible = false;
+            this.colElev.Visible = false;
+            this.colMinorLoss.Visible = false;
+            this.colCalcuPress.Visible = false;
+            this.colCalcuHead.Visible = false;
+            this.colHasDb.Visible = false;
+            this.colFlags.Visible = true;
+            this.colDescription.Visible = true;
+            this.colSet.Visible = false;
+        }
+
+        /// <summary>
+        /// 璁剧疆姝e父鏄剧ず妯″紡
+        /// </summary>
+        public void SetNormalView()
+        {
+            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            this.colDbLocked.Visible = true;
+            this.colName.Visible = true;
+            this.colCode.Visible = true;
+            this.colModelType.Visible = true;
+            this.colMaterial.Visible = true;
+            this.colCaliber.Visible = true;
+            this.colRunningThroughLoss.Visible = true;
+            this.colBranchThroughLoss.Visible = true;
+            this.colElev.Visible = true;
+            this.colMinorLoss.Visible = true;
+            this.colCalcuPress.Visible = false;
+            this.colCalcuHead.Visible = false;
+            this.colHasDb.Visible = true;
+            this.colFlags.Visible = true;
+            this.colDescription.Visible = true;
+            this.colSet.Visible = true;
+        }
+
+        /// <summary>
+        /// 璁剧疆璁$畻鏄剧ず妯″紡
+        /// </summary>
+        public void SetCalcuView()
+        {
+            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            this.colDbLocked.Visible = true;
+            this.colName.Visible = true;
+            this.colCode.Visible = true;
+            this.colModelType.Visible = true;
+            this.colMaterial.Visible = true;
+            this.colCaliber.Visible = true;
+            this.colRunningThroughLoss.Visible = true;
+            this.colBranchThroughLoss.Visible = true;
+            this.colElev.Visible = true;
+            this.colMinorLoss.Visible = true;
+            this.colCalcuPress.Visible = true;
+            this.colCalcuHead.Visible = true;
+            this.colHasDb.Visible = true;
+            this.colFlags.Visible = true;
+            this.colDescription.Visible = true;
+            this.colSet.Visible = true;
+        }
+
+        /// <summary>
+        /// 璁剧疆鎵归噺璁剧疆妯″紡
+        /// </summary>
+        public void SetBulkSetView()
+        {
+            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+            this.colDbLocked.Visible = true;
+            this.colName.Visible = true;
+            this.colCode.Visible = true;
+            this.colModelType.Visible = true;
+            this.colMaterial.Visible = true;
+            this.colCaliber.Visible = true;
+            this.colRunningThroughLoss.Visible = true;
+            this.colBranchThroughLoss.Visible = true;
+            this.colElev.Visible = true;
+            this.colMinorLoss.Visible = true;
+            this.colCalcuPress.Visible = false;
+            this.colCalcuHead.Visible = false;
+            this.colHasDb.Visible = true;
+            this.colFlags.Visible = true;
+            this.colDescription.Visible = true;
+            this.colSet.Visible = true;
+        }
+
+
 
     }
 }

--
Gitblit v1.9.3