From b2e753b7d889e1a1fbc17f8b43c3dd02aa0faad4 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期五, 20 九月 2024 15:35:30 +0800
Subject: [PATCH] 自动匹配界面修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-autoMatching/01-ViewModel/eMatchingType.cs                       |   18 +
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsMainChoicePage.cs                             |   19 +
 Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/AddValveMainInput.cs                                                       |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ElbowsMatchingCtrl.cs             |   26 ++
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs          |   10 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/PumpMatchingViewModel.cs               |   36 +++
 WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/EditValveMainDlg.cs                                                   |    7 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/AsstesAutoMatchingHelper.cs       |  206 ++++++++++++++++-
 Vmo/HStation.Vmo.Assets.Core/02-ValveManage/ValveMainVmo.cs                                                                         |    2 
 Service/HStation.Service.Assets.Core/01-entity/ValveManage/ValveMain.cs                                                             |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs               |    5 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj                                                               |   10 
 Desktop/HStation.Desktop.Xhs.Core/MainForm.Designer.cs                                                                              |    1 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user                                                          |    6 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.Designer.cs               |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PipeLineMatchingCtrl.cs           |    8 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs                                     |   12 +
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs                            |   92 ++++----
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.Designer.cs |   76 +++++-
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs              |    8 
 WinFrmUI/HStation.WinFrmUI.Assets.Core/05-ValveManage/00-ViewModel/ValveMainViewModel.cs                                            |    2 
 WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/AddValveMainDlg.cs                                                    |    5 
 Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/UpdateValveMainInput.cs                                                    |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/FourLinkMatchingCtrl.cs           |   26 ++
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/AdaptingViewModel.cs                   |   36 +++
 Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/ValveMainDto.cs                                                            |    2 
 Service/HStation.Service.Assets.Core/02-model/ValveManage/ValveMain.cs                                                              |    2 
 27 files changed, 497 insertions(+), 126 deletions(-)

diff --git a/Desktop/HStation.Desktop.Xhs.Core/MainForm.Designer.cs b/Desktop/HStation.Desktop.Xhs.Core/MainForm.Designer.cs
index 2207d99..2dd63e1 100644
--- a/Desktop/HStation.Desktop.Xhs.Core/MainForm.Designer.cs
+++ b/Desktop/HStation.Desktop.Xhs.Core/MainForm.Designer.cs
@@ -191,6 +191,7 @@
             navButton2.Alignment = DevExpress.XtraBars.Navigation.NavButtonAlignment.Right;
             navButton2.Caption = "鍨嬪彿绠$悊";
             navButton2.Name = "navButton2";
+            navButton2.Visible = false;
             // 
             // nbSystemConfig
             // 
diff --git a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/AddValveMainInput.cs b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/AddValveMainInput.cs
index 27dcf03..6f5a36c 100644
--- a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/AddValveMainInput.cs
+++ b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/AddValveMainInput.cs
@@ -37,7 +37,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 璇存槑
diff --git a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/UpdateValveMainInput.cs b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/UpdateValveMainInput.cs
index 4240e5e..29e6996 100644
--- a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/UpdateValveMainInput.cs
+++ b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/UpdateValveMainInput.cs
@@ -44,7 +44,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 璇存槑
diff --git a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/ValveMainDto.cs b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/ValveMainDto.cs
index 72868cb..3e3b5ea 100644
--- a/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/ValveMainDto.cs
+++ b/Dto/HStation.Dto.Assets.Core/01-ValveManage/03-ValveMain/ValveMainDto.cs
@@ -61,7 +61,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 璇存槑
diff --git a/Service/HStation.Service.Assets.Core/01-entity/ValveManage/ValveMain.cs b/Service/HStation.Service.Assets.Core/01-entity/ValveManage/ValveMain.cs
index 8497ca7..4a6a741 100644
--- a/Service/HStation.Service.Assets.Core/01-entity/ValveManage/ValveMain.cs
+++ b/Service/HStation.Service.Assets.Core/01-entity/ValveManage/ValveMain.cs
@@ -65,7 +65,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 绫诲瀷
diff --git a/Service/HStation.Service.Assets.Core/02-model/ValveManage/ValveMain.cs b/Service/HStation.Service.Assets.Core/02-model/ValveManage/ValveMain.cs
index e380f94..ead24f0 100644
--- a/Service/HStation.Service.Assets.Core/02-model/ValveManage/ValveMain.cs
+++ b/Service/HStation.Service.Assets.Core/02-model/ValveManage/ValveMain.cs
@@ -85,7 +85,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 璇存槑
diff --git a/Vmo/HStation.Vmo.Assets.Core/02-ValveManage/ValveMainVmo.cs b/Vmo/HStation.Vmo.Assets.Core/02-ValveManage/ValveMainVmo.cs
index c06050d..7b6a3af 100644
--- a/Vmo/HStation.Vmo.Assets.Core/02-ValveManage/ValveMainVmo.cs
+++ b/Vmo/HStation.Vmo.Assets.Core/02-ValveManage/ValveMainVmo.cs
@@ -40,7 +40,7 @@
         /// <summary>
         /// 绯绘暟
         /// </summary>
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 璇存槑
diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-ValveManage/00-ViewModel/ValveMainViewModel.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-ValveManage/00-ViewModel/ValveMainViewModel.cs
index e224a51..60eb056 100644
--- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-ValveManage/00-ViewModel/ValveMainViewModel.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-ValveManage/00-ViewModel/ValveMainViewModel.cs
@@ -64,7 +64,7 @@
         /// </summary>
         [DisplayName("鎹熷け绯绘暟")]
         [Browsable(true)]
-        public string Coefficient { get; set; }
+        public double Coefficient { get; set; }
 
         /// <summary>
         /// 绫诲瀷
diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/AddValveMainDlg.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/AddValveMainDlg.cs
index 312092c..a6ba7c7 100644
--- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/AddValveMainDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/AddValveMainDlg.cs
@@ -73,7 +73,10 @@
             if (!(Valid()))
                 return;
             _ValveMain.Name = TextEditName.Text.Trim();
-            _ValveMain.Coefficient = TextEditCoefficient.Text.Trim();
+            if (double.TryParse(TextEditCoefficient.Text, out double coefficient))
+            {
+                _ValveMain.Coefficient = coefficient;
+            }
             _ValveMain.Material = TextEditMaterial.Text.Trim();
             _ValveMain.Description = TextEditDescription.Text.Trim();
             _ValveMain.Caliber = TextEditCaliber.Text.Trim();
diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/EditValveMainDlg.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/EditValveMainDlg.cs
index c282a87..59c6479 100644
--- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/EditValveMainDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/02-main/EditValveMainDlg.cs
@@ -16,7 +16,7 @@
         {
             _ValveMain = Valve;
             this.TextEditCaliber.Text = _ValveMain.Caliber;
-            this.TextEditCoefficient.Text = _ValveMain.Coefficient;
+            this.TextEditCoefficient.Text = _ValveMain.Coefficient.ToString();
             this.TextEditMaterial.Text = _ValveMain.Material;
             this.TextEditName.Text = _ValveMain.Name;
             this.TextEditDescription.Text = _ValveMain.Description;
@@ -79,7 +79,10 @@
             if (!(Valid()))
                 return;
             _ValveMain.Name = TextEditName.Text.Trim();
-            _ValveMain.Coefficient = TextEditCoefficient.Text.Trim();
+            if (double.TryParse(TextEditCoefficient.Text, out double coefficient))
+            {
+                _ValveMain.Coefficient = coefficient;
+            }
             _ValveMain.Material = TextEditMaterial.Text.Trim();
             _ValveMain.Description = TextEditDescription.Text.Trim();
             _ValveMain.Caliber = TextEditCaliber.Text.Trim();
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/AdaptingViewModel.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/AdaptingViewModel.cs
index 3395cef..7d8bd4c 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/AdaptingViewModel.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/AdaptingViewModel.cs
@@ -1,4 +1,6 @@
-锘縩amespace HStation.WinFrmUI
+锘縰sing HStation.WinFrmUI.Xhs;
+
+namespace HStation.WinFrmUI
 {
     public class AdaptingViewModel
     {
@@ -32,11 +34,18 @@
         public string Name { get; set; }
 
         /// <summary>
-        ///
+        ///淇敼鍓岲bid
         /// </summary>
         [DisplayName("Dbid")]
         [Browsable(false)]
         public long Dbid { get; set; }
+
+        /// <summary>
+        ///淇敼鍚嶥bid
+        /// </summary>
+        [DisplayName("AlterDbid")]
+        [Browsable(false)]
+        public long? AlterDbid { get; set; }
 
         /// <summary>
         /// 缂栫爜
@@ -60,11 +69,25 @@
         public string Material { get; set; }
 
         /// <summary>
+        ///淇敼鍚庢潗璐�
+        /// </summary>
+        [DisplayName("淇敼鍚庢潗璐�")]
+        [Browsable(true)]
+        public string AlterMaterial { get; set; }
+
+        /// <summary>
         /// 鍙e緞
         /// </summary>
         [DisplayName("鍙e緞")]
         [Browsable(true)]
         public string Caliber { get; set; }
+
+        /// <summary>
+        ///淇敼鍚庡彛寰�
+        /// </summary>
+        [DisplayName("淇敼鍚庡彛寰�")]
+        [Browsable(true)]
+        public string AlterCaliber { get; set; }
 
         /// <summary>
         /// Db閿佸畾
@@ -81,10 +104,17 @@
         public double? MinorLoss { get; set; }
 
         /// <summary>
+        ///淇敼鍚庢崯澶辩郴鏁�
+        /// </summary>
+        [DisplayName("淇敼鍚庢崯澶辩郴鏁�")]
+        [Browsable(true)]
+        public double? AlterMinorLoss { get; set; }
+
+        /// <summary>
         /// 鏄惁鍖归厤鎴愬姛
         /// </summary>
         [DisplayName("鏄惁鍖归厤鎴愬姛")]
         [Browsable(true)]
-        public int MatchingType { get; set; }
+        public eMatchingType MatchingType { get; set; }
     }
 }
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/PumpMatchingViewModel.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/PumpMatchingViewModel.cs
index cb9c640..ebcf9ea 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/PumpMatchingViewModel.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/01-ViewModel/PumpMatchingViewModel.cs
@@ -69,5 +69,41 @@
         [DisplayName("ChartDbID")]
         [Browsable(false)]
         public long ChartDbID { get; set; }
+
+        [DisplayName("鍖归厤鍚嶥bID")]
+        [Browsable(false)]
+        public string AlterDbID { get; set; }
+
+        [DisplayName("鍖归厤鍚嶤hartDbID")]
+        [Browsable(false)]
+        public long? AlterChartDbID { get; set; }
+
+        /// <summary>
+        /// 淇敼鍚庨瀹氬姛鐜�
+        /// </summary>
+        [DisplayName("淇敼鍚庨瀹氬姛鐜�")]
+        [Browsable(true)]
+        public double? AlterRatedP { get; set; }
+
+        /// <summary>
+        ///  淇敼鍚庨瀹氭祦閲�
+        /// </summary>
+        [DisplayName("淇敼鍚庨瀹氭祦閲�")]
+        [Browsable(true)]
+        public double? AlterRatedQ { get; set; }
+
+        /// <summary>
+        /// 淇敼鍚庨瀹氭壃绋�
+        /// </summary>
+        [DisplayName("淇敼鍚庨瀹氭壃绋�")]
+        [Browsable(true)]
+        public double? AlterRatedH { get; set; }
+
+        /// <summary>
+        /// 淇敼鍚庨瀹氳浆閫�
+        /// </summary>
+        [DisplayName("淇敼鍚庨瀹氳浆閫�")]
+        [Browsable(true)]
+        public double? AlterRatedN { get; set; }
     }
 }
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/AsstesAutoMatchingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/AsstesAutoMatchingHelper.cs
index 029e2f7..f19b8cd 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/AsstesAutoMatchingHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/AsstesAutoMatchingHelper.cs
@@ -1,7 +1,14 @@
-锘縩amespace HStation.WinFrmUI
+锘縰sing HStation.Vmo;
+using System.Windows.Media.Media3D;
+using Yw.WinFrmUI.Q3d;
+
+namespace HStation.WinFrmUI
 {
     public class AsstesAutoMatchingHelper
     {
+        private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new();
+
+        //杩炴帴浠跺尮閰�
         public static T AutoMatching<T>(T input, List<Vmo.AdaptingManageVmo> adaptingManageVmos) where T : AdaptingViewModel
         {
             Vmo.AdaptingManageVmo vmo = null;
@@ -40,24 +47,51 @@
                     {
                         return Math.Abs(itemCaliber - inputCaliber) <= caliberTolerance;
                     }
+                    else
+                    {
+                        if (item.Caliber == "榛樿")
+                        {
+                            return true;
+                        }
+                    }
                     return false;
                 })
              .ToList();
-                if (rangeMatch != null)
+                if (rangeMatch != null && rangeMatch.Count > 0)
                 {
+                    var materialList = new List<Vmo.AdaptingManageVmo>();
                     foreach (var range in rangeMatch)
                     {
                         //浠ユ潗鏂欎负鏉′欢寮�濮嬪尮閰�
-                        int commonCount = CountCommonCharacters(input.Material, range.Material);
+                        if (range.Material == "榛樿")
+                        {
+                            materialList.Add(range);
+                        }
+                        else
+                        {
+                            int commonCount = CountCommonCharacters(input.Material, range.Material);
+                            if (commonCount > firstCount)
+                            {
+                                materialList.Add(range);
+                                firstCount = commonCount;
+                            }
+                        }
+                    }
+                    //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢��
+                    firstCount = 0;
+                    foreach (var material in materialList)
+                    {
+                        int commonCount = CountCommonCharacters(input.ModelType, material.Name);
                         if (commonCount > firstCount)
                         {
-                            vmo = range;
+                            vmo = material;
                             firstCount = commonCount;
                         }
                     }
                 }
             }
             //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰�
