自动化立体仓库 - WMS系统
luxiaotao1123
2022-03-25 6d51af4d82956e1194deb52d1427190ecbaa0a81
src/main/webapp/static/js/pakStore/pakStore.js
@@ -1,6 +1,14 @@
var initCountVal = 0;
var matCodeData = [];
function getCol() {
    var cols = [
        {fixed: 'left', field: 'count', title: '数量(必填)', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
    ];
    cols.push.apply(cols, matCols);
    cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80})
    return cols;
}
layui.use(['table','laydate', 'form'], function() {
    var table = layui.table;
@@ -16,15 +24,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: 'matNo', align: 'center', title: '物料编码'},
            {field: 'barcode', align: 'center', title: '条码'},
            {field: 'matName', align: 'center', title: '物料名称'},
            {field: 'str1', align: 'center', title: '物料单位'},
            {field: 'str2', align: 'center', title: '物料规格'},
            {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80}
        ]],
        cols: [getCol()],
        done: function (res, curr, count) {
            $('td[data-field=count] div').html(initCountVal);
            setMatCodeData(res.data);
@@ -74,7 +74,9 @@
                        if (res.code === 200){
                            layer.msg("入库启动成功,目标库位:" + res.data);
                            matCodeData = [];
                            $('#focusMatByMat').val("");
                            tableIns.reload({data: matCodeData,done:function (res) { limit(); getInBound();}});
                            document.getElementById("focusMatByMat").focus();
                        } else if (res.code === 403){
                            top.location.href = baseUrl+"/";
                        }else {
@@ -174,6 +176,30 @@
    });
}
// 扫码
function focusMat(el) {
    if (isEmpty(el.value)) {
        return
    }
    $.ajax({
        url: baseUrl + "/matCode/" + el.value + "/auth",
        headers: {'token': localStorage.getItem('token')},
        method: 'GET',
        success: function (res) {
            if (res.code === 200) {
                matCodeData = [];
                var param = new Array();
                param[0] = res.data;
                addTableData(param);
            } else if (res.code === 403) {
                top.location.href = baseUrl + "/";
            } else {
                layer.msg(res.msg, {icon: 2})
            }
        }
    })
}
// 添加表格数据
function addTableData(data) {
    for (var i=0;i<data.length;i++){
@@ -193,4 +219,4 @@
    matCodeData.push.apply(matCodeData, data);
    tableIns.reload({data: matCodeData});
    layer.close(matCodeLayerIdx);
}
}