From 8525529a7fbdd96ab248bf6b2d725990a6531846 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Thu, 27 Feb 2025 15:22:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E6=94=BE=E7=BD=AE=E8=B4=A7=E6=9E=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WCS.BLL/DbModels/STZL/LocationInfo.cs | 3 +++ WCS.BLL/Services/Service/LocationInfoService.cs | 6 ++++++ .../ApiModel/LocationInfo/LocationInfoModel.cs | 4 +++- .../ViewModels/LocationInfoAddOrUpdateViewModel.cs | 14 ++++++++------ .../Views/LocationInfoAddOrUpdateView.xaml | 1 + 货架标准上位机/Views/LocationInfoView.xaml | 2 +- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/WCS.BLL/DbModels/STZL/LocationInfo.cs b/WCS.BLL/DbModels/STZL/LocationInfo.cs index a8f4d44..5b7d246 100644 --- a/WCS.BLL/DbModels/STZL/LocationInfo.cs +++ b/WCS.BLL/DbModels/STZL/LocationInfo.cs @@ -107,6 +107,9 @@ namespace WCS.DAL.DbModels [SugarColumn(IsIgnore = true)] public int RowNumber { get; set; } + [SugarColumn(IsIgnore = true)] + public List AllowShelfTypesName { get; set; } = new List(); + /// /// 是否已经选择 /// diff --git a/WCS.BLL/Services/Service/LocationInfoService.cs b/WCS.BLL/Services/Service/LocationInfoService.cs index 46cab19..ccd4f2d 100644 --- a/WCS.BLL/Services/Service/LocationInfoService.cs +++ b/WCS.BLL/Services/Service/LocationInfoService.cs @@ -40,9 +40,15 @@ namespace WCS.BLL.Services.Service var records = await recordsQueryable .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .ToListAsync(); + //获取系统内货架类型 + var shelfTypes = await DbHelp.db.Queryable().ToListAsync(); + //生成序号 for (int i = 0; i < records.Count; i++) { + records[i].AllowShelfTypesName = shelfTypes.Where(s => records[i].AllowShelfTypes.Contains(s.Id)) + .Select(t => t.ShelfTypeName) + .ToList(); records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; } return new PageQueryResponse() diff --git a/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs b/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs index 4ff6afc..353c4ca 100644 --- a/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs +++ b/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs @@ -33,7 +33,9 @@ namespace WCS.Model.ApiModel.StoreInfo /// /// 允许放置的货架类型 /// - public List AllowShelfTypes { get; set; } = new List(); + public List AllowShelfTypesName { get; set; } = new List(); + public List? AllowShelfTypes { get; set; } =new List(); + /// /// 更新人 /// diff --git a/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs b/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs index cee2cd3..669703e 100644 --- a/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs +++ b/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs @@ -40,9 +40,9 @@ namespace 智慧物流软件系统.ViewModel var task2 = Task.Run(() => { - AllowShelfTypes = new List(); + AllowShelfTypes = new List(); AllowShelfTypes = GetBaseData.GetShelfType() - .Select(t => t.ShelfTypeName) + //.Select(t => t.ShelfTypeName) .ToList(); }); @@ -72,14 +72,16 @@ namespace 智慧物流软件系统.ViewModel //comboBox.selec App.Current.Dispatcher.Invoke(() => { - locationInfoModel.AllowShelfTypes?.ForEach(t => checkComboBox.SelectedItems.Add(t)); + locationInfoModel.AllowShelfTypesName?.ForEach(t => + checkComboBox.SelectedItems.Add(AllowShelfTypes.Where(a => a.ShelfTypeName == t).FirstOrDefault())); }); + IsEnable = locationInfoModel.IsEnable; } public LocationInfoModel GetValues() { - var selectShelfTypes = checkComboBox.SelectedItems?.Cast().ToList(); + var selectShelfTypes = checkComboBox.SelectedItems?.Cast().Select(t => t.Id).ToList(); return new LocationInfoModel() { @@ -137,8 +139,8 @@ namespace 智慧物流软件系统.ViewModel /// /// 允许放置的货架类型 /// - private List allowShelfTypes; - public List AllowShelfTypes + private List allowShelfTypes; + public List AllowShelfTypes { get { return allowShelfTypes; } set diff --git a/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml b/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml index e0250f0..8895746 100644 --- a/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml +++ b/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml @@ -62,6 +62,7 @@ diff --git a/货架标准上位机/Views/LocationInfoView.xaml b/货架标准上位机/Views/LocationInfoView.xaml index 72d8349..535097f 100644 --- a/货架标准上位机/Views/LocationInfoView.xaml +++ b/货架标准上位机/Views/LocationInfoView.xaml @@ -149,7 +149,7 @@ - +