高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
<apex:page controller="RentalFixtureSetAssignAgencyController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="办事处分配/发货">
<!-- 20210624 ljh update SFDC-C448GR --><!-- title="办事处分配/下架/发货" -->
    <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:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
<style type="text/css">
    .hideDropdown select{
        display: none
    }
    .modal {
       display:none;
       position: fixed; /* Stay in place */
       z-index: 10; /* Sit on top */
       left: 0;
       top: 0;
       width: 100%; /* Full width */
       height: 100%; /* Full height */
       overflow: auto; /* Enable scroll if needed */
       background-color: rgb(0,0,0); /* Fallback color */
       background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }
    span.dateFormat {
        display: none;
    }
 
    /* Modal Content/Box */
    .modal-content {
       background-color: #fefefe;
       margin-left: 6px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       right: 5%;
       position: absolute;
       width: 200px;
    }
    .modal-content-cancel {
       background-color: #fefefe;
       margin-left: -150px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       left: 50%;
       position: absolute;
       width: 300px;
    }
    table.list td{
        width:100px;
        border-width: 1px;
    }
    table.list td.col_chk {
        width:30px;
    }
    body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
        border-width: 1px;
    }
</style>
<script type="text/javascript">
function checkMessage() {
    if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
        alert("保存成功");
    }
}
function filljsQR(qrcode) {
    if(!qrcode) return;
    blockme();
    if(scanType == '1'){
        j$("input[name$='SlipNo']").val(qrcode);
    }
    //20210513 ljh 1829 add start
    else if(scanType.indexOf('2;') != -1){ 
        scanAndMatch(qrcode+';'+scanType);
    }
    //20210513 ljh 1829 add end
    else{
        scanAndMatch(qrcode);
    }
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
    unblockUI();
}
function checkAll() {
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(!this.disabled) {
            this.checked = j$("input#checker").prop('checked');
        }
    })
}
var globalChecked = false;
function checkGlobal() {
    globalChecked = !globalChecked;
    j$("table td.col_chk input[type=checkbox]:enabled").each(function(){
        this.checked = globalChecked;
    })
}
/**
20210707 SFDC-C448KZ you start
function cancelModalConfirm() {
    //检查取消理由和取消理由备注
    var reason = j$.trim(j$("select[name$=cancelReason]").val());
    var remark = j$.trim(j$("input[name$=cancelReasonRemark]").val());
    //20210420 ljh 1711 update start
    //if(reason == "" || remark == "") {
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    //20210420 ljh 1711 update end
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
**/
function cancelModalConfirm() {
   //检查取消理由和取消理由备注   cancle Reason Lcr
    var reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    var remark = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    var Lcr = j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).value();
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和备品申请取消理由不可为空!');
        j$("#errormessage").css('display', ''); 
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('一览取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }else if(remark == "其他" && Lcr =="") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
/**20210707 SFDC-C448KZ you end**/
 
function showCancelModal() {
    var hasChecked = false;
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(this.checked) {
            hasChecked = true;
        }
    })
    if(!hasChecked) {
        alert('未选择取消的一览!');
        return;
    }
    j$('#cancelModal').show();
    j$('#searchBlock1').show();
    
}
/** 20210707 SFDC-C448KZ you start**/
 function changeCancleReasonJs(){
    var Cancel_Reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    if(Cancel_Reason != '被动取消'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }    
}
function changeReasonJs(){
    var reason = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    if(reason != null && reason == '其他'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',false);
    }else{
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }    
}
/** 20210707 SFDC-C448KZ you end**/
</script>
<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: 60px; overflow: auto">
    </ul>
  </div>
</div>
 
