liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
<!-- <apex:page Controller="TransferShippmentReceived4Controller" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="调拨出库入库"> -->
<apex:page Controller="TransferShippmentReceived4Controller" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="调拨出库入库" lightningStylesheets="true">
<!-- 20230424 ljh lightning 升级  -->
<head>
    <meta name="format-detection" content="telephone=no"/>
</head>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.instascan)}"/>
<apex:stylesheet value="{!URLFOR($Resource.TransferShippmentReceivedcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.sldsMy)}"/><!-- 20230925 ljh lightning --> 
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilColorCss)}"/><!-- 20230619 ljh lightning  -->
<script type="text/javascript">
function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}
 
function showConfirm(message, okhandler, errorhandler) {
    j$.confirm({
        title: '确认',
        content: message,
        boxWidth: '50%',
        useBootstrap: false,
        buttons: {
            OK: function () {
                okhandler();
            },
            cancel: {
                text: '取消',
                action: function () {
                    errorhandler();
                }
            }
        }
    });
}
function savejs() {
    blockme();
    save();
}
 
function changeCheckLost(ele) {
    // 20230804 ljh start
    // var ele1 = j$(ele).parent().parent().find('[name$="checkboxCDS"]');
    // var ele2 = j$(ele).parent().parent().find('[name$="checkboxGiveUp"]');
    // var ele3 = j$(ele).parent().parent().find('select[id$="checkLost"]');
    // var ele4 = j$(ele).parent().parent().find('span[id$="checkLost3"]');
    // var ele5 = j$(ele).parent().parent().find('input[id$="lostMemo"]');
    // var ele6 = j$(ele).parent().parent().find('input[id$="lostMemo2"]');
    var ele1 = j$(ele).parent().parent().parent().find('[name$="checkboxCDS"]');
    var ele2 = j$(ele).parent().parent().parent().find('[name$="checkboxGiveUp"]');
    var ele3 = j$(ele).parent().parent().parent().find('select[id$="checkLost"]');
    var ele4 = j$(ele).parent().parent().parent().find('span[id$="checkLost3"]');
    var ele5 = j$(ele).parent().parent().parent().find('input[id$="lostMemo"]');
    var ele6 = j$(ele).parent().parent().parent().find('input[id$="lostMemo2"]');
    // 20230804 ljh end
 
    var lastken = ele3.val() == '欠品' || ele4.text() == '欠品';
    ele5.prop('disabled', true);
    ele6.prop('disabled', true);
    if (j$(ele).val() == '欠品' || j$(ele).val() == '消耗') {
        ele1.prop('checked', false);
        ele1.prop('disabled', true);
        changeCheckCds(ele1);
        if (j$(ele).val() == '欠品') {
            ele2.prop('disabled', false);
            ele5.prop('disabled', false);
            ele6.prop('disabled', false);
        } else {
            ele2.prop('checked', false);
            ele2.prop('disabled', true);
        }
    } else if (j$(ele).val() == 'OK') {
        ele1.prop('checked', true);
        ele1.prop('disabled', false);
        ele2.prop('checked', false);
        ele2.prop('disabled', true);
        changeCheckCds(ele1);
    } else {
        if (!lastken) {
            ele1.prop('checked', false);
            ele1.prop('disabled', !ele3.val() && !ele4.text());
            ele2.prop('checked', false);
            ele2.prop('disabled', true);
            changeCheckCds(ele1);
        } else {
            ele2.prop('disabled', false);
            ele2.prop('checked', false);
            ele1.prop('disabled', true);
            ele1.prop('checked', false);
            changeCheckCds(ele1);
        }
    }
}
 
function changeCheckCds(ele) {
    var ele1 = j$(ele).parent().parent().find('[name$="CDSChargement"]');
    var ele2 = j$(ele).parent().parent().find('[name$="CDSType"]');
    if (ele1 != null && ele2 != null) {
        if (j$(ele).prop("checked") == true) {
            ele1.prop('disabled', false);
            ele2.prop('disabled', false);
        } else {
            ele1.val('');
            ele2.val('');
            ele1.prop('disabled', true);
            ele2.prop('disabled', true);
        }
    }
}
 
