From f147cfa91feec613eb304c78fecafdf43286034a Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期六, 30 三月 2024 11:12:24 +0800
Subject: [PATCH] Merge branch 'wxw'

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |  126 ++++++++++++++++++++++-------------------
 1 files changed, 68 insertions(+), 58 deletions(-)

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index e40b61e..17d6ceb 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -506,7 +506,8 @@
                     SkuName = it.SkuName,
                     LotNo = it.LotNo,
                     Standard = it.Standard,
-                    Qty = type == "4" ? it.Qty : it.Qty - it.LockQty - it.FrozenQty
+                    //Qty = type == "4" ? it.Qty : it.Qty - it.LockQty - it.FrozenQty,
+                    Qty = it.Qty - it.LockQty - it.FrozenQty,
 
                 }).ToList();
 
@@ -2548,6 +2549,38 @@
                     {
                         throw new Exception("鏈煡璇㈠埌浠诲姟淇℃伅");
                     }
+                    //鑾峰彇瀵瑰簲搴撲綅淇℃伅
+                    var startlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    if (startlocat == null)
+                    {
+                        throw new Exception("鏈煡璇㈠埌鍌ㄤ綅淇℃伅");
+                    }
+                    startlocat.Status = "0";//淇敼鍒嗛厤淇℃伅鐘舵��
+                    //鑾峰彇鍌ㄤ綅淇℃伅
+                    var locat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
+                    //鑾峰彇绉诲簱浠籨鍔″搴旂洰鏍囧偍浣嶄俊鎭�
+                    SysStorageLocat endlocat = new SysStorageLocat();
+                    if (task.Type == "2")
+                    {
+                        endlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.EndLocat);
+                        if (endlocat == null)
+                        {
+                            throw new Exception("鏈煡璇㈠埌鐩爣鍌ㄤ綅淇℃伅");
+                        }
+                    }
+                    if (locat == null)
+                    {
+                        Db.RollbackTran();
+                        throw new Exception("鏈煡璇㈠埌鍌ㄤ綅淇℃伅锛岃鏍稿疄锛�");
+                    }
+                    locat.Status = "1"; //鏈夌墿鍝�
+                    Db.Updateable(locat).ExecuteCommand();
+                    if (endlocat != null)
+                    {
+                        endlocat.Status = "0"; //绌哄偍浣� 0
+                        Db.Updateable(endlocat).ExecuteCommand();
+                    }
+
                     //淇敼浠诲姟 
                     task.IsSuccess = 1;
                     task.IsSend = 0;
@@ -2571,31 +2604,6 @@
 
                         noticeDetail.FactQty -= item.Qty; //淇敼鍑哄簱鍗曟槑缁嗙殑涓嬫灦鏁伴噺
                         Db.Updateable(noticeDetail).ExecuteCommand();
-
-                        //鑾峰彇鍌ㄤ綅淇℃伅
-                        var locat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W01" && a.LocatNo == task.StartLocat);
-                        //鑾峰彇绉诲簱浠诲姟瀵瑰簲鐩爣鍌ㄤ綅淇℃伅
-                        SysStorageLocat endlocat = new SysStorageLocat();
-                        if (task.Type == "2")
-                        {
-                            endlocat = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.WareHouseNo == "W03" && a.LocatNo == task.EndLocat);
-                            if (endlocat == null)
-                            {
-                                throw new Exception("鏈煡璇㈠埌鐩爣鍌ㄤ綅淇℃伅");
-                            }
-                        }
-                        if (locat == null)
-                        {
-                            Db.RollbackTran();
-                            throw new Exception("鏈煡璇㈠埌鍌ㄤ綅淇℃伅锛岃鏍稿疄锛�");
-                        }
-                        locat.Status = "1"; //鏈夌墿鍝�
-                        Db.Updateable(locat).ExecuteCommand();
-                        if (endlocat != null)
-                        {
-                            endlocat.Status = "0"; //绌哄偍浣� 0
-                            Db.Updateable(endlocat).ExecuteCommand();
-                        }
 
                         if (noticeDetail.FactQty == 0)
                         {
@@ -2838,7 +2846,7 @@
                         }
                         else
                         {
-                            stockDetail = stockDetail.Where(m => m.SkuNo == detail.SkuNo && m.IsDel == "0").ToList(); //&& string.IsNullOrWhiteSpace(m.LotNo)
+                            stockDetail = stockDetail.Where(m => m.SkuNo == detail.SkuNo && m.IsDel == "0" && string.IsNullOrWhiteSpace(m.LotNo)).ToList(); //
                         }
 
                         if (stockDetail.Count < 1)
