ningshuxia
2025-03-13 982cde7e9372dc218f23b204265d8e54f7e9ce4f
WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs
@@ -1,8 +1,4 @@
using DevExpress.XtraSpreadsheet.Model.CopyOperation;
using System.Windows.Media.Imaging;
using Yw.Ahart;
using Yw.DAL.Basic;
using Yw.EPAnet;
using Yw.Ahart;
using Yw.Hydro;
using Yw.Model;
@@ -685,13 +681,7 @@
        /// <summary>
        /// 应用自动匹配ViewModel
        /// </summary>
        public static bool Apply
            (
                Yw.Model.HydroModelInfo hydroInfo,
                HydroMatchingViewModel matchingInfo,
                HydroChangeHelper changeHelper = null,
                HydroPropStatusHelper propStatusHelper = null
            )
        public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, HydroMatchingViewModel matchingInfo)
        {
            if (hydroInfo == null)
            {
@@ -714,7 +704,7 @@
                    allTanks.ForEach(x =>
                    {
                        var matching = matchingInfo.Tanks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -734,7 +724,7 @@
                    hydroInfo.Bluntheads.ForEach(x =>
                    {
                        var matching = matchingInfo.Bluntheads.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -753,7 +743,7 @@
                    hydroInfo.Elbows.ForEach(x =>
                    {
                        var matching = matchingInfo.Elbows.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -772,7 +762,7 @@
                    hydroInfo.Threelinks.ForEach(x =>
                    {
                        var matching = matchingInfo.Threelinks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -791,7 +781,7 @@
                    hydroInfo.Fourlinks.ForEach(x =>
                    {
                        var matching = matchingInfo.Fourlinks.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -810,7 +800,7 @@
                    hydroInfo.Nozzles.ForEach(x =>
                    {
                        var matching = matchingInfo.Nozzles.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -829,7 +819,7 @@
                    hydroInfo.Hydrants.ForEach(x =>
                    {
                        var matching = matchingInfo.Hydrants.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -848,7 +838,7 @@
                    hydroInfo.Coolings.ForEach(x =>
                    {
                        var matching = matchingInfo.Coolings.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -867,7 +857,7 @@
                    hydroInfo.Meters.ForEach(x =>
                    {
                        var matching = matchingInfo.Meters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -886,7 +876,7 @@
                    hydroInfo.Flowmeters.ForEach(x =>
                    {
                        var matching = matchingInfo.Flowmeters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -905,7 +895,7 @@
                    hydroInfo.Pressmeters.ForEach(x =>
                    {
                        var matching = matchingInfo.Pressmeters.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -924,7 +914,7 @@
                    hydroInfo.Pipes.ForEach(x =>
                    {
                        var matching = matchingInfo.Pipes.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -943,7 +933,7 @@
                    hydroInfo.Translations.ForEach(x =>
                    {
                        var matching = matchingInfo.Translations.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -962,7 +952,7 @@
                    hydroInfo.Pumps.ForEach(x =>
                    {
                        var matching = matchingInfo.Pumps.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -981,7 +971,7 @@
                    hydroInfo.Valves.ForEach(x =>
                    {
                        var matching = matchingInfo.Valves.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -1000,7 +990,7 @@
                    hydroInfo.Exchangers.ForEach(x =>
                    {
                        var matching = matchingInfo.Exchangers.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -1019,7 +1009,7 @@
                    hydroInfo.Compressors.ForEach(x =>
                    {
                        var matching = matchingInfo.Compressors.Find(t => t.Code == x.Code);
                        if (Apply(hydroInfo, x, matching, changeHelper, propStatusHelper))
                        if (Apply(hydroInfo, x, matching))
                        {
                            result = true;
                        }
@@ -2496,8 +2486,11 @@
            //visual.DbLocked = matching.DbLocked;
            //visual.DbId = matching.DbId;
            //visual.ModelType = matching.ModelType;
            //if (matching.TranslationType.HasValue)
            //{
            //    visual.TranslationType = HydroTranslationTypeEnumHelper.GetTranslationTypeName(matching.TranslationType.Value);
            //}
            //visual.Material = matching.Material;
            //visual.Diameter = matching.Diameter;
            //visual.StartDiameter = matching.StartDiameter;
            //visual.EndDiameter = matching.EndDiameter;
            //visual.Roughness = matching.Roughness;
@@ -2527,6 +2520,17 @@
                    visual.DbId = matching.MatchingDbId;
                    result = true;
                }
                if (matching.MatchingTranslationType.HasValue)
                {
                    var translationType = HydroTranslationTypeEnumHelper.GetTranslationTypeName(matching.MatchingTranslationType.Value);
                    if (visual.TranslationType != translationType)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.TranslationType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.TranslationType = translationType;
                    result = true;
                }
                if (!string.IsNullOrEmpty(matching.MatchingMaterial))
                {
                    if (visual.Material != matching.MatchingMaterial)
@@ -2535,16 +2539,6 @@
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Material), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.Material = matching.MatchingMaterial;
                    result = true;
                }
                if (matching.MatchingDiameter.HasValue)
                {
                    if (visual.Diameter != matching.MatchingDiameter.Value)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Diameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
                }
                if (matching.MatchingRoughness.HasValue)
@@ -2754,6 +2748,7 @@
                        hydroInfo.Curves.Add(curveqh);
                        visual.CurveQH = curveqh.Code;
                        changeHelper?.Append(curveqh, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQH), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
@@ -2764,7 +2759,6 @@
                            curveqh.DbId = matching.MatchingCurveDbId;
                            curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curveqh, eChangeType.Update);
                            propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQH), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                            result = true;
                        }
                    }
@@ -2789,6 +2783,7 @@
                        hydroInfo.Curves.Add(curveqp);
                        visual.CurveQP = curveqp.Code;
                        changeHelper?.Append(curveqp, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQP), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
@@ -2799,7 +2794,6 @@
                            curveqp.DbId = matching.MatchingCurveDbId;
                            curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curveqp, eChangeType.Update);
                            propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQP), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                            result = true;
                        }
                    }
@@ -2824,6 +2818,7 @@
                        hydroInfo.Curves.Add(curveqe);
                        visual.CurveQE = curveqe.Code;
                        changeHelper?.Append(curveqe, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQE), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
@@ -2834,41 +2829,7 @@
                            curveqe.DbId = matching.MatchingCurveDbId;
                            curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curveqe, eChangeType.Update);
                            propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQE), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                            result = true;
                        }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(visual.CurveQH))
                    {
                        var curveQH = hydroInfo?.Curves?.Find(x => x.Code == visual.CurveQH);
                        if (curveQH != null)
                        {
                            hydroInfo.Curves?.RemoveAll(x => x.Code == visual.CurveQH);
                            visual.CurveQH = string.Empty;
                            changeHelper?.Append(curveQH, eChangeType.Remove);
                        }
                    }
                    if (!string.IsNullOrEmpty(visual.CurveQP))
                    {
                        var curveQP = hydroInfo?.Curves?.Find(x => x.Code == visual.CurveQP);
                        if (curveQP != null)
                        {
                            hydroInfo.Curves?.RemoveAll(x => x.Code == visual.CurveQP);
                            visual.CurveQP = string.Empty;
                            changeHelper?.Append(curveQP, eChangeType.Remove);
                        }
                    }
                    if (!string.IsNullOrEmpty(visual.CurveQE))
                    {
                        var curveQE = hydroInfo?.Curves?.Find(x => x.Code == visual.CurveQE);
                        if (curveQE != null)
                        {
                            hydroInfo.Curves?.RemoveAll(x => x.Code == visual.CurveQE);
                            visual.CurveQE = string.Empty;
                            changeHelper?.Append(curveQE, eChangeType.Remove);
                        }
                    }
                }
@@ -2922,15 +2883,13 @@
                return false;
            }
            // visual.Name = matching.Name;
            // visual.DbLocked = matching.DbLocked;
            //visual.Name = matching.Name;
            //visual.DbLocked = matching.DbLocked;
            //visual.DbId = matching.DbId;
            // visual.ModelType = matching.ModelType;
            //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;
            bool result = false;
@@ -2941,7 +2900,7 @@
                    if (visual.ModelType != matching.MatchingModelType)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ModelType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ModelType), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.ModelType = matching.MatchingModelType;
                    result = true;
@@ -2951,7 +2910,7 @@
                    if (visual.DbId != matching.MatchingDbId)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.DbId), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.DbId), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.DbId = matching.MatchingDbId;
                    result = true;
@@ -2961,7 +2920,7 @@
                    if (visual.Material != matching.MatchingMaterial)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Material), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Material), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.Material = matching.MatchingMaterial;
                    result = true;
@@ -2971,7 +2930,7 @@
                    if (visual.Diameter != matching.MatchingDiameter.Value)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Diameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Diameter), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.Diameter = matching.MatchingDiameter.Value;
                    result = true;
@@ -2981,141 +2940,98 @@
                    if (visual.MinorLoss != matching.MatchingMinorLoss.Value)
                    {
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinorLoss), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinorLoss), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                    visual.MinorLoss = matching.MatchingMinorLoss.Value;
                    result = true;
                }
                if (matching.MatchingValveType.HasValue)
                if (!string.IsNullOrEmpty(matching.MatchingCurveDbId))
                {
                    var valveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value);
                    if (visual.ValveType != valveType)
                    //开度损失曲线
                    var curveol = hydroInfo.Curves?.Find(x => x.Code == visual.CurveOL);
                    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 = string.Empty;
                        curveol.DbLocked = false;
                        curveol.DbId = matching.MatchingCurveDbId;
                        curveol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL;
                        curveol.CurveFactor = null;
                        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.CurveOL = curveol.Code;
                        changeHelper?.Append(curveol, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ValveType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveOL), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
                    visual.ValveType = valveType;
                    result = true;
                }
                switch (visual.ValveType)
                {
                    case Yw.Hydro.ValveType.PSV:
                    else
                    {
                        if (!curveol.DbLocked)
                        {
                            if (!string.IsNullOrEmpty(matching.MatchingValveSetting))
                            {
                                visual.ValveSetting = matching.MatchingValveSetting;
                                result = true;
                            }
                            curveol.DbId = matching.MatchingCurveDbId;
                            curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curveol, eChangeType.Update);
                            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.HydroCurveType.CurveOL;
                                    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.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL;
                                        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.HydroCurveType.CurveQL;
                                    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.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL;
                                        curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        result = true;
                                    }
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ValveType.CV:
                        {
                    }
                    //水头损失曲线
                    if (matching.MatchingCurvesQL != null && matching.MatchingCurvesQL.Count > 0)
                    {
                        if (visual.CurvesQL == null)
                        {
                            visual.CurvesQL = new List<string>();
                        }
                        break;
                        var curvesql = new List<string>();
                        var matchingCurvesQL = matching.MatchingCurvesQL.OrderBy(x => x.CurveFactor).ToList();
                        foreach (var matchingCurveQL in matchingCurvesQL)
                        {
                            var curveql = hydroInfo.Curves?.Find(x => visual.CurvesQL.Contains(x.Code) && x.CurveFactor.HasValue && x.CurveFactor.Value == matchingCurveQL.CurveFactor);
                            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 = string.Empty;
                                curveql.DbLocked = false;
                                curveql.DbId = matching.MatchingCurveDbId;
                                curveql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL;
                                curveql.CurveFactor = matchingCurveQL.CurveFactor;
                                curveql.CurveData = matchingCurveQL.CurveData?.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);
                                changeHelper?.Append(curveql, eChangeType.Add);
                                result = true;
                            }
                            else
                            {
                                if (!curveql.DbLocked)
                                {
                                    curveql.DbId = matching.MatchingCurveDbId;
                                    curveql.CurveFactor = matchingCurveQL.CurveFactor;
                                    curveql.CurveData = matchingCurveQL.CurveData?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                    changeHelper?.Append(curveql, eChangeType.Update);
                                    result = true;
                                }
                            }
                            curvesql.Add(curveql.Code);
                        }
                        visual.CurvesQL = curvesql;
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurvesQL), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                    }
                }
            }
            return result;
@@ -3248,6 +3164,7 @@
                        hydroInfo.Curves.Add(curvevql);
                        visual.CurveQL = curvevql.Code;
                        changeHelper?.Append(curvevql, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
@@ -3258,21 +3175,7 @@
                            curvevql.DbId = matching.MatchingCurveDbId;
                            curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curvevql, eChangeType.Update);
                            propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                            result = true;
                        }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(visual.CurveQL))
                    {
                        var curveql = hydroInfo?.Curves?.Find(x => x.Code == visual.CurveQL);
                        if (curveql != null)
                        {
                            hydroInfo.Curves?.RemoveAll(x => x.Code == visual.CurveQL);
                            visual.CurveQL = string.Empty;
                            changeHelper?.Append(curveql, eChangeType.Remove);
                        }
                    }
                }
@@ -3407,6 +3310,7 @@
                        hydroInfo.Curves.Add(curvevql);
                        visual.CurveQL = curvevql.Code;
                        changeHelper?.Append(curvevql, eChangeType.Add);
                        changeHelper?.Append(visual, eChangeType.Update);
                        propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                        result = true;
                    }
@@ -3417,21 +3321,7 @@
                            curvevql.DbId = matching.MatchingCurveDbId;
                            curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                            changeHelper?.Append(curvevql, eChangeType.Update);
                            propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改");
                            result = true;
                        }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(visual.CurveQL))
                    {
                        var curveql = hydroInfo?.Curves?.Find(x => x.Code == visual.CurveQL);
                        if (curveql != null)
                        {
                            hydroInfo.Curves?.RemoveAll(x => x.Code == visual.CurveQL);
                            visual.CurveQL = string.Empty;
                            changeHelper?.Append(curveql, eChangeType.Remove);
                        }
                    }
                }