function checkDetail(ele, resid) {
    if (j$(ele).prop("checked")) {
        var el = j$("input[data-resid='" + resid + "']");
        el = el.filter(function(index,element){
            var rid = j$(element).last().prev().attr('id');
            rid = rid.substring(0, rid.lastIndexOf(":"));
            j$("input[name^='"+rid+"']").prop("disabled", false);
            return j$("input[name^='"+rid+"']").prop("checked") === false
        })
        el.prop("checked", true);
        el.each(function(index, val) {
            if (j$(val).data('lost')) {
                j$(val).prop("disabled", false);
            } else {
                j$(val).prop("disabled", true);
            }
        })
    } else {
        j$("input[data-resid='" + resid + "']").prop("disabled", true);
        j$("input[data-resid='" + resid + "']").parent().parent().parent().find('input[id$="noitem"]').prop("disabled", true);
        j$("input[data-resid='" + resid + "']").parent().parent().parent().find('input[id$="noitem"]').prop("checked", false);
        j$("input[data-resid='" + resid + "']").prop("checked", false);
    }
 
}
function checkNoItem(ele, resdid) {
    if (j$(ele).prop("checked")) {
        j$("input[value='" + resdid + "']").prop("disabled", true);
        j$("input[value='" + resdid + "']").prop("checked", false);
    } else {
        var resid = j$("input[value='" + resdid + "']").data("resid");
        if (j$("input[data-resid2='" + resid + "']").prop("checked")) {
            j$("input[value='" + resdid + "']").each(function(index, val) {
                if (j$(val).data('lost')) {
                    j$(val).prop("disabled", false);
                } else {
                    j$(val).prop("disabled", true);
                    j$(val).prop("checked", true);
                }
            })
        }
    }
}
function filljsQR1(qrcode) {
    if(!qrcode)return;
    blockme();
    j$("input[name$='SlipNo']").val(qrcode);
    unblockUI();
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
}
function filljsQR2(qrcode) {
    blockme();
    if (j$("[data-qr='"+qrcode+"']").size() > 1) {
        alert("数量管理附属品请手动打勾!");
    } else {
        j$("[data-qr='"+qrcode+"']").find('select').val('OK');
        // 20230927 ljh update start
        // var cds = j$("[data-qr='"+qrcode+"']").children("input[name$='checkboxCDS']");
        var cds = j$("[data-qr='"+qrcode+"']").find("input[name$='checkboxCDS']");
        // 20230927 ljh update end
        cds.prop('disabled', false).prop('checked',true)
        changeCheckCds(cds);
    }
    unblockUI();
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
}
var checked_raes = ''
var checked_raesd = ''
 
function checkAllDetail2() {
    // 20240116 ljh update start
    if(j$('select[name$="checkLost"]').parent().parent().css("display") != 'none'){
        j$('select[name$="checkLost"]').val("OK");
    }
    if(j$('select[name$="checkLost2"]').parent().parent().css("display") != 'none'){
        j$('select[name$="checkLost2"]').val("OK");
    }
    // 20240116 ljh update end  
    // j$("input[name$='checkboxCDS']");
    var cds = j$("input[name$='checkboxCDS']");
    cds.prop('disabled', false).prop('checked',true);
    changeCheckCds(cds);
}
function ShippmentAddJs() {
    j$(escapeVfId('allPage:allForm:SlipNo')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DeliveryType')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DistributorMethod')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DeliveryCompany')).prop("disabled", true);
    ShippmentAdd();
}
function ShippmentDetailJs() {
    j$(escapeVfId('allPage:allForm:SlipNo')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DeliveryType')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DistributorMethod')).prop("disabled", true);
    j$(escapeVfId('allPage:allForm:DeliveryCompany')).prop("disabled", true);
    ShippmentDetail();
}
 
function resetDetailDivMargintop() {
    var handerHeight = document.getElementById('hander').clientHeight;
    document.getElementById('detailDiv').style.marginTop = handerHeight + 'px';
}
 
window.onload = function hiddenName(){
    if( document.getElementById('allPage:allForm:CDS_staff_mlktp')){
        document.getElementById('allPage:allForm:CDS_staff_mlktp').style.visibility="hidden" ;
        document.getElementById('allPage:allForm:CDS_staff_mlktp').style.width="200px" ;
    }
    fixDeliveryType();
    resetDetailDivMargintop();
}
 