+            firstCount = 0;
             if (vmo == null)
             {
                 foreach (var item in adaptingManageVmos)
@@ -72,21 +106,127 @@
             }
             if (vmo != null)
             {
-                input.MinorLoss = vmo.Coefficient;
+                input.AlterMinorLoss = vmo.Coefficient;
+                input.MatchingType = Xhs.eMatchingType.Success;
+                return input;
+            }
+            return null;
+        }
+
+        //闃�闂ㄥ尮閰�
+        public static ValveMatchingViewModel ValveMatching(ValveMatchingViewModel input, List<Vmo.ValveMainVmo> adaptingManageVmos)
+        {
+            HStation.Vmo.ValveMainVmo vmo = null;
+            int firstCount = 0;
+            //鍙e緞鏈�灏忓樊鍊�
+            const double caliberTolerance = 10.0;
+            // 缁濆鍖归厤
+            var absoluteMatch = adaptingManageVmos.Where(i =>
+              ((input.Caliber == null && i.Caliber == "榛樿") || i.Caliber == input.Caliber) &&
+               ((input.Material == null && i.Material == "榛樿") || i.Material == input.Material)).ToList();
+            if (absoluteMatch.Any())
+            {
+                foreach (var range in absoluteMatch)
+                {
+                    int commonCount = CountCommonCharacters(input.ModelType, range.Name);
+                    if (commonCount > firstCount)
+                    {
+                        vmo = range;
+                        firstCount = commonCount;
+                    }
+                }
+            }
+            else
+            {
+                double inputCaliber;
+                if (!double.TryParse(input.Caliber, out inputCaliber))
+                {
+                    return null;
+                }
+
+                //鍖洪棿鍖归厤
+                var rangeMatch = adaptingManageVmos.Where(item =>
+                {
+                    double itemCaliber;
+                    if (double.TryParse(item.Caliber, out itemCaliber))
+                    {
+                        return Math.Abs(itemCaliber - inputCaliber) <= caliberTolerance;
+                    }
+                    else
+                    {
+                        if (item.Caliber == "榛樿")
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                })
+             .ToList();
+                if (rangeMatch != null && rangeMatch.Count > 0)
+                {
+                    var materialList = new List<Vmo.ValveMainVmo>();
+                    foreach (var range in rangeMatch)
+                    {
+                        //浠ユ潗鏂欎负鏉′欢寮�濮嬪尮閰�
+                        if (range.Material == "榛樿")
+                        {
+                            materialList.Add(range);
+                        }
+                        else
+                        {
+                            int commonCount = CountCommonCharacters(input.Material, range.Material);
+                            if (commonCount > firstCount)
+                            {
+                                materialList.Add(range);
+                                firstCount = commonCount;
+                            }
+                        }
+                    }
+                    //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢��
+                    firstCount = 0;
+                    foreach (var material in materialList)
+                    {
+                        int commonCount = CountCommonCharacters(input.ModelType, material.Name);
+                        if (commonCount > firstCount)
+                        {
+                            vmo = material;
+                            firstCount = commonCount;
+                        }
+                    }
+                }
+            }
+            //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰�
+            firstCount = 0;
+            if (vmo == null)
+            {
+                foreach (var item in adaptingManageVmos)
+                {
+                    int commonCount = CountCommonCharacters(input.ModelType, item.Name);
+                    if (commonCount > firstCount)
+                    {
+                        vmo = item;
+                        firstCount = commonCount;
+                    }
+                }
+            }
+            if (vmo != null)
+            {
+                input.AlterMinorLoss = vmo.Coefficient;
+                input.MatchingType = Xhs.eMatchingType.Success;
                 return input;
             }
             return null;
         }
 
         //娉靛尮閰�
-        public static PumpMatchingViewModel PumpMatching(PumpMatchingViewModel viewModel, List<Vmo.PumpMainVmo> pumpMainVmos)
+        public static async Task<PumpMatchingViewModel> PumpMatching(PumpMatchingViewModel viewModel, List<Vmo.PumpMainVmo> pumpMainVmos)
         {
             const double speedTolerance = 100;
             const double flowTolerance = 10;
             const double headTolerance = 5;
             const double powerTolerance = 0.05;
             Vmo.PumpMainVmo vmo = null;
-            int firstCount = 0;
+            int startCount = 0;
             // 灏濊瘯缁濆鍖归厤
             var absoluteMatch = pumpMainVmos.Where(item =>
             (viewModel.RatedN == null || viewModel.RatedN == item.RatedSpeed) &&
@@ -98,10 +238,10 @@
                 foreach (var item in absoluteMatch)
                 {
                     int commonCount = CountCommonCharacters(viewModel.ModelType, item.Name);
-                    if (commonCount > firstCount)
+                    if (commonCount > startCount)
                     {
                         vmo = item;
-                        firstCount = commonCount;
+                        startCount = commonCount;
                     }
                 }
             }
@@ -118,19 +258,45 @@
                     foreach (var item in rangeMatch)
                     {
                         int commonCount = CountCommonCharacters(viewModel.ModelType, item.Name);
-                        if (commonCount > firstCount)
+                        if (commonCount > startCount)
                         {
                             vmo = item;
-                            firstCount = commonCount;
+                            startCount = commonCount;
                         }
                     }
                 }
             }
-            return new PumpMatchingViewModel();
+            //
+            if (vmo == null)
+            {
+                foreach (var item in pumpMainVmos)
+                {
+                    int commonCount = CountCommonCharacters(viewModel.ModelType, item.Name);
+                    if (commonCount > startCount)
+                    {
+                        vmo = item;
+                        startCount = commonCount;
+                    }
+                }
+            }
+            if (vmo != null)
+            {
+                viewModel.AlterRatedH = vmo.RatedHead;
+                viewModel.AlterRatedN = vmo.RatedSpeed;
+                viewModel.AlterRatedQ = vmo.RatedFlow;
+                viewModel.AlterRatedP = vmo.RatedPower;
+                viewModel.AlterDbID = vmo.ID.ToString();
+                var list = await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(vmo.ID);
+                if (list != null && list.Count > 0)
+                {
+                    viewModel.AlterChartDbID = list.First().ID;
+                }
+            }
+            return null;
         }
 
         //绠¢亾鍖归厤
