From ded7dffbb1fbed96acd8cc10c7710f4d848384e9 Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期一, 23 三月 2026 15:45:17 +0800
Subject: [PATCH] fix: 修改库存已满无法入库问题,修复大屏库存图信息
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
index cc91e60..25b27c2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
@@ -160,20 +160,20 @@
}
- public string AccessingTunnel(int WarehouseId, int LocationType)
+ public string AccessingTunnel(int WarehouseId, int LocationType, int taskCount)
{
List<Dt_LocationInfo> locationData = BaseDal.QueryData(x => x.WarehouseId == WarehouseId);
var roadwayGroups = locationData.Where(x => x.LocationType == LocationType && x.LocationStatus== (int)LocationStatusEnum.Free && x.EnableStatus== (int)EnableStatusEnum.Normal).GroupBy(x => x.RoadwayNo)
.Select(g => new
{
RoadwayNo = g.Key,
- LocationCount = g.Count(),
+ LocationCount = g.Count() - taskCount,
}).OrderByDescending(g => g.LocationCount).ToList();
- int minRequired = 15;
+ int minRequired = 3;
if(WarehouseId== (int)WarehouseEnum.YMYL)
{
- if (LocationType == 2) minRequired = 6;
+ if (LocationType == 2) minRequired = 2;
var selectedRoadway = roadwayGroups.FirstOrDefault(g => g.LocationCount >= minRequired);
if(selectedRoadway!=null) return selectedRoadway.RoadwayNo;
@@ -375,15 +375,16 @@
return WebResponseContent.Instance.OK("鎴愬姛", result);
}
-
+ // 缁х画鍒嗭紝WarehouseId =1锛屾湁涓や釜涓嶅悓鐨勮揣鐗╋紝LocationType =1鍜�2
public WebResponseContent GetWarehouseCapacity()
{
- // 鏌ヨ鎵�鏈変粨搴撶殑璐т綅鏁版嵁
+ // 鏌ヨ鎵�鏈変粨搴撶殑璐т綅鏁版嵁锛屽寘鍚揣浣嶇被鍨�
var allLocations = BaseDal.QueryData()
.Select(x => new
{
x.WarehouseId,
- x.LocationStatus
+ x.LocationStatus,
+ x.LocationType // 娣诲姞璐т綅绫诲瀷
})
.ToList();
@@ -393,15 +394,21 @@
return WebResponseContent.Instance.OK("鏈壘鍒颁换浣曡揣浣嶆暟鎹�", new List<object>());
}
- // 璁$畻姣忎釜浠撳簱鐨勫閲忎娇鐢ㄦ儏鍐�
+ // 鎸変粨搴撳拰璐т綅绫诲瀷鍒嗙粍缁熻
var result = allLocations
- .GroupBy(x => x.WarehouseId)
+ .GroupBy(x => new { x.WarehouseId, x.LocationType })
.Select(g => new
{
- WarehouseId = g.Key,
+ WarehouseId = g.Key.WarehouseId,
+ LocationType = g.Key.LocationType,
+ TotalLocations = g.Count(),
FreeLocations = g.Count(x => x.LocationStatus == 0),
+ UsedLocations = g.Count(x => x.LocationStatus == 1),
+ OccupancyRate = (int)Math.Round((double)g.Count(x => x.LocationStatus == 1) / g.Count() * 100),
RemainingCapacityPercentage = (int)Math.Round((double)g.Count(x => x.LocationStatus == 0) / g.Count() * 100)
})
+ .OrderBy(x => x.WarehouseId)
+ .ThenBy(x => x.LocationType)
.ToList();
return WebResponseContent.Instance.OK("鎴愬姛", result);
--
Gitblit v1.9.3