自动化立体仓库 - WMS系统
luxiaotao1123
2021-09-14 c6bc9682699d3e10dc06a3d6641a70179e64f9a1
src/main/webapp/static/js/waitMatin/waitMatin.js
@@ -73,7 +73,7 @@
            layer.open({
                type: 1,
                title: false,
                area: '630px',
                area: '800px',
                offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                shade: .01,
                shadeClose: true,
@@ -98,7 +98,10 @@
                                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: {
                            pageName: 'curr',
@@ -127,11 +130,13 @@
    // 显示表单弹窗
    function showEditModel(expTpe) {
        var mlist=null
        var inQtys=[]
        admin.open({
            type: 1,
            title: (expTpe ? '修改' : '添加') + '单据',
            content: $('#editDialog').html(),
            area: '700px',
            area: '1300px',
            success: function (layero, dIndex) {
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                var isExpAdd = !expTpe;
@@ -150,14 +155,29 @@
                    var param = [];
                    var nList = admin.util.deepClone(xxDataList);
                    for (var xi = 0; xi < nList.length; xi++) {
                        if (nList[xi].qty > 0) {
                        // console.log('已入库:'+nList[xi].inQty)
                        // console.log('旧数量:'+inQtys[xi])
                        // console.log('数量:'+nList[xi].qty)
                        if (nList[xi].inQty > 0 && inQtys[xi]!=nList[xi].qty) {
                            layer.msg("已入库无法修改", {icon: 2})
                            return false;
                        } else  if (nList[xi].qty > 0) {
                            param.push({
                                billNo: data.field.billNo,
                                billType: data.field.billType,
                                matNo: nList[xi].matNo,
                                matName: nList[xi].matName,
                                color: nList[xi].color,
                                size: nList[xi].size,
                                specs: nList[xi].specs,
                                memo: nList[xi].memo,
                                unit: nList[xi].unit,
                                qty: nList[xi].qty,
                                inQty: nList[xi].inQty,
                            })
                        }else if (nList[xi].qty == 0){
                            layer.msg('明细修改数量不合法', {icon: 2});
                            return false;
                        }
                    }
                    if (param.length === 0) {
@@ -199,10 +219,21 @@
                        {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},
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80}
                    ]],
                    done: function (res) {
                        mlist= res.data
                        for (let i = 0; i < mlist.length; i++) {
                            var waitIn=mlist[i]
                            inQtys.push(waitIn.qty)
                        }
                        $(layero).find('.layui-table-view').css('margin', '0');
                    },
                    size: ''
@@ -250,19 +281,29 @@
                });
                // 数量修改
                table.on('edit(formSSXMTable)', function (obj) {
                    let count = Number(obj.value);
                    if (isNaN(count)) {
                        layer.msg("请输入数字");
                    } else {
                        if (count > 0) {
                            for (var i=0;i<xxDataList.length;i++){
                                if (xxDataList[i]["matNo"] === obj.data.matNo){
                                    xxDataList[i]["qty"] = count;
                                    break;
                                }
                    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;
                                break;
                            }
                        }
                    }else if (obj.field=='qty'){
                        let vle = Number(obj.value);
                        if (isNaN(vle)) {
                            layer.msg("请输入数字");
                        } else {
                            layer.msg("数量必须大于零");
                            if (vle > 0) {
                                for (var i=0;i<xxDataList.length;i++) {
                                    if (xxDataList[i]["matNo"] === obj.data.matNo) {
                                        xxDataList[i]["qty"] = vle;
                                        break;
                                    }
                                }
                            } else {
                                layer.msg("数量必须大于零");
                            }
                        }
                    }
                    insTbSSXM.reload({data: xxDataList});
@@ -306,6 +347,11 @@
                                                    xxDataList.push({
                                                        matNo: mat.matNo,
                                                        matName: mat.matName,
                                                        color:mat.color,
                                                        size:mat.size,
                                                        specs:mat.specs,
                                                        memo: mat.memo,
                                                        unit: mat.unit,
                                                        qty: 0.0
                                                    });
                                                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});