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
<!--仿EquipmentSetShippmentReceived6.page-->
<apex:page Controller="ReceivingNoteAcceptanceController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="收货清单清点" docType="html-5.0" lightningStylesheets="true">
<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.EquipmentSetShippmentReceivedcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.sldsMy)}"/><!-- 20230925 ljh lightning -->
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilColorCss)}"/><!-- 20230619 ljh lightning  -->
 
<apex:stylesheet value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.js')}"/>
<script type="text/javascript">
function showConfirm(message, okhandler, errorhandler) {
    j$.confirm({
            title: '确认',
            content: message,
            boxWidth: '50%',
            useBootstrap: false,
            buttons: {
                OK: function () {
                    okhandler();
                },
                cancel: {
                    text: '取消', // With spaces and symbols
                    action: function () {
                        errorhandler();
                    }
                }
            }
        });
}
function savejs() {
    var dateInputs = j$("input[name$=PeriodOfUse_Final__c");
    var changedList = new Array();
    for(var i = 0 ; i < dateInputs.length ; i++) {
        var j = dateInputs[i].id.split(':')[3];
        var dateBefore = document.getElementById('allPage:allForm:esdList:' + j + ':PeriodOfUse_Old_F__c').textContent
        if (dateBefore != dateInputs[i].value && dateInputs[i].value != '') {
            changedList.push(j$("div.menu ul")[j].getAttribute('data-model'));
        }
    }
    if(changedList.length > 0) {
        showConfirm('是否确认修改 ' + changedList.toString() + ' 的使用期限?',
            function(){
                blockme();
                save();
            },
            function(){}
        )
    }
    else {
        blockme();
        save();
    }
}
 
function filljs1() {
    j$('input:checkbox:checked').each(function(){
        j$('ul[data-sumId="'+j$(this).data("rnid")+'"]').find('li.item-1').find('select').val('OK').change();
    })
    
}
 
function filljsQR1(qrcode) {
    blockme();
    if (qrcode.substr(-8,3) == '250') qrcode = qrcode.slice(0,-8);
    var select1 = j$("[data-qr='"+qrcode+"'],[data-bar^='"+qrcode+"']").data('sumid');
    j$('input:checkbox[data-rnId="'+select1+'"]').prop("checked",true);
 
    unblockUI();
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
}
 
function filljsQR2(qrcode, setId) {
}
 
function checkAll() {
    j$('input[name$="checkedRN"]:visible').prop("checked",true);
}
 
function changeAccessory() {
    console.log('附属品事件---------');
    // event.target.blur()
    var checkedRN = j$("input[name$='checkedRN']:checked");
    if(checkedRN.length>0){
        let fstid = checkedRN.first().data('fsid');
        let sameflg = true;
        checkedRN.each(function() {
            sameflg = (j$(this).data('fsid') === fstid) && sameflg;
        })
        if (!sameflg) {
            alert("不能同时调整不同备品配套的一览数据!"); 
            return;
        }
        console.log('allen附属品事件---------'+checkedRN);
 
        let sid = '';
        for (var i = 0; i < checkedRN.length; i++) {
            if(i == 0){
                sid += checkedRN[i].dataset["rnid"];
            }
            else{
                sid += ','+checkedRN[i].dataset["rnid"];
            }
        }
        window.location.href = '/apex/ReceivingNoteDetailSelect?sids='+sid+'&returl='+encodeURIComponent(window.location.href);
    }
    else{
        alert("请勾选配套一览!");
    }
}
 
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" ;
    }
    resetDetailDivMargintop();
}
 
function checkMessage() {
    if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
        alert("保存完了");
    }
}
 
function toggleSerialNumberInputBox(ele){
    var inputbox_serial = j$(ele).parent().parent().find('input[name$="serialNumberfix"]');
    inputbox_serial.removeClass("disableInput");
}
 
