Blame view

src/main/resources/templates/monitor/locationstatus/locationstatus.html 31 KB
tangying authored
1
2
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
3
>
tangying authored
4
5
6
7
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<style type="text/css">
8
    #img_list li {
tangying authored
9
10
11
        font-size: 10px;
        /*width: 50px;*/
        text-align: left;
12
        margin: 5px 20px 5px 5px;
tangying authored
13
    }
14
15

    #img_list li img {
tangying authored
16
17
18
        height: 35px;
        width: 35px;
    }
19
20

    #info_list {
21
        width: 100%;
22
        display: inline-block;
tangying authored
23
    }
24
25
26

    #info_list li {
        margin: 8px 3px 0 5px;
tangying authored
27
    }
28
29

    #info_list li span {
tangying authored
30
31
32
33
34
        font-size: 12px;
        display: inline-block;
        /*width: 65px;*/
        text-align: center;
    }
35
36

    .grid {
tangying authored
37
38
39
40
41
        display: inline-block;
        width: 50px;
        height: 50px;
        /*margin: 12px 6px;*/
        margin-bottom: 6px;
42
        background-size: cover;
tangying authored
43
44
        background-image: url("../img/icon/空柜空闲.png");
    }
45
46

    #location span {
tangying authored
47
48
49
50
51
52
53
54
55
56
57
58
59
        display: inline-block;
        text-align: right;
        width: 50px;
        margin-right: 10px;
    }
</style>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="container-form">
                <div class="select-list">
                    <ul id="select_info">
                        <li>
xumiao authored
60
61
                            仓库:
                            <select id="warehouseCode" name="warehouseCode">
62
                                <option value="">所有</option>
63
64
65
                                <option value="CS0001" th:selected="${warehouseCode=='CS0001'}">长沙仓库</option>
                                <option value="KS0001" th:selected="${warehouseCode=='KS0001'}">昆山仓库</option>
                                <option value="XZ0001" th:selected="${warehouseCode=='XZ0001'}">徐州仓库</option>
xumiao authored
66
67
68
                            </select>
                        </li>
                        <li>
69
                            <select id="zoneCode" name="zoneCode" style="width: 100px">
70
71
                                <option selected th:each="item:${@zone.getZoneCodeList()}" th:value="${item['code']}"
                                        th:text="${item['name']}"></option>
tangying authored
72
73
74
75
76
77
78
79
80
81
82
83
84
85
                            </select>
                        </li>
                        <li>

                            <select id="editable-num" name="num" style="width: 70px">
                            </select>
                        </li>
                        <li>
                            <select id="editable-select" name="col" style="width: 70px">
                                <option value="row" selected></option>
                                <option value="line"></option>
                                <option value="layer"></option>
                            </select>
                        </li>
86
87
88
                        <!--                        <li>货主编码:-->
                        <!--                            <input type="text" name="receiptCompanyCode" id="receiptCompanyCode">-->
                        <!--                        </li>-->
tangying authored
89
                        <li>
90
91
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="Search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
tangying authored
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
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <form id="receiptHeader-form">
                <div class="select-list">
                    <ul id="img_list" style="">
                        <li>
                            空柜空闲:<img src="../img/icon/空柜空闲.png">
                        </li>
                        <li>
                            空盘空闲:<img src="../img/icon/空盘空闲.png">
                        </li>
                        <li>
                            半盘空闲:<img src="../img/icon/半盘空闲.png">
                        </li>
                        <li>
                            整盘空闲:<img src="../img/icon/整盘空闲.png">
                        </li>
                        <li>
                            空柜锁定:<img src="../img/icon/空柜锁定.png">
                        </li>
                        <li>
                            空盘锁定:<img src="../img/icon/空盘锁定.png">
                        </li>
                        <li>
                            半盘锁定:<img src="../img/icon/半盘锁定.png">
                        </li>
                        <li>
                            整盘锁定:<img src="../img/icon/整盘锁定.png">
                        </li>
                        <li>
                            空柜禁用:<img src="../img/icon/空柜禁用.png">
                        </li>
                        <li>
                            空盘禁用:<img src="../img/icon/空盘禁用.png">
                        </li>
                        <li>
                            半盘禁用:<img src="../img/icon/半盘禁用.png">
                        </li>
                        <li>
                            整盘禁用:<img src="../img/icon/整盘禁用.png">
                        </li>
