| <!DOCTYPE html> | 
| <html> | 
|   | 
| <head> | 
|     <meta charset="utf-8"> | 
|     <title>标签打印</title> | 
|     <meta name="renderer" content="webkit"> | 
|     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|     <meta name="viewport" | 
|         content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> | 
|     <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> | 
|     <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all"> | 
|     <style media="print"> | 
|         @page { | 
|             size: auto; | 
|             margin: 0 0 0 20px; | 
|         } | 
|   | 
|         .layui-input { | 
|             padding-left: 0px; | 
|         } | 
|   | 
|         .layui-form-item { | 
|             margin-bottom: 2px; | 
|         } | 
|     </style> | 
|     <style> | 
|         .layui-form-item .layui-input-inline { | 
|             display: block; | 
|             float: none; | 
|             left: -3px; | 
|             width: auto; | 
|             margin: 0 0 10px 90px; | 
|         } | 
|   | 
|         .hideCls { | 
|             display: none; | 
|         } | 
|   | 
|         .showCls { | 
|             display: block; | 
|         } | 
|         .font-size12{ | 
|             font-size: 12px; | 
|         } | 
|         .font-size10{ | 
|             font-size: 10px; | 
|         } | 
|     </style> | 
| </head> | 
|   | 
| <body> | 
|     <div style="width:100%;"> | 
|         <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="1" id="table" style="width: 90%; height:240px; text-align: center;border-collapse: collapse;table-layout: fixed;"> | 
|                     <tr>  | 
|                         <td colspan="2"> | 
|                             <img src="../../img/LiNuo.jpg" style="width: 80%; height: 15px;" /> | 
|                         </td> | 
|                         <td colspan="2" style="padding: 1px 0px;" class="font-size12">SMP-ST002-R08-01</td>  | 
|                     </tr> | 
|                     <tr>  | 
|                         <td colspan="4" class="font-size12">物料标签</td> | 
|                     </tr> | 
|                     <tr> | 
|                         <td class="font-size12">品名</td> | 
|                         <td colspan="3" id="SkuName" class="font-size10"></td> | 
|                     </tr> | 
|                     <tr> | 
|                         <td class="font-size12">规格/型号</td> | 
|                         <td id="Standard" class="font-size10"></td> | 
|                         <td class="font-size12">包装规格</td> | 
|                         <td id="PackageStandard" class="font-size10"></td> | 
|                     </tr> | 
|                     <tr> | 
|                         <td class="font-size12">进厂编号</td> | 
|                         <td id="LotNo" class="font-size10"></td> | 
|                         <td class="font-size12">物料代码</td> | 
|                         <td id="SkuNo" class="font-size10"></td> | 
|                     </tr> | 
|                     <tr> | 
|                         <td class="font-size12">原厂批号</td> | 
|                         <td id="SupplierLot" class="font-size10"></td>  | 
|                         <td class="font-size12">数   量</td> | 
|                         <td id="Qty" class="font-size10"></td>  | 
|                     </tr> | 
|                     <tr> | 
|                         <td class="font-size12">有效期至</td> | 
|                         <td id="ExpirationTime" class="font-size10"></td> | 
|                         <td class="font-size12">储存期至</td> | 
|                         <td id="StoreTime" class="font-size10"></td>  | 
|                     </tr> | 
|                     <tr>  | 
|                         <td colspan="4" style="padding: 5px 0px;"> | 
|                             <img id="imgBar" style="width: 90%; height: 25px;" /> | 
|                         </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 class="layui-form" style="padding: 30px 15px 0px; " id="button"> | 
|             <div class="layui-form-item" style="margin-bottom:0px;"> | 
|                 <label class="layui-form-label" style="width: 60px;">起始箱码</label> | 
|                 <div class="layui-input-inline"> | 
|                     <input type="text" id="LabelStream" name="LabelStream" placeholder="起始箱码" autocomplete="off" | 
|                         class="layui-input"> | 
|                 </div> | 
|             </div> | 
|             <div class="layui-form-item" style="margin-bottom:0px;"> | 
|                 <label class="layui-form-label" style="width: 60px;">结尾箱码</label> | 
|                 <div class="layui-input-inline"> | 
|                     <input type="text" id="EndBoxCode" name="EndBoxCode" placeholder="结尾箱码" autocomplete="off" | 
|                         class="layui-input"> | 
|                 </div> | 
|             </div> | 
|   | 
|             <div class="layui-form-item" style="margin-bottom:0px;"> | 
|                 <label class="layui-form-label" style="width: 60px;">起始支码</label> | 
|                 <div class="layui-input-inline"> | 
|                     <input type="text" id="LabelStream2" name="LabelStream2" placeholder="起始支码" autocomplete="off" | 
|                         class="layui-input" readonly> | 
|                 </div> | 
|             </div> | 
|   | 
|             <div class="layui-form-item" style="margin-bottom:0px;"> | 
|                 <label class="layui-form-label" style="width: 60px;">结尾支码</label> | 
|                 <div class="layui-input-inline"> | 
|                     <input type="text" id="EndBoxCode2" name="EndBoxCode2" placeholder="结尾支码" autocomplete="off" | 
|                         class="layui-input" readonly> | 
|                 </div> | 
|             </div> | 
|               | 
|             <div class="layui-form-item" style="margin-bottom:0px;"> | 
|                 <label class="layui-form-label" style="width: 60px;">补打类型</label> | 
|                 <div class="layui-input-inline"> | 
|                     <select name="Type" id="Type" lay-search lay-filter="Type"> | 
|                         <option value="1">箱</option> | 
|                         <option value="2">支</option> | 
|                         <option value="3">同箱内箱支</option> | 
|                     </select> | 
|                 </div> | 
|             </div> | 
|             <div class="layui-form-item" style="margin-bottom:0px; text-align: center;"> | 
|   | 
|                 <button id="btnPrint" class="layui-btn layui-btn-sm" lay-event="Add"><i | 
|                         class="layui-icon"></i>打印</button> | 
|             </div> | 
|         </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 boxcode = ""; | 
|         layui.config({ | 
|             base: '../../layuiadmin/' //静态资源所在路径 | 
|         }).extend({ | 
|             index: 'lib/index' //主入口模块 | 
|         }).use(['index', 'form', 'layer', 'laydate'], function () { | 
|   | 
|             var $ = layui.$, | 
|                 form = layui.form, | 
|                 layer = layui.layer; | 
|             var laydate = layui.laydate; | 
|             var indes = layer.index; | 
|             laydate.render({ | 
|                 elem: '#ProductionDate' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             laydate.render({ | 
|                 elem: '#InspectTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             laydate.render({ | 
|                 elem: '#ExpirationTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             var xun = 0; | 
|   | 
|             $('#btnPrint').on('click', function () { | 
|   | 
|                 GetImportId(); | 
|             }); | 
|             form.on('select(Type)', function (data) { | 
|                 // console.log(data.value); //得到被选中的值  | 
|                 if (data.value == "1") { | 
|                     $("#LabelStream").removeAttr("readonly") | 
|                     $("#EndBoxCode").removeAttr("readonly") | 
|   | 
|                     $("#LabelStream2").attr("readonly", "readonly") | 
|                     $("#EndBoxCode2").attr("readonly", "readonly") | 
|   | 
|                 } else if (data.value == "2") { | 
|                     $("#LabelStream").attr("readonly", "readonly") | 
|                     $("#EndBoxCode").attr("readonly", "readonly") | 
|   | 
|                     $("#LabelStream2").removeAttr("readonly") | 
|                     $("#EndBoxCode2").removeAttr("readonly") | 
|   | 
|                 } else if (data.value == "3") { | 
|                     $("#LabelStream").removeAttr("readonly") | 
|                     $("#EndBoxCode").attr("readonly", "readonly") | 
|   | 
|                     $("#LabelStream2").removeAttr("readonly") | 
|                     $("#EndBoxCode2").removeAttr("readonly") | 
|                 } | 
|             }); | 
|             // 标签变量赋值 | 
|             function GetImportId() { | 
|                 var param1 = { | 
|                     BoxNo: $("#LabelStream").val(), | 
|                     EndBoxNo: $("#EndBoxCode").val(), | 
|                     BoxNo2: $("#LabelStream2").val(), | 
|                     EndBoxNo2: $("#EndBoxCode2").val(), | 
|                     Type: $("#Type").val(), | 
|                 }; | 
|   | 
|                 synData(IP + "/BllAsn/GetBuDaLabelList", param1, 'post', function (res) { | 
|                     if (res.code == 0) { //成功     | 
|                         var labels = ""; | 
|                         // console.log(res.data); | 
|                         for (var z = 0; z < res.data.length; z++) { | 
|                             var idd = ""; | 
|                             if (z - 1 >= 0) { | 
|                                 idd = (z - 1).toString(); | 
|                             } | 
|                             // console.log(res.data[z]); | 
|                             // console.log(z); | 
|                             $("#SkuNo").attr("id", "SkuNo" + z.toString()); | 
|                             $("#SkuNo" + z.toString()).html(res.data[z].SkuNo); | 
|                               | 
|                             $("#SkuName").attr("id", "SkuName" + z.toString()); | 
|                             $("#SkuName" + z.toString()).html( res.data[z].SkuName); | 
|   | 
|                               | 
|                             $("#PackageStandard").attr("id", "PackageStandard" + z.toString()); | 
|                             $("#PackageStandard" + z.toString()).html(res.data[z].PackageStandard); | 
|   | 
|                             $("#Standard").attr("id", "Standard" + z.toString()); | 
|                             $("#Standard" + z.toString()).html(res.data[z].Standard); | 
|   | 
|                             $("#Qty").attr("id", "Qty" + z.toString()); | 
|                             $("#Qty" + z.toString()).html( res.data[z].Qty); | 
|   | 
|                             $("#SupplierLot").attr("id", "SupplierLot" + z.toString()); | 
|                             $("#SupplierLot" + z.toString()).html( res.data[z].SupplierLot); | 
|   | 
|                             $("#LotNo").attr("id", "LotNo" + z.toString()); | 
|                             $("#LotNo" + z.toString()).html( res.data[z].LotNo); | 
|   | 
|                             $("#SupplierLot").attr("id", "SupplierLot" + z.toString()); | 
|                             $("#SupplierLot" + z.toString()).html( res.data[z].SupplierLot); | 
|   | 
|                             $("#ExpirationTime").attr("id", "ExpirationTime" + z.toString()); | 
|                             $("#ExpirationTime" + z.toString()).html( formatDate2(res.data[z].ExpirationTime)); | 
|   | 
|                               | 
|                             $("#StoreTime").attr("id", "StoreTime" + z.toString()); | 
|                             $("#StoreTime" + z.toString()).html(formatDate2(res.data[z].StoreTime)); | 
|    | 
|                             $("#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); | 
|                             $("#SkuNo" + z.toString()).attr("id", "SkuNo"); | 
|                             $("#SkuNo").html(""); | 
|   | 
|                             $("#SkuName" + z.toString()).attr("id", "SkuName"); | 
|                             $("#SkuName").html(""); | 
|   | 
|                             $("#PackageStandard" + z.toString()).attr("id", "PackageStandard"); | 
|                             $("#PackageStandard").html(""); | 
|   | 
|                             $("#Qty" + z.toString()).attr("id", "Qty"); | 
|                             $("#Qty").html(""); | 
|   | 
|                             $("#Standard" + z.toString()).attr("id", "Standard"); | 
|                             $("#Standard").html(""); | 
|   | 
|                             $("#LotNo" + z.toString()).attr("id", "LotNo"); | 
|                             $("#LotNo").html(""); | 
|   | 
|                             $("#SupplierLot" + z.toString()).attr("id", "SupplierLot"); | 
|                             $("#SupplierLot").html(""); | 
|   | 
|                             $("#StoreTime" + z.toString()).attr("id", "StoreTime"); | 
|                             $("#StoreTime").html(""); | 
|   | 
|                             $("#ExpirationTime" + z.toString()).attr("id", "ExpirationTime"); | 
|                             $("#ExpirationTime").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 () { }); | 
|                     } | 
|                 }); | 
|             }; | 
|   | 
|             // 获取传递参数 | 
|             function getQueryString(name) { | 
|                 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); | 
|                 var r = window.location.search.substr(1).match(reg); | 
|                 if (r != null) return unescape(r[2]); | 
|                 return null; | 
|             } | 
|         }) | 
|   | 
|     </script> | 
|   | 
| </body> | 
|   | 
| </html> |