function fixDeliveryType() {
 
 
    j$('[name$="checkboxGiveUp"]').prop('disabled',true)
 
    j$("select[name$='checkLost2']").each(function() {
        if (j$(this).val() == '欠品' || j$(this).val() == '消耗' || j$(this).val() == '' ) {
            j$(this).parent().parent().parent().find('[name$="checkboxCDS"]').prop('disabled',true);
            j$(this).parent().parent().parent().find('[name$="CDSChargement"]').prop('disabled',true);
            j$(this).parent().parent().parent().find('[name$="CDSType"]').prop('disabled',true);
        }
        if (j$(this).val() == '欠品' ) {
            j$(this).parent().parent().parent().find('input[id$="lostMemo2"]').prop('disabled',false);
        } else {
            j$(this).parent().parent().parent().find('input[id$="lostMemo2"]').prop('disabled',true);
        }
    })
    j$("select[name$='checkLost']").each(function() {
        if (j$(this).val() == '欠品' || j$(this).val() == '消耗' || j$(this).val() == '' ) {
            j$(this).parent().parent().parent().find('[name$="checkboxCDS"]').prop('disabled',true);
            j$(this).parent().parent().parent().find('[name$="CDSChargement"]').prop('disabled',true);
            j$(this).parent().parent().parent().find('[name$="CDSType"]').prop('disabled',true);
        }
        if (j$(this).val() == '欠品' ) {
            j$(this).parent().parent().parent().find('input[id$="lostMemo"]').prop('disabled',false);
        } else {
            j$(this).parent().parent().parent().find('input[id$="lostMemo"]').prop('disabled',true);
        }
    })
 
    j$('span[id$="checkLost3"]').each(function() {
        if (j$(this).text() == '欠品') {
            j$(this).parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        }
        if(j$(this).parent().css("display") != 'none'){
            j$(this).parent().parent().parent().find('[name$="lostMemo"]').prop('disabled',true)
            j$(this).parent().parent().parent().find('[name$="lostMemo"]').hide()
        }
    })
    j$('select[id$="checkLost"]').each(function() {
        if (j$(this).val() == '欠品') {
            j$(this).parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        }
    })
 
    j$('span[id$="checkLost"]').each(function() {
        if (j$(this).children().text() == '欠品') {
            j$(this).parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        }
    })
 
    j$('span[id$="checkLost4"]').each(function() {
        if (j$(this).text() == '欠品') {
            j$(this).parent().find('input[id$="lostMemo2"]').prop('disabled',false);
            j$(this).parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        } else if (j$(this).text() != '') {
            j$(this).parent().find('input[id$="lostMemo2"]').prop('disabled',true);
            j$(this).parent().find('[name$="checkboxGiveUp"]').prop('disabled',true)
        }
    })
 
    j$('span[id$="checkLost2"]').each(function() {
        if (j$(this).children().text() == '欠品') {
            j$(this).parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        } else if (j$.trim(j$(this).text()) != '') {
            j$(this).parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',true)
        }
    })
 
    j$('select[id$="checkLost2"]').each(function() {
        if (j$(this).val() == '欠品') {
            j$(this).parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
        } else if (j$(this).val() != '') {
            j$(this).parent().parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',true)
            // 20230927 ljh add start
            j$(this).parent().parent().parent().find('[name$="checkboxCDS"]').prop('disabled',false);
            // 20230927 ljh add end
        }
    })
 
    j$('img[alt="チェック"]').each(function() {
        j$(this).parent().parent().find('[name$="checkboxGiveUp"]').prop('disabled',false)
    })
 
    j$('input[id$="noitem"]').prop('disabled', true);
}
 
function checkMessage() {
    fixDeliveryType();
    var flag = j$(escapeVfId('allPage:allForm:done_flg')).val();
    if ( flag == 'true') {
        alert("保存完了");
        window.location.reload(false);
    } else if (checked_raes) {
        var carray = checked_raes.split(",");
 
        carray.forEach(function(element) {
            j$("input[data-resid2='" + element + "']").prop('checked', true);
            j$("input[data-resid2='" + element + "']").trigger('change');
        });
        checked_raes = '';
 
        if (checked_raesd) {
            var darray = checked_raesd.split(",")
            j$("input[name$='raesdCheck']:checked").each(function(){
                if (checked_raesd.indexOf(j$(this).val()) == -1) {
                    j$(this).prop('checked', false);
                }
            });
            checked_raesd = '';
        }
    }
}
 
