| | |
| | | return R.ok("出库启动成功"); |
| | | } |
| | | |
| | | @RequestMapping("/locCheck/out/start") |
| | | @ManagerAuth(memo = "盘点出库") |
| | | public R locCheckOutStart(@RequestBody StockOutParam param) { |
| | | workService.locCheckOut(param, getUserId()); |
| | | return R.ok("出库启动成功"); |
| | | } |
| | | |
| | | @RequestMapping("/loc/move/start") |
| | | @ManagerAuth(memo = "库位移转") |
| | | public R locMoveStart(@RequestParam String sourceLocNo, |
| | |
| | | * 出库作业 |
| | | * @param staNo 目标站点 |
| | | * @param locDetls 待出库物料 |
| | | * @param ioType 入出库类型 |
| | | */ |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, Long userId); |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, Integer ioType, Long userId); |
| | | |
| | | /** |
| | | * 空板入库 |
| | |
| | | void emptyPlateOut(EmptyPlateOutParam param, Long userId); |
| | | |
| | | /** |
| | | * 盘点出库 |
| | | */ |
| | | void locCheckOut(StockOutParam param, Long userId); |
| | | |
| | | /** |
| | | * 库位移转 |
| | | */ |
| | | void locMove(String sourceLocNo, String locNo, Long userId); |
| | |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 |
| | | stockOut(staNo, locDetlDtos, userId); |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, 101, userId); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Long userId) { |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId) { |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo())); |
| | |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | // 获取路径 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 101) |
| | | .eq("type_no", ioType) |
| | | .eq("stn_no", staNo.getDevNo()) |
| | | .eq("crn_no", locMast.getCrnNo()); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(101); // 入出库状态:101.出库 |
| | | wrkMast.setIoType(ioType); // 入出库状态:101.出库 |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | if (detlDto.getCount() <= 0.0D) {continue;} |
| | | if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;} |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(detlDto.getLocDetl().getMatnr()); |
| | | wrkDetl.setAnfme(detlDto.getCount()); // 数量 |
| | | Double anfme = ioType==101?detlDto.getCount():detlDto.getLocDetl().getAnfme(); |
| | | wrkDetl.setAnfme(anfme); // 数量 |
| | | wrkDetl.setZmatid(detlDto.getLocDetl().getZmatid()); |
| | | wrkDetl.setTbpos(detlDto.getLocDetl().getTbpos()); |
| | | wrkDetl.setTbnum(detlDto.getLocDetl().getTbnum()); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void locCheckOut(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | if (!Cools.isEmpty(locDetl.getLocNo(), locDetl.getMatnr())) { |
| | | LocDetl sqlParam = new LocDetl(); |
| | | sqlParam.setLocNo(locDetl.getLocNo()); |
| | | sqlParam.setMatnr(locDetl.getMatnr()); |
| | | LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam)); |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, locDetl.getCount())); |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, 107, userId); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void locMove(String sourceLocNo, String locNo, Long userId) { |
| | | LocMast sourceLoc = locMastService.selectById(sourceLocNo); |
| | | if (Cools.isEmpty(sourceLoc)){ |
New file |
| | |
| | | var pageCurr; |
| | | 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', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | data: [], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | // {field: 'count', align: 'center',title: '出库数量', edit:'text', width: 130, style:'color: blue;font-weight: bold'} // todo |
| | | ,{field: 'anfme', align: 'center',title: '原数量'} |
| | | ,{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: 'altme', align: 'center',title: '单位', width:80} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'bname', align: 'center',title: '用户ID'} |
| | | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80} // todo |
| | | ]], |
| | | done: function(res, curr, count) { |
| | | limit(); |
| | | getOutBound(); |
| | | } |
| | | }); |
| | | |
| | | // 页面修改 |
| | | table.on('edit(chooseData)', function (obj) { |
| | | updateLocDetlData(obj.data.locNo, obj.data.matnr, Number(obj.value)); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(chooseData)', function (obj) { |
| | | var data = locDetlData; |
| | | switch (obj.event) { |
| | | case 'outbound': |
| | | if (data.length === 0){ |
| | | layer.msg('请先添加库位物料'); |
| | | } else { |
| | | var staNo = $("#staNoSelect").val(); |
| | | if (staNo === "" || staNo === null){ |
| | | layer.msg("请选择出库口"); |
| | | return; |
| | | } |
| | | var locDetls = []; |
| | | data.forEach(function(elem) { |
| | | // locDetls.push({locNo: elem.locNo, matnr: elem.matnr, count: elem.count}); // todo |
| | | locDetls.push({locNo: elem.locNo, matnr: elem.matnr}); |
| | | }); |
| | | let param = { |
| | | outSite: staNo, |
| | | locDetls: locDetls |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl+"/locCheck/out/start", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | locDetlData = []; |
| | | tableIns.reload({data: locDetlData,done:function (res) {limit();getOutBound();}}); |
| | | layer.msg(res.msg); |
| | | } 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 = locDetlData.length - 1; i >= 0; i--) { |
| | | if (locDetlData[i].locNo === data.locNo && locDetlData[i].matnr === data.matnr) { |
| | | locDetlData.splice(i, 1); |
| | | } |
| | | } |
| | | tableIns.reload({data: locDetlData,done:function (res) {limit();getOutBound();}}); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | function updateLocDetlData(locNo, matnr, count) { |
| | | if (isNaN(count)) { |
| | | layer.msg("请输入数字"); |
| | | } else { |
| | | if (count > 0) { |
| | | for (var i=0;i<locDetlData.length;i++){ |
| | | if (locDetlData[i]["locNo"] === locNo && locDetlData[i]["matnr"] === matnr){ |
| | | if (count > locDetlData[i]["anfme"]) { |
| | | layer.msg("不能超过原数量"); |
| | | } else { |
| | | locDetlData[i]["count"] = count; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | layer.msg("数量必须大于零"); |
| | | } |
| | | } |
| | | tableIns.reload({data: locDetlData,done:function (res) {limit(); getOutBound();}}); |
| | | } |
| | | |
| | | // 获取出库口 |
| | | function getOutBound(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/available/take/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var tpl = $("#takeSiteSelectTemplate").html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | $('#staNoSelect').append(html); |
| | | form.render('select'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // 提取物料 |
| | | var locDetlLayerIdx; |
| | | function getLocDetl() { |
| | | locDetlLayerIdx = layer.open({ |
| | | type: 2, |
| | | title: '提取物料', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: 'locDetlQuery.html', |
| | | success: function(layero, index){ |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 添加表格数据 |
| | | function addTableData(data) { |
| | | for (var i=0;i<data.length;i++){ |
| | | let pass = false; |
| | | for (var j=0;j<locDetlData.length;j++){ |
| | | if (data[i].matnr === locDetlData[j].matnr && data[i].locNo$ === locDetlData[j].locNo$) { |
| | | pass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (pass) { |
| | | data.splice(i--, 1); |
| | | } else { |
| | | data[i]["count"] = data[i]["anfme"]; |
| | | } |
| | | |
| | | } |
| | | locDetlData.push.apply(locDetlData, data); |
| | | tableIns.reload({data: locDetlData}); |
| | | layer.close(locDetlLayerIdx); |
| | | } |
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); |
| | | } |
| | | #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-outbound { |
| | | margin-left: 60px; |
| | | } |
| | | |
| | | /*----------------------------------*/ |
| | | .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; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body style="padding-bottom: 30px"> |
| | | |
| | | <!-- 功能区 --> |
| | | <div class="function-area"> |
| | | <button id="mat-query" class="function-btn" onclick="getLocDetl()">新增</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"> |
| | | <!-- 1.选择出库口 --> |
| | | <span id="staNoSpan">出库口:</span> |
| | | <select id="staNoSelect" lay-verify="required"> |
| | | <!-- <option value="">请选择站点</option>--> |
| | | </select> |
| | | <!-- 2.启动出库 --> |
| | | <button class="layui-btn layui-btn-lg" id="btn-outbound" lay-event="outbound">盘点出库</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/pakStore/stockOut.js" charset="utf-8"></script> |
| | | |
| | | <script type="text/template" id="takeSiteSelectTemplate"> |
| | | {{#each data}} |
| | | <option value="{{this}}">{{this}}</option> |
| | | {{/each}} |
| | | </script> |
| | | |
| | | <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/pakStore/locCheckOut.js" charset="utf-8"></script> |
| | | |
| | | </body> |
| | | </html> |
| | | |