From 2c889b38311883ceb703c4e0034c798fdaa2e21c Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 12 八月 2025 23:11:57 +0800
Subject: [PATCH] 更新代码,货位分配优化等

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs |  168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 164 insertions(+), 4 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 c4fcbbc..289db11 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"
@@ -464,8 +464,53 @@
             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));
+                #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅
+                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && 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 == 3 || row == 4))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                }
+                #endregion
                 if (locationInfo != null)
                 {
                     groupLocations.Add(locationInfo);
@@ -474,8 +519,42 @@
 
             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));
+                #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅
+                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
+                    }
+                }
+                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                #endregion
                 if (locationInfo != null)
                 {
                     groupLocations.Add(locationInfo);
@@ -499,6 +578,52 @@
             for (int j = location.Depth + 1; j <= maxDepth; j++)
             {
                 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));
+                #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅
+                if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && 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 == 3 || row == 4))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                }
+                #endregion
                 if (locationInfo != null)
                 {
                     groupLocations.Add(locationInfo);
@@ -508,6 +633,41 @@
             for (int j = location.Depth - 1; j >= 1; j--)
             {
                 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));
+                #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅
+                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2);
+                    }
+                }
+                if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6))
+                {
+                    if (row <= maxDepth)
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1);
+                    }
+                    else
+                    {
+                        locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1);
+                    }
+                }
+                #endregion
                 if (locationInfo != null)
                 {
                     groupLocations.Add(locationInfo);

--
Gitblit v1.9.3