From e34f379c22862982c20376c952ab56f9c4ccb163 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期二, 25 六月 2024 08:08:04 +0800
Subject: [PATCH] 修改controller

---
 Wms/WMS.BLL/DataServer/StockDetailServer.cs |   82 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
index 732a837..6b1cfdc 100644
--- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs
+++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
@@ -403,5 +403,87 @@
             }
         }
         #endregion
+
+        #region 浜屾ゼ涓氬姟
+        /// <summary>
+        /// 娣诲姞鎵樼洏搴撳瓨鏄庣粏
+        /// </summary>
+        public void InsertStockDetail(string PalletNo,string WareHouseNo,string AreaNo,string LocatNo, string PalletStatus,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}鐨勬槑缁嗭紝璇峰嬁閲嶅娣诲姞!");
+                }
+                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",
+
+                    PalletStatus = PalletStatus,
+
+                    IsDel = "0",
+                    CreateUser = userId,
+                    CreateTime = comTime
+                };
+                //鎻掑叆搴撳瓨鏄庣粏
+                Db.Insertable(model).ExecuteCommand();
+
+                Db.CommitTran();
+            }
+            catch (Exception e)
+            {
+                //鍥炴粴浜嬪姟
+                Db.RollbackTran();
+                throw new Exception(e.Message);
+            }
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0