</script>
<style type="text/css">
    .menu div.m_title{
        border-top-left-radius:10px;
        border-top-right-radius:10px;
        text-align: left;
        margin: 0;
        /* lightning改造   zyh   start */
        /* padding: 1%; */
        /* width: 98%; */
        /* background:#DCDCDC; */
        background:#DCDCDC;
        padding-left: 0.75rem;
        /* lightning改造   zyh   end */
        position: relative;
    }
    .checkintitle{
        position:absolute;
        right:10px;   
    }
    input.disableInput[type="text"] {
        pointer-events: none;
        background-color: #8c8c8c5b;
    }
    .dateFormat {
        display: none;
    }
    #Step_tab {
        list-style-type: none;
        padding: 0;
        margin: 0;
        height: 31px;
        border-bottom: 5px solid #3b5998;
    }
    #Step_tab li {
        position: relative;
        /* lightning改造   zyh   start */
        /* width: 20%; */
        width: 50%;
        /* lightning改造   zyh   end */
        float: left;
        margin: 0;
        padding: 0;
        text-align: center;
        cursor: pointer;
        /* lightning改造   zyh   start */
        /* height: 25px; */
        height: 30px;
        line-height: 30px;
        /* lightning改造   zyh   end */
    }
    #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.menu{
        /* lightning改造   zyh   start */
        /* margin-bottom: 20px;  */
        margin-bottom: 2px; 
        /* width: 490px; */
        /* lightning改造   zyh   end */ 
    }
 
    hr {
        border-top: 2px dotted #f00;
        color: #fff;
        background-color: #fff;
        height: 1px;
        /* lightning改造   zyh   start */
        /* width: 90%; */
        width: 98%;
        /* lightning改造   zyh   end */ 
    }
    .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;
 
    }
    .menu{
        border:1px solid #a1a1a1;
        border-radius:10px;
        /* lightning改造   zyh   start */
        /* width: 400px; */
        /* lightning改造   zyh   end */ 
    }
    .menu li .fieldname {
        width: 30%;
        text-align: right;
        float: left;
    }
    .menu li .fieldvalue{
        width: 30%;
        text-align: left;
        margin-left: 10px;
 
    }
    .menu li {
        vertical-align: middle;
        margin: 5px 0;
    }
    .commandbutton{
        width: 110px !important;
        margin-left: 20px !important;
    }
    div.freezehander{
        /* lightning改造   zyh   start */
        /* width:500px; */
        /* lightning改造   zyh   end */
    }
    .titleCheckbox[type="checkbox"]{
        margin-bottom: 4px;
        margin-right: 0;
        margin-left: 10px;
    }
 
