From 2950220f98f891a64cc452478e2a2ae61b82a8cd Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期日, 13 四月 2025 16:21:52 +0800 Subject: [PATCH] 优化代码、添加大屏 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 50 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..f68525c 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; @@ -207,13 +208,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 +238,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