From ad4d32dc4e162ba7fb71cd3bc213f1d71c964551 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 13 五月 2025 14:30:57 +0800
Subject: [PATCH] 最新代码上传

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs"
index 43c07f3..3691af7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs"
@@ -75,6 +75,19 @@
 
                 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 (definedTypeEmptyLocations.Any())
+                {
+                    for (int i = 0; i < definedTypeEmptyLocations.Count; i++)
+                    {
+                        Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i];
+                        Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo);
+                        if (locationInfo != null)
+                        {
+                            locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
+                            return locationInfo;
+                        }
+                    }
+                }
                 if ((locationInfos.Count * weightValue_GM >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//濡傛灉宸插畾涔夌被鍨嬭揣浣嶆湭瓒呰繃姣斾緥锛屼笖鏈夋湭瀹氫箟绫诲瀷鐨勮揣浣�
                 {
                     if (palletTypeInfo.LocaitonCount == 2)
@@ -95,18 +108,10 @@
                         }
                     }
                 }
-                else
+                //鍒ゆ柇濡傛灉宸插畾涔夎揣浣嶇被鍨嬬殑璐т綅鍜屾湭瀹氫箟绫诲瀷鐨勭┖璐т綅閮戒负绌洪噴鏀炬弧瓒虫潯浠剁殑璐т綅
+                if (!definedTypeEmptyLocations.Any() && !undefinedTypeEmptyLocations.Any())
                 {
-                    for (int i = 0; i < definedTypeEmptyLocations.Count; i++)
-                    {
-                        Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i];
-                        Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo);
-                        if (locationInfo != null)
-                        {
-                            locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
-                            return locationInfo;
-                        }
-                    }
+
                 }
                 return null;
             }

--
Gitblit v1.9.3