lixiaojun
2024-12-03 c7c7ba392c1767eb58942b82e7243bbdf4af5b0a
水力匹配应用
已删除1个文件
已重命名15个文件
已修改1个文件
已添加2个文件
2389 ■■■■ 文件已修改
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/01-const/HydroElbow.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs 2227 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-tank/HydroTankMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-blunthead/HydroBluntheadMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-threelink/HydroThreelinkMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-fourlink/HydroFourlinkMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-meter/HydroMeterMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-flowmeter/HydroFlowmeterMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-pressmeter/HydroFlowmeterMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-hydrant/HydroHydrantMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-pipe/HydroPipeMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-translation/HydroTranslationMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-exchanger/HydroExchangerMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-compressor/HydroCompressorMatchingViewModel.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/01-const/HydroElbow.cs
ÎļþÒÑɾ³ý
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
namespace Yw.WinFrmUI
{
    /// <summary>
    /// å¼¯å¤´æžšä¸¾è¾…助类
    /// </summary>
    public class HydroElbowTypeEnumHelper
    {
        //字典
        private static readonly Dictionary<eElbowType, string> _dict = new Dictionary<eElbowType, string>()
        {
            { eElbowType.Short,"短径"},
            { eElbowType.Middle,"中径"},
            { eElbowType.Long,"长径"}
        };
        /// <summary>
        /// èŽ·å–å¼¯å¤´ç±»åž‹
        /// </summary>
        public static eElbowType? GetElbowType(string name)
        {
            if (_dict.ContainsValue(name))
            {
                return _dict.First(x => x.Value == name).Key;
            }
            return default;
        }
        /// <summary>
        /// èŽ·å–å¼¯å¤´ç±»åž‹åç§°
        /// </summary>
        public static string GetElbowTypeName(eElbowType elbowType)
        {
            if (_dict.ContainsKey(elbowType))
            {
                return _dict[elbowType];
            }
            return default;
        }
    }
}
WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yw.WinFrmUI
{
    /// <summary>
    /// é˜€é—¨ç±»åž‹æžšä¸¾è¾…助类
    /// </summary>
    public class HydroValveTypeEnumHelper
    {
        //字典
        private static readonly Dictionary<eValveType, string> _dict = new Dictionary<eValveType, string>()
        {
            { eValveType.PRV,Yw.Hydro.ValveType.PRV},
            { eValveType.PBV,Yw.Hydro.ValveType.PBV},
            { eValveType.PSV,Yw.Hydro.ValveType.PSV},
            { eValveType.FCV,Yw.Hydro.ValveType.FCV},
            { eValveType.TCV,Yw.Hydro.ValveType.TCV},
             { eValveType.GPV,Yw.Hydro.ValveType.GPV},
             { eValveType.CV,Yw.Hydro.ValveType.CV},
        };
        /// <summary>
        /// èŽ·å–é˜€é—¨ç±»åž‹
        /// </summary>
        public static eValveType? GetValveType(string name)
        {
            if (_dict.ContainsValue(name))
            {
                return _dict.First(x => x.Value == name).Key;
            }
            return default;
        }
        /// <summary>
        /// èŽ·å–é˜€é—¨ç±»åž‹ç¼–ç 
        /// </summary>
        public static string GetValveTypeCode(eValveType valveType)
        {
            if (_dict.ContainsKey(valveType))
            {
                return _dict[valveType];
            }
            return default;
        }
    }
}
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs
@@ -1,4 +1,8 @@
using Yw.Model;
using DevExpress.XtraSpreadsheet.Model.CopyOperation;
using System.Windows.Media.Imaging;
using Yw.DAL.Basic;
using Yw.EPAnet;
using Yw.Model;
namespace Yw.WinFrmUI
{
@@ -651,82 +655,1116 @@
        #region åº”用
        ///// <summary>
        ///// åº”用资产自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, AssetsMatchingViewModel output)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (output == null)
        //    {
        //        return false;
        //    }
        /// <summary>
        /// åº”用自动匹配ViewModel
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, HydroMatchingViewModel matchingInfo)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (matchingInfo == null)
            {
                return false;
            }
        //    bool result = false;
            bool result = false;
        //    //æ°´æ³µ
        //    output.PumpMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            #region æ°´æ± 
        //    //阀门
        //    output.ValveMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            var allTanks = hydroInfo.GetAllTanks();
            if (allTanks != null && allTanks.Count > 0)
            {
                if (matchingInfo.Tanks != null && matchingInfo.Tanks.Count > 0)
                {
                    allTanks.ForEach(x =>
                    {
                        var matching = matchingInfo.Tanks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
        //    //管道
        //    output.PipeMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            }
        //    //弯头
        //    output.ElbowMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            #endregion
        //    //三通
        //    output.ThreelinkMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            #region é—·å¤´
        //    //四通
        //    output.FourlinkMatchingList?.ForEach(x =>
        //    {
        //        if (Apply(hydroInfo, x))
        //        {
        //            result = true;
        //        }
        //    });
            if (hydroInfo.Bluntheads != null && hydroInfo.Bluntheads.Count > 0)
            {
                if (matchingInfo.Bluntheads != null && matchingInfo.Bluntheads.Count > 0)
                {
                    hydroInfo.Bluntheads.ForEach(x =>
                    {
                        var matching = matchingInfo.Bluntheads.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
        //    return result;
        //}
            #endregion
            #region å¼¯å¤´
            if (hydroInfo.Elbows != null && hydroInfo.Elbows.Count > 0)
            {
                if (matchingInfo.Elbows != null && matchingInfo.Elbows.Count > 0)
                {
                    hydroInfo.Elbows.ForEach(x =>
                    {
                        var matching = matchingInfo.Elbows.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region ä¸‰é€š
            if (hydroInfo.Threelinks != null && hydroInfo.Threelinks.Count > 0)
            {
                if (matchingInfo.Threelinks != null && matchingInfo.Threelinks.Count > 0)
                {
                    hydroInfo.Threelinks.ForEach(x =>
                    {
                        var matching = matchingInfo.Threelinks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region å››é€š
            if (hydroInfo.Fourlinks != null && hydroInfo.Fourlinks.Count > 0)
            {
                if (matchingInfo.Fourlinks != null && matchingInfo.Fourlinks.Count > 0)
                {
                    hydroInfo.Fourlinks.ForEach(x =>
                    {
                        var matching = matchingInfo.Fourlinks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region å–·å¤´
            if (hydroInfo.Nozzles != null && hydroInfo.Nozzles.Count > 0)
            {
                if (matchingInfo.Nozzles != null && matchingInfo.Nozzles.Count > 0)
                {
                    hydroInfo.Nozzles.ForEach(x =>
                    {
                        var matching = matchingInfo.Nozzles.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region æ¶ˆç«æ “
            if (hydroInfo.Hydrants != null && hydroInfo.Hydrants.Count > 0)
            {
                if (matchingInfo.Hydrants != null && matchingInfo.Hydrants.Count > 0)
                {
                    hydroInfo.Hydrants.ForEach(x =>
                    {
                        var matching = matchingInfo.Hydrants.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region æ°´è¡¨
            if (hydroInfo.Meters != null && hydroInfo.Meters.Count > 0)
            {
                if (matchingInfo.Meters != null && matchingInfo.Meters.Count > 0)
                {
                    hydroInfo.Meters.ForEach(x =>
                    {
                        var matching = matchingInfo.Meters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region æµé‡è®¡
            if (hydroInfo.Flowmeters != null && hydroInfo.Flowmeters.Count > 0)
            {
                if (matchingInfo.Flowmeters != null && matchingInfo.Flowmeters.Count > 0)
                {
                    hydroInfo.Flowmeters.ForEach(x =>
                    {
                        var matching = matchingInfo.Flowmeters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region åŽ‹åŠ›è¡¨
            if (hydroInfo.Pressmeters != null && hydroInfo.Pressmeters.Count > 0)
            {
                if (matchingInfo.Pressmeters != null && matchingInfo.Pressmeters.Count > 0)
                {
                    hydroInfo.Pressmeters.ForEach(x =>
                    {
                        var matching = matchingInfo.Pressmeters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region ç®¡é“
            if (hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
            {
                if (matchingInfo.Pipes != null && matchingInfo.Pipes.Count > 0)
                {
                    hydroInfo.Pipes.ForEach(x =>
                    {
                        var matching = matchingInfo.Pipes.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region è¿‡æ¸¡ä»¶
            if (hydroInfo.Translations != null && hydroInfo.Translations.Count > 0)
            {
                if (matchingInfo.Translations != null && matchingInfo.Translations.Count > 0)
                {
                    hydroInfo.Translations.ForEach(x =>
                    {
                        var matching = matchingInfo.Translations.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region é˜€é—¨
            if (hydroInfo.Valves != null && hydroInfo.Valves.Count > 0)
            {
                if (matchingInfo.Valves != null && matchingInfo.Valves.Count > 0)
                {
                    hydroInfo.Valves.ForEach(x =>
                    {
                        var matching = matchingInfo.Valves.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region æ¢çƒ­å™¨
            if (hydroInfo.Exchangers != null && hydroInfo.Exchangers.Count > 0)
            {
                if (matchingInfo.Exchangers != null && matchingInfo.Exchangers.Count > 0)
                {
                    hydroInfo.Exchangers.ForEach(x =>
                    {
                        var matching = matchingInfo.Exchangers.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            #region ç©ºåŽ‹æœº
            if (hydroInfo.Compressors != null && hydroInfo.Compressors.Count > 0)
            {
                if (matchingInfo.Compressors != null && matchingInfo.Compressors.Count > 0)
                {
                    hydroInfo.Compressors.ForEach(x =>
                    {
                        var matching = matchingInfo.Compressors.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
                    });
                }
            }
            #endregion
            return result;
        }
        #region æ°´æ± 
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTankInfo visual, HydroTankMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.MinLevel = matching.MinLevel;
            visual.MaxLevel = matching.MaxLevel;
            visual.DN = matching.DN;
            visual.MinVol = matching.MinVol;
            visual.OverFlow = matching.OverFlow;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingMinLevel.HasValue)
                {
                    visual.MinLevel = matching.MatchingMinLevel.Value;
                    result = true;
                }
                if (matching.MatchingMaxLevel.HasValue)
                {
                    visual.MaxLevel = matching.MatchingMaxLevel.Value;
                    result = true;
                }
                if (matching.MatchingDN.HasValue)
                {
                    visual.DN = matching.MatchingDN.Value;
                    result = true;
                }
                if (matching.MatchingMinVol.HasValue)
                {
                    visual.MinVol = matching.MatchingMinVol.Value;
                    result = true;
                }
                if (matching.MatchingOverFlow.HasValue)
                {
                    visual.OverFlow = matching.MatchingOverFlow.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                {
                    var curvevol = hydroInfo.Curves?.Find(x => x.Code == visual.VolCurve);
                    if (curvevol == null)
                    {
                        curvevol = new Yw.Model.HydroCurveInfo();
                        curvevol.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curvevol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curvevol.Name = "匹配";
                        curvevol.ModelType = string.Empty;
                        curvevol.DbLocked = false;
                        curvevol.DbId = matching.MatchingCurveDbId;
                        curvevol.CurveType = Yw.WinFrmUI.HydroCurve.TankVol;
                        curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curvevol);
                        visual.VolCurve = curvevol.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curvevol.DbLocked)
                        {
                            curvevol.DbId = matching.MatchingCurveDbId;
                            curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
                }
            }
            return result;
        }
        #endregion
        #region é—·å¤´
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroBluntheadInfo visual, HydroBluntheadMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Caliber = matching.Caliber;
            visual.Material = matching.Material;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region å¼¯å¤´
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroElbowInfo visual, HydroElbowMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Caliber = matching.Caliber;
            visual.Material = matching.Material;
            visual.MinorLoss = matching.MinorLoss;
            visual.BendingAngle = matching.BendingAngle;
            if (matching.ElbowType.HasValue)
            {
                visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.ElbowType.Value);
            }
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingBendingAngle.HasValue)
                {
                    visual.BendingAngle = matching.MatchingBendingAngle.Value;
                    result = true;
                }
                if (matching.MatchingElbowType.HasValue)
                {
                    visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.MatchingElbowType.Value);
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region ä¸‰é€š
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroThreelinkInfo visual, HydroThreelinkMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Caliber = matching.Caliber;
            visual.Material = matching.Material;
            visual.MinorLoss = matching.MinorLoss;
            visual.RunningThroughLoss = matching.RunningThroughLoss;
            visual.BranchThroughLoss = matching.BranchThroughLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingRunningThroughLoss.HasValue)
                {
                    visual.RunningThroughLoss = matching.MatchingRunningThroughLoss.Value;
                    result = true;
                }
                if (matching.MatchingBranchThroughLoss.HasValue)
                {
                    visual.BranchThroughLoss = matching.MatchingBranchThroughLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region å››é€š
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFourlinkInfo visual, HydroFourlinkMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Caliber = matching.Caliber;
            visual.Material = matching.Material;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region å–·å¤´
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroNozzleInfo visual, HydroNozzleMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Caliber = matching.Caliber;
            visual.MinorLoss = matching.MinorLoss;
            visual.Coefficient = matching.Coefficient;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingCoefficient.HasValue)
                {
                    visual.Coefficient = matching.MatchingCoefficient.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region æ¶ˆç«æ “
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroHydrantInfo visual, HydroHydrantMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Caliber = matching.Caliber;
            visual.MinorLoss = matching.MinorLoss;
            visual.Coefficient = matching.Coefficient;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingCaliber.HasValue)
                {
                    visual.Caliber = matching.MatchingCaliber.Value;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingCoefficient.HasValue)
                {
                    visual.Coefficient = matching.MatchingCoefficient.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region æ°´è¡¨
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroMeterInfo visual, HydroMeterMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region æµé‡è®¡
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFlowmeterInfo visual, HydroFlowmeterMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region åŽ‹åŠ›è¡¨
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPressmeterInfo visual, HydroPressmeterMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region ç®¡é“
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPipeInfo visual, HydroPipeMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Diameter = matching.Diameter;
            visual.Roughness = matching.Roughness;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingRoughness.HasValue)
                {
                    visual.Roughness = matching.MatchingRoughness.Value;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
        #region è¿‡æ¸¡ä»¶
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTranslationInfo visual, HydroTranslationMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Diameter = matching.Diameter;
            visual.StartDiameter = matching.StartDiameter;
            visual.EndDiameter = matching.EndDiameter;
            visual.Roughness = matching.Roughness;
            visual.MinorLoss = matching.MinorLoss;
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingStartDiameter.HasValue)
                {
                    visual.StartDiameter = matching.MatchingStartDiameter.Value;
                    result = true;
                }
                if (matching.MatchingEndDiameter.HasValue)
                {
                    visual.EndDiameter = matching.MatchingEndDiameter.Value;
                    result = true;
                }
                if (matching.MatchingRoughness.HasValue)
                {
                    visual.Roughness = matching.MatchingRoughness.Value;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
            }
            return result;
        }
        #endregion
@@ -735,568 +1773,553 @@
        /// <summary>
        /// åº”用
        /// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, PumpMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPumpInfo visual, HydroPumpMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
        //    bool result = false;
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.RatedQ = matching.RatedQ;
            visual.RatedH = matching.RatedH;
            visual.RatedP = matching.RatedP;
            visual.RatedN = matching.RatedN;
            visual.RatedHz = matching.RatedHz;
            visual.SpeedRatio = matching.CurrentHz / visual.RatedHz;
        //    var pump = hydroInfo.Pumps?.Find(x => x.Code == matching.Code);
        //    if (pump != null)
        //    {
        //        pump.DbLocked = matching.DbLocked;
        //        pump.ModelType = matching.ModelType;
        //        pump.RatedP = matching.RatedP;
        //        pump.RatedQ = matching.RatedQ;
        //        pump.RatedH = matching.RatedH;
        //        pump.RatedN = matching.RatedN;
        //        pump.RatedHz = matching.RatedHz;
        //        pump.SpeedRatio = Math.Round(matching.CurrentHz / matching.RatedHz, 1);
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingRatedQ.HasValue)
                {
                    visual.RatedQ = matching.MatchingRatedQ.Value;
                    result = true;
                }
                if (matching.MatchingRatedH.HasValue)
                {
                    visual.RatedH = matching.MatchingRatedH.Value;
                    result = true;
                }
                if (matching.MatchingRatedP.HasValue)
                {
                    visual.RatedP = matching.MatchingRatedP.Value;
                    result = true;
                }
                if (matching.MatchingRatedN.HasValue)
                {
                    visual.RatedN = matching.MatchingRatedN.Value;
                    result = true;
                }
                if (matching.MatchingRatedHz.HasValue)
                {
                    visual.RatedHz = matching.MatchingRatedHz.Value;
                    result = true;
                }
                if (matching.MatchingCurrentHz.HasValue)
                {
                    visual.SpeedRatio = matching.MatchingCurrentHz.Value / visual.RatedHz;
                    result = true;
                }
        //        if (!pump.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                pump.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                pump.DbId = matching.MatchingDbId;
        //            }
        //            if (matching.MatchingRatedP.HasValue)
        //            {
        //                pump.RatedP = matching.MatchingRatedP.Value;
        //            }
        //            if (matching.MatchingRatedQ.HasValue)
        //            {
        //                pump.RatedQ = matching.MatchingRatedQ.Value;
        //            }
        //            if (matching.MatchingRatedH.HasValue)
        //            {
        //                pump.RatedH = matching.MatchingRatedH.Value;
        //            }
        //            if (matching.MatchingRatedN.HasValue)
        //            {
        //                pump.RatedN = matching.MatchingRatedN.Value;
        //            }
                if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                {
                    //流量扬程曲线
                    var curveqh = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQH);
                    if (curveqh == null)
                    {
                        curveqh = new Yw.Model.HydroCurveInfo();
                        curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curveqh.Name = "匹配";
                        curveqh.ModelType = string.Empty;
                        curveqh.DbLocked = false;
                        curveqh.DbId = matching.MatchingCurveDbId;
                        curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH;
                        curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curveqh);
                        visual.CurveQH = curveqh.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curveqh.DbLocked)
                        {
                            curveqh.DbId = matching.MatchingCurveDbId;
                            curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
        //            if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
        //            {
        //                //流量扬程曲线
        //                var curveqh = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQH);
        //                if (curveqh == null)
        //                {
        //                    curveqh = new Yw.Model.HydroCurveInfo();
        //                    curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve;
        //                    curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
        //                    curveqh.Name = "匹配";
        //                    curveqh.ModelType = string.Empty;
        //                    curveqh.DbLocked = false;
        //                    curveqh.DbId = matching.MatchingCurveDbId;
        //                    curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH;
        //                    curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    if (hydroInfo.Curves == null)
        //                    {
        //                        hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
        //                    }
        //                    hydroInfo.Curves.Add(curveqh);
        //                    pump.CurveQH = curveqh.Code;
        //                }
        //                else
        //                {
        //                    if (!curveqh.DbLocked)
        //                    {
        //                        curveqh.DbId = matching.MatchingCurveDbId;
        //                        curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    }
        //                }
                    //流量功率曲线
                    var curveqp = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQP);
                    if (curveqp == null)
                    {
                        curveqp = new Yw.Model.HydroCurveInfo();
                        curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curveqp.Name = "匹配";
                        curveqp.ModelType = string.Empty;
                        curveqp.DbLocked = false;
                        curveqp.DbId = matching.MatchingCurveDbId;
                        curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP;
                        curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curveqp);
                        visual.CurveQP = curveqp.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curveqp.DbLocked)
                        {
                            curveqp.DbId = matching.MatchingCurveDbId;
                            curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
        //                //流量功率曲线
        //                var curveqp = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP);
        //                if (curveqp == null)
        //                {
        //                    curveqp = new Yw.Model.HydroCurveInfo();
        //                    curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve;
        //                    curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
        //                    curveqp.Name = "匹配";
        //                    curveqp.ModelType = string.Empty;
        //                    curveqp.DbLocked = false;
        //                    curveqp.DbId = matching.MatchingCurveDbId;
        //                    curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP;
        //                    curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    if (hydroInfo.Curves == null)
        //                    {
        //                        hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
        //                    }
        //                    hydroInfo.Curves.Add(curveqp);
        //                    pump.CurveQP = curveqp.Code;
        //                }
        //                else
        //                {
        //                    if (!curveqp.DbLocked)
        //                    {
        //                        curveqp.DbId = matching.MatchingCurveDbId;
        //                        curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    }
        //                }
                    //流量效率曲线
                    var curveqe = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQE);
                    if (curveqe == null)
                    {
                        curveqe = new Yw.Model.HydroCurveInfo();
                        curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curveqe.Name = "匹配";
                        curveqe.ModelType = string.Empty;
                        curveqe.DbLocked = false;
                        curveqe.DbId = matching.MatchingCurveDbId;
                        curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE;
                        curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curveqe);
                        visual.CurveQE = curveqe.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curveqe.DbLocked)
                        {
                            curveqe.DbId = matching.MatchingCurveDbId;
                            curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
                }
            }
        //                //流量效率曲线
        //                var curveqe = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQE);
        //                if (curveqe == null)
        //                {
        //                    curveqe = new Yw.Model.HydroCurveInfo();
        //                    curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve;
        //                    curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
        //                    curveqe.Name = "匹配";
        //                    curveqe.ModelType = string.Empty;
        //                    curveqe.DbLocked = false;
        //                    curveqe.DbId = matching.MatchingCurveDbId;
        //                    curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE;
        //                    curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    if (hydroInfo.Curves == null)
        //                    {
        //                        hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
        //                    }
        //                    hydroInfo.Curves.Add(curveqe);
        //                    pump.CurveQE = curveqe.Code;
        //                }
        //                else
        //                {
        //                    if (!curveqe.DbLocked)
        //                    {
        //                        curveqe.DbId = matching.MatchingCurveDbId;
        //                        curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                    }
        //                }
        //            }
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
            return result;
        }
        #endregion
        ///// <summary>
        ///// åº”用阀门自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ValveMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        #region é˜€é—¨
        //    bool result = false;
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroValveInfo visual, HydroValveMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
        //    var valve = hydroInfo.Valves?.Find(x => x.Code == matching.Code);
        //    if (valve != null)
        //    {
        //        valve.DbLocked = matching.DbLocked;
        //        valve.ModelType = matching.ModelType;
        //        valve.Material = matching.Material;
        //        valve.Diameter = matching.Diameter;
        //        valve.MinorLoss = matching.MinorLoss;
        //        switch (matching.ValveType)
        //        {
        //            case HStation.Assets.eValveType.PBV: valve.ValveType = Yw.Hydro.ValveType.PBV; break;
        //            case HStation.Assets.eValveType.PRV: valve.ValveType = Yw.Hydro.ValveType.PRV; break;
        //            case HStation.Assets.eValveType.PSV: valve.ValveType = Yw.Hydro.ValveType.PSV; break;
        //            case HStation.Assets.eValveType.TCV: valve.ValveType = Yw.Hydro.ValveType.TCV; break;
        //            case HStation.Assets.eValveType.FCV: valve.ValveType = Yw.Hydro.ValveType.FCV; break;
        //            case HStation.Assets.eValveType.GPV: valve.ValveType = Yw.Hydro.ValveType.GPV; break;
        //            case HStation.Assets.eValveType.CV: valve.ValveType = Yw.Hydro.ValveType.CV; break;
        //            default: break;
        //        }
        //        valve.ValveSetting = matching.ValveSetting;
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Diameter = matching.Diameter;
            visual.MinorLoss = matching.MinorLoss;
            visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.ValveType);
            visual.ValveSetting = matching.ValveSetting;
        //        if (!valve.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                valve.DbId = matching.MatchingDbId;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                valve.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingMaterial))
        //            {
        //                valve.Material = matching.MatchingMaterial;
        //            }
        //            if (matching.MatchingDiameter.HasValue)
        //            {
        //                valve.Diameter = matching.MatchingDiameter.Value;
        //            }
        //            if (matching.MatchingMinorLoss.HasValue)
        //            {
        //                valve.MinorLoss = matching.MatchingMinorLoss.Value;
        //            }
        //            if (matching.MatchingValveType.HasValue)
        //            {
        //                switch (matching.MatchingValveType.Value)
        //                {
        //                    case HStation.Assets.eValveType.PBV: valve.ValveType = Yw.Hydro.ValveType.PBV; break;
        //                    case HStation.Assets.eValveType.PRV: valve.ValveType = Yw.Hydro.ValveType.PRV; break;
        //                    case HStation.Assets.eValveType.PSV: valve.ValveType = Yw.Hydro.ValveType.PSV; break;
        //                    case HStation.Assets.eValveType.TCV: valve.ValveType = Yw.Hydro.ValveType.TCV; break;
        //                    case HStation.Assets.eValveType.FCV: valve.ValveType = Yw.Hydro.ValveType.FCV; break;
        //                    case HStation.Assets.eValveType.GPV: valve.ValveType = Yw.Hydro.ValveType.GPV; break;
        //                    case HStation.Assets.eValveType.CV: valve.ValveType = Yw.Hydro.ValveType.CV; break;
        //                    default: break;
        //                }
        //            }
        //            switch (valve.ValveType)
        //            {
        //                case Yw.Hydro.ValveType.PSV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
        //                        {
        //                            valve.ValveSetting = matching.MatchingValveSetting;
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.PBV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
        //                        {
        //                            valve.ValveSetting = matching.MatchingValveSetting;
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.PRV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
        //                        {
        //                            valve.ValveSetting = matching.MatchingValveSetting;
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.FCV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
        //                        {
        //                            valve.ValveSetting = matching.MatchingValveSetting;
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.TCV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
        //                        {
        //                            //阀门开度损失系数曲线
        //                            var curveol = hydroInfo.Curves?.Find(x => x.Code == valve.ValveSetting);
        //                            if (curveol == null)
        //                            {
        //                                curveol = new Yw.Model.HydroCurveInfo();
        //                                curveol.Catalog = Yw.Hydro.ParterCatalog.Curve;
        //                                curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
        //                                curveol.Name = "匹配";
        //                                curveol.ModelType = valve.ModelType;
        //                                curveol.DbLocked = false;
        //                                curveol.DbId = matching.MatchingCurveDbId;
        //                                curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL;
        //                                curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                                if (hydroInfo.Curves == null)
        //                                {
        //                                    hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
        //                                }
        //                                hydroInfo.Curves.Add(curveol);
        //                                valve.ValveSetting = curveol.Code;
        //                            }
        //                            else
        //                            {
        //                                if (!curveol.DbLocked)
        //                                {
        //                                    curveol.DbId = matching.MatchingCurveDbId;
        //                                    curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                                }
        //                            }
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.GPV:
        //                    {
        //                        if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
        //                        {
        //                            //阀门开度损失系数曲线
        //                            var curveql = hydroInfo.Curves?.Find(x => x.Code == valve.ValveSetting);
        //                            if (curveql == null)
        //                            {
        //                                curveql = new Yw.Model.HydroCurveInfo();
        //                                curveql.Catalog = Yw.Hydro.ParterCatalog.Curve;
        //                                curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
        //                                curveql.Name = "匹配";
        //                                curveql.ModelType = valve.ModelType;
        //                                curveql.DbLocked = false;
        //                                curveql.DbId = matching.MatchingCurveDbId;
        //                                curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL;
        //                                curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                                if (hydroInfo.Curves == null)
        //                                {
        //                                    hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
        //                                }
        //                                hydroInfo.Curves.Add(curveql);
        //                                valve.ValveSetting = curveql.Code;
        //                            }
        //                            else
        //                            {
        //                                if (!curveql.DbLocked)
        //                                {
        //                                    curveql.DbId = matching.MatchingCurveDbId;
        //                                    curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
        //                                }
        //                            }
        //                        }
        //                    }
        //                    break;
        //                case Yw.Hydro.ValveType.CV:
        //                    {
            bool result = false;
        //                    }
        //                    break;
        //            }
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingValveType.HasValue)
                {
                    visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value);
                    result = true;
                }
                switch (visual.ValveType)
                {
                    case Yw.Hydro.ValveType.PSV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
                            {
                                visual.ValveSetting = matching.MatchingValveSetting;
                                result = true;
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.PBV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
                            {
                                visual.ValveSetting = matching.MatchingValveSetting;
                                result = true;
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.PRV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
                            {
                                visual.ValveSetting = matching.MatchingValveSetting;
                                result = true;
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.FCV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
                            {
                                visual.ValveSetting = matching.MatchingValveSetting;
                                result = true;
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.TCV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                            {
                                //阀门开度损失系数曲线
                                var curveol = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting);
                                if (curveol == null)
                                {
                                    curveol = new Yw.Model.HydroCurveInfo();
                                    curveol.Catalog = Yw.Hydro.ParterCatalog.Curve;
                                    curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                                    curveol.Name = "匹配";
                                    curveol.ModelType = visual.ModelType;
                                    curveol.DbLocked = false;
                                    curveol.DbId = matching.MatchingCurveDbId;
                                    curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL;
                                    curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                    if (hydroInfo.Curves == null)
                                    {
                                        hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                                    }
                                    hydroInfo.Curves.Add(curveol);
                                    visual.ValveSetting = curveol.Code;
                                    result = true;
                                }
                                else
                                {
                                    if (!curveol.DbLocked)
                                    {
                                        curveol.DbId = matching.MatchingCurveDbId;
                                        curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        result = true;
                                    }
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.GPV:
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                            {
                                //阀门开度损失系数曲线
                                var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting);
                                if (curveql == null)
                                {
                                    curveql = new Yw.Model.HydroCurveInfo();
                                    curveql.Catalog = Yw.Hydro.ParterCatalog.Curve;
                                    curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                                    curveql.Name = "匹配";
                                    curveql.ModelType = visual.ModelType;
                                    curveql.DbLocked = false;
                                    curveql.DbId = matching.MatchingCurveDbId;
                                    curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL;
                                    curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                    if (hydroInfo.Curves == null)
                                    {
                                        hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                                    }
                                    hydroInfo.Curves.Add(curveql);
                                    visual.ValveSetting = curveql.Code;
                                    result = true;
                                }
                                else
                                {
                                    if (!curveql.DbLocked)
                                    {
                                        curveql.DbId = matching.MatchingCurveDbId;
                                        curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        result = true;
                                    }
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.CV:
                        {
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
                        }
                        break;
                }
            }
            return result;
        }
        ///// <summary>
        ///// åº”用管道自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, PipeMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        #endregion
        //    bool result = false;
        #region æ¢çƒ­å™¨
        //    var pipe = hydroInfo.Pipes?.Find(x => x.Code == matching.Code);
        //    if (pipe != null)
        //    {
        //        pipe.DbLocked = matching.DbLocked;
        //        pipe.ModelType = matching.ModelType;
        //        pipe.Diameter = matching.Diameter;
        //        pipe.Material = matching.Material;
        //        pipe.Roughness = matching.Roughness;
        //        pipe.MinorLoss = matching.MinorLoss;
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroExchangerInfo visual, HydroExchangerMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Diameter = matching.Diameter;
            visual.MinorLoss = matching.MinorLoss;
        //        if (!pipe.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                pipe.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                pipe.DbId = matching.MatchingDbId;
        //            }
        //            if (matching.MatchingDiameter.HasValue)
        //            {
        //                pipe.Diameter = matching.MatchingDiameter.Value;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingMaterial))
        //            {
        //                pipe.Material = matching.MatchingMaterial;
        //            }
        //            if (matching.MatchingRoughness.HasValue)
        //            {
        //                pipe.Roughness = matching.MatchingRoughness.Value;
        //            }
        //            if (matching.MatchingMinorLoss.HasValue)
        //            {
        //                pipe.MinorLoss = matching.MatchingMinorLoss.Value;
        //            }
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
                if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                {
                    var curvevql = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQL);
                    if (curvevql == null)
                    {
                        curvevql = new Yw.Model.HydroCurveInfo();
                        curvevql.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curvevql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curvevql.Name = "匹配";
                        curvevql.ModelType = string.Empty;
                        curvevql.DbLocked = false;
                        curvevql.DbId = matching.MatchingCurveDbId;
                        curvevql.CurveType = Yw.WinFrmUI.HydroCurve.ExchangerQL;
                        curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curvevql);
                        visual.CurveQL = curvevql.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curvevql.DbLocked)
                        {
                            curvevql.DbId = matching.MatchingCurveDbId;
                            curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
                }
            }
            return result;
        }
        ///// <summary>
        ///// åº”用弯头自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ElbowMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        #endregion
        //    bool result = false;
        #region ç©ºåŽ‹æœº
        //    var elbow = hydroInfo.Elbows?.Find(x => x.Code == matching.Code);
        //    if (elbow != null)
        //    {
        //        elbow.DbLocked = matching.DbLocked;
        //        elbow.ModelType = matching.ModelType;
        //        elbow.Caliber = matching.Caliber;
        //        elbow.Material = matching.Material;
        //        elbow.MinorLoss = matching.MinorLoss;
        /// <summary>
        /// åº”用
        /// </summary>
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCompressorInfo visual, HydroCompressorMatchingViewModel matching)
        {
            if (hydroInfo == null)
            {
                return false;
            }
            if (visual == null)
            {
                return false;
            }
            if (matching == null)
            {
                return false;
            }
            visual.Name = matching.Name;
            visual.DbLocked = matching.DbLocked;
            visual.DbId = matching.DbId;
            visual.ModelType = matching.ModelType;
            visual.Material = matching.Material;
            visual.Diameter = matching.Diameter;
            visual.MinorLoss = matching.MinorLoss;
        //        if (!elbow.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                elbow.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                elbow.DbId = matching.MatchingDbId;
        //            }
        //            if (matching.MatchingCaliber.HasValue)
        //            {
        //                elbow.Caliber = matching.MatchingCaliber.Value;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingMaterial))
        //            {
        //                elbow.Material = matching.MatchingMaterial;
        //            }
        //            if (matching.MatchingMinorLoss.HasValue)
        //            {
        //                elbow.MinorLoss = matching.MatchingMinorLoss.Value;
        //            }
            bool result = false;
            if (!visual.DbLocked)
            {
                if (!string.IsNullOrEmpty(matching.MatchingModelType))
                {
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingDbId))
                {
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingMinorLoss.HasValue)
                {
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
                if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                {
                    var curvevql = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQL);
                    if (curvevql == null)
                    {
                        curvevql = new Yw.Model.HydroCurveInfo();
                        curvevql.Catalog = Yw.Hydro.ParterCatalog.Curve;
                        curvevql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes());
                        curvevql.Name = "匹配";
                        curvevql.ModelType = string.Empty;
                        curvevql.DbLocked = false;
                        curvevql.DbId = matching.MatchingCurveDbId;
                        curvevql.CurveType = Yw.WinFrmUI.HydroCurve.CompressorQL;
                        curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                        if (hydroInfo.Curves == null)
                        {
                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
                        }
                        hydroInfo.Curves.Add(curvevql);
                        visual.CurveQL = curvevql.Code;
                        result = true;
                    }
                    else
                    {
                        if (!curvevql.DbLocked)
                        {
                            curvevql.DbId = matching.MatchingCurveDbId;
                            curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            result = true;
                        }
                    }
                }
            }
            return result;
        }
        ///// <summary>
        ///// åº”用三通自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ThreelinkMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        //    bool result = false;
        //    var threelink = hydroInfo.Threelinks?.Find(x => x.Code == matching.Code);
        //    if (threelink != null)
        //    {
        //        threelink.DbLocked = matching.DbLocked;
        //        threelink.ModelType = matching.ModelType;
        //        threelink.Caliber = matching.Caliber;
        //        threelink.Material = matching.Material;
        //        threelink.MinorLoss = matching.MinorLoss;
        //        if (!threelink.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                threelink.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                threelink.DbId = matching.MatchingDbId;
        //            }
        //            if (matching.MatchingCaliber.HasValue)
        //            {
        //                threelink.Caliber = matching.MatchingCaliber.Value;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingMaterial))
        //            {
        //                threelink.Material = matching.MatchingMaterial;
        //            }
        //            if (matching.MatchingMinorLoss.HasValue)
        //            {
        //                threelink.MinorLoss = matching.MatchingMinorLoss.Value;
        //            }
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
        ///// <summary>
        ///// åº”用四通自动匹配ViewModel
        ///// </summary>
        //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, FourlinkMatchingViewModel matching)
        //{
        //    if (hydroInfo == null)
        //    {
        //        return false;
        //    }
        //    if (matching == null)
        //    {
        //        return false;
        //    }
        //    bool result = false;
        //    var fourlink = hydroInfo.Fourlinks?.Find(x => x.Code == matching.Code);
        //    if (fourlink != null)
        //    {
        //        fourlink.DbLocked = matching.DbLocked;
        //        fourlink.ModelType = matching.ModelType;
        //        fourlink.Caliber = matching.Caliber;
        //        fourlink.Material = matching.Material;
        //        fourlink.MinorLoss = matching.MinorLoss;
        //        if (!fourlink.DbLocked)
        //        {
        //            if (!string.IsNullOrEmpty(matching.MatchingModelType))
        //            {
        //                fourlink.ModelType = matching.MatchingModelType;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingDbId))
        //            {
        //                fourlink.DbId = matching.MatchingDbId;
        //            }
        //            if (matching.MatchingCaliber.HasValue)
        //            {
        //                fourlink.Caliber = matching.MatchingCaliber.Value;
        //            }
        //            if (!string.IsNullOrEmpty(matching.MatchingMaterial))
        //            {
        //                fourlink.Material = matching.MatchingMaterial;
        //            }
        //            if (matching.MatchingMinorLoss.HasValue)
        //            {
        //                fourlink.MinorLoss = matching.MatchingMinorLoss.Value;
        //            }
        //            result = true;
        //        }
        //    }
        //    return result;
        //}
        #endregion
        #endregion
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-tank/HydroTankMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-blunthead/HydroBluntheadMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-elbow/HydroElbowMatchingViewModel.cs ÐÞ¸Ä
@@ -25,13 +25,7 @@
            this.Caliber = rhs.Caliber;
            this.MinorLoss = rhs.MinorLoss;
            this.BendingAngle = rhs.BendingAngle.HasValue ? (int)rhs.BendingAngle.Value : null;
            switch (rhs.ElbowType)
            {
                case HydroElbow.Short: this.ElbowType = eElbowType.Short; break;
                case HydroElbow.Middle: this.ElbowType = eElbowType.Middle; break;
                case HydroElbow.Long: this.ElbowType = eElbowType.Long; break;
                default: break;
            }
            this.ElbowType = HydroElbowTypeEnumHelper.GetElbowType(rhs.ElbowType);
        }
        /// <summary>
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-threelink/HydroThreelinkMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-fourlink/HydroFourlinkMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-meter/HydroMeterMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-flowmeter/HydroFlowmeterMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-pressmeter/HydroFlowmeterMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-hydrant/HydroHydrantMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-pipe/HydroPipeMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-pump/HydroPumpMatchingViewModel.cs ÐÞ¸Ä
@@ -84,11 +84,6 @@
        public string CurveDbId { get; set; }
        /// <summary>
        /// é¢å®šåŠŸçŽ‡
        /// </summary>
        public double RatedP { get; set; }
        /// <summary>
        ///  é¢å®šæµé‡
        /// </summary>
        public double? RatedQ { get; set; }
@@ -97,6 +92,11 @@
        /// é¢å®šæ‰¬ç¨‹
        /// </summary>
        public double? RatedH { get; set; }
        /// <summary>
        /// é¢å®šåŠŸçŽ‡
        /// </summary>
        public double RatedP { get; set; }
        /// <summary>
        /// é¢å®šè½¬é€Ÿ
@@ -139,11 +139,6 @@
        public string MatchingCurveDbId { get; set; }
        /// <summary>
        /// åŒ¹é…é¢å®šåŠŸçŽ‡
        /// </summary>
        public double? MatchingRatedP { get; set; }
        /// <summary>
        ///  åŒ¹é…é¢å®šæµé‡
        /// </summary>
        public double? MatchingRatedQ { get; set; }
@@ -154,6 +149,11 @@
        public double? MatchingRatedH { get; set; }
        /// <summary>
        /// åŒ¹é…é¢å®šåŠŸçŽ‡
        /// </summary>
        public double? MatchingRatedP { get; set; }
        /// <summary>
        /// åŒ¹é…é¢å®šè½¬é€Ÿ
        /// </summary>
        public double? MatchingRatedN { get; set; }
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-translation/HydroTranslationMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-valve/HydroValveMatchingViewModel.cs ÐÞ¸Ä
@@ -25,17 +25,12 @@
            this.Material = rhs.Material;
            this.Diameter = rhs.Diameter;
            this.MinorLoss = rhs.MinorLoss;
            switch (rhs.ValveType)
            var valveType = HydroValveTypeEnumHelper.GetValveType(rhs.ValveType);
            if (!valveType.HasValue)
            {
                case Yw.Hydro.ValveType.PRV: this.ValveType = eValveType.PRV; break;
                case Yw.Hydro.ValveType.PSV: this.ValveType = eValveType.PSV; break;
                case Yw.Hydro.ValveType.PBV: this.ValveType = eValveType.PBV; break;
                case Yw.Hydro.ValveType.TCV: this.ValveType = eValveType.TCV; break;
                case Yw.Hydro.ValveType.FCV: this.ValveType = eValveType.FCV; break;
                case Yw.Hydro.ValveType.GPV: this.ValveType = eValveType.GPV; break;
                case Yw.Hydro.ValveType.CV: this.ValveType = eValveType.CV; break;
                default: break;
                valveType = eValveType.GPV;
            }
            this.ValveType = valveType.Value;
            this.ValveSetting = rhs.ValveSetting;
        }
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-exchanger/HydroExchangerMatchingViewModel.cs
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-compressor/HydroCompressorMatchingViewModel.cs