<apex:form id="allForm" styleclass="pbBody">
    <!-- 20210624 ljh update SFDC-C448GR -->
    <!-- <apex:actionFunction name="stockDown" action="{!stockDown}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
    <apex:actionFunction name="scanAndMatch" action="{!scanAndMatch}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();">
        <apex:param name="firstParam" assignTo="{!qrcode}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="cancelSet" action="{!cancelSet}" rerender="allForm"  oncomplete="unblockUI();checkMessage();checEventFrame();j$('#cancelModal').hide();"/>
    <apex:actionFunction name="changeStep" rerender="allForm"  oncomplete="unblockUI();"/>
 
    <apex:inputHidden value="{!done_flg}" id="done_flg"/>
    <apex:inputHidden value="{!readOnly}" id="readOnly"/>
    <div id="cancelModal" class="modal">
        <div class="modal-content-cancel">
            <table>
                <tr>
                    <td colspan="2" align="center">
                        <apex:commandButton style="margin: 0 20px;" value="确定" onclick="cancelModalConfirm(); return false;" />
                        <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#errormessage').css('display', 'none');j$('#cancelModal').hide();return false;"/>
                    </td>
                </tr>
                <tr style="display: none;" id="errormessage">
                    <td colspan="2">
                        <span style="color: #F00; font-weight:bold"></span>
                    </td>
                </tr>
                <!--
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由"/>
                    </td>
                    <td>
                        <apex:selectList id="cancelReason" size="1" value="{!cancelReason}">
                            <apex:selectOption itemValue="" itemLabel="--无--"/>
                            <apex:selectOption itemValue="主动取消" itemLabel="主动取消"/>
                            <apex:selectOption itemValue="被动取消" itemLabel="被动取消"/>
                        </apex:selectList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由备注"/> 
                    </td>
                    <td>
                        <apex:inputText id="cancelReasonRemark" value="{!cancelReasonRemark}"/>
                    </td>
                </tr>
            -->
            <!--  20210707 SFDC-C448KZ you start-->
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                </td>
                <td>
                <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </td>
            </tr>            
            <tr rendered="true">
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                </td>
                <td>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </td>
            </tr>
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                </td>
                <td>
                 <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </td>
            </tr>
            <!--  20210707 SFDC-C448KZ you end-->
            <!--<tr>  20210707 SFDC-C448KZ you start-->
            <!-- <apex:pageBlock id="searchBlock1" tabStyle="Report">
            <apex:pageBlockSection title="备品借出申请一览取消" collapsible="false" id="cancle">
               <apex:pageBlockSectionItem id="CR">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                    <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </apex:pageBlockSectionItem>
                
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>              
                <apex:pageBlockSectionItem rendered="true" id="Reason">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem id="Lcr">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            </apex:pageBlock>   -->
            <!-- 20210707 SFDC-C448KZ you end
            </tr>--> 
            </table>
        </div>
    </div>
 
    <apex:pageBlock id="searchBlock" tabStyle="Report">
        <apex:pageBlockButtons location="top">
            预计出货日
            <apex:inputField id="rentalStartDate" value="{!parentObj.Asset_loaner_start_day__c}"/>
            <apex:commandButton value="适用" action="{!applyDate}" onclick="blockme();" reRender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            &nbsp; &nbsp;
            出库
            <apex:selectList size="1" value="{!stepName}" onchange="blockme();changeStep();return false;">
                <apex:selectOption itemValue="无" itemLabel="无"/>
                <apex:selectOption itemValue="分配" itemLabel="分配"/>
                <!-- 20210624 ljh update SFDC-C448GR -->
                <!-- <apex:selectOption itemValue="下架" itemLabel="下架"/> -->
                <apex:selectOption itemValue="发货" itemLabel="发货"/>
            </apex:selectList>
            &nbsp; &nbsp;
            <!-- 20210517 ljh update 1829 start -->
            <!-- <apex:commandButton value="扫一扫" onclick="qrscan();return false;" disabled="{!readOnly || stepName!='分配'}"/> -->
            <apex:commandButton value="扫一扫" onclick="qrscan(0);return false;" disabled="{!readOnly || stepName!='分配'}"/>
            <!-- 20210517 ljh update 1829 end -->
            <apex:commandButton value="分配" action="{!assign}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='分配'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            <!-- 20210624 ljh update SFDC-C448GR -->
            <!-- <apex:commandButton value="下架" action="{!stockdown}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='下架'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
            <apex:commandButton value="发货" action="{!shipment}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='发货'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            &nbsp; &nbsp;
            <apex:commandButton value="全选/取消全选" onclick="checkGlobal(); return false;" disabled="{!readOnly}"/>
            <apex:commandButton value="取消" onclick="showCancelModal(); return false;" disabled="{!readOnly}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="办事处分配">
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Name.Label}"/>
                <apex:outputField value="{!parentObj.Name}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="主单预计出货日"/>
                <apex:outputText value="{0,date, yyyy/MM/dd}">
                    <apex:param value="{!masterDate}"/>
                </apex:outputText>
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 start -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.demo_purpose2__c.Label}"/>
                <apex:outputField value="{!parentObj.demo_purpose2__c}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            &nbsp;&nbsp;&nbsp;&nbsp;
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 end -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Name.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Name}" id="SlipNo" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Name}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                    <apex:commandButton value="扫运输单" onclick="qrscan(1);return false;" disabled="{!NOT(slipEnabled && stepName == '发货')}"/>
                    <apex:commandButton value="检索" action="{!searchSlip}" onclick="blockme();" reRender="allForm" disabled="{!NOT(slipEnabled && stepName == '发货')}" oncomplete="unblockUI();checEventFrame();"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryType__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryType__c}" id="deliveryType" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryType__c}"  rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Distributor_method__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Distributor_method__c}" id="distributorMethod" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Distributor_method__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryCompany__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryCompany__c}" id="deliveryCompany" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryCompany__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Wh_Staff__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Wh_Staff__c}" styleClass="hideDropdown" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Wh_Staff__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add start-->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Delivery_Agency__c.Label}"/>
                <!-- 20210624 ljh update SFDC-C448GR start-->
                <!-- <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.StockDown_ng_num__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.StockDown_ng_num__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel> -->
                <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel>
                <!-- 20210624 ljh update SFDC-C448GR end-->
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem html-style="display: none;">
                <apex:inputField value="{!parentObj.SalesdeptSelect__c}"  style="display: none;" />
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add end-->
        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputPanel id="message">
        <apex:pageMessages />
    </apex:outputPanel>
 
    <apex:outputPanel id="detail">
    <div id="out_Div_L">
            <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L">
                <tr class="headerRow" height="30px">
                    <td class="col_chk" align="center">
                        全选 <input type='checkbox' onClick='checkAll();' id="checker"/>
                    </td>
                    <td> 申请型号 </td>
                    <td> 存放地 </td>
                    <td> 固定资产编号(Key) </td>
                    <td> 机身编号 </td>
                    <td> 预计出货日 </td>
                    <td style="{!IF(stepName='分配','background-color: #cfeef9','')}"> 分配 </td>
                    <!-- 20210624 ljh update SFDC-C448GR -->
                    <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}"> 下架 </td> -->
                    <td> 借出备品一览明细状态 </td>
                    <td> 备品分类 </td><!-- 20210508 ljh add 1672  -->
                    <td> 操作 </td> 
                    <!-- 20210510 ljh add 1829 -->
                </tr>
                <apex:variable value="{!0}" var="Cnt" />
                <apex:repeat id="dataline_L" value="{!esdList}" var="esdInfo">
                    <tr class="" id="tableData_L_{!Cnt}" style="{!IF(esdInfo.rec.AgencyTempCancel__c, 'display: none','')}">
                        <td class="dataCellBorder1 col_chk" align="center">
                            <apex:inputCheckbox styleClass="rowchkcls" rendered="{!esdInfo.rec.Is_Body__c}" value="{!esdInfo.checked}" id="rowCheck" disabled="{!!esdInfo.editable}" html-qrscan="{!esdInfo.rec.Rental_Apply_Equipment_Set__c}"/>
                            <!-- 20210514 ljh 1829 add html-qrscan -->
                        </td>
                        <td> <apex:outputText value="{!esdInfo.tempModel}"/> </td>
                        <td> {!esdInfo.tempLocation} </td>
                        <td> {!esdInfo.tempKey}</td>
                        <td> {!esdInfo.tempSerial} </td>
                        <td>
                            <apex:inputField value="{!esdInfo.rec.Rental_Apply_Equipment_Set__r.Rental_Start_Date__c}" rendered="{!esdInfo.editable && stepName=='分配'}"/>
                            <apex:outputText value="{0,date, yyyy/MM/dd}" rendered="{!NOT(esdInfo.editable && stepName=='分配')}">
                                <apex:param value="{!esdInfo.tempDate}"/>
                            </apex:outputText>
                        </td>
                        <td style="{!IF(stepName='分配','background-color: #cfeef9','')}">
                            {!esdInfo.tempStatus}
                        </td>
                        <!-- 20210624 ljh update SFDC-C448GR -->
                        <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}">
                            <apex:outputField value="{!esdInfo.rec.StockDown__c}"/>
                        </td> -->
                        <td> <apex:outputText value="{!esdInfo.tempDetailStatus}"/> </td>
                        <td> {!esdInfo.tempEquipmentType}</td>
                        <!-- 20210508 ljh add 1672  -->
                        <td>
                            <apex:commandButton rendered="{!esdInfo.rec.Is_Body__c}" value="分配代替品" onclick="qrscan('2;{!esdInfo.rec.Rental_Apply_Equipment_Set__c}');return false;" disabled="{!readOnly || esdInfo.IsCanSub || stepName != '分配'}"/>
                        </td>
                        <!-- 20210508 ljh add 1829  -->
                    </tr>
                    <apex:variable value="{!Cnt+1}" var="Cnt" />
                </apex:repeat>
            </table>
        </div>
    </apex:outputPanel>
    <apex:outputPanel id="checEventFrame">
        <script>
            checEventFrame();
        </script>
    </apex:outputPanel>
