#
luxiaotao1123
2021-03-23 357de6228f120de8072c482d04bd7577e4f5db0b
src/main/webapp/static/js/ioWorks/matQuery.js
@@ -9,12 +9,16 @@
    cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:65})
    return cols;
}
layui.use(['table','laydate', 'form'], function() {
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
    notice: 'notice/notice',
}).use(['table','laydate', 'form',  'notice'], function() {
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;
    var notice = layui.notice;
    tableIns = table.render({
        elem: '#chooseData',
@@ -41,12 +45,18 @@
        switch (obj.event) {
            case 'createDoc':
                if (data.length === 0){
                    layer.msg('请添加物料');
                    notice.error({
                        title: '消息通知',
                        message: '请添加物料'
                    });
                } else {
                    var success = true;
                    for (var i=0;i<matData.length;i++) {
                        if (matData[i].count <= 0) {
                            layer.msg(matData[i].matnr + '物料数量必须大于零!', {icon: 2})
                            notice.error({
                                title: '消息通知',
                                message: matData[i].matnr + '物料数量必须大于零!'
                            });
                            success = false;
                            return false;
                        }
@@ -54,7 +64,7 @@
                    if (success) {
                        layer.open({
                            type: 1,
                            title: '定义销售单编号',
                            title: '定义采购退货单编号',
                            offset: '100px',
                            area: ['360px'],
                            shade: 0.1,
@@ -98,9 +108,17 @@
            });
        });
        var number = data.field.orderNo; // 单号
        if (number.substring(0, 3) !== 'PR-') {
            notice.error({
                title: '消息通知',
                message: '单号不符合规则,请以 PR- 开头'
            });
            return false;
        }
        var req = JSON.stringify({
            number: data.field.orderNo
            , customerTypeId: '1'
            number: number
            , customerTypeId: data.field.customerTypeId
            , list: matDetls
        })
        $.ajax({
@@ -111,12 +129,18 @@
            method: 'POST',
            success: function (res) {
                if (res.code === 200){
                    layer.msg(res.msg, {icon: 1});
                    notice.success({
                        title: '消息通知',
                        message: res.msg
                    });
                    top.layui.layer.close(top.popupRight);
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg, {icon: 2})
                    notice.error({
                        title: '消息通知',
                        message: res.msg
                    });
                }
            }
        });
@@ -124,21 +148,23 @@
    function updateMatData(locNo, matnr, count) {
        if (isNaN(count)) {
            layer.msg("请输入数字");
            notice.error({
                title: '消息通知',
                message: '请输入数字'
            });
        } else {
            if (count > 0) {
                for (var i=0;i<matData.length;i++){
                    if (matData[i]["matnr"] === matnr){
                        // if (count > locDetlData[i]["anfme"]) {
                        //     layer.msg("不能超过原数量");
                        // } else {
                            matData[i]["count"] = count;
                        // }
                        matData[i]["count"] = count;
                        break;
                    }
                }
            } else {
                layer.msg("数量必须大于零");
                notice.error({
                    title: '消息通知',
                    message: '数量必须大于零'
                });
            }
        }
        tableIns.reload({data: matData,done:function (res) {
@@ -197,7 +223,10 @@
            } else if (res.code === 403){
                top.location.href = baseUrl+"/";
            } else {
                layer.msg(res.msg, {icon: 2})
                notice.error({
                    title: '消息通知',
                    message: res.msg
                });
            }
        }
    });