自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-04-01 8e504e7057ec0911547b9c935b2e5e5beef7842c
src/main/webapp/static/js/pakStore/stockAdjust.js
@@ -2,12 +2,27 @@
var initAnfmeVal = "-";
var matCodeData = [];
var currLocNo;
layui.use(['table','laydate', 'form'], function() {
var matCodeLayerIdx;
function getCol() {
    var cols = [
        {fixed: 'left', field: 'count', title: '实际数量', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
        ,{field: 'anfme', align: 'center',title: '数量'}
    ];
    arrRemove(detlCols, "field", "anfme")
    cols.push.apply(cols, detlCols);
    cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80})
    return cols;
}
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin'], function() {
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var admin = layui.admin;
    tableIns = table.render({
        elem: '#chooseData',
@@ -16,21 +31,7 @@
        limit: 500,
        cellMinWidth: 50,
        toolbar: '#toolbar',
        cols: [[
            {fixed: 'left', field: 'count', title: '实际数量', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'matnr', align: 'center',title: '物料'}
            // ,{field: 'lgnum', align: 'center',title: '仓库号'}
            // ,{field: 'tbnum', align: 'center',title: '转储请求编号'}
            // ,{field: 'tbpos', align: 'center',title: '行项目'}
            // ,{field: 'zmatid', align: 'center',title: '物料标签ID'}
            ,{field: 'maktx', align: 'center',title: '物料描述'}
            // ,{field: 'werks', align: 'center',title: '工厂'}
            ,{field: 'altme', align: 'center',title: '单位'}
            ,{field: 'zpallet', align: 'center',title: '托盘条码'}
            // ,{field: 'bname', align: 'center',title: '用户ID'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80}
        ]],
        cols: [getCol()],
        done: function (res, curr, count) {
            limit();
        }
@@ -51,7 +52,7 @@
                    return;
                }
                if (matCodeData.length === 0) {
                    layer.msg("请先添加物料");
                    layer.msg("请先添加明细");
                    return;
                }
                for (var i=0;i<matCodeData.length;i++){
@@ -101,7 +102,7 @@
                        matCodeData.splice(i, 1);
                    }
                }
                tableIns.reload({data: matCodeData,done:function (res) {limit();}});
                tableIns.reload({data: matCodeData});
                break;
        }
    });
@@ -145,9 +146,7 @@
    // 重载表格
    function tableReload() {
        tableIns.reload({data: matCodeData,done:function (res) {
                limit();
            }});
        tableIns.reload({data: matCodeData});
    }
    // 库位提示框
@@ -157,11 +156,11 @@
                let data = res.data;
                if (data != null) {
                    $(".retrieve").show();
                    $("#locMsg").html(locNo + "&nbsp;,库位状态:" + data.locType$);
                    $("#locMsg").html(locNo + "&nbsp;,库位状态:" + data.locSts$);
                    $('.not-retrieve').hide();
                    currLocNo = locNo;
                } else {
                    layer.msg("请输入有效库位号");
                    layer.msg("请输入有效库位号", {icon: 2});
                    $('.not-retrieve').show();
                    $("#locMsg").html("");
                    $(".retrieve").hide();
@@ -191,31 +190,31 @@
                layer.msg("数量必须大于零");
            }
        }
        tableIns.reload({data: matCodeData,done:function (res) {
                limit();
            }});
        tableIns.reload({data: matCodeData});
    }
})
// 提取物料
var matCodeLayerIdx;
function getMat() {
    if (isEmpty(currLocNo)) {
        layer.msg("请先检索库位")
        inputTip($("#searchLocNo"));
        return;
    }
    matCodeLayerIdx = layer.open({
        type: 2,
        title: '提取物料',
        maxmin: true,
        area: [top.detailWidth, top.detailHeight],
        shadeClose: true,
        content: 'matQuery.html',
        success: function(layero, index){
    $(document).on('click','#mat-query', function () {
        if (isEmpty(currLocNo)) {
            layer.msg("请先检索库位")
            inputTip($("#searchLocNo"));
            return;
        }
    });
}
        let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false});
        matCodeLayerIdx = admin.open({
            type: 2,
            title: false,
            closeBtn: false,
            maxmin: false,
            area: ['90%', '85%'],
            shadeClose: true,
            content: 'matQuery.html',
            success: function(layero, index){
                layer.close(loadIndex);
            }
        });
    })
})
// 搜索框空值提示
function inputTip(el) {
@@ -231,7 +230,7 @@
    for (var i=0;i<data.length;i++){
        let pass = false;
        for (var j=0;j<matCodeData.length;j++){
            if (data[i].matNo === matCodeData[j].matnr) {
            if (data[i].matnr === matCodeData[j].matnr) {
                pass = true;
                break;
            }
@@ -241,13 +240,20 @@
                count: initCountVal,
                anfme: initAnfmeVal,
                removeBtn: true,
                matnr: data[i].matNo,
                matnr: data[i].matnr,
                maktx: data[i].matName,
                lgnum: data[i].str2,
                type: data[i].str5,
                color: data[i].barcode,
                supplier: data[i].str6,
                warehouse: data[i].str7,
                brand: data[i].str3,
                altme: data[i].str1,
                bname: data[i].str4,
            })
        }
    }
    matCodeData.push.apply(matCodeData,applyData);
    tableIns.reload({data: matCodeData});
    layer.close(matCodeLayerIdx);
}
}