From 35d7109801b437fad4514047db521ae358a1b7ca Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期一, 30 六月 2025 14:11:25 +0800 Subject: [PATCH] Merge branch 'wxw' --- Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 108 insertions(+), 0 deletions(-) diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs index 46d0078..80ad10c 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs @@ -29,6 +29,7 @@ using Model.ModelVm.SysVm; using System.Security.Cryptography.X509Certificates; using AutoMapper.Configuration.Annotations; +using Utility; namespace WMS.BLL.BllPdaServer { @@ -6515,6 +6516,113 @@ } #endregion + #region 浠撳簱鏀惰揣 + /// <summary> + /// 浠撳簱纭鏀惰揣 + /// </summary> + /// <param name="model"></param> + public void ConfirmTakeOf(string palletNo,int userId) + { + try + { + #region 楠岃瘉淇℃伅 + if (string.IsNullOrEmpty(palletNo)) + { + throw new Exception("鎵樼洏鏉$爜涓嶈兘涓虹┖!"); + } + + //鑾峰彇鎵樼洏淇℃伅 + var pallet = Db.Queryable<SysPallets>().First(w => w.IsDel == "0" && w.PalletNo == palletNo); + //楠岃瘉鎵樼洏淇℃伅鏄惁涓虹┖ + if (pallet == null) + { + throw new Exception("鎵樼洏淇℃伅涓嶅瓨鍦紝璇锋鏌�!"); + } + if (pallet.Status == "0") + { + throw new Exception("鎵樼洏鏈娇鐢紝璇锋鏌�!"); + } + #endregion + + //鑾峰彇搴撳瓨鏄庣粏淇℃伅 + var stockDetailList = Db.Queryable<DataStockDetail>().Where(s => s.IsDel == "0" && s.PalletNo == palletNo).ToList(); + //楠岃瘉搴撳瓨鏄庣粏淇℃伅鏄惁瀛樺湪 + if (stockDetailList.Count<=0) + { + throw new Exception("搴撳瓨鏄庣粏涓嶅瓨鍦紝璇锋鏌ュ簱瀛樹俊鎭�!"); + } + //寮�鍚簨鍔� + Db.BeginTran(); + + foreach (var item in stockDetailList) + { + if (item.AreaNo != "B06" && item.AreaNo != "B07" && item.AreaNo != "B09") + { + throw new Exception("璇ユ墭鐩橀潪绾胯竟鍥炲簱鎵樼洏!"); + } + //搴撳瓨鎬昏〃 + var stock = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo); + if (stock == null) + { + throw new Exception($"鏈煡璇㈠埌璇ユ墭鐩樹笂鐗╂枡缂栫爜涓�:{item.SkuNo}鐨勫簱瀛樹俊鎭�!"); + } + + var boxInfoList = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == palletNo && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo).ToList(); + if (boxInfoList.Count > 0) + { + foreach (var box in boxInfoList) + { + var bllBox = Db.Queryable<BllBoxInfo>().First(w => w.IsDel == "0" && w.Status != "0"); + if (bllBox != null) + { + bllBox.Status = "0"; + bllBox.ASNDetailNo = null; + bllBox.BindNo = null; + bllBox.PalletNo = ""; + //鏇存柊绠辨敮鏄庣粏琛� + Db.Updateable(bllBox).ExecuteCommand(); + } + } + //鍒犻櫎搴撳瓨绠辩爜淇℃伅 + Db.Deleteable(boxInfoList).ExecuteCommand(); + } + + //鍒犻櫎鎴栦慨鏀瑰簱瀛� + stock.Qty -= (decimal)item.Qty; + if (stock.Qty <= 0) + { + Db.Deleteable(stock).ExecuteCommand(); + } + else + { + Db.Updateable(stock).ExecuteCommand(); + } + //鍒犻櫎搴撳瓨鏄庣粏 + Db.Deleteable(item).ExecuteCommand(); + + //鍒ゆ柇鎵樼洏涓婅繕鏈夋病鏈夊叾浠栫墿鏂� + var palletData = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && w.Id != item.Id); + if (palletData == null) + { + pallet.Status = "0"; + Db.Updateable(pallet).ExecuteCommand(); + } + } + + new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "浠撳簱鏀惰揣", palletNo, "瀹屾垚", $"鍦≒DA涓婂畬鎴愭墭鐩樼爜涓猴細{palletNo}鐨勪粨搴撴敹璐ф搷浣�", userId); + + //鎻愪氦浜嬪姟 + Db.CommitTran(); + } + catch (Exception ex) + { + //鍥炴粴浜嬪姟 + Db.RollbackTran(); + throw ex; + } + } + #endregion + #region JC23鍙栨牱涓氬姟鎺ュ彛 //鑾峰彇鏈粍鎵樻垨宸茬粍鎵樼殑绠辩爜绾у埆 -- Gitblit v1.8.0