From 964db60bb3d2e9a0a695b71554a98765e900732a Mon Sep 17 00:00:00 2001 From: yuyou_x <2336760928@qq.com> Date: 星期六, 16 三月 2024 10:58:34 +0800 Subject: [PATCH] Merge branch 'yyk' --- Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 202 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 158 insertions(+), 44 deletions(-) diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs index b0ba6db..c3031a1 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs @@ -17,6 +17,7 @@ using Model.ModelDto.PdaDto; using Dm; using Model.InterFaceModel; +using WMS.Entity.BllQualityEntity; namespace WMS.BLL.BllPdaServer { @@ -33,6 +34,23 @@ // 鏈叧鍗曠殑鍗曟嵁 sqlString = $"select * from BllArrivalNotice where Type in ({model.Type}) and Status != '3' and Status != '4' and IsDel='0' order by CreateTime;"; var modelList = Db.Ado.SqlQuery<ArrivalNoticeDto>(sqlString); + + return modelList; + } + catch (Exception ex) + { + throw ex; + } + } + + //鏍规嵁鍏ュ簱鍗曞彿鑾峰彇鍏ュ簱鎬诲崟淇℃伅 + public List<BllArrivalNotice> GetArrivalNotice(ArrivalNoticeVm model) + { + string sqlString = string.Empty; + try + { + sqlString = $"select * from BllArrivalNotice where ASNNo = '{model.ASNNo}' and isdel='0' "; + var modelList = Db.Ado.SqlQuery<BllArrivalNotice>(sqlString); return modelList; } @@ -1286,7 +1304,7 @@ /// </summary> /// <param name="locatNo">鍌ㄤ綅缂栫爜</param> /// <returns></returns> - public string CheckLocatNo(string locatNo) + public string CheckLocatNo(string locatNo) { try { @@ -1771,9 +1789,9 @@ } //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟 var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); - if (notice.Status != "0" && notice.Status != "1") + if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2") { - throw new Exception("-1:鍏ュ簱鍗曠姸鎬佷笉鏄瓑寰呮墽琛屾垨鎵ц瀹屾垚!"); + throw new Exception("-1:璇ュ崟鎹凡鍏冲崟!"); } if (string.IsNullOrEmpty(model.LotNo)) { @@ -1791,6 +1809,10 @@ if (indexOfDash != -1) { model.LotNo = model.LotNo.Substring(indexOfDash + 1); + } + else + { + model.LotNo = ""; } } //鍒ゆ柇鐗╂枡鏁伴噺鏄惁涓�0 涓�0鍒ゆ柇绠辩爜淇℃伅 涓嶄负0缁х画 @@ -1810,6 +1832,52 @@ } } + int isDeposit = 0; + //鍒ゆ柇鎬诲崟鍗曟嵁鏄惁涓哄瘎瀛樺崟鎹� + if (notice.Type == "7") + { + isDeposit = 1; + } + if (isDeposit == 1) + { + //鍒ゆ柇鎬诲崟澶囨敞鏄惁涓虹┖ + if (!string.IsNullOrWhiteSpace(notice.Demo)) + { + //鍒嗗壊鎬诲崟澶囨敞鍙婃墭鐩樺娉� + var noticeDemo = notice.Demo.Split('銆�'); //鎬诲崟澶囨敞 + var palletDemo = model.Demo.Split('銆�'); //鎵樼洏澶囨敞 + + //寰幆鎵樼洏澶囨敞 + foreach (var itemPallet in palletDemo) + { + int isDemo = 0; + //寰幆鎬诲崟澶囨敞 + foreach (var itemNotice in noticeDemo) + { + //鍒ゆ柇鏄惁鏈夌浉鍚屽娉� + if (itemPallet == itemNotice) + { + isDemo = 1; + break; + } + } + if (isDemo == 0) + { + throw new Exception("-1:鎬诲崟澶囨敞涓庢墭鐩樺娉ㄤ笉绗︼紝璇锋牳瀹炲悗閲嶆柊缁戝畾!"); + } + } + } + else if (string.IsNullOrWhiteSpace(notice.Demo)) + { + //鍒ゆ柇鎵樼洏澶囨敞鏄惁涓虹┖ + if (!string.IsNullOrWhiteSpace(model.Demo)) + { + throw new Exception("-1:璇锋坊鍔犳�诲崟澶囨敞鍚庤緭鍏ユ墭鐩樺娉�!"); + } + } + } + + #endregion Db.BeginTran(); @@ -1827,7 +1895,7 @@ throw new Exception("璇ユ墭鐩樻湭鍦ㄥ簱澶栵紝璇锋牳瀹烇紒"); } // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦� - var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && model.LotNo.Contains(m.LotNo)); + var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo)); if (detail == null) { throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!"); @@ -1836,40 +1904,46 @@ var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0"); var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo); var pack = package.First(m => m.IsDel == "0" && m.PackagNo == sku.PackagNo); - if (pack == null) - { - throw new Exception("-1:鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!"); - } + var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺 var bNum = 0;//绠辩爜鐗╁搧鏁伴噺 - if (pack.L5Num.HasValue) + + //鍒ゆ柇鏄惁涓哄瘎瀛樼墿鏂� + if (isDeposit == 0) { - pNum = (int)pack.L5Num; - bNum = (int)pack.L4Num; - } - else if (pack.L4Num.HasValue) - { - pNum = (int)pack.L4Num; - bNum = (int)pack.L3Num; - } - else if (pack.L3Num.HasValue) - { - pNum = (int)pack.L3Num; - bNum = (int)pack.L2Num; - } - else if (pack.L2Num.HasValue) - { - pNum = (int)pack.L2Num; - bNum = (int)pack.L1Num; - } - else if (pack.L1Num.HasValue) - { - pNum = (int)pack.L1Num; - bNum = (int)pack.L1Num; - } - if (pNum == 0 || bNum == 0) - { - throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒"); + if (pack == null) + { + throw new Exception("-1:鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!"); + } + if (pack.L5Num.HasValue) + { + pNum = (int)pack.L5Num; + bNum = (int)pack.L4Num; + } + else if (pack.L4Num.HasValue) + { + pNum = (int)pack.L4Num; + bNum = (int)pack.L3Num; + } + else if (pack.L3Num.HasValue) + { + pNum = (int)pack.L3Num; + bNum = (int)pack.L2Num; + } + else if (pack.L2Num.HasValue) + { + pNum = (int)pack.L2Num; + bNum = (int)pack.L1Num; + } + else if (pack.L1Num.HasValue) + { + pNum = (int)pack.L1Num; + bNum = (int)pack.L1Num; + } + if (pNum == 0 || bNum == 0) + { + throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒"); + } } #endregion @@ -1888,7 +1962,7 @@ } } #endregion - var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo); + var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo && m.Status != "2"); var bindId = 0; if (bind == null) { @@ -1905,14 +1979,16 @@ Type = "0", LotNo = model.LotNo, LotText = detail.LotText, - SupplierLot = "", + SupplierLot = detail.SupplierLot, InspectMark = "0", BitPalletMark = "1", IsBale = "0", IsBelt = "0", - CreateUser = userId + CreateUser = userId, + Demo = model.Demo, + }; - if (model.SkuQty > pNum) + if (model.SkuQty > pNum && isDeposit == 0) { throw new Exception($"缁戝畾澶辫触锛寋model.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒"); } @@ -2002,7 +2078,7 @@ // 鏇存柊鎵樼洏缁戝畾琛� bind.Qty += factQty; } - if (bind.FullQty < bind.Qty) + if (bind.FullQty < bind.Qty && isDeposit == 0) { throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺"); } @@ -2011,7 +2087,7 @@ { bind.BitPalletMark = "0"; } - if (bind.Qty > pNum) + if (bind.Qty > pNum && isDeposit == 0) { throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒"); } @@ -2149,13 +2225,13 @@ #endregion #region 绠辩爜淇℃伅 - var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList(); + var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo && w.PalletNo == model.PalletNo).ToList(); // type 0:鎴愬搧鍏ュ簱 1:閲囪喘鍏ュ簱 2:涓棿鍝佸叆搴� 3:閫�璐у叆搴� 4:杞﹂棿浣欐枡閫�鍥炲叆搴� 5:鍏跺畠鍏ュ簱 6:浠e偍鍏ュ簱 7:瀵勫瓨鍏ュ簱 if (notice.Type == "2" || notice.Type == "6" || notice.Type == "7") { // 涓嶈创鐮佺墿鏂� 鏃犻渶楠岃瘉绠辩爜淇℃伅 } - else + else { //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪 if (boxInfoList.Count <= 0) @@ -2223,6 +2299,12 @@ CreateUser = (int)model.CreateUser, CreateTime = serverTime }; + //缁存姢搴撳瓨璐т富淇℃伅 + if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱 + { + stockModel.OwnerNo = notice.CustomerNo;//璐т富缂栫爜 + stockModel.OwnerName = notice.CustomerName;//璐т富鍚嶇О + } //鏂板搴撳瓨鎬讳俊鎭� Db.Insertable<DataStock>(stockModel).ExecuteCommand(); } @@ -2275,11 +2357,43 @@ PackagNo = sku.PackagNo, IsBale = bindInfo.IsBale, IsBelt = bindInfo.IsBelt, + CreateUser = (int)model.CreateUser, CreateTime = serverTime }; + //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭� + if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱 + { + detailModel.OwnerNo = notice.CustomerNo;//璐т富缂栫爜 + detailModel.OwnerName = notice.CustomerName;//璐т富鍚嶇О + } + else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱 + { + detailModel.SupplierNo = notice.CustomerNo;//渚涘簲鍟嗙紪鐮� + detailModel.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉� + } + #region 缁存姢璐ㄦ缁撴灉 + //鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉 + var quality = Db.Queryable<BllQualityInspect>().Where(a => a.LotNo == noticeDetail.LotNo && a.IsDel == "0").OrderByDescending(a => a.CreateTime).First(); + if (quality != null) + { + //淇敼鍚堟牸涓嶅悎鏍兼暟閲� + if (quality.IsQualified == "1") //鍚堟牸 + { + //澧炲姞鍚堟牸鏁伴噺 + quality.PassQty += detailModel.Qty; + detailModel.InspectStatus = "1"; + } + else if (quality.IsQualified == "0") //涓嶅悎鏍� + { + //澧炲姞涓嶅悎鏍兼暟閲� + quality.FailQty += detailModel.Qty; + detailModel.InspectStatus = "2"; + } + Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅 + } + #endregion stId = Db.Insertable<DataStockDetail>(detailModel).ExecuteReturnIdentity(); - } else { -- Gitblit v1.8.0