From 3ffc9e207b22b4fff12e601aeb512b8d373e5a9d Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 30 十月 2025 17:01:05 +0800
Subject: [PATCH] 修改问题

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

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index 294d448..fd465ab 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -997,10 +997,10 @@
                         inspectStatus = "1";
                         break;
                     case "1"://棰嗘枡鍑哄簱
-                        if (house != "W02")
-                        {
-                            throw new Exception("棰嗘枡鍑哄簱鍙兘閫夋嫨鍘熸枡搴�");
-                        }
+                        //if (house != "W02")
+                        //{
+                        //    throw new Exception("棰嗘枡鍑哄簱鍙兘閫夋嫨鍘熸枡搴�");
+                        //}
                         skuType = "(0,1,3)";
                         inspectStatus = "1";
                         break;
@@ -1097,7 +1097,7 @@
                     skuList = skuList.Where(m => m.SkuNo == "100088").ToList();
                 }
                 skuStrList = skuList.Select(m => m.SkuNo).ToList();
-                var areaStr = new List<string>() { "B06", "B07", "B09" };
+                var areaStr = new List<string>() { "B06", "B07", "B09", "B24" };
                 var stockRst = new StockServer();
                 var stockDetailRst = new StockDetailServer();
                 Expression<Func<DataStockDetail, bool>> item = Expressionable.Create<DataStockDetail>()
@@ -1194,6 +1194,12 @@
                         //}
                         break;
                     case "W02"://鍘熸枡搴�
+                        if (skuList.Any(m => m.Type == "2"))
+                        {
+                            throw new Exception("浠撳簱涓庡嚭搴撶墿鏂欎笉绗�");
+                        }
+                        break;
+                    case "W04"://骞冲簱
                         if (skuList.Any(m => m.Type == "2"))
                         {
                             throw new Exception("浠撳簱涓庡嚭搴撶墿鏂欎笉绗�");
@@ -2765,8 +2771,8 @@
                         }
                         #region 鍖呰淇℃伅
 
-                        var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺
-                        var bNum = 0;//绠辩墿鍝佹暟閲�
+                        var pNum = 0m;//鎵樼洏鐗╁搧鏁伴噺
+                        var bNum = 0m;//绠辩墿鍝佹暟閲�
                         //鍏叡鏂规硶鑾峰彇鍖呰鏁伴噺
                         new Common().GetPackQtyInfo(detail.PackagNo, ref pNum, ref bNum);
 
@@ -2774,7 +2780,8 @@
 
                         //鍙栧悎閫傚簱瀛樺晢鍝�
                         Dictionary<int, decimal> stockQtyDic = new Dictionary<int, decimal>();//鎵樺嚭搴撶墿鍝佹暟
-                        var qty = 0m;
+                        var qty = 0m;//鍒嗛厤鏁伴噺
+                        var xQty = 0m;//涓嬫灦鏁伴噺
                         var house = "";
 
                         //鍒嗛厤璐х墿
@@ -2810,6 +2817,11 @@
                                 CreateUser = userId,
                                 CreateTime = DateTime.Now
                             };
+                            if (s.WareHouseNo == "W04")
+                            {
+                                allot.Status = "2";//寰呮嫞璐�
+                                xQty += allot.Qty;
+                            }
                             exAllotList.Add(allot);
 
                             s.LockQty += stockQtyDic[s.Id];
@@ -2822,11 +2834,12 @@
                             {
                                 s.Status = "1";
                             }
-
+                           
                             var sd = Db.Updateable(s).UpdateColumns(it => new { it.LockQty, it.Status }).ExecuteCommand();
 
                         }
-                        detail.AllotQty += qty;
+                        detail.AllotQty += qty;//鍒嗛厤鏁伴噺
+                        detail.FactQty += xQty;//涓嬫灦鏁伴噺
                         detail.UpdateUser = userId;
                         detail.UpdateTime = DateTime.Now;
                         if (detail.Status == "0")
@@ -2892,8 +2905,13 @@
                                 //璇佹槑鎵�鏈夊垎閰嶆暟閲忓叏閮ㄥ皬浜庣瓑浜庡嚭搴撴暟閲� 涓嶅仛淇敼
                                 break;
                         }
-
+                        var outPalletCount = exAllotList.Where(w => w.Status == "0").Count();//鏌ユ壘鏈夋棤闇�瑕佸嚭搴撶殑鎵樼洏
+                        if (outPalletCount <= 0)
+                        {
+                            notice.Status = "3";//姝e湪鎵ц
+                        }
                     }
+                    
                     notice.UpdateUser = userId;
                     notice.UpdateTime = DateTime.Now;
                     var zd = Db.Updateable(notice).ExecuteCommand();
@@ -3005,6 +3023,7 @@
                             soDetailList.Add(soDetail);
                         }
                         d.AllotQty = 0;
+                        d.FactQty = 0;
                         d.Status = "0";
                         d.UpdateUser = userId;
                         d.UpdateTime = DateTime.Now;
@@ -3210,7 +3229,8 @@
                 //var stockz = Db.Queryable<DataStock>().First(d => d.IsDel == "0" && d.SkuNo == detail.SkuNo && d.LotNo == detail.LotNo);
 
                 var allotList = new List<BllExportAllot>();
-                decimal outQtys = 0;
+                decimal outQtys = 0;//鍒嗛厤鏁伴噺
+                decimal xQty = 0;//涓嬫灦鏁伴噺
                 foreach (var st in model.StockList)
                 {
                     var stock = stockList.First(a => a.Id == st.StockId);
@@ -3252,6 +3272,11 @@
                             CreateUser = userId,
                             CreateTime = DateTime.Now
                         };
+                        if (stock.WareHouseNo == "W04")
+                        {
+                            allot.Status = "2";//寰呮嫞璐�
+                            xQty += allot.Qty;
+                        }
                         allotList.Add(allot);
                     }
                     else
@@ -3274,7 +3299,8 @@
                 }
                 Db.Insertable(allotList).ExecuteCommand();
                 //淇敼鍗曟嵁鏄庣粏
-                detail.AllotQty += outQtys;
+                detail.AllotQty += outQtys;//鍒嗛厤鏁伴噺
+                detail.FactQty += xQty;//涓嬫灦鏁伴噺
                 detail.UpdateUser = userId;
                 detail.UpdateTime = DateTime.Now;
                 if (detail.Status == "0")
@@ -3304,6 +3330,12 @@
                     {
                         notice.Status = "1";//璇佹槑鍒嗛厤鏁伴噺灏忎簬绛変簬鍑哄簱鏁伴噺  淇敼涓洪儴鍒嗗垎閰�
                     }
+
+                    var outPalletCount = allotList.Where(w => w.Status == "0").Count();//鏌ユ壘鏈夋棤闇�瑕佸嚭搴撶殑鎵樼洏
+                    if (outPalletCount <= 0)
+                    {
+                        notice.Status = "3";//姝e湪鎵ц
+                    }
                     Db.Updateable(notice).ExecuteCommand();
                 }
                 //娣诲姞鎿嶄綔鏃ュ織璁板綍

--
Gitblit v1.8.0