<!-- <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() {
    j$('select[name$="checkLost"]').val("OK");
    j$('select[name$="checkLost2"]').val("OK");
    // 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)
        }
        j$(this).parent().find('[name$="lostMemo"]').prop('disabled',true)
        j$(this).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>