lixiaojun
2024-10-22 18225d288883a20cb7c634bda8032e1ecfee89da
型号展示界面调用
已修改4个文件
246 ■■■■ 文件已修改
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/XhsProjectSimulationPropertyCtrl.cs 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/03-property/HydroParterPropertyCtrl.cs 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/GlobalUsings.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/XhsProjectSimulationPropertyCtrl.cs
@@ -12,9 +12,6 @@
        {
            InitializeComponent();
            this.hydroParterPropertyCtrl1.ViewCurveEvent += HydroParterPropertyCtrl1_ViewCurveEvent;
            this.hydroParterPropertyCtrl1.SetCurveEvent += HydroParterPropertyCtrl1_SetCurveEvent;
            this.hydroParterPropertyCtrl1.SetPatternEvent += HydroParterPropertyCtrl1_SetPatternEvent;
            this.hydroParterPropertyCtrl1.PropertyValueChangedEvent += HydroParterPropertyCtrl1_PropertyValueChangedEvent;
            this.hydroParterPropertyCtrl1.PropertyValueChangingEvent += HydroParterPropertyCtrl1_PropertyValueChangingEvent;
            this.hydroParterPropertyCtrl1.MatchingDbEvent += HydroParterPropertyCtrl1_MatchingDbEvent;
@@ -223,110 +220,109 @@
        }
        //匹配Db
        private void HydroParterPropertyCtrl1_MatchingDbEvent(Yw.Model.HydroParterInfo parter)
        private bool HydroParterPropertyCtrl1_MatchingDbEvent(HydroParterPropertyViewModel propertyViewModel)
        {
            if (parter == null)
            var bol = false;
            if (propertyViewModel == null)
            {
                return;
                return bol;
            }
            var hydroInfo = _hydroInfoFunc?.Invoke();
            if (hydroInfo == null)
            {
                return;
                return bol;
            }
            switch (parter.Catalog)
            var catalog = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogCode(propertyViewModel.Catalog);
            switch (catalog)
            {
                case Yw.Hydro.ParterCatalog.Pump://水泵
                    {
                        var pumpInfo = hydroInfo.Pumps?.Find(x => x.Code == parter.Code);
                        var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo);
                        if (!string.IsNullOrEmpty(pumpInfo.DbId))
                        var pumpInfo = hydroInfo.Pumps?.Find(x => x.Code == propertyViewModel.Code);
                        if (pumpInfo == null)
                        {
                            var detailDlg = new PumpFullInfoViewDlg();
                            detailDlg.SetBindindData(input);
                            detailDlg.ShowDialog();
                            break;
                        }
                        else
                        var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo);
                        if (string.IsNullOrEmpty(pumpInfo.DbId))
                        {
                            var dlg = new PumpSingleMatchingDlg();
                            dlg.SetBindingData(input);
                            dlg.ReloadDataEvent += (rhs) =>
                            dlg.ReloadDataEvent += (output) =>
                            {
                                var bol = AssetsMatchingParasHelper.Apply(hydroInfo, rhs);
                                bol = AssetsMatchingParasHelper.Apply(hydroInfo, output);
                                if (bol)
                                {
                                    TipFormHelper.ShowSucceed("匹配成功");
                                    propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters());
                                }
                            };
                            dlg.ShowDialog();
                                }
                                else
                                {
                                    TipFormHelper.ShowWarn("匹配失败");
                            var dlg = new PumpFullInfoViewDlg();
                            dlg.SetBindindData(input);
                            dlg.ReloadDataEvent += (output) =>
                            {
                                bol = AssetsMatchingParasHelper.Apply(hydroInfo, output);
                                if (bol)
                                {
                                    propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters());
                                }
                            };
                            dlg.ShowDialog();
                        }
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Valve://阀门
                    {
                        var valveInfo = hydroInfo.Valves?.Find(x => x.Code == parter.Code);
                        var valveInfo = hydroInfo.Valves?.Find(x => x.Code == propertyViewModel.Code);
                        if (valveInfo == null)
                        {
                            break;
                        }
                        var input = AssetsMatchingParasHelper.Create(hydroInfo, valveInfo);
                        var dlg = new ValveSingleMatchingDlg();
                        dlg.SetBindingData(input);
                        dlg.ReloadDataEvent += (rhs) =>
                        {
                            var bol = AssetsMatchingParasHelper.Apply(hydroInfo, rhs);
                            if (bol)
                            {
                                TipFormHelper.ShowSucceed("匹配成功");
                            }
                            else
                            {
                                TipFormHelper.ShowWarn("匹配失败");
                            }
                            bol = AssetsMatchingParasHelper.Apply(hydroInfo, rhs);
                        };
                        dlg.ShowDialog();
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Pipe://管道
                    {
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Elbow://弯头
                    {
                        var elbowInfo = hydroInfo.Elbows?.Find(x => x.Code == parter.Code);
                        var elbowInfo = hydroInfo.Elbows?.Find(x => x.Code == propertyViewModel.Code);
                        if (elbowInfo == null)
                        {
                            break;
                        }
                        var input = AssetsMatchingParasHelper.Create(hydroInfo, elbowInfo);
                        var dlg = new ElbowSingMatchingDlg();
                        dlg.SetBindingData(input);
                        dlg.ReloadDataEvent += (rhs) =>
                        dlg.ReloadDataEvent += (output) =>
                        {
                            var bol = AssetsMatchingParasHelper.Apply(hydroInfo, rhs);
                            if (bol)
                            {
                                TipFormHelper.ShowSucceed("匹配成功");
                            }
                            else
                            {
                                TipFormHelper.ShowWarn("匹配失败");
                            }
                            bol = AssetsMatchingParasHelper.Apply(hydroInfo, output);
                        };
                        dlg.ShowDialog();
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Threelink://三通
                    {
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Fourlink://四通
                    {
                    }
                    break;
                default: break;
            }
            return bol;
        }
        //强调连接组件
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -1,9 +1,5 @@
global using Yw.EPAnet;
using DevExpress.Mvvm.Native;
using DevExpress.Pdf.Native;
using DevExpress.Utils.DirectXPaint;
using NetTaste;
using NPOI.SS.Formula.Functions;
using Yw.WinFrmUI.Bimface;
using Yw.WinFrmUI.Hydro;
@@ -178,7 +174,7 @@
            }
        }
        #endregion Bimface
        #endregion
        #region Q3d
