From 86e443e42c4bee972c5b795def4917e02f98ce40 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 11 七月 2025 16:45:08 +0800 Subject: [PATCH] 修改问题 --- Wms/WMS.BLL/Logic/AllotLocation.cs | 78 +++++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 35 deletions(-) diff --git a/Wms/WMS.BLL/Logic/AllotLocation.cs b/Wms/WMS.BLL/Logic/AllotLocation.cs index 190b34e..2a5c1f1 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; @@ -292,10 +292,14 @@ /// <param name="areaList">鍖哄煙闆嗗悎</param> /// <param name="roadwayNo">宸烽亾鍙�(鍙┖)</param> /// <returns></returns> - public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "") + public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "",string ceng = "") { try { + if (string.IsNullOrWhiteSpace(ceng)) + { + throw new Exception($"鐢宠璐ф灦搴撲綅灞傛暟涓嶈兘涓虹┖"); + } var db = DataContext.Db; /* 1.鍏堝垽鏂粨搴擄紙绔嬪簱鎴栬�呭钩搴擄級 * 2.濡傛灉鏄珛搴� 鍐嶅垽鏂槸鍚︽寚瀹氬贩閬撳彿 @@ -334,7 +338,7 @@ //鏌ヨ璇ュ贩閬撳苟涓旀爣蹇椾负姝e父鐨勭殑鍌ㄤ綅 roadwayList.Add(roadway); - var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo); + var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo, ceng); if (locate == null) { throw new Exception($"{roadwayNo}宸烽亾娌℃湁鍚堥�傜殑绌哄偍浣�"); @@ -346,7 +350,7 @@ { var roadwayList = db.Queryable<SysStorageRoadway>().Where(m => m.WareHouseNo == houseNo && m.Status == "0" && roadList.Contains(m.RoadwayNo)).OrderBy(m => new { m.Priority, m.RoadwayNo }).ToList(); - var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo); + var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo,ceng); if (locate == null) { throw new Exception($"{houseNo}浠撳簱宸插惎鐢ㄧ殑宸烽亾涓病鏈夊悎閫傜殑绌哄偍浣�"); @@ -380,7 +384,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",string ceng = "") { try { @@ -469,7 +473,7 @@ var count = 0; do { - locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); + locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count, ceng); if (locate != null) { break; @@ -503,7 +507,7 @@ var count = 0; do { - locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); + locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng); if (locate != null) { break; @@ -531,7 +535,7 @@ var count = 0; do { - locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); + locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng); if (locate != null) { break; @@ -575,7 +579,7 @@ /// <param name="areaList">鍖哄煙闆嗗悎</param> /// <param name="locateNoStr">鎺掗櫎鐨勫偍浣嶉泦鍚�</param> /// <returns></returns> - private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count) + private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count,string ceng = "") { var db = DataContext.Db; var str = ""; @@ -596,7 +600,11 @@ foreach (var area in areaList) { - var sql = $@"select * from SysStorageLocat where IsDel = 0 and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) "; + var sql = $@"select * from SysStorageLocat where IsDel = 0 and Layer!= '3' and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) "; + if (!string.IsNullOrWhiteSpace(ceng)) + { + sql += $"and Layer = '{ceng}' "; + } sql += "order by "; sql += topOrBom == 0 ? "Layer desc, " : "Layer, "; sql += leftOrRight == 0 ? "[Column], " : "[Column] desc, "; -- Gitblit v1.8.0