chengsc
2025-03-10 d7fe0f4c66b134fca43bca44b1161c0e4aa28bcb
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
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="utf-8">
    <title>入库单据</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
 
    <style type="text/css">
        .layui-table-view .layui-table[lay-size=sm] .layui-table-cell {
            height: auto;
            line-height: 23px;
        }
 
        .layui-table-tool-panel {
            top: auto;
            bottom: 29px;
        }
 
        .layui-table-tool {
            padding-left: 5px;
        }
 
        /* 表格下拉小箭头隐藏 */
        .layui-table-grid-down {
            display: none;
        }
    </style>
    <script>
        // 这里是需要在页面渲染之前执行的代码
        document.addEventListener("DOMContentLoaded", function () {
            //获取table默认显示数
            pageCntFirst();
            console.log(pageCnt)
            //判断是否开启table列表列宽调整功能。
            GetIsSetColW();
        });
    </script>
</head>
 
<body id="body">
    <div class="layui-fluid" style="padding-bottom: 0;">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto" id="top">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">入库单号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="ASNNo" name="ASNNo" placeholder="入库单号" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">执行状态</label>
                        <div class="layui-input-inline">
                            <select name="Status" id="Status" lay-filter="Status" lay-search>
                                <option value=""></option>
                                <option value="0">等待执行</option>
                                <option value="1">正在执行</option>
                                <option value="2">执行完成</option>
                                <option value="3">订单关闭</option>
                                <option value="4">上传完毕</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">批次号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="LotNo" name="LotNo" placeholder="批次号" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">物料编码</label>
                        <div class="layui-input-inline">
                            <input type="text" id="SkuNo" name="SkuNo" placeholder="物料编码" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">物料名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="SkuName" name="SkuName" placeholder="物料名称" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">单据类型</label>
                        <div class="layui-input-inline">
                            <select name="Type" id="Type" lay-filter="Type" lay-search>
                                <option value=""></option>
                                <!--JC34-->
                                <option value="0">成品入库</option>
                                <option value="1">采购入库</option> 
                                <option value="3">退货入库</option>
                                <option value="4">余料退回入库</option>
                                <option value="8">生产退料入库</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">下发单号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="OrderCode" name="OrderCode" placeholder="上游系统下发的单号"
                                autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">客户名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="CustomerName" name="CustomerName" placeholder="客户名称"
                                autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">开始日期</label>
                        <div class="layui-input-inline">
                            <input type="text" autocomplete="off" name="StartTime" id="StartTime" class="layui-input"
                                placeholder="开始日期">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">结束日期</label>
                        <div class="layui-input-inline">
                            <input type="text" autocomplete="off" name="EndTime" id="EndTime" class="layui-input"
                                placeholder="结束日期">
                        </div>
                    </div>
                    <div class="layui-inline" id="divReason" style="display: none; padding-top: 10px;">
                        <label class="layui-form-label">撤销原因</label>
                        <div class="layui-input-inline">
                            <textarea id="Reason" name="Reason" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
 
                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
                            lay-filter="LAY-app-contlist-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
                        </button>
                    </div>
 
                    <!-- 维护备注弹框 -->
                    <div class="layui-inline" id="divEditDemo" style="display: none; padding-top: 10px;">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline" style="width: 300px;height: 100%;">
                            <textarea placeholder="请输入内容" id="NoticeDemo" name="NoticeDemo"
                                class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
 
            <div id="center">
            </div>
 
            <div class="layui-card-body">
                <div class="position-relative"><!-- class="position-relative" --><!-- 自定义表头加上 -->
                    <table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
                    <!-- #region 自定义表头 -->
                    <div class="headerSetIcon">
                        <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols">
                            <i class="layui-icon">&#xe610;</i>
                        </button>
                    </div>
                    <!-- #endregion -->
 
                    <!-- <a class="layui-btn layui-btn-danger layui-btn-xs cheXiaoClass" lay-event="chexiao"> <i class="layui-icon layui-icon-delete"></i>撤销</a> -->
                    <script type="text/html" id="toolbarDemo1">
                        {{# function GetBtn1(d){
                            var html = ''; 
                            if (d.Status == '0' && (d.Origin == '录入' || d.Origin == '采购单')) {
                                html += `<a class="layui-btn layui-btn-normal layui-btn-xs editClass" lay-event="edit">
                                    <i class="layui-icon layui-icon-edit"></i>编辑</a>`;
                            }
                            switch (d.Status) {
                                case "0" :
                                    html += `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del">
                                            <i class="layui-icon layui-icon-delete"></i>删除</a>`;
                                    break; 
                                case "1" : 
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs">  <i class="layui-icon layui-icon-ok"></i>关单</a>`; 
                                    break;
                                case "2" : 
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs">  <i class="layui-icon layui-icon-ok"></i>关单</a>`; 
                                    break;
                                case "3" : 
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs checkClass" lay-event="check">  <i class="layui-icon layui-icon-ok"></i>复核</a>`; 
                                    break;
                                default : 
                                break; 
                            }
                            html += `<a class="layui-btn layui-btn-normal layui-btn-xs editDemoClass" lay-event="editDemo">
                                <i class="layui-icon layui-icon-edit"></i>备注</a>`;
                            return html;
                        } 
                    }}
                    {{ GetBtn1(d) }}
                    </script>
 
                    <!-- #region 自定义表头 -->
                    <script type="text/html" id="buttonTpl">
                        {{# function GetBtn3(d){
                                var html = ``;
                                switch(d.Status)
                                {
                                    case "0" : html = `<button class="layui-btn layui-btn-radius layui-btn-xs">等待执行</button>`;break; 
                                    case "1" : html = `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">正在执行</button>`; break; 
                                    case "2" : html = `<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">执行完毕</button>`; break;
                                    case "3" : html = `<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">订单关闭</button>`; break;
                                    case "4" : html = `<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">上传完毕</button>`; break;
                                    default : break; 
                                }
 
                                return html;
                            }    
                        }}
                        {{ GetBtn3(d) }}
                    </script>
 
                    <script type="text/html" id="templetType">
                        {{# function GetBtn4(d){
                                var html = ``;
                                switch(d.Type)
                                {
                                    case "0" : html = `成品入库`;break; 
                                    case "1" : html = `采购入库`; break; 
                                    case "2" : html = `中间品入库`; break;
                                    case "3" : html = `退货入库`; break;
                                    case "4" : html = `余料退回入库`; break;
                                    case "8" : html = `生产退料入库`; break;
                                    default : break; 
                                }
                                
                                return html;
                            }    
                        }}
                        {{ GetBtn4(d) }}
                    </script>
 
                    <script type="text/html" id="templetCompleteTime">
                        {{# function GetBtn5(d){
                                return formatDate2(d.CompleteTime);
                            }    
                        }}
                        {{ GetBtn5(d) }}
                    </script>
 
                    <script type="text/html" id="templetCreateTime">
                        {{# function GetBtn6(d){
                                return formatDate(d.CreateTime);
                            }    
                        }}
                        {{ GetBtn6(d) }}
                    </script>
 
                    <script type="text/html" id="templetUpdateTime">
                        {{# function GetBtn7(d){
                                return formatDate(d.UpdateTime);
                            }    
                        }}
                        {{ GetBtn7(d) }}
                    </script>
 
                    <script type="text/html" id="templetCheckTime">
                        {{# function GetBtn11(d){
                                return formatDate(d.CheckTime);
                            }    
                        }}
                        {{ GetBtn11(d) }}
                    </script>
                    <!-- #endregion -->
                </div>
                <div class="position-relative"><!-- class="position-relative" --><!-- 自定义表头加上 -->
                    <table id="LAY-app-content-list2" lay-filter="LAY-app-content-list2"></table>
                    <!--#region 自定义表头 -->
                    <div class="headerSetIcon">
                        <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols2">
                            <i class="layui-icon">&#xe610;</i>
                        </button>
                    </div>
                    <!-- #endregion -->
 
                    <script type="text/html" id="toolbarDemo">
                        <button style="margin-right: 5px;" class="layui-btn layui-btn-sm layuiadmin-btn-list addClass" lay-event="add" >
                            <i class="layui-icon">&#xe654;</i>添加
                        </button>
                    </script>
                    
                    <script type="text/html" id="toolbarDemoList">
                        {{# function GetBtn2(d){ 
                            console.log(d);
                                var html = ``;
                                if(d.Status == "0"){ 
                                    html = `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"> 
                                        <i class="layui-icon layui-icon-delete"></i>删除</a>`; 
                                    
                                }
                                if((d.AsnType =="1" || d.AsnType == "4") && d.IsPasteCode == "1" && (d.Status == "0" || d.Status == "1")){  
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs addLabelClass" lay-event="Addlabel"> 
                                        <i class="layui-icon layui-icon-edit"></i>生成标签</a>`; 
                                } 
                                
                                return html;
                            } 
                        }}
                        {{ GetBtn2(d) }}
                    </script>
 
                    <!-- #region 自定义表头-->
                    <script type="text/html" id="templetCompleteTime2">
                        {{# function GetBtn8(d){
                                return formatDate(d.CompleteTime);
                            }    
                        }}
                        {{ GetBtn8(d) }}
                    </script>
 
                    <script type="text/html" id="templetCreateTime2">
                        {{# function GetBtn9(d){
                                return formatDate(d.CreateTime);
                            }    
                        }}
                        {{ GetBtn9(d) }}
                    </script>
 
                    <script type="text/html" id="templetUpdateTime3">
                        {{# function GetBtn10(d){
                                return formatDate(d.UpdateTime);
                            }    
                        }}
                        {{ GetBtn10(d) }}
                    </script>
 
                    <script type="text/html" id="templetUDF5">
                        {{# function GetBtn11(d){
                                var html = ``;
                                if(d.UDF5=='1'){ 
                                    html = `值1`; 
                                } else if(d.UDF5=='2') { 
                                    html = `值2`; 
                                } else if(d.UDF5=='3') { 
                                    html = `值3`; 
                                }
                                return html;
                            }    
                        }}
                        {{ GetBtn11(d) }}
                    </script>
                    <script type="text/html" id="templetIsSampling">
                        {{# function GetBtn12(d){
                                var html = ``;
                                console.log(d);
                                if(d.IsSampling=='0'){ 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-xs">未取样</button>`; 
                                } else if(d.IsSampling=='1') { 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">已取样</button>`; 
                                }
                                return html;
                            }    
                        }}
                        {{ GetBtn12(d) }}
                    </script>
                    <script type="text/html" id="templetInspectStatus">
                        {{# function GetBtn13(d){
                                var html = ``;
                                if(d.InspectStatus=='0'){ 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">待检验</button>`; 
                                } else if(d.InspectStatus=='1') { 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-xs">检验合格</button>`; 
                                } else if(d.InspectStatus=='2') { 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">不合格</button>`; 
                                } else if(d.InspectStatus=='4') { 
                                    html = `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">放置期</button>`; 
                                }
                                
                                return html;
                            }    
                        }}
                        {{ GetBtn13(d) }}
                    </script>
                    <!-- #endregion -->
 
                </div>
            </div>
        </div>
    </div>
 
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../js/jquery-3.5.1.min.js"></script>
    <script src="../../js/jquery.cookie.js"></script>
    <script src="../../js/public.js"></script>
 
    <script>
        var uid = $.cookie('userId');
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'table', 'laypage', 'layer', 'laydate'], function () {
 
            var doing = true;
 
            var table = layui.table,
                form = layui.form,
                laypage = layui.laypage,
                layer = layui.layer;
 
            laydate = layui.laydate;
 
            laydate.render({
                elem: '#StartTime'
                , format: 'yyyy-MM-dd', //可任意组合
            });
            laydate.render({
                elem: '#EndTime'
                , format: 'yyyy-MM-dd' //可任意组合
            });
 
            var h1 = GetTableTopHeight();
            var h2 = GetTableBottomHeight();
 
 
            refreshTable();
            refreshTablemx("单号");
            //渲染总单    
            //#region 自定义表头
            var TotalColsArr = [[
                { field: '', title: '序号', type: 'numbers', width: 50, align: 'center', fixed: 'left', "disabled": true },
                { field: 'ASNNo', title: '入库单号', align: 'center', fixed: 'left', sort: true, width: 180, "disabled": true },
                { field: 'Status', title: '执行状态', align: 'center', templet: '#buttonTpl' },
                { field: 'Origin', title: '来源', align: 'center', width: 80 },
                { field: 'CustomerName', title: '客户名称', align: 'center' },
                { field: 'Type', title: '单据类型', align: 'center', templet: '#templetType' },
                { field: 'OrderCode', title: '下发单号', align: 'center', width: 180 },
                { field: 'CompleteTime', title: '完成时间', align: 'center', templet: '#templetCompleteTime' },
                { field: 'Demo', title: '备注', align: 'center', width: 180 },
                { field: 'UserName', title: '制单人', align: 'center', width: 110 },
                { field: 'CreateUserName', title: '创建人', align: 'center', width: 110 },
                { field: 'CreateTime', title: '创建时间', align: 'center', templet: '#templetCreateTime' },
                { field: 'UpdateUserName', title: '修改人', align: 'center', width: 110 },
                { field: 'UpdateTime', title: '修改时间', align: 'center', templet: '#templetUpdateTime' },
                { field: 'CheckUserName', title: '复核人', align: 'center', width: 110 },
                { field: 'CheckTime', title: '复核时间', align: 'center', templet: '#templetCheckTime' },
                { field: 'caozuo', title: '操作', fixed: 'right', width: 280, align: 'center', toolbar: '#toolbarDemo1', "disabled": true }
            ]];
            var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
            //#endregion
            function refreshTable() {
 
                //#region 自定义表头
                var colsJson
                var param1 = {
                    Href: 'BllAsn/GetArrivalNoticeList'
                };
                sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) {
                    if (res.code == 0) {
                        if (res.data == '' || res.data == undefined || res.data == null) {
                            colsJson = TotalColsArr
                        } else {
                            colsJson = eval(res.data);
                        }
                    } else {
                        colsJson = TotalColsArr
                    }
                    var param = {
                        ASNNo: $("#ASNNo").val(),
                        Type: $("#Type").val(),
                        Status: $("#Status").val(),
                        OrderCode: $("#OrderCode").val(),
                        CustomerName: $("#CustomerName").val(),
                        LotNo: $("#LotNo").val(),
                        SkuNo: $("#SkuNo").val(),
                        SkuName: $("#SkuName").val(),
                        StartTime: $("#StartTime").val(),
                        EndTime: $("#EndTime").val()
                    };
                    table.render({
                        elem: '#LAY-app-content-list',
                        url: IP + "/BllAsn/GetArrivalNoticeList",
                        method: 'POST',
                        height: h1,
                        id: 'LAY-app-content-list',
                        where: param,
                        contentType: 'application/json',
                        headers: { ToKen: $.cookie('token') },
                        page: true,
                        even: true,
                        limit: pageCnt,
                        limits: pageLimits,
                        cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                        done: function (res) {
                            console.log(res);
                            setRight();
                            //自定义列宽
                            SetTableColW('LAY-app-content-list', 'BllAsn/GetArrivalNoticeList', TotalColsSysArr);
                        },
                        cols: colsJson
                    });
                });
                //#endregion
            }
 
            // 入库单table单机事件
            table.on('row(LAY-app-content-list)', function (obj) {
                refreshTablemx(obj.data.ASNNo);
            });
            //渲染明细
            //#region 自定义表头
            var DetailColsArr = [[
                { field: '', title: '序号', type: 'numbers', width: 50, align: 'center', fixed: 'left', "disabled": true },
                { field: 'ASNNo', title: '入库单号', align: 'center', fixed: 'left', sort: true, width: 180, "disabled": true },
                { field: 'SkuNo', title: '物料编码', align: 'center', width: 100 },
                { field: 'SkuName', title: '物料名称', align: 'center', width: 200 },
                { field: 'Standard', title: '物料规格', align: 'center', width: 130 },
                { field: 'LotNo', title: '批次号', align: 'center', width: 100 },
                { field: 'SupplierLot', title: '供货批次', align: 'center', width: 100 },
                { field: 'Qty', title: '数量', align: 'center', width: 70 },
                { field: 'FactQty', title: '已组数量', align: 'center', width: 90 },
                { field: 'CompleteQty', title: '完成数量', align: 'center', width: 90 },
                { field: 'CompleteTime', title: '完成时间', align: 'center', width: 160, templet: '#templetCompleteTime2' },
                { field: 'IsSampling', title: '是否取样', align: 'center', width: 90, templet: '#templetIsSampling' },
                { field: 'InspectStatus', title: '质检状态', align: 'center', width: 90, templet: '#templetInspectStatus' },
                { field: 'UnitName', title: '计量单位', align: 'center', width: 90 },
                // {field: 'Price',title: '单价',align: 'center',width: 65},
                // {field: 'Money',title: '金额',align: 'center',width: 65},
                { field: 'LotText', title: '批次描述', align: 'center', width: 120 },
                { field: 'PackagName', title: '包装名称', align: 'center', width: 110, },
                { field: 'Lot1', title: '生产日期', align: 'center', width: 140 },
                { field: 'Lot2', title: '过期日期', align: 'center', width: 140 },
                // { field: 'IsBale', title: '是否裹包', align: 'center', width: 150 },
                // { field: 'IsBelt', title: '是否打带', align: 'center', width: 150 },
                // { field: 'UDF1', title: '自定义列1', align: 'center', width: 140 },
                // { field: 'UDF2', title: '自定义列2', align: 'center', width: 140 },
                // { field: 'UDF3', title: '自定义列3', align: 'center', width: 140 },
                // { field: 'UDF4', title: '自定义列4', align: 'center', width: 140 },
                // { field: 'UDF5', title: '自定义列5', align: 'center', width: 140, templet: '#templetUDF5' },
                { field: 'CreateUserName', title: '创建人', align: 'center', width: 100 },
                { field: 'CreateTime', title: '创建时间', align: 'center', width: 160, templet: '#templetCreateTime2' },
                { field: 'UpdateUserName', title: '修改人', align: 'center', width: 150, },
                { field: 'UpdateTime', title: '修改时间', align: 'center', width: 150, templet: '#templetUpdateTime3' },
                { field: 'caozuo', title: '操作', fixed: 'right', width: 170, align: 'left', toolbar: '#toolbarDemoList', "disabled": true }
            ]];
            var DetailColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//将表头数据进行url编码
            //#endregion
            function refreshTablemx(asnNo) {
 
                //#region 自定义表头
                var colsJson2
                var param1 = {
                    Href: 'BllAsn/GetArrivalNoticeDetailList'
                };
                sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) {
                    if (res.code == 0) {
                        if (res.data == '' || res.data == undefined || res.data == null) {
                            colsJson2 = DetailColsArr
                        } else {
                            colsJson2 = eval(res.data);
                        }
                    } else {
                        colsJson2 = DetailColsArr
                    }
                    var param = {
                        ASNNo: asnNo
                    };
                    table.render({
                        elem: '#LAY-app-content-list2',
                        url: IP + "/BllAsn/GetArrivalNoticeDetailList",
                        method: 'POST',
                        height: h2,
                        id: 'LAY-app-content-list2',
                        where: param,
                        contentType: 'application/json',
                        toolbar: '#toolbarDemo',
                        defaultToolbar: [], //'filter','print', 'exports'
                        headers: { ToKen: $.cookie('token') },
                        page: true,
                        limit: pageCnt,
                        limits: pageLimits,
                        cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                        done: function () {
                            setRight()
                            //自定义列宽
                            SetTableColW('LAY-app-content-list2', 'BllAsn/GetArrivalNoticeDetailList', DetailColsSysArr);
                        },
                        cols: colsJson2
                    });
                });
                //#endregion
            }
 
            function setRight() {
                $(function () {
                    $(".addClass").hide();
                    $(".editClass").hide();
                    $(".delClass").hide();
                    // $(".cheXiaoClass").hide(); 
                    $(".clossClass").hide();
                    $(".editDemoClass").hide();//备注
                    $(".checkClass").hide(); //复核
                    $(".addLabelClass").hide(); //生成标签
 
                });
                sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
                    if (res.code == 0) { //成功 
                        for (var k = 0; k < res.data.length; k++) {
                            if (res.data[k].MenuName == "添加入库单") {
                                $(function () {
                                    $(".addClass").show();
                                });
                            }
                            if (res.data[k].MenuName == "编辑入库单") {
                                $(function () {
                                    $(".editClass").show();
                                });
                            }
                            if (res.data[k].MenuName == "删除入库单") {
                                $(function () {
                                    $(".delClass").show();
                                });
                            }
                            // if (res.data[k].MenuName == "撤销入库单") {
                            //     $(function() {
                            //         $(".cheXiaoClass").show(); 
                            //     });
                            // }
                            if (res.data[k].MenuName == "关闭入库单") {
                                $(function () {
                                    $(".clossClass").show();
                                });
                            }
                            if (res.data[k].MenuName == "维护入库单备注") {
                                $(function () {
                                    $(".editDemoClass").show();
                                });
                            }
                            if (res.data[k].MenuName == "复核入库单") {
                                $(function () {
                                    $(".checkClass").show();
                                });
                            }
                            if (res.data[k].MenuName == "生成标签") {
                                $(function () {
                                    $(".addLabelClass").show();
                                });
                            }
                        }
                    } else { //不成功
                        layer.msg('获取权限信息失败', {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function () { });
                    }
                });
            }
 
            // 页面监控,点击查询加载入库总单
            form.on('submit(LAY-app-contlist-search)', function (data) {
                refreshTable();
                refreshTablemx("单号");
            });
 
            table.on('toolbar(LAY-app-content-list2)', function (obj) {
                if (obj.event == "add") {
                    layer.open({
                        type: 2,
                        title: '添加入库单据',
                        content: 'ArrivalNoticeDetail.html',
                        maxmin: true,
                        area: ['70%', '90%']
                    });
                }
            });
 
 
            var ImportId = 0;
            table.on('tool(LAY-app-content-list)', function (obj) {
                var data = obj.data;
                switch (obj.event) {
                    case "edit":
                        // 代码区域
                        var id = data.ASNNo;
                        layer.open({
                            type: 2,
                            title: '编辑入库单',
                            content: 'ArrivalNoticeDetail.html?id=' + id,
                            maxmin: true,
                            area: ['70%', '90%']
                        });
                        break;
                    case "del":
                        layer.confirm('确定删除此单据吗?', function (index) {
                            // 代码区域
                            var param = {
                                ASNNo: data.ASNNo,
                            };
                            sendData(IP + "/BllAsn/DelArrivalNotice", param, 'post', function (res) {
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
                                        icon: 1,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () {
                                        refreshTable();
                                        refreshTablemx("单号");
                                        doing = true
                                    });
                                } else { //不成功
                                    layer.msg(res.msg, {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () { doing = true });
                                }
                            });
                        });
                        break;
                    case "closs":
                        // 代码区域
                        layer.confirm('确定关闭此单据吗?', function (index) {
                            // 代码区域
                            var param = {
                                Id: data.Id,
                            };
                            sendData(IP + "/UpApi/CloseAsn", param, 'post', function (res) {
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
                                        icon: 1,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () {
                                        refreshTable();
                                        doing = true
                                    });
                                } else { //不成功
                                    layer.msg(res.msg, {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () { doing = true });
                                }
                            });
                        });
 
                        break;
                    case "check":
                        // 代码区域
                        layer.confirm('确定复核此单据吗?', function (index) {
                            // 代码区域
                            var param = {
                                Id: data.Id,
                            };
                            sendData(IP + "/UpApi/FinishAsn", param, 'post', function (res) {
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
                                        icon: 1,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () {
                                        refreshTable();
                                        doing = true
                                    });
                                } else { //不成功
                                    layer.msg(res.msg, {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () { doing = true });
                                }
                            });
                        });
 
                        break;
                    case "chexiao":
                        layer.open({
                            type: 1,
                            title: '撤销申请',
                            content: $('#divReason'),
                            maxmin: true,
                            area: ['300px', '265px'],
                            btn: ['确定', '取消'],
                            yes: function (index, layero) {
                                var pa = $('#Reason').val();
                                if (doing == true) {
                                    doing = false;
 
                                    var param = {
                                        Id: data.Id,
                                        Reason: pa,
                                    };
                                    console.log(param);
                                    sendData(IP + "/BllAsn/CancelOrder", param, 'get', function (res) {
                                        console.log(res);
                                        if (res.code == 0) { //成功
                                            layer.msg(res.msg, {
                                                icon: 1,
                                                time: 3000 //1秒关闭(如果不配置,默认是3秒)
                                            }, function () {
                                                refreshTable();
                                                doing = true;
                                            });
                                        } else { //不成功
                                            layer.msg(res.msg, {
                                                icon: 2,
                                                time: 3000 //2秒关闭(如果不配置,默认是3秒)
                                            }, function () {
                                                refreshTable();
                                                doing = true;
                                            });
                                        }
                                        layer.close(index);
                                    });
                                } else {
                                    layer.msg("请勿重复点击", {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    });
                                }
 
                            }
                        });
 
                        break;
                    case "editDemo":
                        $('#NoticeDemo').val(data.Demo);
                        layer.open({
                            type: 1,
                            title: '维护备注',
                            content: $('#divEditDemo'),
                            maxmin: false,
                            area: ['420px', '260px'],
                            btn: ['确定', '取消'],
                            yes: function (index, layero) {
                                var demo = $('#NoticeDemo').val();
                                var param = {
                                    id: data.Id,
                                    demo: demo,
                                };
                                sendData(IP + "/BllAsn/EditNoticeDemo", param, 'get', function (res) {
                                    if (res.code == 0) { //成功
                                        refreshTable();
                                        layer.msg(res.msg, {
                                            icon: 1,
                                            time: 1500 //1秒关闭(如果不配置,默认是3秒)
                                        }, function () {
 
                                        });
                                    } else { //不成功
                                        layer.msg(res.msg, {
                                            icon: 2,
                                            time: 3000 //2秒关闭(如果不配置,默认是3秒)
                                        }, function () {
                                            refreshTable();
                                        });
                                    }
                                    layer.close(index);
                                });
                            }
                        });
                        break;
                    default: break;
                }
            });
            //明细表操作栏事件
            table.on('tool(LAY-app-content-list2)', function (obj) {
                var data = obj.data;
                var id = data.Id;
                switch (obj.event) {
                    case "del":
                        layer.confirm('确定删除入库单明细吗?', function (index) {
                            // 代码区域
                            var param = {
                                ASNNo: data.ASNNo,
                                Id: data.Id,
                            };
                            sendData(IP + "/BllAsn/DelArrivalNoticeDetail", param, 'post', function (res) {
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
                                        icon: 1,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () {
                                        refreshTable();
                                        refreshTablemx(data.ASNNo);
                                        doing = true
                                    });
                                } else { //不成功
                                    layer.msg(res.msg, {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () { doing = true });
                                }
                            });
                        });
 
                        break;
                    case "Addlabel":
                        if (data.Qty <= 0) {
                            layer.msg("请先输入到货数量!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        }
                        layer.open({
                            type: 2,
                            title: '生成标签',
                            content: 'LabelPrintSelect.html?Id=' + id + '&SupplierLot=' + data.SupplierLot,
                            maxmin: true,
                            area: ['480px', '615px'],
                            btn: ['确定', '取消'],
                            yes: function (index, layero) {
                                var iframeWindow = window['layui-layer-iframe' + index]
                                    , submitID = 'layuiadmin-app-form-edit'
                                    , submit = layero.find('iframe').contents().find('#' + submitID);
                                //监听提交
                                iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
                                    var field = data.field; //获取提交的字段
                                    console.log(field);
                                    //提交 Ajax 成功后,静态更新表格中的数据
                                    //"&Level="+field.level+"&Type="+field.type+"&BoxType="+field.boxType+"&Qty="+field.qty+
                                    var str = "Id=" + id + "&IsReset=" + field.reset + "&ArriveQty=" + field.arriveQty + "&ProductionTime=" + field.productionTime + "&ExpirationTime=" + field.expirationTime + "&StoreTime=" + field.storeTime + "&SupplierLot=" + field.SupplierLot;
 
                                    layer.open({
                                        type: 2,
                                        title: '生成标签',
                                        content: 'LabelPrint.html?' + str,
                                        maxmin: true,
                                        area: ['660px', '660px'],
                                        btn: ['取消'],
 
 
                                    });
                                });
                                submit.trigger('click');
                            }
 
                        });
 
                        break;
                    case "Addlabel2":
                        if (data.Qty <= 0) {
                            layer.msg("请先输入到货数量!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        }
                        layer.open({
                            type: 2,
                            title: '生成标签',
                            content: 'LabelPrintSelect.html?Id=' + id + '&Type=4',
                            maxmin: true,
                            area: ['480px', '615px'],
                            btn: ['确定', '取消'],
                            yes: function (index, layero) {
                                var iframeWindow = window['layui-layer-iframe' + index]
                                    , submitID = 'layuiadmin-app-form-edit'
                                    , submit = layero.find('iframe').contents().find('#' + submitID);
                                //监听提交
                                iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
                                    var field = data.field; //获取提交的字段
                                    console.log(field);
                                    //提交 Ajax 成功后,静态更新表格中的数据
                                    //"&Level="+field.level+"&Type="+field.type+"&BoxType="+field.boxType+"&Qty="+field.qty+
                                    var str = "Id=" + id + "&IsReset=" + field.reset + "&ArriveQty=" + field.arriveQty + "&ProductionTime=" + field.productionTime + "&ExpirationTime=" + field.expirationTime + "&StoreTime=" + field.storeTime;
 
                                    layer.open({
                                        type: 2,
                                        title: '生成标签',
                                        content: 'LabelPrint.html?' + str,
                                        maxmin: true,
                                        area: ['660px', '660px'],
                                        btn: ['取消'],
 
 
                                    });
                                });
                                submit.trigger('click');
                            }
 
                        });
 
                        break;
                    default: break;
                }
            });
 
            //#region 自定义表头
            //自定义表头            
            active = {
                customCols: function () {
                    layer.open({
                        type: 2,
                        title: '自定义列',
                        content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetArrivalNoticeList&ColsSysArr=' + TotalColsSysArr,
                        maxmin: false,
                        resize: false,
                        area: ['970px', '650px']
                    });
                },
                customCols2: function () {
                    layer.open({
                        type: 2,
                        title: '自定义列',
                        content: '../SystemSettings/HeaderSetting.html?Href=BllAsn/GetArrivalNoticeDetailList&ColsSysArr=' + DetailColsSysArr,
                        maxmin: false,
                        resize: false,
                        area: ['970px', '650px']
                    });
                }
 
            };
            $('.layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            //#endregion
        });
    </script>
</body>
 
</html>