From fd4c07a540632cb6b30b4036f0af83182125104b Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 05 十二月 2024 21:21:14 +0800
Subject: [PATCH] 匹配方法提交

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs |  521 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 407 insertions(+), 114 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
index bf7962d..1c71dcb 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
@@ -305,6 +305,7 @@
         //闃�闂ㄥ尮閰�
         public static bool MatchingValve(HydroValveMatchingViewModel input, List<Vmo.AssetsValveMainVmo> valveMainVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (valveMainVmos == null)
             {
                 return true;
@@ -381,31 +382,68 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingDiameter = vmo.Caliber;
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                input.MatchingValveSetting = vmo.ValveSetting;
-                input.MatchingValveType = (eValveType?)(int)vmo.ValveType;
-                if (vmo.ValveType == HStation.Assets.eValveType.GPV)
+                if (!isNotarize)
                 {
-                    var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
-                    if (curveList != null && curveList.Count > 0)
+                    if (input.CurveDbId == null)
                     {
-                        input.MatchingCurveDbId = curveList.First().ID.ToString();
-                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
-                        input.MatchingCurveQL = pt_list;
+                        if (vmo.ValveType == HStation.Assets.eValveType.GPV)
+                        {
+                            var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
+                            if (curveList != null && curveList.Count > 0)
+                            {
+                                input.MatchingCurveDbId = curveList.First().ID.ToString();
+                                var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                                input.MatchingCurveQL = pt_list;
+                            }
+                        }
+                        else if (vmo.ValveType == HStation.Assets.eValveType.TCV)
+                        {
+                            var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
+                            if (curveList != null && curveList.Count > 0)
+                            {
+                                input.MatchingCurveDbId = curveList.First().ID.ToString();
+                                var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve);
+                                input.MatchingCurveOL = pt_list;
+                            }
+                        }
                     }
-                }
-                else if (vmo.ValveType == HStation.Assets.eValveType.TCV)
-                {
-                    var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
-                    if (curveList != null && curveList.Count > 0)
+                    if (input.MinorLoss < 0)
                     {
-                        input.MatchingCurveDbId = curveList.First().ID.ToString();
-                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve);
-                        input.MatchingCurveOL = pt_list;
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    }
+                    if (!input.MatchingDiameter.HasValue)
+                        input.MatchingDiameter = vmo.Caliber;
+                    if (input.ValveSetting == null)
+                        input.MatchingValveSetting = vmo.ValveSetting;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingDiameter = vmo.Caliber;
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingValveSetting = vmo.ValveSetting;
+                    input.MatchingValveType = (eValveType?)(int)vmo.ValveType;
+                    if (vmo.ValveType == HStation.Assets.eValveType.GPV)
+                    {
+                        var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
+                        if (curveList != null && curveList.Count > 0)
+                        {
+                            input.MatchingCurveDbId = curveList.First().ID.ToString();
+                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                            input.MatchingCurveQL = pt_list;
+                        }
+                    }
+                    else if (vmo.ValveType == HStation.Assets.eValveType.TCV)
+                    {
+                        var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
+                        if (curveList != null && curveList.Count > 0)
+                        {
+                            input.MatchingCurveDbId = curveList.First().ID.ToString();
+                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve);
+                            input.MatchingCurveOL = pt_list;
+                        }
                     }
                 }
                 return true;
