#
luxiaotao1123
2021-03-11 c2cd7bc6d350d00f4e5df6d114f68f0804cb13d1
src/main/webapp/static/js/ioWorks/matQuery.js
@@ -43,44 +43,30 @@
                if (data.length === 0){
                    layer.msg('请添加物料');
                } else {
                    layer.open({
                        type: 1,
                        title: '定义销售单编号',
                        offset: '100px',
                        area: ['360px'],
                        shade: 0.1,
                        content: $('#getOrderNo'),
                        success: function(layero, index){
                            layer.iframeAuto(index)
                        },
                    });
                    // var matDetls = [];
                    // data.forEach(function(elem) {
                    //     matDetls.push({matnr: elem.matnr, count: elem.count});
                    // });
                    // $.ajax({
                    //     url: baseUrl+"/work/pakout/init",
                    //     headers: {'token': localStorage.getItem('token')},
                    //     data: JSON.stringify(matDetls),
                    //     contentType:'application/json;charset=UTF-8',
                    //     method: 'POST',
                    //     success: function (res) {
                    //         if (res.code === 200){
                    //             matData = [];
                    //             tableIns.reload({data: matData,done:function (res) {
                    //                 limit();
                    //             }});
                    //             layer.msg(res.msg, {icon: 1});
                    //         } else if (res.code === 403){
                    //             top.location.href = baseUrl+"/";
                    //         } else {
                    //             layer.msg(res.msg)
                    //         }
                    //     }
                    // });
                    var success = true;
                    for (var i=0;i<matData.length;i++) {
                        if (matData[i].count <= 0) {
                            layer.msg(matData[i].matnr + '物料数量必须大于零!', {icon: 2})
                            success = false;
                            return false;
                        }
                    }
                    if (success) {
                        layer.open({
                            type: 1,
                            title: '定义销售单编号',
                            offset: '100px',
                            area: ['360px'],
                            shade: 0.1,
                            content: $('#getOrderNo'),
                            success: function(layero, index){
                                layer.iframeAuto(index)
                            },
                            cancel: function () {
                                $('#orderNo').val('');
                            }
                        });
                    }
                }
                break;
        }
@@ -103,9 +89,37 @@
        }
    });
    // 开始打印
    // 开始生成拣货单
    form.on('submit(confirm)', function (data) {
        var matDetls = [];
        matData.forEach(function(elem) {
            matDetls.push({matnr: elem.matnr
                , count: elem.count
            });
        });
        var req = JSON.stringify({
            number: data.field.orderNo
            , customerTypeId: '1'
            , list: matDetls
        })
        $.ajax({
            url: baseUrl+"/work/order/init",
            headers: {'token': localStorage.getItem('token')},
            data: req,
            contentType:'application/json;charset=UTF-8',
            method: 'POST',
            success: function (res) {
                if (res.code === 200){
                    layer.msg(res.msg, {icon: 1});
                    top.layui.layer.close(top.popupRight);
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg, {icon: 2})
                }
            }
        });
    })
    function updateMatData(locNo, matnr, count) {