From 7a5f2b3bdb3346c6a2d73aeacdb58c8e366606ea Mon Sep 17 00:00:00 2001
From: yuyou_x <2336760928@qq.com>
Date: 星期一, 04 三月 2024 16:04:28 +0800
Subject: [PATCH] Merge branch 'yyk'

---
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |  145 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 108 insertions(+), 37 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index b0ba6db..5afee30 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -42,6 +42,23 @@
             }
         }
 
+        //鏍规嵁鍏ュ簱鍗曞彿鑾峰彇鍏ュ簱鎬诲崟淇℃伅
+        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;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
         // 鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
         public List<ArrivalNoticeDetailDto> GetArrivalNoticeDetails(ArrivalNoticeVm model)
         {
@@ -1286,7 +1303,7 @@
         /// </summary>
         /// <param name="locatNo">鍌ㄤ綅缂栫爜</param>
         /// <returns></returns>
-        public string CheckLocatNo(string locatNo) 
+        public string CheckLocatNo(string locatNo)
         {
             try
             {
@@ -1810,6 +1827,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();
@@ -1836,40 +1899,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
 
@@ -1910,9 +1979,11 @@
                         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 +2073,7 @@
                     // 鏇存柊鎵樼洏缁戝畾琛�
                     bind.Qty += factQty;
                 }
-                if (bind.FullQty < bind.Qty)
+                if (bind.FullQty < bind.Qty && isDeposit == 0)
                 {
                     throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
                 }
@@ -2011,7 +2082,7 @@
                 {
                     bind.BitPalletMark = "0";
                 }
-                if (bind.Qty > pNum)
+                if (bind.Qty > pNum && isDeposit == 0)
                 {
                     throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
                 }
@@ -2155,7 +2226,7 @@
                     {
                         // 涓嶈创鐮佺墿鏂� 鏃犻渶楠岃瘉绠辩爜淇℃伅
                     }
-                    else 
+                    else
                     {
                         //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪
                         if (boxInfoList.Count <= 0)

--
Gitblit v1.8.0