From 00b42d0599014d02b95f04f0e6b7fb1fa1ce998a Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期五, 11 十月 2024 23:50:17 +0800
Subject: [PATCH] 修改命名,及匹配

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
index 8a27dbb..34281f8 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
@@ -1,4 +1,5 @@
-锘縰sing HStation.WinFrmUI.PhartRelation;
+锘縰sing HStation.Vmo;
+using HStation.WinFrmUI.PhartRelation;
 
 namespace HStation.WinFrmUI
 {
@@ -84,6 +85,10 @@
         //娉靛尮閰�
         public static async Task<bool> MatchingPumps(PumpMatchingViewModel InputModel, List<Vmo.PumpMainVmo> pumpMainVmos)
         {
+            if (pumpMainVmos == null)
+            {
+                return true;
+            }
             Vmo.PumpMainVmo vmo = null;
             int startCount = 0;
             // 灏濊瘯缁濆鍖归厤
@@ -189,13 +194,17 @@
         //闃�闂ㄥ尮閰�
         public static bool MatchingValve(ValveMatchingViewModel input, List<Vmo.ValveMainVmo> adaptingManageVmos)
         {
+            if (adaptingManageVmos == null)
+            {
+                return true;
+            }
             HStation.Vmo.ValveMainVmo vmo = null;
             int firstCount = 0;
             //鍙e緞鏈�灏忓樊鍊�
             // 缁濆鍖归厤
             var absoluteMatch = adaptingManageVmos.Where(i =>
               ((i.Caliber == null) || i.Caliber == input.Diameter) &&
-               ((input.Material == null) || i.Material == input.Material)).ToList();
+               ((input.Material == null) || i.MaterialName == input.Material)).ToList();
             if (absoluteMatch.Any())
             {
                 foreach (var range in absoluteMatch)
@@ -233,13 +242,13 @@
                     foreach (var range in rangeMatch)
                     {
                         //浠ユ潗鏂欎负鏉′欢寮�濮嬪尮閰�
-                        if (range.Material == null)
+                        if (range.MaterialName == null)
                         {
                             materialList.Add(range);
                         }
                         else
                         {
-                            int commonCount = GetIntersect(input.Material, range.Material);
+                            int commonCount = GetIntersect(input.Material, range.MaterialName);
                             if (commonCount > firstCount)
                             {
                                 materialList.Add(range);
@@ -279,7 +288,7 @@
                 input.MatchingMinorLoss = vmo.Coefficient;
                 input.MatchingDbId = vmo.ID.ToString();
                 input.MatchingDiameter = vmo.Caliber;
-                input.MatchingMaterial = vmo.Material;
+                input.MatchingMaterial = vmo.MaterialName;
                 input.MatchingModelType = vmo.Name;
                 //  input.MatchingValveSetting =
                 input.MatchingValveType = vmo.SeriesType.ToString();
@@ -291,6 +300,10 @@
         //绠¢亾鍖归厤
         public static bool MatchingPipe(PipeMatchingViewModel input, List<Vmo.PipeMainVmo> pipeLineManageVmos)
         {
+            if (pipeLineManageVmos == null)
+            {
+                return true;
+            }
             Vmo.PipeMainVmo vmo = null;
             int StartCount = 0;
             //鍙e緞鏈�灏忓樊鍊�
@@ -381,6 +394,10 @@
         //寮ご鍖归厤
         public static bool MatchingElbow(ElbowMatchingViewModel input, List<Vmo.ElbowMainVmo> adaptingManageVmos)
         {
+            if (adaptingManageVmos == null)
+            {
+                return true;
+            }
             Vmo.ElbowMainVmo vmo = null;
             int firstCount = 0;
             //鍙e緞鏈�灏忓樊鍊�
@@ -480,6 +497,10 @@
         //涓夐�氬尮閰�
         public static bool MatchingThreelink(ThreelinkMatchingViewModel input, List<Vmo.ThreeLinkMainVmo> adaptingManageVmos)
         {
+            if (adaptingManageVmos == null)
+            {
+                return true;
+            }
             Vmo.ThreeLinkMainVmo vmo = null;
             int firstCount = 0;
             //鍙e緞鏈�灏忓樊鍊�
@@ -579,6 +600,10 @@
         //鍥涢�氬尮閰�
         public static bool MatchingFourlink(FourlinkMatchingViewModel input, List<Vmo.FourLinkMainVmo> adaptingManageVmos)
         {
+            if (adaptingManageVmos == null)
+            {
+                return true;
+            }
             Vmo.FourLinkMainVmo vmo = null;
             int firstCount = 0;
             //鍙e緞鏈�灏忓樊鍊�
@@ -674,22 +699,6 @@
             }
             return false;
         }
-
-        /*
-                //杩斿洖涓や釜瀛楃涓蹭箣闂寸浉鍚岀殑瀛楃涓暟
-                private static int GetIntersect(string baseString, string compareString)
-                {
-                    // 灏嗗瓧绗︿覆杞崲涓哄瓧绗﹂泦鍚�
-                    if (baseString == string.Empty || baseString == null || compareString == string.Empty || compareString == null)
-                    {
-                        return 0;
-                    }
-                    HashSet<char> baseChars = new HashSet<char>(baseString);
-                    HashSet<char> comparisonChars = new HashSet<char>(compareString);
-                    // 璁$畻涓や釜闆嗗悎鐨勪氦闆�
-                    int commonCount = baseChars.Intersect(comparisonChars).Count();
-                    return commonCount;
-                }*/
 
         /// <summary>
         /// 鑾峰彇涓や釜瀛楃涓茬殑鎵�鏈変氦闆�

--
Gitblit v1.9.3