137
                        <li><span style="font-size: 12px">库位统计情况:</span>
138
                            <input style="width: 400px;  font-size: 12px" type="text" id="zone" disabled/>
139
                        </li>
140
141
                    </ul>
                    <br><br>
tangying authored
142
143
144
145
                    <ul id="info_list">
                        <li><span>库位:</span><input type="text" id="code" disabled/></li>
                        <li><span>容器编码:</span><input type="text" id="containerCode" disabled/></li>
                        <li><span>物料信息:<select id="material" style="width: auto"><option></option></select></span></li>
146
147
148
149
                        <!--                        <li>-->
                        <!--                            <a class="btn btn-success btn-rounded btn-sm" onclick="checkLocationCode()"-->
                        <!--                               shiro:hasPermission="inventory:inventory:seeOut"><i class="fa fa-eye"></i>&nbsp;出库查看</a>-->
                        <!--                        </li>-->
150
                    </ul>
151
152
153
154
                    <!--                    <ul>-->
                    <!--                        <li style="float:left;margin-left: 40px"><button type="button" class="btn btn-sm btn-success" onclick="searchLocation()">查看库位</button></li>-->
                    <!--                        <li style="float:left;margin-left: 20px"><button type="button" class="btn btn-sm btn-success" onclick="searchInventory()">查看库存</button></li>-->
                    <!--                    </ul>-->
tangying authored
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <!--style="width: 100%;overflow-x: scroll;white-space:nowrap"-->
            <div id="borderCol" style="overflow-y: scroll;white-space:nowrap">
                <div class="location" id="location">
                    <!--<div class="grid"></div>-->
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
mahuandong authored
170
    var prefix = ctx + "config/location";
周鸿 authored
171
    var prefix_task = ctx + "task/taskHeader";
tangying authored
172
    var grid_row;
周峰 authored
173
    var grid_row_first;
tangying authored
174
175
176
    var grid_line;
    var grid_layer;
    var list_info;
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
    var grid_rest = "../img/icon/空柜空闲.png";
    var grid_empty = "../img/icon/空盘空闲.png";
    var grid_half = "../img/icon/半盘空闲.png";
    var grid_all = "../img/icon/整盘空闲.png";
    var grid_emp_waing = "../img/icon/空柜禁用.png";
    var grid_empty_waring = "../img/icon/空盘禁用.png";
    var grid_half_waring = "../img/icon/半盘禁用.png";
    var grid_all_waring = "../img/icon/整盘禁用.png";
    var grid_emp_lock = "../img/icon/空柜锁定.png";
    var grid_empty_lock = "../img/icon/空盘锁定.png";
    var grid_half_lock = "../img/icon/半盘锁定.png";
    var grid_all_lock = "../img/icon/整盘锁定.png";
    var rel_empty = "../img/icon/空.png";
    var grid_num_1 = 0;
    var grid_num_2 = 0;
    var grid_num_3 = 0;
    var grid_num_4 = 0;
    var grid_num_5 = 0;
    var grid_num_6 = 0;
    var grid_num_7 = 0;
    var grid_num_8 = 0;
    var grid_num_9 = 0;
    var grid_num_10 = 0;
    var grid_num_11 = 0;
    var grid_num_12 = 0;
lector authored
202
    var currentContainerCode;