@@ -416,6 +454,7 @@
         //绠¢亾鍖归厤
         public static bool MatchingPipe(HydroPipeMatchingViewModel input, List<Vmo.AssetsPipeMainVmo> pipeLineMainVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (pipeLineMainVmos == null)
             {
                 return true;
@@ -488,28 +527,40 @@
             }
             if (vmo != null)
             {
-                switch (input.eAlgorithmType)
+                if (!isNotarize)
                 {
-                    case eAlgorithmType.Hazen:
-                        input.MatchingRoughness = vmo.Hazen;
-                        break;
-
-                    case eAlgorithmType.Manning:
-                        input.MatchingRoughness = vmo.Manning;
-                        break;
-
-                    case eAlgorithmType.Darcy:
-                        input.MatchingRoughness = vmo.Darcy;
-                        break;
-
-                    default:
-                        input.MatchingRoughness = vmo.Hazen;
-                        break;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
                 }
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                input.MatchingMinorLoss = vmo.MinorLoss;
+                else
+                {
+                    switch (input.eAlgorithmType)
+                    {
+                        case eAlgorithmType.Hazen:
+                            input.MatchingRoughness = vmo.Hazen;
+                            break;
+
+                        case eAlgorithmType.Manning:
+                            input.MatchingRoughness = vmo.Manning;
+                            break;
+
+                        case eAlgorithmType.Darcy:
+                            input.MatchingRoughness = vmo.Darcy;
+                            break;
+
+                        default:
+                            input.MatchingRoughness = vmo.Hazen;
+                            break;
+                    }
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                }
                 return true;
             }
             return false;
@@ -518,6 +569,7 @@
         //寮ご鍖归厤
         public static bool MatchingElbow(HydroElbowMatchingViewModel input, List<Vmo.AssetsElbowMainVmo> elbowMainVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (elbowMainVmos == null || input == null || elbowMainVmos.Count == 0)
             {
                 return true;
@@ -573,6 +625,7 @@
                     //鍙栭粯璁�
                     if (defaultList.Count > 0)
                     {
+                        isNotarize = true;
                         vmo = defaultList.First();
                     }
                     else if (defaultList.Count <= 0)
@@ -589,12 +642,42 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType;
-                input.MatchingBendingAngle = vmo.Angle;
+                if (!isNotarize)
+                {
+                    if (!input.MinorLoss.HasValue)
+                    {
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    }
+                    if (input.DbId == null)
+                    {
+                        input.MatchingDbId = vmo.ID.ToString();
+                    }
+                    if (input.Material == null)
+                    {
+                        input.MatchingMaterial = vmo.Material;
+                    }
+                    if (input.ModelType == null)
+                    {
+                        input.MatchingModelType = vmo.Material;
+                    }
+                    if (!input.ElbowType.HasValue)
+                    {
+                        input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType;
+                    }
+                    if (!input.BendingAngle.HasValue)
+                    {
+                        input.MatchingBendingAngle = vmo.Angle;
+                    }
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType;
+                    input.MatchingBendingAngle = vmo.Angle;
+                }
                 return true;
             }
             return false;
@@ -603,6 +686,7 @@
         //涓夐�氬尮閰�
         public static bool MatchingThreelink(HydroThreelinkMatchingViewModel input, List<Vmo.AssetsThreelinkMainVmo> threelinkVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             Vmo.AssetsThreelinkMainVmo vmo = null;
             if (threelinkVmos == null || input == null || threelinkVmos.Count == 0)
             {
@@ -674,12 +758,26 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss;
-                input.MatchingBranchThroughLoss = vmo.BranchThroughMinorLoss;
+                if (!isNotarize)
+                {
+                    if (!input.MinorLoss.HasValue)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (!input.RunningThroughLoss.HasValue)
+                        input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss;
+                    if (!input.MatchingBranchThroughLoss.HasValue)
+                        input.MatchingRunningThroughLoss = vmo.BranchThroughMinorLoss;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss;
+                    input.MatchingBranchThroughLoss = vmo.BranchThroughMinorLoss;
+                }
                 return true;
             }
             return false;
@@ -688,6 +786,7 @@
         //鍥涢�氬尮閰�
         public static bool MatchingFourlink(HydroFourlinkMatchingViewModel input, List<Vmo.AssetsFourlinkMainVmo> fourLinkVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (fourLinkVmos == null || input == null || fourLinkVmos.Count == 0)
             {
                 return true;
@@ -759,10 +858,24 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (!input.MinorLoss.HasValue)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -771,6 +884,7 @@
         //鍠峰ご鍖归厤
         public static bool MatchingSprinkler(HydroNozzleMatchingViewModel input, List<Vmo.AssetsSprinklerMainVmo> sprinklerVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (sprinklerVmos == null || input == null || sprinklerVmos.Count == 0)
             {
                 return true;
@@ -842,10 +956,24 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (!input.MinorLoss.HasValue)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -854,6 +982,8 @@
         //鎹㈢儹鍣ㄥ尮閰�
         public static bool MatchingExchanger(HydroExchangerMatchingViewModel input, List<Vmo.AssetsExchangerMainVmo> exchangerVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
+
             if (exchangerVmos == null || input == null || exchangerVmos.Count == 0)
             {
                 return true;
@@ -923,16 +1053,40 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                var curveList = Task.Run(async () => await new BLL.AssetsExchangerCoefficient().GetByMainID(vmo.ID)).Result;
-                if (curveList != null && curveList.Count > 0)
+                if (!isNotarize)
                 {
-                    input.MatchingCurveDbId = curveList.First().ID.ToString();
-                    var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
-                    input.MatchingCurveQL = pt_list;
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                    if (input.CurveDbId == null)
+                    {
+                        var curveList = Task.Run(async () => await new BLL.AssetsExchangerCoefficient().GetByMainID(vmo.ID)).Result;
+                        if (curveList != null && curveList.Count > 0)
+                        {
+                            input.MatchingCurveDbId = curveList.First().ID.ToString();
+                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                            input.MatchingCurveQL = pt_list;
+                        }
+                    }
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    var curveList = Task.Run(async () => await new BLL.AssetsExchangerCoefficient().GetByMainID(vmo.ID)).Result;
+                    if (curveList != null && curveList.Count > 0)
+                    {
+                        input.MatchingCurveDbId = curveList.First().ID.ToString();
+                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                        input.MatchingCurveQL = pt_list;
+                    }
                 }
                 return true;
             }
@@ -942,6 +1096,7 @@
         //绌哄帇鏈哄尮閰�
         public static bool MatchingCompressor(HydroCompressorMatchingViewModel input, List<Vmo.AssetsCompressorMainVmo> compressorVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (compressorVmos == null || input == null || compressorVmos.Count == 0)
             {
                 return true;
@@ -1011,16 +1166,40 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().GetByMainID(vmo.ID)).Result;
-                if (curveList != null && curveList.Count > 0)
+                if (!isNotarize)
                 {
-                    input.MatchingCurveDbId = curveList.First().ID.ToString();
-                    var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
-                    input.MatchingCurveQL = pt_list;
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                    if (input.CurveDbId == null)
+                    {
+                        var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().GetByMainID(vmo.ID)).Result;
+                        if (curveList != null && curveList.Count > 0)
+                        {
+                            input.MatchingCurveDbId = curveList.First().ID.ToString();
+                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                            input.MatchingCurveQL = pt_list;
+                        }
+                    }
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().GetByMainID(vmo.ID)).Result;
+                    if (curveList != null && curveList.Count > 0)
+                    {
+                        input.MatchingCurveDbId = curveList.First().ID.ToString();
+                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
+                        input.MatchingCurveQL = pt_list;
+                    }
                 }
                 return true;
             }
@@ -1030,6 +1209,7 @@
         //闂峰ご鍖归厤
         public static bool MatchingBlunthead(HydroBluntheadMatchingViewModel input, List<Vmo.AssetsBluntheadMainVmo> bluntheadVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (bluntheadVmos == null || input == null || bluntheadVmos.Count == 0)
             {
                 return true;
@@ -1101,10 +1281,24 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.Material == null)
+                        input.MatchingMaterial = vmo.Material;
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -1113,6 +1307,7 @@
         //姘存睜鍖归厤
         public static bool MatchingTank(HydroTankMatchingViewModel input, List<Vmo.AssetsTankMainVmo> tankVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (tankVmos == null || input == null || tankVmos.Count == 0)
             {
                 return true;
@@ -1147,17 +1342,41 @@
                 vmo = tankVmos.First();
             if (vmo != null)
             {
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingModelType = vmo.Name;
-                input.MatchingDN = vmo.DN;
-                input.MatchingMinLevel = vmo.MinLevel;
-                input.MatchingOverFlow = vmo.OverFlow;
-                var curveList = Task.Run(async () => await new BLL.AssetsTankCoefficient().GetByMainID(vmo.ID)).Result;
-                if (curveList != null && curveList.Count > 0)
+                if (!isNotarize)
                 {
-                    input.MatchingCurveDbId = curveList.First().ID.ToString();
-                    var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve);
-                    input.MatchingVolCurve = pt_list;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                    if (input.DN < 0)
+                        input.MatchingDN = vmo.DN;
+                    if (input.MinLevel < 0)
+                        input.MatchingMinLevel = vmo.MinLevel;
+                    if (input.CurveDbId == null)
+                    {
+                        var curveList = Task.Run(async () => await new BLL.AssetsTankCoefficient().GetByMainID(vmo.ID)).Result;
+                        if (curveList != null && curveList.Count > 0)
+                        {
+                            input.MatchingCurveDbId = curveList.First().ID.ToString();
+                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve);
+                            input.MatchingVolCurve = pt_list;
+                        }
+                    }
+                }
+                else
+                {
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingDN = vmo.DN;
+                    input.MatchingMinLevel = vmo.MinLevel;
+                    input.MatchingOverFlow = vmo.OverFlow;
+                    var curveList = Task.Run(async () => await new BLL.AssetsTankCoefficient().GetByMainID(vmo.ID)).Result;
+                    if (curveList != null && curveList.Count > 0)
+                    {
+                        input.MatchingCurveDbId = curveList.First().ID.ToString();
+                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve);
+                        input.MatchingVolCurve = pt_list;
+                    }
                 }
                 return true;
             }
@@ -1167,6 +1386,7 @@
         //姘磋〃鍖归厤
         public static bool MatchingMeter(HydroMeterMatchingViewModel input, List<Vmo.AssetsMeterMainVmo> MeterMainVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             Vmo.AssetsMeterMainVmo vmo = null;
             if (MeterMainVmos == null || input == null || MeterMainVmos.Count == 0)
             {
@@ -1201,9 +1421,21 @@
 
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -1212,6 +1444,7 @@
         //娴侀噺璁″尮閰�
         public static bool MatchingFlowmeter(HydroFlowmeterMatchingViewModel input, List<Vmo.AssetsFlowmeterMainVmo> FlowmeterMainVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (FlowmeterMainVmos == null || input == null || FlowmeterMainVmos.Count == 0)
             {
                 return true;
@@ -1248,9 +1481,21 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -1259,6 +1504,7 @@
         //娑堢伀鏍撳尮閰�
         public static bool MatchingHydrant(HydroHydrantMatchingViewModel input, List<Vmo.AssetsHydrantMainVmo> hydrantVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (hydrantVmos == null || input == null || hydrantVmos.Count == 0)
             {
                 return true;
@@ -1330,10 +1576,22 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -1342,6 +1600,7 @@
         //鍘嬪姏琛ㄥ尮閰�
         public static bool MatchingPressmeter(HydroPressmeterMatchingViewModel input, List<Vmo.AssetsPressmeterMainVmo> pressmeterVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
             if (pressmeterVmos == null || input == null || pressmeterVmos.Count == 0)
             {
                 return true;
@@ -1378,9 +1637,21 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingModelType = vmo.Name;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingModelType = vmo.Name;
+                }
                 return true;
             }
             return false;
@@ -1389,6 +1660,8 @@
         //杩囨浮浠跺尮閰�
         public static bool MatchingTranslation(HydroTranslationMatchingViewModel input, List<Vmo.AssetsTranslationMainVmo> translationVmos)
         {
+            bool isNotarize = false; //鏄惁纭畾
+
             if (translationVmos == null || input == null || translationVmos.Count == 0)
             {
                 return true;
@@ -1458,14 +1731,34 @@
             }
             if (vmo != null)
             {
-                input.MatchingMinorLoss = vmo.MinorLoss;
-                input.MatchingDbId = vmo.ID.ToString();
-                input.MatchingMaterial = vmo.Material;
-                input.MatchingModelType = vmo.Name;
-                input.MatchingDiameter = vmo.Diameter;
-                input.MatchingEndDiameter = vmo.EndDiameter;
-                input.MatchingStartDiameter = vmo.StartDiameter;
-                input.MatchingRoughness = vmo.Roughness;
+                if (!isNotarize)
+                {
+                    if (input.MinorLoss < 0)
+                        input.MatchingMinorLoss = vmo.MinorLoss;
+                    if (input.DbId == null)
+                        input.MatchingDbId = vmo.ID.ToString();
+                    if (input.ModelType == null)
+                        input.MatchingModelType = vmo.Name;
+                    if (input.Roughness < 0)
+                        input.MatchingRoughness = vmo.Roughness;
+                    if (input.EndDiameter < 0)
+                        input.MatchingEndDiameter = vmo.EndDiameter;
+                    if (input.StartDiameter < 0)
+                        input.MatchingStartDiameter = vmo.StartDiameter;
+                    if (input.Diameter < 0)
+                        input.MatchingDiameter = vmo.Diameter;
+                }
+                else
+                {
+                    input.MatchingMinorLoss = vmo.MinorLoss;
+                    input.MatchingDbId = vmo.ID.ToString();
+                    input.MatchingMaterial = vmo.Material;
+                    input.MatchingModelType = vmo.Name;
+                    input.MatchingDiameter = vmo.Diameter;
+                    input.MatchingEndDiameter = vmo.EndDiameter;
+                    input.MatchingStartDiameter = vmo.StartDiameter;
+                    input.MatchingRoughness = vmo.Roughness;
+                }
                 return true;
             }
             return false;

--
Gitblit v1.9.3