</script>
<style type="text/css">
    .hideDropdown select{
        display: none;
    }
    .hideDropdown input {
        width:80px;
    }
    .menu {
        border-radius:8px;
        border:1px solid #D1D1D1;
    }
    .menu div.m_title{
        /* width: 308px; */ /*20230722 ljh*/
        text-align: left;
        margin: 0;
        background:#DCDCDC;
        /* background:#95aee5; */
        border-radius:8px 8px 0 0;
        /*height: 42px;*/
        padding-left: 0.75rem;/*20230721 ljh  */
    }
    .menu div.m_titleg{
        /* width: 308px; */
        text-align: left;
        margin: 0;
        background:#DCDCDC;
        border-radius:8px 8px 0 0;
        /*height: 42px;*/
        padding-left: 0.75rem;/*20230721 ljh  */
    }
    .dateFormat {
        display: none;
    }
    #Step_tab {
        list-style-type: none;
        padding: 0;
        /* 20230424 ljh lightning 升级 start */
        /* height: 25px; */
        height: 30px;
        margin-left:0;
        /* 20230424 ljh lightning 升级 end */
        border-bottom: 5px solid #3b5998;
    }
    #Step_tab li {
        position: relative;
        /* 20230424 ljh lightning 升级 start */
        /* width: 20%; */
        width: 50%;
        /* 20230424 ljh lightning 升级 end */
        float: left;
        margin: 0;
        padding: 0;
        text-align: center;
        cursor: pointer;
    }
    #Step_tab li span {
        margin: 0;
        padding: 15px 0 11px;
        color: #2daae1;
        font-size: 12px;
        font-weight: bold;
        line-height: 1;
    }
    #Step_tab li.selected {
        background: #3b5998;
    }
    #Step_tab li.selected span {
        color: #fff;
    }
 
    div#main {
        /* width: 320px; */
    }
 
    hr {
        border-top: 2px dotted #f00;
        color: #fff;
        background-color: #fff;
        height: 1px;
        /* 20230722 ljh */
        /* width: 90%; */
        width: 98%;
    }
    .close {
        color: #aaaaaa;
        float: right;
        font-size: 28px;
        font-weight: bold;
    }
    .close:hover,
    .close:focus {
        color: #000;
        text-decoration: none;
        cursor: pointer;
    }
    .menu blockquote{
        margin: 0;
        padding: 1px;
        list-style: none;
        border-top: 1px solid #ddd;
    }
    #alertoverlay{display: none;
        opacity: .8;
        z-index: 20;
        position: fixed;
        top: 0px;
        left: 0px;
        background: #FFF;
        width: 100%;}
 
    #alertbox{display: none;
        position: fixed;
        background: white;
        z-index: 21;
        border: 1px solid black;
        font-size:18px;}
 
    #alertbox > div > #alertboxhead{background:white; padding:3px; color:black;}
    #alertbox > div > #alertboxbody{ background:white; padding:10px; color:red; }
    #alertbox > div > #alertboxfoot{ background:white; padding:3px; text-align:right; }
    /* 20230424 ljh lightning 升级 start */
    /*.menu span {
        display: inline-block;
        height: 30px;
    }*/
    /* 20230424 ljh lightning 升级 end */
</style>
<div id="myModal" class="modal">
 
  <!-- Modal content -->
  <div class="modal-content">
    <span class="close" onclick="stopScan()">&times;</span>
    <p>扫描中</p>
        <p>Code:<input type="text" id="qrcode"/></p>
    <video playsinline="true" id="preview" style="width: 100%;z-index: 11;transform: scaleX(-1);margin-top: 10px;"></video>
    扫码履历:
    <ul id="scanedqr" style="list-style-type: none; text-align: center;padding: 0;width: 100%; height: 100px; overflow: auto">
    </ul>
  </div>
 
</div>
 
<div id="alertoverlay"></div>
<div id="alertbox">
  <div>
    <div id="alertboxhead"></div>
    <div id="alertboxbody"></div>
    <div id="alertboxfoot"></div>
  </div>
</div>
 