203
204
205
    var currentLocationCode = 0;
    var currentMaterialCode = 0;
    $(function () {
206
        resetAjax("LK");
tangying authored
207
208
209

        //库位类型和行列层选择
        $("#editable-select").change(function () {
210
            let num = $("#editable-select").val();
tangying authored
211
212
            $("#editable-num").children().remove();
            if (num === "row") {
周峰 authored
213
                for (let i = grid_row_first; i <= grid_row; i++) {
214
                    $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
tangying authored
215
                }
216
            } else if (num === "line") {
tangying authored
217
                for (let i = 1; i <= grid_line; i++) {
218
                    $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
tangying authored
219
                }
220
            } else if (num === "layer") {
xumiao authored
221
222
                for (let i = grid_layer; i >= 1; i--) {
                    $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
tangying authored
223
                }
xumiao authored
224
225
226
                /*for (let i = 1; i <= grid_layer; i++) {
                    $("#editable-num").append("<option value='"+i+"'>"+i+"</option>")
                }*/
tangying authored
227
228
            }
        });
mahuandong authored
229
230
        $("#zoneCode").change(function () {
231
232
233
            let type = $("#zoneCode").val();
            let warehouseCode = $("#warehouseCode").val();
            resetAjax(warehouseCode, type);
tangying authored
234
235
236
        });

        //页面初始化请求
237
        function resetAjax(warehouseCode, type) {
xumiao authored
238
            console.log(warehouseCode);
tangying authored
239
            $.ajax({
240
241
242
243
244
                url: prefix + "/getAllLocation",
                type: "post",
                data: {
                    warehouseCode: warehouseCode,
                    type: type
tangying authored
245
                },
246
247
                success: function (res) {
                    grid_row = res.data.maxRow;
周峰 authored
248
                    grid_row_first = res.data.minRow;
249
250
                    grid_line = res.data.maxLine;
                    grid_layer = res.data.maxLayer;
tangying authored
251
252
253
254
255
256
                    //初始格子
                    $("#location").children().remove();
                    for (let i = 1; i <= grid_layer; i++) {
                        // var index=i+1;<span style='margin-top:30px'>第"+ index +"行</span>
                        $(".location").append("<br>");
                        for (let j = 1; j <= grid_line; j++) {
257
                            $(".location").append("<img data-i='1' data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
tangying authored
258
259
                        }
                    }
260
                    let num = $("#editable-select").val();
游杰 authored
261
262
                    $("#editable-num").children().remove();
                    if (num === "row") {
周峰 authored
263
                        for (let i = grid_row_first; i <= grid_row; i++) {
264
                            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
游杰 authored
265
                        }
266
                    } else if (num === "line") {
游杰 authored
267
                        for (let i = 1; i <= grid_line; i++) {
268
                            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
游杰 authored
269
                        }
270
                    } else if (num === "layer") {
游杰 authored
271
                        for (let i = 1; i <= grid_layer; i++) {
272
                            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
游杰 authored
273
                        }
tangying authored
274
275
                    }
                    changeMargin();
游杰 authored
276
                    Search();
tangying authored
277
278
279
280
                }
            });
        }
游杰 authored
281
tangying authored
282
        //监听浏览器宽度的改变
283
        window.onresize = function () {
tangying authored
284
285
286
287
288
289
290
291
292
            changeMargin();
            border()
        };
        changeMargin();
        border()
    });

    //边框高度
    function border() {
293
294
295
        let box_height = $("#borderCol").offset().top;
        let window_height = $(window).height() - 20;
        $("#borderCol").css({"height": window_height - box_height});
tangying authored
296
297
298
299
    }

    //格子宽度
    function changeMargin() {
300
301
302
        let box_width = document.getElementById("location").offsetWidth;
        box_width = box_width - 80;
        let num = $("#editable-select").val();
tangying authored
303
304
        let grid_width;
        if (num === "layer" || num === "row") {
305
306
307
            grid_width = box_width / grid_line;
        } else if (num === "line") {
            grid_width = box_width / grid_row;
tangying authored
308
309
        }
        if (grid_width >= 50) {
310
311
312
313
314
            $(".grid").css({"width": "50px", "height": "50px"});
        } else if (grid_width <= 20) {
            $(".grid").css({"width": "20px", "height": "20px"});
        } else {
            $(".grid").css({"width": grid_width, "height": grid_width});
tangying authored
315
316
317
318
319
        }
    }

    //tips信息
    function lays(x) {
320
321
322
323
324
325
326
        let $j = $(x);
        let row = $j.attr("data-i");
        let line = $j.attr("data-j");
        let layers = $j.attr("data-k");
        row = parseInt(row);
        line = parseInt(line);
        layers = parseInt(layers);
tangying authored
327
328
        if (list_info) {
            for (let i = 0; i < list_info.length; i++) {
mahuandong authored
329
                if (list_info[i].iRow === row && list_info[i].iColumn === line && list_info[i].iLayer === layers) {
330
331
                    let str_info = '';
                    let container_code = '';
tangying authored
332
                    if (list_info[i].containerCode) {
333
                        container_code = "&nbsp;&nbsp;&nbsp;&nbsp;容器编码:" + list_info[i].containerCode + "";
tangying authored
334
335
                        if (list_info[i].materialName) {
                            for (let j = 0; j < list_info[i].materialName.length; j++) {
336
337
338
339
                                // let list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
                                let list_days = list_info[i].days[j] === null ? "无" : list_info[i].days[j] === "" ? "无" : list_info[i].days[j];
                                str_info = str_info + "<br>库龄:" + list_days + ",物料名称:" + list_info[i].materialName[j] + ",物料编码:" + list_info[i].materialCode[j] +
                                    ",数量:" + list_info[i].qty[j] + ""
tangying authored
340
341
342
                            }
                        }
                    }
343
344
345
                    let code = list_info[i].code === null ? "无" : list_info[i].code;
                    layer.tips("第" + row + "行,第" + line + "列,第" + layers + "层<br>库位:" + code + container_code + str_info + ""
                        , $j, {tips: [1, "rgb(28,132,198)"], time: 0, area: 'auto', maxWidth: '1000'});
tangying authored
346
347
                }
            }
348
349
350
        } else {
            return ""
        }
tangying authored
351
352
353
354
355
356
357
358
359
360
    }

    //关闭tips
    function Mclose(x) {
        let index = layer.tips();
        layer.close(index);
    }

    //搜索平面库位
    function Search() {
361
362
363
        let index = $("#editable-select").val();
        let num = $("#editable-num").val();
        let zoneCode = $("#zoneCode").val();
tangying authored
364
365
        $("#code").val("");
        $("#containerCode").val("");
366
        let warehouseCode = $("#warehouseCode").val();
tangying authored
367
368
369
        $("#material").children().remove();
        $("#material").append("<option>无</option>");
        let data;
370
        seachZone();
tangying authored
371
        if (index === "row") {
372
            data = {type: zoneCode, row: num, warehouseCode: warehouseCode};
tangying authored
373
            $("#location").children().remove();
xumiao authored
374
375
376
377
378
379
380
381
382
            for (let i = grid_layer; i >= 1; i--) {
                $(".location").append("<br><span>第" + i + "层</span>");

                for (let j = 1; j <= grid_line; j++) {

                    $(".location").append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                }
            }
            /*for (let i = 1; i <= grid_layer; i++) {
tangying authored
383
                $(".location").append("<br><span>第"+ i+"层</span>");
xumiao authored
384
tangying authored
385
386
387
                for (let j = 1; j <= grid_line; j++) {
                    $(".location").append("<img data-i="+num+" data-j="+j+" data-k="+i+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                }
xumiao authored
388
            }*/
tangying authored
389
            changeMargin();
390
391
392
            ajaxGrid(index, data);
        } else if (index === "line") {
            data = {type: zoneCode, line: num, warehouseCode: warehouseCode};
tangying authored
393
            $("#location").children().remove();
xumiao authored
394
395
396
397
398
399
400
            for (let k = grid_layer; k >= 1; k--) {
                $(".location").append("<br><span>第" + k + "层</span>");
                for (let l = 1; l <= grid_row; l++) {
                    $(".location").append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                }
            }
            /*for (let k = 1; k <= grid_layer; k++) {
tangying authored
401
402
403
404
                $(".location").append("<br><span>第"+ k+"层</span>");
                for (let l = 1; l <= grid_row; l++) {
                    $(".location").append("<img data-i="+l+" data-j="+num+" data-k="+k+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                }
xumiao authored
405
            }*/
tangying authored
406
            changeMargin();
407
408
409
            ajaxGrid(index, data);
        } else if (index === "layer") {
            data = {type: zoneCode, layer: num, warehouseCode: warehouseCode};
tangying authored
410
411
            $("#location").children().remove();
            for (let m = 1; m <= grid_row; m++) {
412
                $(".location").append("<br><span>第" + m + "行</span>");
tangying authored
413
                for (let n = 1; n <= grid_line; n++) {
414
                    $(".location").append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
tangying authored
415
416
417
                }
            }
            changeMargin();
418
            ajaxGrid(index, data);
tangying authored
419
420
        }
    }
lector authored
421
tangying authored
422
423
    //库位信息请求和状态显示
    function ajaxGrid(x, info) {
424
        let load = layer.msg('加载中', {icon: 16, shade: 0.4, time: false});
tangying authored
425
        $.ajax({
426
427
428
429
430
            url: prefix + "/getLocationInfo",
            type: "post",
            data: info,
            success: function (res) {
                if (res.code === 200 || res.data || res.msg === "成功") {
游杰 authored
431
432
433
434
435
436
437
438
439
440
441
442
                    grid_num_1 = 0;
                    grid_num_2 = 0;
                    grid_num_3 = 0;
                    grid_num_4 = 0;
                    grid_num_5 = 0;
                    grid_num_6 = 0;
                    grid_num_7 = 0;
                    grid_num_8 = 0;
                    grid_num_9 = 0;
                    grid_num_10 = 0;
                    grid_num_11 = 0;
                    grid_num_12 = 0;
tangying authored
443
                    if (x === "row") {
xumiao authored
444
                        console.log('grid_line', grid_line)
tangying authored
445
                        for (let i = 0; i < res.data.length; i++) {
xumiao authored
446
447
448
449
                            //let index=res.data[i].iColumn+((res.data[i].iLayer-1)*grid_line);
                            let index = res.data[i].iColumn + ((grid_layer - res.data[i].iLayer) * grid_line);
                            index = index - 1;
                            resShow(res, index, i);
tangying authored
450
                        }
xumiao authored
451
452
                        //console.log('grid_line',grid_line)
                        //console.log('grid_layer',grid_layer)
453
                        clearLocation(grid_line, grid_layer);
tangying authored
454
                        layer.close(load);
455
                    } else if (x === "line") {
tangying authored
456
                        for (let i = 0; i < res.data.length; i++) {
xumiao authored
457
458
                            // let index=res.data[i].iRow+((res.data[i].iLayer-1)*grid_row);
                            let index = res.data[i].iRow + ((grid_layer - res.data[i].iLayer) * grid_row);
459
460
                            index = index - 1;
                            resShow(res, index, i);
tangying authored
461
                        }
462
                        clearLocation(grid_row, grid_layer);
tangying authored
463
                        layer.close(load);
464
                    } else if (x === "layer") {
tangying authored
465
                        for (let i = 0; i < res.data.length; i++) {
466
467
468
                            let index = res.data[i].iColumn + ((res.data[i].iRow - 1) * grid_line);
                            index = index - 1;
                            resShow(res, index, i);
tangying authored
469
                        }
470
                        clearLocation(grid_line, grid_row);
tangying authored
471
472
                        layer.close(load);
                    }
473
                } else if (res.msg !== "成功" || res.code !== 200) {
tangying authored
474
475
476
477
478
479
                    layer.close(load);
                    layer.open({
                        title: '错误',
                        content: res.msg
                    });
                }
480
                list_info = res.data;
tangying authored
481
            },
482
            error: function (req, msg) {
tangying authored
483
484
485
486
487
488
                console.log(msg);
            }
        })
    }

    //库位请求的结果显示
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
    function resShow(res, index, i) {
        if (res.data[i].deleted === false) {
            if (res.data[i].userDef3 === "1") {
                $(".grid").eq(index).attr({"src": grid_rest, "isTrue": 1});
                grid_num_1 = grid_num_1 + 1;
            } else if (res.data[i].userDef3 === "2") {
                $(".grid").eq(index).attr({"src": grid_empty, "isTrue": 1});
                grid_num_2 = grid_num_2 + 1;
            } else if (res.data[i].userDef3 === "3") {
                $(".grid").eq(index).attr({"src": grid_half, "isTrue": 1});
                grid_num_3 = grid_num_3 + 1;
            } else if (res.data[i].userDef3 === "4") {
                $(".grid").eq(index).attr({"src": grid_all, "isTrue": 1});
                grid_num_4 = grid_num_4 + 1;
            } else if (res.data[i].userDef3 === "5") {
                $(".grid").eq(index).attr({"src": grid_emp_lock, "isTrue": 1});
                grid_num_5 = grid_num_5 + 1;
            } else if (res.data[i].userDef3 === "6") {
                $(".grid").eq(index).attr({"src": grid_empty_lock, "isTrue": 1});
                grid_num_6 = grid_num_6 + 1;
            } else if (res.data[i].userDef3 === "7") {
                $(".grid").eq(index).attr({"src": grid_half_lock, "isTrue": 1});
                grid_num_7 = grid_num_7 + 1;
            } else if (res.data[i].userDef3 === "8") {
                $(".grid").eq(index).attr({"src": grid_all_lock, "isTrue": 1});
                grid_num_8 = grid_num_8 + 1;
            } else if (res.data[i].userDef3 === "9") {
                $(".grid").eq(index).attr({"src": grid_emp_waing, "isTrue": 1});
                grid_num_9 = grid_num_9 + 1;
            } else if (res.data[i].userDef3 === "10") {
                $(".grid").eq(index).attr({"src": grid_empty_waring, "isTrue": 1});
                grid_num_10 = grid_num_10 + 1;
            } else if (res.data[i].userDef3 === "11") {
                $(".grid").eq(index).attr({"src": grid_half_waring, "isTrue": 1});
                grid_num_11 = grid_num_11 + 1;
            } else if (res.data[i].userDef3 === "12") {
                $(".grid").eq(index).attr({"src": grid_all_waring, "isTrue": 1});
                grid_num_12 = grid_num_12 + 1;
            }
        } else if (res.data[i].deleted === true) {
            $(".grid").eq(i).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
        }
tangying authored
531
532
533
534
535
    }

    //清除将数据库中没有的库位
    function clearLocation(x, y) {
        for (let j = 0; j < x * y; j++) {
536
            let sta = $(".grid").eq(j).attr("isTrue");
tangying authored
537
            if (sta !== "1") {
538
                $(".grid").eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
tangying authored
539
540
541
542
543
544
            }
        }
    }

    //点击显示当前库位信息
    function gridMsg(msg) {
545
546
547
548
549
550
551
        let $j = $(msg);
        let row = $j.attr("data-i");
        let line = $j.attr("data-j");
        let layers = $j.attr("data-k");
        row = parseInt(row);
        line = parseInt(line);
        layers = parseInt(layers);
tangying authored
552
553
        if (list_info) {//缓存查询
            for (let i = 0; i < list_info.length; i++) {
mahuandong authored
554
                if (list_info[i].iRow === row && list_info[i].iColumn === line && list_info[i].iLayer === layers) {
tangying authored
555
556
557
                    if (list_info[i].materialName) {
                        $("#material").children().remove();
                        for (let j = 0; j < list_info[i].materialName.length; j++) {
558
559
560
561
562
                            // let list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
                            let list_days = list_info[i].days[j] === null ? "无" : list_info[i].days[j] === "" ? "无" : list_info[i].days[j];
                            let str_info = "库龄:" + list_days + "/ 物料名称:" + list_info[i].materialName[j] + "/ 物料编码:" + list_info[i].materialCode[j] +
                                "/ 数量:" + list_info[i].qty[j] + "";
                            $("#material").append("<option>" + str_info + "</option>");
lector authored
563
                            currentMaterialCode = list_info[i].materialCode[j]
tangying authored
564
                        }
565
                    } else {
tangying authored
566
567
568
569
                        $("#material").children().remove();
                        $("#material").append("<option>无</option>");
                    }
                    $("#code").val(list_info[i].code);
570
                    $("#containerCode").val(list_info[i].containerCode === "" ? "无" : list_info[i].containerCode);
lector authored
571
572
                    currentContainerCode = $("#containerCode").val()
                    currentLocationCode = $("#code").val()
tangying authored
573
574
                }
            }
575
576
577
        } else {
            return ""
        }
tangying authored
578
        //接口查询
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
        //     $.ajax({
        //         url:prefix+"/getLocationInfo",
        //         type:"post",
        //         data:{
        //             type:"L",
        //             row:row,
        //             line:line,
        //             layer:layers,
        //             grid:1
        //         },
        //         success:function (res) {
        //             $("#row_info").val(res.data[0].row);
        //             $("#line_info").val(res.data[0].line);
        //             $("#layer_info").val(res.data[0].layer);
        //             $("#id").val(res.data[0].id);
        //             $("#code").val(res.data[0].code);
        //             $("#warehouseId").val(res.data[0].warehouseId);
        //             $("#warehouseCode").val(res.data[0].warehouseCode);
        //             $("#rowIndex").val(res.data[0].rowIndex);
        //             $("#roadway").val(res.data[0].roadway);
        //             $("#type").val(res.data[0].type);
        //             $("#containerId").val(res.data[0].containerId);
        //             $("#containerCode").val(res.data[0].containerCode);
        //             $("#zoneId").val(res.data[0].zoneId);
        //             $("#zoneCode").val(res.data[0].zoneCode);
        //             $("#status").val(res.data[0].userDef3);
        //             $("#lastCycleCountDate").val(res.data[0].lastCycleCountDate);
        //             $("#created").val(res.data[0].created);
        //             $("#createdBy").val(res.data[0].createdBy);
        //             $("#lastUpdated").val(res.data[0].lastUpdated);
        //             $("#lastUpdatedBy").val(res.data[0].lastUpdatedBy);
        //             $("#enable").val(res.data[0].enable);
        //         }
        //     });
tangying authored
613
614
615
616
617
618
619
620
    }

    //出库查看
    function checkLocationCode() {
        let data = $("#code").val();
        if (data) {
            $.modal.loading("正在处理中,请稍后...");
            $.ajax({
周鸿 authored
621
                url: prefix_task + "/checkLocationCode",
622
623
624
625
                type: 'post',
                datatype: 'json',
                data: {
                    locationCode: data
tangying authored
626
627
628
                },
                success: function (result) {
                    if (result.code == web_status.SUCCESS) {
周鸿 authored
629
                        $.modal.alertSuccess(result.msg);
tangying authored
630
631
632
633
634
635
                    } else {
                        $.modal.alertError(result.msg)
                    }
                    $.modal.closeLoading()
                }
            })
636
637
        } else {
            layer.tips('请选择库位!', $("#code"), {tips: [1, "rgb(28,132,198)"], time: 3000, area: 'auto', maxWidth: '1000'})
tangying authored
638
639
        }
    }
lector authored
640
641
642
    function searchLocation() {
        if (!currentLocationCode) {
643
            $.modal.alertError("请选择库位")
644
645
646
        } else {
            localStorage.setItem("locationCode", currentLocationCode)
            createMenuItem(ctx + "config/location", "库位管理")
647
        }
lector authored
648
649
650
    }

    function searchInventory() {
651
        if (!currentLocationCode) {
652
653
654
            $.modal.alertError("请选择库位")
            return
        }
655
656
        localStorage.setItem("locationCode", currentLocationCode)
        createMenuItem(ctx + "inventory/inventoryHeader", "库存查看")
lector authored
657
    }
658
659
    function seachZone() {
660
        $.ajax({
661
662
663
664
            url: ctx + "config/zone/getStatus",
            data: {
                zoneCode: $("#zoneCode").val(),
                warehouseCode: $("#warehouseCode").val()
665
            },
666
667
668
669
670
            success: function (response) {
                if (response.code == 200) {
                    $("#zone").val("库位总数:" + response.data.location + ", 空闲库位:" + response.data.emptyLocation +
                        ", 空托盘库位:" + response.data.haveContainLocation + ", 有货库位:" + response.data.haveInventoryLocation)
                } else {
671
672
673
                    $.modal.alertError(response.msg)
                }
            },
674
            error: function () {
675
676
677
678
                $.modal.alertError("未知的错误")
            }
        })
    }
xumiao authored
679
680
681
682
683
684
685
686
687
688

    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({elem: '#appointmentTime', min: 0, theme: 'molv', type: 'datetime'});
        });

        $("select[name='warehouseCode']").change(function (e) {
            debugger;
            let warehouseCode = $("select[name='warehouseCode'] option:selected").val();
689
            if (!warehouseCode) {
xumiao authored
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
                return;
            }
            $.ajax({
                url: ctx + "config/zone/findByWare",
                type: 'post',
                data: {warehouseCode: warehouseCode},
                success: function (response) {
                    if (response.code === 200) {
                        $("select[name='zoneCode']").children().remove();
                        $("select[name='zoneCode']").append(`<option value="">所有</option>`);
                        for (let item of response.data) {
                            let option = `<option value="${item.code}">${item.name}</option>`;
                            $("select[name='zoneCode']").append(option);
                        }
                    } else {
                        $.modal.msgError(response.msg)
                    }
                }
            });
        })
    })
tangying authored
711
712
</script>
</body>
lector authored
713
</html>