duheng
2024-09-26 8ebe1a107a444f4925783e5e4795da46512cb51c
Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0
已修改1个文件
92 ■■■■■ 文件已修改
WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs
@@ -168,6 +168,88 @@
                                if (!string.IsNullOrEmpty(pumpMatching.MatchingCurveDbId))
                                {
                                    //流量扬程曲线
                                    var curveqh = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQH);
                                    if (curveqh == null)
                                    {
                                        var allParterList = hydroInfo.GetAllParters();
                                        var parterNameList = allParterList?.Select(x => x.Code).Distinct().ToList();
                                        curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve;
                                        curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
                                        curveqh.Name = "匹配";
                                        curveqh.ModelType = string.Empty;
                                        curveqh.DbLocked = false;
                                        curveqh.DbId = pumpMatching.MatchingCurveDbId;
                                        curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH;
                                        curveqh.CurveData = pumpMatching.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);
                                    }
                                    else
                                    {
                                        if (!curveqh.DbLocked)
                                        {
                                            curveqh.DbId = pumpMatching.MatchingDbId;
                                            curveqh.CurveData = pumpMatching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        }
                                    }
                                    //流量功率曲线
                                    var curveqp = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP);
                                    if (curveqp == null)
                                    {
                                        curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve;
                                        curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
                                        curveqp.Name = "匹配";
                                        curveqp.ModelType = string.Empty;
                                        curveqp.DbLocked = false;
                                        curveqp.DbId = pumpMatching.MatchingCurveDbId;
                                        curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP;
                                        curveqp.CurveData = pumpMatching.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);
                                    }
                                    else
                                    {
                                        if (!curveqp.DbLocked)
                                        {
                                            curveqp.DbId = pumpMatching.MatchingDbId;
                                            curveqp.CurveData = pumpMatching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        }
                                    }
                                    //流量效率曲线
                                    var curveqe = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQE);
                                    if (curveqe == null)
                                    {
                                        curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve;
                                        curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
                                        curveqe.Name = "匹配";
                                        curveqe.ModelType = string.Empty;
                                        curveqe.DbLocked = false;
                                        curveqe.DbId = pumpMatching.MatchingCurveDbId;
                                        curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE;
                                        curveqe.CurveData = pumpMatching.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);
                                    }
                                    else
                                    {
                                        if (!curveqe.DbLocked)
                                        {
                                            curveqe.DbId = pumpMatching.MatchingDbId;
                                            curveqe.CurveData = pumpMatching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
                                        }
                                    }
                                }
                            }
@@ -423,6 +505,16 @@
            return result;
        }
        //获取所有编码列表
        private static List<string> GetAllCodeList(Yw.Model.HydroModelInfo hydroInfo)
        {
            if (hydroInfo == null)
            {
                return default;
            }
            var allParterList = hydroInfo.GetAllParters();
            return allParterList?.Select(x => x.Code).Distinct().ToList();
        }
    }
}