自动化立体仓库 - WMS系统
chen.llin
4 天以前 d6d25613f504d8fc4c6ffa8a1854beb4dac044d0
src/main/webapp/static/js/locCache/locCache.js
@@ -12,7 +12,7 @@
    // 数据渲染
    tableIns = table.render({
        elem: '#locCache',
        headers: {token: localStorage.getItem('token')},
        headers: { token: localStorage.getItem('token') },
        url: baseUrl + '/locCache/list/auth',
        page: true,
        limit: 15,
@@ -20,23 +20,23 @@
        toolbar: '#toolbar',
        cellMinWidth: 80,
        height: 'full-120',
        cols: [[{type: 'checkbox'}, {field: 'locNo', align: 'center', title: '库位号', width: 120}
            , {field: 'barcode', align: 'center', title: '托盘码'}
            , {field: 'areaName', align: 'center', title: '库区名称'}
        cols: [[{ type: 'checkbox' }, { field: 'locNo', align: 'center', title: '库位号', width: 120 }
            , { field: 'barcode', align: 'center', title: '托盘码' }
            , { field: 'areaName', align: 'center', title: '库区名称' }
            // , {field: 'whsType$', align: 'center', title: '库位类型'}
            , {field: 'locSts', align: 'center', title: '库位状态'}
            , {field: 'row1', align: 'center', title: '排'}
            , {field: 'bay1', align: 'center', title: '列'}
            , {field: 'lev1', align: 'center', title: '层'}
            , { field: 'locSts', align: 'center', title: '库位状态' }
            , { field: 'row1', align: 'center', title: '排' }
            , { field: 'bay1', align: 'center', title: '列' }
            , { field: 'lev1', align: 'center', title: '层' }
            // , {field: 'locType', align: 'center', title: '库位类型'}
            , {field: 'sort', align: 'center', title: '优先级'}
            , {field: 'modiUser$', align: 'center', title: '修改人员'}
            , {field: 'modiTime$', align: 'center', title: '修改时间'}
            , {field: 'appeUser$', align: 'center', title: '创建者'}
            , {field: 'appeTime$', align: 'center', title: '添加时间'}
            , {field: 'frozen', align: 'center', title: '是否冻结,0.未冻结,1.已冻结', hide: true}
            , {field: 'frozenMemo', align: 'center', title: '冻结备注', hide: true}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 160}]
            , { field: 'sort', align: 'center', title: '优先级' }
            , { field: 'modiUser$', align: 'center', title: '修改人员', hide: true }
            , { field: 'modiTime$', align: 'center', title: '修改时间' }
            , { field: 'appeUser$', align: 'center', title: '创建者', hide: true }
            , { field: 'appeTime$', align: 'center', title: '添加时间', hide: true }
            , { field: 'frozen', align: 'center', title: '是否冻结', hide: true }
            , { field: 'frozenMemo', align: 'center', title: '冻结备注', hide: true }
            , { fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 350 }]
        ],
        request: {
            pageName: 'curr', pageSize: 'limit'
@@ -67,7 +67,7 @@
        searchData['orderByField'] = obj.field;
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData, page: {curr: 1}
            where: searchData, page: { curr: 1 }
        });
    });
