From f7a2b37e42aac9578f96d9a954f065d1de74b2b2 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 31 十月 2025 11:23:58 +0800
Subject: [PATCH] 托盘明细增加箱码标签补打功能;

---
 Wms/WMS.IBLL/IDataServer/IDataBoxInfoServer.cs |    9 +
 Wms/WMS.BLL/DataServer/DataBoxInfoServer.cs    |  133 ++++++++++++++++++++++
 Wms/Wms/Controllers/StatisticalController.cs   |   23 +++
 HTML/views/StatisticalReport/BoxInfor.html     |  167 +++++++++++++++++++++++++++
 4 files changed, 332 insertions(+), 0 deletions(-)

diff --git a/HTML/views/StatisticalReport/BoxInfor.html b/HTML/views/StatisticalReport/BoxInfor.html
index 94d5113..507105e 100644
--- a/HTML/views/StatisticalReport/BoxInfor.html
+++ b/HTML/views/StatisticalReport/BoxInfor.html
@@ -16,6 +16,14 @@
 			margin-bottom: 1px;
 			margin-right: 1px;
 		}
+
+		.hideCls {
+            display: none;
+        }
+
+        .showCls {
+            display: block;
+        }
 	</style>
 	<script>
 		// 杩欓噷鏄渶瑕佸湪椤甸潰娓叉煋涔嬪墠鎵ц鐨勪唬鐮�
@@ -335,16 +343,70 @@
                         <button class="layui-btn layui-btn-normal layui-btn-xs approvalBtnupt" id="approvalBtnupt" lay-event="edit">
                             <i class="layui-icon layui-icon-edit"></i>璇︽儏
                         </button>
+
+						<button class="layui-btn layui-btn-normal layui-btn-xs printBtnupt" id="printBtnupt" lay-event="print">
+                            <i class="layui-icon layui-icon-print"></i>琛ユ墦
+                        </button>
                     </script>
 					
 			</div>
 		</div>
+
+		 <div class="layui-form hideCls" lay-filter="layuiadmin-app-form-list" id="print"
+            style="width: 100%;height:100%;">
+            <div style="display: flex;align-items: center;justify-content: center; height: 260px;">
+                <table border="0" id="table"
+                    style="width: 90%; height:240px;border-collapse: collapse;table-layout: fixed;border:none">
+                    <tr>
+                        <td class="font-size12">
+                            鐗╂枡缂栧彿锛�
+                            <table id="SkuNoP" class="font-size12"></table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="font-size12">
+                            鐗╂枡鍚嶇О锛�
+                            <table id="SkuNameP" class="font-size12"></table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="font-size12">
+                            鎵规鍙凤細
+                            <table id="LotNoP" class="font-size12"></table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="font-size12">
+                            鐢熶骇鏃ユ湡锛�
+                            <table id="ProductionTimeP" class="font-size12"></table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="font-size12">
+                            鏈夋晥鏈燂細
+                            <table id="ExpirationTimeP" class="font-size12"></table>
+                        </td>
+                    </tr>
+
+                    <tr>
+                        <td style="padding: 5px 0px;">
+                            <img id="imgBar" style=" height: 60px;" />
+                        </td>
+                    </tr>
+
+                </table>
+            </div>
+            <div style="page-break-after: always;"></div>
+        </div>
+        <div class="layui-form hideCls" lay-filter="layuiadmin-app-form-list" id="print2"
+            style="width: 100%;height:100%;"></div>
 	</div>
 
 	<script src="../../layuiadmin/layui/layui.js"></script>
 	<script src="../../js/public.js"></script>
 	<script src="../../js/jquery-3.5.1.min.js"></script>
 	<script src="../../js/jquery.cookie.js"></script>
+	<script src="../../js/jquery.print.js"></script>
 	<script>
 		var uid = $.cookie('userId');
 		layui.config({
@@ -790,6 +852,111 @@
 						}
 					});
 				}
