From 7e514494e595531a0517d6266823bc7f6d673831 Mon Sep 17 00:00:00 2001 From: bklLiudl <673013083@qq.com> Date: 星期四, 14 三月 2024 13:41:29 +0800 Subject: [PATCH] 呼叫小车 --- Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 78 +++++++++++++++++++++++++++++++++----- 1 files changed, 67 insertions(+), 11 deletions(-) diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs index 7af1516..13d05b0 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs @@ -888,7 +888,18 @@ } try { - string EndLocat = string.Empty;//鐩爣浣嶇疆 + string EndLocat = string.Empty;//鐩爣浣嶇疆 + + var log = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && (w.Status == "0" || w.Status == "1")); + if (log != null) + { + throw new Exception("璇ユ墭鐩樺凡鏈夊皬杞︾瓑寰呮墽琛屾垨姝e湪鎵ц鐨勪换鍔�!"); + } + var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo); + if (stockDetail == null) + { + throw new Exception("鎵樼洏涓婄墿鏂欏簱瀛樻槑缁嗕俊鎭笉瀛樺湪,璇锋鏌�!"); + } if (!string.IsNullOrEmpty(areaNo)) { var storageArea = Db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.AreaNo == areaNo); @@ -896,17 +907,11 @@ { throw new Exception("鎵�閫夊尯鍩熶俊鎭笉瀛樺湪,璇锋鏌�!"); } - EndLocat = Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.AreaNo == storageArea.AreaNo && w.Status == "0" && w.Flag == "0").Select(s => s.LocatNo).First(); + EndLocat = GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo,palletNo); } else { EndLocat = ruku; - } - - var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo); - if (stockDetail == null) - { - throw new Exception("鎵樼洏涓婄墿鏂欏簱瀛樻槑缁嗕俊鎭笉瀛樺湪,璇锋鏌�!"); } var stock = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == stockDetail.SkuNo && w.LotNo == stockDetail.LotNo); if (stock == null) @@ -961,7 +966,7 @@ Db.Updateable(stock).ExecuteCommand(); //淇敼鍌ㄤ綅鍦板潃鐘舵�� - storageLocat.Status = "3";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 + storageLocat.Status = "5";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 Db.Updateable(storageLocat).ExecuteCommand(); //娣诲姞鎿嶄綔鏃ュ織璁板綍 @@ -1002,6 +1007,12 @@ } try { + var log = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && (w.Status == "0" || w.Status == "1")); + if (log != null) + { + throw new Exception("璇ユ墭鐩樺凡鏈夊皬杞︾瓑寰呮墽琛屾垨姝e湪鎵ц鐨勪换鍔�!"); + } + var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo); if (notice == null) { @@ -1041,7 +1052,7 @@ throw new Exception("鎵�閫夊尯鍩熶俊鎭笉瀛樺湪,璇锋鏌�!"); } string EndLocat = string.Empty;//鐩爣浣嶇疆 - EndLocat= Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.AreaNo==storageArea.AreaNo && w.Status=="0" &&w.Flag=="0").Select(s=>s.LocatNo).First(); + EndLocat= GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo,palletNo); //寮�鍚簨鍔� Db.BeginTran(); @@ -1077,7 +1088,7 @@ Db.Updateable(stock).ExecuteCommand(); //淇敼鍌ㄤ綅鍦板潃鐘舵�� - storageLocat.Status = "3";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 + storageLocat.Status = "5";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 Db.Updateable(storageLocat).ExecuteCommand(); //娣诲姞鎿嶄綔鏃ュ織璁板綍 @@ -1095,6 +1106,51 @@ throw new Exception(ex.Message); } } + /// <summary> + /// 鏍规嵁鍖哄煙鍒嗛厤鍌ㄤ綅 + /// </summary> + /// <param name="areaNo"></param> + /// <param name="skuNo"></param> + /// <param name="lotNo"></param> + /// <returns></returns> + private string GetLocat(string areaNo,string skuNo,string lotNo,string palletNo) + { + try + { + string endLocat = string.Empty;//鐩爣鍌ㄤ綅 + //褰撶劧鍖哄煙鎵�鏈夊偍浣嶄俊鎭� + var storageLocatList = Db.Queryable<SysStorageLocat>().Where(w => w.WareHouseNo == "W02" && w.AreaNo == areaNo).ToList(); + //鍚屽尯鍩熷悓鎵规鐗╂枡鐨勫偍浣嶄俊鎭� + List<string> locatList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == skuNo && w.LotNo == lotNo && w.WareHouseNo == "W02" && w.AreaNo == areaNo && w.PalletNo != palletNo) + .OrderByDescending(o=>o.LocatNo).Select(s=>s.LocatNo).Distinct().ToList(); + foreach (var item in locatList) + { + var locatInfo = storageLocatList.Where(w => w.LocatNo == item).First(); + + var locatInfo2 = storageLocatList.Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" && w.LocatNo != locatInfo.LocatNo && w.Row == locatInfo.Row) + .OrderByDescending(o => o.Column).First(); + if (locatInfo2 != null) + { + endLocat = locatInfo2.LocatNo; + } + } + if (string.IsNullOrEmpty(endLocat)) + { + var locatInfo3 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0" && w.Status == "0") + .OrderByDescending(m => new { m.Layer, m.Column, m.Row }).First(); + + if (locatInfo3 != null) + { + endLocat = locatInfo3.LocatNo; + } + } + return endLocat; + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + } #endregion } -- Gitblit v1.8.0