From a9a3f943efb083de8ed88b293897886b3ef612a2 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 11 八月 2025 17:37:09 +0800
Subject: [PATCH] 功能增添优化
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs | 334 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 182 insertions(+), 152 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs"
index 6f3a453..7042b06 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs"
@@ -55,9 +55,9 @@
"HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
"HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
"HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
- "闃荤剨浠�" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
+ "HA154" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
"HA153" => AssignLocation(roadwayNo),
- "HA71" => AssignLocation(roadwayNo),
+ "HA71" or "HA72" or "HA73" => AssignLocation(roadwayNo),
"HA60" => AssignLocation(roadwayNo),
_ => throw new Exception($"鏈壘鍒颁粨搴撹揣浣嶅垎閰嶆柟娉�")
};
@@ -119,153 +119,153 @@
/// <param name="location">璐т綅瀵硅薄</param>
/// <param name="palletType">鎵樼洏绫诲瀷</param>
/// <param name="locationStatus">璐т綅鐘舵��</param>
- public void UpdateLocationStatus2(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId)
- {
- List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo);
+ //public void UpdateLocationStatus2(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId)
+ //{
+ // List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo);
- List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, location);
- if (locationInfos.Max(x => x.Depth) < 3)
- {
- for (int i = 0; i < locations.Count; i++)
- {
- if (locations[i].LocationType != palletType.ObjToInt())
- {
- locations[i].LocationType = palletType.ObjToInt();
- }
+ // List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, location);
+ // if (locationInfos.Max(x => x.Depth) < 3)
+ // {
+ // for (int i = 0; i < locations.Count; i++)
+ // {
+ // if (locations[i].LocationType != palletType.ObjToInt())
+ // {
+ // locations[i].LocationType = palletType.ObjToInt();
+ // }
- if (locations[i].LocationCode == location.LocationCode)
- {
- locations[i].LocationStatus = locationStatus.ObjToInt();
- }
- else
- {
- if (locationStatus == LocationStatusEnum.Lock)
- {
- if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
- }
- else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
- }
- }
- else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock)
- {
- if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- }
- else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
- }
- }
- }
- }
+ // if (locations[i].LocationCode == location.LocationCode)
+ // {
+ // locations[i].LocationStatus = locationStatus.ObjToInt();
+ // }
+ // else
+ // {
+ // if (locationStatus == LocationStatusEnum.Lock)
+ // {
+ // if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
+ // }
+ // else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
+ // }
+ // }
+ // else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock)
+ // {
+ // if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ // }
+ // else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ // }
+ // }
+ // }
+ // }
- Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
- if(location.RoadwayNo == "SC01_BC")
- {
- nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
- }
- if (nearLocation != null)
- {
- List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation);
- for (int i = 0; i < nearLocations.Count; i++)
- {
- if (nearLocations[i].LocationType != palletType.ObjToInt())
- {
- nearLocations[i].LocationType = palletType.ObjToInt();
- }
+ // Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
+ // if(location.RoadwayNo == "SC01_BC")
+ // {
+ // nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
+ // }
+ // if (nearLocation != null)
+ // {
+ // List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation);
+ // for (int i = 0; i < nearLocations.Count; i++)
+ // {
+ // if (nearLocations[i].LocationType != palletType.ObjToInt())
+ // {
+ // nearLocations[i].LocationType = palletType.ObjToInt();
+ // }
- if (palletType.ObjToInt() >= PalletTypeEnum.LargePallet.ObjToInt())
- {
- if (nearLocations[i].LocationCode == nearLocation.LocationCode)
- {
- nearLocations[i].LocationStatus = locationStatus.ObjToInt();
- }
- else
- {
- if (locationStatus == LocationStatusEnum.Lock)
- {
- if (nearLocations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
- {
- nearLocations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
- }
- else if (nearLocations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
- {
- nearLocations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
- }
- }
- else if (locationStatus == LocationStatusEnum.InStock)
- {
- if (nearLocations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
- {
- nearLocations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- }
- else if (nearLocations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
- {
- nearLocations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
- }
- }
- }
- }
+ // if (palletType.ObjToInt() >= PalletTypeEnum.LargePallet.ObjToInt())
+ // {
+ // if (nearLocations[i].LocationCode == nearLocation.LocationCode)
+ // {
+ // nearLocations[i].LocationStatus = locationStatus.ObjToInt();
+ // }
+ // else
+ // {
+ // if (locationStatus == LocationStatusEnum.Lock)
+ // {
+ // if (nearLocations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+ // {
+ // nearLocations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
+ // }
+ // else if (nearLocations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
+ // {
+ // nearLocations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
+ // }
+ // }
+ // else if (locationStatus == LocationStatusEnum.InStock)
+ // {
+ // if (nearLocations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
+ // {
+ // nearLocations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ // }
+ // else if (nearLocations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
+ // {
+ // nearLocations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ // }
+ // }
+ // }
+ // }
- }
- locations.AddRange(nearLocations);
- }
- }
- else
- {
- for (int i = 0; i < locations.Count; i++)
- {
- if (locations[i].LocationCode == location.LocationCode)
- {
- locations[i].LocationStatus = locationStatus.ObjToInt();
- }
- else
- {
- if (locationStatus == LocationStatusEnum.Lock)
- {
- if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
- }
- else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
- }
- }
- else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock)
- {
- if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- }
- else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
- {
- locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
- }
- }
- }
- if (locations[i].LocationType != palletType.ObjToInt())
- {
- locations[i].LocationType = palletType.ObjToInt();
- }
- }
- }
+ // }
+ // locations.AddRange(nearLocations);
+ // }
+ // }
+ // else
+ // {
+ // for (int i = 0; i < locations.Count; i++)
+ // {
+ // if (locations[i].LocationCode == location.LocationCode)
+ // {
+ // locations[i].LocationStatus = locationStatus.ObjToInt();
+ // }
+ // else
+ // {
+ // if (locationStatus == LocationStatusEnum.Lock)
+ // {
+ // if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt();
+ // }
+ // else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt();
+ // }
+ // }
+ // else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock)
+ // {
+ // if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ // }
+ // else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt())
+ // {
+ // locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ // }
+ // }
+ // }
+ // if (locations[i].LocationType != palletType.ObjToInt())
+ // {
+ // locations[i].LocationType = palletType.ObjToInt();
+ // }
+ // }
+ // }
- if (locations.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).Count() == locations.Count && locationStatus == LocationStatusEnum.Free)
- {
- locations.ForEach(x =>
- {
- x.LocationType = 0;
- });
- }
+ // if (locations.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).Count() == locations.Count && locationStatus == LocationStatusEnum.Free)
+ // {
+ // locations.ForEach(x =>
+ // {
+ // x.LocationType = 0;
+ // });
+ // }
- Repository.UpdateData(locations);
- }
+ // Repository.UpdateData(locations);
+ //}
public void UpdateLocationStatus(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId)
{
@@ -334,16 +334,34 @@
Dt_LocationInfo? nearLocation;
if (palletTypeInfo.IsOdd)
{
- nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
+ if (warehouse.WarehouseCode==WarehouseEnum.HA154.ToString())
+ {
+ nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
+ }
+ else
+ {
+ nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
+ }
}
else
{
nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
}
- if (location.RoadwayNo == "SC01_BC")
+ if (nearLocation!=null && location.RoadwayNo.Contains("BC"))
+ {
+ if (nearLocation?.LocationType == LocationTypeEnum.SmallPallet.ObjToInt())
+ {
+ nearLocation = null;
+ }
+ }
+ if (location.RoadwayNo == "SC01_BC" && palletType != PalletTypeEnum.SmallPallet.ObjToInt())
{
nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1);
+ if (nearLocation?.LocationType == LocationTypeEnum.SmallPallet.ObjToInt())
+ {
+ nearLocation = null;
+ }
}
if (nearLocation != null)
@@ -446,8 +464,11 @@
int row = location.Row;
for (int j = location.Depth + 1; j <= maxDepth; j++)
{
- row += 1;
- Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
+ Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row + 1));
+ if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+ {
+ locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
+ }
if (locationInfo != null)
{
groupLocations.Add(locationInfo);
@@ -456,8 +477,11 @@
for (int j = location.Depth - 1; j >= 1; j--)
{
- row -= 1;
- Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
+ Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row -1));
+ if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
+ {
+ locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
+ }
if (locationInfo != null)
{
groupLocations.Add(locationInfo);
@@ -480,8 +504,11 @@
int row = location.Row;
for (int j = location.Depth + 1; j <= maxDepth; j++)
{
- row += 1;
- Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
+ Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1));
+ if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+ {
+ locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
+ }
if (locationInfo != null)
{
groupLocations.Add(locationInfo);
@@ -490,8 +517,11 @@
for (int j = location.Depth - 1; j >= 1; j--)
{
- row -= 1;
- Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row);
+ Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1));
+ if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
+ {
+ locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
+ }
if (locationInfo != null)
{
groupLocations.Add(locationInfo);
--
Gitblit v1.9.3