From c250003dc425746c0b31598b8966a785a5aac473 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期六, 24 二月 2024 11:17:47 +0800 Subject: [PATCH] pda开发agv转运 --- Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 92 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 72 insertions(+), 20 deletions(-) diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs index 116e879..bc3aad1 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs @@ -1281,6 +1281,30 @@ } } + /// <summary> + /// 楠岃瘉鍌ㄤ綅鍦板潃(鍦扮爜)鏄惁鍙敤 + /// </summary> + /// <param name="locatNo">鍌ㄤ綅缂栫爜</param> + /// <returns></returns> + public string CheckLocatNo(string locatNo) + { + try + { + string strMsg = ""; + var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == locatNo && w.Status == "0" && w.WareHouseNo == "W02"); + if (storageLocat == null) + { + throw new Exception("-1:鍦扮爜(鍌ㄤ綅淇℃伅)涓嶅瓨鍦ㄦ垨闈炵┖闂茬姸鎬侊紝璇锋牳鏌�!"); + } + + return strMsg; + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + } + //鏍规嵁绠辩爜鑾峰彇鐗╂枡銆佹壒娆°�佹暟閲忕瓑淇℃伅 public PdaPalletNoCheckDto GetBoxInfoByBoxNo(string boxNo) { @@ -1737,8 +1761,6 @@ { throw new Exception("-1:鍗曟嵁鍙蜂笉鍙负绌�!"); } - //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟 - var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); if (model.AsnDetailId == null || model.AsnDetailId == 0) { throw new Exception("-1:鐗╂枡涓嶅彲涓虹┖!"); @@ -1746,6 +1768,12 @@ if (string.IsNullOrEmpty(model.PalletNo)) { throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!"); + } + //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟 + var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); + if (notice.Status != "0" && notice.Status != "1") + { + throw new Exception("-1:鍏ュ簱鍗曠姸鎬佷笉鏄瓑寰呮墽琛屾垨鎵ц瀹屾垚!"); } if (string.IsNullOrEmpty(model.LotNo)) { @@ -1791,6 +1819,12 @@ if (pallet == null) { throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�"); + } + //鍒ゆ柇鎵樼洏鏄惁鍦ㄥ簱澶� + var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo); + if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo)) + { + throw new Exception("璇ユ墭鐩樻湭鍦ㄥ簱澶栵紝璇锋牳瀹烇紒"); } // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦� var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo)); @@ -1892,6 +1926,7 @@ throw new Exception("-1:褰撳墠鎵樼洏姝e湪鎵ц涓紝缁戝畾澶辫触锛岃鏍稿疄!"); } bindId = bind.Id; + bind.Qty += model.SkuQty; } #region 绠辩爜淇℃伅 @@ -1926,6 +1961,7 @@ // 鏇存敼绠辨敮鍏崇郴琛� decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲� + //鎴愬搧缁勬墭 if (model.SkuQty == 0) { var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); @@ -1985,7 +2021,7 @@ var sqlString = string.Empty; if (factQty == 0) { - sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; + sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{model.SkuQty}' where id = '{model.AsnDetailId}';"; } else { @@ -2053,6 +2089,13 @@ //楠岃瘉搴撳瓨鏄惁鎷ユ湁璇ユ墭淇℃伅 if (stockDetail != null && stockDetail.Count > 0) { + foreach (var item in stockDetail) + { + if (!string.IsNullOrEmpty(item.WareHouseNo)) + { + throw new Exception("璇ユ墭鐩樻湭鍦ㄥ簱澶栵紝璇锋牳鏌�!"); + } + } iscount = 1; //鍥炴祦鍏ュ簱 } #endregion @@ -2084,22 +2127,6 @@ Db.BeginTran();//寮�鍚簨鍔� if (iscount == 0)//姝e父鍏ュ簱 { - #region 绠辩爜淇℃伅 - var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList(); - //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪 - if (boxInfoList.Count <= 0) - { - throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!"); - } - foreach (var item in boxInfoList) - { - item.Status = "2"; // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴� - item.UpdateTime = serverTime; - item.UpdateUser = model.CreateUser; - } - Db.Updateable(boxInfoList).ExecuteCommand(); - #endregion - #region 鍏ュ簱鎬诲崟淇℃伅 var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.Status != "3" && a.ASNNo == model.ASNNo); //楠岃瘉鍏ュ簱鍗曟�诲崟鏄惁鍏抽棴 @@ -2111,6 +2138,30 @@ if (notice.Status == "3") { throw new Exception("鍏ュ簱鍗曟�诲崟宸插叧闂紝璇锋牳鏌�!"); + } + #endregion + + #region 绠辩爜淇℃伅 + var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList(); + // type 0:鎴愬搧鍏ュ簱 1:閲囪喘鍏ュ簱 2:涓棿鍝佸叆搴� 3:閫�璐у叆搴� 4:杞﹂棿浣欐枡閫�鍥炲叆搴� 5:鍏跺畠鍏ュ簱 6:浠e偍鍏ュ簱 7:瀵勫瓨鍏ュ簱 + if (notice.Type == "2" || notice.Type == "6" || notice.Type == "7") + { + // 涓嶈创鐮佺墿鏂� 鏃犻渶楠岃瘉绠辩爜淇℃伅 + } + else + { + //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪 + if (boxInfoList.Count <= 0) + { + throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!"); + } + foreach (var item in boxInfoList) + { + item.Status = "2"; // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴� + item.UpdateTime = serverTime; + item.UpdateUser = model.CreateUser; + } + Db.Updateable(boxInfoList).ExecuteCommand(); } #endregion @@ -2202,7 +2253,7 @@ ASNDetailNo = (int)bindInfo.ASNDetailNo, WareHouseNo = "W02", RoadwayNo = "", - AreaNo = "", + AreaNo = storageLocat.AreaNo, LocatNo = model.LocatNo, PalletNo = model.PalletNo, PalletNo2 = bindInfo.PalletNo2, @@ -2227,6 +2278,7 @@ { stId = detailModel.Id; detailModel.LocatNo = model.LocatNo; + detailModel.AreaNo = storageLocat.AreaNo; detailModel.UpdateTime = serverTime; detailModel.UpdateUser = (int)model.CreateUser; // 鍙樻洿鍌ㄤ綅鍦板潃 -- Gitblit v1.8.0