</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>
<apex:form id="allForm">
    <apex:actionFunction name="save" action="{!save}" rerender="allForm" onComplete="unblockUI();checkMessage();resetDetailDivMargintop();" />
    <apex:inputHidden value="{!done_flg}" id="done_flg"/>
    <div id="main" style="margin-bottom:20px;">
        <input type="hidden" id="QRType" value="1"/>
        <input type="hidden" id="QRTypeID" value=""/>
        <div id="hander" class="freezehander">
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
            <!-- lightning改造   zyh   start --> 
            <!-- <div style="text-align: right;margin-top: 10px;">
                <apex:commandButton styleClass="commandbutton" onclick="savejs();" value="保存" rerender="dummy" disabled="{!saveBtnDisabled}"/>
            </div>
            <apex:outputText id="saveBtnDisabled" value="{!saveBtnDisabled}" style="display: none;"/> -->
            <!-- <apex:outputText value="(出库指示后取消)" style="color:red;" rendered="{!IF(SR_status='Received' && es.cancel_after_loaner_arranged__c, true, false)}"/> -->
            <!-- <table style="border-collapse: collapse; font-size:13px;">
                <colgroup>
                    <col width="150" />
                    <col width="170" />
                </colgroup>
                <tr> -->
                    <!-- 状态切换btn -->
                    <!-- <th colspan="2" style="font-size:20px;text-align: center;width:500px;">
                        <ul id="Step_tab">
                            <li class="selected"><span class="tabsize">清点</span></li>
                        </ul>
                    </th>
                </tr>
            </table>
            <div style="text-align: right;margin-bottom: 20px;">
                <apex:commandButton styleClass="commandbutton" onclick="changeAccessory()" value="附属品调整" rerender="dummy"/>
                <apex:commandButton styleClass="commandbutton" onclick="qrsacn()" value="扫一扫" rerender="dummy"/>
                <apex:commandButton styleClass="commandbutton" onclick="checkAll();" value="全选" rerender="dummy" />
                <apex:commandButton styleClass="commandbutton" onclick="filljs1();" value="全部OK" rerender="dummy"/>
            </div> -->
            <apex:pageBlock id="btn" >
                <table style="border-collapse: collapse; font-size:13px; margin-bottom:10px;">
                    <colgroup>
                        <col width="20%" />
                        <col width="60%" />
                        <col width="20%" />
                    </colgroup>
                    <tr>
                        <th style="font-size:20px;text-align: center;width:280px;">
                            <ul id="Step_tab">
                                <li class="selected"><span class="tabsize">清点</span></li>
                            </ul>
                        </th>
                        <th >
                            <!-- onclick="changeAccessory()"width="1900px;" style="display:none"  styleClass="commandbutton"-->
                            <apex:commandButton id="test" value="空" style=" width: 1px;height: 1px;margin: 0;padding: 0;border: 0" rerender="dummy"/>
                            <apex:commandButton onclick="changeAccessory()" value="附属品调整" rerender="dummy"/>
                            <apex:commandButton onclick="qrsacn()" value="扫一扫" rerender="dummy"/>
                            <apex:commandButton onclick="checkAll();" value="全选" rerender="dummy" />
                            <apex:commandButton onclick="filljs1();" value="全部OK" rerender="dummy"/>
                            <apex:commandButton onclick="savejs();" value="保存" rerender="dummy" disabled="{!saveBtnDisabled}"/>
                        </th>
                        <!--  【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc Start style=" width:280px; text-align: right;margin-bottom: 20px;" style="padding: 6px;font-size: 110%;"margin-right: 1px;-->
                        <th >
                            <apex:commandButton id="maqCodeBtn"  onclick="document.getElementById('maqCode').focus();return false" value="码枪扫描:" style="margin-left: -110px" />
                            <input   id="maqCode" name="maqCode" style="height:30px;margin: 0 auto;" type="text" onkeydown="onKeyPress001(event)"/> 
                            <!-- autofocus="autofocus"   -->
                            <apex:outputPanel id="checkResult"></apex:outputPanel>
                        </th>
                        <!--  【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc End -->
                    </tr>
                </table>
            </apex:pageBlock>
        </div>
        <apex:outputPanel id="detail">
 
        <div id="detailDiv" class="detail">
            <apex:variable var="indexloop" value="{!0}" />
            <apex:variable var="SetName" value="" />
            <apex:variable var="main_loc" value="" />
 
            <apex:repeat value="{!esdList}" var="esdInfo" id="esdList">
                <!-- <apex:outputPanel rendered="{!IF(SetName=esdInfo.rnd.ReceivingNoteSummary__r.Id,false,true)}"> -->
                <!-- <div style="margin-bottom: -20px;display: {!IF(SetName=esdInfo.rnd.ReceivingNoteSummary__r.Id,'none','block')}"> --> 
                <div style="display: {!IF(SetName=esdInfo.rnd.ReceivingNoteSummary__r.Id,'none','block')}">
                    <apex:outputPanel rendered="{!IF(indexloop=0,false,true)}">
                        <hr/>
                    </apex:outputPanel>
                    <label style="font-size: 14px;font-weight: bold;" >
                        <apex:outputPanel rendered="{!esdInfo.rnd.ReceivingNoteSummary__r.Package_Status__c=='OK'}">
                            <apex:inputCheckbox id="checkedRN" styleClass="titleCheckbox" value="{!esdInfo.isChecked}" html-data-rnId="{!esdInfo.rnd.ReceivingNoteSummary__c}" html-data-fsId="{!esdInfo.rnd.Fixture_Set_Detail__r.Fixture_Set__c}"/>
                        </apex:outputPanel>
                        {!esdInfo.rnd.ReceivingNoteSummary__r.ReceivingNoteSummaryNo__c}
                        <!-- &nbsp;{!esdInfo.rnd.ReceivingNoteSummary__r.ReceivingNoteSummaryNo__c} -->
                    </label>
                    <apex:variable var="SetName" value="{!esdInfo.rnd.ReceivingNoteSummary__r.Id}" />
                    <apex:variable var="indexloop" value="{!indexloop+1}"/>
                </div>
                <!-- </apex:outputPanel> -->
                <!-- <br /> -->
 
 
                <apex:outputPanel layout="none" rendered="true" >
                    <!-- <br/> -->
                    
                    <div class="menu">
                        
                        <div class="m_title">
                            <apex:outputPanel layout="none" rendered="{!IF(esdInfo.rnd.Change_Point__c = null, TRUE, FALSE)}" >
                                <h2><apex:outputField value="{!esdInfo.rnd.Product_Name_F__c}"/></h2>
                            </apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!IF(esdInfo.rnd.Change_Point__c = null, FALSE, TRUE)}" >
                                <h2 style="color: red;"><apex:outputField value="{!esdInfo.rnd.Product_Name_F__c}"/>&nbsp;&nbsp;<apex:outputField value="{!esdInfo.rnd.Change_Point__c}"/></h2>
                            </apex:outputPanel>
                            <!-- <apex:inputCheckbox styleClass="checkintitle" value="{!}"/> -->
 
                        </div>
                        
                        <ul data-sumId="{!esdInfo.rnd.ReceivingNoteSummary__c}" data-model="{!IF(esdInfo.rnd.Fixture_Arrival_Process__c=='变体',esdInfo.rnd.Fixture_Arrival_Product__r.Fixture_Model_No_T__c, esdInfo.rnd.Fixture_Model_No_F__c)}">
                            <li>
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">明细No.</span> -->
                                <span class="fieldvalue">明细No.</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue" style="width: 65%;">{!esdInfo.rnd.ReceivingNoteDetailNo__c}</span>
                            </li>
                            <li style="{!IF(ISBLANK(esdInfo.rnd.Fixture_Arrival_Process__c),'display: none;','')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">备品入库处理</span> -->
                                <span class="fieldvalue">备品入库处理</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue" style="width: 65%;">{!esdInfo.rnd.Fixture_Arrival_Process__c}</span>
                            </li>
                            <li style="{!IF(esdInfo.rnd.Fixture_Arrival_Process__c == '变体','','display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">备品入库产品</span> -->
                                <span class="fieldvalue">备品入库产品</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue" style="width: 65%;">{!esdInfo.rnd.Fixture_Arrival_Product__r.Name}</span>
                            </li>
                            <li>
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">规格</span> -->
                                <span class="fieldvalue">规格</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue">{!esdInfo.rnd.Packing_list_Fixture_F__c}</span>
                            </li>
                            <li style="{!IF(esdInfo.rnd.unknow_serial_NO_product__c = 'TRUE', '', 'display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">无机身号码设备</span> -->
                                <span class="fieldvalue">无机身号码设备</span>
                                <!-- lightning改造   zyh   end -->
                                <apex:outputText styleclass="fieldvalue" id="isNoSerialNumber" value="{!esdInfo.rnd.unknow_serial_NO_product__c}" />
                            </li>
                            <li style="{!IF(esdInfo.rnd.unknow_serial_NO_product__c = 'TRUE', '', 'display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">机身编码</span> -->
                                <span class="fieldvalue">机身编码</span>
                                <!-- lightning改造   zyh   end -->
                                <apex:outputText styleClass="fieldvalue" value="{!esdInfo.rnd.SerialNumber_F__c}"/>
                            </li>
                            <li style="{!IF(esdInfo.rnd.unknow_serial_NO_product__c != 'TRUE', '', 'display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">机身编码</span> -->
                                <span class="fieldvalue">机身编码</span>
                                <!-- lightning改造   zyh   end -->
                                <apex:inputHidden value="{!esdInfo.rnd.unknow_serial_NO_product__c}" />
                                <apex:outputText styleClass="fieldvalue" value="{!esdInfo.rnd.SerialNumber_Origin__c}"/>
                                <apex:outputPanel rendered="{!esdInfo.canChange==true}" layout="none">
                                    <!-- <input type="button" onclick="toggleSerialNumberInputBox(this)" value="修改"/> -->
                                    <apex:commandButton styleClass="commandbutton" onclick="toggleSerialNumberInputBox(this)" value="修改" rerender="dummy"/>
                                </apex:outputPanel>
                            </li>
                            <li style="{!IF(esdInfo.rnd.unknow_serial_NO_product__c != 'TRUE', '', 'display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">机身编码(更新)</span> -->
                                <span class="fieldvalue">机身编码(更新)</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue"><apex:inputField id="serialNumberfix" styleclass="disableInput" value="{!esdInfo.rnd.SerialNumber__c}" /></span>
                            </li>
                            <li style="{!IF(esdInfo.rnd.Asset_loaner_category_F__c != '耗材','','display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">使用期限(修改前)</span> -->
                                <span class="fieldvalue">使用期限(修改前)</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue"> <apex:outputField id="PeriodOfUse_Old_F__c" value="{!esdInfo.rnd.PeriodOfUse_Old_F__c}" /> </span>
                            </li>
                            <li style="{!IF(esdInfo.rnd.Asset_loaner_category_F__c != '耗材','','display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">使用期限(修改后)</span> -->
                                <span class="fieldvalue">使用期限(修改后)</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue">
                                    <apex:inputField id="PeriodOfUse_Final__c" value="{!esdInfo.rnd.PeriodOfUse_Final__c}" rendered="{!esdInfo.canChange==true}" />
                                    <apex:outputField value="{!esdInfo.rnd.PeriodOfUse_Final__c}" rendered="{!esdInfo.canChange==false}"  />
                                </span>
                            </li>
                            <li style="{!IF(esdInfo.rnd.Asset_loaner_category_F__c == '耗材','','display: none;')}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">使用期限</span> -->
                                <span class="fieldvalue">使用期限</span>
                                <!-- lightning改造   zyh   end -->
                                <span class="fieldvalue"> <apex:outputField value="{!esdInfo.rnd.PeriodOfUse__c}" /> </span>
                            </li>
                            <li class="item-1" data-qr="{!esdInfo.rnd.Fixture_QRCode_F__c}" data-bar="{!esdInfo.rnd.Barcode_F__c}" data-sumId="{!esdInfo.rnd.ReceivingNoteSummary__c}">
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">清点结果</span> -->
                                <span class="fieldvalue" id="resultvalue">清点结果</span>
                                <!-- lightning改造   zyh   end -->
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==false}" >
                                   <span class="fieldvalue"><apex:outputField value="{!esdInfo.rnd.AcceptanceResult__c}"/></span>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==true}" >
                                   <span class="fieldvalue"><apex:inputField value="{!esdInfo.rnd.AcceptanceResult__c}"/></span>
                                </apex:outputPanel>
                            </li>
                            <li>
                                <!-- lightning改造   zyh   start -->
                                <!-- <span class="fieldname">清点备注</span> -->
                                <span class="fieldvalue">清点备注</span>
                                <!-- lightning改造   zyh   end -->
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==false}" >
                                   <span class="fieldvalue"><apex:outputField value="{!esdInfo.rnd.AcceptanceComments__c}"/></span>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==true}" >
                                   <span class="fieldvalue"><apex:inputField value="{!esdInfo.rnd.AcceptanceComments__c}"/></span>
                                </apex:outputPanel>
                            </li>
 
                            <!--  【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc Start -->
                            <li class="item-2">
                                <!-- <span class="fieldname">barcode编码对比 -->
                                <span class="fieldvalue">barcode编码对比
                                    <apex:inputhidden value="{!esdInfo.rnd.RNDAssert__r.Barcode__c}" />
                                </span>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==false}" >
                                   <span class="fieldvalue"><apex:outputField value="{!esdInfo.rnd.Barcode_Check_Result__c}"/></span>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==true && esdInfo.rnd.RNDAssert__r.Barcode__c = ''}" >
                                   <span class="fieldvalue">无</span>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!esdInfo.canChange==true && esdInfo.rnd.RNDAssert__r.Barcode__c != ''}" >
                                   <span class="fieldvalue"><apex:inputField id="barcode" value="{!esdInfo.rnd.Barcode_Check_Result__c}"/></span>
                                </apex:outputPanel>
                            </li>
                            <!--  【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc End -->
                        </ul>
                    </div>
                </apex:outputPanel>
 
            </apex:repeat>
        </div>
        </apex:outputPanel>
    </div>
    <script type="text/javascript">
        // lightning改造   zyh   start
        // var standalone = window.navigator.standalone,
        //     userAgent = window.navigator.userAgent.toLowerCase(),
        //     safari = /safari/.test( userAgent ),
        //     ios = /iphone|ipod|ipad/.test( userAgent ),
        //     ver = (navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0].replace("OS ","");
        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 ","");
            }
        // lightning改造   zyh   end
        let scanner = new Instascan.Scanner({ video: document.getElementById('preview'), scanPeriod: 5 ,mirror: false});
 
        function filljsQRC(content) {
            if (j$("#QRType").val() == 2) {
                console.log('j$("#QRTypeID").val()',j$("#QRTypeID").val());
                filljsQR2(content, j$("#QRTypeID").val());
            } else {
                filljsQR1(content);
            }
        }
        scanner.addListener('scan', function (content) {
            filljsQRC(content);
        });
        
        async function qrsacn() {
            j$("#QRType").val(1);
            console.log('11111',j$("#QRType").val(1));
            if (!standalone && !safari && ios) {
                window.location.href="sfqr://scan";
            } else {
                j$(".modal").show();
                await 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);
                // });
            }
        }
 
        function qrsacn2(setId) {
            j$("#QRType").val(2);
            j$("#QRTypeID").val(setId);
            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);
                });
            }
        }
 
        function stopScan() {
            scanner.stop().then(function () {
                j$(".modal").hide();
            });
            j$("#scanedqr").children().remove();
        }
        
        j$(document).ready(function(){
            j$( '#qrcode' ).unbind();
            j$( '#qrcode' ).keypress( function ( e ) {
                if ( e.which == 13 ) {
                    console.log('进入---------------');
                    console.log(j$( '#qrcode' ).val());
                    filljsQRC(j$( '#qrcode' ).val());
                    return false;
                }
            });
        });
 
        // document.addEventListener('keydown', function(event) {
        // if (event.keyCode === 13) { // 如果按下的是回车键
        //     var input = document.getElementById('maqCode'); // 获取要触发点击事件的按钮
        //     onKeyPress(event) // 触发按钮的点击事件
        // }
        // });
 
        // 【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc Start
        function onKeyPress001(e) {
            var keyCode = null;
            if(e.which)
                keyCode = e.which;
            else if(e.keyCode)
                keyCode = e.keyCode;
            // 先清除上一次的校验结果
            document.getElementById("allPage:allForm:btn:checkResult").innerHTML = '';            
            if(keyCode == 13) {
                //拿到当前输入code
                var nowCode = j$( '#maqCode' ).val();
                console.log(nowCode);
                if(nowCode != null && nowCode != ''){
                    filljsQR(nowCode);
                }
                nowCode = '';
                j$("#maqCode").val("");
                j$("#maqCode").focus();
                return true;
            }
            return false;
        }
 
        function filljsQR(content) {
            try {
                var checkResultFlag = false;
                let indexNum = 0;
                j$('div[class="menu"]').each(function(){
                    // 拿到保有设备上的Barcode
                    var existCode;
                    // 单个配套和多个配套的取值方法不一样,此处做两种方法的区分
                    if (j$('div[class="menu"]').size() <= 1) {
                        var existCodeList=[j$('div[class="menu"]').find('li.item-2').find('input').value()];  
                        existCode = existCodeList[indexNum];
                    } else {
                        existCode = j$('div[class="menu"]').find('li.item-2').find('input').value()[indexNum];
                    }
                    console.log('content',content);
                    console.log('existCode',existCode);
                    // 码枪入力的结果和系统中的对比
                    if (existCode != '' ) {
                        if(content == existCode){
                            //因为input 和select的数量不匹配,没办法用相对写法来设置,此处使用硬代码,后续修改时亲注意j_id116可能会发生变化
                            //j$('div[class="menu"]').find('li.item-2').find('select')[indexNum].val('OK').change();
                            //拿到需要显示结果的位置  allPage:allForm:esdList:0:j_id116
                            document.getElementById('allPage:allForm:esdList:' + indexNum + ':barcode').value = 'OK';
                            // showDiv.innerHTML = '<output style="color:green;">OK</output>';
                            checkResultFlag = true;
                        }
                        // else{
                        //     // showDiv.innerHTML = '<output style="color:red;">NG</output>';
                        //     document.getElementById('allPage:allForm:esdList:' + indexNum + ':barcode').value = 'NG';
                        // }   
                    }
                    
                    indexNum++;
                })
                var showDiv = document.getElementById("allPage:allForm:btn:checkResult");
                if (checkResultFlag) {
                    showDiv.innerHTML = '<output style="color:green;">OK</output>';
                } else {
                    showDiv.innerHTML = '<output style="color:red;">NG</output>';
                }
                return;
            } catch (e) {
                // alert("发生异常:" + e);
                console.log("发生异常:" + e);
            }
        } 
        // 【P1】UDI编码加入到新品收货功能中与BARCODE的比对 DB202306207904 20230711 by lc End
    </script>
</apex:form>
</apex:page>