From 87d55df7b7446d7c4c3532a2dd2e78f72574e34b Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 21 二月 2024 08:23:53 +0800
Subject: [PATCH] Merge branch 'master' into wxw

---
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |   94 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 72 insertions(+), 22 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 8ac6d65..a3ce8d4 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -1281,6 +1281,30 @@
             }
         }
 
+        /// <summary>
+        /// 楠岃瘉鍌ㄤ綅鍦板潃(鍦扮爜)鏄惁鍙敤
+        /// </summary>
+        /// <param name="locatNo">鍌ㄤ綅缂栫爜</param>
+        /// <returns></returns>
+        public string CheckLocatNo(string locatNo) 
+        {
+            try
+            {
+                string strMsg = "";
+                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == locatNo && w.Status == "0" && w.WareHouseNo == "W02");
+                if (storageLocat == null)
+                {
+                    throw new Exception("-1:鍦扮爜(鍌ㄤ綅淇℃伅)涓嶅瓨鍦ㄦ垨闈炵┖闂茬姸鎬侊紝璇锋牳鏌�!");
+                }
+
+                return strMsg;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
         //鏍规嵁绠辩爜鑾峰彇鐗╂枡銆佹壒娆°�佹暟閲忕瓑淇℃伅
         public PdaPalletNoCheckDto GetBoxInfoByBoxNo(string boxNo)
         {
@@ -1687,9 +1711,24 @@
                         string[] LotNoList = item.LotNo.Split(';');
                         foreach (var item2 in LotNoList)
                         {
-                            ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto();
-                            entry = item;
-                            entry.LotNo = item2;
+                            ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto()
+                            {
+                                Id = item.Id,
+                                ASNNo = item.ASNNo,
+                                CompleteQty = item.CompleteQty,
+                                CompleteTime = item.CompleteTime,
+                                CreateTime = item.CreateTime,
+                                Qty = item.Qty,
+                                FactQty = item.FactQty,
+                                LotNo = item2,
+                                Money = item.Money,
+                                PackagNo = item.PackagNo,
+                                PackagName = item.PackagName,
+                                Status = item.Status,
+                                SkuNo = item.SkuNo,
+                                SkuName = item.SkuName,
+                            };
+
 
                             noticeList.Add(entry);
                         }
@@ -1877,6 +1916,7 @@
                         throw new Exception("-1:褰撳墠鎵樼洏姝e湪鎵ц涓紝缁戝畾澶辫触锛岃鏍稿疄!");
                     }
                     bindId = bind.Id;
+                    bind.Qty += model.SkuQty;
                 }
 
                 #region 绠辩爜淇℃伅
@@ -1911,6 +1951,7 @@
 
                 // 鏇存敼绠辨敮鍏崇郴琛�
                 decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
+                //鎴愬搧缁勬墭
                 if (model.SkuQty == 0)
                 {
                     var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList();
@@ -1970,7 +2011,7 @@
                 var sqlString = string.Empty;
                 if (factQty == 0)
                 {
-                    sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';";
+                    sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{model.SkuQty}' where id = '{model.AsnDetailId}';";
                 }
                 else
                 {
@@ -2062,7 +2103,7 @@
                         throw new Exception("璇ユ墭鐩樻湭鍦ㄥ簱澶栵紝璇锋牳鏌�!");
                     }
                 }
-                
+
                 #endregion
 
                 #region 鍦扮爜淇℃伅(鍌ㄤ綅淇℃伅)
@@ -2076,22 +2117,6 @@
                 Db.BeginTran();//寮�鍚簨鍔�
                 if (iscount == 0)//姝e父鍏ュ簱
                 {
-                    #region 绠辩爜淇℃伅
-                    var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList();
-                    //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪
-                    if (boxInfoList.Count <= 0)
-                    {
-                        throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
-                    }
-                    foreach (var item in boxInfoList)
-                    {
-                        item.Status = "2"; // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴�
-                        item.UpdateTime = serverTime;
-                        item.UpdateUser = model.CreateUser;
-                    }
-                    Db.Updateable(boxInfoList).ExecuteCommand();
-                    #endregion
-
                     #region 鍏ュ簱鎬诲崟淇℃伅
                     var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.Status != "3" && a.ASNNo == model.ASNNo);
                     //楠岃瘉鍏ュ簱鍗曟�诲崟鏄惁鍏抽棴
@@ -2103,6 +2128,30 @@
                     if (notice.Status == "3")
                     {
                         throw new Exception("鍏ュ簱鍗曟�诲崟宸插叧闂紝璇锋牳鏌�!");
+                    }
+                    #endregion
+
+                    #region 绠辩爜淇℃伅
+                    var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList();
+                    // type 0:鎴愬搧鍏ュ簱 1:閲囪喘鍏ュ簱 2:涓棿鍝佸叆搴� 3:閫�璐у叆搴� 4:杞﹂棿浣欐枡閫�鍥炲叆搴� 5:鍏跺畠鍏ュ簱 6:浠e偍鍏ュ簱 7:瀵勫瓨鍏ュ簱
+                    if (notice.Type == "2" || notice.Type == "6" || notice.Type == "7")
+                    {
+                        // 涓嶈创鐮佺墿鏂� 鏃犻渶楠岃瘉绠辩爜淇℃伅
+                    }
+                    else 
+                    {
+                        //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪
+                        if (boxInfoList.Count <= 0)
+                        {
+                            throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+                        }
+                        foreach (var item in boxInfoList)
+                        {
+                            item.Status = "2"; // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴�
+                            item.UpdateTime = serverTime;
+                            item.UpdateUser = model.CreateUser;
+                        }
+                        Db.Updateable(boxInfoList).ExecuteCommand();
                     }
                     #endregion
 
@@ -2194,7 +2243,7 @@
                             ASNDetailNo = (int)bindInfo.ASNDetailNo,
                             WareHouseNo = "W02",
                             RoadwayNo = "",
-                            AreaNo = "",
+                            AreaNo = storageLocat.AreaNo,
                             LocatNo = model.LocatNo,
                             PalletNo = model.PalletNo,
                             PalletNo2 = bindInfo.PalletNo2,
@@ -2219,6 +2268,7 @@
                     {
                         stId = detailModel.Id;
                         detailModel.LocatNo = model.LocatNo;
+                        detailModel.AreaNo = storageLocat.AreaNo;
                         detailModel.UpdateTime = serverTime;
                         detailModel.UpdateUser = (int)model.CreateUser;
                         // 鍙樻洿鍌ㄤ綅鍦板潃

--
Gitblit v1.8.0