Blame view

src/main/resources/templates/monitor/locationstatus/locationstatus.html 31.6 KB
tangying authored
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<style type="text/css">
    #img_list li{
        font-size: 10px;
        /*width: 50px;*/
        text-align: left;
12
        margin: 5px 20px 5px 5px;
tangying authored
13
14
15
16
17
18
    }
    #img_list li img{
        height: 35px;
        width: 35px;
    }
    #info_list{
19
        width: 100%;
tangying authored
20
21
22
23
24
25
26
27
28
29
30
        display:inline-block;
    }
    #info_list li{
        margin:8px 3px 0 5px;
    }
    #info_list li span{
        font-size: 12px;
        display: inline-block;
        /*width: 65px;*/
        text-align: center;
    }
31
32
33
34
35
36
37
38
39
    .select-list li input {
        border: 1px solid #ddd;
        border-radius: 4px;
        background: transparent;
        outline: none;
        height: 30px;
        width: 130px;
        padding-left: 5px;
    }
tangying authored
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    .grid{
        display: inline-block;
        width: 50px;
        height: 50px;
        /*margin: 12px 6px;*/
        margin-bottom: 6px;
        background-size:cover;
        background-image: url("../img/icon/空柜空闲.png");
    }
    #location span{
        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>
63
                            <select id="zoneCode" name="zoneCode" style="width: 100px">
周峰 authored
64
                                <option selected th:each="item:${@zone.getZoneCodeList()}" th:value="${item['code']}" th:text="${item['name']}"></option>
tangying authored
65
66
67
68
69
70
71
72
73
74
75
76
77
78
                            </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>
79
                        <!--<li>
80
81
82
83
84

                            <select id="grid-num" name="grid-num" style="width: 70px">
                            </select>
                        </li>
                        <li >
85
                            <span style="line-height:33px;">格</span></li>-->
tangying authored
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
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="Search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        </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>
133
134
135
                        <li><span style="font-size: 12px">库位统计情况:</span>
                            <input style="width: 400px;  font-size: 12px"  type="text" id="zone" disabled/>
                        </li>
tangying authored
136
137
138
139
                    </ul><br><br>
                    <ul id="info_list">
                        <li><span>库位:</span><input type="text" id="code" disabled/></li>
                        <li><span>容器编码:</span><input type="text" id="containerCode" disabled/></li>
140
                        <li ><span>物料信息:<select id="material" style="width: auto"><option></option></select></span></li>
tangying authored
141
142
143
                        <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>
144
                    </ul>
145
146
147
148
<!--                    <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
149
150
151
152
153
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <!--style="width: 100%;overflow-x: scroll;white-space:nowrap"-->
154
            <div id="borderCol" style="overflow-y: scroll;white-space:nowrap;float:left;">
tangying authored
155
156
157
158
                <div class="location" id="location">
                    <!--<div class="grid"></div>-->
                </div>
            </div>
159
160
161
162
163
            <!--<div id="borderCol1" style="overflow-y: scroll;white-space:nowrap;">
                <div class="location1" id="location1">
                    &lt;!&ndash;<div class="grid"></div>&ndash;&gt;
                </div>
            </div>-->
tangying authored
164
165
166
167
168
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
169
170

    var supplier =[[${@SupplierService.getCode()}]];
mahuandong authored
171
    var prefix = ctx + "config/location";
tangying authored
172
    var grid_row;
周峰 authored
173
    var grid_row_first;
tangying authored
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
    var grid_line;
    var grid_layer;
    var list_info;
    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";
游杰 authored
190
191
192
193
194
195
196
197
198
199
200
201
    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
    var currentLocationCode=0;
    var currentMaterialCode=0;
205
    var grid_num=1;
tangying authored
206
    $(function() {
207
        resetAjax("A");
208
        $("#zoneCode").val("A");
tangying authored
209
210
211
212
213
214

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

            /*for (let i = 1; i <= grid_num; i++) {
                $("#grid-num").append("<option value='"+i+"'>"+i+"</option>")
            }*/
tangying authored
233
        });
