From 3a5257be69608f4301fe1a1e207db7d95cc4178c Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期日, 11 五月 2025 16:31:40 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/Logic/AllotLocation.cs |   54 +++++++++++++++++++++++++++---------------------------
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/Wms/WMS.BLL/Logic/AllotLocation.cs b/Wms/WMS.BLL/Logic/AllotLocation.cs
index 190b34e..8817d57 100644
--- a/Wms/WMS.BLL/Logic/AllotLocation.cs
+++ b/Wms/WMS.BLL/Logic/AllotLocation.cs
@@ -38,8 +38,8 @@
                 dataStock = dataStock.Where(m => m.LotNo == lotNo);
             }
             //搴撳瓨鏌ユ壘鐩稿悓鐗╂枡/鎵规鐨勫贩閬�
-            var yiYouRoad = dataStock.GroupBy(m => m.RoadwayNo).Select(m => m.RoadwayNo).OrderBy(m => m).ToList();
-            foreach (var l in yiYouRoad)
+            var yiYouRoad = dataStock.GroupBy(m => m.RoadwayNo).Select(m => m.RoadwayNo).ToList();
+            foreach (var l in yiYouRoad.OrderBy(m=>m).ToList())
             {
                 // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
                  
@@ -78,18 +78,18 @@
                             
                         }
                     }
-                    if (bl)
+                }
+                if (bl)
+                {
+                    // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
+
+                    var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
+
+                    var bindNum = db.Queryable<LogTask>().Where(m => m.IsDel == "0" && (m.Status == "0" || m.Status == "1") && m.EndRoadway == l)
+                                .GroupBy(m => m.PalletNo).Select(m => m.PalletNo).Count();
+                    if (locateCount - bindNum > 0)
                     {
-                        // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
-
-                        var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
-
-                        var bindNum = db.Queryable<LogTask>().Where(m => m.IsDel == "0" && (m.Status == "0" || m.Status == "1") && m.EndRoadway == l)
-                                    .GroupBy(m => m.PalletNo).Select(m => m.PalletNo).Count();
-                        if (locateCount - bindNum > 0)
-                        {
-                            return l;
-                        }
+                        return l;
                     }
                 }
             }
@@ -110,7 +110,7 @@
             var db = DataContext.Db;
             
             // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
-            var locateList = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == roadwayNo && areaList.Contains(m.AreaNo)).ToList();
+            var locateList = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == roadwayNo && areaList.Contains(m.AreaNo) && m.Status == "0").ToList();
             if (locateList.Count(m => m.Status == "0") > 0)
             {
                 var bl = GetLocateASCOrDesc(roadwayNo);
@@ -145,7 +145,7 @@
             var locate = db.Queryable<SysStorageLocat>().First(m => m.IsDel == "0" && m.RoadwayNo == roadStr);
             var a = locate.LocatNo.Substring(2,2);//鍌ㄤ綅鍒�
             var b = locate.AisleOne.Substring(2, 2);//閫氶亾鍙e垪
-            return int.Parse(a) < int.Parse(b);  
+            return int.Parse(a) > int.Parse(b);  
         }
 
         /// <summary>
@@ -165,6 +165,17 @@
             var locatList2 = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == locate.RoadwayNo && m.Column > a).ToList();
             if (bl)
             {
+                if (locatList1.Count(m => str2.Contains(m.Status)) > 0)
+                {
+                    return false;
+                }
+                if (locatList2.Count(m => str1.Contains(m.Status)) > 0)
+                {
+                    return false;
+                }
+            }
+            else
+            {
                 if (locatList1.Count(m => str1.Contains(m.Status)) > 0)
                 {
                     return false;
@@ -173,17 +184,6 @@
                 {
                     return false;
                 }
-            }
-            else
-            {
-                if (locatList1.Count(m => str2.Contains(m.Status)) > 0)
-                {
-                    return false;
-                }
-                if (locatList2.Count(m => str1.Contains(m.Status)) > 0)
-                {
-                    return false;
-                } 
             }
             return true;
                 
@@ -380,7 +380,7 @@
         /// <param name="areaList">鍖哄煙闆嗗悎</param>
         /// <param name="isRoadway">鏄惁鎸囧畾宸烽亾</param>
         /// <returns></returns>
-        private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W01")
+        private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W02")
         {
             try
             {

--
Gitblit v1.8.0