bklLiudl
2025-04-07 4e8f58cb41c7b6d570fd1979d80f74ab8a4d00c2
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
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
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
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
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
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
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
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
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
<!DOCTYPE html>
<html>
 
<head>
    <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta charset="UTF-8" />
    <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> -->
    <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> -->
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>AGV转运</title>
 
    <link rel="stylesheet" href="/layui/css/layui.css" />
    <link rel="stylesheet" href="/css/style.css" />
    <script src="/js/adaptive.js"></script>
    <link rel="stylesheet" href="/css/my.css" />
    <style type="text/css">
        td {
            word-break: break-all;
            word-wrap: break-word;
        }
 
        .layui-form-switch {
            margin-top: 0;
        }
 
        /* 标签样式 */
        .tableyang-this a {
            margin: 10px 10px 0px 0px;
            line-height: 30px;
            width: 100px;
            color: #999;
            text-align: center;
            float: left;
            background: #f7f7f7;
            user-select: none;
            position: relative;
            z-index: 1;
            cursor: pointer;
            border-radius: 5px;
            border: 1px solid #ccc;
            transition: all 0.3s ease;
        }
 
        .tableyang-this a.hover {
            color: #5298ff;
            background-color: #eff2ff;
            border: 1px solid #5298ff;
        }
 
        /* 内容居中 */
        .tableyang-tab {
            display: flex;
            /* justify-content: center; */
            /* align-items: center; */
            flex-direction: column;
            height: 90vh;
        }
 
        /* 必用样式 */
        .tableyang-2,
        .tableyang-3 {
            display: none;
        }
 
        ul {
            list-style-type: none;
            padding: 0;
        }
 
        li {
            cursor: pointer;
            background-color: lightgray;
            padding: 10px;
            margin-bottom: 5px;
        }
    </style>
    <link rel="stylesheet" href="/css/adapter.css" />
    <script src="../../js/jquery.js"></script>
    <script src="../../js/jquery-3.5.1.min.js"></script>
</head>
 
