自动化立体仓库 - WMS系统
luxiaotao1123
2022-03-23 47cc646b1c55e905e4a73c80ac78abc77e88aeb7
src/main/webapp/static/js/order/order.js
@@ -12,17 +12,19 @@
    // 渲染表格
    var insTb = table.render({
        elem: '#waitMatin',
        url: baseUrl+'/waitMatin/head/page/auth',
        elem: '#order',
        url: baseUrl+'/order/head/page/auth',
        headers: {token: localStorage.getItem('token')},
        page: true,
        cellMinWidth: 100,
        cols: [[
            {type: 'numbers'},
            {field: 'billNo', title: '单据编号', sort: true},
            {field: 'billType$', align: 'center', title: '类型',  minWidth: 160, width: 160},
            {field: 'orderNo', title: '单据编号', sort: true},
            {field: 'docType$', align: 'center', title: '类型',  minWidth: 160, width: 160},
            {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160},
            {field: 'appeTime$', title: '创建时间', minWidth: 200, width: 200},
            {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200},
            {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl',  minWidth: 160, width: 160},
            {field: 'memo', align: 'center',title: '备注', hide: true},
            {align: 'center', title: '操作', toolbar: '#operate', minWidth: 130, width: 130}
        ]],
        request: {
@@ -48,17 +50,17 @@
    });
    // 搜索
    form.on('submit(waitMatinSearch)', function (data) {
    form.on('submit(tbSearch)', function (data) {
        insTb.reload({where: data.field, page: {curr: 1}});
    });
    // 添加
    $("#waitMatinAddBtn").click(function () {
    $("#orderAddBtn").click(function () {
        showEditModel();
    });
    // 工具条点击事件
    table.on('tool(waitMatin)', function (obj) {
    table.on('tool(order)', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;
        if (layEvent === 'edit') {
@@ -73,7 +75,7 @@
            layer.open({
                type: 1,
                title: false,
                area: '800px',
                area: '700px',
                offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                shade: .01,
                shadeClose: true,
@@ -83,24 +85,26 @@
                    table.render({
                        elem: '#lookSSXMTable',
                        headers: {token: localStorage.getItem('token')},
                        url: baseUrl+'/waitMatin/list/auth',
                        url: baseUrl+'/orderDetl/list/auth',
                        where: {
                            bill_no: data.billNo
                            order_id: data.id
                        },
                        page: true,
                        cellMinWidth: 100,
                        cols: [[
                            {type: 'numbers'},
                            {field: 'matNo', title: '物料编码'},
                            {field: 'matName', title: '物料名称', width: 160},
                            {field: 'qty', title: '数量'},
                            {
                                field: 'createTime$', title: '创建时间', sort: true, templet: function (d) {
                                    return util.toDateString(d.createTime);
                                },  width: 180
                            },
                            {field: 'inQty', title: '已入库量'},
                            {field: 'color', title: '颜色'},
                            {field: 'matnr', title: '商品编码'},
                            {field: 'maktx', title: '商品名称', width: 160},
                            {field: 'batch', title: '批号'},
                            {field: 'count', title: '数量'},
                            {field: 'unit', title: '单位'},
                            // {
                            //     field: 'createTime$', title: '创建时间', sort: true, templet: function (d) {
                            //         return util.toDateString(d.createTime);
                            //     },  width: 180
                            // },
                            // {field: 'inQty', title: '已入库量'},
                            // {field: 'color', title: '颜色'},
                            {field: 'specs', title: '规格'}
                        ]],
                        request: {
@@ -140,13 +144,14 @@
            success: function (layero, dIndex) {
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                var isExpAdd = !expTpe;
                console.log(expTpe)
                // 回显数据
                form.val('editForm', expTpe);
                if (expTpe) {
                    $('#billNo').attr("disabled", "disabled");
                    $('#orderNo').attr("disabled", "disabled");
                }
                // 表单提交事件
                form.on('submit(waitMatinEditSubmit)', function (data) {
                form.on('submit(orderEditSubmit)', function (data) {
                    // 组装数据
                    if (xxDataList.length <= 0) {
                        layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
@@ -216,16 +221,15 @@
                    height: '350px;',
                    cellMinWidth: 100,
                    cols: [[
                        {type: 'numbers'},
                        {field: 'matNo', title: '物料编码'},
                        {field: 'matName', title: '物料名称', width: 160},
                        {field: 'specs', title: '规格', width: 160},
                        {field: 'color', title: '颜色', width: 160},
                        {field: 'size', title: '尺寸', width: 160},
                        {field: 'qty', title: '修改数量', style: 'color: blue;font-weight: bold', edit: true, minWidth: 100, width: 100},
                        {field: 'inQty', title: '已入库量',  minWidth: 100, width: 100},
                        {field: 'unit', title: '单位', width: 160},
                        {field: 'memo', title: '备注' , edit: true, width: 160},
                        {type: 'numbers', title: '#'},
                        {field: 'matnr', title: '商品编码', width: 160},
                        {field: 'maktx', title: '商品名称', width: 200},
                        {field: 'batch', title: '批号'},
                        {field: 'specs', title: '规格'},
                        {field: 'count', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                        // {field: 'inQty', title: '已入库量',  minWidth: 100, width: 100},
                        {field: 'unit', title: '单位', width: 80},
                        {field: 'memo', title: '备注' , edit: true},
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                    ]],
                    done: function (res) {
@@ -240,7 +244,7 @@
                };
                if (!isExpAdd) {
                    $.ajax({
                        url: baseUrl+"/waitMatin/detl/list/auth?billNo=" + expTpe.billNo,
                        url: baseUrl+"/order/detl/all/auth?orderId=" + expTpe.id,
                        headers: {'token': localStorage.getItem('token')},
                        method: 'GET',
                        async: false,
@@ -270,7 +274,7 @@
                        }, function (i) {
                            layer.close(i);
                            for (var j = 0; j < xxDataList.length; j++) {
                                if (xxDataList[j].matNo === data.matNo) {
                                if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) {
                                    xxDataList.splice(j, 1);
                                    break;
                                }
@@ -279,30 +283,31 @@
                        });
                    }
                });
                // 数量修改
                // 明细数据修改
                table.on('edit(formSSXMTable)', function (obj) {
                    if (obj.field=='memo'){
                    let vle = obj.value;
                        for (var i=0;i<xxDataList.length;i++) {
                            if (xxDataList[i]["matNo"] === obj.data.matNo) {
                                xxDataList[i]["memo"] = vle;
                    if (obj.field === 'memo'){
                        for (let i=0;i<xxDataList.length;i++) {
                            if (xxDataList[i]["matnr"] === obj.data.matnr && xxDataList[i]["batch"] === obj.data.batch) {
                                xxDataList[i]["memo"] = obj.value;
                                break;
                            }
                        }
                    }else if (obj.field=='qty'){
                    } else if (obj.field==='count'){
                        let vle = Number(obj.value);
                        if (isNaN(vle)) {
                            layer.msg("请输入数字");
                            layer.msg("请输入数字", {icon: 2});
                            return false;
                        } else {
                            if (vle > 0) {
                                for (var i=0;i<xxDataList.length;i++) {
                                    if (xxDataList[i]["matNo"] === obj.data.matNo) {
                                        xxDataList[i]["qty"] = vle;
                                for (let i=0;i<xxDataList.length;i++) {
                                    if (xxDataList[i]["matnr"] === obj.data.matnr && xxDataList[i]["batch"] === obj.data.batch) {
                                        xxDataList[i]["count"] = vle;
                                        break;
                                    }
                                }
                            } else {
                                layer.msg("数量必须大于零");
                                layer.msg("数量必须大于零", {icon: 2});
                                return false;
                            }
                        }
                    }