自动化立体仓库 - WMS系统
pang.jiabao
2025-04-08 e55f015618ac1e85a5a6f7f3404a8b7a4f8f8e05
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
var pageCurr = 0;
var tableIns;
function getCol() {
    var cols = [
        {field: 'locNo', align: 'center',title: 'Номер складского места', merge: true, style: 'font-weight: bold'}
    ];
    cols.push.apply(cols, detlCols);
    return cols;
}
 
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'tableMerge'], function() {
    var table = layui.table;
    var $ = layui.jquery;
    var form = layui.form;
    var tableMerge = layui.tableMerge;
 
    // 数据渲染
    tableIns = table.render({
        elem: '#locMatCode',
        headers: {token: localStorage.getItem('token')},
        // url: baseUrl+'/locDetl/list/auth',
        data:[],
        page: true,
        limit: 16,
        limits: [16, 50, 100, 200, 500],
        even: true,
        cellMinWidth: 50,
        cols: [getCol()],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            tableMerge.render(this);
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
            clearSelect();
        }
    });
 
});
 
// 搜索库位物料
function getLoc(el) {
    tableIns.reload({
        url: baseUrl+'/locDetl/list/auth'
        , where: {loc_no: el.value}
        , done:function (res) {
            limit();
            clearSelect();
            // 获取同一堆垛机的空库位
            http.post(baseUrl + "/group/empty/stock", {sourceLocNo: el.value}, function (res) {
                if (res.data != null) {
                    var tpl = $("#emptyLocStock").html();
                    var template = Handlebars.compile(tpl);
                    var html = template(res);
                    $('#targetLocNo').append(html);
                    layui.form.render('select');
                }
            });
        }
    });
}
 
// 移库启动
function locMove() {
    var sourceLocNo = $("#sourceLocNo").val();
    var targetLocNo = $("#targetLocNo").val();
    if (sourceLocNo === null || sourceLocNo === ""){
        $("#sourceLocNo").css("border-color", "red");
        setTimeout(function () {
            $("#sourceLocNo").css("border-color", "#b8b8b8");
        }, 1000);
        layer.msg("Пожалуйста, введите исходную ячейку");
        return;
    }
    if (targetLocNo === null || targetLocNo === "") {
        $(".layui-select-title .layui-input").css("border-color", "red");
        setTimeout(function () {
            $(".layui-select-title .layui-input").css("border-color", "#b8b8b8");
        }, 1000);
        layer.msg("请输入目标库位");
        return;
    }
    $.ajax({
        url: baseUrl + "/loc/move/start",
        headers: {'token': localStorage.getItem('token')},
        dataType: 'json',
        data: {
            sourceLocNo: sourceLocNo,
            targetLocNo: targetLocNo
        },
        method: 'POST',
        success: function (res) {
            if (res.code === 200) {
                $("#sourceLocNo").val("");
                $("#targetLocNo").empty();
                layui.form.render('select');
                tableIns.reload({
                    data: [],
                    url: '',
                    done:function (res) {
                        limit();clearSelect();
                    }
                });
                layer.msg(res.msg);
            } else if (res.code === 403) {
                top.location.href = baseUrl + "/";
            } else {
                layer.msg(res.msg);
            }
        }
    })
}
 
function clearSelect() {
    $("#targetLocNo").empty();
    layui.form.render('select');
}