+				//琛ユ墦
+				if (obj.event === 'print') {
+					var param1 = {
+						BoxNo: data.BoxNo,
+					};
+
+					synData(IP + "/Statistical/GetBuDaLabelList", param1, 'post', function (res) {
+						if (res.code == 0) { //鎴愬姛    
+							var labels = "";
+							for (var z = 0; z < res.data.length; z++) {
+								var idd = "";
+								if (z - 1 >= 0) {
+									idd = (z - 1).toString();
+								}
+								$("#SkuNoP").attr("id", "SkuNoP" + z.toString());
+								$("#SkuNoP" + z.toString()).html(res.data[z].SkuNo);
+
+								$("#SkuNameP").attr("id", "SkuNameP" + z.toString());
+								$("#SkuNameP" + z.toString()).html(res.data[z].SkuName);
+
+
+								$("#PackageStandardP").attr("id", "PackageStandardP" + z.toString());
+								$("#PackageStandardP" + z.toString()).html(res.data[z].PackageStandard);
+
+								$("#StandardP").attr("id", "StandardP" + z.toString());
+								$("#StandardP" + z.toString()).html(res.data[z].Standard);
+
+								$("#QtyP").attr("id", "QtyP" + z.toString());
+								$("#QtyP" + z.toString()).html(res.data[z].Qty);
+
+								$("#SupplierLotP").attr("id", "SupplierLotP" + z.toString());
+								$("#SupplierLotP" + z.toString()).html(res.data[z].SupplierLot);
+
+								$("#LotNoP").attr("id", "LotNoP" + z.toString());
+								$("#LotNoP" + z.toString()).html(res.data[z].LotNo);
+
+								$("#SupplierLotP").attr("id", "SupplierLotP" + z.toString());
+								$("#SupplierLotP" + z.toString()).html(res.data[z].SupplierLot);
+
+								$("#ExpirationTimeP").attr("id", "ExpirationTimeP" + z.toString());
+								$("#ExpirationTimeP" + z.toString()).html(formatDate2(res.data[z].ExpirationTime));
+
+
+								$("#ProductionTimeP").attr("id", "ProductionTimeP" + z.toString());
+								$("#ProductionTimeP" + z.toString()).html(formatDate2(res.data[z].ProductionTime));
+
+								$("#imgBar").attr("id", "imgBar" + z.toString());
+								$("#imgBar" + z.toString()).attr("src", res.data[z].ImgStr);
+
+
+								// console.log("#SkuNo"+z.toString());
+								labels += $("#print").html();
+								//console.log(labels);
+								$("#SkuNoP" + z.toString()).attr("id", "SkuNoP");
+								$("#SkuNoP").html("");
+
+								$("#SkuNameP" + z.toString()).attr("id", "SkuNameP");
+								$("#SkuNameP").html("");
+
+								$("#PackageStandardP" + z.toString()).attr("id", "PackageStandardP");
+								$("#PackageStandardP").html("");
+
+								$("#QtyP" + z.toString()).attr("id", "QtyP");
+								$("#QtyP").html("");
+
+								$("#StandardP" + z.toString()).attr("id", "StandardP");
+								$("#StandardP").html("");
+
+								$("#LotNoP" + z.toString()).attr("id", "LotNoP");
+								$("#LotNoP").html("");
+
+								$("#SupplierLotP" + z.toString()).attr("id", "SupplierLotP");
+								$("#SupplierLotP").html("");
+
+								$("#StoreTimeP" + z.toString()).attr("id", "StoreTimeP");
+								$("#StoreTimeP").html("");
+
+								$("#ExpirationTimeP" + z.toString()).attr("id", "ExpirationTimeP");
+								$("#ExpirationTimeP").html("");
+
+								$("#imgBar" + z.toString()).attr("id", "imgBar");
+								$("#imgBar").attr("src", "");
+							}
+							// console.log(labels);
+							document.getElementById('print2').innerHTML = "";
+							document.getElementById('print2').innerHTML = labels;
+							$("#print2").removeClass("hideCls");
+							//$("#button").hide();
+							$("#print2").print();
+							//$("#button").show();
+							$("#print2").addClass("hideCls");
+
+							// $("#LabelStream").val("");
+							// $("#EndBoxCode").val("");
+							// $("#LabelStream2").val("");
+							// $("#EndBoxCode2").val("");
+
+						} else { //涓嶆垚鍔�
+							layer.msg(res.msg, {
+								icon: 2,
+								time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+							}, function () { });
+						}
+					});
+				}
 			});
 
 			form.on('submit(daochu)', function () {
diff --git a/Wms/WMS.BLL/DataServer/DataBoxInfoServer.cs b/Wms/WMS.BLL/DataServer/DataBoxInfoServer.cs
index c564488..d9ac7cd 100644
--- a/Wms/WMS.BLL/DataServer/DataBoxInfoServer.cs
+++ b/Wms/WMS.BLL/DataServer/DataBoxInfoServer.cs
@@ -1,12 +1,18 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Linq.Expressions;
 using System.Text;
+using Model.ModelDto;
 using Model.ModelDto.DataDto;
+using Model.ModelDto.SysDto;
 using SqlSugar;
+using Utility.Tools;
 using WMS.DAL;
+using WMS.Entity.BllAsnEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
+using WMS.Entity.SysEntity;
 using WMS.IBLL.IDataServer;
 
 namespace WMS.BLL.DataServer
@@ -417,6 +423,132 @@
         }
         #endregion
 
+        #region#琛ユ墦鏍囩
+        /// <summary>
+        /// 琛ユ墦搴撳瓨鏄庣粏绠辩爜
+        /// </summary>
+        /// <param name="boxNo"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public List<BoxInfoDto> GetBuDaLabelList(string boxNo)
+        {
+            try
+            {
+                if (string.IsNullOrWhiteSpace(boxNo))
+                {
+                    throw new Exception($"绠辩爜涓嶈兘涓虹┖");
+                }
+
+                //鎵撳嵃鏁版嵁闆嗗悎
+                var printList = new List<BoxInfoDto>();
+
+                List<BoxInfoDto> printModelList = new List<BoxInfoDto>();
+
+
+                var funSet = Db.Queryable<SysFunSetting>().First(m => m.IsDel == "0" && m.FunSetName == "鐗╂枡鐮佺被鍨�" && m.IsEnable == "NO");
+                var allotSet = 1;//鍒嗛厤瑙勫垯璁惧畾
+
+                if (funSet != null)
+                {
+                    switch (funSet.SetValue)
+                    {
+                        case "One":
+                            allotSet = 1;//涓�缁存潯褰㈢爜
+                            break;
+                        case "Two":
+                            allotSet = 2;//浜岀淮鐮�
+                            break;
+                        default:
+                            allotSet = 1;// 榛樿锛氫竴缁存潯褰㈢爜銆�
+                            break;
+                    }
+                }
+                #region 鍗曚釜绠辩爜鏍囩
+
+
+                var dataList = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo).ToList();
+                var data = dataList.FirstOrDefault();
+                if (data == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌{boxNo}淇℃伅");
+                }
+                //鐗╂枡淇℃伅
+                var skuInfo = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == data.SkuNo);
+                if (skuInfo == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌缂栫爜涓簕data.SkuNo}鐨勭墿鏂欎俊鎭�");
+                }
+                //鍖呰淇℃伅
+                var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == skuInfo.PackagNo);
+                if (pack == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌褰撳墠鍗曟嵁涓墿鏂欑殑鍖呰淇℃伅");
+                }
+
+                var packStr = "";
+
+                if (!string.IsNullOrWhiteSpace(pack.L1Name))
+                {
+                    packStr += pack.L1Num + "/" + pack.L1Name;
+                }
+                if (!string.IsNullOrWhiteSpace(pack.L2Name))
+                {
+                    packStr += "-" + pack.L2Num + "/" + pack.L2Name;
+                }
+                if (!string.IsNullOrWhiteSpace(pack.L3Name))
+                {
+                    packStr += "-" + pack.L3Num + "/" + pack.L3Name;
+                }
+                if (!string.IsNullOrWhiteSpace(pack.L4Name))
+                {
+                    packStr += "-" + pack.L4Num + "/" + pack.L4Name;
+                }
+                if (!string.IsNullOrWhiteSpace(pack.L5Name))
+                {
+                    packStr += "-" + pack.L5Num + "/" + pack.L5Name;
+                }
+                // 鐗╂枡鏉$爜淇℃伅璧嬪��
+                BoxInfoDto model = new BoxInfoDto();
+                model.SkuNo = data.SkuNo;
+                model.SkuName = data.SkuName;
+                model.LotNo = data.LotNo;                      //鎵规
+                model.SupplierLot = data.SupplierLot;                        // 鍘熷巶鎵瑰彿
+                model.Standard = data.Standard;                              // 瑙勬牸/鍨嬪彿
+                model.PackageStandard = packStr;                // 鍖呰瑙勬牸
+
+                model.ExpirationTime = data.ExpirationTime;                  // 鏈夋晥鏈熻嚦
+                model.StoreTime = null;                     // 鍌ㄥ瓨鏈熻嚦 
+                model.ProductionTime = data.ProductionTime;//鐢熶骇鏃ユ湡
+
+                model.Qty = dataList.Sum(m => m.Qty);// 鏁伴噺
+
+                model.BoxNo = data.BoxNo;                 // 绠卞彿     
+
+                model.ImgStr = allotSet == 1 ? BarcodeHelper.GetCodeBarBase64(model.BoxNo, 160, 40, false) : BarcodeHelper.GetQrCodeBase64(model.BoxNo, 85, 85);
+
+                // 娣诲姞鍒發ist闆嗗悎
+                printModelList.Add(model);
+
+                //娣诲姞鎵撳嵃璁板綍
+                //WmsLabelPrintLog log = new WmsLabelPrintLog();
+                //log.BoxCode = data.LabelStream;
+                //log.CreateTime = DateTime.Now;
+                //log.Demo = Demo;
+                //log.Isdel = 0;
+                //log.CreateUser = userId;
+                //printlog.Add(log);
+                #endregion
+
+                return printModelList;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
+        #endregion
+
         #region 搴熶唬鐮� 浠呬緵鍙傝��
 
         ////鑾峰彇鍒嗙粍鍚庣殑绠辩爜鏄庣粏
