New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/3/26 |
| | | */ |
| | | |
| | | @RestController |
| | | public class OutController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | @PostMapping("/out/pakout/preview/auth") |
| | | public R pakoutPreview(@RequestBody List<Long> ids) { |
| | | if (Cools.isEmpty(ids)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | return R.ok().add(orderDetls); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | }); |
| | | |
| | | /* 表格2头工具栏点击事件 */ |
| | | table.on('toolbar(sensorTable)', function (obj) { |
| | | if (obj.event === 'add') { // 添加 |
| | | showEditModel() |
| | | table.on('toolbar(orderDetlTable)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | if (obj.event === 'pakoutPreview') { // 添加 |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择至少一条出库明细', {icon: 2}); |
| | | return; |
| | | } |
| | | pakoutPreview(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | var checkRows = table.checkStatus('sensorTable'); |
| | | if (checkRows.data.length === 0) { |
| | |
| | | }); |
| | | |
| | | /* 表格2工具条点击事件 */ |
| | | table.on('tool(sensorTable)', function (obj) { |
| | | table.on('tool(orderDetlTable)', function (obj) { |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'detl': |
| | | top.sensorByDetl = data.id; |
| | | // 出库 |
| | | case 'pakoutPreview': |
| | | pakoutPreview([data.id]) |
| | | break; |
| | | // 编辑 |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | // 删除 |
| | | case 'del': |
| | | var ids = [data.id]; |
| | | doDelSensor({ids: ids}); |
| | | break; |
| | | // 基点定位 |
| | | case 'lbs': |
| | | notice.msg('请求中...', {icon: 4, position: "topCenter"}); |
| | | var param = { |
| | | uuid: data.uuid, |
| | | event: obj.event |
| | | }; |
| | | } |
| | | }); |
| | | |
| | | function pakoutPreview(ids) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/main/command/v1/auth", |
| | | url: baseUrl + "/out/pakout/preview/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | contentType:'application/json;charset=UTF-8', |
| | | data: JSON.stringify(ids), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | notice.destroy(); |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | admin.open({ |
| | | title: '终端响应', |
| | | url: 'callback.html', |
| | | area: '360px', |
| | | data: { |
| | | request: param, |
| | | response: res.data |
| | | }, |
| | | tpl: true |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: false |
| | | ,closeBtn: false |
| | | ,offset: '100px' |
| | | ,area: '1000px' |
| | | ,shade: 0.5 |
| | | ,shadeClose: true |
| | | ,btn: ['立即生成', '稍后处理'] |
| | | ,btnAlign: 'c' |
| | | ,moveType: 1 //拖拽模式,0或者1 |
| | | ,content: $('#pakoutPreviewBox') |
| | | ,success: function(layero, index){ |
| | | console.log(res.data) |
| | | table.render({ |
| | | elem: '#stoPreTab', |
| | | data: res.data, |
| | | page: false, |
| | | cellMinWidth: 100, |
| | | height: 432, |
| | | cols: [[ |
| | | {field: 'title', title: '商品', merge: true, align: 'center'}, |
| | | {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90}, |
| | | {field: 'type', title: '仓库', merge: true, align: 'center', templet: '#typeTpl', width: 90}, |
| | | {field: 'locNo', title: '货位', align: 'center'}, |
| | | {field: 'prior$', title: '推荐货位', align: 'center', width: 100}, |
| | | {field: 'reduce', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | // {field: 'remQty', title: '余量', align: 'center', width: 80}, |
| | | {field: 'total', title: '总量', align: 'center', width: 90}, |
| | | ]], |
| | | done: function () { |
| | | $('.layui-table-body.layui-table-main').css("overflow", "auto") |
| | | } |
| | | }); |
| | | |
| | | } |
| | | ,yes: function(index, layero){ |
| | | //按钮【马上拣货】的回调 |
| | | stockOut(data.orderNo); |
| | | } |
| | | ,btn2: function(index, layero){ |
| | | //按钮【稍后处理】的回调 |
| | | layer.close(index) |
| | | //return false 开启该代码可禁止点击该按钮关闭 |
| | | } |
| | | }); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | }); |
| | | |
| | | // 设备明细展开回调 |
| | | window.onSensorDetlDialog = function () { |
| | | }; |
| | | |
| | | |
| | | /* 显示表单弹窗 */ |
| | |
| | | {field: 'orderNo', title: '单据编号', align: 'center'} |
| | | ]], |
| | | done: function (res, curr, count) { |
| | | console.log(res) |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } |
| | | }); |
| | |
| | | } |
| | | |
| | | /* 权限控制 */ |
| | | #btn-add { |
| | | display: none; |
| | | } |
| | | #btn-delete { |
| | | display: none; |
| | | } |
| | | .btn-edit { |
| | | display: none; |
| | | } |
| | | .btn-more { |
| | | display: none; |
| | | } |
| | | /*#btn-add {*/ |
| | | /* display: none;*/ |
| | | /*}*/ |
| | | /*#btn-delete {*/ |
| | | /* display: none;*/ |
| | | /*}*/ |
| | | /*.btn-edit {*/ |
| | | /* display: none;*/ |
| | | /*}*/ |
| | | /*.btn-more {*/ |
| | | /* display: none;*/ |
| | | /*}*/ |
| | | </style> |
| | | </head> |
| | | <body> |
| | |
| | | <!-- 头工具栏 --> |
| | | <script type="text/html" id="orderDetToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm layui-btn-normal" id="btn-add" lay-event="add"><i class="layui-icon"></i>新增</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="del"><i class="layui-icon"></i>删除</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger btn-pakoutPreview" id="btn-pakoutPreview" lay-event="pakoutPreview">批量出库</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <!-- 行工具栏 --> |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-xs btn-edit" lay-event="detl" ew-event="popupRight" |
| | | data-type="1" data-window="top" data-area="1250px" data-url="sensor5/sensor_detl.html"> |
| | | <i class="layui-icon"></i>查看</a> |
| | | <a class="layui-btn layui-btn-xs layui-btn-primary btn-edit" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>修改</a> |
| | | {{#if (d.anfme > d.qty){ }} |
| | | <a class="layui-btn layui-btn-xs layui-btn-danger btn-pakoutPreview" lay-event="pakoutPreview"><i class="layui-icon layui-icon-prev-circle"></i>出库</a> |
| | | {{# } }} |
| | | </script> |
| | | |
| | | <!-- 出库预览 --> |
| | | <div id="pakoutPreviewBox" style="display: none"> |
| | | <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> |
| | | <table id="stoPreTab" lay-filter="stoPreTab"></table> |
| | | </div> |
| | | |
| | | <!-- 行样式 --> |
| | | <script type="text/html" id="orderNoTpl"> |
| | | <span name="orderNo" class="layui-badge layui-badge-gray">{{d.orderNo}}</span> |