自动化立体仓库 - WMS系统
lty
7 天以前 539a56279625242c497b4b4093f2defbb9d80334
src/main/webapp/static/js/order/out.js
@@ -18,67 +18,107 @@
    var tableMerge = layui.tableMerge;
    var tableX = layui.tableX;
    insTb2 = table.render({
        elem: '#orderDetlTable',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/orderDetl/pakout/list/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#orderDetToolbar',
        height: 'full-120',
        where: {order_id: 9999999999},
        cols: [[
            {type: 'checkbox'}
            ,{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: '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: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
    var initTable = function() {
        insTb2 = table.render({
            elem: '#orderDetlTable',
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/orderDetl/pakout/list/auth',
            page: true,
            limit: 15,
            limits: [15, 30, 50, 100, 200, 500],
            toolbar: '#orderDetToolbar',
            height: 'full-120',
            text: {none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无数据'},
            where: {order_id: 9999999999},
            cols: [[
                {type: 'checkbox'}
                ,{type: 'numbers', title: '#'}
                ,{field: 'orderNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('order_no') : '单据编号', templet: '#orderNoTpl', width: 160}
                ,{field: 'matnr', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('mat_code') : '物料编码', width: 160}
                ,{field: 'maktx', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('mat_name') : '物料名称', width: 200}
                ,{field: 'batch', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('serial_code') : '批号'}
                ,{field: 'specs', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('spec') : '规格'}
                // ,{field: 'anfme', align: 'center',title: '数量'}
                // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
                ,{field: 'enableQty', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('outbound_pending_qty') : '待出库数量', style: 'font-weight: bold'}
                // ,{field: 'name', align: 'center',title: '名称'}
                // ,{field: 'model', align: 'center',title: '型号'}
                ,{field: 'unit', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('unit') : '单位', hide: true}
                ,{field: 'barcode', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('barcode') : '条码', 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: typeof I18n !== 'undefined' ? I18n.t('operation') : '操作', align: 'center', toolbar: '#operate', width: 160}
            ]],
            request: {
                pageName: 'curr',
                pageSize: 'limit'
            },
            parseData: function (res) {
                return {
                    'code': res.code,
                    'msg': res.msg,
                    'count': res.data.total,
                    'data': res.data.records
                }
            },
            response: {
                statusCode: 200
            },
            done: function(res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
                if (typeof I18n !== 'undefined' && I18n.isReady()) {
                    I18n.updatePage();
                    I18n.updateLayuiPagination();
                    if (count === 0) {
                        $('#orderDetlTable+.layui-table-view .layui-table-empty').text(I18n.t('no_data'));
                    }
                }
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
        }
        });
    }
    if (typeof I18n !== 'undefined' && I18n.isReady()) {
        initTable();
    } else {
        $(document).on('i18n:ready', function() {
            initTable();
        });
    }
    // 监听语言切换
    $(document).on('i18n:languageChanged', function () {
        insTb2.reload({
            text: {none: I18n.t('no_data')},
            cols: [[
                {type: 'checkbox'}
                ,{type: 'numbers', title: '#'}
                ,{field: 'orderNo', align: 'center',title: I18n.t('order_no'), templet: '#orderNoTpl', width: 160}
                ,{field: 'matnr', align: 'center',title: I18n.t('mat_code'), width: 160}
                ,{field: 'maktx', align: 'center',title: I18n.t('mat_name'), width: 200}
                ,{field: 'batch', align: 'center',title: I18n.t('serial_code')}
                ,{field: 'specs', align: 'center',title: I18n.t('spec')}
                ,{field: 'enableQty', align: 'center',title: I18n.t('outbound_pending_qty'), style: 'font-weight: bold'}
                ,{field: 'unit', align: 'center',title: I18n.t('unit'), hide: true}
                ,{field: 'barcode', align: 'center',title: I18n.t('barcode'), hide: true}
                ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width: 160}
            ]]
        });
    });
    /* 表格2搜索 */
    form.on('submit(sensorTbSearch)', function (data) {
@@ -92,7 +132,7 @@
        var checkStatus = table.checkStatus(obj.config.id).data;
        if (obj.event === 'pakoutPreview') { // 添加
            if (checkStatus.length === 0) {
                layer.msg('请选择至少一条出库明细', {icon: 2});
                layer.msg(I18n.t('select_at_least_one_outbound_detail'), {icon: 2});
                return;
            }
            pakoutPreview(checkStatus.map(function (d) {
@@ -101,7 +141,7 @@
        } else if (obj.event === 'del') { // 删除
            var checkRows = table.checkStatus('sensorTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要删除的数据', {icon: 2});
                layer.msg(I18n.t('please_select_data_to_delete'), {icon: 2});
                return;
            }
            var ids = checkRows.data.map(function (d) {
@@ -143,11 +183,12 @@
                        ,area: ['1200px', '700px']
                        ,shade: 0.5
                        ,shadeClose: false
                        ,btn: ['立即出库', '稍后处理']
                        ,btn: [I18n.t('immediate_outbound'), I18n.t('process_later')]
                        ,btnAlign: 'c'
                        ,moveType: 1 //拖拽模式,0或者1
                        ,content: $('#pakoutPreviewBox').html()
                        ,success: function(layero, index){
                            I18n.updatePage($(layero));
                            stoPreTabIdx = table.render({
                                elem: '#stoPreTab',
                                data: res.data,
@@ -157,18 +198,20 @@
                                cellMinWidth: 100,
                                cols: [[
                                    // {type: 'checkbox', merge: ['orderNo']},
                                    {field: 'orderNo', title: '单据编号', merge: true, align: 'center'},
                                    {field: 'title', title: '商品', merge: true, align: 'center', width: 350},
                                    {field: 'batch', title: '序列码', align: 'center'},
                                    {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'},
                                    {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'},
                                    {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'},
                                    {field: 'orderNo', title: I18n.t('order_no'), merge: true, align: 'center'},
                                    {field: 'title', title: I18n.t('item'), merge: true, align: 'center', width: 350},
                                    {field: 'batch', title: I18n.t('serial_code'), align: 'center'},
                                    {field: 'anfme', title: I18n.t('quantity'), align: 'center', width: 90, style: 'font-weight: bold'},
                                    {field: 'locNo', title: I18n.t('location'), align: 'center', width: 100, templet: '#locNoTpl'},
                                    {field: 'staNos', align: 'center', title: I18n.t('station_outbound'), merge: ['locNo'], templet: '#tbBasicTbStaNos'},
                                    {type: 'checkbox', merge: ['locNo']},
                                ]],
                                done: function (res) {
                                    tableMerge.render(this);
                                    $('.layui-table-body.layui-table-main').css("overflow", "auto");
                                    tableCache = tableData = table.cache.stoPreTab;
                                    I18n.updatePage($('.layui-table-view[lay-id="stoPreTab"]'));
                                    form.render('select');
                                }
                            });
                            // 修改出库站
@@ -187,7 +230,7 @@
                            form.on('submit(batchModifySta)', function () {
                                let stoPreTabData = layui.table.checkStatus('stoPreTab').data;
                                if (stoPreTabData.length < 1) {
                                    layer.msg("请至少选择一条以上合并数据", {icon: 7});
                                    layer.msg(I18n.t('select_at_least_one_merge_data'), {icon: 7});
                                    return false;
                                }
                                modifySta(stoPreTabData);
@@ -211,19 +254,21 @@
                                    }
                                }
                                if (staBatchSelectVal.length === 0) {
                                    layer.msg("出库站没有交集,无法批量修改", {icon: 2});
                                    layer.msg(I18n.t('no_intersection_outbound_station'), {icon: 2});
                                    return;
                                }
                                admin.open({
                                    type: 1,
                                    area: '300px',
                                    offset: 'auto',
                                    title: '请选择站点',
                                    title: I18n.t('please_select_station'),
                                    content: $('#staBatchSelectDialog').html(),
                                    success: function (layero, ddIndex) {
                                        I18n.updatePage($(layero));
                                        // 渲染下拉框
                                        let template = Handlebars.compile($('#batchStaSelectTpl').html());
                                        $('#batchSelectStaBox').html(template({list: staBatchSelectVal}));
                                        I18n.updatePage($('#batchSelectStaBox'));
                                        // 确认
                                        form.on('submit(staBatchSelectConfirm)', function (obj) {
                                            let loadIdx = layer.load(2);
@@ -279,7 +324,7 @@
    function pakout(tableCache, layerIndex) {
        // let loadIndex = layer.load(2);
        notice.msg('正在生成出库任务......', {icon: 4});
        notice.msg(I18n.t('generating_outbound_task'), {icon: 4});
        $.ajax({
            url: baseUrl + "/out/pakout/auth",
            headers: {'token': localStorage.getItem('token')},
@@ -290,13 +335,13 @@
                notice.destroy();
                if (res.code === 200) {
                    layer.close(layerIndex);
                    layer.msg(res.msg, {icon: 1});
                    layer.msg(I18n.t(res.msg), {icon: 1});
                    insTb.reload({where: null});
                    insTb2.reload({where: null, page: {curr: 1}});
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/";
                } else {
                    layer.msg(res.msg, {icon: 2})
                    layer.msg(I18n.t(res.msg), {icon: 2})
                }
            }
        });
@@ -306,7 +351,7 @@
    /* 删除订单 */
    function doDelSensor(obj) {
        layer.confirm('确定要删除选中数据吗?', {
        layer.confirm(I18n.t('confirm_delete_data'), {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
@@ -364,7 +409,7 @@
 * 一键出库
 */
function autoOut(orderId) {
    let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false});
    let loadIndex = layer.msg(I18n.t('requesting'), {icon: 16, shade: 0.01, time: false});
    $.ajax({
        url: baseUrl + "/out/pakout/orderDetlIds/auth",
        headers: {'token': localStorage.getItem('token')},
@@ -377,7 +422,7 @@
            } else if (res.code === 403){
                top.location.href = baseUrl+"/";
            } else {
                layer.msg(res.msg, {icon: 2});
                layer.msg(I18n.t(res.msg), {icon: 2});
            }
        }
    })