@@ -80,14 +80,14 @@
                break;
            case 'batchModifties':
                if (checkStatus.length === 0) {
                    layer.msg('请选择需要修改的数据信息', {icon: 2});
                    layer.msg('请选择需要修改的数据信息', { icon: 2 });
                    return;
                }
                batchModifies();
                break;
            case 'deleteData':
                if (checkStatus.length === 0) {
                    layer.msg('请选择要删除的数据', {icon: 2});
                    layer.msg('请选择要删除的数据', { icon: 2 });
                    return;
                }
                del(checkStatus.map(function (d) {
@@ -95,8 +95,8 @@
                }));
                break;
            case 'init':
                layer.prompt({title: '请输入口令,并重置库位', formType: 1, shadeClose: true}, function (pass, idx) {
                    http.get(baseUrl + "/locMast/init/pwd", {pwd: pass}, function (res) {
                layer.prompt({ title: '请输入口令,并重置库位', formType: 1, shadeClose: true }, function (pass, idx) {
                    http.get(baseUrl + "/locMast/init/pwd", { pwd: pass }, function (res) {
                        if (res.data) {
                            layer.open({
                                type: 1,
@@ -145,6 +145,12 @@
            case "del":
                del([data.id]);
                break;
            case "clearLoc":
                clearLocation(data);
                break;
            case "setInStock":
                setInStock(data);
                break;
        }
    });
@@ -153,7 +159,7 @@
        console.log(data.field)
        $.ajax({
            url: baseUrl + "/locCache/init/auth",
            headers: {'token': localStorage.getItem('token')},
            headers: { 'token': localStorage.getItem('token') },
            data: data.field,
            method: 'POST',
            async: false,
@@ -190,28 +196,58 @@
        admin.open({
            type: 1,
            area: '600px',
            title: (mData ? '修改' : '添加') + '订单状态',
            title: (mData ? '修改' : '添加') + '库位缓存',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                layDateRender(mData);
                form.val('detail', mData);
                // 加载库区列表
                $.ajax({
                    url: baseUrl + "/basAreasQuery/auth",
                    headers: { 'token': localStorage.getItem('token') },
                    data: { condition: '' },
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200) {
                            var areaSelect = $(layero).find('select[name="areaName"]');
                            areaSelect.empty();
                            areaSelect.append('<option value="">请选择库区</option>');
                            var list = res.data;
                            for (var i = 0; i < list.length; i++) {
                                areaSelect.append('<option value="' + list[i].value + '" data-id="' + list[i].id + '">' + list[i].value + '</option>');
                            }
                            // 设置表单值
                            form.val('detail', mData);
                            // 如果有数据,设置选中的库区
                            if (mData && mData.areaName) {
                                areaSelect.val(mData.areaName);
                            }
                            form.render('select');
                        }
                    }
                });
                // 监听库区选择变化,同步areaId
                form.on('select(editAreaName)', function (data) {
                    var selectedOption = $(data.elem).find('option:selected');
                    var areaId = selectedOption.attr('data-id') || '';
                    $(layero).find('input[name="areaId"]').val(areaId);
                });
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl + "/locCache/" + (mData ? 'update' : 'add') + "/auth",
                        headers: {'token': localStorage.getItem('token')},
                        headers: { 'token': localStorage.getItem('token') },
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            if (res.code === 200) {
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                layer.msg(res.msg, { icon: 1 });
                                tableReload();
                            } else if (res.code === 403) {
                                top.location.href = baseUrl + "/";
                            } else {
                                layer.msg(res.msg, {icon: 2});
                                layer.msg(res.msg, { icon: 2 });
                            }
                        }
                    })
@@ -232,18 +268,18 @@
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl + "/locCache/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: ids},
                headers: { 'token': localStorage.getItem('token') },
                data: { ids: ids },
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200) {
                        layer.msg(res.msg, {icon: 1});
                        layer.msg(res.msg, { icon: 1 });
                        tableReload();
                    } else if (res.code === 403) {
                        top.location.href = baseUrl + "/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                        layer.msg(res.msg, { icon: 2 });
                    }
                }
            })
@@ -290,6 +326,71 @@
    layDateRender();
    // 清空库位
    function clearLocation(data) {
        layer.confirm('确认清空库位:' + data.locNo + '?', {
            skin: 'layui-layer-admin', shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl + "/locCache/lockOrUnlock/auth",
                headers: { 'token': localStorage.getItem('token') },
                data: {
                    locNo: data.locNo,
                    lock: false  // false表示解锁/清空
                },
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200) {
                        layer.msg(res.msg || '清空库位成功', { icon: 1 });
                        tableReload();
                    } else if (res.code === 403) {
                        top.location.href = baseUrl + "/";
                    } else {
                        layer.msg(res.msg || '清空库位失败', { icon: 2 });
                    }
                }
            })
        });
    }
    // 改为有货状态
    function setInStock(data) {
        layer.prompt({
            title: '请选择满托/空托',
            formType: 2,
            content: '<div style="padding: 20px;"><label><input type="radio" name="fullPlt" value="true" checked> 满托</label><br><br><label><input type="radio" name="fullPlt" value="false"> 空托</label></div>',
            area: ['300px', '200px']
        }, function(value, index, elem){
            var fullPlt = $(elem).find('input[name="fullPlt"]:checked').val() === 'true';
            layer.close(index);
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl + "/locCache/lockOrUnlock/auth",
                headers: { 'token': localStorage.getItem('token') },
                data: {
                    locNo: data.locNo,
                    lock: true,  // true表示锁定/改为有货
                    fullPlt: fullPlt
                },
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200) {
                        layer.msg(res.msg || '改为有货状态成功', { icon: 1 });
                        tableReload();
                    } else if (res.code === 403) {
                        top.location.href = baseUrl + "/";
                    } else {
                        layer.msg(res.msg || '改为有货状态失败', { icon: 2 });
                    }
                }
            })
        });
    }
});
// 关闭动作
@@ -303,6 +404,6 @@
        searchData[this.name] = this.value;
    });
    tableIns.reload({
        where: searchData, page: {curr: pageCurr}
        where: searchData, page: { curr: pageCurr }
    });
}