1.0.5
1.增加平仓入库功能
2.优化平仓管理出入库状态查询功能
| | |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.eq("state", "1").or().eq("state", "2"); |
| | | if (Cools.isEmpty(param.get("state"))) { |
| | | wrapper.eq("state", "1").or().eq("state", "2"); |
| | | } |
| | | return R.ok(locNormalService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | locNormalService.pdaLocNormalIn(param.getNormalList()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /* 平仓入库 */ |
| | | @RequestMapping(value = "/locNormal/in") |
| | | @ManagerAuth(memo = "平仓入库") |
| | | @Transactional |
| | | public R locNormalIn(@RequestBody LocNormalParam param) { |
| | | Long userId = getUserId(); |
| | | Date timeNow = new Date(); |
| | | for (Integer i = 0; i < param.getNormalList().size(); i++) { |
| | | param.getNormalList().get(i).setAppeUser(userId); |
| | | param.getNormalList().get(i).setAppeTime(timeNow); |
| | | } |
| | | locNormalService.locNormalIn(param.getNormalList()); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | public void removeLocNormal(@Param("matnr") String matnr, @Param("modiUser") Long modiUser, @Param("modiTime") Date modiTime); |
| | | |
| | | public void pdaLocNormalIn(List<LocNormal> list); |
| | | |
| | | public void locNormalIn(List<LocNormal> list); |
| | | } |
| | |
| | | public void removeLocNormal(String matnr, Long modiUser, Date modiTime); |
| | | |
| | | public void pdaLocNormalIn(List<LocNormal> list); |
| | | |
| | | public void locNormalIn(List<LocNormal> list); |
| | | } |
| | |
| | | public void pdaLocNormalIn(List<LocNormal> list) { |
| | | baseMapper.pdaLocNormalIn(list); |
| | | } |
| | | |
| | | @Override |
| | | public void locNormalIn(List<LocNormal> list) { |
| | | baseMapper.locNormalIn(list); |
| | | } |
| | | } |
| | |
| | | </foreach> |
| | | END; |
| | | </insert> |
| | | |
| | | <insert id="locNormalIn"> |
| | | BEGIN |
| | | <foreach collection="list" item="item" index="index"> |
| | | INSERT INTO asr_loc_normal (matnr, maktx, anfme, altme, lgnum, type, supplier, brand, warehouse, state, |
| | | appe_user, appe_time) |
| | | VALUES (#{item.matnr,jdbcType=VARCHAR}, #{item.maktx,jdbcType=VARCHAR}, #{item.anfme,jdbcType=DECIMAL}, |
| | | #{item.altme,jdbcType=VARCHAR},#{item.lgnum, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR}, |
| | | #{item.supplier, jdbcType=VARCHAR},#{item.brand, jdbcType=VARCHAR}, |
| | | #{item.warehouse,jdbcType=VARCHAR}, '1', #{item.appeUser,jdbcType=DECIMAL}, |
| | | #{item.appeTime,jdbcType=TIMESTAMP}) |
| | | </foreach> |
| | | END; |
| | | </insert> |
| | | </mapper> |
| New file |
| | |
| | | var initCountVal = 0; |
| | | var matCodeData = []; |
| | | var index = 0; |
| | | |
| | | function getCol() { |
| | | var cols = [ |
| | | // {type: 'checkbox', fixed: 'left'}, |
| | | { |
| | | fixed: 'left', |
| | | field: 'anfme', |
| | | title: '数量(必填)', |
| | | align: 'center', |
| | | edit: 'text', |
| | | width: 120, |
| | | style: 'color: blue;font-weight: bold' |
| | | } |
| | | ]; |
| | | locNormalCols.map(function (item) { |
| | | if (item.field === 'supplier') { |
| | | item.edit = 'text'; |
| | | } |
| | | }) |
| | | cols.push.apply(cols, locNormalCols); |
| | | // cols.push({field: 'matStatus', title: '物料状态', align: 'center', width: 120, templet: '#matStatus'}); |
| | | cols.push({fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 80}); |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table', 'laydate', 'form'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#chooseData', |
| | | data: [], |
| | | even: true, |
| | | limit: 500, |
| | | cellMinWidth: 50, |
| | | toolbar: '#toolbar', |
| | | cols: [getCol()], |
| | | done: function (res, curr, count) { |
| | | $('td[data-field=count] div').html(initCountVal); |
| | | setMatCodeData(res.data); |
| | | limit(); |
| | | getInBound(); |
| | | } |
| | | }); |
| | | |
| | | // 页面修改 |
| | | table.on('edit(chooseData)', function (obj) { |
| | | if (obj.field === 'anfme') { |
| | | updateMatCodeData(obj.data.matnr, Number(obj.value), obj.data.index); |
| | | } |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(chooseData)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | var data = checkStatus.data; |
| | | switch (obj.event) { |
| | | case 'comb': |
| | | // 判断是否存在物料 |
| | | if (matCodeData.length === 0) { |
| | | layer.msg("请先添加物料"); |
| | | return; |
| | | } |
| | | // 判断物料数量是否存在异常 |
| | | for (var i = 0; i < matCodeData.length; i++) { |
| | | if (isNaN(matCodeData[i].anfme)) { |
| | | layer.msg("请输入数字"); |
| | | return; |
| | | } |
| | | if (matCodeData[i].anfme === 0) { |
| | | layer.msg("数量不能为零"); |
| | | return; |
| | | } |
| | | } |
| | | // 判断库区是否为空 |
| | | var warehouse = $('#putSiteSelect').val(); |
| | | if (!warehouse || warehouse === '') { |
| | | layer.msg("请选择库区"); |
| | | return; |
| | | } |
| | | // 入库数据赋值库区 |
| | | matCodeData.map(function (item) { |
| | | item.warehouse = warehouse; |
| | | }); |
| | | // 请求接口进行平仓入库 |
| | | $.ajax({ |
| | | url: baseUrl + "/locNormal/in", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | normalList: matCodeData, |
| | | }), |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | layer.msg("入库启动成功"); |
| | | matCodeData = []; |
| | | tableIns.reload({ |
| | | data: matCodeData, done: function (res) { |
| | | limit(); |
| | | getInBound(); |
| | | } |
| | | }); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(chooseData)', function (obj) { |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'remove': |
| | | for (var i = matCodeData.length - 1; i >= 0; i--) { |
| | | if (matCodeData[i].matnr === data.matnr && matCodeData[i].index === data.index) { |
| | | matCodeData.splice(i, 1); |
| | | } |
| | | } |
| | | tableIns.reload({ |
| | | data: matCodeData, |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | function setMatCodeData(data) { |
| | | matCodeData = data; |
| | | for (var i = 0; i < matCodeData.length; i++) { |
| | | matCodeData[i]["count"] = initCountVal; |
| | | } |
| | | } |
| | | |
| | | function updateMatCodeData(matnr, count, index) { |
| | | if (isNaN(count)) { |
| | | layer.msg("请输入数字"); |
| | | } else { |
| | | if (count > 0) { |
| | | for (var i = 0; i < matCodeData.length; i++) { |
| | | if (matCodeData[i]["matnr"] === matnr && matCodeData[i]["index"] === index) { |
| | | matCodeData[i]["anfme"] = count; |
| | | } |
| | | } |
| | | } else { |
| | | layer.msg("数量必须大于零"); |
| | | } |
| | | } |
| | | |
| | | tableIns.reload({ |
| | | data: matCodeData, |
| | | }); |
| | | } |
| | | |
| | | // 获取可用入库站点 |
| | | function getInBound() { |
| | | // 获取仓库下拉 |
| | | $.ajax({ |
| | | url: baseUrl + "/locArea/queryAll/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | var html = ""; |
| | | if (res.data && res.data.length > 0) { |
| | | html += res.data.map(function (item) { |
| | | return "<Option value=" + item.id + ">" + item.name + "</Option>"; |
| | | }); |
| | | } |
| | | $('#putSiteSelect').append(html); |
| | | form.render('select'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | // 提取物料 |
| | | var matCodeLayerIdx; |
| | | function getMat() { |
| | | matCodeLayerIdx = layer.open({ |
| | | type: 2, |
| | | title: '提取物料', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: '../pakStore/matQuery.html', |
| | | success: function (layero, index) { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 添加表格数据 |
| | | function addTableData(data) { |
| | | // 数据格式转换 |
| | | var newData = []; |
| | | data.map(function (item) { |
| | | newData.push({ |
| | | matnr: item.matNo, |
| | | maktx: item.matName, |
| | | lgnum: item.str3, |
| | | type: item.str2, |
| | | supplier: item.str6, |
| | | warehouse: item.str7, |
| | | brand: item.str8, |
| | | altme: item.str1, |
| | | state: 1, // 入库状态 |
| | | anfme: 0, |
| | | index: index, |
| | | }); |
| | | }); |
| | | index++; |
| | | |
| | | for (var i = 0; i < newData.length; i++) { |
| | | let pass = false; |
| | | for (var j = 0; j < matCodeData.length; j++) { |
| | | if (newData[i].matnr === matCodeData[j].matNo) { |
| | | pass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (pass) { |
| | | newData.splice(i--, 1); |
| | | } else { |
| | | newData[i]["count"] = initCountVal; |
| | | } |
| | | } |
| | | matCodeData.push.apply(matCodeData, newData); |
| | | tableIns.reload({data: matCodeData}); |
| | | layer.close(matCodeLayerIdx); |
| | | } |
| | |
| | | </div> |
| | | |
| | | <!-- 功能区 --> |
| | | <div class="function-area"> |
| | | <button id="mat-query" class="function-btn" onclick="addLocNormal()">新增库存</button> |
| | | </div> |
| | | <!--<div class="function-area">--> |
| | | <!--<button id="mat-query" class="function-btn" onclick="addLocNormal()">新增库存</button>--> |
| | | <!--</div>--> |
| | | |
| | | |
| | | <!-- 表格 --> |
| | |
| | | {{# } else { }} |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="locArea"> |
| | | {{ |
| | | locArea.map(function(item){ |
| | | if (d.warehouse == item.id) { |
| | | return item.name; |
| | | } |
| | | }); |
| | | }} |
| | | </script> |
| | | <script type="text/html" id="operate"> |
| | | <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="outLocNormal">出库</button> |
| | | <button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="removeLocNormal">移除</button> |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <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, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <style> |
| | | html { |
| | | height: 100%; |
| | | padding: 10px; |
| | | background-color: #f1f1f1; |
| | | } |
| | | body { |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | box-shadow: 0 0 3px rgba(0,0,0,.3); |
| | | } |
| | | |
| | | .function-area { |
| | | padding: 20px 50px; |
| | | } |
| | | .function-btn { |
| | | font-size: 16px; |
| | | padding: 1px 1px 1px 1px; |
| | | width: 100px; |
| | | height: 50px; |
| | | border-color: #2b425b; |
| | | border-radius: 4px; |
| | | border-width: 2px; |
| | | background: none; |
| | | border-style: solid; |
| | | transition: 0.4s; |
| | | cursor: pointer; |
| | | letter-spacing: 3px; |
| | | } |
| | | .function-btn:hover { |
| | | background-color: #2b425b; |
| | | color: #fff; |
| | | } |
| | | |
| | | .layui-layer-page .layui-layer-content { |
| | | position: relative; |
| | | overflow: visible !important; |
| | | } |
| | | |
| | | #staNoSpan { |
| | | text-align: center; |
| | | display: inline-block; |
| | | width: 100px; |
| | | font-size: 13px; |
| | | } |
| | | .layui-btn-container .layui-form-select { |
| | | display: inline-block; |
| | | width: 150px; |
| | | height: 30px; |
| | | } |
| | | .layui-btn-container .layui-form-select.layui-form-selected { |
| | | display: inline-block; |
| | | width: 150px; |
| | | } |
| | | .layui-btn-container .layui-select-title input { |
| | | font-size: 13px; |
| | | } |
| | | .layui-btn-container .layui-anim.layui-anim-upbit dd { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | #btn-locIn { |
| | | margin-left: 60px; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | <!-- 功能区 --> |
| | | <div class="function-area"> |
| | | <button id="mat-query" class="function-btn" onclick="getMat()">新增</button> |
| | | </div> |
| | | |
| | | <hr> |
| | | |
| | | <!-- 表格 --> |
| | | <div style="padding-bottom: 5px; margin-bottom: 45px"> |
| | | |
| | | <!-- 头部 --> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-form"> |
| | | <div class="layui-btn-container" style="margin-bottom: 8px"> |
| | | <!-- 1.选择入库口 --> |
| | | <span id="staNoSpan">库区:</span> |
| | | <select id="putSiteSelect" lay-verify="required"> |
| | | <option value="">请选择站点</option> |
| | | </select> |
| | | <!-- 2.启动出库 --> |
| | | <button class="layui-btn layui-btn-normal layui-btn-lg" id="btn-locIn" lay-event="comb">启动入库</button> |
| | | </div> |
| | | </div> |
| | | </script> |
| | | |
| | | <!-- 行 --> |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">移除</a> |
| | | </script> |
| | | |
| | | <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> |
| | | </div> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> |
| | | <script type="text/javascript" src="../../static/js/locNormal/locNormalIn.js" charset="utf-8"></script> |
| | | |
| | | <script type="text/template" id="putSiteSelectTemplate"> |
| | | {{#each data}} |
| | | <option value="{{this}}">{{this}}</option> |
| | | {{/each}} |
| | | </script> |
| | | <script type="text/html" id="matStatus"> |
| | | {{ d.matStatus == '1' ? '<span style="color: green">良品</span>' : '<span style="color: red">不良品</span>' }} |
| | | </script> |
| | | </body> |
| | | </html> |
| | | |