mahuandong authored
234
235
236
        $("#zoneCode").change(function () {
           let type=$("#zoneCode").val();
tangying authored
237
238
239
240
241
242
243
244
245
246
247
248
249
            resetAjax(type);
        });

        //页面初始化请求
        function resetAjax(type){
            $.ajax({
                url:prefix+"/getAllLocation",
                type:"post",
                data:{
                    type:type
                },
                success:function (res) {
                    grid_row=res.data.maxRow;
周峰 authored
250
                    grid_row_first = res.data.minRow;
tangying authored
251
252
                    grid_line=res.data.maxLine;
                    grid_layer=res.data.maxLayer;
253
                    grid_num=res.data.maxGrid;
tangying authored
254
                    //初始格子
255
                    /*console.log(grid_layer)
256
                    console.log(grid_line)
257
                    console.log(grid_num)*/
tangying authored
258
259
260
261
262
                    $("#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++) {
263
264
265
266
                            for(let g = 1; g <= grid_num; g++){
                                $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" data-g="+ g +" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                            }
tangying authored
267
268
                        }
                    }
游杰 authored
269
270
271
                    let num=$("#editable-select").val();
                    $("#editable-num").children().remove();
                    if (num === "row") {
周峰 authored
272
                        for (let i = grid_row_first; i <= grid_row; i++) {
游杰 authored
273
274
275
276
277
278
279
280
281
282
283
284
                            $("#editable-num").append("<option value='"+i+"'>"+i+"</option>")
                        }
                    }
                    else if (num === "line") {
                        for (let i = 1; i <= grid_line; i++) {
                            $("#editable-num").append("<option value='"+i+"'>"+i+"</option>")
                        }
                    }
                    else if (num === "layer") {
                        for (let i = 1; i <= grid_layer; i++) {
                            $("#editable-num").append("<option value='"+i+"'>"+i+"</option>")
                        }
tangying authored
285
                    }
286
                   /* $("#grid-num").html('');
287
288
                    for (let i = 1; i <= grid_num; i++) {
                        $("#grid-num").append("<option value='"+i+"'>"+i+"</option>")
289
                    }*/
tangying authored
290
                    changeMargin();
游杰 authored
291
                    Search();
tangying authored
292
293
294
295
                }
            });
        }
