自动化立体仓库 - WMS系统
luxiaotao1123
2021-09-14 c6bc9682699d3e10dc06a3d6641a70179e64f9a1
src/main/webapp/static/js/locStatis/locStatis.js
@@ -60,7 +60,7 @@
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[{field: 'qty', align: 'center', title: '数量', width: 80}
        cols: [[{field: 'qty', align: 'center', title: '数量', width: 120}
            , {field: 'matNo', align: 'center', title: '产品编码'}
            , {field: 'matName', align: 'center', title: '产品名称'}
            ]],
@@ -115,6 +115,74 @@
    table.on('toolbar(locStatis)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch(obj.event) {
            case 'syncStok':
                alert('插入数据到ERP接口库存同步表');
                $.ajax({
                    url: baseUrl + "/stock/stockSyncCount",
                    headers: {'token': localStorage.getItem('token')},
                    data: {},
                    method: 'POST',
                    traditional: true,
                    success: function (res) {
                        if (res.code === 200) {
                            var msg = '';
                            if (res.data == 0) {
                                msg = '确定要同步库存数据吗?'
                            } else {
                                msg = '同步任务正在进行,确定要中止并重新同步吗?'
                            }
                            layer.confirm(msg, {
                                    shadeClose: true
                                    , btn: ['确定']
                                }, function () {
                                    if (res.data > 0) {
                                        // 清空同步上传清单数据,再进行插入数据
                                        $.ajax({
                                            url: baseUrl + "/stock/updateStockSync",
                                            headers: {'token': localStorage.getItem('token')},
                                            data: {},
                                            contentType: 'application/json;charset=UTF-8',
                                            method: 'POST',
                                            success: function (res) {
                                                if (res.code === 200) {
                                                    layer.msg("更新上报库存数据成功!");
                                                } else if (res.code === 403) {
                                                    top.location.href = baseUrl + "/";
                                                } else {
                                                    layer.msg(res.msg)
                                                }
                                            }
                                        });
                                    } else {
                                        // 调用同步上传清单数据插入接口
                                        $.ajax({
                                            url: baseUrl + "/stock/insertStockSync",
                                            headers: {'token': localStorage.getItem('token')},
                                            data: {},
                                            contentType: 'application/json;charset=UTF-8',
                                            method: 'POST',
                                            success: function (res) {
                                                if (res.code === 200) {
                                                    layer.msg("插入上报库存数据成功!");
                                                } else if (res.code === 403) {
                                                    top.location.href = baseUrl + "/";
                                                } else {
                                                    layer.msg(res.msg)
                                                }
                                            }
                                        });
                                    }
                                    layer.closeAll();
                                }
                            );
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            layer.msg(res.msg)
                        }
                    }
                });
                break;
            case 'exportAll':
                layer.closeAll();
                layer.load(1, {shade: [0.1,'#fff']});