From 1e387f457092df846ec04e2c6792b83244aae04e Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期六, 07 十二月 2024 12:09:23 +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/08-working/XhsProjectSimulationWorkingPage.cs |  238 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 147 insertions(+), 91 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
index a42dee2..a8b09e0 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
@@ -9,6 +9,7 @@
 using Yw.WinFrmUI.Q3d;
 using Yw.EPAnet;
 using Mapster;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
 namespace HStation.WinFrmUI
 {
     public partial class XhsProjectSimulationWorkingPage : DocumentPage
@@ -18,7 +19,18 @@
             InitializeComponent();
             this.PageTitle.Caption = "姘村姏妯℃嫙宸ュ喌";
             this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+
         }
+
+
+        /// <summary>
+        /// 鏇存柊宸ュ喌浜嬩欢
+        /// </summary>
+        public event Action<HydroWorkingVmo> UpdateWorkingEvent;
+        /// <summary>
+        /// 绉婚櫎宸ュ喌浜嬩欢
+        /// </summary>
+        public event Action<HydroWorkingVmo> RemoveWorkingEvent;
 
         private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰
         private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔�
@@ -80,10 +92,10 @@
         #region BIM鎺т欢
 
         //bimface鎺т欢
-        private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null;
+        private SimulationBimfaceCtrl _bimfaceCtrl = null;
 
         //鑾峰彇 bimface 鎺т欢
-        private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl()
+        private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl()
         {
             if (_hydroInfo == null)
             {
@@ -91,7 +103,7 @@
             }
             if (_bimfaceCtrl == null)
             {
-                _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
+                _bimfaceCtrl = new SimulationBimfaceCtrl();
                 _bimfaceCtrl.Dock = DockStyle.Fill;
                 await _bimfaceCtrl.InitialData(_project, _projectSite);
                 _bimfaceCtrl.LoadCompletedEvent += async () =>
@@ -167,10 +179,10 @@
         #region 灞炴�ф帶浠�
 
         //灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl _propertyCtrl = null;
+        private HydroVisualPropertyViewCtrl _propertyCtrl = null;
 
         //鑾峰彇灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl GetPropertyCtrl()
+        private HydroVisualPropertyViewCtrl GetPropertyCtrl()
         {
             if (_hydroInfo == null)
             {
@@ -178,11 +190,11 @@
             }
             if (_propertyCtrl == null)
             {
-                _propertyCtrl = new XhsProjectSimulationPropertyCtrl();
+                _propertyCtrl = new HydroVisualPropertyViewCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
-                _propertyCtrl.HydroViewEvent += (visual) =>
+                _propertyCtrl.HydroViewEvent += (visualViewModel) =>
                 {
-                    SelectVisual(visual, eVisualSource.Property);
+                    SelectVisual(GetVisual(visualViewModel), eVisualSource.Property);
                 };
                 _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) =>
                 { //寮鸿皟杩炴帴鑺傜偣
@@ -221,38 +233,6 @@
                     await Task.Delay(5000);
                     await _bimfaceCtrl?.ClearBlinkComponents();
                 };
-                _propertyCtrl.PropertyValueChangedEvent += async (visual) =>
-                {
-                    if (visual == null)
-                    {
-                        return;
-                    }
-                    UpdateVisualListCtrl();
-                    var gradingHelper = await GetGradingHelper();
-                    gradingHelper.Set();
-                };
-                _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) =>
-                {
-                    //鏍囨敞灞炴�у彂鐢熸敼鍙�
-                    //鍒ゆ柇褰撳墠鏄惁鏈夋爣娉ㄥ睍绀猴紝鑻ユ湁鍒欐洿鏂版爣娉紝鏈�濂芥槸鏇存柊鍗曚釜鏍囨敞
-                    var markHelper = await GetMarkHelper();
-                    markHelper.Set(visual);
-                };
-                _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) =>
-                {
-                    //鍒嗙骇灞炴�у彂鐢熸敼鍙�
-                    //鍒ゆ柇褰撳墠鏄惁鏈夊垎绾у睍绀猴紝鑻ユ湁鍒欐洿鏂板垎绾э紝鏈�濂芥槸鏇存柊鍗曚釜鍒嗙骇
-                    var gradingHelper = await GetGradingHelper();
-                    gradingHelper.Set(visual);
-                };
-                _propertyCtrl.FlowEffectPropertyValueChangedEvent += async (visual) =>
-                {
-                    //娴佸悜灞炴�у彂鐢熸敼鍙�
-                    //鍒ゆ柇娴佸悜鏄惁鍔犺浇锛屽鏋滃姞杞藉垯鏇存柊娴佸悜锛屾渶濂芥槸鏇存柊鍗曚釜娴佸悜
-                    var flowEffectHelper = await GetFlowEffectHelper();
-                    flowEffectHelper.Set(visual);
-                };
-
             }
             return _propertyCtrl;
         }
@@ -266,7 +246,7 @@
                 {
                     if (this.controlContainerRight.Controls.Count > 0)
                     {
-                        if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl)
+                        if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl)
                         {
                             return true;
                         }
@@ -425,6 +405,23 @@
             return _visualListHelper;
         }
 
+        //鑾峰彇鍙鏋勪欢
+        private Yw.Model.HydroVisualInfo GetVisual(string code)
+        {
+            if (string.IsNullOrEmpty(code))
+            {
+                return default;
+            }
+            var visualListHelper = GetVisualListHelper();
+            return visualListHelper.GetVisual(code);
+        }
+
+        //鑾峰彇鍙鏋勪欢
+        private Yw.Model.HydroVisualInfo GetVisual(HydroVisualViewModel visualViewModel)
+        {
+            return GetVisual(visualViewModel?.Code);
+        }
+
         #endregion
 
         #region 瑙嗗浘鍒楄〃
