自动化立体仓库 - WMS系统
luxiaotao1123
2022-03-26 3602043d8c79939e1feebb22e4dfcae629d7fde6
src/main/webapp/static/js/order/out.js
@@ -24,33 +24,33 @@
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#orderDetToolbar',
        height: 'full-100',
        height: 'full-120',
        cols: [[
            {type: 'checkbox'}
            ,{type: 'number', title: '#'}
            ,{field: 'orderNo', align: 'center',title: '单据编号'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'matnr', align: 'center',title: '商品编码'}
            ,{field: 'maktx', align: 'center',title: '商品名称'}
            ,{field: 'name', align: 'center',title: '名称'}
            ,{field: 'specs', align: 'center',title: '规格'}
            ,{field: 'model', align: 'center',title: '型号'}
            ,{type: 'numbers', title: '#'}
            ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160}
            ,{field: 'matnr', align: 'center',title: '商品编码', width: 160}
            ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            ,{field: 'batch', align: 'center',title: '批号'}
            ,{field: 'unit', align: 'center',title: '单位'}
            ,{field: 'barcode', align: 'center',title: '商品条码'}
            ,{field: 'supplier', align: 'center',title: '供应商'}
            ,{field: 'unitPrice', align: 'center',title: '单价'}
            ,{field: 'itemNum', align: 'center',title: '品项数'}
            ,{field: 'count', align: 'center',title: '数量'}
            ,{field: 'weight', align: 'center',title: '重量'}
            ,{field: 'status$', align: 'center',title: '状态'}
            ,{field: 'createBy$', align: 'center',title: '添加人员'}
            ,{field: 'createTime$', align: 'center',title: '添加时间'}
            ,{field: 'updateBy$', align: 'center',title: '修改人员'}
            ,{field: 'updateTime$', align: 'center',title: '修改时间'}
            ,{field: 'memo', align: 'center',title: '备注'}
            ,{field: 'specs', align: 'center',title: '规格'}
            // ,{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}
            ,{field: 'barcode', align: 'center',title: '商品条码', hide: true}
            // ,{field: 'supplier', align: 'center',title: '供应商'}
            // ,{field: 'unitPrice', align: 'center',title: '单价'}
            // ,{field: 'itemNum', align: 'center',title: '品项数'}
            // ,{field: 'count', align: 'center',title: '数量'}
            // ,{field: 'weight', align: 'center',title: '重量'}
            // ,{field: 'status$', align: 'center',title: '状态'}
            // ,{field: 'createBy$', align: 'center',title: '添加人员'}
            // ,{field: 'createTime$', align: 'center',title: '添加时间'}
            // ,{field: 'updateBy$', align: 'center',title: '修改人员'}
            // ,{field: 'updateTime$', align: 'center',title: '修改时间'}
            // ,{field: 'memo', align: 'center',title: '备注'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 160}
        ]],
        request: {
@@ -83,9 +83,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) {
@@ -100,61 +107,85 @@
    });
    /* 表格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'
                        ,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})
                }
            }
        })
    }
    /* 显示表单弹窗 */