@@ -480,5 +612,6 @@
         //}
 
         #endregion
+
     }
 }
diff --git a/Wms/WMS.IBLL/IDataServer/IDataBoxInfoServer.cs b/Wms/WMS.IBLL/IDataServer/IDataBoxInfoServer.cs
index 7b73c75..d18bdaa 100644
--- a/Wms/WMS.IBLL/IDataServer/IDataBoxInfoServer.cs
+++ b/Wms/WMS.IBLL/IDataServer/IDataBoxInfoServer.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Text;
+using Model.ModelDto;
 using Model.ModelDto.DataDto;
 using WMS.Entity.DataEntity;
 
@@ -70,5 +71,13 @@
         /// <returns></returns>
         List<DataBoxInfo> GetDataBoxInfoDaoChu(string id, string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitBoxMark, string inspectStatus);
         #endregion
+
+        /// <summary>
+        /// 琛ユ墦搴撳瓨鏄庣粏绠辩爜
+        /// </summary>
+        /// <param name="boxNo"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        List<BoxInfoDto> GetBuDaLabelList(string boxNo);
     }
 }
diff --git a/Wms/Wms/Controllers/StatisticalController.cs b/Wms/Wms/Controllers/StatisticalController.cs
index 21ace0d..365d505 100644
--- a/Wms/Wms/Controllers/StatisticalController.cs
+++ b/Wms/Wms/Controllers/StatisticalController.cs
@@ -9,6 +9,8 @@
 using System.Threading.Tasks;
 using Model.ModelDto.SysDto;
 using WMS.BLL.LogServer;
+using Model.ModelVm.BllTaskVm;
+using Model.ModelVm;
 
 namespace Wms.Controllers
 {
@@ -483,5 +485,26 @@
         }
 
         #endregion
+
+        #region#琛ユ墦鏍囩
+        /// <summary>
+        /// 琛ユ墦搴撳瓨鏄庣粏绠辩爜
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetBuDaLabelList(BuDaLabelBoxVm model)
+        {
+            try
+            {
+                var list = _dataBoxInfo.GetBuDaLabelList(model.BoxNo);
+                return Ok(new { code = 0, msg = "鑾峰彇琛ユ墦绠辩爜鏍囩淇℃伅", data = list });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, count = 0, msg = e.Message });
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.8.0