From 75b62c70cb63bc3ed438485573dacce93b43d55c Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期六, 03 二月 2024 10:25:26 +0800
Subject: [PATCH] 添加生成标签按钮权限,修改获取入库单明细信息

---
 Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs           |   91 +++++++++++++++---------------
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs        |    2 
 Wms/Wms/Controllers/BllAsnController.cs                |    4 
 HTML/views/ASNSetting/ArrivalNotice.html               |   12 +++
 HTML/views/ASNSetting/LabelPrint.html                  |   13 +---
 Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs        |    3 
 Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs |    7 ++
 7 files changed, 71 insertions(+), 61 deletions(-)

diff --git a/HTML/views/ASNSetting/ArrivalNotice.html b/HTML/views/ASNSetting/ArrivalNotice.html
index 53e718c..ce15fdb 100644
--- a/HTML/views/ASNSetting/ArrivalNotice.html
+++ b/HTML/views/ASNSetting/ArrivalNotice.html
@@ -303,13 +303,14 @@
  
 					<script type="text/html" id="toolbarDemoList">
 						{{# function GetBtn2(d){ 
+							console.log(d);
 								var html = ``;
 								if(d.Status == "0"){ 
 									html = `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"> 
 										<i class="layui-icon layui-icon-delete"></i>鍒犻櫎</a>`; 
 								}
-								if(d.Status == "0" || d.Status == "1"){  
-									html += `<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="Addlabel"> 
+								if((d.AsnType =="1" || d.AsnType == "4") && (d.Status == "0" || d.Status == "1")){  
+									html += `<a class="layui-btn layui-btn-normal layui-btn-xs addLabelClass" lay-event="Addlabel"> 
 										<i class="layui-icon layui-icon-edit"></i>鐢熸垚鏍囩</a>`; 
 								}
 								return html;
@@ -890,6 +891,8 @@
 					$(".clossClass").hide(); 
 					$(".editDemoClass").hide();//澶囨敞
 					$(".checkClass").hide(); //澶嶆牳
+					$(".addLabelClass").hide(); //澶嶆牳
+					
 				});
 				sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function(res) {
 					if (res.code == 0) { //鎴愬姛 
@@ -929,6 +932,11 @@
 									$(".checkClass").show(); 
 								});
 							}
+							if (res.data[k].MenuName == "鐢熸垚鏍囩") {
+								$(function() {
+									$(".addLabelClass").show(); 
+								});
+							}
 						}
 					} else { //涓嶆垚鍔�
 						layer.msg('鑾峰彇鏉冮檺淇℃伅澶辫触', {
diff --git a/HTML/views/ASNSetting/LabelPrint.html b/HTML/views/ASNSetting/LabelPrint.html
index 5e7b775..0dc83e6 100644
--- a/HTML/views/ASNSetting/LabelPrint.html
+++ b/HTML/views/ASNSetting/LabelPrint.html
@@ -139,16 +139,11 @@
                         layer.msg(res.msg, {
                             icon: 2,
                             time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-                        }, function () { });
-                        // $("#SkuName").html(res.data.SkuName); 
-                        // $("#Standard").html(res.data.Standard);
-                        // $("#PackageStandard").html(res.data.PackageStandard);
-                        // $("#SkuNo").html(res.data.SkuNo);
-                        // $("#SupplierLot").html(res.data.SupplierLot);
-                        // $("#ExpirationTime").html(expirationTime);
-                        // $("#StoreTime").html( storeTime);
+                        }, function () {
+                            parent.location.reload();
+                            parent.layer.close(layer.index);
+                        });
                         
-                        // $("#imgBar").attr("src", res.data[0].imageStr); 
                     } else { //涓嶆垚鍔�
                         layer.msg(res.msg, {
                             icon: 2,
diff --git a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
index 0cfdd66..013a421 100644
--- a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
+++ b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
@@ -128,6 +128,13 @@
         /// </summary>           
         public string Status { get; set; }
 
+        /// <summary>
+        /// Desc:鍗曟嵁绫诲瀷
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string AsnType { get; set; }
+
         public string AsnStatus { get; set; }
 
         /// <summary>
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index e5cb49d..3cde474 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -103,7 +103,7 @@
                     rowCount = count;
                 }
 
-                sqlString += "SELECT DISTINCT tb1.*,tb2.Status as AsnStatus,tb3.RealName as CreateUserName, ";
+                sqlString += "SELECT DISTINCT tb1.*,tb2.Type as AsnType,tb2.Status as AsnStatus,tb3.RealName as CreateUserName, ";
                 sqlString += "tb4.RealName as UpdateUserName,isnull(tb6.UnitName,tb5.UnitNo) as UnitName,tb7.PackagName ";
                 sqlString += "FROM BllArrivalNoticeDetail AS tb1 ";
                 sqlString += "LEFT JOIN BllArrivalNotice AS tb2 ON tb1.ASNNo = tb2.ASNNo ";
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index fe47e52..866b3b5 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -529,7 +529,7 @@
         }
 
         //鑾峰彇鏍囩淇℃伅(鐢熸垚鏍囩)
-        public List<BoxInfoDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId)
+        public List<BllBoxInfo> AddLabelBox(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId)
         {
             try
             { 
@@ -586,40 +586,14 @@
                 var bNum = 0;//绠辩墿鍝佹暟閲�
                 var zNum = 0;//鏀墿鍝佹暟閲�
                 var packLevel = 0;
-                var isGo = true;
-
-                if (pack.L5Num.HasValue)
-                {
-                    if (pack.L5Name != "鎵�")
-                    {
-                        isGo = false;
-                        packLevel = 5;
-                        bNum = Convert.ToInt32(pack.L5Num);
-                    }
-                }
-                if (pack.L4Num.HasValue && isGo)
-                {
-                    if (pack.L4Name != "鎵�")
-                    {
-                        isGo = false;
-                        packLevel = 4;
-                        bNum = Convert.ToInt32(pack.L4Num);
-                    }
-                }
-                if (pack.L3Num.HasValue && isGo)
-                {
-                    if (pack.L4Name != "鎵�")
-                    {
-                        isGo = false;
-                        packLevel = 3;
-                        bNum = Convert.ToInt32(pack.L3Num);
-                    }
-                }
+                
                 if (pack.L2Num.HasValue)
                 {
-                    packLevel = 2;
-                    bNum = Convert.ToInt32(pack.L2Num);
-
+                    if (pack.L2Name != "鎵�")
+                    {
+                        packLevel = 2; 
+                        bNum = Convert.ToInt32(pack.L2Num);
+                    }
                 }
                 if (pack.L1Num.HasValue)
                 {
@@ -633,7 +607,7 @@
 
                 if (packLevel <= 1)//鍖呰绛夌骇灏忎簬1锛屾寜鐓�1绾ф爣绛炬墦鍗�
                 {
-                    packLevel = 1;
+                    throw new Exception("鍖呰淇℃伅鏈夎锛屽皬浜庝竴绾�");
                 }
 
                 #endregion
@@ -744,12 +718,12 @@
                         //鑾峰彇绠辩爜
                         if (maxBoxCode == "")
                         {
-                            var str = maxLotNoStr + "000001"; //鎵瑰彿+ 娴佹按  2302010001000001
+                            var str = "B"+maxLotNoStr + "000001"; //鎵瑰彿+ 娴佹按  2302010001000001
                             maxBoxCode = str;
                         }
                         else
                         {
-                            maxBoxCode = maxBoxCode.Substring(0, 10) + (int.Parse(maxBoxCode.Substring(10, 6)) + 1).ToString().PadLeft(6, '0'); 
+                            maxBoxCode = maxBoxCode.Substring(0, 11) + (int.Parse(maxBoxCode.Substring(11, 6)) + 1).ToString().PadLeft(6, '0'); 
                         } 
                         
                         // 灏嗘潯鐮佷繚瀛樺埌鍘熸枡鏉$爜琛�
@@ -868,15 +842,34 @@
 
                     for (int i = 1; i <= labelNum2; i++)//绠辩爜鏍囩
                     {
-                        
-                        //鑾峰彇绠辩爜
-                        if (maxboxcode2 == "")
+                        //绠卞唴鏁伴噺
+                        decimal boxQty = 0;
+                        if (i == labelNum2)
                         {
-                            maxboxcode2 = maxCodestr2 + "000001"; // 绠卞彿     鎵瑰彿+绗嚑绠�
+                            // 鏈�鍚庝竴涓潯鐮�
+                            var s = bNum * (i - 1);
+                            if (bNum > qty2 - s)
+                            {
+                                boxQty = qty2 - s;// 鏁伴噺
+                            }
+                            else
+                            {
+                                boxQty = bNum;// 鏁伴噺
+                            }
                         }
                         else
                         {
-                            maxboxcode2 = maxboxcode2.Substring(0, 10) + (int.Parse(maxboxcode2.Substring(10, 6)) + 1).ToString().PadLeft(6, '0'); 
+                            boxQty = bNum;                                                         // 鏁伴噺
+                        }
+
+                        //鑾峰彇绠辩爜
+                        if (maxboxcode2 == "")
+                        {
+                            maxboxcode2 = "B"+maxCodestr2 + "000001"; // 绠卞彿     鎵瑰彿+绗嚑绠�
+                        }
+                        else
+                        {
+                            maxboxcode2 = maxboxcode2.Substring(0, 11) + (int.Parse(maxboxcode2.Substring(11, 6)) + 1).ToString().PadLeft(6, '0'); 
                         }
                         //鑾峰彇绠卞唴鏀爣绛炬暟閲�
                         if (i == labelNum2)
@@ -888,6 +881,12 @@
                                 if (isGo2)
                                 {
                                     break;
+                                }
+                                var s = bNum * (i - 1);
+                                var s2 = zNum * (j - 1);
+                                if (zNum >= qty2 - s - s2)
+                                {
+                                    isGo2 = true;
                                 }
                                 sl++;
                             }
@@ -910,11 +909,11 @@
                             
                             if (maxboxcode3 == "")
                             {
-                                maxboxcode3 = maxCodestr2 + "0001"; // 鏀彿     鎵瑰彿+绗嚑绠� 
+                                maxboxcode3 = "Z"+maxCodestr2 + "0001"; // 鏀彿     鎵瑰彿+绗嚑绠� 
                             }
                             else
                             {
-                                maxboxcode3 = maxboxcode3.Substring(0, 28) + (int.Parse(maxboxcode3.Substring(28, 4)) + 1).ToString().PadLeft(4, '0'); 
+                                maxboxcode3 = maxboxcode3.Substring(0, 11) + (int.Parse(maxboxcode3.Substring(11, 4)) + 1).ToString().PadLeft(4, '0'); 
                             }
 
                             // 灏嗘潯鐮佷繚瀛樺埌鍘熸枡鏉$爜琛�
@@ -934,7 +933,7 @@
                                 PackageStandard = packStr,
                                 SupplierLot = asnList.SupplierLot,
                                 InspectMark = "0",
-                                BitBoxMark = bNum > d ? "1" : "0",
+                                BitBoxMark = bNum > boxQty ? "1" : "0",
                                 InspectStatus = "0",
 
                                 ProductionTime = DateTime.Parse(productionTime),
@@ -956,10 +955,10 @@
                     #endregion
                 }
 
-                //return labelModel;
+                return modelList;
 
 
-                throw new NotImplementedException();
+                //throw new NotImplementedException();
             }
             catch (Exception e)
             {
diff --git a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
index d0c6632..aeb95b6 100644
--- a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
+++ b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.Text;
 using Model.ModelDto.BllAsnDto;
+using WMS.Entity.BllAsnEntity;
 
 namespace WMS.IBLL.IBllAsnServer
 {
@@ -54,7 +55,7 @@
         /// <param name="storeTime">鍌ㄥ瓨鏈熻嚦</param>
         /// <param name="userId">鎿嶄綔浜�</param>
         /// <returns></returns>
-        List<BoxInfoDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId);
+        List<BllBoxInfo> AddLabelBox(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId);
 
     }
 }
diff --git a/Wms/Wms/Controllers/BllAsnController.cs b/Wms/Wms/Controllers/BllAsnController.cs
index f1e307f..9117497 100644
--- a/Wms/Wms/Controllers/BllAsnController.cs
+++ b/Wms/Wms/Controllers/BllAsnController.cs
@@ -892,8 +892,8 @@
                 {
                     return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
-                var list = _BoxInfoSvc.AddLabelBoxReturn(model.Id, model.IsReset, decimal.Parse(model.ArriveQty),  model.ProductionTime, model.ExpirationTime, model.StoreTime, int.Parse(userId));
-                return Ok(new { code = 0,  msg = "绠辩爜鏍囩鍒楄〃", data = list });
+                var list = _BoxInfoSvc.AddLabelBox(model.Id, model.IsReset, decimal.Parse(model.ArriveQty),  model.ProductionTime, model.ExpirationTime, model.StoreTime, int.Parse(userId));
+                return Ok(new { code = 0,  msg = "鐢熸垚绠辩爜鏍囩鎴愬姛", data = list });
             }
             catch (Exception e)
             {

--
Gitblit v1.8.0