WinFrmUI/Yw.WinFrmUI.Hydro.Core/03-property/HydroParterPropertyCtrl.cs
@@ -1,17 +1,9 @@
using DevExpress.Data.ExpressionEditor;
using DevExpress.Utils;
using DevExpress.XtraBars;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraLayout.Utils;
using DevExpress.XtraRichEdit.SpellChecker;
using DevExpress.XtraVerticalGrid.Events;
using NetTaste;
using SQLitePCL;
using System.Text;
using System.Windows.Forms.VisualStyles;
using Yw.EPAnet;
namespace Yw.WinFrmUI
{
@@ -27,18 +19,22 @@
        /// <summary>
        /// 匹配db事件
        /// 第一个参数为匹配Db的ViewModel
        /// 第二个参数为是否匹配成功
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> MatchingDbEvent;
        /// <summary>
        /// 查看曲线事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo, string> ViewCurveEvent;
        public event Func<HydroParterPropertyViewModel, bool> MatchingDbEvent;
        /// <summary>
        /// 设置曲线事件
        /// 第一个参数为设置曲线的ViewModel
        /// 第二个参数为曲线类型
        /// 第三个参数为是否设置成功
        /// </summary>
        public event Func<HydroParterPropertyViewModel, string, bool> SetCurveEvent;
        /// <summary>
        /// 设置模式事件
        /// 第一个参数为设置模式事的ViewModel
        /// 第二个参数为模式事类型
        /// 第三个参数为是否设置成功
        /// </summary>
        public event Func<HydroParterPropertyViewModel, string, bool> SetPatternEvent;
        /// <summary>
@@ -49,14 +45,12 @@
        /// 属性值发生改变事件
        /// </summary>
        public event Func<HydroParterPropertyViewModel, bool> PropertyValueChangedEvent;
        /// <summary>
        /// 强调连接组件事件
        /// 第一个参数为本身Code
        /// 第二个参数为连接Code
        /// </summary>
        public event Action<string, string> BlinkLinkParterEvent;
        //获取水力信息方法
@@ -356,10 +350,44 @@
            #endregion
            #region 型号
            var modelTypeAttri = (IsHydroModelTypeAttribute)descriptor.Attributes[typeof(IsHydroModelTypeAttribute)];
            if (modelTypeAttri != null)
            {
                var buttonEdit = new RepositoryItemButtonEdit();
                buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor;
                buttonEdit.ButtonClick += delegate
                {
                    if (this.MatchingDbEvent == null)
                    {
                        return;
                    }
                    var hydroInfo = _hydroInfoFunc?.Invoke();
                    if (hydroInfo == null)
                    {
                        return;
                    }
                    var vm = GetPropertyViewModel(e.Row);
                    if (vm == null)
                    {
                        return;
                    }
                    var bol = this.MatchingDbEvent.Invoke(vm);
                    if (bol)
                    {
                        UpdateRows();
                    }
                };
                e.RepositoryItem = buttonEdit;
            }
            #endregion
            #region 曲线
            var curvePro = (IsHydroCurveProAttribute)descriptor.Attributes[typeof(IsHydroCurveProAttribute)];
            if (curvePro != null)
            var curvePropAttri = (IsHydroCurveProAttribute)descriptor.Attributes[typeof(IsHydroCurveProAttribute)];
            if (curvePropAttri != null)
            {
                var buttonEdit = new RepositoryItemButtonEdit();
                buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor;
@@ -371,24 +399,22 @@
                        return;
                    }
                    var vm = GetPropertyViewModel(e.Row);
                    switch (curvePro.CurveType)
                    switch (curvePropAttri.CurveType)
                    {
                        case HydroCurve.Pump:
                            {
                                var pumpInfo = hydroInfo.Pumps?.Find(x => x.Code == vm.Code);
                                if (pumpInfo == null)
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, HydroCurve.Pump))
                                {
                                    return;
                                    //缺省的设置方法
                                }
                                this.ViewCurveEvent?.Invoke(pumpInfo, HydroCurve.Pump);
                            }
                            break;
                        case HydroCurve.PumpQH:
                            {
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePro.CurveType))
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, HydroCurve.PumpQH))
                                {
                                    var vmPump = vm as HydroPumpPropertyViewModel;
                                    var curveQh = hydroInfo.Curves?.Find(x => x.Code == vmPump.CurveQH);
                                    var pumpViewModel = vm as HydroPumpPropertyViewModel;
                                    var curveQh = hydroInfo.Curves?.Find(x => x.Code == pumpViewModel.CurveQH);
                                    var dlg = new SetHydroCurveDlg();
                                    dlg.ReloadDataEvent += (curveInfo) =>
                                    {
@@ -401,20 +427,20 @@
                                            hydroInfo.Curves.Remove(curveQh);
                                        }
                                        hydroInfo.Curves.Add(curveInfo);
                                        vmPump.CurveQH = curveInfo.Code;
                                        pumpViewModel.CurveQH = curveInfo.Code;
                                        UpdateRows();
                                    };
                                    dlg.SetBindingData(hydroInfo, curveQh, curvePro.CurveType);
                                    dlg.SetBindingData(hydroInfo, curveQh, curvePropAttri.CurveType);
                                    dlg.ShowDialog();
                                }
                            }
                            break;
                        case HydroCurve.PumpQP:
                            {
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePro.CurveType))
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePropAttri.CurveType))
                                {
                                    var vmPump = vm as HydroPumpPropertyViewModel;
                                    var curveQp = hydroInfo.Curves?.Find(x => x.Code == vmPump.CurveQP);
                                    var pumpViewModel = vm as HydroPumpPropertyViewModel;
                                    var curveQp = hydroInfo.Curves?.Find(x => x.Code == pumpViewModel.CurveQP);
                                    var dlg = new SetHydroCurveDlg();
                                    dlg.ReloadDataEvent += (curveInfo) =>
                                    {
@@ -427,20 +453,18 @@
                                            hydroInfo.Curves.Remove(curveQp);
                                        }
                                        hydroInfo.Curves.Add(curveInfo);
                                        vmPump.CurveQP = curveInfo.Code;
                                        pumpViewModel.CurveQP = curveInfo.Code;
                                        UpdateRows();
                                    };
                                    dlg.SetBindingData(hydroInfo, curveQp, curvePro.CurveType);
                                    dlg.SetBindingData(hydroInfo, curveQp, curvePropAttri.CurveType);
                                    dlg.ShowDialog();
                                }
                            }
                            break;
                        case HydroCurve.PumpQE:
                            {
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePro.CurveType))
                                {
                                    var vmPump = vm as HydroPumpPropertyViewModel;
                                    var curveQe = hydroInfo.Curves?.Find(x => x.Code == vmPump.CurveQE);
                                var pumpViewModel = vm as HydroPumpPropertyViewModel;
                                var curveQe = hydroInfo.Curves?.Find(x => x.Code == pumpViewModel.CurveQE);
                                    var dlg = new SetHydroCurveDlg();
                                    dlg.ReloadDataEvent += (curveInfo) =>
                                    {
@@ -453,24 +477,26 @@
                                            hydroInfo.Curves.Remove(curveQe);
                                        }
                                        hydroInfo.Curves.Add(curveInfo);
                                        vmPump.CurveQE = curveInfo.Code;
                                    pumpViewModel.CurveQE = curveInfo.Code;
                                        UpdateRows();
                                    };
                                    dlg.SetBindingData(hydroInfo, curveQe, curvePro.CurveType);
                                dlg.SetBindingData(hydroInfo, curveQe, curvePropAttri.CurveType);
                                    dlg.ShowDialog();
                                }
                            }
                            break;
                        case HydroCurve.Valve:
                            {
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, HydroCurve.Valve))
                                {
                                    //缺省的设置方法
                                }
                            }
                            break;
                        case HydroCurve.ValveQL:
                            {
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePro.CurveType))
                                if (this.SetCurveEvent == null || !this.SetCurveEvent.Invoke(vm, curvePropAttri.CurveType))
                                {
                                    //缺省的设置方法
                                }
                            }
                            break;