@@ -448,6 +445,23 @@
             return _visualVmListHelper;
         }
 
+        //鑾峰彇鍙瑙嗗浘
+        private HydroVisualViewModel GetVisualViewModel(string code)
+        {
+            if (string.IsNullOrEmpty(code))
+            {
+                return default;
+            }
+            var visualVmListHelper = GetVisualVmListHelper();
+            return visualVmListHelper.GetVisual(code);
+        }
+
+        //鑾峰彇鍙瑙嗗浘
+        private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual)
+        {
+            return GetVisualViewModel(visual?.Code);
+        }
+
         #endregion
 
         #region 鏄庣粏鎺т欢
@@ -465,10 +479,6 @@
                 _visualListCtrl.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.List);
-                };
-                _visualListCtrl.HydroChangedInfoEvent += (visualList) =>
-                {
-                    SelectVisual(_visual, eVisualSource.List);
                 };
             }
             return _visualListCtrl;
@@ -512,15 +522,7 @@
             var visualVmListHelper = GetVisualVmListHelper();
             var allVisualVmList = visualVmListHelper.GetVisualList();
             visualListCtrl.SetBindingData(allVisualVmList);
-            var calcuResult = GetCalcuResult();
-            if (calcuResult != null && calcuResult.Succeed)
-            {
-                visualListCtrl.SetCalcuView();
-            }
-            else
-            {
-                visualListCtrl.SetNormalView();
-            }
+            visualListCtrl.SetResultView();
         }
 
         //鏇存柊鏋勪欢鏄庣粏鎺т欢
@@ -1415,26 +1417,26 @@
 
             }
 
-            var dlg = new PumpParallelAnalyDlg();
-            dlg.SetBindingData(vmList);
-            dlg.ReloadDataEvent += (list) =>
-            {
-                list?.ForEach(x =>
-                {
-                    var pump = pumps.Find(t => t.Code == x.Code);
-                    if (pump != null)
-                    {
-                        pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
-                        pump.SpeedRatio = x.CurrentHz / pump.RatedHz;
-                    }
-                });
-                var codes = list?.Select(x => x.Code).ToList();
-                //UpdateVisualViewModelProperty(codes);
-                //ShowSelectedProperty();
-                UpdateVisualListCtrl();
-                return true;
-            };
-            dlg.ShowDialog();
+            //var dlg = new PumpParallelAnalyDlg();
+            //dlg.SetBindingData(vmList);
+            //dlg.ReloadDataEvent += (list) =>
+            //{
+            //    list?.ForEach(x =>
+            //    {
+            //        var pump = pumps.Find(t => t.Code == x.Code);
+            //        if (pump != null)
+            //        {
+            //            pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
+            //            pump.SpeedRatio = x.CurrentHz / pump.RatedHz;
+            //        }
+            //    });
+            //    var codes = list?.Select(x => x.Code).ToList();
+            //    //UpdateVisualViewModelProperty(codes);
+            //    //ShowSelectedProperty();
+            //    UpdateVisualListCtrl();
+            //    return true;
+            //};
+            //dlg.ShowDialog();
         }
 
         //骞惰仈鍒嗘瀽
@@ -1618,23 +1620,23 @@
 
             }
 
-            var dlg = new PumpParallelAnalyDlg();
-            dlg.SetBindingData(vmList);
-            dlg.ReloadDataEvent += (list) =>
-            {
-                list?.ForEach(x =>
-                {
-                    var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code);
-                    if (pump != null)
-                    {
-                        pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
-                        pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1);
-                    }
-                });
-                //ShowSelectedProperty();
-                return true;
-            };
-            dlg.ShowDialog();
+            //var dlg = new PumpParallelAnalyDlg();
+            //dlg.SetBindingData(vmList);
+            //dlg.ReloadDataEvent += (list) =>
+            //{
+            //    list?.ForEach(x =>
+            //    {
+            //        var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code);
+            //        if (pump != null)
+            //        {
+            //            pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
+            //            pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1);
+            //        }
+            //    });
+            //    //ShowSelectedProperty();
+            //    return true;
+            //};
+            //dlg.ShowDialog();
         }
 
         //鑳芥晥鍒嗘瀽
@@ -1722,9 +1724,63 @@
 
         #endregion
 
+        #region 鏇存柊宸ュ喌
 
+        //缂栬緫
+        private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            if (_working == null)
+            {
+                return;
+            }
+            var dlg = new EditHydroWorkingDlg();
+            dlg.SetBindingData(_working);
+            dlg.ReloadDataEvent += (rhs) =>
+            {
+                _working = rhs;
+                this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}";
+                UpdatePageTitle(this.PageGuid, this.PageTitle);
+                this.UpdateWorkingEvent?.Invoke(_working);
+            };
+            dlg.ShowDialog();
+        }
 
+        #endregion
 
+        #region 鍒犻櫎宸ュ喌
+
+        //鍒犻櫎
+        private async void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            if (_working == null)
+            {
+                return;
+            }
+            var bol = XtraMessageBox.Show("璇烽棶鏄惁鍒犻櫎褰撳墠宸ュ喌锛�", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes;
+            if (!bol)
+            {
+                return;
+            }
+            bol = await BLLFactory<Yw.BLL.HydroWorking>.Instance.DeleteByID(_working.ID);
+            if (!bol)
+            {
+                TipFormHelper.ShowError("鍒犻櫎澶辫触锛�");
+                return;
+            }
+            this.RemoveWorkingEvent?.Invoke(_working);
+            TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�");
+            ClosePage(this.PageGuid);
+        }
+
+        #endregion
 
 
     }

--
Gitblit v1.9.3