-        public static PipeLineMatchingViewModel AutoMatching(PipeLineMatchingViewModel input, List<Vmo.PipeLineManageVmo> adaptingManageVmos)
+        public static PipeLineMatchingViewModel PipeAutoMatching(PipeLineMatchingViewModel input, List<Vmo.PipeLineManageVmo> adaptingManageVmos)
         {
             Vmo.PipeLineManageVmo vmo = null;
             int StartCount = 0;
@@ -203,31 +369,31 @@
                 switch (input.eAlgorithmType)
                 {
                     case HStation.Assets.eAlgorithmType.Hazen:
-                        input.MinorLoss = vmo.Hazen;
+                        input.AlterMinorLoss = vmo.Hazen;
                         return input;
 
                     case HStation.Assets.eAlgorithmType.Manning:
-                        input.MinorLoss = vmo.Manning;
+                        input.AlterMinorLoss = vmo.Manning;
                         return input;
 
                     case HStation.Assets.eAlgorithmType.Darcy:
-                        input.MinorLoss = vmo.Darcy;
+                        input.AlterMinorLoss = vmo.Darcy;
                         return input;
 
                     default:
-                        input.MinorLoss = vmo.Hazen;
+                        input.AlterMinorLoss = vmo.Hazen;
                         return input;
                 }
             }
             return null;
         }
 
-        //杩斿洖涓や釜瀛楃涓蹭箣闂寸浉鍚岀殑瀛楃
-        private static int CountCommonCharacters(string baseString, string comparisonString)
+        //杩斿洖涓や釜瀛楃涓蹭箣闂寸浉鍚岀殑瀛楃涓暟
+        private static int CountCommonCharacters(string baseString, string compareString)
         {
             // 灏嗗瓧绗︿覆杞崲涓哄瓧绗﹂泦鍚�
             HashSet<char> baseChars = new HashSet<char>(baseString);
-            HashSet<char> comparisonChars = new HashSet<char>(comparisonString);
+            HashSet<char> comparisonChars = new HashSet<char>(compareString);
             // 璁$畻涓や釜闆嗗悎鐨勪氦闆�
             int commonCount = baseChars.Intersect(comparisonChars).Count();
             return commonCount;
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ElbowsMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ElbowsMatchingCtrl.cs
index 60421dd..d03c1d5 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ElbowsMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ElbowsMatchingCtrl.cs
@@ -9,5 +9,31 @@
             this.gridView1.OptionsView.ShowDetailButtons = true;
             this.gridView1.OptionsView.ShowGroupPanel = false;
         }
+
+        private List<ElbowsMatchingViewModel> _allBindingList = null;
+
+        public List<ElbowsMatchingViewModel> SetBindingData(List<ElbowsMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
+        {
+            if (inputs == null || inputs.Count == 0)
+                return null;
+            var resultList = new List<ElbowsMatchingViewModel>();
+            foreach (var item in inputs)
+            {
+                var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
+                if (result != null)
+                {
+                    resultList.Add(result);
+                }
+                else
+                {
+                    item.MatchingType = Xhs.eMatchingType.Error;
+                    resultList.Add(result);
+                }
+            }
+            _allBindingList = resultList;
+            this.elbowsMatchingViewModelBindingSource.DataSource = _allBindingList;
+            this.elbowsMatchingViewModelBindingSource.ResetBindings(false);
+            return resultList;
+        }
     }
 }
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/FourLinkMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/FourLinkMatchingCtrl.cs
index 979814f..498f5b8 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/FourLinkMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/FourLinkMatchingCtrl.cs
@@ -9,5 +9,31 @@
             this.gridView1.OptionsView.ShowDetailButtons = true;
             this.gridView1.OptionsView.ShowGroupPanel = false;
         }
+
+        private List<FourLinkMatchingViewModel> _allBindingList = null;
+
+        public List<FourLinkMatchingViewModel> SetBindingData(List<FourLinkMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
+        {
+            if (inputs == null || inputs.Count == 0)
+                return null;
+            var resultList = new List<FourLinkMatchingViewModel>();
+            foreach (var item in inputs)
+            {
+                var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
+                if (result != null)
+                {
+                    resultList.Add(result);
+                }
+                else
+                {
+                    item.MatchingType = Xhs.eMatchingType.Error;
+                    resultList.Add(result);
+                }
+            }
+            _allBindingList = resultList;
+            this.fourLinkMatchingViewModelBindingSource.DataSource = _allBindingList;
+            this.fourLinkMatchingViewModelBindingSource.ResetBindings(false);
+            return resultList;
+        }
     }
 }
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PipeLineMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PipeLineMatchingCtrl.cs
index dc96769..2a7e2ec 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PipeLineMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PipeLineMatchingCtrl.cs
@@ -12,12 +12,16 @@
 
         private List<PipeLineMatchingViewModel> _allBindingList = null;
 