@@ -2866,41 +2874,43 @@
                         #region 鍖呰淇℃伅
 
                         var pack = packList.FirstOrDefault(p => p.PackagNo == detail.PackagNo);
-                        if (pack == null)
-                        {
-                            throw new Exception("鏈煡璇㈠埌鐗╂枡鍖呰");
-                        }
                         var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺
                         var bNum = 0;//绠辩墿鍝佹暟閲�
-                        if (pack.L5Num.HasValue)
+                        if (pack != null)
                         {
-                            pNum = Convert.ToInt32(pack.L5Num);
-                            bNum = Convert.ToInt32(pack.L4Num);
+                            //throw new Exception("鏈煡璇㈠埌鐗╂枡鍖呰");
+                            if (pack.L5Num.HasValue)
+                            {
+                                pNum = Convert.ToInt32(pack.L5Num);
+                                bNum = Convert.ToInt32(pack.L4Num);
+                            }
+                            else if (pack.L4Num.HasValue)
+                            {
+                                pNum = Convert.ToInt32(pack.L4Num);
+                                bNum = Convert.ToInt32(pack.L3Num);
+                            }
+                            else if (pack.L3Num.HasValue)
+                            {
+                                pNum = Convert.ToInt32(pack.L3Num);
+                                bNum = Convert.ToInt32(pack.L2Num);
+                            }
+                            else if (pack.L2Num.HasValue)
+                            {
+                                pNum = Convert.ToInt32(pack.L2Num);
+                                bNum = Convert.ToInt32(pack.L1Num);
+                            }
+                            else if (pack.L1Num.HasValue)
+                            {
+                                pNum = Convert.ToInt32(pack.L1Num);
+                                bNum = Convert.ToInt32(pack.L1Num);
+                            }
                         }
-                        else if (pack.L4Num.HasValue)
-                        {
-                            pNum = Convert.ToInt32(pack.L4Num);
-                            bNum = Convert.ToInt32(pack.L3Num);
-                        }
-                        else if (pack.L3Num.HasValue)
-                        {
-                            pNum = Convert.ToInt32(pack.L3Num);
-                            bNum = Convert.ToInt32(pack.L2Num);
-                        }
-                        else if (pack.L2Num.HasValue)
-                        {
-                            pNum = Convert.ToInt32(pack.L2Num);
-                            bNum = Convert.ToInt32(pack.L1Num);
-                        }
-                        else if (pack.L1Num.HasValue)
-                        {
-                            pNum = Convert.ToInt32(pack.L1Num);
-                            bNum = Convert.ToInt32(pack.L1Num);
-                        }
-                        if (pNum == 0)
-                        {
-                            throw new Exception("鏈煡璇㈠埌鐗╂枡鍖呰鎵樼鍏崇郴淇℃伅");
-                        }
+                       
+                        
+                        //if (pNum == 0)
+                        //{
+                        //    throw new Exception("鏈煡璇㈠埌鐗╂枡鍖呰鎵樼鍏崇郴淇℃伅");
+                        //}
                         #endregion
                         //鍙栧悎閫傚簱瀛樺晢鍝�
                         Dictionary<int, decimal> stockQtyDic = new Dictionary<int, decimal>();//鎵樺嚭搴撶墿鍝佹暟

--
Gitblit v1.8.0