自动化立体仓库 - WMS系统
zjj
2023-09-01 a801b6c075becb1a8660d451cbfb31ddf782a89d
src/main/webapp/static/js/orderCheck/orderCheck.js
@@ -87,6 +87,7 @@
        showEditModel();
    });
    // 工具条点击事件
    table.on('tool(order)', function (obj) {
        var data = obj.data;
@@ -101,8 +102,6 @@
            btnPrint(data.id, data.orderNo, 4);
        } else if (layEvent === 'manPrint') {
            addPakOut(data.orderNo);
        }else if (layEvent === 'examine'){
            examine(data);
        }else if (layEvent === 'look') {
            var $a = $(obj.tr).find('a[lay-event="look"]');
            var offset = $a.offset();
@@ -113,7 +112,7 @@
                type: 1,
                title: false,
                area: '900px',
                offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                offset: [top + 'px', (left - 600 + $a.outerWidth()) + 'px'],
                shade: .01,
                shadeClose: true,
                fixed: false,
@@ -135,9 +134,11 @@
                            {field: 'maktx', title: '商品名称', width: 160},
                            {field: 'locNo', title: '库位号'},
                            {field: 'anfme', title: '数量'},
                            {field: 'realAnfme', title: '真实数量'},
                            {field: 'realAnfme', title: '真实数量',style: 'color: blue;font-weight: bold', edit: true},
                            {field: 'diffAnfme', title: '差异数量', style: 'font-weight: bold'},
                            {field: 'type$', title: '状态'},
                            {field: 'owner$', title: '货主'},
                            {field: 'payment$', title: '货物状态'},
                            {align: 'center', title: '操作', toolbar: '#formSSXMTableBar3', minWidth: 80, width: 80, fixed: 'right'}
                        ]],
                        request: {
@@ -167,8 +168,18 @@
            });
        }else if (layEvent === 'wrkTrace'){
            showWrkTrace(data.id);
        }else if (layEvent === 'printExcel'){
            printExcel(data);
        }
    });
    //单据明细表 审核按钮
    table.on('tool(lookSSXMTable)', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;
        if (layEvent === 'examine') {
            examine(data);
        }
    })
    function showWrkTrace(orderId) {
        console.log(orderId);
@@ -194,6 +205,10 @@
                    // 组装数据
                    if (xxDataList.length <= 0) {
                        layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
                        return false;
                    }
                    if (data.field.orderNo == "" || data.field.orderNo == null) {
                        layer.tips('请输入盘点单编号', '#orderNo', {tips: [1, '#ff4c4c']});
                        return false;
                    }
                    let nList = admin.util.deepClone(xxDataList);
@@ -249,10 +264,13 @@
                        {field: 'matnr', title: '商品编码', width: 160},
                        {field: 'maktx', title: '商品名称', width: 160},
                        {field: 'locNo', title: '库位号'},
                        {field: 'owner$', title: '货主'},
                        {field: 'payment$', title: '货物状态'},
                        {field: 'anfme', title: '库存数量'},
                        {field: 'realAnfme', title: '真实数量'},
                        {field: 'diffAnfme', title: '差异数量', style: 'font-weight: bold'},
                        {field: 'type$', title: '状态'},
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBarr', minWidth: 80, width: 80, fixed: 'right'}
                    ]],
                    done: function (res) {
@@ -346,12 +364,17 @@
                function showEditModel2(exp) {
                    var checkType = $("#checkType option:selected").val();
                    var tp = '';
                    if (checkType == 'loc'){
                    if (checkType == 'locno'){
                        tp = 2;
                    }
                    if (checkType == 'matnr'){
                        tp = 3;
                    }
                    if (checkType == 'owner'){
                        tp = 4;
                    }
                    admin.open({
                        type: 1,
                        offset: '150px',
@@ -365,9 +388,25 @@
                            form.on('submit(matEditSubmit)', function (data) {
                                var prec = $("#selectPerc option:selected").val();
                                var selectList;
                                if (tp == 2){
                                    prec = $("#selectPerc2 option:selected").val();
                                    selectList = matXmSelect2.getValue();
                                    console.log(selectList);
                                    for (let i = 0; i<selectList.length; i++) {
                                        selectList[i].children="";
                                    }
                                }
                                if (tp == 3){
                                    prec = $("#selectPerc3 option:selected").val();
                                    selectList = matXmSelect.getValue();
                                    console.log(selectList);
                                    for (let i = 0; i<selectList.length; i++) {
                                        selectList[i].children="";
                                    }
                                }
                                if (tp == 4){
                                    prec = $("#selectPerc4 option:selected").val();
                                    selectList = matXmSelect3.getValue();
                                    console.log(selectList);
                                    for (let i = 0; i<selectList.length; i++) {
                                        selectList[i].children="";
@@ -381,28 +420,79 @@
                                json.data = selectList;
                                console.log(json);
                                $.ajax({
                                    url: baseUrl+"/orderCheck/create/auth",
                                    headers: {'token': localStorage.getItem('token')},
                                    contentType:'application/json;charset=UTF-8',
                                    data: JSON.stringify(json),
                                    method: 'POST',
                                    async: false,
                                    success: function (res) {
                                        if (res.code === 200){
                                            for (var i =0;i<res.data.length;i++){
                                                xxDataList.push(res.data[i]);
                                                console.log(xxDataList);
                                                insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                            }
                                        } else if (res.code === 403){
                                            top.location.href = baseUrl+"/";
                                        }else {
                                            layer.msg(res.msg, {icon: 2})
                                if ( tp == 3 || tp == ''){
                                    $.ajax({
                                        url: baseUrl+"/orderCheck/create/auth",
                                        headers: {'token': localStorage.getItem('token')},
                                        contentType:'application/json;charset=UTF-8',
                                        data: JSON.stringify(json),
                                        method: 'POST',
                                        async: false,
                                        success: function (res) {
                                            xxDataList = []
                                            if (res.code === 200){
                                                for (var i =0;i<res.data.length;i++){
                                                    xxDataList.push(res.data[i]);
                                                    console.log(xxDataList);
                                                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                                }
                                            } else if (res.code === 403){
                                                top.location.href = baseUrl+"/";
                                            }else {
                                                layer.msg(res.msg, {icon: 2})
                                            }
                                        }
                                    }
                                })
                                    })
                                }else if (tp == 2){
                                    $.ajax({
                                        url: baseUrl+"/orderCheck/create/loc/auth",
                                        headers: {'token': localStorage.getItem('token')},
                                        contentType:'application/json;charset=UTF-8',
                                        data: JSON.stringify(json),
                                        method: 'POST',
                                        async: false,
                                        success: function (res) {
                                            if (res.code === 200){
                                                for (var i =0;i<res.data.length;i++){
                                                    xxDataList.push(res.data[i]);
                                                    console.log(xxDataList);
                                                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                                }
                                            } else if (res.code === 403){
                                                top.location.href = baseUrl+"/";
                                            }else {
                                                layer.msg(res.msg, {icon: 2})
                                            }
                                        }
                                    })
                                }else if (tp == 4){
                                    $.ajax({
                                        url: baseUrl+"/orderCheck/create/owner/auth",
                                        headers: {'token': localStorage.getItem('token')},
                                        contentType:'application/json;charset=UTF-8',
                                        data: JSON.stringify(json),
                                        method: 'POST',
                                        async: false,
                                        success: function (res) {
                                            if (res.code === 200){
                                                for (var i =0;i<res.data.length;i++){
                                                    xxDataList.push(res.data[i]);
                                                    console.log(xxDataList);
                                                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                                }
                                            } else if (res.code === 403){
                                                top.location.href = baseUrl+"/";
                                            }else {
                                                layer.msg(res.msg, {icon: 2})
                                            }
                                        }
                                    })
                                }
                                layer.close(dIndex);
                                return false;
                            });
@@ -435,6 +525,62 @@
                                    });
                                }
                            })
                            // 渲染物料选择
                            var matXmSelect2 = xmSelect.render({
                                el: '#mat2',
                                style: {
                                    width: '340px',
                                },
                                autoRow: true,
                                toolbar: { show: true },
                                filterable: true,
                                remoteSearch: true,
                                remoteMethod: function(val, cb, show){
                                    $.ajax({
                                        url: baseUrl+"/orderCheck/all/get/loc",
                                        headers: {'token': localStorage.getItem('token')},
                                        method: 'POST',
                                        success: function (res) {
                                            if (res.code === 200){
                                                cb(res.data)
                                            } else {
                                                cb([]);
                                                layer.msg(res.msg, {icon: 2});
                                            }
                                        }
                                    });
                                }
                            })
                            // 渲染物料选择
                            var matXmSelect3 = xmSelect.render({
                                el: '#mat4',
                                style: {
                                    width: '340px',
                                },
                                autoRow: true,
                                toolbar: { show: true },
                                filterable: true,
                                remoteSearch: true,
                                remoteMethod: function(val, cb, show){
                                    $.ajax({
                                        url: baseUrl+"/orderCheck/all/get/owner",
                                        headers: {'token': localStorage.getItem('token')},
                                        method: 'POST',
                                        success: function (res) {
                                            if (res.code === 200){
                                                cb(res.data)
                                            } else {
                                                cb([]);
                                                layer.msg(res.msg, {icon: 2});
                                            }
                                        }
                                    });
                                }
                            })
                            // 弹窗不出现滚动条
                            $(layero).children('.layui-layer-content').css('overflow', 'visible');
                            layui.form.render('select');
@@ -590,7 +736,48 @@
        })
    }
    function examine(data){
        console.log(data)
        layer.confirm('请确定真实数量以及差异数量!', {
            shade: .1,
            skin: 'layui-layer-admin'
        }, function (i) {
            $.ajax({
                url: baseUrl + "/orderCheck/mxamine",
                headers: {'token': localStorage.getItem('token')},
                contentType:'application/json;charset=UTF-8',
                data: JSON.stringify(data),
                method: 'POST',
                async: false,
                success: function (res) {
                    if (res.code === 200){
                        layer.msg(res.msg);
                    }else {
                        layer.msg(res.msg);
                    }
                }
            });
        });
    }
    // 页面修改
    table.on('edit(lookSSXMTable)', function (obj) {
        console.log(obj.data)
    })
    function printExcel(data){
        layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
           // window.open("http://localhost:8082/stwms/orderCheck/printExport/auth?orderNo="+data.orderNo);
            layer.closeAll();
            layer.load(1, {shade: [0.1,'#fff']});
           // location.href = "http://192.168.4.121:8082/stwms/orderCheck/printExport/auth?orderNo="+data.orderNo;
            location.href = "http://10.114.97.100:8080/stwms/orderCheck/printExport/auth?orderNo="+data.orderNo;
            layer.closeAll('loading');
        });
    }
});