-        public List<PipeLineMatchingViewModel> SetBindingData(List<PipeLineMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
+        public List<PipeLineMatchingViewModel> SetBindingData(List<PipeLineMatchingViewModel> inputs, List<PipeLineManageVmo> alllist)
         {
+            if (inputs == null)
+            {
+                return null;
+            }
             var finishList = new List<PipeLineMatchingViewModel>();
             foreach (var item in inputs)
             {
-                var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
+                var result = AsstesAutoMatchingHelper.PipeAutoMatching(item, alllist);
                 if (result != null)
                 {
                     finishList.Add(result);
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
index ced9648..19461c1 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
@@ -12,15 +12,14 @@
 
         private List<PumpMatchingViewModel> _allBindingList = null;
 
-        public List<PumpMatchingViewModel> SetBindingData(List<PumpMatchingViewModel> pumpMatchingViewModel, List<PumpMainVmo> pumpMainVmos, out List<PumpMatchingViewModel> errorList)
+        public async Task<List<PumpMatchingViewModel>> SetBindingData(List<PumpMatchingViewModel> pumpMatchingViewModel, List<PumpMainVmo> pumpMainVmos)
         {
-            errorList = null;
             List<PumpMatchingViewModel> _allBindingList = new List<PumpMatchingViewModel>();
             if (pumpMatchingViewModel == null)
                 return null;
             foreach (var item in pumpMatchingViewModel)
             {
-                var result = AsstesAutoMatchingHelper.PumpMatching(item, pumpMainVmos);
+                var result = await AsstesAutoMatchingHelper.PumpMatching(item, pumpMainVmos);
             }
             this.pumpMatchingViewModelBindingSource.DataSource = _allBindingList;
             return _allBindingList;
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.Designer.cs
index 7de3ef2..1f615bb 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.Designer.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.Designer.cs
@@ -30,18 +30,22 @@
         {
             components = new Container();
             gridControl1 = new DevExpress.XtraGrid.GridControl();
+            threeLinkMatchingViewModelBindingSource = new BindingSource(components);
             gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
             colName = new DevExpress.XtraGrid.Columns.GridColumn();
-            colDbid = new DevExpress.XtraGrid.Columns.GridColumn();
             colCode = new DevExpress.XtraGrid.Columns.GridColumn();
             colModelType = new DevExpress.XtraGrid.Columns.GridColumn();
             colMaterial = new DevExpress.XtraGrid.Columns.GridColumn();
             colCaliber = new DevExpress.XtraGrid.Columns.GridColumn();
             colDbLocked = new DevExpress.XtraGrid.Columns.GridColumn();
-            threeLinkMatchingViewModelBindingSource = new BindingSource(components);
+            colAlterCaliber = new DevExpress.XtraGrid.Columns.GridColumn();
+            colAlterMaterial = new DevExpress.XtraGrid.Columns.GridColumn();
+            colAlterMinorLoss = new DevExpress.XtraGrid.Columns.GridColumn();
+            colMatchingType = new DevExpress.XtraGrid.Columns.GridColumn();
+            colMinorLoss = new DevExpress.XtraGrid.Columns.GridColumn();
             ((ISupportInitialize)gridControl1).BeginInit();
-            ((ISupportInitialize)gridView1).BeginInit();
             ((ISupportInitialize)threeLinkMatchingViewModelBindingSource).BeginInit();
+            ((ISupportInitialize)gridView1).BeginInit();
             SuspendLayout();
             // 
             // gridControl1
@@ -55,9 +59,13 @@
             gridControl1.TabIndex = 0;
             gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { gridView1 });
             // 
+            // threeLinkMatchingViewModelBindingSource
+            // 
+            threeLinkMatchingViewModelBindingSource.DataSource = typeof(ThreeLinkMatchingViewModel);
+            // 
             // gridView1
             // 
-            gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { colName, colDbid, colCode, colModelType, colMaterial, colCaliber, colDbLocked });
+            gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { colName, colCode, colModelType, colMaterial, colCaliber, colDbLocked, colAlterCaliber, colAlterMaterial, colAlterMinorLoss, colMatchingType, colMinorLoss });
             gridView1.GridControl = gridControl1;
             gridView1.Name = "gridView1";
             gridView1.OptionsView.ShowGroupPanel = false;
@@ -69,51 +77,75 @@
             colName.Visible = true;
             colName.VisibleIndex = 0;
             // 
-            // colDbid
-            // 
-            colDbid.FieldName = "Dbid";
-            colDbid.Name = "colDbid";
-            colDbid.Visible = true;
-            colDbid.VisibleIndex = 1;
-            // 
             // colCode
             // 
             colCode.FieldName = "Code";
             colCode.Name = "colCode";
             colCode.Visible = true;
-            colCode.VisibleIndex = 2;
+            colCode.VisibleIndex = 1;
             // 
             // colModelType
             // 
             colModelType.FieldName = "ModelType";
             colModelType.Name = "colModelType";
             colModelType.Visible = true;
-            colModelType.VisibleIndex = 3;
+            colModelType.VisibleIndex = 2;
             // 
             // colMaterial
             // 
             colMaterial.FieldName = "Material";
             colMaterial.Name = "colMaterial";
             colMaterial.Visible = true;
-            colMaterial.VisibleIndex = 4;
+            colMaterial.VisibleIndex = 3;
             // 
             // colCaliber
             // 
             colCaliber.FieldName = "Caliber";
             colCaliber.Name = "colCaliber";
             colCaliber.Visible = true;
-            colCaliber.VisibleIndex = 5;
+            colCaliber.VisibleIndex = 7;
             // 
             // colDbLocked
             // 
             colDbLocked.FieldName = "DbLocked";
             colDbLocked.Name = "colDbLocked";
             colDbLocked.Visible = true;
-            colDbLocked.VisibleIndex = 6;
+            colDbLocked.VisibleIndex = 9;
             // 
-            // threeLinkMatchingViewModelBindingSource
+            // colAlterCaliber
             // 
-            threeLinkMatchingViewModelBindingSource.DataSource = typeof(ThreeLinkMatchingViewModel);
+            colAlterCaliber.FieldName = "AlterCaliber";
+            colAlterCaliber.Name = "colAlterCaliber";
+            colAlterCaliber.Visible = true;
+            colAlterCaliber.VisibleIndex = 8;
+            // 
+            // colAlterMaterial
+            // 
+            colAlterMaterial.FieldName = "AlterMaterial";
+            colAlterMaterial.Name = "colAlterMaterial";
+            colAlterMaterial.Visible = true;
+            colAlterMaterial.VisibleIndex = 4;
+            // 
+            // colAlterMinorLoss
+            // 
+            colAlterMinorLoss.FieldName = "AlterMinorLoss";
+            colAlterMinorLoss.Name = "colAlterMinorLoss";
+            colAlterMinorLoss.Visible = true;
+            colAlterMinorLoss.VisibleIndex = 6;
+            // 
+            // colMatchingType
+            // 
+            colMatchingType.FieldName = "MatchingType";
+            colMatchingType.Name = "colMatchingType";
+            colMatchingType.Visible = true;
+            colMatchingType.VisibleIndex = 10;
+            // 
+            // colMinorLoss
+            // 
+            colMinorLoss.FieldName = "MinorLoss";
+            colMinorLoss.Name = "colMinorLoss";
+            colMinorLoss.Visible = true;
+            colMinorLoss.VisibleIndex = 5;
             // 
             // ThreeLinkMatchingCtrl
             // 
@@ -123,8 +155,8 @@
             Name = "ThreeLinkMatchingCtrl";
             Size = new Size(1035, 503);
             ((ISupportInitialize)gridControl1).EndInit();
-            ((ISupportInitialize)gridView1).EndInit();
             ((ISupportInitialize)threeLinkMatchingViewModelBindingSource).EndInit();
+            ((ISupportInitialize)gridView1).EndInit();
             ResumeLayout(false);
         }
 
@@ -133,12 +165,16 @@
         private DevExpress.XtraGrid.GridControl gridControl1;
         private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
         private DevExpress.XtraGrid.Columns.GridColumn colName;
-        private DevExpress.XtraGrid.Columns.GridColumn colDbid;
         private DevExpress.XtraGrid.Columns.GridColumn colCode;
         private DevExpress.XtraGrid.Columns.GridColumn colModelType;
         private DevExpress.XtraGrid.Columns.GridColumn colMaterial;
         private DevExpress.XtraGrid.Columns.GridColumn colCaliber;
         private DevExpress.XtraGrid.Columns.GridColumn colDbLocked;
         private BindingSource threeLinkMatchingViewModelBindingSource;
+        private DevExpress.XtraGrid.Columns.GridColumn colAlterCaliber;
+        private DevExpress.XtraGrid.Columns.GridColumn colAlterMaterial;
+        private DevExpress.XtraGrid.Columns.GridColumn colAlterMinorLoss;
+        private DevExpress.XtraGrid.Columns.GridColumn colMatchingType;
+        private DevExpress.XtraGrid.Columns.GridColumn colMinorLoss;
     }
 }
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
index 6de0b0c..89a03e3 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
@@ -18,22 +18,24 @@
         {
             if (inputs == null || inputs.Count == 0)
                 return null;
-            var finishList = new List<ThreeLinkMatchingViewModel>();
+            var resultList = new List<ThreeLinkMatchingViewModel>();
             foreach (var item in inputs)
             {
                 var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
                 if (result != null)
                 {
-                    finishList.Add(result);
+                    resultList.Add(result);
                 }
                 else
                 {
+                    item.MatchingType = Xhs.eMatchingType.Error;
+                    resultList.Add(result);
                 }
             }
-            _allBindingList = finishList;
+            _allBindingList = resultList;
             this.threeLinkMatchingViewModelBindingSource.DataSource = _allBindingList;
             this.threeLinkMatchingViewModelBindingSource.ResetBindings(false);
-            return finishList;
+            return resultList;
         }
     }
 }
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs
index ab4586e..b506264 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs
@@ -10,18 +10,14 @@
             this.gridView1.OptionsView.ShowGroupPanel = false;
         }
 