<body>
    <div id="" class="main-content">
 
        <div id="" class="layout-title">
            <table border="" cellspacing="" cellpadding="">
                <tr>
                    <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td>
                    <td class="title-text" lang>AGV转运</td>
                    <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td>
                </tr>
            </table>
        </div>
 
        <div id="" class="layout-sub-content">
            <div id="menuList" class="menu">
                <ul class="" style="text-align: center;">
                    <li><a href="../index.html" lang>主页</a></li>
                    <!-- <li><a href="productEnterConfirm.html">入库信息确认</a></li> -->
                    <li><a href="../login.html" lang>重新登录</a></li>
                </ul>
            </div>
 
            <!-- <ul>
                <li id="option1">小车</li>
                <li id="option2">叫货</li>
 
            </ul> -->
 
            <button id="option1" class="layout-btn" type="button">小车</button>
            <button id="option2" class="layout-btn" type="button">叫货</button>
            <br /><br />
 
            <!-- 有码 -->
            <div id="content1">
                <div id="zongDiv" class="layout-bill-info" style="height: 170px;">
                    <form class="layui-form" action="">
                        <div id="" class="layui-form-item layout-input">
                            <label class="layui-form-label" lang>托盘条码:</label>
                            <div class="layui-input-block">
                                <input id="STOCKCODE" type="text" lay-verify="stock" lang langholder
                                    placeholder="请扫描托盘条码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div id="" class="layui-form-item layout-input">
                            <label class="layui-form-label" lang>起始地码:</label>
                            <div class="layui-input-block">
                                <input id="LocatNo" type="text" lay-verify="stock" lang langholder placeholder="起始地码"
                                    autocomplete="off" class="layui-input" readonly>
                            </div>
                        </div>
                        <div id="" class="layui-form-item layout-dropdownlist">
                            <label class="layui-form-label" lang>目标区域:</label>
                            <div class="layui-input-block" id="selectQuyu">
                                <select id="Quyu" lay-filter="getQuyu" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png">
                            </div>
                        </div>
                        <div id="" class="layui-form-item layout-dropdownlist">
                            <label class="layui-form-label" lang>入库口:</label>
                            <div class="layui-input-block" id="selectRuku">
                                <select id="Ruku" lay-filter="getRuku" lay-search>
                                    <option value=""></option>
                                    <option value="033">033</option>
                                    <option value="039">039</option>
                                    <option value="044">044</option>
                                    <option value="051">051</option>
                                    <option value="443">443</option>
                                    <option value="440">440</option>
                                </select>
                                <img src="/assets/down_arraw.png">
                            </div>
                        </div>
 
                        <table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
                            <tr>
                                <td style="width: 23%;"></td>
                                <td>
                                    <button class="layout-btn layout-btn-red" lang type="button" lay-submit
                                        lay-filter="formCall">叫小车</button>
                                </td>
                                <td style="width: 33%;"></td>
 
                            </tr>
                        </table>
                    </form>
                </div>
 
                <br>
 
                <div id="" class="cut-line">
                    <img src="/assets/fengexian.png">
                </div>
 
                <div class="layout-tbl-paging" id="">
                    <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
                        <tr>
                            <th lang style="width: 15%;">物料编码</th>
                            <th lang style="width: 35%;">物料名称</th>
                            <th lang style="width: 25%;">批次</th>
                            <th lang style="width: 15%;">物料数量</th>
                        </tr>
                        <tr id="boxCell" style="display: none;">
                            <td name="code">AG000001</td>
                            <td name="name">疫苗名称名称名称</td>
                            <td name="lotNo">批次号</td>
                            <td name="num">30</td>
                        </tr>
                    </table>
                    <!-- 分页 -->
                    <table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
                        <tr>
                            <td class="page-prev">上一页</td>
                            <td class="page-num page-num-select">1</td>
                            <td class="page-num">2</td>
                            <td class="page-num">3</td>
                            <td class="page-num">4</td>
                            <td class="page-num">5</td>
                            <td class="page-next">下一页</td>
                        </tr>
                    </table>
                </div>
 
            </div>
            <!-- 无码 -->
            <div id="content2">
                <div id="zongDiv" class="layout-bill-info" style="height: 150px;">
                    <form class="layui-form" id="form2" action="">
                        <div id="" class="layui-form-item layout-dropdownlist">
                            <label class="layui-form-label" lang>出库单:</label>
                            <div class="layui-input-block" id="selectOutNo">
                                <select id="OutNo" lay-filter="getOutNo" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png">
                            </div>
                        </div>
                        <div id="" class="layui-form-item layout-dropdownlist">
                            <label class="layui-form-label" lang>托盘条码:</label>
                            <div class="layui-input-block" id="selectPalletNo">
                                <select id="PalletNo" lay-filter="getPalletNo" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png">
                            </div>
                        </div>
                        <div id="" class="layui-form-item layout-dropdownlist">
                            <label class="layui-form-label" lang>目标区域:</label>
                            <div class="layui-input-block" id="selectQuyu2">
                                <select id="Quyu2" lay-filter="getQuyu2" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png">
                            </div>
                        </div>
 
                        <table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
                            <tr>
                                <td style="width: 23%;"></td>
                                <td>
                                    <button class="layout-btn layout-btn-red" lang type="button" lay-submit
                                        lay-filter="formCall">叫小车</button>
                                </td>
                                <td style="width: 33%;"></td>
 
                            </tr>
                        </table>
 
                    </form>
                </div>
 
                <br>
 
                <div id="" class="cut-line">
                    <img src="/assets/fengexian.png">
                </div>
 
                <div class="layout-tbl-paging" id="">
                    <table id="tableBoxList1" class="tbl-box-list" border="" cellspacing="" cellpadding="">
                        <tr>
                            <th lang style="width: 15%;">物料编码</th>
                            <th lang style="width: 35%;">物料名称</th>
                            <th lang style="width: 25%;">批次</th>
                            <th lang style="width: 15%;">物料数量</th>
                        </tr>
                        <tr id="boxCell" style="display: none;">
                            <td name="code">AG000001</td>
                            <td name="name">疫苗名称名称名称</td>
                            <td name="lotNo">批次号</td>
                            <td name="num">30</td>
                        </tr>
                    </table>
                    <!-- 分页 -->
                    <table id="tableBoxPages1" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
                        <tr>
                            <td class="page-prev">上一页</td>
                            <td class="page-num page-num-select">1</td>
                            <td class="page-num">2</td>
                            <td class="page-num">3</td>
                            <td class="page-num">4</td>
                            <td class="page-num">5</td>
                            <td class="page-next">下一页</td>
                        </tr>
                    </table>
                </div>
 
            </div>
 
        </div>
    </div>
    <script src="/js/jquery-3.5.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <script src="/js/public.js"></script>
    <script src="/js/language.js"></script>
    <script src="/js/jquery.cookie.js"></script>
    <script>
        layui.use(['form', 'jquery'], function () {
            var form = layui.form
 
            /* 标签切换代码 */
 
            var xianshiyemian = 0;
 
            $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //选中后颜色
            $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //默认颜色
            $('#content2').hide();
            $(document).ready(function () {
                $('#option1').click(function () {
                    // qingkong();
                    xianshiyemian = 0;
                    $('#content1').show();
                    $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //选中后颜色
 
                    $('#content2').hide();
                    $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //默认颜色
                });
 
                $('#option2').click(function () {
                    // qingkong();
                    xianshiyemian = 1;
                    $('#content1').hide();
                    $('#option1').attr("style", "background-color: #999;width: 50%;float: left;text-align: center;"); //默认颜色
 
                    $('#content2').show();
                    $('#option2').attr("style", "background-color: red;width: 50%;float: right;text-align: center;"); //选中后颜色
 
                });
            });
 
            /*——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————*/
 
            initLanguage()
            setLanguage()
 
            function clear() {
                $("#Quyu").empty()
                $("#Quyu").append('<option value =>' + '</option>');
                $("#Ruku").empty()
                $("#Ruku").append('<option value =>' + '</option>');
                form.render('select');
                $('#STOCKCODE').val("");
                $('#LocatNo').val("");
            }
            //当前分页
            var curPageIndex = 1;
 
            // 托盘码文本改变时触发
            $("#STOCKCODE").on('input', function () {
                if ($("#STOCKCODE").val() == "" || $("#STOCKCODE").val().length < 8) {
                    return
                }
                if ($("#STOCKCODE").val().length >= 8) {
                    $("#STOCKCODE").val($("#STOCKCODE").val().substr(-8))
                }
                getPalletLocatNo()
            })
            //托盘码回车事件
            $("#STOCKCODE").keydown(function (e) {
                if (e.keyCode === 13) {
                    if ($("#STOCKCODE").val() == "") {
                        layer.msg('请先扫描托盘条码', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return
                    }
                    getPalletLocatNo()
                }
            });
 
            function getPalletLocatNo() {
                if (xianshiyemian == 0) {
                    var param = {
                        "PalletNo": $("#STOCKCODE").val()
                    }
                    sendData(IP + "/PdaCr/GetPalletLocatNo", param, 'get', function (res) {
                        if (res.code == 0) {
                            $("#LocatNo").val(res.data)
                            refreshTable()
                        } else {
                            $("#LocatNo").val('')
                            //先清空一下箱子列表
                            let trs = $("#tableBoxList tr")
                            let len = trs.length
 
                            for (i = len - 1; i >= 2; i--) {
                                trs[i].remove();
                            }
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () { });
                        }
                    });
                }
                else if (xianshiyemian == 1) {
 
                }
 
            }
            //点击目标区域下拉框事件
            $("#selectQuyu").click(function () {
                if ($("#STOCKCODE").val() == "") {
                    layer.msg('请先扫描托盘条码', {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return
                }
                if ($("#LocatNo").val() == "") {
                    layer.msg('请扫描正确的托盘条码', {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return
                }
                var input = $('select[id="Quyu"]').next().find('.layui-select-title input')
                var val = input.val()
                //先更新一下目标区域
                updateQuyuList(function (data) {
                    $('select[id="Quyu"]').next().addClass('layui-form-selected')
                    $('select[id="Quyu"]').next().find('.layui-select-title input').val(val)
                })
            })
 
            /* 绑定目标区域信息 */
            function updateQuyuList(callback) {
                var input = $('select[id="Quyu"]').next().find('.layui-select-title input')
                var val = input.val()
                $("#Quyu").empty()
                $("#Quyu").append('<option value =>' + '</option>');
                form.render('select');
 
                var param = {
                    "PalletNo": $("#STOCKCODE").val()
                };
                sendData(IP + "/PdaCr/GetStorageArea", param, 'get', function (res) {
                    if (res.code == 0) { //成功
                        for (var i = 0; i < res.data.length; i++) {
                            $("#Quyu").append('<option value =' + res.data[i].AreaNo + '>' + res.data[i]
                                .AreaNo + '-' + res.data[i].AreaName +
                                '</option>');
                        }
                        form.render('select');
 
                        if (!val) {
                            $('#Quyu').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
                        } else {
                            var sel = 'dd[lay-value=' + val + ']';
                            $('#Quyu').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
                        }
 
                        callback(res.data)
                    } else { //不成功
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function () { });
                    }
                });
            }
 
            //点击出库单据下拉框事件
            $("#selectOutNo").click(function () {
                var input = $('select[id="OutNo"]').next().find('.layui-select-title input')
                var val = input.val()
                //先更新一下出库单
                updateBillList(function (data) {
                    $('select[id="OutNo"]').next().addClass('layui-form-selected')
                    $('select[id="OutNo"]').next().find('.layui-select-title input').val(val)
                })
            })
 
            /* 绑定出库单信息 */
            function updateBillList(callback) {
                var input = $('select[id="OutNo"]').next().find('.layui-select-title input')
                var val = input.val()
                $("#OutNo").empty()
                $("#OutNo").append('<option value =>' + '</option>');
                form.render('select');
 
                var param = {
 
                };
                sendData(IP + "/PdaCr/GetRunSoNoticeList", param, 'get', function (res) {
                    if (res.code == 0) { //成功
                        for (var i = 0; i < res.data.length; i++) {
                            $("#OutNo").append('<option value =' + res.data[i] + '>' + res.data[i] +
                                '</option>');
                        }
                        form.render('select');
 
                        if (!val) {
                            $('#OutNo').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
                        } else {
                            var sel = 'dd[lay-value=' + val + ']';
                            $('#OutNo').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
                        }
 
                        callback(res.data)
                    } else { //不成功
                        // layer.msg(res.msg, {
                        //     icon: 2,
                        //     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        // }, function() {});
                    }
                });
            }
            //选中出库单事件
            form.on('select(getOutNo)', function (data) {
                $("#PalletNo").empty()
                $("#PalletNo").append('<option value =>' + '</option>');
                form.render('select');
 
                $("#Quyu2").empty()
                $("#Quyu2").append('<option value =>' + '</option>');
                form.render('select');
 
                //refreshTable()
            });
 
            //点击托盘条码下拉框事件
            $("#selectPalletNo").click(function () {
                if ($("#OutNo").val() == "") {
                    layer.msg('请先选择出库单', {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return
                }
                var input = $('select[id="PalletNo"]').next().find('.layui-select-title input')
                var val = input.val()
 
                updatePalletNoList(function (data) {
                    $('select[id="PalletNo"]').next().addClass('layui-form-selected')
                    $('select[id="PalletNo"]').next().find('.layui-select-title input').val(val)
                })
            })
 
            /* 绑定出库单下托盘条码信息 */
            function updatePalletNoList(callback) {
                var input = $('select[id="PalletNo"]').next().find('.layui-select-title input')
                var val = input.val()
                $("#PalletNo").empty()
                $("#PalletNo").append('<option value =>' + '</option>');
                form.render('select');
 
                var param = {
                    soNo: $("#OutNo").val()
                };
                sendData(IP + "/PdaCr/GetPalletNoListBySoNo", param, 'get', function (res) {
                    if (res.code == 0) { //成功
                        for (var i = 0; i < res.data.length; i++) {
                            $("#PalletNo").append('<option value =' + res.data[i] + '>' + res.data[i] +
                                '</option>');
                        }
                        form.render('select');
 
                        if (!val) {
                            $('#PalletNo').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
                        } else {
                            var sel = 'dd[lay-value=' + val + ']';
                            $('#PalletNo').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
                        }
 
                        callback(res.data)
                    } else { //不成功
                        // layer.msg(res.msg, {
                        //     icon: 2,
                        //     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        // }, function() {});
                    }
                });
            }
 
            //选中托盘事件
            form.on('select(getPalletNo)', function (data) {
                refreshTable()
 
                $("#Quyu2").empty()
                $("#Quyu2").append('<option value =>' + '</option>');
                form.render('select');
            });
 
            //点击目标区域下拉框事件
            $("#selectQuyu2").click(function () {
                // if ($("#PalletNo").val() == "") {
                //     layer.msg('请先选择托盘条码', {
                //         icon: 2,
                //         time: 2000 //2秒关闭(如果不配置,默认是3秒)
                //     });
                //     return
                // }
                var input = $('select[id="Quyu2"]').next().find('.layui-select-title input')
                var val = input.val()
                //先更新一下目标区域
                updateQuyuList2(function (data) {
                    $('select[id="Quyu2"]').next().addClass('layui-form-selected')
                    $('select[id="Quyu2"]').next().find('.layui-select-title input').val(val)
                })
            })
 
            /* 绑定目标区域信息 */
            function updateQuyuList2(callback) {
                var input = $('select[id="Quyu2"]').next().find('.layui-select-title input')
                var val = input.val()
                $("#Quyu2").empty()
                $("#Quyu2").append('<option value =>' + '</option>');
                form.render('select');
 
                var param = {
                    "PalletNo": $("#PalletNo").val()
                };
                sendData(IP + "/PdaCr/GetStorageArea", param, 'get', function (res) {
                    if (res.code == 0) { //成功
                        for (var i = 0; i < res.data.length; i++) {
                            $("#Quyu2").append('<option value =' + res.data[i].AreaNo + '>' + res.data[i]
                                .AreaNo + '-' + res.data[i].AreaName +
                                '</option>');
                        }
                        form.render('select');
 
                        if (!val) {
                            $('#Quyu2').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
                        } else {
                            var sel = 'dd[lay-value=' + val + ']';
                            $('#Quyu2').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
                        }
 
                        callback(res.data)
                    } else { //不成功
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function () { });
                    }
                });
            }
 
            //呼叫小车事件
            form.on('submit(formCall)', function (data) {
                if (xianshiyemian == 0) {
                    if ($("#STOCKCODE").val() == "") {
                        layer.msg('请扫描托盘条码', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                    if ($("#LocatNo").val() == "") {
                        layer.msg('请扫描正确的托盘条码', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                    if ($("#Quyu").val() != "" && $("#Ruku").val() != "") {
                        layer.msg('目标区域和入库口不能同时选择', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                    var param = {
                        PalletNo: $("#STOCKCODE").val(),
                        AreaNo: $("#Quyu").val(),
                        Ruku: $("#Ruku").val()
                    }
                    //呼叫小车
                    sendData(IP + "/PdaCr/AgvTransport", param, 'post', function (res) {
                        if (res.code == 0) { //成功 
                            layer.msg(res.msg, {
                                icon: 1,
                                time: 1000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () {
                                clear()
 
                            });
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () {
                                clear()
                            });
                        }
                    });
                }
                else if (xianshiyemian == 1) {
                    if ($("#OutNo").val() == "") {
                        layer.msg('请选择出库单', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                    // if ($("#PalletNo").val() == "") {
                    //     layer.msg('请扫描托盘条码', {
                    //         icon: 2,
                    //         time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    //     });
                    //     return;
                    // }
                    if ($("#Quyu2").val() == "") {
                        layer.msg('请选择目标区域', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                    var param = {
                        SoNo: $("#OutNo").val(), //出库单据
                        PalletNo: $("#PalletNo").val(), //托盘条码
                        AreaNo: $("#Quyu2").val()//目标区域
                    }
                    //呼叫小车
                    sendData(IP + "/PdaCr/AgvTransport2", param, 'post', function (res) {
                        if (res.code == 0) { //成功 
                            layer.msg(res.msg, {
                                icon: 1,
                                time: 1000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () {
 
                            });
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () {
                                //回调
                            });
                        }
                    });
                }
 
                return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
            });
 
 
            // 渲染箱码信息
            function refreshTable() {
                if (xianshiyemian == 0) {
                    //先清空一下箱子列表
                    let trs = $("#tableBoxList tr")
                    let len = trs.length
 
                    for (i = len - 1; i >= 2; i--) {
                        trs[i].remove();
                    }
                    if ($("#STOCKCODE").val() == '') {
                        return;
                    }
 
                    var param = {
                        PalletNo: $("#STOCKCODE").val(),
                        IsHuiKu: 1
                    };
                    //  根据托盘号获取箱码信息
                    sendData(IP + "/PdaCr/GetSkuInfoByPalletNo", param, 'get', function (res) {
                        if (res.code == 0) { //成功
                            var list = res
                            var arrTrs = new Array()
                            let idx = 0
                            for (var i in res.data) {
                                var tr = $("#boxCell").eq(0).clone();
                                tr.appendTo("#tableBoxList");
                                tr.attr('id', res.data[i].Id)
                                tr.attr('boxno', res.data[i].BoxNo)
                                tr.attr('BindNo', res.data[i].BindNo)
                                idx++;
                                tr.attr('index', idx)
                                tr.find("td[name='code']").html(res.data[i].BoxNo);
                                tr.find("td[name='name']").html(res.data[i].SkuName);
                                tr.find("td[name='lotNo']").html(res.data[i].LotNo);
                                tr.find("td[name='num']").html(res.data[i].Qty);
                                tr.show();
                                arrTrs[i] = tr
                            }
 
 
                        } else { //不成功
                            layer.msg("无数据", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () { });
                            $("#boxNum").val(0)
                        }
                    });
                }
                else if (xianshiyemian == 1) {
                    //先清空一下箱子列表
                    let trs = $("#tableBoxList1 tr")
                    let len = trs.length
 
                    for (i = len - 1; i >= 2; i--) {
                        trs[i].remove();
                    }
                    if ($("#PalletNo").val() == '') {
                        return;
                    }
                    var param = {
                        PalletNo: $("#PalletNo").val()
                    };
                    //  根据托盘号获取箱码信息
                    sendData(IP + "/PdaCr/GetSkuInfoByPalletNo", param, 'get', function (res) {
                        if (res.code == 0) { //成功
                            var list = res
                            var arrTrs = new Array()
                            let idx = 0
                            for (var i in res.data) {
                                var tr = $("#boxCell").eq(0).clone();
                                tr.appendTo("#tableBoxList1");
                                tr.attr('id', res.data[i].Id)
                                tr.attr('boxno', res.data[i].BoxNo)
                                tr.attr('BindNo', res.data[i].BindNo)
                                idx++;
                                tr.attr('index', idx)
                                tr.find("td[name='code']").html(res.data[i].SkuNo);
                                tr.find("td[name='name']").html(res.data[i].SkuName);
                                tr.find("td[name='lotNo']").html(res.data[i].LotNo);
                                tr.find("td[name='num']").html(res.data[i].Qty);
                                tr.show();
                                arrTrs[i] = tr
                            }
 
                            //设置分页
                            setPages(1, list.length)
 
                        } else { //不成功
                            layer.msg("无数据", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () { });
                            $("#boxNum").val(0)
                            setPages(1, 0)
                        }
                    });
                }
 
            }
            /* 分页 */
            //设置分页
            function setPages(pageIndex, boxNum) {
 
                if (xianshiyemian == 0) {
                    if (boxNum <= 0) {
                        //列表为空,隐藏分页页码
                        $("#tableBoxPages").hide()
                        return
                    }
 
                    let pageNum = Math.floor(boxNum / 10);
                    if (boxNum % 10 > 0) {
                        pageNum += 1;
                    }
                    //console.log("pageNum is " + pageNum)
 
                    $("#tableBoxPages").find("tr").remove()
                    let table = $("#tableBoxPages")
                    $("<tr></tr>").appendTo("#tableBoxPages")
 
                    // let newTr = table.append("<tr></tr>")
                    // newTr.append("<td class='page-prev'>上一页</td>")
                    $("<td id='prevPage' class='page-prev'>上一页</td>").appendTo("#tableBoxPages tr")
                    $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function () {
                        onClickPrevPage()
                    })
                    for (i = 1; i < pageNum + 1; i++) {
                        // newTr.append("<td class='page-num'>"+ i +"</td>")
                        $("<td class='page-num'>" + i + "</td>").appendTo("#tableBoxPages tr")
                    }
                    // newTr.append("<td class='page-next'>下一页</td>")
                    $("<td id='nextPage' class='page-next'>下一页</td>").appendTo("#tableBoxPages tr")
                    $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function () {
                        onClickNextPage()
                    })
                    // pages.show()
                    $("#tableBoxPages").show()
 
                    setCurPage(1)
                }
                else if (xianshiyemian == 1) {
                    if (boxNum <= 0) {
                        //列表为空,隐藏分页页码
                        $("#tableBoxPages1").hide()
                        return
                    }
 
                    let pageNum = Math.floor(boxNum / 10);
                    if (boxNum % 10 > 0) {
                        pageNum += 1;
                    }
                    //console.log("pageNum is " + pageNum)
 
                    $("#tableBoxPages1").find("tr").remove()
                    let table = $("#tableBoxPages1")
                    $("<tr></tr>").appendTo("#tableBoxPages1")
 
                    // let newTr = table.append("<tr></tr>")
                    // newTr.append("<td class='page-prev'>上一页</td>")
                    $("<td id='prevPage' class='page-prev'>上一页</td>").appendTo("#tableBoxPages1 tr")
                    $("#tableBoxPages1 tr").eq(0).find("td[id^='prevPage']").click(function () {
                        onClickPrevPage()
                    })
                    for (i = 1; i < pageNum + 1; i++) {
                        // newTr.append("<td class='page-num'>"+ i +"</td>")
                        $("<td class='page-num'>" + i + "</td>").appendTo("#tableBoxPages1 tr")
                    }
                    // newTr.append("<td class='page-next'>下一页</td>")
                    $("<td id='nextPage' class='page-next'>下一页</td>").appendTo("#tableBoxPages1 tr")
                    $("#tableBoxPages1 tr").eq(0).find("td[id^='nextPage']").click(function () {
                        onClickNextPage()
                    })
                    // pages.show()
                    $("#tableBoxPages1").show()
 
                    setCurPage(1)
                }
 
            }
 
            //设置当前分页
            function setCurPage(pageIndex) {
                if (xianshiyemian == 0) {
                    let totalTrNum = $("#tableBoxList tr").length
                    if (totalTrNum <= 2) {
                        //console.log("tableBoxList 为空 totalTrNum: " + totalTrNum)
                        //curPageIndex = 1
                        return
                    }
 
                    let pageNum = getBoxPageNum()
                    if (pageIndex > pageNum) {
                        //console.log("设置的页码超出页数, pageIndex : " + pageIndex)
                        //curPageIndex = 1
                        return
                    }
 
                    let startIndex = (pageIndex - 1) * 10 + 1
                    let n = totalTrNum - startIndex
                    let endIndex = 0
                    if (n > 9) {
                        endIndex = startIndex + 9
                    } else {
                        endIndex = startIndex + n
                    }
 
                    let trs = $("#tableBoxList tr")
                    //console.log("行数 "+trs.length)
                    let d = 0
                    for (let i = 2; i < trs.length; i++) {
                        //console.log("行索引 " + trs.eq(i).attr('index'))
                        let t = trs.eq(i)
                        d = t.attr('index')
                        if (d >= startIndex && d <= endIndex) {
                            //console.log("需要显示")
                            //显示行
                            t.show()
                        } else {
                            //隐藏行
                            t.hide()
                        }
                    }
 
                    curPageIndex = pageIndex
 
                    let ptr = $("#tableBoxPages tr")
                    for (let i = 1; i < pageNum + 1; i++) {
                        ptr.eq(0).find("td").eq(i).removeClass("page-num-select")
                        if (i == curPageIndex) {
                            ptr.eq(0).find("td").eq(i).addClass("page-num-select")
                        }
                    }
                }
                else if (xianshiyemian == 1) {
                    let totalTrNum = $("#tableBoxList1 tr").length
                    if (totalTrNum <= 2) {
                        return
                    }
 
                    let pageNum = getBoxPageNum()
                    if (pageIndex > pageNum) {
                        //console.log("设置的页码超出页数, pageIndex : " + pageIndex)
                        //curPageIndex = 1
                        return
                    }
 
                    let startIndex = (pageIndex - 1) * 10 + 1
                    let n = totalTrNum - startIndex
                    let endIndex = 0
                    if (n > 9) {
                        endIndex = startIndex + 9
                    } else {
                        endIndex = startIndex + n
                    }
 
                    let trs = $("#tableBoxList1 tr")
                    //console.log("行数 "+trs.length)
                    let d = 0
                    for (let i = 2; i < trs.length; i++) {
                        //console.log("行索引 " + trs.eq(i).attr('index'))
                        let t = trs.eq(i)
                        d = t.attr('index')
                        if (d >= startIndex && d <= endIndex) {
                            //console.log("需要显示")
                            //显示行
                            t.show()
                        } else {
                            //隐藏行
                            t.hide()
                        }
                    }
 
                    curPageIndex = pageIndex
 
                    let ptr = $("#tableBoxPages1 tr")
                    for (let i = 1; i < pageNum + 1; i++) {
                        ptr.eq(0).find("td").eq(i).removeClass("page-num-select")
                        if (i == curPageIndex) {
                            ptr.eq(0).find("td").eq(i).addClass("page-num-select")
                        }
                    }
                }
 
            }
 
            function getBoxPageNum() {
                if (xianshiyemian == 0) {
                    let num = $("#tableBoxList tr").length
                    if (num <= 2) {
                        return 0
                    }
 
                    let pageNum = Math.floor(num / 10);
                    if (num % 10 > 0) {
                        pageNum += 1;
                    }
 
                    return pageNum
                }
                else if (xianshiyemian == 1) {
                    let num = $("#tableBoxList1 tr").length
                    if (num <= 2) {
                        return 0
                    }
 
                    let pageNum = Math.floor(num / 10);
                    if (num % 10 > 0) {
                        pageNum += 1;
                    }
 
                    return pageNum
                }
 
            }
 
            function onClickPrevPage() {
                //console.log("上一页按钮被点击")
                if (curPageIndex == 1) {
                    return
                }
                setCurPage(curPageIndex - 1)
            }
 
            function onClickNextPage() {
                //console.log("下一页按钮被点击")
                let n = getBoxPageNum()
                if (curPageIndex == n) {
                    return
                }
                setCurPage(curPageIndex + 1)
            }
 
            /*——————————————————————————————————————————————————————————*/
 
 
            $("#menuImg").click(function (e) {
                //console.log("menuImg")
                e.stopPropagation()
 
                if ($("#menuList").is(":hidden")) {
                    $("#menuList").show()
                } else {
                    $("#menuList").hide()
                }
            })
            $('body').click(function () {
                // //console.log("body")
                $("#menuList").hide()
            })
        })
    </script>
</body>
 
</html>