自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-03-28 978a64cef6ac485bff42b2faa4caf0e5bf1276e0
src/main/webapp/static/js/order/out.js
@@ -4,7 +4,7 @@
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
    notice: 'notice/notice',
}).use(['table','laydate', 'form', 'util', 'admin', 'notice', 'treeTable', 'xmSelect'], function(){
}).use(['table','laydate', 'form', 'util', 'admin', 'notice', 'treeTable', 'xmSelect', 'tableMerge'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
@@ -15,6 +15,7 @@
    var notice = layui.notice;
    var treeTable = layui.treeTable;
    var xmSelect = layui.xmSelect;
    var tableMerge = layui.tableMerge;
    insTb2 = table.render({
        elem: '#orderDetlTable',
@@ -33,8 +34,9 @@
            ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            ,{field: 'batch', align: 'center',title: '批号'}
            ,{field: 'specs', align: 'center',title: '规格'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
            // ,{field: 'anfme', align: 'center',title: '数量'}
            // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
            ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'}
            // ,{field: 'name', align: 'center',title: '名称'}
            // ,{field: 'model', align: 'center',title: '型号'}
            ,{field: 'unit', align: 'center',title: '单位', hide: true}
@@ -82,9 +84,16 @@
    });
    /* 表格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) {
@@ -99,61 +108,89 @@
    });
    /* 表格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
                };
                $.ajax({
                    url: baseUrl+"/main/command/v1/auth",
                    headers: {'token': localStorage.getItem('token')},
                    data: JSON.stringify(param),
                    contentType:'application/json;charset=UTF-8',
                    method: 'POST',
                    success: function (res) {
                        notice.destroy();
                        if (res.code === 200){
                            admin.open({
                                title: '终端响应',
                                url: 'callback.html',
                                area: '360px',
                                data: {
                                    request: param,
                                    response: res.data
                                },
                                tpl: true
                            });
                        } else if (res.code === 403){
                            top.location.href = baseUrl+"/";
                        }else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }
                })
                break
        }
    });
    // 设备明细展开回调
    window.onSensorDetlDialog = function () {
    };
    function pakoutPreview(ids) {
        var loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl + "/out/pakout/preview/auth",
            headers: {'token': localStorage.getItem('token')},
            contentType: 'application/json;charset=UTF-8',
            data: JSON.stringify(ids),
            method: 'POST',
            success: function (res) {
                layer.close(loadIndex);
                if (res.code === 200){
                    layer.open({
                        type: 1
                        ,title: false
                        ,closeBtn: false
                        ,offset: '100px'
                        // ,area: ['1000px', '700px']
                        ,area: '1200px'
                        ,shade: 0.5
                        ,shadeClose: true
                        ,btn: ['立即生成', '稍后处理']
                        ,btnAlign: 'c'
                        ,moveType: 1 //拖拽模式,0或者1
                        ,content: $('#pakoutPreviewBox').html()
                        ,success: function(layero, index){
                            console.log(res.data)
                            table.render({
                                elem: '#stoPreTab',
                                data: res.data,
                                height: 432,
                                page: false,
                                limit: Number.MAX_VALUE,
                                cellMinWidth: 100,
                                cols: [[
                                    {type: 'checkbox', merge: ['orderNo']},
                                    {field: 'orderNo', title: '单据编号', merge: true, align: 'center'},
                                    {field: 'title', title: '商品', align: 'center', width: 350},
                                    {field: 'batch', title: '批号', merge: ['title'], align: 'center'},
                                    // {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90},
                                    {field: 'locNo', title: '货位', align: 'center', width: 90},
                                    {field: 'anfme', 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 () {
                                    tableMerge.render(this);
                                    $('.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})
                }
            }
        })
    }
    /* 显示表单弹窗 */