-        private BLL.AdaptingManage _adaptingBll;
-
         private List<ValveMatchingViewModel> _allBindingList = null;
 
-        public List<ValveMatchingViewModel> SetBindingData(List<ValveMatchingViewModel> inputs)
+        public List<ValveMatchingViewModel> SetBindingData(List<ValveMatchingViewModel> inputs, List<ValveMainVmo> alllist)
         {
             var finishList = new List<ValveMatchingViewModel>();
-            _adaptingBll = new BLL.AdaptingManage();
-            var alllist = _adaptingBll.GetAll().Result;
             foreach (var item in inputs)
             {
-                var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
+                var result = AsstesAutoMatchingHelper.ValveMatching(item, alllist);
                 if (result != null)
                 {
                     finishList.Add(result);
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.Designer.cs
index 9e5e2b6..907e122 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.Designer.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.Designer.cs
@@ -107,7 +107,7 @@
             // 
             AssetsMainChoicePage.Dock = DockStyle.Fill;
             AssetsMainChoicePage.Location = new Point(0, 0);
-            AssetsMainChoicePage.Name = "pumpMainChoicePage";
+            AssetsMainChoicePage.Name = "AssetsMainChoicePage";
             AssetsMainChoicePage.Size = new Size(1051, 505);
             AssetsMainChoicePage.TabIndex = 0;
             // 
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsMainChoicePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsMainChoicePage.cs
index a16bcda..3dc3db6 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsMainChoicePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsMainChoicePage.cs
@@ -11,6 +11,10 @@
 
         private BLL.AdaptingManage _adaptingManage = null;
 
+        private BLL.PipeLineManage _pipeLineManage = null;
+
+        private BLL.ValveMain _valveMain = null;
+
         /// <summary>
         /// 鍒濆鍖�
         /// </summary>
@@ -18,12 +22,23 @@
         {
             _pumpMain = new BLL.PumpMain();
             _adaptingManage = new BLL.AdaptingManage();
+            _pipeLineManage = new BLL.PipeLineManage();
+            _valveMain = new BLL.ValveMain();
             var allPump = await _pumpMain.GetAll();
             var allAdapting = await _adaptingManage.GetAll();
+            var allPipeLine = await _pipeLineManage.GetAll();
+            var allValve = await _valveMain.GetAll();
             var assetsAutoMatching = new AssetsAutoMatchingInputViewModel();
-            var pumpMatching = this.pumpMatchingCtrl1.SetBindingData(input.PumpMatchingModels, allPump, out List<PumpMatchingViewModel> pumpErrors);
+            //娉靛尮閰�
+            var pumpMatching = await this.pumpMatchingCtrl1.SetBindingData(input.PumpMatchingModels, allPump);
+            //涓夐�氬尮閰�
             var threeLinkMatching = this.threeLinkMatchingCtrl1.SetBindingData(input.ThreeLinkMatchingModels, allAdapting);
-
+            //鍥涢�氬尮閰�
+            var fourLinkMatching = this.fourLinkMatchingCtrl1.SetBindingData(input.FourLinkMatchingModels, allAdapting);
+            //绠¢亾鍖归厤
+            var PipeLineMatching = this.pipeLineMatchingCtrl1.SetBindingData(input.PipeLineMatchingModels, allPipeLine);
+            //闃�闂ㄥ尮閰�
+            var ValveMatching = this.valveMatchingCtrl1.SetBindingData(input.ValveMatchingModels, allValve);
             assetsAutoMatching.PumpMatchingModels = pumpMatching;
             assetsAutoMatching.ThreeLinkMatchingModels = threeLinkMatching;
             return assetsAutoMatching;
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-autoMatching/01-ViewModel/eMatchingType.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-autoMatching/01-ViewModel/eMatchingType.cs
new file mode 100644
index 0000000..f45595c
--- /dev/null
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-autoMatching/01-ViewModel/eMatchingType.cs
@@ -0,0 +1,18 @@
+锘縩amespace HStation.WinFrmUI.Xhs
+{
+    //鍖归厤鐘舵��
+    public enum eMatchingType
+    {
+        /// <summary>
+        ///鍖归厤鎴愬姛
+        /// </summary>
+        [Display(Name = "鍖归厤鎴愬姛")]
+        Success = 0,
+
+        /// <summary>
+        ///鍖归厤澶辫触
+        /// </summary>
+        [Display(Name = "鍖归厤澶辫触")]
+        Error = 1,
+    }
+}
\ No newline at end of file
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
index e60a372..8360ec9 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
@@ -58,13 +58,13 @@
             docPnlProperty = new DevExpress.XtraBars.Docking.DockPanel();
             dockPanel1_Container = new DevExpress.XtraBars.Docking.ControlContainer();
             xhsProjectSimulationPropertyCtrl1 = new XhsProjectSimulationPropertyCtrl();
+            docPnlHydroCalcu = new DevExpress.XtraBars.Docking.DockPanel();
+            controlContainer2 = new DevExpress.XtraBars.Docking.ControlContainer();
+            xhsProjectSimulationHydroCalcuFailedCtrl1 = new XhsProjectSimulationHydroCalcuFailedCtrl();
             docPnlHydroCheck = new DevExpress.XtraBars.Docking.DockPanel();
             controlContainer1 = new DevExpress.XtraBars.Docking.ControlContainer();
             xhsProjectSimulationHydroCheckFailedCtrl1 = new XhsProjectSimulationHydroCheckFailedCtrl();
-            docPnlHydroCalcu = new DevExpress.XtraBars.Docking.DockPanel();
-            controlContainer2 = new DevExpress.XtraBars.Docking.ControlContainer();
             svgImg32 = new DevExpress.Utils.SvgImageCollection(components);
-            xhsProjectSimulationHydroCalcuFailedCtrl1 = new XhsProjectSimulationHydroCalcuFailedCtrl();
             ((ISupportInitialize)ribbonControl1).BeginInit();
             ((ISupportInitialize)tabPane1).BeginInit();
             tabPane1.SuspendLayout();
@@ -73,10 +73,10 @@
             ((ISupportInitialize)dockManager1).BeginInit();
             docPnlProperty.SuspendLayout();
             dockPanel1_Container.SuspendLayout();
-            docPnlHydroCheck.SuspendLayout();
-            controlContainer1.SuspendLayout();
             docPnlHydroCalcu.SuspendLayout();
             controlContainer2.SuspendLayout();
+            docPnlHydroCheck.SuspendLayout();
+            controlContainer1.SuspendLayout();
             ((ISupportInitialize)svgImg32).BeginInit();
             SuspendLayout();
             // 
@@ -92,7 +92,7 @@
             ribbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.False;
             ribbonControl1.ShowExpandCollapseButton = DevExpress.Utils.DefaultBoolean.False;
             ribbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages;
-            ribbonControl1.Size = new Size(1051, 128);
+            ribbonControl1.Size = new Size(1051, 101);
             ribbonControl1.ToolbarLocation = DevExpress.XtraBars.Ribbon.RibbonQuickAccessToolbarLocation.Hidden;
             // 
             // barBtnHydroCheck
@@ -235,12 +235,12 @@
             tabPane1.Controls.Add(pageBimface);
             tabPane1.Controls.Add(pageQ3d);
             tabPane1.Dock = DockStyle.Fill;
-            tabPane1.Location = new Point(0, 128);
+            tabPane1.Location = new Point(0, 101);
             tabPane1.Name = "tabPane1";
             tabPane1.Pages.AddRange(new DevExpress.XtraBars.Navigation.NavigationPageBase[] { pageBimface, pageQ3d });
-            tabPane1.RegularSize = new Size(776, 134);
+            tabPane1.RegularSize = new Size(776, 161);
             tabPane1.SelectedPage = pageBimface;
-            tabPane1.Size = new Size(776, 134);
+            tabPane1.Size = new Size(776, 161);
             tabPane1.TabIndex = 1;
             tabPane1.Text = "tabPane1";
             // 
@@ -249,14 +249,14 @@
             pageBimface.Caption = "涓夌淮妯″瀷";
             pageBimface.Controls.Add(xhsProjectSimulationBimfaceCtrl1);
             pageBimface.Name = "pageBimface";
-            pageBimface.Size = new Size(776, 101);
+            pageBimface.Size = new Size(776, 128);
             // 
             // xhsProjectSimulationBimfaceCtrl1
             // 
             xhsProjectSimulationBimfaceCtrl1.Dock = DockStyle.Fill;
             xhsProjectSimulationBimfaceCtrl1.Location = new Point(0, 0);
             xhsProjectSimulationBimfaceCtrl1.Name = "xhsProjectSimulationBimfaceCtrl1";
-            xhsProjectSimulationBimfaceCtrl1.Size = new Size(776, 101);
+            xhsProjectSimulationBimfaceCtrl1.Size = new Size(776, 128);
             xhsProjectSimulationBimfaceCtrl1.TabIndex = 0;
             xhsProjectSimulationBimfaceCtrl1.ClickParterEvent += xhsProjectSimulationBimfaceCtrl1_ClickParterEvent;
             // 
@@ -286,10 +286,10 @@
             docPnlProperty.Controls.Add(dockPanel1_Container);
             docPnlProperty.Dock = DevExpress.XtraBars.Docking.DockingStyle.Right;
             docPnlProperty.ID = new Guid("cffe2560-3445-4488-83cf-b9e4b936ff18");
-            docPnlProperty.Location = new Point(776, 128);
+            docPnlProperty.Location = new Point(776, 101);
             docPnlProperty.Name = "docPnlProperty";
             docPnlProperty.OriginalSize = new Size(275, 200);
-            docPnlProperty.Size = new Size(275, 622);
+            docPnlProperty.Size = new Size(275, 649);
             docPnlProperty.Text = "灞炴��";
             // 
             // dockPanel1_Container
@@ -297,7 +297,7 @@
             dockPanel1_Container.Controls.Add(xhsProjectSimulationPropertyCtrl1);
             dockPanel1_Container.Location = new Point(4, 26);
             dockPanel1_Container.Name = "dockPanel1_Container";
-            dockPanel1_Container.Size = new Size(268, 593);
+            dockPanel1_Container.Size = new Size(268, 620);
             dockPanel1_Container.TabIndex = 0;
             // 
             // xhsProjectSimulationPropertyCtrl1
@@ -305,8 +305,36 @@
             xhsProjectSimulationPropertyCtrl1.Dock = DockStyle.Fill;
             xhsProjectSimulationPropertyCtrl1.Location = new Point(0, 0);
             xhsProjectSimulationPropertyCtrl1.Name = "xhsProjectSimulationPropertyCtrl1";
-            xhsProjectSimulationPropertyCtrl1.Size = new Size(268, 593);
+            xhsProjectSimulationPropertyCtrl1.Size = new Size(268, 620);
             xhsProjectSimulationPropertyCtrl1.TabIndex = 0;
+            // 
+            // docPnlHydroCalcu
+            // 
+            docPnlHydroCalcu.Controls.Add(controlContainer2);
+            docPnlHydroCalcu.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
+            docPnlHydroCalcu.FloatVertical = true;
+            docPnlHydroCalcu.ID = new Guid("ac7055c0-e9fe-40c2-bf51-83dde5710cd4");
+            docPnlHydroCalcu.Location = new Point(0, 262);
+            docPnlHydroCalcu.Name = "docPnlHydroCalcu";
+            docPnlHydroCalcu.OriginalSize = new Size(200, 236);
+            docPnlHydroCalcu.Size = new Size(776, 236);
+            docPnlHydroCalcu.Text = "姘村姏璁$畻";
+            // 
+            // controlContainer2
+            // 
+            controlContainer2.Controls.Add(xhsProjectSimulationHydroCalcuFailedCtrl1);
+            controlContainer2.Location = new Point(3, 27);
+            controlContainer2.Name = "controlContainer2";
+            controlContainer2.Size = new Size(770, 206);
+            controlContainer2.TabIndex = 0;
+            // 
+            // xhsProjectSimulationHydroCalcuFailedCtrl1
+            // 
+            xhsProjectSimulationHydroCalcuFailedCtrl1.Dock = DockStyle.Fill;
+            xhsProjectSimulationHydroCalcuFailedCtrl1.Location = new Point(0, 0);
+            xhsProjectSimulationHydroCalcuFailedCtrl1.Name = "xhsProjectSimulationHydroCalcuFailedCtrl1";
+            xhsProjectSimulationHydroCalcuFailedCtrl1.Size = new Size(770, 206);
+            xhsProjectSimulationHydroCalcuFailedCtrl1.TabIndex = 0;
             // 
             // docPnlHydroCheck
             // 
@@ -338,38 +366,10 @@
             xhsProjectSimulationHydroCheckFailedCtrl1.TabIndex = 0;
             xhsProjectSimulationHydroCheckFailedCtrl1.HydroClickEvent += xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent;
             // 
-            // docPnlHydroCalcu
-            // 
-            docPnlHydroCalcu.Controls.Add(controlContainer2);
-            docPnlHydroCalcu.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
-            docPnlHydroCalcu.FloatVertical = true;
-            docPnlHydroCalcu.ID = new Guid("ac7055c0-e9fe-40c2-bf51-83dde5710cd4");
-            docPnlHydroCalcu.Location = new Point(0, 514);
-            docPnlHydroCalcu.Name = "docPnlHydroCalcu";
-            docPnlHydroCalcu.OriginalSize = new Size(200, 236);
-            docPnlHydroCalcu.Size = new Size(776, 236);
-            docPnlHydroCalcu.Text = "姘村姏璁$畻";
-            // 
-            // controlContainer2
-            // 
-            controlContainer2.Controls.Add(xhsProjectSimulationHydroCalcuFailedCtrl1);
-            controlContainer2.Location = new Point(3, 27);
-            controlContainer2.Name = "controlContainer2";
-            controlContainer2.Size = new Size(770, 206);
-            controlContainer2.TabIndex = 0;
-            // 
             // svgImg32
             // 
             svgImg32.ImageSize = new Size(32, 32);
             svgImg32.Add("calculatesheet", "image://svgimages/spreadsheet/calculatesheet.svg");
-            // 
-            // xhsProjectSimulationHydroCalcuFailedCtrl1
-            // 
-            xhsProjectSimulationHydroCalcuFailedCtrl1.Dock = DockStyle.Fill;
-            xhsProjectSimulationHydroCalcuFailedCtrl1.Location = new Point(0, 0);
-            xhsProjectSimulationHydroCalcuFailedCtrl1.Name = "xhsProjectSimulationHydroCalcuFailedCtrl1";
-            xhsProjectSimulationHydroCalcuFailedCtrl1.Size = new Size(770, 206);
-            xhsProjectSimulationHydroCalcuFailedCtrl1.TabIndex = 0;
             // 
             // XhsProjectSimulationCorePage
             // 
@@ -378,9 +378,9 @@
             AutoScaleDimensions = new SizeF(7F, 14F);
             AutoScaleMode = AutoScaleMode.Font;
             Controls.Add(tabPane1);
-            Controls.Add(docPnlHydroCheck);
             Controls.Add(docPnlHydroCalcu);
             Controls.Add(docPnlProperty);
+            Controls.Add(docPnlHydroCheck);
             Controls.Add(ribbonControl1);
             Margin = new Padding(2);
             Name = "XhsProjectSimulationCorePage";
@@ -393,10 +393,10 @@
             ((ISupportInitialize)dockManager1).EndInit();
             docPnlProperty.ResumeLayout(false);
             dockPanel1_Container.ResumeLayout(false);
-            docPnlHydroCheck.ResumeLayout(false);
-            controlContainer1.ResumeLayout(false);
             docPnlHydroCalcu.ResumeLayout(false);
             controlContainer2.ResumeLayout(false);
+            docPnlHydroCheck.ResumeLayout(false);
+            controlContainer1.ResumeLayout(false);
             ((ISupportInitialize)svgImg32).EndInit();
             ResumeLayout(false);
             PerformLayout();
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 2513f0c..0f1546e 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -255,7 +255,7 @@
                 return;
             }
             _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id);
-            this.xhsProjectSimulationBimfaceCtrl1.
+            //     this.xhsProjectSimulationBimfaceCtrl1.
             TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�");
         }
 
@@ -304,6 +304,16 @@
                             ID=item.ID,
                             Code=item.Code,
                             MinorLoss=item.MinorLoss
+                        },
+                           new ThreeLinkMatchingViewModel
+                        {
+                            Caliber="11",
+                            Material="22",
+                            ModelType=item.ModelType,
+                            DbLocked=item.DbLocked,
+                            ID=item.ID,
+                            Code=item.Code,
+                            MinorLoss=item.MinorLoss
                         }
                     }
                 };
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj
index e7d2615..66754a0 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj
@@ -138,19 +138,19 @@
     <Compile Update="04-simulation\03-q3d\XhsProjectSimulationQ3dCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\PipeLineMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\PipeLineMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\ValveMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\ValveMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\PumpMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\PumpMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\ThreeLinkMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\ThreeLinkMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\FourLinkMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\FourLinkMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
     <Compile Update="04-simulation\06-simulation\XhsProjectSimulationCorePage.cs">
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user
index d97b5b6..4334649 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user
@@ -61,16 +61,16 @@
     <Compile Update="03-scheme\02-asset-mgr\PumpMain_Wizrad\AddPumpMainDlg.cs">
       <SubType>Form</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\02-AsstesFormCtrl\ElbowsMatchingCtrl.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\02-AsstesFormCtrl\ElbowsMatchingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\AssetsAutoMatchingMainDlg.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\AssetsAutoMatchingMainDlg.cs">
       <SubType>Form</SubType>
     </Compile>
     <Compile Update="03-scheme\02-asset-mgr\PumpMain_Wizrad\PumpMainForm.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Update="04-simulation\06-simulation\01-AutoMatching\AssetsMainChoicePage.cs">
+    <Compile Update="04-simulation\06-simulation\01-autoMatching\AssetsMainChoicePage.cs">
       <SubType>UserControl</SubType>
     </Compile>
     <Compile Update="03-scheme\02-asset-mgr\XhsProjectAssetsBimfaceCtrl.cs">

--
Gitblit v1.9.3