From d3521d4f8feda989df7f0f48eff6ee3fd6ebec47 Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期一, 19 二月 2024 09:59:22 +0800
Subject: [PATCH] 修改标签生成数量限制问题

---
 Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs |   76 ++++++++++++++++++++------------------
 1 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index 4011efa..870b0e8 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -412,7 +412,7 @@
                     .AndIF(!string.IsNullOrWhiteSpace(model.SkuNo), it => it.SkuNo.Contains(model.SkuNo.Trim()))
                     .AndIF(!string.IsNullOrWhiteSpace(model.LotNo), it => it.LotNo.Contains(model.LotNo.Trim()))
                     .AndIF(!string.IsNullOrWhiteSpace(model.SupplierLot), it => it.SupplierLot.Contains(model.SupplierLot.Trim()))
-                    .AndIF(!string.IsNullOrWhiteSpace(model.Status), it => it.Status == model.SupplierLot)
+                    .AndIF(!string.IsNullOrWhiteSpace(model.Status), it => it.Status == model.Status)
                     .AndIF(!string.IsNullOrWhiteSpace(model.ProductionTime), it => it.ProductionTime >= Convert.ToDateTime(model.ProductionTime))
                     .AndIF(!string.IsNullOrWhiteSpace(model.ProductionTime), it => it.ProductionTime <= Convert.ToDateTime(model.ProductionTime).AddDays(1))
                     .And(it => it.IsDel == "0" && it.Origin == "WMS鐢熸垚")
@@ -614,30 +614,35 @@
                 var modelList = new List<BllBoxInfo>();
 
                 var addLotNo = "";