</apex:form>
<script type="text/javascript">
    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});
    scanner.addListener('scan', function (content) {
      filljsQR(content);
    });
 
    function qrscan(stype) {
        scanType = stype.toString();//20210518 ljh update toString 1829
        //20210514 ljh add 1829 start
        //console.log(scanType+':~'+scanType.indexOf('2;'));
        if(scanType.indexOf('2;') != -1){
            j$("input[type=checkbox][qrscan='"+scanType.split('2;')[1]+"']").prop("checked", true);
        }
        //20210514 ljh add 1829 end
        if (!standalone && !safari && ios) {
            window.location.href="sfqr://scan";
        } else {
            j$("#myModal").show();
            Instascan.Camera.getCameras().then(function (cameras) {
              if (cameras.length > 0) {
                if (ver >= 13) {
                    scanner.start(cameras[1]);
                } else {
                    scanner.start(cameras[0]);
                }
              } else {
                console.error('No cameras found.');
              }
            }).catch(function (e) {
              console.error(e);
            });
        }
    }
 
    function stopScan() {
        scanner.stop().then(function () {
            j$("#myModal").hide();
        });
        j$("#scanedqr").children().remove();
    }
    j$(document).ready(function(){
        j$( '#qrcode' ).unbind();
        j$( '#qrcode' ).keypress( function ( e ) {
            if ( e.which == 13 ) {
                filljsQR(j$( '#qrcode' ).val());
                return false;
            }
        });
    });
    function checEventFrame() {
        j$('select[name$="deliveryType"]').val('发货');
        j$('select[name$="deliveryType"]').prop('disabled', true);
        j$("input[name=onetoone]").siblings("input[type=checkbox]").each(function(){
            this.disabled = true;
        })
        if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
            j$("input#checker").attr('disabled', 'disabled');
        }
        else {
            j$("input#checker").removeAttr('disabled');
        }
        setTimeout(function() {
            j$('select[name$="distributorMethod"]').children('option[value="空运"]').remove();
            j$('select[name$="deliveryCompany"]').children('option[value="莱比特"],option[value="嘉里大通"]').remove();
            if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
                j$("input[type=text],select").each(function(){
                    this.disabled = true;
                })
            }
        }, 500);
 
    }
    // checEventFrame();
</script>
</apex:page>