|  |  |  | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/common.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | body { | 
|---|
|  |  |  | padding: 0 20px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-table-box { | 
|---|
|  |  |  | border-right: 1px solid #9F9F9F; | 
|---|
|  |  |  | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div style="padding: 25px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;"> | 
|---|
|  |  |  | <span style="font-size: large; font-weight: bold">提取库存商品</span> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 搜索栏 --> | 
|---|
|  |  |  | <fieldset class="layui-elem-field site-demo-button" style="margin: 20px;"> | 
|---|
|  |  |  | <legend>搜索栏</legend> | 
|---|
|  |  |  | <!-- 搜索栏 --> | 
|---|
|  |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline cool-auto-complete"> | 
|---|
|  |  |  | <input id="standby1" class="layui-input" name="standby1" type="text" placeholder="请输入" autocomplete="off" style="display: none"> | 
|---|
|  |  |  | <input id="standby1$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="仓库" onfocus=this.blur()> | 
|---|
|  |  |  | <div class="cool-auto-complete-window"> | 
|---|
|  |  |  | <input class="cool-auto-complete-window-input" data-key="storeTypeQueryBystandby1" onkeyup="autoLoad(this.getAttribute('data-key'))"> | 
|---|
|  |  |  | <select class="cool-auto-complete-window-select" data-key="storeTypeQueryBystandby1Select" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline cool-auto-complete"> | 
|---|
|  |  |  | <input id="crnNo" class="layui-input" name="crnNo" type="text" placeholder="请输入" autocomplete="off" style="display: none"> | 
|---|
|  |  |  | <input id="crnNo$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="堆垛机号" onfocus=this.blur()> | 
|---|
|  |  |  | <div class="cool-auto-complete-window"> | 
|---|
|  |  |  | <input class="cool-auto-complete-window-input" data-key="basCrnpQueryBycrnNo" onkeyup="autoLoad(this.getAttribute('data-key'))"> | 
|---|
|  |  |  | <select class="cool-auto-complete-window-select" data-key="basCrnpQueryBycrnNoSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="matnr" placeholder="箱号/批号"  autocomplete="off"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="matnr" placeholder="商品编号"  autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="mat_name" placeholder="物料名称" autocomplete="off"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="batch" placeholder="批次"  autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="specs" placeholder="规格"  autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="maktx" placeholder="物料描述" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select name="frozen" class="layui-input" type="text" autocomplete="off"> | 
|---|
|  |  |  | <option value="">冻结否</option> | 
|---|
|  |  |  | <option value="0">未冻结</option> | 
|---|
|  |  |  | <option value="1">已冻结</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 日期范围 --> | 
|---|
|  |  |  | <div class="layui-inline" style="width: 300px"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input layui-laydate-range" name="modi_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 待添加 --> | 
|---|
|  |  |  | <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> | 
|---|
|  |  |  | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
|---|
|  |  |  | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </fieldset> | 
|---|
|  |  |  | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function() { | 
|---|
|  |  |  | function getCol() { | 
|---|
|  |  |  | var cols = [ | 
|---|
|  |  |  | {type: 'checkbox', merge: ['locNo']} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位号', merge: true, style: 'font-weight: bold'} | 
|---|
|  |  |  | // ,{field: 'locNo$', align: 'center',title: '库位号'} | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | cols.push.apply(cols, detlCols); | 
|---|
|  |  |  | cols.push({field: 'modiUser$', align: 'center',title: '修改人员', hide: true} | 
|---|
|  |  |  | ,{field: 'modiTime$', align: 'center',title: '修改时间'}) | 
|---|
|  |  |  | return cols; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'admin', 'tableMerge'], function() { | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  | var tableMerge = layui.tableMerge; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | locDetlTableIns = table.render({ | 
|---|
|  |  |  | elem: '#stockOut', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/stock/out/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: 10, | 
|---|
|  |  |  | limits: [16, 30, 50, 100, 200, 500], | 
|---|
|  |  |  | limit: 16, | 
|---|
|  |  |  | even: true, | 
|---|
|  |  |  | toolbar: '#toolbar', | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'locNo$', align: 'center',title: '库位号'} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '物料'} | 
|---|
|  |  |  | ,{field: 'lgnum', align: 'center',title: '仓库号', width:80} | 
|---|
|  |  |  | ,{field: 'tbnum', align: 'center',title: '转储请求编号'} | 
|---|
|  |  |  | // ,{field: 'tbpos', align: 'center',title: '行项目'} | 
|---|
|  |  |  | ,{field: 'zmatid', align: 'center',title: '物料标签ID', width:200} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '物料描述', width:150} | 
|---|
|  |  |  | ,{field: 'werks', align: 'center',title: '工厂'} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '数量', width:80} | 
|---|
|  |  |  | ,{field: 'altme', align: 'center',title: '单位', width:80} | 
|---|
|  |  |  | ,{field: 'zpallet', align: 'center',title: '托盘条码'} | 
|---|
|  |  |  | ,{field: 'bname', align: 'center',title: '用户ID'} | 
|---|
|  |  |  | // ,{field: 'memo', align: 'center',title: '备注'} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | cols: [getCol()], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | 
|---|
|  |  |  | statusCode: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function(res, curr, count) { | 
|---|
|  |  |  | tableMerge.render(this); | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | form.on('checkbox(tableCheckbox)', function (data) { | 
|---|
|  |  |  | var _index = $(data.elem).attr('table-index')||0; | 
|---|
|  |  |  | if(data.elem.checked){ | 
|---|
|  |  |  | res.data[_index][data.value] = 'Y'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | res.data[_index][data.value] = 'N'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | layer.msg("请选择数据"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (var i=0;i<data.length;i++){ | 
|---|
|  |  |  | data[i]["count"] = data[i]["anfme"]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (data.some(obj => obj.frozen === 1)) { | 
|---|
|  |  |  | layer.msg("冻结的库存不允许出库!"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | parent.locDetlData.push.apply(parent.locDetlData, data); | 
|---|
|  |  |  | parent.tableIns.reload({data: parent.locDetlData}); | 
|---|
|  |  |  | parent.layer.close(parent.locDetlLayerIdx); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let locNos = []; | 
|---|
|  |  |  | data.forEach(function(elem) { | 
|---|
|  |  |  | locNos.push(elem.locNo); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locDetl/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {locNos:locNos}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | data = res.data; | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl + "/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | parent.addTableData(data); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 搜索栏搜索事件 | 
|---|
|  |  |  | form.on('submit(search)', function (data) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | tableReload(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 搜索栏重置事件 | 
|---|
|  |  |  | form.on('submit(reset)', function (data) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | clearFormVal($('#search-box')); | 
|---|
|  |  |  | tableReload(); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '.layui-laydate-range' | 
|---|
|  |  |  | ,type: 'datetime' | 
|---|
|  |  |  | ,range: true | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function tableReload(child) { | 
|---|
|  |  |  | function tableReload() { | 
|---|
|  |  |  | var searchData = {}; | 
|---|
|  |  |  | $.each($('#search-box [name]').serializeArray(), function() { | 
|---|
|  |  |  | searchData[this.name] = this.value; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | locDetlTableIns.reload({ | 
|---|
|  |  |  | where: searchData, | 
|---|
|  |  |  | page: { | 
|---|
|  |  |  | curr: pageCurr | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function (res, curr, count) { | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | if (res.data.length === 0 && count !== 0) { | 
|---|
|  |  |  | locDetlTableIns.reload({ | 
|---|
|  |  |  | where: searchData, | 
|---|
|  |  |  | page: { | 
|---|
|  |  |  | curr: pageCurr-1 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | pageCurr -= 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function clearFormVal(el) { | 
|---|
|  |  |  | $(':input', el) | 
|---|
|  |  |  | .val('') | 
|---|
|  |  |  | .removeAttr('checked') | 
|---|
|  |  |  | .removeAttr('selected'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </html> | 
|---|