| <apex:page controller="TransferAgencyShipmentController" showHeader="false" sidebar="false" id="allPage" action="{!init}" 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 */ | 
|     } | 
|   | 
|     /* Modal Content/Box */ | 
|     .modal-content { | 
|        background-color: #fefefe; | 
|        margin-left: -100px; | 
|        margin-top: 100px; | 
|        padding: 20px; | 
|        border: 1px solid #888; | 
|        left: 50%; | 
|        position: absolute; | 
|        width: 200px; | 
|     } | 
|     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); | 
|     } | 
|     else{ | 
|         var qrtag = j$("input[name=qrcode][value='"+qrcode+"']"); | 
|         if(qrtag == undefined) { | 
|             return; | 
|         } | 
|         if(qrtag.size() > 1) { | 
|             alert("数量管理附属品请手动打勾!"); | 
|         } | 
|         else if(qrtag.size() == 1) { | 
|             box = qrtag.siblings("input[type=checkbox]")[0]; | 
|             box.checked = true; | 
|             checkOnetoOne(box); | 
|         } | 
|     } | 
|     j$("#scanedqr").append("<li>"+qrcode+"</li>"); | 
|     j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000); | 
|     unblockUI(); | 
| } | 
| function savejs() { | 
|     blockme(); | 
|     var saveable = true; | 
|     j$("input[name$='inspectionResult']:checked").each(function() { | 
|         if (j$(this).parent().children("[name='onetoone']").size() > 0) { | 
|             var val = j$(this).parent().children("[name='onetoone']").val(); | 
|             if (j$("input[name='onetoone_main'][value='"+val+"']").size() == 0) { | 
|                 saveable = false; | 
|             } else { | 
|                 if (j$("input[name='onetoone_main'][value='"+val+"']").parent().children("[name$='inspectionResult']").attr("checked") != "checked") { | 
|                     saveable = false; | 
|                 } | 
|                 var stockdown = j$("input[name='onetoone_main'][value='"+val+"']").parent().find("[name='onetoone_main_down']").val(); | 
|                 if (stockdown == 'true') saveable = true; | 
|             } | 
|         } | 
|     }) | 
|     if (saveable) { | 
|         stockDown(); | 
|         j$("input#checker").attr('checked',false) | 
|     } else { | 
|         alert("一对一分配附属品不能单独下架!") | 
|         unblockUI(); | 
|     } | 
| } | 
|   | 
| function checkAll(isChecked) { | 
|     j$("table input.rowchkcls[type=checkbox]:enabled").each(function(){ | 
|         this.checked = isChecked; | 
|         if(isChecked) { | 
|             checkOnetoOne(this, true); | 
|         } | 
|     }) | 
| } | 
| var globalChecked = false; | 
| function checkGlobal() { | 
|     globalChecked = !globalChecked; | 
|     j$("table input[type=checkbox]").each(function(){ | 
|         if(this.getAttribute('class')=='rowchkcls' && this.getAttribute('disabled') == 'disabled' ) { | 
|         } | 
|         else { | 
|             this.checked = globalChecked; | 
|         } | 
|     }) | 
| } | 
| function checkOnetoOne(box, ischk) { | 
|     if(ischk) { | 
|         j$(box).parent().parent().find("td.col_StockDown__c input")[0].checked = true; | 
|     } | 
|     else { | 
|         j$(box).parent().parent().find("td.col_chk input")[0].checked = true; | 
|     } | 
|     var tasIdTag = j$(box).parent().parent().children("td.col_StockDown__c").children("input[name=onetoone_main]"); | 
|     if(tasIdTag.size() > 0) { | 
|         var tasId = tasIdTag.val(); | 
|         // 同一个一览下的一对一附属品下架打勾 | 
|         j$("input[type=hidden][value="+tasId+"]").each(function(){ | 
|             j$(this).siblings("input[type='checkbox']").prop('checked', box.checked); | 
|         }); | 
|     } | 
| } | 
|   | 
| </script> | 
| <div id="myModal" class="modal"> | 
|   <!-- Modal content --> | 
|   <div class="modal-content"> | 
|     <span class="close" onclick="stopScan()">×</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" styleclass="pbBody"> | 
|     <apex:actionFunction name="stockDown" action="{!stockDown}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();"/> | 
|     <apex:actionFunction name="searchSlip" action="{!searchSlip}" reRender="allForm" onComplete="unblockUI();checkMessage();checEventFrame();" /> | 
|     <apex:inputHidden value="{!done_flg}" id="done_flg"/> | 
|     <apex:inputHidden value="{!readOnly}" id="readOnly"/> | 
|     <apex:pageBlock id="searchBlock" tabStyle="Report" title="下架/发货"> | 
|         <apex:pageBlockButtons location="top"> | 
|             <apex:commandButton value="全选/取消全选" onclick="checkGlobal(); return false;" disabled="{!readOnly}"/> | 
|             <apex:commandButton value="扫一扫" onclick="qrscan(0);return false;" disabled="{!readOnly}"/> | 
|             <apex:commandButton value="下架" onclick="savejs(); return false;" rerender="allForm" disabled="{!readOnly}"/> | 
|             <apex:commandButton value="保存物流信息" action="{!saveSlip}" onclick="blockme();" rerender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> | 
|             <apex:commandButton value="发货" action="{!shipment}" onclick="blockme();" reRender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> | 
|             <apex:commandButton value="取消明细" action="{!cancelDetail}" onclick="blockme();" reRender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> | 
|         </apex:pageBlockButtons> | 
|         <apex:pageBlockSection > | 
|             <apex:pageBlockSectionItem > | 
|                 <apex:outputLabel value="{!$ObjectType.TransferApply__c.fields.Name.Label}"/> | 
|                 <apex:outputText value="{!apply_no}"/> | 
|             </apex:pageBlockSectionItem> | 
|             <apex:pageBlockSectionItem /> | 
|             <apex:pageBlockSectionItem > | 
|                 <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Name.Label}"/> | 
|                 <apex:outputPanel > | 
|                     <apex:inputField value="{!slip.Name}" id="SlipNo"/> | 
|                     <apex:commandButton value="扫运输单" onclick="qrscan(1);return false;" disabled="{!readOnly}"/> | 
|                     <apex:commandButton value="检索" onclick="blockme();searchSlip(); return false;" disabled="{!readOnly}"/> | 
|                 </apex:outputPanel> | 
|             </apex:pageBlockSectionItem> | 
|             <apex:pageBlockSectionItem > | 
|                 <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryType__c.Label}"/> | 
|                 <apex:inputField value="{!slip.DeliveryType__c}" id="deliveryType"/> | 
|             </apex:pageBlockSectionItem> | 
|             <apex:pageBlockSectionItem > | 
|                 <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Distributor_method__c.Label}"/> | 
|                 <apex:inputField value="{!slip.Distributor_method__c}" id="distributorMethod"/> | 
|             </apex:pageBlockSectionItem> | 
|             <apex:pageBlockSectionItem > | 
|                 <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryCompany__c.Label}"/> | 
|                 <apex:inputField value="{!slip.DeliveryCompany__c}" id="deliveryCompany"/> | 
|             </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="{!!readOnly}"/> | 
|                     <apex:outputField value="{!slip.Wh_Staff__c}" styleClass="hideDropdown" rendered="{!readOnly}"/> | 
|                 </apex:outputPanel> | 
|             </apex:pageBlockSectionItem> | 
|         </apex:pageBlockSection> | 
|     </apex:pageBlock> | 
|     <apex:outputPanel id="message"> | 
|         <apex:pageMessages /> | 
|     </apex:outputPanel> | 
|     <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(this.checked);' id="checker"/> | 
|                 </td> | 
|                 <apex:repeat value="{!outputFieldList}" var="info"> | 
|                     <td class="col_{!info.value}"> | 
|                        {!info.label}{!IF(info.label=='下架','结果','')} | 
|                     </td> | 
|                 </apex:repeat> | 
|             </tr> | 
|         </table> | 
|     </div> | 
|     <apex:outputPanel id="detail"> | 
|         <div id="in_Div_L"> | 
|             <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableData_L"> | 
|                 <apex:variable value="{!0}" var="Cnt" /> | 
|                     <apex:repeat id="dataline_L" value="{!esdList}" var="esdInfo"> | 
|                         <tr class="" id="tableData_L_{!Cnt}"> | 
|                             <td class="dataCellBorder1 col_chk" align="center"> | 
|                                 <apex:inputCheckbox styleClass="rowchkcls" rendered="{!!esdInfo.rec.OneToOneAccessory__c}" | 
|                                 value="{!esdInfo.checked}" id="rowCheck" disabled="{!!esdInfo.editable}" | 
|                                 onchange="if(this.checked) {checkOnetoOne(this, true);}"/> | 
|                             </td> | 
|                             <apex:repeat value="{!outputFieldList}" var="info"> | 
|                                 <td class="dataCellBorder1 {!'col_' + info.value}"> | 
|                                     <apex:outputPanel layout="none" rendered="{!!esdInfo.editable || info.value!='StockDown__c'}"> | 
|                                         <apex:outputField value="{!esdInfo.rec[info.value]}" /> | 
|                                     </apex:outputPanel> | 
|                                     <apex:outputPanel layout="none" rendered="{!esdInfo.editable && info.value=='StockDown__c' }" > | 
|                                         <apex:outputField value="{!esdInfo.rec.StockDown__c}" rendered="{!!esdInfo.editable}"/> | 
|                                         <apex:inputField id="inspectionResult" value="{!esdInfo.rec[info.value]}" onclick="checkOnetoOne(this, false);" rendered="{!esdInfo.editable}"/> | 
|                                         <apex:outputPanel layout="none" rendered="{!esdInfo.rec.Main_OneToOne__c}"> | 
|                                             <input type="hidden" name="onetoone_main" value="{!esdInfo.rec.TransferApplySummary__c}"/> | 
|                                             <input type="hidden" name="onetoone_main_down" value="{!esdInfo.rec.StockDown__c}"/> | 
|                                         </apex:outputPanel> | 
|                                         <apex:outputPanel layout="none" rendered="{!esdInfo.rec.OneToOneAccessory__c}"> | 
|                                             <input type="hidden" name="onetoone" value="{!esdInfo.rec.TransferApplySummary__c}"/> | 
|                                         </apex:outputPanel> | 
|                                         <apex:outputPanel layout="none" rendered="{!!esdInfo.rec.OneToOneAccessory__c}"> | 
|                                             <input type="hidden" name="qrcode" value="{!esdInfo.rec.Fixture_QRCode_F__c}"/> | 
|                                         </apex:outputPanel> | 
|                                     </apex:outputPanel> | 
|                                 </td> | 
|                             </apex:repeat> | 
|   | 
|                         </tr> | 
|                     <apex:variable value="{!Cnt+1}" var="Cnt" /> | 
|                 </apex:repeat> | 
|             </table> | 
|         </div> | 
|     </apex:outputPanel> | 
|     <apex:outputPanel id="checEventFrame"> | 
|         <script> | 
|   | 
|   | 
|         </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; | 
|         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]); | 
|                 } | 
|               } 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 ) { | 
|                 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> |