From a9522f978edf6dee98949f9ed715fc36f999ed4f Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期五, 22 三月 2024 15:37:04 +0800
Subject: [PATCH] 修改bug问题

---
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 7172e55..42f39e2 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -313,24 +313,30 @@
                 {
                     throw new Exception($"{palletNo}鎵樼洏涓婂瓨鍦ㄧ鐮佷俊鎭紝鏃犳硶鍦ㄦ暟閲忔嫞璐ц繘琛屾搷浣滐紒");
                 }
-                //鍑哄簱鍗曟槑缁�
-                var noticeDetail = Db.Queryable<BllExportNoticeDetail>().First(a => a.Id == int.Parse(soDetailId) && a.IsDel == "0");
-                if (noticeDetail == null)
+
+                BllExportAllot allot = null;
+                if (!string.IsNullOrWhiteSpace(soDetailId))
                 {
-                    throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟槑缁嗕俊鎭紝璇锋牳瀹烇紒");
+                    //鍑哄簱鍗曟槑缁�
+                    var noticeDetail = Db.Queryable<BllExportNoticeDetail>().First(a => a.Id == int.Parse(soDetailId) && a.IsDel == "0");
+                    if (noticeDetail == null)
+                    {
+                        throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟槑缁嗕俊鎭紝璇锋牳瀹烇紒");
+                    }
+                    //鍑哄簱鍗曟�诲崟
+                    var notice = Db.Queryable<BllExportNotice>().First(a => a.IsDel == "0" && a.SONo == noticeDetail.SONo);
+                    if (notice == null)
+                    {
+                        throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟�诲崟淇℃伅锛岃鏍稿疄锛�");
+                    }
+                    //鍒嗛厤淇℃伅
+                    allot = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.PalletNo == palletNo && (a.Status == "2" || a.Status == "3"));
+                    if (allot == null)
+                    {
+                        throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍒嗛厤淇℃伅锛岃鏍稿疄锛�");
+                    }
                 }
-                //鍑哄簱鍗曟�诲崟
-                var notice = Db.Queryable<BllExportNotice>().First(a => a.IsDel == "0" && a.SONo == noticeDetail.SONo);
-                if (notice == null)
-                {
-                    throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟�诲崟淇℃伅锛岃鏍稿疄锛�");
-                }
-                //鍒嗛厤淇℃伅
-                var allot = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.PalletNo == palletNo && (a.Status == "2" || a.Status == "3"));
-                if (allot == null)
-                {
-                    throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍒嗛厤淇℃伅锛岃鏍稿疄锛�");
-                }
+                
                 //搴撳瓨鏄庣粏
                 var detail = Db.Queryable<DataStockDetail>().First(a => a.IsDel == "0" && a.PalletNo == palletNo);
                 if (detail == null)
@@ -346,8 +352,8 @@
                 {
                     SkuNo = detail.SkuNo,
                     BoxNo = detail.SkuNo,
-                    Qty = (int)allot.Qty,
-                    PickedQty = (int)allot.CompleteQty,
+                    Qty = allot == null ? (int)(detail.Qty-detail.LockQty) : (int)allot.Qty,
+                    PickedQty = allot == null ? 0 : (int)allot.CompleteQty,
                 };
 
                 pdaInfo.Add(info);

--
Gitblit v1.8.0