From a3014a01e07619105d597d0c51cf195217b0806f Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 29 七月 2025 10:47:01 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs |   53 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs
index 5594f9d..8b2fd17 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs
@@ -67,21 +67,21 @@
 
                 List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList();
 
-                //if (heightType == 1)
-                //{
-                //    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer <= 3).ToList();
-                //    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer <= 3).ToList();
-                //}
-                //else if (heightType == 2)
-                //{
-                //    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 4).ToList();
-                //    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 4).ToList();
-                //}
-                //else if (heightType == 3)
-                //{
-                //    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 5).ToList();
-                //    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 5).ToList();
-                //}
+                if (heightType == 1)
+                {
+                    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer >= 14).ToList();
+                    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer >= 14).ToList();
+                }
+                else if (heightType == 2)
+                {
+                    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer >= 5 && x.Layer <= 13).ToList();
+                    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer >= 5 && x.Layer <= 13).ToList();
+                }
+                else if (heightType == 3)
+                {
+                    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer <= 4).ToList();
+                    definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer <= 4).ToList();
+                }
                 //else
                 //{
                 //    undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => false).ToList();
@@ -132,14 +132,14 @@
                             Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i];
                             Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo);
                             //鍒ゆ柇璐т綅涓ゆ繁鍙婁互涓婃槸鍚﹀瓨鍦ㄥ嚭搴撻攣瀹氳揣浣�
-                            if (locationInfo?.Depth == 1)
-                            {
-                                Dt_LocationInfo? IsBebusyLocation = locationInfos.Where(x => x.Row == (locationInfo?.Row == 2 ? locationInfo?.Row - 1 : locationInfo?.Row + 1) && x.Column == locationInfo?.Column && x.Layer == locationInfo?.Layer).FirstOrDefault();
-                                if (IsBebusyLocation != null && (IsBebusyLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt()))
-                                {
-                                    continue;
-                                }
-                            }
+                            //if (locationInfo?.Depth == 1)
+                            //{
+                            //    Dt_LocationInfo? IsBebusyLocation = locationInfos.Where(x => x.Row == (locationInfo?.Row == 2 ? locationInfo?.Row - 1 : locationInfo?.Row + 1) && x.Column == locationInfo?.Column && x.Layer == locationInfo?.Layer).FirstOrDefault();
+                            //    if (IsBebusyLocation != null && (IsBebusyLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt()))
+                            //    {
+                            //        continue;
+                            //    }
+                            //}
                             if (locationInfo != null)
                             {
                                 //UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, locationInfo.WarehouseId);
@@ -148,6 +148,13 @@
                             }
                         }
                     }
+                    else
+                    {
+                        Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations.FirstOrDefault();
+                        Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo);
+                        locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
+                        return locationInfo;
+                    }
 
                 }
                 return null;

--
Gitblit v1.9.3