From 8db84793a19b02df61c8fb9e5d539c57b827da45 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 28 六月 2024 16:53:58 +0800 Subject: [PATCH] 修改问题 --- Wms/WMS.BLL/DataServer/StockDetailServer.cs | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-) diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs index 732a837..9d629d2 100644 --- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs +++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs @@ -9,6 +9,7 @@ using WMS.Entity.BllQualityEntity; using WMS.Entity.Context; using WMS.Entity.DataEntity; +using WMS.Entity.SysEntity; using WMS.IBLL.IDataServer; namespace WMS.BLL.DataServer @@ -403,5 +404,102 @@ } } #endregion + + #region 浜屾ゼ涓氬姟 + /// <summary> + /// 娣诲姞鎵樼洏搴撳瓨鏄庣粏 + /// </summary> + public void InsertStockDetail(string PalletNo,string WareHouseNo,string AreaNo,string LocatNo, string PalletStatus, string SkuNo, string SkuName, string LotNo, int userId) + { + try + { + if (string.IsNullOrEmpty(PalletNo)) + { + throw new Exception("鎵樼洏鍙蜂笉鑳戒负绌�!"); + } + if (string.IsNullOrEmpty(WareHouseNo)) + { + throw new Exception("鎵�灞炰粨搴撲笉鑳戒负绌�!"); + } + if (string.IsNullOrEmpty(AreaNo)) + { + throw new Exception("鎵�灞炲尯鍩熶笉鑳戒负绌�!"); + } + if (string.IsNullOrEmpty(LocatNo)) + { + throw new Exception("鍌ㄤ綅鍦板潃涓嶈兘涓虹┖!"); + } + if (string.IsNullOrEmpty(PalletStatus)) + { + throw new Exception("鎵樼洏鐘舵�佷笉鑳戒负绌�!"); + } + var palletInfo = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == PalletNo); + if (palletInfo != null) + { + throw new Exception($"搴撳瓨涓凡鏈夌紪鍙蜂负锛歿PalletNo}鐨勬槑缁嗭紝璇峰嬁閲嶅娣诲姞!"); + } + //鐩爣鍌ㄤ綅淇℃伅 + var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == LocatNo && w.Status == "0" && w.IsDel == "0"); + if (locatInfo == null) + { + throw new Exception("鍌ㄤ綅鍦板潃涓嶅瓨鍦�!"); + } + + Db.BeginTran(); + + var comTime = DateTime.Now; + var model = new DataStockDetail() + { + Qty = 0, + LockQty = 0, + FrozenQty = 0, + InspectQty = 0, + WareHouseNo = WareHouseNo,//鎵�灞炰粨搴� + RoadwayNo = "",//鎵�灞炲贩閬� + AreaNo = AreaNo,//鎵�灞炲尯鍩� + LocatNo = LocatNo,//鍌ㄤ綅鍦板潃 + PalletNo = PalletNo, + PalletNo2 = "", + PalletNo3 = "", + PalletTags = "0", + CompleteTime = comTime, + ProductionTime = null, + ExpirationTime = null, + Status = "0", + InspectMark = "0", + InspectStatus = "0",//寰呮楠� + BitPalletMark = "0", + PackagNo = "", + IsBale = "0", + IsBelt = "0", + + SkuNo = SkuNo, + SkuName = SkuName, + LotNo = LotNo, + + PalletStatus = PalletStatus, + + IsDel = "0", + CreateUser = userId, + CreateTime = comTime + }; + //鎻掑叆搴撳瓨鏄庣粏 + Db.Insertable(model).ExecuteCommand(); + + locatInfo.Status = "1";//鏈夌墿鍝� + //淇敼鐩爣鍌ㄤ綅鐘舵�� + Db.Updateable(locatInfo).ExecuteCommand(); + + Db.CommitTran(); + } + catch (Exception e) + { + //鍥炴粴浜嬪姟 + Db.RollbackTran(); + throw new Exception(e.Message); + } + } + + #endregion } } -- Gitblit v1.8.0