<apex:form id="allForm">
    <apex:actionFunction name="save" action="{!save}" rerender="detail,message,done_flg" onComplete="checkMessage();unblockUI();resetDetailDivMargintop();"/>
    <apex:inputHidden value="{!done_flg}" id="done_flg"/>
    <div id="main">
        <div id="hander" class="freezehander">
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
            <!-- <div style="text-align: right;margin-top: 10px;">
                <apex:commandButton styleClass="commandbutton" onclick="savejs();return false;" value="保存"/>
            </div>
            <apex:outputText id="saveBtnDisabled" value="{!saveBtnDisabled}" style="display: none;"/>
            <table style="border-collapse: collapse; font-size:13px;">
                <colgroup>
                    <col width="150" />
                    <col width="170" />
                </colgroup>
                <tr>
                    <th colspan="2" style="font-size:20px;text-align: center;width:380px;">
                        <ul id="Step_tab">
                            <li class="selected"><span class="tabsize">欠品确认</span></li>
                        </ul>
                    </th>
                </tr>
            </table>
 
            <div style="text-align: right">
                <apex:commandButton styleClass="commandbutton" onclick="qrsacn(2)" value="扫一扫备品" rerender="dummy"/>
                <input type="hidden" id="QRType" value="1"/>
                <apex:commandButton styleClass="commandbutton" onclick="checkAllDetail2();return false" value="全部OK" rerender="dummy"/>
            </div> -->
 
            <apex:pageBlock >
                <table style="border-collapse: collapse; font-size:13px;">
                    <colgroup>
                        <col width="20%" />
                        <col width="80%" />
                    </colgroup>
                    <tr>
                        <!-- 状态切换btn -->
                        <th  style="font-size:20px;text-align: center;width:280px;height: 50px;" >
                            <ul id="Step_tab" style="margin:0;">
                                <li class="selected"><span class="tabsize">欠品确认</span></li>
                            </ul>
                        </th>
                        <th width="900px;" style="padding-left:50px;" class="myBtn">
                            <apex:commandButton styleClass="commandbutton" onclick="qrsacn(2)" value="扫一扫备品" rerender="dummy"/>
                            <input type="hidden" id="QRType" value="1"/>
                            <apex:commandButton styleClass="commandbutton" onclick="checkAllDetail2();return false" value="全部OK" rerender="dummy"/>
                            <apex:commandButton styleClass="commandbutton" onclick="savejs();return false;" value="保存"/>
                            <apex:outputText id="saveBtnDisabled" value="{!saveBtnDisabled}" style="display: none;"/>
                        </th>
                    </tr>
                </table>
            </apex:pageBlock>
        </div>
        <apex:outputPanel id="detail">
        <div id="detailDiv" class="detail">
            <apex:inputHidden value="{!ApplyId}" id="applyId"/>
            <apex:outputPanel layout="none" rendered="true">
                <apex:variable var="indexloop" value="{!0}" />
                <apex:variable var="SetName" value="" />
                <apex:repeat value="{!esdList}" var="esdInfo" id="esdList">
                <apex:outputPanel layout="none" rendered="{!esdInfo.isChecked}">
                    <apex:variable var="indexloop" value="{!indexloop+1}"/>
                    <apex:variable var="SetName" value="{!IF(SetName='', esdInfo.rec.TransferApplySummary__c, SetName)}" />
                    <apex:outputPanel layout="none" rendered="{!IF(SetName=esdInfo.rec.TransferApplySummary__c && indexloop != 1, true, false)}">
                        <br/>
                    </apex:outputPanel>
                    <apex:outputPanel layout="none" rendered="{!IF(SetName=esdInfo.rec.TransferApplySummary__c, false, true)}">
                        <hr/>
                        <h3 style="padding: 5px 0.75rem;" class="detailtab">{!esdInfo.fsName}</h3>
                        <apex:variable var="SetName" value="{!esdInfo.rec.TransferApplySummary__c}" />
                    </apex:outputPanel>
 
                    <apex:outputPanel layout="none" rendered="{!IF(indexloop == 1, true, false)}">
                        <h3 style="padding: 5px 0.75rem;" class="detailtab">{!esdInfo.fsName}</h3>
                    </apex:outputPanel>
                    <div class="menu">
                    <apex:outputPanel layout="none">
                    <div class="m_title">
                        <h2>
                            &nbsp;<apex:outputField value="{!esdInfo.rec.Fixture_Name_F__c}" />&nbsp;&nbsp;
                            <!-- 2023-08-02 zyh 机身编号换地方 -->
                            <span>(<apex:outputField value="{!esdInfo.rec.SerialNumber_F__c}" style="margin:3px;"/>)</span>
                            <!-- 2023-08-02 zyh 机身编号换地方 -->
                        </h2>
                    </div>
                    </apex:outputPanel>
                    <!-- 20230721 ljh -->
                    <ul data-qr="{!esdInfo.rec.Fixture_QRCode_F__c}" style="font-size:14px;padding: 1px 0.75rem;">
                        <apex:inputField value="{!esdInfo.rec.Loaner_accsessary__c}" style="display:none"/>
                        <!-- 20201209 ljh add -->
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(AND(esdInfo.rec.ArrivalResult__c != null,esdInfo.rec.ArrivalResult__c !=''), true, false)}"> -->
                        <li style="{!IF(AND(esdInfo.rec.ArrivalResult__c != null,esdInfo.rec.ArrivalResult__c !=''),'','display:none;')}">
                        <span>{!$ObjectType.TransferApplyDetail__c.fields.ArrivalResult__c.label} : </span>
                        <apex:outputField value="{!esdInfo.rec.ArrivalResult__c}" style="margin:3px;" />
                        </li>
                        <!-- </apex:outputPanel> -->
                        <!-- 20201209 ljh add -->
                        <!-- 20210426 ljh add 1832 start-->
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(AND(esdInfo.rec.Return_DeliverySlip__c != null,esdInfo.rec.ArrivalResult__c == 'NG',esdInfo.rec.Arrival_NG_Comment__c !=''), true, false)}"> -->
                        <li style="{!IF(AND(esdInfo.rec.Return_DeliverySlip__c != null,esdInfo.rec.ArrivalResult__c == 'NG',esdInfo.rec.Arrival_NG_Comment__c !=''),'','display:none;')}">
                        <span>{!$ObjectType.TransferApplyDetail__c.fields.Arrival_NG_Comment__c.label} : </span>
                        <apex:outputField value="{!esdInfo.rec.Arrival_NG_Comment__c}" style="margin:3px;" />
                        </li>
                        <!-- </apex:outputPanel> -->
                        <!-- 20210426 ljh add 1832 end-->
                        <!-- === -->
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''), true, false)}"> -->
                            <li style="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''),'','display:none;')}">
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.Check_lost_Item__c.label} :</span>
                            <apex:outputPanel layout="none" rendered="{!(esdInfo.editable)}">
                                <apex:inputField id="checkLost" value="{!esdInfo.rec.Check_lost_Item__c}" style="margin:3px;" onchange="changeCheckLost(this)"/>
                            </apex:outputPanel> 
                            <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable))}">
                                <apex:outputField value="{!esdInfo.rec.Check_lost_Item__c}" style="margin:3px;" />
                            </apex:outputPanel>
                            </li>
                        <!-- </apex:outputPanel> -->
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''), false, true   )}"> -->
                            <li style="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''),'display:none;','')}">
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.Check_lost_Item__c.label} : </span>
                            <apex:outputField id="checkLost3" value="{!esdInfo.rec.Check_lost_Item__c}" style="margin:3px;"/>
                            </li>
                        <!-- </apex:outputPanel> -->
                        <li>
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_Memo__c.label}: </span>
                            <apex:outputPanel layout="none" rendered="{!esdInfo.editable}">
                                <apex:inputField id="lostMemo" value="{!esdInfo.rec.Lost_item_Memo__c}" style="margin:3px;"/>
                            </apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || (esdInfo.rec.Check_lost_Item__c != null && esdInfo.rec.Check_lost_Item__c != 'OK'))}">
                                <apex:outputField value="{!esdInfo.rec.Lost_item_Memo__c}" style="margin:3px;"/>
                            </apex:outputPanel>
                        </li>
                        <!-- 最初最终对出现 -->
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''), false, true   )}"> -->
                            <li style="{!IF(OR(esdInfo.rec.Check_lost_Item__c='OK',esdInfo.rec.Check_lost_Item__c=''),'display:none;','')}">
                                <span>{!$ObjectType.TransferApplyDetail__c.fields.Check_lost_Item_Final__c.label} : </span>
                                <!-- 20231020 ljh add  AND(esdInfo.rec.Check_lost_Item__c !='OK',esdInfo.rec.Check_lost_Item__c !='') -->
                                <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗' && AND(esdInfo.rec.Check_lost_Item__c !='OK',esdInfo.rec.Check_lost_Item__c !=''))}"><apex:inputField id="checkLost2" value="{!esdInfo.rec.Check_lost_Item_Final__c}" style="margin:3px;" onchange="changeCheckLost(this)"/></apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗')}"><apex:outputField id="checkLost4" value="{!esdInfo.rec.Check_lost_Item_Final__c}" style="margin:3px;" /></apex:outputPanel>
                            </li>
                        <!-- </apex:outputPanel> -->
                        <!-- <apex:outputPanel layout="none" rendered="{!esdInfo.rec.Check_lost_Item__c != null && esdInfo.rec.Check_lost_Item__c != 'OK' }"> -->
                            <li style="{!IF(esdInfo.rec.Check_lost_Item__c != null && esdInfo.rec.Check_lost_Item__c != 'OK','','display:none;')}">
                                <span>{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_Memo_Final__c.label}: </span>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗'}">
                                    <apex:inputField id="lostMemo2" value="{!esdInfo.rec.Lost_item_Memo_Final__c}" style="margin:3px;"/>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗'}">
                                <apex:outputField value="{!esdInfo.rec.Lost_item_Memo_Final__c}" style="margin:3px;"/>
                                </apex:outputPanel>
                            </li>
                        <!-- </apex:outputPanel> -->
                        <!-- === -->
                        <apex:outputPanel layout="none" rendered="{!IF(esdInfo.slipId=null, true, false)}">
                        <input type="hidden" name="noSlip" value="1"/>
                        </apex:outputPanel>
                        <li>
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.NoItemReturn__c.label}: 
                            <apex:outputField value="{!esdInfo.rec.NoItemReturn__c}" style="margin:3px;"/></span>
                        </li>
                        
                        <!-- <apex:outputPanel layout="none" rendered="{!esdInfo.rec.Check_lost_Item__c != null && esdInfo.rec.Check_lost_Item__c != 'OK' }">
                            <li>
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_Memo_Final__c.label}: </span>
                            <apex:outputPanel layout="none" rendered="{!esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗'}">
                            <apex:inputField id="lostMemo2" value="{!esdInfo.rec.Lost_item_Memo_Final__c}" style="margin:3px;"/>
                            </apex:outputPanel>s
                            <apex:outputPanel layout="none" rendered="{!NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗'}">
                            <apex:outputField value="{!esdInfo.rec.Lost_item_Memo_Final__c}" style="margin:3px;"/>
                            </apex:outputPanel>
                            </li>
                        </apex:outputPanel> -->
                        
                        <!-- <apex:outputPanel layout="none" rendered="{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_giveup__c.accessible}"> -->
                        <!-- 20230424 ljh lightning 升级 start -->
                        <!-- &nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_giveup__c.label} : <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && NOT(esdInfo.rec.Lost_item_giveup__c) && esdInfo.rec.Check_lost_Item_Final__c != '消耗')}"><apex:inputField id="checkboxGiveUp" value="{!esdInfo.rec.Lost_item_giveup__c}"/></apex:outputPanel> -->
                        <li style="{!IF($ObjectType.TransferApplyDetail__c.fields.Lost_item_giveup__c.accessible,'','display:none;')}">
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.Lost_item_giveup__c.label} :</span> 
                            <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && NOT(esdInfo.rec.Lost_item_giveup__c) && esdInfo.rec.Check_lost_Item_Final__c != '消耗')}"><apex:inputField id="checkboxGiveUp" value="{!esdInfo.rec.Lost_item_giveup__c}"/></apex:outputPanel>
                            <!-- 20230424 ljh lightning 升级 end -->
                            <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || esdInfo.rec.Lost_item_giveup__c || esdInfo.rec.Check_lost_Item_Final__c == '消耗')}"><apex:outputField value="{!esdInfo.rec.Lost_item_giveup__c}"/></apex:outputPanel>
                        </li>
                        <!-- </apex:outputPanel> -->
                        <li>
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.CDS_complete__c.label} : </span>
                            <apex:outputPanel layout="none" rendered="{!IF(esdInfo.slipId=null, false, true)}">
                                <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗')}"><apex:inputField id="checkboxCDS" value="{!esdInfo.rec.CDS_complete__c}" onchange="changeCheckCds(this);"/></apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗')}"><apex:outputField value="{!esdInfo.rec.CDS_complete__c}"/></apex:outputPanel>
                            </apex:outputPanel>
                        </li>
                        <!-- <apex:outputPanel layout="none" rendered="{!IF(esdInfo.slipId=null, false, esdInfo.rec.Main_OneToOne__c)}"> -->
                        <li style="{!IF(esdInfo.slipId=null,'display:none;',IF( esdInfo.rec.Main_OneToOne__c,'','display:none;'))}">
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.CDSChargement__c.label} : </span>
                            <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗')}"><apex:inputField id="CDSChargement" value="{!esdInfo.rec.CDSChargement__c}"/></apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗')}"><apex:outputField value="{!esdInfo.rec.CDSChargement__c}"/></apex:outputPanel>
                            </li>
                            <li style="{!IF(esdInfo.slipId=null,'display:none;',IF( esdInfo.rec.Main_OneToOne__c,'','display:none;'))}">
                            <span>{!$ObjectType.TransferApplyDetail__c.fields.CDSType__c.label} : </span>
                            <apex:outputPanel layout="none" rendered="{!(esdInfo.editable && esdInfo.rec.Check_lost_Item_Final__c != '消耗')}"><apex:inputField id="CDSType" value="{!esdInfo.rec.CDSType__c}"/></apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!(NOT(esdInfo.editable) || esdInfo.rec.Check_lost_Item_Final__c == '消耗')}"><apex:outputField value="{!esdInfo.rec.CDSType__c}"/></apex:outputPanel>
                            </li>
                        <!-- </apex:outputPanel> -->
                            <!-- 2023-08-02 zyh 机身编号换地方 -->
                        <!-- <li>
                        <span>{!$ObjectType.TransferApplyDetail__c.fields.SerialNumber_F__c.label}: </span>
                        <span><apex:outputField value="{!esdInfo.rec.SerialNumber_F__c}" style="margin:3px;"/></span>
                        </li> -->
                            <!-- 2023-08-02 zyh 机身编号换地方 -->
                    </ul>
                    </div>
                </apex:outputPanel>
                <apex:inputCheckbox Id="bbbaaa" value="{!esdInfo.isChecked}" style="display: none"/>
                </apex:repeat>
            </apex:outputPanel>
        </div>
        </apex:outputPanel>
    </div>