@@ -482,10 +508,10 @@
            #endregion
            #region 型号
            #region 模式
            var modelTypePro = (IsHydroModelTypeAttribute)descriptor.Attributes[typeof(IsHydroModelTypeAttribute)];
            if (modelTypePro != null)
            var patternProAttri = (IsHydroPatternProAttribute)descriptor.Attributes[typeof(IsHydroPatternProAttribute)];
            if (patternProAttri != null)
            {
                var buttonEdit = new RepositoryItemButtonEdit();
                buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor;
@@ -497,26 +523,25 @@
                        return;
                    }
                    var vm = GetPropertyViewModel(e.Row);
                    var allParterList = hydroInfo.GetAllParters();
                    var parter = allParterList?.Find(x => x.Code == vm.Code);
                    this.MatchingDbEvent?.Invoke(parter);
                };
                e.RepositoryItem = buttonEdit;
                    switch (patternProAttri.PatternType)
                    {
                        case HydroPattern.Head:
                            {
                                if (this.SetPatternEvent == null || !this.SetPatternEvent.Invoke(vm, HydroPattern.Head))
                                {
                                    //缺省的设置方法
            }
            #endregion
            #region 模式
            var patternPro = (IsHydroPatternProAttribute)descriptor.Attributes[typeof(IsHydroPatternProAttribute)];
            if (patternPro != null)
                            }
                            break;
                        case HydroPattern.Demand:
            {
                var buttonEdit = new RepositoryItemButtonEdit();
                buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor;
                buttonEdit.ButtonClick += delegate
                                if (this.SetPatternEvent == null || !this.SetPatternEvent.Invoke(vm, HydroPattern.Demand))
                {
                    var vm = GetPropertyViewModel(e.Row);
                    this.SetPatternEvent?.Invoke(vm, patternPro.PatternType);
                                    //缺省的设置方法
                                }
                            }
                            break;
                    }
                };
                e.RepositoryItem = buttonEdit;
            }
WinFrmUI/Yw.WinFrmUI.Hydro.Core/GlobalUsings.cs
@@ -5,3 +5,4 @@
global using System.ComponentModel;
global using System.ComponentModel.DataAnnotations;
global using Yw.Vmo;
global using System.Text;