+                if (arriveQty < 0)
+                {
+                    throw new Exception("鍒拌揣鏁伴噺涓嶈兘灏忎簬0!");
+                }
 
                 if (packLevel == 1)
                 {
                     #region 涓�绾у寘瑁�
 
                     // 鏍规嵁鐢ㄦ埛杈撳叆鐨勭鏁伴噺璁$畻闇�瑕佺殑鏉$爜鏁�
-                    var labQty = label.Sum(m => m.Qty);
-                    var qty = asnList.Qty - labQty;//褰撳墠鍗曟嵁鍓╀綑闇�瑕佹墦鍗扮殑鐗╂枡鏁伴噺(涓嶆槸鏍囩鏁伴噺)
-                    if (qty <= 0)
-                    {
-                        throw new Exception("褰撳墠鍗曟嵁鐗╂枡鏍囩宸叉墦鍗板畬姣曪紝濡傛湁闇�瑕佽琛ユ墦");
-                    }
+                    //var labQty = label.Sum(m => m.Qty);
+                    //var qty = asnList.Qty - labQty;//褰撳墠鍗曟嵁鍓╀綑闇�瑕佹墦鍗扮殑鐗╂枡鏁伴噺(涓嶆槸鏍囩鏁伴噺)
+                    //if (qty <= 0)
+                    //{
+                    //    throw new Exception("褰撳墠鍗曟嵁鐗╂枡鏍囩宸叉墦鍗板畬姣曪紝濡傛湁闇�瑕佽琛ユ墦");
+                    //}
 
                     #region 鍒拌揣鏁伴噺
 
-                    if (arriveQty - qty > 0)
-                    {
-                        throw new Exception("鍒拌揣鏁伴噺澶т簬鏈墦鏍囩鏁伴噺锛岃閲嶆柊杈撳叆鍒拌揣鏁伴噺骞舵牳瀹�!");
-                    }
-                    else
-                    {
-                        qty = arriveQty;
-                    }
-
+                    //if (arriveQty - qty > 0)
+                    //{
+                    //    throw new Exception("鍒拌揣鏁伴噺澶т簬鏈墦鏍囩鏁伴噺锛岃閲嶆柊杈撳叆鍒拌揣鏁伴噺骞舵牳瀹�!");
+                    //}
+                    //else
+                    //{
+                    //    qty = arriveQty;
+                    //}
+                    
+                    var qty = arriveQty;
                     #endregion
 
                     int labelNum = 1; //鐢熶骇鏉$爜鏁伴噺
@@ -672,7 +677,7 @@
                     }
                     else
                     {
-                        var maxCode = Db.Queryable<BllLabelBoxNo>().Max(a => a.LotNo);                        // 鑾峰彇浠婂ぉ鏈�澶ф壒娆″彿
+                        var maxCode = Db.Queryable<BllBoxInfo>().Where(m=>m.Origin == "WMS鐢熸垚").Max(a => a.LotNo);                        // 鑾峰彇浠婂ぉ鏈�澶ф壒娆″彿
                         if (string.IsNullOrWhiteSpace(maxCode))
                         {
                             maxLotNoStr = toDayTime.Substring(2, 6) + "0001";
@@ -769,25 +774,27 @@
                     #region 浜岀骇鍖呰
 
                     // 鏍规嵁鐢ㄦ埛杈撳叆鐨勭鏁伴噺璁$畻闇�瑕佺殑鏉$爜鏁�
-                    var labQty = label.Sum(m => m.Qty);
-                    var qty2 = asnList.Qty - labQty;
-                    if (qty2 <= 0)
-                    {
-                        throw new Exception("褰撳墠鍗曟嵁鐗╂枡鏍囩宸叉墦鍗板畬姣曪紝濡傛湁闇�瑕佽琛ユ墦");
-                    }
+                    //var labQty = label.Sum(m => m.Qty);
+                    //var qty2 = asnList.Qty - labQty;
+                    //if (qty2 <= 0)
+                    //{
+                    //    throw new Exception("褰撳墠鍗曟嵁鐗╂枡鏍囩宸叉墦鍗板畬姣曪紝濡傛湁闇�瑕佽琛ユ墦");
+                    //}
 
                     #region 澧炲姞鍒拌揣鏁伴噺
 
-                    if (arriveQty - qty2 > 0)
-                    {
-                        throw new Exception("鍒拌揣鏁伴噺澶т簬鏈墦鏍囩鏁伴噺锛岃閲嶆柊杈撳叆鍒拌揣鏁伴噺!");
-                    }
-                    else
-                    {
-                        qty2 = arriveQty;
-                    }
+                    //if (arriveQty - qty2 > 0)
+                    //{
+                    //    throw new Exception("鍒拌揣鏁伴噺澶т簬鏈墦鏍囩鏁伴噺锛岃閲嶆柊杈撳叆鍒拌揣鏁伴噺!");
+                    //}
+                    //else
+                    //{
+                    //    qty2 = arriveQty;
+                    //}
                     #endregion
 
+                    
+                    var qty2 = arriveQty;
                     int labelNum2 = 1; //鐢熶骇绠辨潯鐮佹暟閲�
 
                     labelNum2 = int.Parse(Math.Ceiling(qty2 / bNum).ToString());
@@ -819,7 +826,7 @@
                     }
                     else
                     {
-                        var maxCode = Db.Queryable<BllLabelBoxNo>().Max(a => a.LotNo);                        // 鑾峰彇浠婂ぉ鏈�澶ф壒娆″彿
+                        var maxCode = Db.Queryable<BllBoxInfo>().Where(m => m.Origin == "WMS鐢熸垚").Max(a => a.LotNo);                        // 鑾峰彇浠婂ぉ鏈�澶ф壒娆″彿
                         if (string.IsNullOrWhiteSpace(maxCode))
                         {
                             maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
@@ -1512,7 +1519,7 @@
                                         model1.Qty = item.Qty;// 鏁伴噺
                                         model1.BoxNo = item.BoxNo3;                 // 鏀彿     
 
-                                        model.ImgStr = BarcodeHelper.GetCodeBarBase64(model1.BoxNo, 160, 40, false);
+                                        model1.ImgStr = BarcodeHelper.GetCodeBarBase64(model1.BoxNo, 160, 40, false);
 
                                         // 娣诲姞鍒發ist闆嗗悎
                                         printModelList.Add(model1);
@@ -1543,9 +1550,6 @@
 
                 #endregion
 
-                //dataContext.WmsLabelPrintLog.InsertAllOnSubmit(printlog);
-                //    dataContext.SubmitChanges();
-                //    return printModel;
                 return printModelList;
             }
             catch (Exception e)

--
Gitblit v1.8.0