bklLiudl
2024-05-25 484e5129e4c9a671c5660a556a24bd306f1fdd9b
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
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
        <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> -->
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Boxline PDA</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">
            .layout-bill-info {
                height: auto;
                /* background-color: #009E94; */
            }
            .layout-tbl-submit {
                margin-top: 10px;
            }
            /* .out-scatter-num {
                 background-color: #009688; 
                
            } */
            .out-scatter-num .local-input {
                width: 40%;
                height: 25px;
                float: left;
            }
            .out-scatter-num .local-ok button {
                height: 25px; 
                border: 0; 
                color: #FFFFFF; 
                background-color: #0a93e3;
                border-radius: 3px;
                padding: 2px;
                margin-left: 10px;
                width: 100%;
            }
            .out-scatter-num .layui-form-label {
                width: 30%;
                /* background-color: #007BFF; */
            }
            .out-scatter-num .layui-input-block {
                width: 100%;
                /* background-color: #009E94; */
                margin-left: 0;
            }
            .out-scatter-num .local-ok {
                width: 20%;
                height: 25px;
                float: left;
            }
            .btn-ok-blue {
                border: none; 
                color: #FFFFFF; 
                background-color: #0a93e3;
                width: 48%;
                height: 36px;
                border-radius: 5px;
            }
            .btn-ok-red {
                border: none; 
                color: #FFFFFF; 
                background-color: #9f1707;
                width: 48%;
                height: 36px;
                border-radius: 5px;
            }
            .btn-ok-blue:active {
                opacity: 0.8;
            }
            .btn-ok-red:active {
                opacity: 0.8;
            }
            .layout-tbl-paging {
                margin-top: 20px;
            }
            .foot-container {
                text-align: center;
            }
            .layout-tab-page {
                height: auto;
            }
            .layui-form-checkbox {
                margin: auto;
                /* padding-left: 2px; */
                /* padding-right: 2px; */
            }
            .div-tbl-title {
                width: 98%;
                margin: auto;
                /* background-color: #4476A7; */
                height: 30px;
            }
            .div-tbl-title table {
                width: 100%;
                height: 30px;
            }
            td{
                word-break: break-all; word-wrap:break-word;
            }
            #tabShow::-webit-scrollbar{
                display: none;
            }
            .isShow{
                display: block;
            }
            .isHide{
                display: none;
            }
        </style>
        <link rel="stylesheet" href="/css/adapter.css" />
    </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">创建出库单</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">主页</a></li>
                        <li><a href="../login.html">重新登录</a></li>
                    </ul>
                </div>
                
                <div id="" class="layout-bill-info">
                    <form class="layui-form" action="" style="height: auto;">
                        
                        <div id="layout-wavebill" class="layui-form-item layout-dropdownlist" >
                            <label class="layui-form-label">单据类型:</label>
                            <div class="layui-input-block" id="selectWaveDiv">
                                <select id="billType" lay-filter="billType" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png" >
                            </div>
                        </div>
                        <div id="layoutPickArea" class="layui-form-item layout-dropdownlist" >
                            <label class="layui-form-label">拣货区:</label>
                            <div class="layui-input-block" id="selectDiv">
                                <select id="pickArea" lay-filter="pickArea" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png" >
                            </div>
                        </div>
                        <div id="layoutCarrier" class="layui-form-item layout-dropdownlist isHide" >
                            <label class="layui-form-label">承运商:</label>
                            <div class="layui-input-block" id="selectDiv">
                                <select id="carrier" lay-filter="carrier" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png" >
                            </div>
                        </div>
                        <div class="layui-form-item layout-dropdownlist" style="margin-top: 10px;">
                            <label class="layui-form-label">物料名称:</label>
                            <div class="layui-input-block" id="goods">
                                <select id="goodSelect" lay-filter="goodSelect" lay-search>
                                    <option value=""></option>
                                </select>
                                <img src="/assets/down_arraw.png" >
                            </div>
                        </div>
                        <div id="" class="layout-tab-page">
                            
                            
                            <div class="layui-form-item layout-dropdownlist" style="margin-top: 10px;">
                                <label class="layui-form-label">物料批次:</label>
                                <div class="layui-input-block" id="lotno">
                                    <select id="lotNoSelect" lay-filter="lotNoSelect" lay-search>
                                        <option value=""></option>
                                    </select>
                                    <img src="/assets/down_arraw.png" >
                                </div>
                            </div>
                            <div id="layout-pallet" class="layui-form-item layout-input">
                                <label class="layui-form-label">库存数量:</label>
                                <div class="layui-input-block">
                                    <input id="exitDesc"  style="border: none;" type="text" lay-verify="stock" disabled placeholder=""
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <table id="outHalf" class="layout-tab-content" border="" cellspacing="" cellpadding="">
                                
                                <tr id="outScatter">
                                    <td>
                                        <div id="layout-boxcode" class="layui-form-item out-scatter-num">
                                            <label class="layui-form-label" style="width: 21%;">出库数量:</label>
                                            <div id="" class="local-input" >
                                                <div class="layui-input-block" >
                                                    <input id="ExQty" type="number" placeholder="请输入出库数量"
                                                        autocomplete="off" class="layui-input" style="padding-left:0.1rem;" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
                                                </div>
                                            </div>
                                            <div id="" class="local-ok" >
                                                <button type="button" lay-submit lay-filter="formPickScatter">确认</button>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <div id="" style="text-align: right;margin-top: 10px;">
                                <div id="" class="cut-line" >
                                    <img src="/assets/fengexian.png" >
                                </div>
                            </div>
                        </div>
                        
                    </form>
                </div>
                
                <div class="layout-tbl-paging" id="tabShow" style="overflow-y:auto;overflow-x:hidden; " >
                    
                    <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
                        <tr id="tableHead">
                             
                            <th style="width: 21%;">编码</th>
                            <th style="width: 32%;">名称</th>
                            <th style="width: 22%;">批次</th>
                            <th name="hpicknum" style="width: 15%;">数量</th>
                            <th lang style="width: 10%;">操作</th>
                        </tr>
                        <tr class="boxCell" style="display: none;">
                            <td name="goodCode">AG00000asdfdsaf1</td>
                            <td name="goodName">疫苗名称名称</td>
                            <td name="lotNo">30</td>
                            <td name="qty">30</td>
                            <td name="del">
                                <div id="" class="tbl-btn-del" lang>
                                    删除
                                </div>
                            </td>
                        </tr>
                    </table>
                    <!-- 按钮提交 -->
                    <div style="width:100%; text-align: center; margin-top: 5px;">
                        <button class="layout-btn layout-btn-red" lang type="button" lay-submit lay-filter="formBind"
                                style="width: 50%; ">提交</button>
                    </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/jquery.cookie.js"></script>
        <script>
            layui.use(['form', 'jquery'], function() {
                var form = layui.form
                
                var tableData =  new Array();
                var canPickBox = true
                var PickingAreaData = null;//拣货区集合          
                
                if (!$.cookie('token')) {
                    layer.msg('登陆失效,请重新登陆', {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    }, function() {
                        location.href = "/View/login.html";
                        //回调
                    });
                }
                Init();
                function clear(){
                    $("#lotNoSelect").empty()
                    $("#lotNoSelect").append('<option value =>' + '</option>');
                
                    form.render('select');
                    $('#exitDesc').val("");
                    $("#ExQty").val("");
                }
                
                //下拉单据选中后事件
                form.on('select(billType)', function(data) {
                    // console.log(data);
                    // console.log(PickingAreaData);
                    if (data.value == "101") { //销售出库
                        $("#pickArea").empty()
                        $("#pickArea").append('<option value =>' + '</option>');
                        form.render('select');
                        console.log($("#pickArea"));
                        for (var i = 0; i < PickingAreaData.length; i++) {
                            if (PickingAreaData[i].Code =="02") {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code  + ' selected>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } else {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code + '>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } 
                        }
                        $("#layoutCarrier").removeClass("isHide"); 
                        $("#layoutCarrier").addClass("isShow"); 
                        form.render('select'); 
                    }else if(data.value == "103"){//不合格出库
                        $("#pickArea").empty()
                        $("#pickArea").append('<option value =>' + '</option>');
                        form.render('select');
                        for (var i = 0; i < PickingAreaData.length; i++) {
                            if (PickingAreaData[i].Code =="03") {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code  + ' selected>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } else {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code + '>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } 
                        }
                        $("#layoutCarrier").removeClass("isShow"); 
                        $("#layoutCarrier").addClass("isHide"); 
                        form.render('select'); 
                    }else if(data.value == "104"){//取样出库
                        $("#pickArea").empty()
                        $("#pickArea").append('<option value =>' + '</option>');
                        form.render('select');
                        for (var i = 0; i < PickingAreaData.length; i++) {
                            if (PickingAreaData[i].Code =="03") {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code  + ' selected>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } else {
                                $("#pickArea").append('<option value =' + PickingAreaData[i].Code + '>'
                                     + PickingAreaData[i].TypeName +'</option>');
                            } 
                        }
                        $("#layoutCarrier").removeClass("isShow"); 
                        $("#layoutCarrier").addClass("isHide"); 
                        form.render('select'); 
                    }else{
                        $("#pickArea").empty()
                        $("#pickArea").append('<option value =>' + '</option>');
                        form.render('select');
                        for (var i = 0; i < PickingAreaData.length; i++) {
                            $("#pickArea").append('<option value =' + PickingAreaData[i].Code + '>'
                                + PickingAreaData[i].TypeName +'</option>');
                        }
                        $("#layoutCarrier").removeClass("isShow"); 
                        $("#layoutCarrier").addClass("isHide"); 
                        form.render('select'); 
                    }
                    if (data.value =="") {
                        $("#goodSelect").empty()
                        $("#goodSelect").append('<option value =>' + '</option>');
                        form.render('select');
                    }else{
                        InitGoodList();
                    }
                    $("#lotNoSelect").empty()
                    $("#lotNoSelect").append('<option value =>' + '</option>');
                    form.render('select');
                    $('#exitDesc').val("");
                }); 
                //下拉物料选中后事件
                form.on('select(goodSelect)', function(data) {
                    if (data.value =="") {
                        $("#lotNoSelect").empty()
                        $("#lotNoSelect").append('<option value =>' + '</option>');
                    
                        form.render('select');
                        $('#exitDesc').val("");
                    }else{
                        InitLotNoList();
                    }
                })
                //下拉批次选中后事件
                form.on('select(lotNoSelect)', function(data) {
                    if (data.value =="") {
                        $('#exitDesc').val("");
                    }else{
                        getBar();
                    }
                })
                //点击物料下拉框事件
                $("#goods").click(function(data) {
                    if ($("#billType").val() == "") {
                        layer.msg("请先选择单据类型", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {});
                    } 
                }); 
                //点击批次下拉框事件
                $("#lotno").click(function(data) {
                    if ($("#goodSelect").val() == "") {
                        layer.msg("请先选择物料", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {});
                    } 
                }); 
                function Init() {
                    InitBillTypeList();
                    InitPickAreaList();
                    InitCarrierList();
                }
                //初始化渲染 出库单据类型
                function InitBillTypeList(){ 
                    $("#billType").empty()
                    $("#billType").append('<option value =>' + '</option>');
                    form.render('select');
                    var param = {
                        type:"出"
                    };
                    synData(IP + "/PdaInterface/GetImExBillType", param, 'post', function(res) {
                        if (res.code == 1) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                
                                $("#billType").append('<option value =' + res.data[i].BillTypeCode + '>'
                                     + res.data[i].BillTypeName+'</option>');
                                
                            } 
                            form.render('select');
                            
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                        }
                    });
                }
 
                //初始化渲染 拣货区
                function InitPickAreaList(){ 
                    $("#pickArea").empty()
                    $("#pickArea").append('<option value =>' + '</option>');
                    form.render('select');
                    var param = {};
                    synData(IP + "/PdaInterface/GetPickArea", param, 'post', function(res) {
                        if (res.code == 1) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                $("#pickArea").append('<option value =' + res.data[i].Code + '>'
                                    + res.data[i].TypeName+'</option>');
                            } 
                            PickingAreaData = res.data;
                            form.render('select'); 
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                        }
                    });
                }
 
                //初始化渲染 承运商
                function InitCarrierList(){
 
                    $("#carrier").empty()
                    $("#carrier").append('<option value =>' + '</option>');
                    form.render('select');
                    
                    var param = {};
                    synData(IP + "/PdaInterface/GetCarrier", param, 'post', function(res) {
                        
                        if (res.code == 1) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                 
                                $("#carrier").append('<option value =' + res.data[i].CarrierCode + '>'
                                     + res.data[i].CarrierName + '</option>');
                            }
                            form.render('select');
                            
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                        }
                    });
                }
                
                //初始化渲染物料
                function InitGoodList(){ 
                    
                    $("#goodSelect").empty()
                    $("#goodSelect").append('<option value =>' + '</option>');
                    form.render('select');
                    
                    var param = {
                        billType: $("#billType").val(),
                    };
                    sendData(IP + "/PdaInterface/StockGoodList", param, 'post', function(res) {
                         
                        if (res.code == 1) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                $("#goodSelect").append('<option value =' + res.data[i].StockGoodsCode + '>'
                                     + res.data[i].StockGoodsName +'</option>');
                            }
                            form.render('select');
                            
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                }
 
                //初始化渲染批次
                function InitLotNoList(){
                    $("#lotNoSelect").empty()
                    $("#lotNoSelect").append('<option value =>' + '</option>');
                    form.render('select');
                    
                    var param = {
                        billType: $("#billType").val(),
                        goodCode: $("#goodSelect").val(),
                    };
                    sendData(IP + "/PdaInterface/StockLotNoList", param, 'post', function(res) {
                        console.log("出库口:"+JSON.stringify(res))
                        if (res.code == 1) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                $("#lotNoSelect").append('<option value =' + res.data[i] + '>'
                                     + res.data[i] +'</option>');
                            }
                            form.render('select');
                            
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                }
 
                // 获取库存数量
                function getBar() {
                    $('#exitDesc').val("");
                    
                    var param = {
                        billType: $("#billType").val(),
                        goodCode: $("#goodSelect").val(),
                        lotNo: $("#lotNoSelect").val(),
                    }
                    sendData(IP + "/PdaInterface/StockQty", param, 'post', function(res) {
                         
                        if (res.code == 1) { //成功
                            let data = res.data;
                            $('#exitDesc').val(data);
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                    
                }
                
                //渲染表格数据                
                function refreshTable(list) {
                    //先清空一下信息列表
                    let trs = $("#tableBoxList tr")
                    let len = trs.length
                    //console.log("tr 数量 + " + trs.length)
                    for(i=len - 1; i >=2; i--){
                        trs[i].remove();
                    }
                     
                    console.log(list != null);
                    console.log(list );
                    if (list != null && list.length > 0) { //成功
                         
                        var arrTrs = new Array()
                        let idx = 0
                        for(var i in list) {
                            var tr = $(".boxCell").eq(0).clone();
                            tr.appendTo("#tableBoxList");
                            tr.attr('good', list[i].ExportGoodCode)
                            tr.attr('lotno', list[i].ExportLotNo)
                            
                            tr.attr('index', idx)
                            idx++;
                            tr.find("td[name='goodCode']").html(list[i].ExportGoodCode);
                            tr.find("td[name='goodName']").html(list[i].ExportGoodName);
                            tr.find("td[name='lotNo']").html(list[i].ExportLotNo);
                            tr.find("td[name='qty']").html(list[i].ExportQuantity);
                            tr.find("td[name='del']").click(function () {
                                
                                var elem = $(this).parent()
                                console.log(elem);
                                var num = elem.attr('index')
                                var goodcode = elem.attr('good')
                                var lotno = elem.attr('lotno')
                                console.log("删除箱子按钮被点击 " + goodcode+lotno)
                                layer.confirm("确定要从托盘上删除这个批次的物料吗?<br>" + goodcode, {
                                    icon: 2,
                                    time: 0, //2秒关闭(如果不配置,默认是3秒)
                                    btn: ['删除', '取消'],
                                    yes: function (index) {
                                        tableData.splice(num,1);
                                        // var s = 0;
                                        // tableData.forEach(d => {
                                        //     if ( tableData[s].ExportGoodCode == goodcode && tableData[s].ExportLotNo == lotno) {
                                        //         tableData.splice(s,1);
                                        //         if (s!=0) {
                                        //             s--;
                                        //         }
                                        //     }else{
                                        //         s++;
                                        //     }
                                        // });
                                        refreshTable(tableData); 
                                        parent.layer.close(index);//关闭当前页
                                    }
                                })
                            })
                            tr.show();
                            arrTrs[i] = tr
                        }
                        
                    }
                }
                
                //添加明细(确认按钮)
                form.on('submit(formPickScatter)', function(data) {
                    if (!$.cookie('userId')) {
                        layer.msg('登陆失效,请重新登陆', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            location.href = "login.html";
                            //回调
                        });
                    }
                    if($('#goodSelect').val() == ""){
                        layer.msg("请选择出库物料", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    if($('#lotNoSelect').val() == ""){
                        layer.msg("请输入批次号", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    if($('#ExQty').val() == ""){
                        layer.msg("请输入出库数量", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    console.log($('#ExQty').val());
                    console.log($('#exitDesc').val());
                    if( parseInt($('#ExQty').val()) > parseInt($('#exitDesc').val())){
                        layer.msg("出库数量请勿大于库存数量", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    var item = {
                        ExportGoodCode:$('#goodSelect').val(), 
                        ExportGoodName:$('#goodSelect option:selected').text(), 
                        ExportLotNo:$('#lotNoSelect').val(),
                        ExportQuantity:$('#ExQty').val()
                    };
                    var isHave = false;
                    tableData.forEach(d => {
                        if (d.ExportGoodCode == item.ExportGoodCode && d.ExportLotNo == item.ExportLotNo) {
                            isHave = true;
                        }
                    });
                    if (isHave == true) {
                        layer.msg("当前物料已有此批次,请核实", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return
                    }else{
                        
                        tableData.push(item);
                        refreshTable(tableData);
                        clear();
                        InitGoodList();
                    }
                    
                    
                    return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
                });
 
                //添加单据(提交按钮)后端交互
                form.on('submit(formBind)', function(data) {
                    if (!$.cookie('userId')) {
                        layer.msg('登陆失效,请重新登陆', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            location.href = "login.html";
                            //回调
                        });
                    }
                    
                    if($('#billType').val() == ""){
                        layer.msg("请选择出库单据类型", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    if(tableData.length == 0){
                        layer.msg("单据明细信息为空,请填写!", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function() {
                            //回调
                        });
                        return
                    }
                    if (canPickBox == true) {
                        canPickBox = false; 
                        var param = {
                            ExportBillType:$("#billType").val(),
                            CarrierCode:$("#carrier").val(),
                            PickArea:$("#pickArea").val(),
                            UserId:$.cookie('userId'),
                            Detail:tableData
                        };
                        sendData(IP + "/PdaInterface/AddExportBill", param, 'post', function(res) {
                            console.log("出库:"+JSON.stringify(res))
                            if (res.code == 1) { //成功
                                layer.msg(res.msg, {
                                    icon: 1,
                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {
                                    clear();
                                    Init();
                                    tableData= new Array();
                                    refreshTable(tableData);
                                    canPickBox = true;
                                });
                            } else { //不成功
                                layer.msg(res.msg, {
                                    icon: 2,
                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                }, function() {canPickBox = true;});
                            }
                        });
                    }else{
                        layer.msg("请求未完成,不要重复请求", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                    }                    
                    return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
                });
 
 
                //------------------------------------------------------------------------------------------------------------------
                //主页及重新登录
                $("#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>