自动化立体仓库 - WMS系统
lty
8 天以前 539a56279625242c497b4b4093f2defbb9d80334
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
    <style>
        body {
            padding: 0 20px;
        }
        .layui-table-box {
            border-right: 1px solid #9F9F9F;
            border-left: 1px solid #9F9F9F;
        }
 
        #search-box {
            padding: 30px 0 20px 0;
        }
        #search-box .layui-inline:first-child {
            margin-left: 30px;
        }
        #search-box .layui-inline {
            margin-right: 5px;
        }
 
        #data-search-btn {
            margin-left: 10px;
            display: inline-block;
        }
        #data-search-btn.layui-btn-container .layui-btn {
            margin-right: 20px;
        }
 
    </style>
</head>
<body>
 
<!-- 搜索栏 -->
<fieldset class="layui-elem-field site-demo-button" style="margin: 20px;">
    <legend data-i18n="search_bar">搜索栏</legend>
    <!-- 搜索栏 -->
    <div id="search-box" class="layui-form layui-card-header">
<!--        <div class="layui-input-inline" style="margin-top: -10px">-->
<!--            <select id="crnNo" name="crnNo">-->
<!--                <option value="" style="display: none">请选择巷道</option>-->
<!--                <option value="1">1号</option>-->
<!--                <option value="2">2号</option>-->
<!--                <option value="3">3号</option>-->
<!--                <option value="4">4号</option>-->
<!--            </select>-->
<!--        </div>-->
        <div class="layui-inline">
            <div class="layui-input-inline cool-auto-complete">
                <input id="crnNo" class="layui-input" name="crnNo" type="text" data-i18n-placeholder="please_input" placeholder="请输入" autocomplete="off" style="display: none">
                <input id="crnNo$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" data-i18n-placeholder="crane_no" placeholder="堆垛机号" onfocus=this.blur()>
                <div class="cool-auto-complete-window">
                    <input class="cool-auto-complete-window-input" data-key="basCrnpQueryBycrnNo" onkeyup="autoLoad(this.getAttribute('data-key'))">
                    <select class="cool-auto-complete-window-select" data-key="basCrnpQueryBycrnNoSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="loc_no" data-i18n-placeholder="location_no" placeholder="库位号" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="matnr" data-i18n-placeholder="product_code" placeholder="商品编号"  autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="specs" data-i18n-placeholder="spec" placeholder="规格"  autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="maktx" data-i18n-placeholder="material_desc" placeholder="物料描述" autocomplete="off">
            </div>
        </div>
        <!-- 日期范围 -->
        <div class="layui-inline" style="width: 300px">
            <div class="layui-input-inline">
                <input class="layui-input layui-laydate-range" id="modi_time" name="modi_time" type="text" data-i18n-placeholder="start_end_time" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
            </div>
        </div>
        <!-- 待添加 -->
        <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
            <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search" data-i18n="search">搜索</button>
            <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset" data-i18n="reset">重置</button>
        </div>
    </div>
</fieldset>
 
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn" id="btn-confirm" lay-event="confirm" style="" data-i18n="extract">提取</button>
    </div>
</script>
 
<div class="layui-form">
    <table class="layui-hide" id="stockOut" lay-filter="stockOut"></table>
</div>
 
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/i18n/i18n-helper.js"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
 
</body>
<script>
    var locDetlTableIns;
    function getCol() {
        let cols = [
            {type: 'checkbox', merge: ['locNo']}
            ,{field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '库位号', merge: true, style: 'font-weight: bold'}
        ];
        var dCols = [];
        if (typeof getDetlCols === 'function') {
            dCols = getDetlCols();
        } else {
            dCols = detlCols.slice();
        }
        cols.push.apply(cols, dCols);
        cols.push({field: 'modiUser$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modifier') : '修改人员', hide: true}
            ,{field: 'modiTime$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modify_time') : '修改时间'})
        return cols;
    }
 
    layui.config({
        base: baseUrl + "/static/layui/lay/modules/"
    }).use(['table','laydate', 'form', 'admin', 'tableMerge'], function() {
        var table = layui.table;
        var $ = layui.jquery;
        var layer = layui.layer;
        var layDate = layui.laydate;
        var form = layui.form;
        var admin = layui.admin;
        var tableMerge = layui.tableMerge;
 
        var dateIns = layDate.render({
            elem: '#modi_time'
            ,type: 'datetime'
            ,range: true
            ,lang: typeof I18n !== 'undefined' && I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en'
        });
 
        // 数据渲染
        function initTable() {
            locDetlTableIns = table.render({
                elem: '#stockOut',
                headers: {token: localStorage.getItem('token')},
                url: baseUrl+'/stock/out/list/auth',
                page: true,
                limit: 20,
                limits: [20, 50, 100, 200, 500],
                even: true,
                toolbar: '#toolbar',
                cellMinWidth: 50,
                cols: [getCol()],
                text: {
                    none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据'
                },
                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+"/";
                    }
                    if (typeof I18n !== 'undefined') {
                        I18n.updatePage();
                        I18n.updateLayuiPagination();
                    }
                }
            });
        }
 
        // Initialize table when I18n is ready
        if (typeof I18n !== 'undefined' && I18n.isReady()) {
            initTable();
        } else {
            $(document).on('i18n:ready', function() {
                initTable();
            });
        }
 
        $(document).on('i18n:languageChanged', function() {
            if (locDetlTableIns) {
                locDetlTableIns.reload({
                    cols: [getCol()]
                });
            } else {
                initTable();
            }
            $('[data-i18n-placeholder]').each(function() {
                var key = $(this).attr('data-i18n-placeholder');
                $(this).attr('placeholder', I18n.t(key));
            });
            // Reload date component
            if (typeof dateIns !== 'undefined') {
                 // Completely remove and recreate the input element to force laydate reset
                 var $input = $('#modi_time');
                 var parent = $input.parent();
                 var inputHtml = $input.prop("outerHTML");
                 $input.remove();
                 parent.append(inputHtml);
                 $('#modi_time').removeAttr('lay-key'); // Ensure no key remains
 
                 dateIns = layDate.render({
                    elem: '#modi_time'
                    ,type: 'datetime'
                    ,range: true
                    ,lang: I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en'
                });
            }
        });
 
        // 监听头工具栏事件
        table.on('toolbar(stockOut)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            switch(obj.event) {
                case 'confirm':
                    if (data.length === 0){
                        layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : "请选择数据", {icon: 2});
                        return;
                    }
                    let locNos = [];
                    data.forEach(function(elem) {
                        locNos.push(elem.locNo);
                    });
                    $.ajax({
                        url: baseUrl+"/locDetl/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: {locNos:locNos},
                        method: 'POST',
                        async: false,
                        success: function (res) {
                            if (res.code === 200) {
                                data = res.data;
                            } else if (res.code === 403) {
                                top.location.href = baseUrl + "/";
                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    })
                    parent.addTableData(data);
                    break;
            }
        });
 
        // 搜索栏搜索事件
        form.on('submit(search)', function (data) {
            tableReload();
        });
 
 
    })
 
    function tableReload() {
        if (!locDetlTableIns) return;
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        locDetlTableIns.reload({
            where: searchData
        });
    }
 
</script>
 
</html>