</apex:form>
    <script type="text/javascript">
 
        function CustomAlert(){
            this.on = function(alert){
                var winW = window.innerWidth;
                var winH = window.innerHeight;
 
                alertoverlay.style.display = "block";
                alertoverlay.style.height = window.innerHeight+"px";
                alertbox.style.left = (window.innerWidth/3.5)+"pt";
                alertbox.style.right = (window.innerWidth/3.5)+"pt";
            alertbox.style.top = (window.innerHeight/10)+"pt";
                alertbox.style.display = "block";
                document.getElementById('alertboxhead').innerHTML = "提示";
                document.getElementById('alertboxbody').innerHTML = alert;
                document.getElementById('alertboxfoot').innerHTML = '<button onclick="Alert.off()">确定</button>';
            }
            this.off = function(){
                document.getElementById('alertbox').style.display = "none";
                document.getElementById('alertoverlay').style.display = "none";
            }
        }
        var Alert = new CustomAlert();
        j$(document).ready(function(){
            j$( '#qrcode' ).unbind();
            j$( '#qrcode' ).keypress( function ( e ) {
                if ( e.which == 13 ) {
                    filljsQR(j$( '#qrcode' ).val());
                    return false;
                }
            });
        });
 
        var standalone = window.navigator.standalone,
            userAgent = window.navigator.userAgent.toLowerCase(),
            safari = /safari/.test( userAgent ),
            ios = /iphone|ipod|ipad/.test( userAgent ),
            ver = '';
            if(ios) {
                ver = (navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0].replace("OS ","");
            }
        let scanner = new Instascan.Scanner({ video: document.getElementById('preview'), scanPeriod: 5 ,mirror: false});
 
        function filljsQR(content) {
            console.log(content+'~'+j$("#QRType").val() );
            if (j$("#QRType").val() == 2) {
                filljsQR2(content);
            } else {
                filljsQR1(content);
            }
        }
 
        scanner.addListener('scan', function (content) {
            filljsQR(content)
        });
 
        function qrsacn(t) {
            j$("#QRType").val(t);
            if (!standalone && !safari && ios) {
                window.location.href="sfqr://scan";
            } else {
                j$(".modal").show();
                Instascan.Camera.getCameras().then(function (cameras) {
                  if (cameras.length > 0) {
                    if (ver >= 13) {
                        scanner.start(cameras[1]);
                    } else {
                        // scanner.start(cameras[0]);
                        // 20231105 zq 设置摄像头 start
                        if(cameras.length > 1){
                            scanner.start(cameras[1]);
                        }else{
                            scanner.start(cameras[0]);
                        }
                        // 20231105 zq 设置摄像头 end
                    }
                  } else {
                    console.error('No cameras found.');
                  }
                }).catch(function (e) {
                  // console.error(e);
                  console.log(e);
                });
            }
        }
 
        function stopScan() {
            try{
                scanner.stop().then(function () {
                    j$(".modal").hide();
                });
                j$("#scanedqr").children().remove();
            } catch (error) {
                j$(".modal").hide();
                j$("#scanedqr").children().remove();
            }
        }
    </script>
</apex:page>