From a8ccc992964272f6a74631e8c164e8c91e5cb6d4 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期六, 12 十月 2024 16:47:29 +0800 Subject: [PATCH] 处理冲突 --- WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.Designer.cs | 17 + Service/HStation.Service.Assets.Core/04-dal/03-sqlite/01-PumpMainManage/PumpPart.cs | 4 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs | 32 +- Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/05-PumpPartMain/PumpPartMain.cs | 33 +- WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs | 7 Service/HStation.Service.Assets.Core/04-dal/02-postgresql/01-PumpMainManage/PumpPart.cs | 4 WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user | 4 WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs | 490 ++++++++++++++++------------------ /dev/null | 57 ---- WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/00-ViewModel/CurrentPumpPartMainViewModel.cs | 7 BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpPart.cs | 21 Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/06-PumpPropContent/PumpPropContent.cs | 52 ++- Vmo/HStation.Vmo.Assets.Core/01-PumpMainManage/PumpPartMainVmo.cs | 13 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/02-pump/XhsPumpMatchingListCtrl.cs | 2 WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.cs | 40 ++ WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.resx | 23 + 16 files changed, 408 insertions(+), 398 deletions(-) diff --git a/BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpPart.cs b/BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpPart.cs index cb961f5..70a9e95 100644 --- a/BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpPart.cs +++ b/BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpPart.cs @@ -243,17 +243,16 @@ public async Task<bool> DeleteEx(long ID) { - /* return await Task.Factory.StartNew(() => - { - var bol = _service.DeleteExByID(ID); - if (!bol) - { - throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, "鍒犻櫎澶辫触"); - } - return true; - });*/ - return false; - } + return await Task.Factory.StartNew(() => + { + var bol = _service.DeleteExByID(ID); + if (!bol) + { + throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, "鍒犻櫎澶辫触"); + } + return true; + }); + } /// <summary> /// 閫氳繃 Ids 鍒犻櫎 diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/AddElbowSeriesInput.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/AddElbowSeriesInput.cs deleted file mode 100644 index e639d80..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/AddElbowSeriesInput.cs +++ /dev/null @@ -1,43 +0,0 @@ -锘縰sing HStation.Assets; -using Yw.Model; - -namespace HStation.Dto.Assets -{ - public class AddAssetsElbowSeriesInput - { - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - - /// <summary> - /// 鍙傛暟 - /// </summary> - public Dictionary<string, string> Paras { get; set; } - - /// <summary> - /// 鏍囩 - /// </summary> - public List<string> Flags { get; set; } - - /// <summary> - /// 鏍囧織 - /// </summary> - public string TagName { get; set; } - - /// <summary> - /// 浣跨敤鐘舵�� - /// </summary> - public eUseStatus UseStatus { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - } -} \ No newline at end of file diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/ElbowSeriesDto.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/ElbowSeriesDto.cs deleted file mode 100644 index effafdb..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/ElbowSeriesDto.cs +++ /dev/null @@ -1,64 +0,0 @@ -锘縰sing HStation.Assets; -using Yw.Model; - -namespace HStation.Dto.Assets -{ - public class AssetsElbowSeriesDto - { - public AssetsElbowSeriesDto() - { - } - - public AssetsElbowSeriesDto(Model.AssetsElbowSeries rhs) - { - this.ID = rhs.ID; - this.Name = rhs.Name; - this.Paras = rhs.Paras; - this.Flags = rhs.Flags; - this.TagName = rhs.TagName; - this.UseStatus = rhs.UseStatus; - this.SortCode = rhs.SortCode; - this.Description = rhs.Description; - } - - /// <summary> - /// id - /// </summary> - public long ID { get; set; } - - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - - /// <summary> - /// 鍙傛暟 - /// </summary> - public Dictionary<string, string> Paras { get; set; } - - /// <summary> - /// 鏍囩 - /// </summary> - public List<string> Flags { get; set; } - - /// <summary> - /// 鏍囧織 - /// </summary> - public string TagName { get; set; } - - /// <summary> - /// 浣跨敤鐘舵�� - /// </summary> - public eUseStatus UseStatus { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - } -} \ No newline at end of file diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/UpdateElbowSeriesInput.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/UpdateElbowSeriesInput.cs deleted file mode 100644 index 60cb907..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/01-ElbowSeries/UpdateElbowSeriesInput.cs +++ /dev/null @@ -1,50 +0,0 @@ -锘縰sing HStation.Assets; -using System.ComponentModel.DataAnnotations; -using Yw.Model; - -namespace HStation.Dto.Assets -{ - public class UpdateAssetsElbowSeriesInput - { - /// <summary> - /// id - /// </summary> - [Required, Range(1, long.MaxValue, ErrorMessage = "ID 蹇呴』澶т簬0")] - public long ID { get; set; } - - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - - /// <summary> - /// 鍙傛暟 - /// </summary> - public Dictionary<string, string> Paras { get; set; } - - /// <summary> - /// 鏍囩 - /// </summary> - public List<string> Flags { get; set; } - - /// <summary> - /// 鏍囧織 - /// </summary> - public string TagName { get; set; } - - /// <summary> - /// 浣跨敤鐘舵�� - /// </summary> - public eUseStatus UseStatus { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - } -} \ No newline at end of file diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/AddElbowMianInput.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/AddElbowMianInput.cs deleted file mode 100644 index db50afa..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/AddElbowMianInput.cs +++ /dev/null @@ -1,72 +0,0 @@ -锘縰sing HStation.Assets; -using Yw.Model; - -namespace HStation.Dto.Assets -{ - public class AddElbowMianInput - { - public AddElbowMianInput() - { } - - public AddElbowMianInput(Model.AssetsElbowMain rhs) - { - this.ID = rhs.ID; - this.Coefficient = rhs.Coefficient; - this.MaterialName = rhs.MaterialName; - this.Caliber = rhs.Caliber; - this.Name = rhs.Name; - this.SortCode = rhs.SortCode; - this.Description = rhs.Description; - this.KeyWord = rhs.KeyWord; - this.IsDefault = rhs.IsDefault; - this.SeriesID = rhs.SeriesID; - } - - public long ID { get; set; } - - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - - /// <summary> - /// 绯诲垪ID - /// </summary> - public long SeriesID { get; set; } - - /// <summary> - /// 鍙e緞 - /// </summary> - public double? Caliber { get; set; } - - /// <summary> - /// 鏉愭枡 - /// </summary> - public string MaterialName { get; set; } - - /// <summary> - /// 绯绘暟 - /// </summary> - public double? Coefficient { get; set; } - - /// <summary> - /// 璇嗗埆鍏抽敭瀛� - /// </summary> - public string KeyWord { get; set; } - - /// <summary> - /// 鏄惁榛樿 - /// </summary> - public bool IsDefault { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - } -} \ No newline at end of file diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/ElbowMainDto.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/ElbowMainDto.cs deleted file mode 100644 index 4b4a134..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/ElbowMainDto.cs +++ /dev/null @@ -1,68 +0,0 @@ -锘縩amespace HStation.Dto.Assets -{ - public class AssetsElbowMainDto - { - public AssetsElbowMainDto() - { } - - public AssetsElbowMainDto(Model.AssetsElbowMain rhs) - { - this.ID = rhs.ID; - this.MaterialName = rhs.MaterialName; - this.Caliber = rhs.Caliber; - this.Coefficient = rhs.Coefficient; - this.Description = rhs.Description; - this.SortCode = rhs.SortCode; - this.KeyWord = rhs.KeyWord; - this.IsDefault = rhs.IsDefault; - this.Name = rhs.Name; - this.SeriesID = rhs.SeriesID; - } - - public long ID { get; set; } - - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - /// <summary> - /// 绯诲垪ID - /// </summary> - public long SeriesID { get; set; } - - /// <summary> - /// 鍙e緞 - /// </summary> - public double? Caliber { get; set; } - - /// <summary> - /// 鏉愭枡 - /// </summary> - public string MaterialName { get; set; } - - /// <summary> - /// 绯绘暟 - /// </summary> - public double? Coefficient { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - - /// <summary> - /// 璇嗗埆鍏抽敭瀛� - /// </summary> - public string KeyWord { get; set; } - - /// <summary> - /// 鏄惁榛樿 - /// </summary> - public bool IsDefault { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - } -} \ No newline at end of file diff --git a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/UpdateElbowMainInput.cs b/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/UpdateElbowMainInput.cs deleted file mode 100644 index b44d1cb..0000000 --- a/Dto/HStation.Dto.Assets.Core/05-ElbowManage/02-ElbowMain/UpdateElbowMainInput.cs +++ /dev/null @@ -1,57 +0,0 @@ -锘縰sing System.ComponentModel.DataAnnotations; - -namespace HStation.Dto.Assets -{ - public class UpdateAssetsElbowMainInput - { - /// <summary> - /// id - /// </summary> - [Required, Range(1, long.MaxValue, ErrorMessage = "ID 蹇呴』澶т簬0")] - public long ID { get; set; } - - /// <summary> - /// 鍚嶇О - /// </summary> - public string Name { get; set; } - /// <summary> - /// 绯诲垪ID - /// </summary> - public long SeriesID { get; set; } - - /// <summary> - /// 鍙e緞 - /// </summary> - public double? Caliber { get; set; } - - /// <summary> - /// 鏉愭枡 - /// </summary> - public string MaterialName { get; set; } - - /// <summary> - /// 绯绘暟 - /// </summary> - public double? Coefficient { get; set; } - - /// <summary> - /// 璇嗗埆鍏抽敭瀛� - /// </summary> - public string KeyWord { get; set; } - - /// <summary> - /// 鏄惁榛樿 - /// </summary> - public bool IsDefault { get; set; } - - /// <summary> - /// 鎺掑簭鐮� - /// </summary> - public int SortCode { get; set; } - - /// <summary> - /// 璇存槑 - /// </summary> - public string Description { get; set; } - } -} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/01-PumpMainManage/PumpPart.cs b/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/01-PumpMainManage/PumpPart.cs index cade92f..cb2cea2 100644 --- a/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/01-PumpMainManage/PumpPart.cs +++ b/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/01-PumpMainManage/PumpPart.cs @@ -48,6 +48,10 @@ { if (AssetsPumpPropContents != null) { + foreach (var item in AssetsPumpPropContents) + { + item.PartID = result; + } var content = db.Insertable(AssetsPumpPropContents).ExecuteReturnSnowflakeId(); if (content < 0) { diff --git a/Service/HStation.Service.Assets.Core/04-dal/03-sqlite/01-PumpMainManage/PumpPart.cs b/Service/HStation.Service.Assets.Core/04-dal/03-sqlite/01-PumpMainManage/PumpPart.cs index dc519b2..5234a54 100644 --- a/Service/HStation.Service.Assets.Core/04-dal/03-sqlite/01-PumpMainManage/PumpPart.cs +++ b/Service/HStation.Service.Assets.Core/04-dal/03-sqlite/01-PumpMainManage/PumpPart.cs @@ -48,6 +48,10 @@ { if (AssetsPumpPropContents != null) { + foreach (var item in AssetsPumpPropContents) + { + item.PartID = result; + } var content = db.Insertable(AssetsPumpPropContents).ExecuteReturnSnowflakeId(); if (content < 0) { diff --git a/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/05-PumpPartMain/PumpPartMain.cs b/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/05-PumpPartMain/PumpPartMain.cs index eb9e468..ff5ef75 100644 --- a/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/05-PumpPartMain/PumpPartMain.cs +++ b/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/05-PumpPartMain/PumpPartMain.cs @@ -195,7 +195,7 @@ if (id > 0) { UpdateCache(id); - // AssetsPumpPropContent.UpdateCacheByPartID(id); + AssetsPumpPropContent.UpdateCacheByPartID(id); AssetsPumpMainAndPartMap.UpdateCacheByPartID(id); } return id; @@ -327,22 +327,21 @@ return bol; } - /* //閫氳繃 ID 鍒犻櫎浜у搧琛ㄥ強灞炴�ц〃 - public bool DeleteExByID(long ID) - { - var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpPartMain>(); - var partmain = dal.GetByID(ID); - var propmodellist = AssetsPumpPropContent.GetProplistByPartID(ID); - var propentitylist = AssetsPumpPropContent.Model2Entities(propmodellist); - var bol = dal.DeleteEx(partmain, propentitylist); - if (bol) - { - RemoveCache(ID); - AssetsPumpPropContent.RemoveCacheByIDs(propmodellist.Select(x => x.ID).ToList()); - } - return bol; - } - */ + //閫氳繃 ID 鍒犻櫎浜у搧琛ㄥ強灞炴�ц〃 + public bool DeleteExByID(long ID) + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpPartMain>(); + var partmain = dal.GetByID(ID); + var propmodellist = AssetsPumpPropContent.GetProplistByPartID(ID); + var propentitylist = AssetsPumpPropContent.Model2Entities(propmodellist); + var bol = dal.DeleteEx(partmain, propentitylist); + if (bol) + { + RemoveCache(ID); + AssetsPumpPropContent.RemoveCacheByIDs(propmodellist.Select(x => x.ID).ToList()); + } + return bol; + } #endregion Delete } diff --git a/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/06-PumpPropContent/PumpPropContent.cs b/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/06-PumpPropContent/PumpPropContent.cs index 09e4e97..4ae3351 100644 --- a/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/06-PumpPropContent/PumpPropContent.cs +++ b/Service/HStation.Service.Assets.Core/05-service/01-PumpMainManage/06-PumpPropContent/PumpPropContent.cs @@ -43,29 +43,28 @@ AssetsPumpSeriesCacheHelper.Trigger(); } - /* - //閫氳繃 浜у搧ID 鏇存柊缂撳瓨 - public static void UpdateCacheByPartID(long ID) + //閫氳繃 浜у搧ID 鏇存柊缂撳瓨 + public static void UpdateCacheByPartID(long ID) + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpPropContent>(); + var alllist = dal.GetAll(); + var selectlist = alllist.Where(x => x.PartID == ID).ToList(); + var model_ds = Entity2Models(selectlist); + var all = GetCache(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + all.AddRange(model_ds); + } + else + { + foreach (var item in model_ds) { - var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpPropContent>(); - var alllist = dal.GetAll(); - var selectlist = alllist.Where(x => x.PartID == ID).ToList(); - var model_ds = Entity2Models(selectlist); - var all = GetCache(); - var model = all.Find(x => x.ID == ID); - if (model == null) - { - all.AddRange(model_ds); - } - else - { - foreach (var item in model_ds) - { - model.Reset(item); - } - } - AssetsPumpSeriesCacheHelper.Trigger(); - }*/ + model.Reset(item); + } + } + AssetsPumpSeriesCacheHelper.Trigger(); + } //閫氳繃 Ids 鏇存柊缂撳瓨 public static void UpdateCache(List<long> Ids) @@ -142,6 +141,15 @@ } /// <summary> + /// 閫氳繃 浜у搧ID 鑾峰彇 + /// </summary> + public static List<Model.AssetsPumpPropContent> GetProplistByPartID(long ID) + { + var all = GetCache(); + return all.Where(x => x.PartID == ID).ToList(); + } + + /// <summary> /// 閫氳繃 ID 鑾峰彇 /// </summary> public List<Model.AssetsPumpPropContent> GetByIds(List<long> Ids) diff --git a/Vmo/HStation.Vmo.Assets.Core/01-PumpMainManage/PumpPartMainVmo.cs b/Vmo/HStation.Vmo.Assets.Core/01-PumpMainManage/PumpPartMainVmo.cs index 0d47db6..1da9582 100644 --- a/Vmo/HStation.Vmo.Assets.Core/01-PumpMainManage/PumpPartMainVmo.cs +++ b/Vmo/HStation.Vmo.Assets.Core/01-PumpMainManage/PumpPartMainVmo.cs @@ -1,10 +1,4 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HStation.Vmo +锘縩amespace HStation.Vmo { public class AssetsPumpPartMainVmo { @@ -14,6 +8,11 @@ public long ID { get; set; } /// <summary> + /// 娉佃澶嘔D + /// </summary> + public long PartID { get; set; } + + /// <summary> /// 娉电郴鍒桰D /// </summary> public long SeriesID { get; set; } diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/00-ViewModel/CurrentPumpPartMainViewModel.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/00-ViewModel/CurrentPumpPartMainViewModel.cs index 1ca9e59..6577a8e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/00-ViewModel/CurrentPumpPartMainViewModel.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/00-ViewModel/CurrentPumpPartMainViewModel.cs @@ -9,6 +9,7 @@ public CurrentPartMainViewModel(Vmo.AssetsPumpPartMainVmo rhs) : base() { this.ID = rhs.ID; + this.PartID=rhs.PartID; this.Name = rhs.Name; this.NO = rhs.NO; this.Code = rhs.Code; @@ -21,6 +22,7 @@ this.Name = rhs.Name; this.NO = rhs.NO; this.Code = rhs.Code; + this.PartID = rhs.PartID; this.SeriesID = rhs.SeriesID; } @@ -29,6 +31,11 @@ /// </summary> public long ID { get; set; } + + /// <summary> + /// 娉佃澶嘔D + /// </summary> + public long PartID { get; set; } /// <summary> /// 娉电郴鍒桰D /// </summary> diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs index 865b3eb..5484a2e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs @@ -1,4 +1,5 @@ 锘縰sing HStation.WinFrmUI.Xhs.PumpProduct; +using NetTaste; namespace HStation.WinFrmUI { @@ -9,6 +10,7 @@ InitializeComponent(); this.gridView1.Columns["PropGroupName"].Group(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; + this.pumpProductListBox1.MouseUp += PumpProductListBox1_MouseUp; } private BLL.AssetsPumpPartMain _bll = null; @@ -117,10 +119,9 @@ updatepart.Code = TextEditProductCode.Text; updatepart.SeriesID = _seriesID; var updateproplist = new List<UpdateAssetsPumpPropContentInput>(); - // var update = _allPropList.Select(x => x.Adapt<AssetsPumpPropContentDto, UpdateAssetsPumpPropContentInput>()).ToList(); foreach (var item in _proplist) { - if (_allPropList != null) + if (_allPropList != null || _allBindingList.Count > 0) { _allPropList.Find(x => x.PropID == item.ID).PropValue = item.Value; } @@ -138,7 +139,7 @@ } //宸︿晶鏍戝彸鍑昏彍鍗曚簨浠� - private void ListBoxPart_MouseUp(object sender, MouseEventArgs e) + private void PumpProductListBox1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.Designer.cs index 5e1a614..274fe5d 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.Designer.cs @@ -38,6 +38,7 @@ barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); barDockControlRight = new DevExpress.XtraBars.BarDockControl(); + barBtnDelete = new DevExpress.XtraBars.BarButtonItem(); ((System.ComponentModel.ISupportInitialize)listBoxControl1).BeginInit(); ((System.ComponentModel.ISupportInitialize)barManager1).BeginInit(); SuspendLayout(); @@ -50,6 +51,7 @@ listBoxControl1.Size = new Size(247, 459); listBoxControl1.TabIndex = 0; listBoxControl1.SelectedIndexChanged += listBoxControl1_SelectedIndexChanged; + listBoxControl1.MouseUp += listBoxControl1_MouseUp; // // barManager1 // @@ -59,8 +61,8 @@ barManager1.DockControls.Add(barDockControlLeft); barManager1.DockControls.Add(barDockControlRight); barManager1.Form = this; - barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { BtnAddProductProp }); - barManager1.MaxItemId = 1; + barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { BtnAddProductProp, barBtnDelete }); + barManager1.MaxItemId = 2; // // bar1 // @@ -68,7 +70,7 @@ bar1.DockCol = 0; bar1.DockRow = 0; bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; - bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(BtnAddProductProp) }); + bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(BtnAddProductProp), new DevExpress.XtraBars.LinkPersistInfo(barBtnDelete) }); bar1.OptionsBar.AllowQuickCustomization = false; bar1.OptionsBar.DrawBorder = false; bar1.OptionsBar.DrawDragBorder = false; @@ -118,6 +120,14 @@ barDockControlRight.Manager = barManager1; barDockControlRight.Size = new Size(0, 459); // + // barBtnDelete + // + barBtnDelete.Caption = "鍒犻櫎灞炴��"; + barBtnDelete.Id = 1; + barBtnDelete.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barBtnDelete.ImageOptions.SvgImage"); + barBtnDelete.Name = "barBtnDelete"; + barBtnDelete.ItemClick += barBtnDelete_ItemClick; + // // PumpProductListBox // AutoScaleDimensions = new SizeF(7F, 14F); @@ -145,5 +155,6 @@ private DevExpress.XtraBars.BarDockControl barDockControlBottom; private DevExpress.XtraBars.BarDockControl barDockControlLeft; private DevExpress.XtraBars.BarDockControl barDockControlRight; + private DevExpress.XtraBars.BarButtonItem barBtnDelete; } } diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.cs index 158e7a4..c613282 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.cs @@ -1,4 +1,6 @@ -锘縩amespace HStation.WinFrmUI.Assets +锘縰sing DevExpress.XtraEditors; + +namespace HStation.WinFrmUI.Assets { public partial class PumpProductListBox : DevExpress.XtraEditors.XtraUserControl { @@ -11,11 +13,15 @@ public List<CurrentPartMainViewModel> _allBindingList = null; + public BLL.AssetsPumpPartMain _Bll; + + public event Action<object, MouseEventArgs> MouseUp; + public async void SetBindingData(Vmo.AssetsPumpMainVmo AssetsPumpMain) { _allBindingList = new List<CurrentPartMainViewModel>(); - var _bll = new BLL.AssetsPumpPartMain(); - var allpartlist = await _bll.GetByPumpMainID(AssetsPumpMain.ID); //鑾峰彇鎵�鏈変骇鍝� + _Bll = new BLL.AssetsPumpPartMain(); + var allpartlist = await _Bll.GetByPumpMainID(AssetsPumpMain.ID); //鑾峰彇鎵�鏈変骇鍝� var series = await new BLL.AssetsPumpSeries().GetByID(AssetsPumpMain.PumpSeriesID); //鑾峰彇绯诲垪 if (allpartlist != null) { @@ -47,5 +53,33 @@ { SelectReloadEvent.Invoke(); } + + private void listBoxControl1_MouseUp(object sender, MouseEventArgs e) + { + MouseUp.Invoke(sender, e); + } + + //鍒犻櫎灞炴�� + private async void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + var vm = this.listBoxControl1.GetCurrentViewModel(_allBindingList); + if (vm == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏁版嵁琛�!"); + return; + } + if (MessageBoxHelper.IsClickOk($"纭鍒犻櫎鏁版嵁琛�?", "鎻愮ず")) + return; + if (await _Bll.DeleteEx(vm.ID)) + { + _allBindingList.Remove(vm); + this.listBoxControl1.Refresh(); + TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛!"); + } + else + { + TipFormHelper.ShowError("鍒犻櫎澶辫触!"); + } + } } } \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.resx b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.resx index 4799cb7..d51a3b7 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.resx +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/PumpProductListBox.resx @@ -139,4 +139,27 @@ Cjwvc3ZnPgs= </value> </data> + <data name="barBtnDelete.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v23.2" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIzLjIsIFZlcnNpb249MjMuMi40 + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAJIDAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg + MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLlllbGxvd3tmaWxsOiNGRkIxMTU7fQoJ + LlJlZHtmaWxsOiNEMTFDMUM7fQoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5HcmVlbntmaWxsOiMwMzlD + MjM7fQoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh + Y2l0eTowLjU7fQoJLnN0MXtkaXNwbGF5Om5vbmU7fQoJLnN0MntkaXNwbGF5OmlubGluZTtmaWxsOiMw + MzlDMjM7fQoJLnN0M3tkaXNwbGF5OmlubGluZTtmaWxsOiNEMTFDMUM7fQoJLnN0NHtkaXNwbGF5Omlu + bGluZTtmaWxsOiM3MjcyNzI7fQo8L3N0eWxlPg0KICA8ZyBpZD0iRGVsZXRlIj4NCiAgICA8cGF0aCBk + PSJNMTguOCwxNmw4LjktOC45YzAuNC0wLjQsMC40LTEsMC0xLjRsLTEuNC0xLjRjLTAuNC0wLjQtMS0w + LjQtMS40LDBMMTYsMTMuMkw3LjEsNC4zYy0wLjQtMC40LTEtMC40LTEuNCwwICAgTDQuMyw1LjdjLTAu + NCwwLjQtMC40LDEsMCwxLjRsOC45LDguOWwtOC45LDguOWMtMC40LDAuNC0wLjQsMSwwLDEuNGwxLjQs + MS40YzAuNCwwLjQsMSwwLjQsMS40LDBsOC45LTguOWw4LjksOC45ICAgYzAuNCwwLjQsMSwwLjQsMS40 + LDBsMS40LTEuNGMwLjQtMC40LDAuNC0xLDAtMS40TDE4LjgsMTZ6IiBjbGFzcz0iUmVkIiAvPg0KICA8 + L2c+DQo8L3N2Zz4L +</value> + </data> </root> \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user b/WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user index 253ac94..6c2f54e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user @@ -101,10 +101,10 @@ <Compile Update="07-fourLink\02-main\FourLinkManageMainPage.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Update="08-Nozzle\02-main\AddNozzleMainDlg.cs"> + <Compile Update="08-nozzle\02-main\AddNozzleMainDlg.cs"> <SubType>Form</SubType> </Compile> - <Compile Update="08-Nozzle\02-main\EditNozzleMainDlg.cs"> + <Compile Update="08-nozzle\02-main\EditNozzleMainDlg.cs"> <SubType>Form</SubType> </Compile> <Compile Update="09-manufacturer\AddManufacturerDlg.cs"> diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs index 6744c32..8d000ed 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs @@ -1,5 +1,6 @@ 锘縰sing HStation.Vmo; using HStation.WinFrmUI.PhartRelation; +using System.Windows.Input; namespace HStation.WinFrmUI { @@ -13,8 +14,9 @@ private const double _powerTolerance = 0.05; //璧勪骇鑷姩鍖归厤 - public static async Task<bool> Matching(AssetsMatchingViewModel assetsAutoMatchingView) + public static bool Matching(AssetsMatchingViewModel assetsAutoMatchingView, out string Error) { + Error = string.Empty; bool IsMaching = false; var AssetsPumpMain = new BLL.AssetsPumpMain(); var adaptingManage = new BLL.AdaptingManage(); @@ -23,67 +25,74 @@ var AssetsElbowMain = new BLL.AssetsElbowMain(); var AssetsThreelinkMain = new BLL.AssetsThreelinkMain(); var AssetsFourlinkMain = new BLL.AssetsFourlinkMain(); - - var allPump = await AssetsPumpMain.GetAll(); - var allAdapting = await adaptingManage.GetAll(); - var allPipeLine = await pipeLineManage.GetAll(); - var allValve = await AssetsValveMain.GetAll(); - var allElbow = await AssetsElbowMain.GetAll(); - var allThreeLink = await AssetsThreelinkMain.GetAll(); - var allFourLink = await AssetsFourlinkMain.GetAll(); - //娉靛尮閰� - foreach (var item in assetsAutoMatchingView.PumpMatchingList) + try { - if (await MatchingPumps(item, allPump)) + var allPump = Task.Run(async () => await AssetsPumpMain.GetAll()).Result; + var allAdapting = Task.Run(async () => await adaptingManage.GetAll()).Result; + var allPipeLine = Task.Run(async () => await pipeLineManage.GetAll()).Result; + var allValve = Task.Run(async () => await AssetsValveMain.GetAll()).Result; + var allElbow = Task.Run(async () => await AssetsElbowMain.GetAll()).Result; + var allThreeLink = Task.Run(async () => await AssetsThreelinkMain.GetAll()).Result; + var allFourLink = Task.Run(async () => await AssetsFourlinkMain.GetAll()).Result; + //娉靛尮閰� + foreach (var item in assetsAutoMatchingView.PumpMatchingList) { - IsMaching = true; + if (MatchingPumps(item, allPump)) + { + IsMaching = true; + } + } + //涓夐�氬尮閰� + foreach (var item in assetsAutoMatchingView.ThreelinkMatchingList) + { + if (MatchingThreelink(item, allThreeLink)) + { + IsMaching = true; + } + } + //鍥涢�氬尮閰� + foreach (var item in assetsAutoMatchingView.FourlinkMatchingList) + { + if (MatchingFourlink(item, allFourLink)) + { + IsMaching = true; + } + } + //绠¢亾鍖归厤 + foreach (var item in assetsAutoMatchingView.PipeMatchingList) + { + if (MatchingPipe(item, allPipeLine)) + { + IsMaching = true; + } + } + //闃�闂ㄥ尮閰� + foreach (var item in assetsAutoMatchingView.ValveMatchingList) + { + if (MatchingValve(item, allValve)) + { + IsMaching = true; + } + } + //寮ご鍖归厤 + foreach (var item in assetsAutoMatchingView.ElbowMatchingList) + { + if (MatchingElbow(item, allElbow)) + { + IsMaching = true; + } } } - //涓夐�氬尮閰� - foreach (var item in assetsAutoMatchingView.ThreelinkMatchingList) + catch (Exception ex) { - if (MatchingThreelink(item, allThreeLink)) - { - IsMaching = true; - } - } - //鍥涢�氬尮閰� - foreach (var item in assetsAutoMatchingView.FourlinkMatchingList) - { - if (MatchingFourlink(item, allFourLink)) - { - IsMaching = true; - } - } - //绠¢亾鍖归厤 - foreach (var item in assetsAutoMatchingView.PipeMatchingList) - { - if (MatchingPipe(item, allPipeLine)) - { - IsMaching = true; - } - } - //闃�闂ㄥ尮閰� - foreach (var item in assetsAutoMatchingView.ValveMatchingList) - { - if (MatchingValve(item, allValve)) - { - IsMaching = true; - } - } - //寮ご鍖归厤 - foreach (var item in assetsAutoMatchingView.ElbowMatchingList) - { - if (MatchingElbow(item, allElbow)) - { - IsMaching = true; - } + Error = ex.Message; + return false; } return IsMaching; } //娉靛尮閰� - public static async Task<bool> MatchingPumps(PumpMatchingViewModel InputModel, List<Vmo.AssetsPumpMainVmo> AssetsPumpMainVmos) + public static bool MatchingPumps(PumpMatchingViewModel InputModel, List<Vmo.AssetsPumpMainVmo> AssetsPumpMainVmos) { if (AssetsPumpMainVmos == null) { @@ -151,7 +160,7 @@ InputModel.MatchingRatedP = vmo.RatedPower; InputModel.MatchingDbId = vmo.ID.ToString(); InputModel.MatchingModelType = vmo.Name; - var list = await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(vmo.ID); + var list = Task.Run(async () => await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(vmo.ID)).Result; if (list != null && list.Count > 0) { InputModel.MatchingCurveDbId = list.First().ID.ToString(); @@ -205,37 +214,35 @@ var absoluteMatch = adaptingManageVmos.Where(i => ((i.Caliber == null) || i.Caliber == input.Diameter) && ((input.Material == null) || i.MaterialName == input.Material)).ToList(); - if (absoluteMatch.Any()) + if (absoluteMatch.Count > 1) { - foreach (var range in absoluteMatch) + var allMatchingList = absoluteMatch + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, range.KeyWord); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = range; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� + } + else if (absoluteMatch.Count == 1) + { + vmo = absoluteMatch.First(); } else { //鍖洪棿鍖归厤 - var rangeMatch = adaptingManageVmos.Where(item => - { - if (item.Caliber.HasValue) - { - return Math.Abs(Convert.ToInt64(item.Caliber - input.Diameter)) <= _caliberTolerance; - } - else - { - if (item.Caliber == null) - { - return true; - } - } - return false; - }) - .ToList(); + var rangeMatch = adaptingManageVmos + .Where(item => + item.Caliber == null || + Math.Abs(Convert.ToInt64(item.Caliber) - Convert.ToInt64(input.Diameter)) <= _caliberTolerance) + .ToList(); if (rangeMatch != null && rangeMatch.Count > 0) { var materialList = new List<Vmo.AssetsValveMainVmo>(); @@ -258,31 +265,26 @@ } //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢�� firstCount = 0; - foreach (var material in materialList) + if (materialList.Count < 1) + return false; + var allMatchingList = materialList + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, material.KeyWord); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = material; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� } } //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰� firstCount = 0; - if (vmo == null) - { - foreach (var item in adaptingManageVmos) - { - int commonCount = GetIntersect(input.ModelType, item.KeyWord); - if (commonCount > firstCount) - { - vmo = item; - firstCount = commonCount; - } - } - } if (vmo != null) { input.MatchingMinorLoss = vmo.Coefficient; @@ -305,63 +307,67 @@ return true; } Vmo.AssetsPipeMainVmo vmo = null; - int StartCount = 0; + int firstCount = 0; //鍙e緞鏈�灏忓樊鍊� // 缁濆鍖归厤 var absoluteMatch = pipeLineManageVmos.Where(i => ((i.Caliber == null) || i.Caliber == input.Diameter) && ((input.Material == null) || i.MaterialName == input.Material)).ToList(); - if (absoluteMatch.Any()) + if (absoluteMatch.Count > 1) { - foreach (var range in absoluteMatch) - { - int commonCount = GetIntersect(input.ModelType, range.KeyWord); - if (commonCount > StartCount) - { - vmo = range; - StartCount = commonCount; - } - } + } + else if (absoluteMatch.Count == 1) + { + vmo = absoluteMatch.First(); } else { //鍖洪棿鍖归厤 - var rangeMatch = pipeLineManageVmos.Where(item => - { - if (item.Caliber != null) - { - return Math.Abs(Convert.ToInt64(item.Caliber - input.Diameter)) <= _caliberTolerance; - } - return false; - }) - .ToList(); + var rangeMatch = pipeLineManageVmos + .Where(item => + item.Caliber == null || + Math.Abs(Convert.ToInt64(item.Caliber) - Convert.ToInt64(input.Diameter)) <= _caliberTolerance) + .ToList(); if (rangeMatch != null) { + var materialList = new List<Vmo.AssetsPipeMainVmo>(); foreach (var range in rangeMatch) { //浠ユ潗鏂欎负鏉′欢寮�濮嬪尮閰� - int commonCount = GetIntersect(input.Material, range.MaterialName); - if (commonCount > StartCount) + if (range.MaterialName == null) { - vmo = range; - StartCount = commonCount; + materialList.Add(range); + } + else + { + int commonCount = GetIntersect(input.Material, range.MaterialName); + if (commonCount > firstCount) + { + materialList.Add(range); + firstCount = commonCount; + } } } + firstCount = 0; + if (materialList.Count < 1) + return false; + var allMatchingList = materialList + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) + { + if (item.IsDefault) + { + vmo = item; + } + } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� } } //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰� - if (vmo == null) - { - foreach (var item in pipeLineManageVmos) - { - int commonCount = GetIntersect(input.ModelType, item.KeyWord); - if (commonCount > StartCount) - { - vmo = item; - StartCount = commonCount; - } - } - } if (vmo != null) { switch (input.eAlgorithmType) @@ -400,42 +406,40 @@ } Vmo.AssetsElbowMainVmo vmo = null; int firstCount = 0; - //鍙e緞鏈�灏忓樊鍊� // 缁濆鍖归厤 var absoluteMatch = adaptingManageVmos.Where(i => ((input.Caliber == null && i.Caliber == null) || i.Caliber == input.Caliber) && ((input.Material == null) || i.MaterialName == input.Material)).ToList(); - if (absoluteMatch.Any()) + if (absoluteMatch.Count > 1) { - foreach (var range in absoluteMatch) + var allMatchingList = absoluteMatch + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, range.KeyWord); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = range; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� + } + else if (absoluteMatch.Count == 1) + { + vmo = absoluteMatch.First(); } else { //鍖洪棿鍖归厤 - var rangeMatch = adaptingManageVmos.Where(item => - { - if (item.Caliber != null && input.Caliber != null) - { - return Math.Abs(Convert.ToInt64(item.Caliber - input.Caliber)) <= _caliberTolerance; - } - else - { - if (item.Caliber == null) - { - return true; - } - } - return false; - }) - .ToList(); + var rangeMatch = adaptingManageVmos + .Where(item => + input.Caliber == null || + item.Caliber == null || + Math.Abs(Convert.ToInt64(item.Caliber) - Convert.ToInt64(input.Caliber)) <= _caliberTolerance) + .ToList(); if (rangeMatch != null && rangeMatch.Count > 0) { var materialList = new List<Vmo.AssetsElbowMainVmo>(); @@ -458,31 +462,26 @@ } //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢�� firstCount = 0; - foreach (var material in materialList) + if (materialList.Count < 1) + return false; + var allMatchingList = materialList + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, material.KeyWord); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = material; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� } } - //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰� + //绮剧‘鍖归厤鍜岀矖绯欏尮閰嶉兘娌℃湁鍖归厤鍒板氨杩斿洖閿欒 firstCount = 0; - if (vmo == null) - { - foreach (var item in adaptingManageVmos) - { - int commonCount = GetIntersect(input.ModelType, item.Name); - if (commonCount > firstCount) - { - vmo = item; - firstCount = commonCount; - } - } - } if (vmo != null) { input.MatchingMinorLoss = vmo.Coefficient; @@ -503,42 +502,40 @@ } Vmo.AssetsThreelinkMainVmo vmo = null; int firstCount = 0; - //鍙e緞鏈�灏忓樊鍊� // 缁濆鍖归厤 var absoluteMatch = adaptingManageVmos.Where(i => ((input.Caliber == null && i.Caliber == null) || i.Caliber == input.Caliber) && ((input.Material == null) || i.MaterialName == input.Material)).ToList(); - if (absoluteMatch.Any()) + if (absoluteMatch.Count > 1) { - foreach (var range in absoluteMatch) + var allMatchingList = absoluteMatch + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, range.Name); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = range; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� + } + else if (absoluteMatch.Count == 1) + { + vmo = absoluteMatch.First(); } else { //鍖洪棿鍖归厤 - var rangeMatch = adaptingManageVmos.Where(item => - { - if (item.Caliber != null && input.Caliber != null) - { - return Math.Abs(Convert.ToInt64(item.Caliber - input.Caliber)) <= _caliberTolerance; - } - else - { - if (item.Caliber == null) - { - return true; - } - } - return false; - }) - .ToList(); + var rangeMatch = adaptingManageVmos + .Where(item => + input.Caliber == null || + item.Caliber == null || + Math.Abs(Convert.ToInt64(item.Caliber) - Convert.ToInt64(input.Caliber)) <= _caliberTolerance) + .ToList(); if (rangeMatch != null && rangeMatch.Count > 0) { var materialList = new List<Vmo.AssetsThreelinkMainVmo>(); @@ -561,31 +558,26 @@ } //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢�� firstCount = 0; - foreach (var material in materialList) + if (materialList.Count < 1) + return false; + var allMatchingList = materialList + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, material.Name); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = material; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� } } - //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰� + //绮剧‘鍖归厤鍜岀矖绯欏尮閰嶉兘娌℃湁鍖归厤鍒板氨杩斿洖閿欒 firstCount = 0; - if (vmo == null) - { - foreach (var item in adaptingManageVmos) - { - int commonCount = GetIntersect(input.ModelType, item.Name); - if (commonCount > firstCount) - { - vmo = item; - firstCount = commonCount; - } - } - } if (vmo != null) { input.MatchingMinorLoss = vmo.Coefficient; @@ -606,42 +598,40 @@ } Vmo.AssetsFourlinkMainVmo vmo = null; int firstCount = 0; - //鍙e緞鏈�灏忓樊鍊� // 缁濆鍖归厤 var absoluteMatch = adaptingManageVmos.Where(i => ((input.Caliber == null && i.Caliber == null) || i.Caliber == input.Caliber) && ((input.Material == null) || i.MaterialName == input.Material)).ToList(); - if (absoluteMatch.Any()) + if (absoluteMatch.Count > 1) { - foreach (var range in absoluteMatch) + var allMatchingList = absoluteMatch + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, range.Name); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = range; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� + } + else if (absoluteMatch.Count == 1) + { + vmo = absoluteMatch.First(); } else { //鍖洪棿鍖归厤 - var rangeMatch = adaptingManageVmos.Where(item => - { - if (item.Caliber != null && input.Caliber != null) - { - return Math.Abs(Convert.ToInt64(item.Caliber - input.Caliber)) <= _caliberTolerance; - } - else - { - if (item.Caliber == null) - { - return true; - } - } - return false; - }) - .ToList(); + var rangeMatch = adaptingManageVmos + .Where(item => + input.Caliber == null || + item.Caliber == null || + Math.Abs(Convert.ToInt64(item.Caliber) - Convert.ToInt64(input.Caliber)) <= _caliberTolerance) + .ToList(); if (rangeMatch != null && rangeMatch.Count > 0) { var materialList = new List<Vmo.AssetsFourlinkMainVmo>(); @@ -664,31 +654,26 @@ } //鐢ㄥ凡缁忕瓫閫夊畬鎴愮殑鍒楄〃涓互鍚嶇О绛涢�� firstCount = 0; - foreach (var material in materialList) + if (materialList.Count < 1) + return false; + var allMatchingList = materialList + .Where(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType) >= 2) + .OrderByDescending(x => GetIntersect(x.KeyWord == string.Empty ? x.Name : x.KeyWord, input.ModelType)) + .ToList();//鎵惧嚭鐩稿悓瀛楃鍦�2浠ヤ笂骞朵笖杩涜鎺掑簭 + if (allMatchingList.Count < 1) + return false;//閫氳繃鍨嬪彿鍚嶆病鏈夋壘鍒�,鍒欒涓烘病鏈夊尮閰嶅埌 + foreach (var item in allMatchingList) { - int commonCount = GetIntersect(input.ModelType, material.Name); - if (commonCount > firstCount) + if (item.IsDefault) { - vmo = material; - firstCount = commonCount; + vmo = item; } } + vmo = allMatchingList.First();//濡傛灉娌℃湁璁剧疆榛樿鍊�,鍒欓粯璁よ繑鍥炲尮閰嶅瓧绗︽渶澶氱殑涓�鏉℃暟鎹� } } - //鍙e緞鍜屾潗鏂欓兘娌℃湁鍖归厤涓�,灏辩敤鍨嬪彿鍚嶅尮閰� + //绮剧‘鍖归厤鍜岀矖绯欏尮閰嶉兘娌℃湁鍖归厤鍒板氨杩斿洖閿欒 firstCount = 0; - if (vmo == null) - { - foreach (var item in adaptingManageVmos) - { - int commonCount = GetIntersect(input.ModelType, item.KeyWord); - if (commonCount > firstCount) - { - vmo = item; - firstCount = commonCount; - } - } - } if (vmo != null) { input.MatchingMinorLoss = vmo.Coefficient; @@ -703,9 +688,6 @@ /// <summary> /// 鑾峰彇涓や釜瀛楃涓茬殑鎵�鏈変氦闆� /// </summary> - /// <param name="str1"></param> - /// <param name="str2"></param> - /// <returns></returns> public static int GetIntersect(string str1, string str2) { if (str1 == null || str2 == null) return 0; diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs index 6d9f1a7..0f9ca13 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs @@ -41,7 +41,7 @@ feedBackProgress?.Invoke(100, 5); - #endregion + #endregion 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛� #region 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛� @@ -77,7 +77,7 @@ feedBackProgress?.Invoke(100, 10); - #endregion + #endregion 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛� #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛� @@ -112,7 +112,7 @@ feedBackProgress?.Invoke(100, 20); - #endregion + #endregion 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛� #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛� @@ -139,12 +139,11 @@ return true; } - feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 25); - #endregion + #endregion 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛� #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛� @@ -188,11 +187,13 @@ feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Code}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岄敊璇細{revitParterPropStatus.StatusInfo} ", Color.Red); } break; + case Revit.ePropStatus.Lack: { feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Code}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岀己鐪侊細{revitParterPropStatus.StatusInfo} ", Color.Gray); } break; + case Revit.ePropStatus.Abnormal: { feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Code}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛屽紓甯革細{revitParterPropStatus.StatusInfo} ", Color.Orange); @@ -209,7 +210,6 @@ feedBackProgress?.Invoke(100, 100); return true; } - var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(structRevitModel, out msg); if (hydroInfo == null) @@ -232,7 +232,7 @@ feedBackMsg?.Invoke("姝e湪杩涜浜у搧鍖归厤...", Color.Black); hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroId); var matchingParas = AssetsMatchingParasHelper.Create(hydroInfo); - if (await AssetsMatchingHelper.Matching(matchingParas)) + if (AssetsMatchingHelper.Matching(matchingParas, out string error)) { if (AssetsMatchingParasHelper.Apply(hydroInfo, matchingParas)) { @@ -253,7 +253,7 @@ feedBackProgress?.Invoke(100, 30); vm.HydroID = hydroId; - #endregion + #endregion 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛� #region 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛� @@ -288,12 +288,11 @@ return true; } - vm.HydroRelationID = hydroRelationId; feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 40); - #endregion + #endregion 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛� #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� @@ -321,7 +320,7 @@ feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 45); - #endregion + #endregion 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� @@ -349,7 +348,7 @@ feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 50); - #endregion + #endregion 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� @@ -374,7 +373,7 @@ feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 55); - #endregion + #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� #region 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� @@ -407,7 +406,7 @@ feedBackProgress?.Invoke(100, 80); - #endregion + #endregion 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� #region 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛� @@ -428,10 +427,7 @@ feedBackMsg?.Invoke("椤圭洰瀵煎叆瀹屾垚銆傘�傘��", Color.Green); return true; - #endregion - + #endregion 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛� } - - } } \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/02-pump/XhsPumpMatchingListCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/02-pump/XhsPumpMatchingListCtrl.cs index c28d9b9..473537f 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/02-pump/XhsPumpMatchingListCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/02-pump/XhsPumpMatchingListCtrl.cs @@ -36,7 +36,7 @@ foreach (var item in pumpMatchingViewModel) { - await AssetsMatchingHelper.MatchingPumps(item, AssetsPumpMainVmos); + AssetsMatchingHelper.MatchingPumps(item, AssetsPumpMainVmos); } _allBindingList.Clear(); foreach (var item in pumpMatchingViewModel) -- Gitblit v1.9.3