| <!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> | 
|         .rightMargin { | 
|             margin-right: 0px; | 
|         } | 
|   | 
|         .buJu { | 
|             margin-top: 10px; | 
|             display: flex; | 
|             flex-direction: row-reverse; | 
|         } | 
|   | 
|         .beiJing { | 
|             background-color: #fafafa; | 
|             padding-top: 5px; | 
|             border-radius: 3px; | 
|             box-shadow: inset 0 0 3px 1px #ccc; | 
|         } | 
|         .layui-form-switch{ | 
|             margin-top: 0; | 
|             vertical-align:middle; | 
|              | 
|         } | 
|     </style> | 
| </head> | 
|   | 
| <body> | 
|   | 
|     <div class="layui-fluid" style="padding: 3px;"> | 
|         <div class="layui-card"> | 
|             <div class="layui-form layui-card-header layuiadmin-card-header-auto"> | 
|                 <div class="layui-form-item"> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">入库单</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <select name="BillCode" id="BillCode" lay-filter="BillCode" | 
|                                 lay-search> | 
|                                 <option value=""></option> | 
|                             </select> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 70px;">物料-批次</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <select name="detail" id="detail" lay-filter="detail" lay-search> | 
|                                 <option value=""></option> | 
|                             </select> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">托盘条码</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="palletNo" name="palletNo" placeholder="托盘条码" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"  style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 40px;">箱码</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="boxNo" name="boxNo" placeholder="箱码" autocomplete="off" | 
|                                 class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" style="margin-right: 0;"> | 
|                         <label class="layui-form-label" style="width: 60px;">是否连组</label> | 
|                          | 
|                         <div class="layui-input-inline" style="width: 60px;margin-right: 0;height:34px;line-height:34px;"> | 
|                             <input type="checkbox" name="IsLianXu" id="IsLianXu" lay-filter="IsLianXu" lay-skin="switch" lay-text="是|否"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline" id="BOX2" style="margin-right: 0;display:none;"> | 
|                         <label class="layui-form-label" style="width: 60px;">尾箱箱码</label> | 
|                         <div class="layui-input-inline" style="margin-right: 0;"> | 
|                             <input type="text" id="boxNo2" name="boxNo2" lay-filter="boxNo2" placeholder="尾箱箱码" autocomplete="off" class="layui-input"> | 
|                         </div> | 
|                     </div> | 
|                     <div class="layui-inline"> | 
|                         <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit | 
|                             lay-filter="confirm"> | 
|                             <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索 | 
|                         </button> | 
|                         <button style="margin-right: 15px;" class="layui-btn layui-btn-sm layuiadmin-btn-list" | 
|                             lay-submit id="Create" lay-filter="Create">提交</button> | 
|                     </div> | 
|                 </div> | 
|             </div> | 
|             <div class="layui-card-body"> | 
|                 <table id="Box-list" lay-filter="Box-list"></table> | 
|                 <script type="text/html" id="bulkTank"> | 
|                        <p>{{d.BulkTank == 0? '否':'是'}}</p> | 
|                     </script> | 
|                 <script type="text/html" id="table-content-list"> | 
|                     <a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>     | 
|                 </script> | 
|             </div> | 
|   | 
|         </div> | 
|     </div> | 
|   | 
|   | 
|     <script src="../../layuiadmin/layui/layui.js"></script> | 
|     <script src="../../js/jquery-3.5.1.min.js"></script> | 
|     <script src="../../js/jquery.cookie.js"></script> | 
|     <script src="../../js/public.js"></script> | 
|     <script> | 
|         layui.extend({ | 
|             excel: '../../layuiadmin/layui/layui_exts/excel' // {/}的意思即代表采用自有路径,即不跟随 base 路径 | 
|         }) | 
|   | 
|         layui.config({ | 
|             base: '../../layuiadmin/' //静态资源所在路径 | 
|         }).extend({ | 
|             index: 'lib/index' //主入口模块 | 
|         }).use(['index', 'form', 'layer', 'table', 'laydate', 'upload', 'excel'], function () { | 
|             var form = layui.form, | 
|                 table = layui.table, | 
|                 layer = layui.layer; | 
|             laydate = layui.laydate; | 
|             IsContinue = "0"; | 
|             var param = { | 
|                 Type: "0,1" | 
|             }; | 
|             sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) { | 
|                 if (res.code == 0) { //成功 | 
|                     $("#BillCode").empty(); | 
|                     $("#BillCode").append("<option value =''></option>"); | 
|                     for (var i = 0; i < res.data.length; i++) { | 
|                         $("#BillCode").append('<option value =' + res.data[i].ASNNo + '>' + res.data[i].ASNNo + | 
|                             '</option>'); | 
|                     } | 
|                     form.render('select'); | 
|                 } else { //不成功 | 
|                     layer.msg(res.msg, { | 
|                         icon: 2, | 
|                         time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                     }, function () { }); | 
|                 } | 
|             }); | 
|             // 绑定入库单物料及批次 | 
|             function updateGoodList() { | 
|   | 
|                 $("#detail").empty() | 
|                 $("#detail").append('<option value =>' + '</option>'); | 
|   | 
|                 var param = { | 
|                     AsnNo: $("#BillCode").val(), | 
|                 }; | 
|                 synData(IP + "/PdaAsn/GetArrivalNoticeDetails", param, 'post', function (res) { | 
|                     if (res.code == 0) { //成功 | 
|                         asnDetails = res.data; | 
|                         for (var i = 0; i < res.data.length; i++) { | 
|                             if (i == 0) { | 
|                                 $("#detail").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i] | 
|                                     .SkuName + "-" + res.data[i].LotNo + | 
|                                     '</option>'); | 
|                             } else { | 
|                                 $("#detail").append('<option value =' + res.data[i].Id + '>' + res.data[i] | 
|                                     .SkuName + "-" + res.data[i].LotNo + | 
|                                     '</option>'); | 
|                             } | 
|   | 
|                         } | 
|                         form.render('select'); | 
|                     } else { | 
|                         layer.msg(res.msg, { | 
|                             icon: 2, | 
|                             time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                         }, function () { }); | 
|                     } | 
|                 }); | 
|             } | 
|             form.on('select(BillCode)', function (data) { | 
|                 updateGoodList(); | 
|             }); | 
|             //连组按钮 | 
|             form.on('switch(IsLianXu)', function (obj) { | 
|                 if (obj.elem.checked) {  | 
|                     $('#BOX2').attr("style","display:block-inlink") | 
|                     IsContinue = "1"; | 
|                 } else {  | 
|                     $('#BOX2').attr("style","display:none") | 
|                     IsContinue = "0"; | 
|                 } | 
|                 $('#boxNo2').val(""); | 
|             }); | 
|   | 
|             //#endregion | 
|             laydate.render({ | 
|                 elem: '#StartTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             laydate.render({ | 
|                 elem: '#EndTime' | 
|                 , format: 'yyyy-MM-dd' //可任意组合 | 
|             }); | 
|             renderTable(null); | 
|   | 
|             function renderTable(list) { | 
|                 var tableIns = table.render({ | 
|                     elem: '#Box-list', | 
|                     height: 'full-195', | 
|                     id: 'Box-list', | 
|                     data: list, | 
|                     page: true, | 
|                     limit: 10,  //默认多少页 | 
|                     limits: [10, 15],    //默认数组[10,20,30,40,50] | 
|                     cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增 | 
|                     even: true, //隔行换色 | 
|                     cols: [ | 
|                     [ | 
|                         {field: 'BoxNo',title: '箱码',align: 'center',fixed: 'left',width:220}, | 
|                         {field: 'SkuNo',title: '物料编号',align: 'center',width:150}, | 
|                         {field: 'SkuName',title: '物料名称',align: 'center'}, | 
|                         {field: 'LotNo',templet: '#buttonTpl',title: '批次号',align: 'center',width:150},  | 
|                         {field: 'Qty',title: '实际数量',align: 'center',width:150},  | 
|                         // {field: 'Standard',title: '物品规格',align: 'center'},  | 
|                         //{title: '操作',width: 100,align: 'center',toolbar: '#table-content-list'} | 
|                     ]], | 
|   | 
|                 }); | 
|             } | 
|              | 
|   | 
|             //搜索箱码集合 | 
|             form.on('submit(confirm)', function (data) { | 
|   | 
|                 var result = true;  | 
|                 if (result) { | 
|                     var param = { | 
|                         boxNo: data.field.boxNo, | 
|                         isContinue: IsContinue, | 
|                         boxNo2: data.field.boxNo2, | 
|                     }; | 
|                     sendData(IP + "/BllAsn/GetBoxInfoListByBoxCode", param, 'get', function (res) { | 
|                         console.log(res); | 
|                         if (res.code == 0) { //成功 | 
|                             renderTable(res.data) | 
|                         } else { //不成功 | 
|                             layer.msg(res.msg, { | 
|                                 icon: 2, | 
|                                 time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                             }, function () { }); | 
|                         } | 
|                     }); | 
|                 } | 
|   | 
|                 return false; | 
|   | 
|             }); | 
|   | 
|             table.on('tool(Box-list)', function (obj) { | 
|                 var data = obj.data; | 
|                 // console.log(obj.event); | 
|                 if (obj.event === 'del') { | 
|                     layer.confirm('确定删除箱码信息?', { offset: ['20%', '35%'] }, function (index) { | 
|                         console.log(data); | 
|                         console.log(index); | 
|                         for (let i = 0; i < list.length; i++) { | 
|                             const ele = list[i]; | 
|                             if (ele.BoxCode == data.BoxCode) { | 
|                                 list.splice(i, 1) | 
|                             } | 
|                         } | 
|                         renderTable(list) | 
|                         layer.close(index); | 
|                     }); | 
|   | 
|                 } | 
|             }); | 
|             var doing = true; | 
|             //提交箱码托盘关系 | 
|             form.on('submit(Create)', function () { | 
|   | 
|                 var result = true; | 
|                 if ($("#BillCode").val().replace(/\s/g, "") == "") { | 
|                     layer.msg("请填写入库单"); | 
|                     result = false; | 
|                     return; | 
|                 } | 
|                 if ($("#palletNo").val().replace(/\s/g, "") == "") { | 
|                     layer.msg("请填写托盘码"); | 
|                     result = false; | 
|                     return; | 
|                 } | 
|   | 
|                 if (result) {  | 
|                     var param = { | 
|                         AsnNo: $("#BillCode").val(), | 
|                         PalletNo: $("#palletNo").val(), | 
|                         AsnDetailId: parseInt($("#detail").val()), | 
|                         BoxNo: $("#boxNo").val(), | 
|                         IsContinue :IsContinue, | 
|                         TailBoxNo: $("#boxNo2").val(), | 
|                         Origin:"WMS" | 
|                     } | 
|   | 
|                     if (doing) { | 
|                         doing = false; | 
|                         //组盘 | 
|                         sendData(IP + "/PdaAsn/BindPallet", param, 'post', function (res) { | 
|                             if (res.code == 0) { //成功  | 
|                                 layer.msg(res.msg, { | 
|                                     icon: 1, | 
|                                     time: 1000 //2秒关闭(如果不配置,默认是3秒) | 
|                                 }, function () { | 
|                                     renderTable(null); | 
|                                     $("#boxNo").val(""); | 
|                                     $("#boxNo2").val(""); | 
|                                     var index = parent.layer.getFrameIndex(window.name) | 
|                                     parent.layer.close(index); //关闭弹层 | 
|                                     parent.layui.table.reload('PalletBind'); | 
|                                     parent.layui.table.reload('BoxInfo'); | 
|                                     doing = true; | 
|                                 }); | 
|                             } else { //不成功 | 
|                                 layer.msg(res.msg, { | 
|                                     icon: 2, | 
|                                     time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|                                 }, function () { doing = true;}); | 
|                             } | 
|                         }); | 
|   | 
|                     } | 
|                 } | 
|   | 
|                 return false; | 
|   | 
|             }); | 
|   | 
|             // //关闭弹窗 | 
|             // form.on('submit(Close)', function () { | 
|   | 
|             //     var index = parent.layer.getFrameIndex(window.name); | 
|             //     parent.layer.close(index); //关闭弹层 | 
|   | 
|             //     return false; | 
|   | 
|             // }); | 
|   | 
|         }) | 
|     </script> | 
| </body> | 
|   | 
| </html> |