游杰 authored
296
tangying authored
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
        //监听浏览器宽度的改变
        window.onresize = function(){
            changeMargin();
            border()
        };
        changeMargin();
        border()
    });

    //边框高度
    function border() {
        let box_height=$("#borderCol").offset().top;
        let window_height=$(window).height()-20;
        $("#borderCol").css({"height":window_height-box_height});
    }

    //格子宽度
    function changeMargin() {
        let box_width=document.getElementById("location").offsetWidth;
        box_width=box_width-80;
        let num=$("#editable-select").val();
        let grid_width;
        if (num === "layer" || num === "row") {
            grid_width=box_width/grid_line;
        }
        else if (num === "line") {
            grid_width=box_width/grid_row;
        }
325
326
        if (grid_width >= 40) {
            $(".grid").css({"width":"40px","height":"40px"});
tangying authored
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
        }
        else if (grid_width <= 20) {
            $(".grid").css({"width":"20px","height":"20px"});
        }
        else {
            $(".grid").css({"width":grid_width,"height":grid_width});
        }
    }

    //tips信息
    function lays(x) {
        let $j=$(x);
        let row=$j.attr("data-i");
        let line=$j.attr("data-j");
        let layers=$j.attr("data-k");
342
        let grid=$j.attr("data-g");
tangying authored
343
344
345
        row=parseInt(row);
        line=parseInt(line);
        layers=parseInt(layers);
346
        grid=parseInt(grid);
tangying authored
347
348
        if (list_info) {
            for (let i = 0; i < list_info.length; i++) {
349
                if (list_info[i].iRow === row && list_info[i].iColumn === line && list_info[i].iLayer === layers&& list_info[i].iGrid === grid) {
tangying authored
350
351
352
353
354
355
                    let str_info='';
                    let container_code='';
                    if (list_info[i].containerCode) {
                        container_code="<br>容器编码:"+ list_info[i].containerCode+"";
                        if (list_info[i].materialName) {
                            for (let j = 0; j < list_info[i].materialName.length; j++) {
356
357
                                //console.log(list_info[i])
                                //let list_batch=list_info[i].batch[j]===null?"无":list_info[i].batch[j]===""?"无":list_info[i].batch[j];
358
359
360
361
362
363
364
365
366
367
368
                                let list_supplicode=list_info[i].supplierCodeList[j]===null?"无":list_info[i].supplierCodeList[j]===""?"无":list_info[i].supplierCodeList[j];
                                let supplierName="无";
                                if(list_supplicode!="无"){
                                    for(let a=0;a<supplier.length;a++){
                                        let dict=supplier[a];
                                        if (dict.code == list_supplicode) {
                                            supplierName= dict.name;
                                            break
                                        }
                                    }
                                }
369
                                str_info=str_info + "<br>物料名称:"+ list_info[i].materialName[j] +",物料编码:"+ list_info[i].materialCode[j] +
370
                                    ",数量:"+ list_info[i].qty[j]+",供应商:"+supplierName  +",创建人:"+list_info[i].createByList[j] +",入库时间:"+list_info[i].createdList[j]
tangying authored
371
372
373
374
                            }
                        }
                    }
                    let code=list_info[i].code===null?"无":list_info[i].code;
375
                    layer.tips("第"+row+"行,第"+line+"列,第"+ layers +"层,第"+ grid +"格<br>库位:"+ code + container_code + str_info + ""
tangying authored
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
                        ,$j,{tips:[1,"rgb(28,132,198)"],time:0,area:'auto',maxWidth: '1000'});
                }
            }
        }else {return ""}
    }

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

    //搜索平面库位
    function Search() {
        let index=$("#editable-select").val();
        let num=$("#editable-num").val();
392
        let zoneCode=$("#zoneCode").val();
tangying authored
393
394
395
396
        $("#code").val("");
        $("#containerCode").val("");
        $("#material").children().remove();
        $("#material").append("<option>无</option>");
397
        var gridNum=$("#grid-num").val();
tangying authored
398
        let data;
399
        seachZone();
tangying authored
400
        if (index === "row") {
401
            data={type:zoneCode, row:num,grid:gridNum};
tangying authored
402
403
404
            $("#location").children().remove();
            for (let i = 1; i <= grid_layer; i++) {
                $(".location").append("<br><span>第"+ i+"层</span>");
405
                //data-g  第几格
tangying authored
406
                for (let j = 1; j <= grid_line; j++) {
407
408
409
                    for(let g = 1; g <= grid_num; g++){
                        $(".location").append("<img data-i="+num+" data-j="+j+" data-k="+i+" data-g="+g+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                    }
410
411
412
                    if(grid_num!=1){
                        $(".location").append("<img style='width:8px;'>")
                    }
tangying authored
413
414
415
416
417
418
                }
            }
            changeMargin();
            ajaxGrid(index,data);
        }
        else if (index === "line") {
419
            data={type:zoneCode, line:num,grid:gridNum};
tangying authored
420
421
422
423
            $("#location").children().remove();
            for (let k = 1; k <= grid_layer; k++) {
                $(".location").append("<br><span>第"+ k+"层</span>");
                for (let l = 1; l <= grid_row; l++) {
424
425
426
427
428
429
430
                    for(let g = 1; g <= grid_num; g++){
                        $(".location").append("<img data-i="+l+" data-j="+num+" data-k="+k+" data-g="+g+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                    }
                    if(grid_num!=1){
                        $(".location").append("<img style='width:8px;'>")
                    }
tangying authored
431
432
433
434
435
436
                }
            }
            changeMargin();
            ajaxGrid(index,data);
        }
        else if (index === "layer") {
437
            data={type:zoneCode, layer:num,grid:gridNum};
tangying authored
438
439
440
441
            $("#location").children().remove();
            for (let m = 1; m <= grid_row; m++) {
                $(".location").append("<br><span>第"+ m+"行</span>");
                for (let n = 1; n <= grid_line; n++) {
442
443
444
445
446
447
                    for(let g = 1; g <= grid_num; g++){
                        $(".location").append("<img data-i="+m+" data-j="+n+" data-k="+num+" data-g="+g+" class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
                    }
                    if(grid_num!=1){
                        $(".location").append("<img style='width:8px;'>")
                    }
tangying authored
448
449
450
451
452
453
                }
            }
            changeMargin();
            ajaxGrid(index,data);
        }
    }
lector authored
454
tangying authored
455
456
457
458
459
460
461
462
463
    //库位信息请求和状态显示
    function ajaxGrid(x, info) {
        let load=layer.msg('加载中', {icon: 16,shade: 0.4,time: false});
        $.ajax({
            url:prefix+"/getLocationInfo",
            type:"post",
            data:info,
            success:function (res) {
                if (res.code===200||res.data||res.msg==="成功") {
游杰 authored
464
465
466
467
468
469
470
471
472
473
474
475
                    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
476
477
                    if (x === "row") {
                        for (let i = 0; i < res.data.length; i++) {
478
mahuandong authored
479
                            let index=res.data[i].iColumn+((res.data[i].iLayer-1)*grid_line);
tangying authored
480
                            index=index-1;
481
482
483
484
485
486
                            if(index!=0){
                                index=index*grid_num;
                            }
                            if(res.data[i].iGrid!=1){
                                index=index+res.data[i].iGrid-1;
                            }
tangying authored
487
488
                            resShow(res,index,i);
                        }
pengcheng authored
489
                        clearLocation(grid_line,grid_layer,grid_num);
tangying authored
490
491
492
493
                        layer.close(load);
                    }
                    else if (x === "line") {
                        for (let i = 0; i < res.data.length; i++) {
游杰 authored
494
                            let index=res.data[i].iRow+((res.data[i].iLayer-1)*grid_row);
tangying authored
495
                            index=index-1;
496
497
498
499
500
501
                            if(index!=0){
                                index=index*grid_num;
                            }
                            if(res.data[i].iGrid!=1){
                                index=index+res.data[i].iGrid-1;
                            }
tangying authored
502
503
                            resShow(res,index,i);
                        }
pengcheng authored
504
                        clearLocation(grid_row,grid_layer,grid_num);
tangying authored
505
506
507
508
                        layer.close(load);
                    }
                    else if (x === "layer") {
                        for (let i = 0; i < res.data.length; i++) {
游杰 authored
509
                            let index=res.data[i].iColumn+((res.data[i].iRow-1)*grid_line);
tangying authored
510
                            index=index-1;
511
512
513
514
515
516
                            if(index!=0){
                                index=index*grid_num;
                            }
                            if(res.data[i].iGrid!=1){
                                index=index+res.data[i].iGrid-1;
                            }
tangying authored
517
518
                            resShow(res,index,i);
                        }
pengcheng authored
519
                        clearLocation(grid_line,grid_row,grid_num);
tangying authored
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
                        layer.close(load);
                    }
                }
                else if (res.msg !== "成功"||res.code!==200) {
                    layer.close(load);
                    layer.open({
                        title: '错误',
                        content: res.msg
                    });
                }
                list_info=res.data;
            },
            error:function (req, msg) {
                console.log(msg);
            }
        })
    }

    //库位请求的结果显示
    function resShow(res, index ,i) {
540
           /* if(res.data[i].userDef3=="4"){
541
542
                console.log(index)
                console.log(res.data[i])
543
            }*/
tangying authored
544
545
546
                if (res.data[i].deleted === false) {
                    if (res.data[i].userDef3 === "1") {
                        $(".grid").eq(index).attr({"src": grid_rest, "isTrue": 1});
游杰 authored
547
                        grid_num_1 = grid_num_1 + 1;
tangying authored
548
549
                    } else if (res.data[i].userDef3 === "2") {
                        $(".grid").eq(index).attr({"src": grid_empty, "isTrue": 1});
游杰 authored
550
                        grid_num_2 = grid_num_2 + 1;
tangying authored
551
552
                    } else if (res.data[i].userDef3 === "3") {
                        $(".grid").eq(index).attr({"src": grid_half, "isTrue": 1});
游杰 authored
553
                        grid_num_3 = grid_num_3 + 1;
tangying authored
554
555
                    } else if (res.data[i].userDef3 === "4") {
                        $(".grid").eq(index).attr({"src": grid_all, "isTrue": 1});
游杰 authored
556
                        grid_num_4 = grid_num_4 + 1;
tangying authored
557
558
                    } else if (res.data[i].userDef3 === "5") {
                        $(".grid").eq(index).attr({"src": grid_emp_lock, "isTrue": 1});
游杰 authored
559
                        grid_num_5 = grid_num_5 + 1;
tangying authored
560
561
                    } else if (res.data[i].userDef3 === "6") {
                        $(".grid").eq(index).attr({"src": grid_empty_lock, "isTrue": 1});
游杰 authored
562
                        grid_num_6 = grid_num_6 + 1;
tangying authored
563
564
                    } else if (res.data[i].userDef3 === "7") {
                        $(".grid").eq(index).attr({"src": grid_half_lock, "isTrue": 1});
游杰 authored
565
                        grid_num_7 = grid_num_7 + 1;
tangying authored
566
567
                    } else if (res.data[i].userDef3 === "8") {
                        $(".grid").eq(index).attr({"src": grid_all_lock, "isTrue": 1});
游杰 authored
568
                        grid_num_8 = grid_num_8 + 1;
tangying authored
569
570
                    } else if (res.data[i].userDef3 === "9") {
                        $(".grid").eq(index).attr({"src": grid_emp_waing, "isTrue": 1});
游杰 authored
571
                        grid_num_9 = grid_num_9 + 1;
tangying authored
572
573
                    } else if (res.data[i].userDef3 === "10") {
                        $(".grid").eq(index).attr({"src": grid_empty_waring, "isTrue": 1});
游杰 authored
574
                        grid_num_10 = grid_num_10 + 1;
tangying authored
575
576
                    } else if (res.data[i].userDef3 === "11") {
                        $(".grid").eq(index).attr({"src": grid_half_waring, "isTrue": 1});
游杰 authored
577
                        grid_num_11 = grid_num_11 + 1;
tangying authored
578
579
                    } else if (res.data[i].userDef3 === "12") {
                        $(".grid").eq(index).attr({"src": grid_all_waring, "isTrue": 1});
游杰 authored
580
                        grid_num_12 = grid_num_12 + 1;
tangying authored
581
582
583
584
585
586
587
588
                    }
                }
                else if (res.data[i].deleted === true) {
                    $(".grid").eq(i).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
                }
    }

    //清除将数据库中没有的库位
pengcheng authored
589
590
    function clearLocation(x, y,z) {
        for (let j = 0; j < x * y * z; j++) {
tangying authored
591
592
593
594
595
596
597
598
599
600
601
602
603
            let sta=$(".grid").eq(j).attr("isTrue");
            if (sta !== "1") {
                $(".grid").eq(j).attr({"src": rel_empty,"onmouseover": "","onclick": ""});
            }
        }
    }

    //点击显示当前库位信息
    function gridMsg(msg) {
        let $j=$(msg);
        let row=$j.attr("data-i");
        let line=$j.attr("data-j");
        let layers=$j.attr("data-k");
604
        let grid=$j.attr("data-g");
tangying authored
605
606
607
        row=parseInt(row);
        line=parseInt(line);
        layers=parseInt(layers);
608
        grid=parseInt(grid);
tangying authored
609
610
        if (list_info) {//缓存查询
            for (let i = 0; i < list_info.length; i++) {
611
               //console.log(list_info[i])
612
                if (list_info[i].iRow === row && list_info[i].iColumn === line && list_info[i].iLayer === layers&& list_info[i].iGrid === grid) {
tangying authored
613
614
615
                    if (list_info[i].materialName) {
                        $("#material").children().remove();
                        for (let j = 0; j < list_info[i].materialName.length; j++) {
616
                            //let list_batch=list_info[i].batch[j]===null?"无":list_info[i].batch[j]===""?"无":list_info[i].batch[j];
617
618
619
620
621
622
623
624
625
626
627
                            let list_supplicode=list_info[i].supplierCodeList[j]===null?"无":list_info[i].supplierCodeList[j]===""?"无":list_info[i].supplierCodeList[j];
                            let supplierName="无";
                            if(list_supplicode!="无"){
                                for(let a=0;a<supplier.length;a++){
                                    let dict=supplier[a];
                                    if (dict.code == list_supplicode) {
                                        supplierName= dict.name;
                                        break
                                    }
                                }
                            }
628
                            let str_info="物料名称:"+ list_info[i].materialName[j] +"/物料编码:"+ list_info[i].materialCode[j] +
629
                                "/数量:"+ list_info[i].qty[j] +"/供应商:"+ supplierName +"/创建人:"+ list_info[i].createByList[j] +"/入库时间:"+list_info[i].createdList[j]
tangying authored
630
                            $("#material").append("<option>"+ str_info +"</option>");
lector authored
631
                            currentMaterialCode = list_info[i].materialCode[j]
tangying authored
632
633
634
635
636
637
638
639
                        }
                    }
                    else {
                        $("#material").children().remove();
                        $("#material").append("<option>无</option>");
                    }
                    $("#code").val(list_info[i].code);
                    $("#containerCode").val(list_info[i].containerCode===""?"无":list_info[i].containerCode);
lector authored
640
641
                    currentContainerCode = $("#containerCode").val()
                    currentLocationCode = $("#code").val()
tangying authored
642
643
644
645
                }
            }
        }else {return ""}
        //接口查询
mahuandong authored
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
    //     $.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
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
    }

    //出库查看
    function checkLocationCode() {
        let data = $("#code").val();
        if (data) {
            $.modal.loading("正在处理中,请稍后...");
            $.ajax({
                url:prefix + "/checkLocationCode",
                type:'post',
                datatype:'json',
                data:{
                    locationCode:data
                },
                success: function (result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.msgSuccess(result.msg);
                    } else {
                        $.modal.alertError(result.msg)
                    }
                    $.modal.closeLoading()
                }
            })
        }
        else{
            layer.tips('请选择库位!',$("#code"),{tips:[1,"rgb(28,132,198)"],time:3000,area:'auto',maxWidth: '1000'})
        }
    }
lector authored
708
709

    function searchLocation(){
710
711
712
713
714
715
        if(!currentLocationCode){
            $.modal.alertError("请选择库位")
        }else {
            localStorage.setItem("locationCode",currentLocationCode)
            createMenuItem(ctx +"config/location","库位管理")
        }
lector authored
716
717
718
    }

    function searchInventory() {
719
720
721
722
723
724
        if(!currentLocationCode){
            $.modal.alertError("请选择库位")
            return
        }
        localStorage.setItem("locationCode",currentLocationCode)
        createMenuItem(ctx +"inventory/inventoryHeader","库存查看")
lector authored
725
    }
726
727
728
729
730
731
732
733
734

    function seachZone(){
        $.ajax({
            url:ctx+"config/zone/getStatus",
            data:{
                zoneCode:$("#zoneCode").val()
            },
            success:function (response) {
                if (response.code==200){
735
736
                    $("#zone").val("库位总数:"+response.data.location+", 空闲库位:"+response.data.emptyLocation+
                        ", 空托盘库位:"+response.data.haveContainLocation+", 有货库位:"+response.data.haveInventoryLocation)
737
738
739
740
741
742
743
744
745
                }else {
                    $.modal.alertError(response.msg)
                }
            },
            error:function () {
                $.modal.alertError("未知的错误")
            }
        })
    }
tangying authored
746
747
</script>
</body>
lector authored
748
</html>