From ba4a73e2ced6874fb0494988d01ce17f26de1e42 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Tue, 1 Apr 2025 19:10:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=8D=E7=BD=AE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WCS.BLL/DbModels/STZL/LocationInfo.cs | 6 ++- WCS.BLL/Manager/AGVManager.cs | 39 +++++++++++++++++++ .../Service/MatDetailCurrentInfoService.cs | 3 ++ .../LocationInfo/LocationInfoModel.cs | 5 +++ .../MatDetailCurrentInfo.cs | 6 ++- .../Controllers/LocationInfoController.cs | 2 + .../MatDetailCurrenInfoController.cs | 2 + .../ViewModels/LocationInfoAddOrUpdateViewModel.cs | 12 ++++++ .../Views/LocationInfoAddOrUpdateView.xaml | 20 +++++++++- 货架标准上位机/Views/LocationInfoView.xaml | 2 + .../Views/MatDetailCurrentInfoView.xaml | 4 +- 11 files changed, 96 insertions(+), 5 deletions(-) diff --git a/WCS.BLL/DbModels/STZL/LocationInfo.cs b/WCS.BLL/DbModels/STZL/LocationInfo.cs index 6c91063..c6de1cd 100644 --- a/WCS.BLL/DbModels/STZL/LocationInfo.cs +++ b/WCS.BLL/DbModels/STZL/LocationInfo.cs @@ -41,7 +41,11 @@ namespace WCS.DAL.DbModels public string RcsStoreCode { get; set; } - + /// + /// 位置名称 -用于存储RCS修改的库存别名 + /// + [SugarColumn(ColumnName = "location_name", Length = 64, IsNullable = false, ColumnDescription = "位置名称,用于存储和显示")] + public string LocationName { get; set; } /// /// 可放置货架类型 diff --git a/WCS.BLL/Manager/AGVManager.cs b/WCS.BLL/Manager/AGVManager.cs index c3a5664..0605db3 100644 --- a/WCS.BLL/Manager/AGVManager.cs +++ b/WCS.BLL/Manager/AGVManager.cs @@ -205,6 +205,45 @@ namespace WCS.BLL.Manager .ExecuteCommand(); } Logs.Write($"【定时任务】定时同步货架绑定情况,更新0个货架", LogsType.Tasks); + + #region 更新库位别名 + //获取当前所有库位 + var locationInfos = DbHelp.db.Queryable() + .ToList(); + //RCS中位置的信息 + var rcsLocationDatas = result.data.Where(t => !string.IsNullOrEmpty(t.podCode)) + .Select(t => new + { + LocationCode = t.mapDataCode, + LocationName = t.positionCode, + }) + .Distinct() + .ToList(); + var needUpdateLocationInfos = new List(); + foreach (var locationInfo in locationInfos) + { + //RCS中找寻同名库位 + var rcsLocationData = rcsLocationDatas.Where(t => t.LocationCode == locationInfo.LocationCode) + .First(); + if (rcsLocationData == null) + { + Logs.Write($"【定时任务】定时同步库位别名,出现问题:RCS接口未返回同名库位{locationInfo.LocationCode}", LogsType.Tasks); + continue; + } + if (locationInfo.LocationName != rcsLocationData.LocationName) + { + locationInfo.LocationName = rcsLocationData.LocationName; + needUpdateLocationInfos.Add(locationInfo); + } + } + if (needUpdateLocationInfos != null && needUpdateLocationInfos.Count > 0) + { + Logs.Write($"【定时任务】定时同步库位别名,更新{needUpdateLocationInfos.Count}个库位", LogsType.Tasks); + DbHelp.db.Updateable(needUpdateLocationInfos) + .UpdateColumns(t => new { t.LocationName}) + .ExecuteCommand(); + } + #endregion } } diff --git a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs index 2952478..c4f1349 100644 --- a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs +++ b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs @@ -51,6 +51,7 @@ namespace WCS.BLL.Services.Service LocationArea = li.LocationArea, LocationCode = li.LocationCode, + LocationName = li.LocationName, MatCode = mci.MatCode, MatName = mci.MatName, @@ -137,6 +138,7 @@ namespace WCS.BLL.Services.Service LocationArea = li.LocationArea, LocationCode = li.LocationCode, + LocationName = li.LocationName, MatCode = mci.MatCode, MatName = mci.MatName, @@ -209,6 +211,7 @@ namespace WCS.BLL.Services.Service LocationArea = li.LocationArea, LocationCode = li.LocationCode, + LocationName = li.LocationName, MatCode = mci.MatCode, MatName = mci.MatName, diff --git a/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs b/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs index 353c4ca..9217a8d 100644 --- a/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs +++ b/WCS.Model/ApiModel/LocationInfo/LocationInfoModel.cs @@ -18,6 +18,11 @@ namespace WCS.Model.ApiModel.StoreInfo /// public string LocationCode { get; set; } + /// + /// 位置名称 + /// + public string LocationName { get; set; } + /// /// 库位区域 /// diff --git a/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs b/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs index f2ddb19..97e099c 100644 --- a/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs +++ b/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs @@ -16,9 +16,13 @@ namespace WCS.Model.ApiModel.MatDetailCurrentInfo //货架位置的区域 public string? LocationArea { get; set; } = string.Empty; /// - /// 货架位置 + /// 货架位置 位置的编码 /// public string? LocationCode { get; set; } = string.Empty; + /// + /// 位置名称 RCS对应位置的别名 + /// + public string? LocationName { get; set; } = string.Empty; #endregion #region 物料属性 diff --git a/WCS.WebApi/Controllers/LocationInfoController.cs b/WCS.WebApi/Controllers/LocationInfoController.cs index eca2ff8..dbad273 100644 --- a/WCS.WebApi/Controllers/LocationInfoController.cs +++ b/WCS.WebApi/Controllers/LocationInfoController.cs @@ -82,6 +82,8 @@ namespace WCS.WebApi.Controllers new ExportableColumn("序号","RowNumber"), new ExportableColumn("位置区域","LocationArea"), new ExportableColumn("位置编号","LocationCode"), + new ExportableColumn("位置名称","LocationName"), + new ExportableColumn("RCS库位编号","RcsStoreCode"), new ExportableColumn("可放置货架类型","AllowShelfTypesNameStr"), new ExportableColumn("启用状态","IsEnableStr"), diff --git a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs index 6243953..98356e3 100644 --- a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs +++ b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs @@ -52,6 +52,8 @@ namespace WCS.WebApi.Controllers new ExportableColumn("货架编码","ShelfCode"), new ExportableColumn("位置区域","LocationArea"), new ExportableColumn("位置编号","LocationCode"), + new ExportableColumn("位置名称","LocationName"), + new ExportableColumn("物料编码","MatCode"), new ExportableColumn("物料名称","MatName"), new ExportableColumn("物料批次","MatBatch"), diff --git a/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs b/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs index 669703e..382b4a8 100644 --- a/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs +++ b/货架标准上位机/ViewModels/LocationInfoAddOrUpdateViewModel.cs @@ -69,6 +69,7 @@ namespace 智慧物流软件系统.ViewModel } LocationCode = locationInfoModel.LocationCode; RcsStoreCode = locationInfoModel.RcsStoreCode; + LocationName = locationInfoModel.LocationName; //comboBox.selec App.Current.Dispatcher.Invoke(() => { @@ -89,6 +90,7 @@ namespace 智慧物流软件系统.ViewModel LocationAreaId = SelectedLocationAreaItem.Id, LocationArea = SelectedLocationAreaItem.LocationAreaName, LocationCode = LocationCode, + LocationName = LocationName, RcsStoreCode = RcsStoreCode, ModifyUser = LocalStatic.CurrentUser, AllowShelfTypes = selectShelfTypes, @@ -136,6 +138,16 @@ namespace 智慧物流软件系统.ViewModel } } + private string locationName; + public string LocationName + { + get { return locationName; } + set + { + SetProperty(ref locationName, value); + } + } + /// /// 允许放置的货架类型 /// diff --git a/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml b/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml index 8895746..dcb3b3a 100644 --- a/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml +++ b/货架标准上位机/Views/LocationInfoAddOrUpdateView.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:hc="https://handyorg.github.io/handycontrol" mc:Ignorable="d" - Height="320" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1"> + Height="360" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1"> @@ -47,7 +47,23 @@ - + + + + + + + diff --git a/货架标准上位机/Views/MatDetailCurrentInfoView.xaml b/货架标准上位机/Views/MatDetailCurrentInfoView.xaml index eae0d95..279f0ac 100644 --- a/货架标准上位机/Views/MatDetailCurrentInfoView.xaml +++ b/货架标准上位机/Views/MatDetailCurrentInfoView.xaml @@ -177,7 +177,9 @@ - + + +