From 9e579eda4601ed7b492b9d19a24e8146f6ebdf8d Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 19 四月 2025 19:50:43 +0800 Subject: [PATCH] 优化空托出入库逻辑 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs | 66 +++++++++++++++++++++++++++++++- 1 files changed, 63 insertions(+), 3 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs" index 648514e..2497f4f 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs" @@ -1,4 +1,5 @@ -锘縰sing Microsoft.AspNetCore.Mvc.RazorPages; +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; using SqlSugar; using System; @@ -95,6 +96,19 @@ var locationInfos = BaseDal.QueryData(x => Stations.Contains(x.LocationCode) && x.CurrentQty < x.MaxQty - 1, _emptyAssignOrderBy); if (locationInfos != null && locationInfos.Count > 0) locationInfo = locationInfos[0]; + return locationInfo; + } + /// <summary> + /// 鑾峰彇绌烘墭璐т綅 + /// </summary> + /// <returns></returns> + public Dt_LocationInfo GetLocationPallet() + { + string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//鑾峰彇绌挎杞﹀厖鐢典綅缃� + var ChargingStations = CarChargingStation.Split(","); + Dt_LocationInfo? locationInfo = null; + var locationInfos = BaseDal.QueryData(x => !ChargingStations.Contains(x.LocationCode) && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && x.CurrentQty < x.MaxQty, _emptyAssignOrderBy); + if (locationInfos.Count > 1 && locationInfos != null) locationInfo = locationInfos[0]; return locationInfo; } /// <summary> @@ -207,13 +221,28 @@ return BaseDal.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo && x.Column == locationInfo.Column && x.Layer == locationInfo.Layer && x.Depth != locationInfo.Depth && x.Row != locationInfo.Row && (SqlFunc.Abs(x.Row - locationInfo.Row) == 1)); } - public WebResponseContent GetPosition(string position) + public WebResponseContent GetPosition(string position, string position1) { WebResponseContent content = new WebResponseContent(); try { + Dt_LocationInfo? locationInfo = null; //Dt_LocationInfo locationInfo = BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (x.Row == 1 || x.Row == 3), _emptyAssignOrderBy); - Dt_LocationInfo locationInfo = BaseDal.QueryFirst(x => x.CurrentQty < x.MaxQty && x.LocationCode != position, _emptyAssignOrderBy); + string position2 = string.Empty; + string[] Codes = position1.Split("-"); + var row = Convert.ToInt16(Codes[0]); + if (row < 3) + { + position2 = row == 1 ? "002" + "-" + Codes[1] + "-" + Codes[2] : "001" + "-" + Codes[1] + "-" + Codes[2]; + } + if (string.IsNullOrEmpty(position2)) + { + locationInfo = BaseDal.QueryFirst(x => x.CurrentQty < x.MaxQty && x.LocationCode != position && x.LocationCode != position1, _emptyAssignOrderBy); + } + else + { + locationInfo = BaseDal.QueryFirst(x => x.CurrentQty < x.MaxQty && x.LocationCode != position && x.LocationCode != position1 && x.LocationCode != position2, _emptyAssignOrderBy); + } if (locationInfo != null) content.OK(locationInfo.LocationCode); } catch (Exception ex) @@ -222,5 +251,36 @@ } return content; } + /// <summary> + /// 鑾峰彇璐т綅淇℃伅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public WebResponseContent GetLocationInfo(SaveModel model) + { + WebResponseContent response = new WebResponseContent(); + try + { + List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => true); + var Freelocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).ToList(); + var Palletlocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()).ToList(); + var InStocklocations = locationInfos.Where(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.LocationStatus != LocationStatusEnum.Pallet.ObjToInt()).ToList(); + //Dictionary<string, object> keyValuePairs = new Dictionary<string, object>(); + //keyValuePairs.Add("绌鸿揣浣�", Freelocations.Count); + //keyValuePairs.Add("绌烘墭鐩�", Palletlocations.Count); + //keyValuePairs.Add("鏈夎揣", InStocklocations.Count); + response.OK(data: new + { + FreeQty = Freelocations.Count, + PalletQty = Palletlocations.Count, + InStockQty = InStocklocations.Count, + }); + } + catch (Exception ex) + { + response.Error(ex.Message); + } + return response; + } } } -- Gitblit v1.9.3