<apex:page standardController="Maintenance_Product_Data__c" extensions="MaintenanceProductDataController" showHeader="false"   sidebar="true" id="allPage" action="{!init}" title="产品主数据维护" lightningStylesheets="true">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
<style type="text/css">
    .bPageBlock .detailList .dataCol{
    width:100%
    }
    .dateFormat  {
        display: none;
    }
    td.columuslowercolour {
        background-color:red;
        text-align: right;
    }
        td.columuscuperolour {
        background-color: yellow;
        text-align: right;
    }
    td.dataCol.first.last{
        width: 100%
    }
</style>
<script>
    function refreshPageSizeJs() {
        refreshPageSize();
    }    
    function searchProductJs() {
        blockme();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:mpdDetailsRecordsViewCount')).value();
        var isChanged = false;
        for (var i = 0; i < productCount; i++) {
            var nowChk = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked');
            var oldChk = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:proRowOldCheckbox')).attr('checked');
            if (nowChk != oldChk || nowChk == 'checked') {
                isChanged = true;
                break;
            }
        }

        searchMaintenanceProductDataDetails();
    }
    function ClearJs(){
        //blockme();
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:CateName')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:ProductCodeExt')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:GuranteeType')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:Category1')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:Category2')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:Category3')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:Category4')).val('');
        j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:Category5')).val('');
        //searchMaintenanceProductDataDetails();
    }
    var selectedSize = 0;
    var pageLimit = {!pageLimit};
    function checkAll() {
        selectedSize = 0;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
            //console.log(productCount);
            //var outer = 0;
            for (var i = 0; i < productCount; i++) {
                //outer = Math.floor(i / 1000);
                if(selectedSize >= pageLimit){
                    window.alert("页面所选数据不能超过200条");
                    return;
                }
                //canSelect
                var canSelect = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('disabled');
                if(canSelect !='disabled'){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked',true);
                    selectedSize ++;
                }
                //alert(selectedSize);
            }
        } else {
            //var outer = 0;
            for (var i = 0; i < productCount; i++) {
                //outer = Math.floor(i / 1000);
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked',false);
                //selectedSize --;
            }
        }
    }

    function CheckSize(j){
        var a = j.id;
        var productCount = j$(escapeVfId(a)).attr('checked');
        if (productCount == 'checked') {
            if(selectedSize >= pageLimit){
                window.alert("页面所选数据不能超过200条");
                j$(escapeVfId(a)).attr('checked',false);
                return;
            }
            selectedSize ++;
        } else {
            selectedSize --;
        }
        //alert(selectedSize);
    }
    function isChecked(j) {
        var a = j.id;
        var i=a.substring(0,a.lastIndexOf('theRepeat'));
        //console.log(i);
        var z = 0;
        var temp = {!columns.size};
        var canSelect = j$(escapeVfId(i + 'variableinfo:productCountproRowCheckbox')).attr('disabled');
        for(var c = 0;c<temp;c++){
            var tempData = j$(escapeVfId(i+'theRepeat:'+c+':variable:theValue')).value();
            //if(canSelect !='disabled'){}
            if(tempData!=null&&tempData!=''&&tempData!=0 && canSelect !='disabled'){
                z++;
            }
        }
        //allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:20:theRepeat:1:variable:theValue
        //allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:16:variableinfo:productCountproRowCheckbox
        console.log(z);
        if(z>0){
            j$(escapeVfId(i+'variableinfo:productCountproRowCheckbox')).attr('checked',true);
            }else{
            j$(escapeVfId(i+'variableinfo:productCountproRowCheckbox')).attr('checked',false);
        }
    }
    
    function moreChange(){
        var RecordTypeName = '{!RecordTypeName}';
        switch(RecordTypeName)
        {
            case 'ImportantProduct':
                //var ImportantProduct00 = j$(escapeVfId('ImportantProduct0')).value();
                var ImportantProduct11 = j$(escapeVfId('ImportantProduct1')).attr('checked')=='checked'?true:false;;
                var ImportantProduct22 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:ImportantProduct2')).value();
                var ImportantProduct33 = j$(escapeVfId('ImportantProduct3')).attr('checked')=='checked'?true:false;
                var ImportantProduct44 = j$(escapeVfId('ImportantProduct4')).attr('checked')=='checked'?true:false;
                var ImportantProduct55 = j$(escapeVfId('ImportantProduct5')).value();
                // 20221020 ljh SWAG-CJ98AJ 
                console.log(ImportantProduct11);
                //ImportantProduct0(ImportantProduct00);
                ImportantProduct1(ImportantProduct11);
                if(ImportantProduct22 !='x'){
                    ImportantProduct2(ImportantProduct22);
                }
                ImportantProduct3(ImportantProduct33);
                ImportantProduct4(ImportantProduct44);

                // FY23修改 WLIG-CFV4AV 重点产品维护（新）start
                var ImportantProduct155P = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:ImportantProduct155')).value();
                if(ImportantProduct155P !='x'){
                    ImportantProduct155(ImportantProduct155P);
                }

                var CelonProductP = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:CelonProduct')).value();
                if(CelonProductP !='x'){
                    CelonProductSel(CelonProductP);
                }
                // FY23修改 WLIG-CFV4AV 重点产品维护（新）end
                // 20221020 ljh SWAG-CJ98AJ start
                ImportantProduct5(ImportantProduct55);
                // 20221020 ljh SWAG-CJ98AJ end
                break;
            case 'GuranteeMain':
                var GuranteeMain11 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:GuranteeMain1')).value();
                var GuranteeMain22 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:GuranteeMain2')).value();
                var GuranteeMain33 = j$(escapeVfId('GuranteeMain3')).value();
                var GuranteeMain44 = j$(escapeVfId('GuranteeMain4')).value();
                var GuranteeMain88 = j$(escapeVfId('GuranteeMain8')).attr('checked')=='checked'?true:false;
                console.log(GuranteeMain11);
                if(GuranteeMain11 !='x' ){
                    GuranteeMain1(GuranteeMain11);
                }
                if(GuranteeMain22 !='x' ){
                   GuranteeMain2(GuranteeMain22); 
                }
                GuranteeMain3(GuranteeMain33);
                GuranteeMain4(GuranteeMain44);
                GuranteeMain8(GuranteeMain88);
                break;
            case 'GuranteePrice':
                var GuranteePrice11 = j$(escapeVfId('GuranteePrice1')).value();
                var GuranteePrice33 = j$(escapeVfId('GuranteePrice3')).value();
                var GuranteePrice55 = j$(escapeVfId('GuranteePrice5')).value();
                GuranteePrice1(GuranteePrice11);
                GuranteePrice3(GuranteePrice33);
                GuranteePrice5(GuranteePrice55);
                break;
            case 'RepairInfo':
                var RepairInfo1a = j$(escapeVfId('RepairInfo1')).value();
                var RepairInfo22 = j$(escapeVfId('RepairInfo2')).value();
                var RepairInfo33 = j$(escapeVfId('RepairInfo3')).value();
                var RepairInfo44 = j$(escapeVfId('RepairInfo4')).attr('checked')=='checked'?true:false;
                var RepairInfo55 = j$(escapeVfId('RepairInfo5')).value();
                var RepairInfo66 = j$(escapeVfId('RepairInfo6')).value();
                var RepairInfo77 = j$(escapeVfId('RepairInfo7')).value();
                //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 Star
                var RepairInfo8a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo8')).value();
                var RepairInfo9a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo9')).value();
                var RepairInfo10a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo10')).value();
                var RepairInfo11a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo11')).value();
                var RepairInfo12a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo12')).value();
                var RepairInfo13a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo13')).value();
                var RepairInfo14a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo14')).value();
                var RepairInfo15a = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:RepairInfo15')).value();
                //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 End
                RepairInfo1(RepairInfo1a);
                RepairInfo2(RepairInfo22);
                RepairInfo3(RepairInfo33);
                RepairInfo4(RepairInfo44);
                RepairInfo5(RepairInfo55);
                RepairInfo6(RepairInfo66);
                RepairInfo7(RepairInfo77);
                //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star
                RepairInfo8(RepairInfo8a);
                RepairInfo9(RepairInfo9a);
                RepairInfo10(RepairInfo10a);
                RepairInfo11(RepairInfo11a);
                RepairInfo12(RepairInfo12a);
                RepairInfo13(RepairInfo13a);
                RepairInfo14(RepairInfo14a);
                RepairInfo15(RepairInfo15a);
                //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End
                break;
            case 'EquipmentInfo':
                var EquipmentInfo11 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:EquipmentInfo1')).value();
                var EquipmentInfo22 = j$(escapeVfId('EquipmentInfo2')).attr('checked')=='checked'?true:false;
                var EquipmentInfo33 = j$(escapeVfId('EquipmentInfo3')).value();
                var EquipmentInfo44 = j$(escapeVfId('EquipmentInfo4')).value();
                var EquipmentInfo55 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:EquipmentInfo5')).value();
                var EquipmentInfo66 = j$(escapeVfId('allPage:allForm:searchAndMoreUpdate0:EquipmentInfo6')).value();
                if(EquipmentInfo11 != 'x'){
                   EquipmentInfo1(EquipmentInfo11); 
                }
                EquipmentInfo2(EquipmentInfo22);
                EquipmentInfo3(EquipmentInfo33);
                EquipmentInfo4(EquipmentInfo44);
                EquipmentInfo5(EquipmentInfo55);
                if(EquipmentInfo66 !='x'){
                   EquipmentInfo6(EquipmentInfo66); 
                }
                break;
        }  
    }

    function  ServiceMoreChange(){
        var GuranteeMain00 = j$(escapeVfId('ServiceGuranteeMain0')).attr('checked')=='checked'?true:false;
        var GuranteeMain55 = j$(escapeVfId('ServiceGuranteeMain5')).value();
        var GuranteeMain77 = j$(escapeVfId('ServiceGuranteeMain7')).value();
        var GuranteeMain99 = j$(escapeVfId('ServiceGuranteeMain9')).value();
        console.log(GuranteeMain55);
        GuranteeMain0(GuranteeMain00);
        GuranteeMain5(GuranteeMain55);
        GuranteeMain7(GuranteeMain77);
        GuranteeMain9(GuranteeMain99);     
    }
    
    //重点产品 start
    /*function ImportantProduct0(obj) {
        //var val = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).val(obj);
            }
        }
    }*/
    function ImportantProduct1(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).attr('checked', obj);
            }
        }
    }
    function ImportantProduct2(obj) {
        //var selectValue = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).val(obj);
            }
        }
    }
        
    function ImportantProduct3(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).attr('checked', obj);
            }
        }
    }
    function ImportantProduct4(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).attr('checked', obj);
            }
        }
    }
    //20221020 ljh 20221020 ljh SWAG-CJ98AJ
    function ImportantProduct5(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:6:variable:theValue')).val(obj);
            }
        }
    }
    //重点产品 end
    // FY23修改 WLIG-CFV4AV 重点产品维护（新）start
    function ImportantProduct155(obj) {
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:4:variable:theValue')).val(obj);
            }
        }
    }

    function CelonProductSel(obj) {
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:5:variable:theValue')).val(obj);
            }
        }
    }
    // FY23修改 WLIG-CFV4AV 重点产品维护（新）end
    //多年保主数据维护 start
    function GuranteeMain1(obj) {
        //var selectValue = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).val(obj);
            }
        }
    }
    function GuranteeMain2(obj) {
        //var selectValue = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).val(obj);
            }
        }
    }
    function GuranteeMain3(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).val(obj);
            }
        }
    }
    function GuranteeMain4(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).val(obj);
            }
        }
    }

    //ljh
    function GuranteeMain8(obj) {
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:4:variable:theValue')).attr('checked', obj);
            }
        }
    }

    //---------
    function GuranteeMain0(obj) {
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:'+i+':variableinfo:edproductCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:5:edvariable:edtheValue')).attr('checked', obj);
            }
        }
    }

    function GuranteeMain5(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        //console.log(obj);
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
        console.log(productCount);
        //allPage:allForm:allBlock:edmpdDetails:bb:0:variableinfo:edproductCountproRowCheckbox
        // console.log(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:0:variableinfo:edproductCountproRowCheckbox')).attr('checked'));
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:'+i+':variableinfo:edproductCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:6:edvariable:edtheValue')).val(obj);
            }
        }
    }
    function GuranteeMain7(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:'+i+':variableinfo:edproductCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:7:edvariable:edtheValue')).val(obj);
            }
        }
    }
    
    function GuranteeMain9(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:'+i+':variableinfo:edproductCountproRowCheckbox')).attr('checked')=='checked' ){
            j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:8:edvariable:edtheValue')).val(obj);
            }
        }
    }
    //---------
    //多年保主数据维护 end
    //多年保价格维护 start
    function GuranteePrice1(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).val(obj);
            }
        }
    }
    function GuranteePrice3(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).val(obj);
            }
        }
    }
    function GuranteePrice5(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).val(obj);
            }
        }
    }
    //多年保价格维护 end
    //修理信息维护 strat
    function RepairInfo1(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).val(obj);
                }
            }
        }

        
    }
    function RepairInfo2(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).val(obj);
                }
            }
        }
        
    }
    function RepairInfo3(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo4(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj == true) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).attr('checked', obj);
                }
            }
        
        }
        
    }
    function RepairInfo5(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:4:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo6(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:5:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo7(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:6:variable:theValue')).val(obj);
                }
            }
        }
    }
    //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star
    function RepairInfo8(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:7:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo9(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:8:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo10(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:9:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo11(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:10:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo12(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:11:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo13(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:12:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo14(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:13:variable:theValue')).val(obj);
                }
            }
        }
    }
    function RepairInfo15(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        if (obj) {
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                    j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:14:variable:theValue')).val(obj);
                }
            }
        }
    }
    //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End

    //修理信息维护 end
    //备品信息维护 start
    function EquipmentInfo1(obj) {
        //var selectValue = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).val(obj);
            }
        }
    }
    function EquipmentInfo2(obj) {
        //var val = obj.checked;
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).attr('checked', obj);
            }
        }
    }
    function EquipmentInfo3(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).val(obj);
            }
        }
    }
    function EquipmentInfo4(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).val(obj);
            }
        }
    }
    function EquipmentInfo5(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:4:variable:theValue')).val(obj);
            }
        }
    }
    
    function EquipmentInfo6(obj) {
        //var Value = j$(escapeVfId(obj.id)).value();
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();
        for (var i = 0; i < productCount; i++) {
            if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo:productCountproRowCheckbox')).attr('checked')=='checked' ){
                j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:5:variable:theValue')).val(obj);
            }
        }
    }
    //备品信息维护 end
    function isAllEqual(array) {
        if (array.length > 0) {
            return !array.some(function(value, index) {
                return value !== array[0];
            });
        } else {
            return true;
        }
    }
     function saveJs() {
        var RecordTypeName = '{!RecordTypeName}';
        var productCount = j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount')).value();  

        if(RecordTypeName=='GuranteeMain'){
            var typeArr = new Array();
            var CanNotCancelledGurantee  = false;
            //2021/02/01 liying start
            var RevisedAmount = false;
            for (var i = 0; i < productCount; i++) {
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo' + ':productCountproRowCheckbox')).attr('checked')=='checked' ){
                   typeArr.push(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).value());
                }
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:4:variable:theValue')).attr('checked')=='checked'){
                       CanNotCancelledGurantee = true;
                    }
            }
            for(var i = 0; i < productCount; i++){
                //allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:0:theRepeat:1:variable:theValue
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo' + ':productCountproRowCheckbox')).attr('checked')=='checked' && j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:5:variable:theValue')).attr('checked')=='checked'){
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:6:variable:theValue')).value()== 0||j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:7:variable:theValue')).value()== 0||j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:8:variable:theValue')).value()== 0){
                    RevisedAmount = true;
                    break;
                }//2021/02/01 liying end
              }
            }
            //已经选择的
            var mpdedCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
            var mpdedArr = new Array();
            for (var i = 0; i < mpdedCount; i++) {
                mpdedArr.push(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:0:edvariable:edtheValue')).value());
            } 
            //合并数组
            if(mpdedArr.length >typeArr.length){
                var arrNew = mpdedArr.concat(typeArr);
            }else{
                var arrNew = typeArr.concat(mpdedArr);
            }
            console.log(arrNew);
            console.log(isAllEqual(arrNew));               
            if(!isAllEqual(arrNew)){
                alert('所有多年保修类型选择保持一致,请您重新选择或填写！');
                return false;
            }else if(typeArr[0] !='市场'&&CanNotCancelledGurantee){
                alert('多年保类型是市场的时候，才可以勾选不可取消多年保修！');
                return false;
            //2021/02/01 liying start
            }else if(RevisedAmount){
                //价格是否变为0
                if(confirm("您保存的价格中，有为0.00的金额，确认是否追加！")){
                blockme();
                save();
                } 
                else{
                    return false;
                }
            } else{
                blockme();
                save();
            }
        }else if(RecordTypeName=='GuranteePrice'){
            //记录类型是维护价格 价格是否变为0  提示：
            // allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:27:theRepeat:1:variable:theValue
            for(var i = 0; i < productCount; i++){
                if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':variableinfo' + ':productCountproRowCheckbox')).attr('checked')=='checked' && j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:0:variable:theValue')).attr('checked')=='checked' ){
                    if(j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:1:variable:theValue')).value()== 0||j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:2:variable:theValue')).value()== 0||j$(escapeVfId('allPage:allForm:allBlock:mpdDetailsSection:save:maintenanceProductDatadetailsTable:' + i + ':theRepeat:3:variable:theValue')).value()== 0){
                    RevisedAmount = true;
                    break;

                    }
                }
            }
           if(RevisedAmount){
                if(confirm("您保存的价格中，有为0的金额，确认是否要保存！")){
                blockme();
                save();
                }
            }else{
                blockme();
                save();
            } 
        }else{
            blockme();
            save();
        }
    }//2021/02/01 liying end
    function Update() {
        //allPage:allForm:allBlock:edmpdDetails:bb:0:theRepeat:0:variable:theValue
        var RecordTypeName = '{!RecordTypeName}';
        var CanNotCancelledGurantee  = false;  
        if(RecordTypeName=='GuranteeMain'){
            var mpdedCount = j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount')).value();
            var typeArr = new Array();
            for (var i = 0; i < mpdedCount; i++) {
                typeArr.push(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:0:edvariable:edtheValue')).value());
                if(j$(escapeVfId('allPage:allForm:allBlock:edmpdDetails:bb:' + i + ':edtheRepeat:4:edvariable:edtheValue')).attr('checked')=='checked'){
                       CanNotCancelledGurantee = true;
                    }
            } 
            console.log(typeArr);
            console.log(isAllEqual(typeArr)+'=CanNotCancelledGurantee='+CanNotCancelledGurantee);            
            if(!isAllEqual(typeArr)){
                alert('所有多年保修类型选择保持一致,请您重新选择或填写！');
                return false;
            }if(typeArr[0]!='市场'&&CanNotCancelledGurantee){
                alert('多年保类型是市场的时候，才可以勾选不可取消多年保修！');
                return false;
            }else{
                blockme();
                UpdateSave();
            } 
        }else{
            blockme();
            UpdateSave();
        }  
    }
    function deleteJs(line) {
        blockme();
        var gnl=confirm("你确定要删除吗?"); 
        if (gnl==true){
            deleteMpdd(line); 
            return true; 
        }else{ 
            return false; 
        }   
    }
        
    function EditMpd(){
        //解除不可写状态
        blockme();
        setEditAble();
    }    
    function FilesUploadJs(){
        //上传文件
        FilesUpload();
    }
    //提交待审批
    function SubmitmpdJs() {
        blockme();
        Submitmpd();
    }
    function colseBackmpdJs() {
        blockme();
        returnMpdPage();
    }
</script>
    <apex:form id="allForm">
        <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" reRender="mpdDetailsSection"/>
        <apex:actionFunction name="searchMaintenanceProductDataDetails" action="{!searchMaintenanceProductDataDetails}" rerender="mpdDetailsSection, message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="save" action="{!save}" rerender="editAble,mpdDetailsSection,edmpdDetails, message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="UpdateSave" action="{!UpdateSave}" rerender="edmpdDetails,message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="deleteMpdd" action="{!deleteMpdd}" rerender="mpdDetailsSection, edmpdDetails,message" onComplete="unblockUI();">
        <apex:param name="firstParam" assignTo="{!mpddId}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="setEditAble" action="{!setEditAble}" rerender="mpdDetailsSection,edmpdDetails, message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="FilesUpload" action="{!FilesUpload}" rerender="mpdDetailsSection,edmpdDetails, message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="Submitmpd" action="{!Submitmpd}" rerender="mpdDetailsSection,edmpdDetails, message" onComplete="unblockUI();init();">
        </apex:actionFunction>
        <apex:actionFunction name="returnMpdPage" action="{!returnMpdPage}" rerender="message" onComplete="unblockUI();">
        </apex:actionFunction>


        <apex:pageBlock id="EDCline_1" >
            <apex:commandButton onclick="EditMpd();"   value="编辑" style="margin-left:30px;width:180px" rerender="mpdDetailsSection,edmpdDetails,message" rendered="{!!editAble }" disabled="{!IF(mpd.Status__c ='草案中'||mpd.Status__c='已驳回'||!editDisabled,false,true)}"/>

            <apex:commandButton onclick="FilesUploadJs();" value="上传附件" style="margin-left:30px;width:180px" rerender="mpdDetailsSection,message" rendered="{!!(EditDelCommitBtnDisabled||editAble)}" disabled="{!IF(mpd.Status__c ='草案中'||mpd.Status__c='已驳回'||!editDisabled,false,true)}"/>

           <apex:commandButton onclick="SubmitmpdJs();"    value="提交待审批" style="margin-left:30px;width:180px" rerender="unEditable" rendered="{!!(EditDelCommitBtnDisabled||editAble)}" disabled="{!IF(mpd.Status__c ='草案中'||mpd.Status__c='已驳回',false,true)}"/>
            <apex:commandButton onclick="Update();" value="保存维护记录" style="margin-left:30px;width:180px" rerender="edmpdDetails" rendered="{!IF(editAble,true,false)}" />
            <apex:commandButton onclick="colseBackmpdJs();" value="关闭" style="margin-left:30px;width:180px" rerender="message" rendered="true" /> 
        </apex:pageBlock>
        <apex:pageBlock title="产品主数据维护信息" id="unEditable" rendered="{!IF(mpd !=null,true,false)}">
            <table style="width:100%;">
                <colgroup>
                    <col width="20%"/>
                    <col width="20%"/>
                    <col width="10%"/>
                    <col width="10%"/>
                    <col width="20%"/>
                    <col width="20%"/>
                </colgroup>
                <tr>
                    <td align="right" >维护产品主数据名称：</td>
                    <td align="left" ><apex:outputField id="name_out"  value="{!mpd.Name}" style="width:300px"/></td>
                    <td align="right" >状 态：</td>
                    <td align="left" ><apex:outputField id="Status_out" value="{!mpd.Status__c}" style="width:100px"/></td>
                    <td align="right" >记录类型：</td>
                    <td align="left" ><apex:outputField id="RecordType" value="{!mpd.RecordType.Name}" style="width:100px"/>
                    </td>
                </tr>
            </table>
        </apex:pageBlock>

        <apex:pageBlock id="searchAndMoreUpdate0" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}">
            <table>
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'GuranteePrice'|| RecordTypeName ='GuranteeMain', false,true)}">
                <tr>
                    <td align="right" style="width: 100px;">第1分类</td>
                    <td>
                        <apex:selectList id="Category1" value="{!category1}" size="1">
                            <apex:selectOption itemValue="" itemLabel="-无-"/>
                            <apex:selectOption itemValue="GI" itemLabel="GI"/>
                            <apex:selectOption itemValue="ET" itemLabel="ET"/>
                            <apex:selectOption itemValue="SP" itemLabel="SP"/>
                            <apex:selectOption itemValue="ENG" itemLabel="ENG"/>
                            <apex:selectOption itemValue="RS" itemLabel="RS"/>
                            <apex:selectOption itemValue="OTH" itemLabel="OTH"/>
                        </apex:selectList>
                    </td>
                    <td align="right" style="width: 100px;" >第2分类</td>
                    <td><apex:inputText id="Category2" value="{!category2}" style="width:100px"/></td>
                    <td align="right" style="width: 100px;" >第3分类</td>
                    <td><apex:inputText id="Category3" value="{!category3}" style="width:100px"/></td>
                    <td align="right" style="width: 100px;" >第4分类</td>
                    <td><apex:inputText id="Category4" value="{!category4}" style="width:100px"/></td>
                    <td align="right" style="width: 100px;" >第5分类</td>
                    <td><apex:inputText id="Category5" value="{!category5}" style="width:100px"/></td>
                    <!-- <td colspan="10"></td> -->
                    <!-- <td align="right"></td>     -->
                </tr>
                </apex:outputPanel>
                <tr>
                    <td align="right" style="width: 100px;">产品名称</td>
                    <!-- ProductDateSearch -->
                    <td><apex:inputText id="CateName" value="{!searchCateName}" style="width:100px"/></td>
                    <td align="right" style="width: 100px;">产品编码</td>
                    <td><apex:inputText id="ProductCodeExt" value="{!searchProductCodeExt}" style="width:100px"/></td>
                    <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'GuranteePrice'|| RecordTypeName ='GuranteeMain', true,false)}">
                    <td align="right" style="width: 100px;">多年保修类型</td>
                    <td>
                        <apex:selectList id="GuranteeType" value="{!searchGuranteeType}" size="1">
                            <apex:selectOption itemValue="" itemLabel="-无-"/>
                            <apex:selectOption itemValue="市场" itemLabel="市场"/>
                            <apex:selectOption itemValue="服务" itemLabel="服务"/>
                        </apex:selectList>
                    </td>
                    </apex:outputPanel>
                    <!-- <td colspan="{!IF(RecordTypeName = 'GuranteePrice'|| RecordTypeName ='GuranteeMain', 12,12)}"></td> -->
                    <!-- <td align="right"></td> -->
                    <td colspan="2" align="right"><apex:commandButton value="产品搜索" style="width: 100px;" onclick="searchProductJs();return false;" reRender="mpdDetailsSection" /></td>
                    <td colspan="2" align="left" style="padding-left:20px; "><input type="button" value="清空" style="width: 100px;" onclick="ClearJs();return false;" class="btn"/></td>
                    <td colspan="{!IF(RecordTypeName = 'GuranteePrice'|| RecordTypeName ='GuranteeMain', 2,4)}"></td>
                    
                </tr>
                <tr>
                    <td colspan="22"></td>
                </tr>
            </table>           
        <!-- </apex:pageBlock>
        <apex:pageBlock  id="moreUpdate0" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}"> -->
            <div style="float: left;width: 95%;overflow:auto;">
            <table class="list" border="0" cellpadding="0" cellspacing="0" width="100%"  >
                <tr class="headerRow">
                    <th rowspan = "2">未选择的产品<br/>选中数据批量修改</th>
                    <apex:repeat value="{!title}" var="t">
                    <th><apex:outputText value="{!t}"/></th>
                    </apex:repeat>
                </tr>
                <!-- 重点产品维护 -->
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ImportantProduct',true , false)}">
                <tr >
                    <!--<td>
                        <input id="ImportantProduct0" type="text"  size="20"  />
                    </td>-->
                    <td>
                        <input type="checkbox" id="ImportantProduct1"  />
                    </td>
                    <td>
                        <!--<select id="ImportantProduct2" >
                            <option value ="无">无</option>
                            <apex:repeat value="{!tempImportantRroduct}" var="t">
                                <option value ="{!t}">{!t}</option>
                            </apex:repeat>
                        </select>-->
                        <apex:selectList id="ImportantProduct2"  size="1">
                            <apex:selectOptions value="{!KeyProduct147POps}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <input type="checkbox"   id="ImportantProduct3" />
                    </td>
                    <td>
                        <input type="checkbox"   id="ImportantProduct4" />
                    </td>
                    <!-- FY23修改 WLIG-CFV4AV 重点产品维护（新）start -->
                    <!--<td>
                        <input id="ImportantProduct0" type="text"  size="20"  />
                    </td>-->
                    <td>
                        <apex:selectList id="ImportantProduct155"  size="1">
                            <apex:selectOptions value="{!KeyProduct155POps}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="CelonProduct"  size="1">
                            <apex:selectOptions value="{!CelonProductOps}"/>
                        </apex:selectList>
                    </td>
                    <!-- FY23修改 WLIG-CFV4AV 重点产品维护（新）end -->
                    <!-- 20221020 ljh SWAG-CJ98AJ start-->
                    <td>
                        <input name="suitDepartment"  id="ImportantProduct5" size="20" type="text" value=""/>
                    </td>
                    <!-- 20221020 ljh SWAG-CJ98AJ end-->
                </tr>
                </apex:outputPanel>
                <!-- 主数据维护 -->
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'GuranteeMain',true , false)}">
                <tr>
                    <td>
                        <apex:selectList id="GuranteeMain1"  size="1">
                            <apex:selectOptions value="{!GuranteeTypeOps}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="GuranteeMain2"  size="1">
                            <apex:selectOptions value="{!EntendGuranteePeriodOps}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <span class="dateInput dateOnlyInput">
                            <input name="Gurantee_Start_Date" id="GuranteeMain3"  onfocus="DatePicker.pickDate(true, 'GuranteeMain3', false);" size="12" type="text" data-uidsfdc="3"/>
                        </span>
                    </td>
                    <td>
                        <span class="dateInput dateOnlyInput">
                            <input name="Gurantee_End_Date" id="GuranteeMain4" onfocus="DatePicker.pickDate(true, 'GuranteeMain4', false);" size="12" type="text" data-uidsfdc="4"/>
                        </span>
                    </td>
                    <td><input type="checkbox" id="GuranteeMain8" /></td>
                    <!-- <td></td>
                    <td>
                        <input  name="Intra_Trade_Service_RMB" id="GuranteeMain5" size="20" type="number" value="" disabled="true" />
                    </td>
                    <td>
                        <input  name="Intra_Trade_Gurantee_RMB" id="GuranteeMain7" size="20" type="number" value="" disabled="true" />
                    </td>
                    <td>
                        <input  id="GuranteeMain9" size="20" type="number" name="Maintenance_Price_Year" disabled="true" />
                    </td> -->
                </tr>
                </apex:outputPanel>
                <!-- 多年保价格 -->
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'GuranteePrice',true , false)}">
                <tr>
                    <td></td>
                    <td>
                        <input name="Intra_Trade_Service_RMB"  id="GuranteePrice1" size="20" type="number" value=""/>
                    </td>
                    <td>
                        <input name="Intra_Trade_Gurantee_RMB"  id="GuranteePrice3" size="20" type="number" value=""/>
                    </td>
                    <td>
                        <input name="Maintenance_Price_Year"  id="GuranteePrice5" size="20" type="number"/>
                    </td>
                </tr>
                </apex:outputPanel>
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'RepairInfo',true , false)}">
                <tr>

                    <td>
                        <input name="RepairListPriceLevelA"  id="RepairInfo1" size="10" type="number" value="" style="width:100px;" />
                    </td>
                    <td>
                        <input name="RepairListPriceLevelB"  id="RepairInfo2" size="10" type="number" value="" style="width:100px;"/>
                    </td>
                    <td>
                        <input name="RepairListPriceLevelC"  id="RepairInfo3" size="10" type="number" value="" style="width:100px;"/>
                    </td>
                    <td>
                        <input type="checkbox"   id="RepairInfo4" />
                    </td>
                    <td>
                        <input name="Repair_Product_Code"  id="RepairInfo5" size="20" type="text" value="" style="width:100px;"/>
                    </td>
                    <td>
                        <input name="Maintenance_Price_Year"  id="RepairInfo6" size="20" type="number" style="width:100px;"/>
                    </td>
                    <td>
                        <span class="dateInput dateOnlyInput">
                            <input name="PartSupplyFinishDate"  id="RepairInfo7" onfocus="DatePicker.pickDate(true, 'RepairInfo7', false);" size="12" type="text" data-uidsfdc="1"/>
                        </span>
                    </td>
                    <!-- LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 Star -->
                    <td>
                        <apex:selectList id="RepairInfo8"  size="1">
                            <apex:selectOptions value="{!CanRepairOps}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="RepairInfo9"  size="1">
                            <apex:selectOptions value="{!ServiceCategory1}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="RepairInfo10"  size="1">
                            <apex:selectOptions value="{!ServiceCategory2}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="RepairInfo11"  size="1">
                            <apex:selectOptions value="{!ServiceCategory3}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="RepairInfo12"  size="1">
                            <apex:selectOptions value="{!ServiceCategory4}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:selectList id="RepairInfo13"  size="1">
                            <apex:selectOptions value="{!ServiceCategory5}"/>
                        </apex:selectList>
                    </td>
                    <td>
                        <apex:inputField id="RepairInfo14" value="{!RepairInfo[0].Service_Category6__c}"/>
                    </td>
                    <td>
                        <apex:inputField id="RepairInfo15" value="{!RepairInfo[0].Service_Category7__c}"/>
                    </td>
                    <!-- LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 End -->
                </tr>
                </apex:outputPanel>
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'EquipmentInfo',true , false)}">
                <tr>
                    <td>
                        <apex:selectList id="EquipmentInfo1"  size="1">
                            <apex:selectOptions value="{!AssetLoanerCategoryOps}"/>
                        </apex:selectList>

                    </td>
                    <td>
                        <input type="checkbox"   id="EquipmentInfo2" />
                    </td>
                    <td>
                        <input name="Fixture_Model_No"  id="EquipmentInfo3" size="20" type="text" />
                    </td>
                    <td>
                        <input name="Packing_list_Fixture"  id="EquipmentInfo4" size="20" type="text" />
                    </td>
                    <td>
                        <apex:inputField id="EquipmentInfo5" value="{!EquipmentInfo[0].Default_Fixture_Arrival_Product__c}"/>
                    </td>
                    <td>
                        <apex:selectList id="EquipmentInfo6"  size="1">
                            <apex:selectOptions value="{!DefaultFixtureArrivalProcessOps}"/>
                        </apex:selectList>
                    </td>
                </tr>
                </apex:outputPanel>
            </table>
            </div>
            <div style="float: right;width:4%;position:relative;" >
                <button type="button" onclick="moreChange();"  style="width:100%;display:inline-block;height:30px;margin-top:15px;">确定</button>             
            </div> 
            <div style="clear: both;"></div> 
        </apex:pageBlock>

        <apex:pageBlock title="选中数据批量修改" id="GuranteeMainMoreUpdate0" rendered="{!IF(editAble&&RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写',true,false)}">
            <div style="float: left;width: 95%" >
            <table class="list" border="0" cellpadding="0" cellspacing="0" width="100%"  >
                <tr class="headerRow">
                    <th rowspan = "2">产品主数据维护<br/>选中数据批量修改</th>
                    <apex:repeat value="{!title}" var="t">
                    <th><apex:outputText value="{!t}"/></th>
                    </apex:repeat>
                </tr>
                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'GuranteeMain',true , false)}">
                <tr>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td><input type="checkbox" id="ServiceGuranteeMain0" /></td>
                    <td>
                        <input  name="Intra_Trade_Service_RMB" id="ServiceGuranteeMain5" size="20" type="number" value=""  />
                    </td>
                    <td>
                        <input  name="Intra_Trade_Gurantee_RMB" id="ServiceGuranteeMain7" size="20" type="number" value=""  />
                    </td>
                    <td>
                        <input  id="ServiceGuranteeMain9" size="20" type="number" name="Maintenance_Price_Year"  />
                    </td>

                </tr>
                </apex:outputPanel>
            </table>
            </div>
            <div style="float: right;width:4%;position:relative;" >
                <button type="button" onclick="ServiceMoreChange();"  style="width:100%;display:inline-block;height:30px;margin-top:15px;">确定</button>             
            </div> 
            <div style="clear: both;"></div> 
        </apex:pageBlock>

        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>

        <apex:outputPanel id="allPanel">
            <apex:pageBlock id="allBlock" >
                <apex:pageblocksection title="{!IF(editAble,'产品主数据维护','产品主数据维护(蓝色为新值)')}" id="edmpdDetails" rendered="{!IF(mpdDetailsRecordsCount >0,true,false)}" html-style="width: 100%;overflow:auto;">
                <apex:outputLabel style="width: 100%;">
                <input type="hidden" id="allPage:allForm:allBlock:edmpdDetails:mpdDetailsRecordsCount" value="{!mpdDetailsRecordsCount}" />
                    <table class="list" border="0" cellpadding="0" cellspacing="0"  >
                        <tr class="headerRow">
                            <apex:variable var="v" value="" rendered="{!IF(editAble&&RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写',true,false)}">
                               <th>选择</th>
                            </apex:variable>
                            <th>产品名称</th>
                            <th>产品编码</th> 
                            <apex:variable var="type" value="" rendered="{!IF(RecordTypeName='GuranteePrice',true,false)}"> 
                            <th>多年保修类型</th> 
                            </apex:variable>                          
                            <apex:repeat value="{!title}" var="t">
                            <th><apex:outputText value="{!t}"/></th>
                            </apex:repeat>
                            <apex:variable var="type" value="" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}"> 
                            <th>操作</th>
                            </apex:variable>

                        </tr>
                        <apex:repeat value="{!mpdDetailsRecords}" var="aa" id="bb"> 
                            <tr>
                            <apex:variable var="v" value="" rendered="{!IF(editAble&&RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写',true,false)}" id="variableinfo">
                            <td>
                                <apex:inputCheckbox value="{!aa.check}" id="edproductCountproRowCheckbox" />
                                <!-- disabled="{!!aa.canSelect}" -->
                             </td>
                             </apex:variable>
                                <td class="dataCell" rowspan="{!IF(editAble,1,2)}" >
                                    <apex:outputText value="{!aa.mpded.ProductsID__r.Name}"/>
                                </td>
                                <td class="dataCell" rowspan="{!IF(editAble,1,2)}">
                                    <apex:outputText value="{!aa.mpded.ProductCode_Ext__c}" /> 
                                </td> 
                                <apex:variable var="type" value="" rendered="{!IF(RecordTypeName='GuranteePrice',true,false)}"> 
                                <td class="dataCell" rowspan="{!IF(editAble,1,2)}" >
                                    <apex:outputText value="{!aa.mpded.GuranteeTypeP__c }" /> 
                                </td> 
                                </apex:variable>                          
                                <apex:repeat value="{!columns}" var="edc" id="edtheRepeat" >
                                    <td style="{!IF(editAble,'','background:rgb(207,238,248)')}">
                                        <apex:variable var="edv" value="" rendered="{!editAble}" id="edvariable">
                                            <apex:outputPanel rendered="{!(edc.size==1)}" layout="none">
                                                <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,edc[0]))||RecordTypeName != 'GuranteeMain',true , false)}">
                                                    <apex:InputField value="{!aa.mpded[edc[0]]}"  id="edtheValue" style="max-width: 120px;"/> 
                                                </apex:outputPanel>
                                                <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,edc[0]))||RecordTypeName != 'GuranteeMain',false , true)}">
                                                    <apex:outputField value="{!aa.mpded[edc[0]]}"/>
                                                </apex:outputPanel>
                                            </apex:outputPanel>
                                        </apex:variable>
                                        <apex:variable var="edvun" value="" rendered="{!!editAble}">
                                            <apex:outputPanel rendered="{!(edc.size==1)}" layout="none">
                                                <apex:outputField value="{!aa.mpded[edc[0]]}"/>
                                            </apex:outputPanel>
                                        </apex:variable>
                                    </td>
                                </apex:repeat>
                                <apex:variable var="type" value="" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}"> 
                                <td class="dataCell" >
                                    <apex:commandButton onclick="deleteJs('{!aa.mpded.id}');return false;" value="删除" style="width:60px" rerender=""/>
                                </td>
                                </apex:variable>
                            </tr>
                            <apex:variable var="old" value="" rendered="{!!editAble}">
                            <tr>
                                <apex:repeat value="{!columns_Old}" var="c" id="atheRepeat" >
                                <td><apex:outputField value="{!aa.mpded[c[0]]}"/></td>
                                </apex:repeat>
                            </tr>
                            </apex:variable>
                        </apex:repeat>
                    </table>
                </apex:outputLabel>
                </apex:pageblocksection>
                <!-- !(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写') -->
                <apex:pageBlock title="未选择的产品" id="mpdDetailsSection" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}">
                   <div style="position:relative;height: 0px;">
                       <input type="hidden" id="allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount" value="{!mpdDetailsRecordsViewCount}" />
                        <apex:commandButton onclick="saveJs();" value="确认追加" style="position:relative;top: -45px;left: 120px; width:100px;" rerender="mpdDetailsSection,edmpdDetails" rendered="{!IF(editAble,true,false)}" />
                   </div>
                    <apex:variable var="v" value="" rendered="{!editAble}" id="save"> 
                    <div style="max-height:210px;width:100%;overflow:auto;position: relative;"> 
                    <table class="list" border="0" cellpadding="0" cellspacing="0"  >
                        <tr class="headerRow">
                            <apex:variable var="v" value="" rendered="{!editAble}">
                                <th><input type='checkbox' onClick='checkAll()' id='checker'/>选择</th> 
                            </apex:variable> 
                            <th>产品名称</th>
                            <th>产品编码</th>
                            <apex:variable var="type" value="" rendered="{!IF(RecordTypeName='GuranteePrice',true,false)}"> 
                            <th>多年保修类型</th> 
                            </apex:variable>                         
                            <apex:repeat value="{!title}" var="t">
                            <th><apex:outputText value="{!t}"/></th>
                            </apex:repeat>
                        </tr>
                        <apex:repeat value="{!mpdDetailsRecordsView}" var="records" id="maintenanceProductDatadetailsTable">
                        <tr>
                            <apex:variable var="v" value="" rendered="{!editAble}" id="variableinfo">
                                <td  style="{!IF(!records.canSelect,'background-color:#F5F5F5;','')}">
                                <apex:inputCheckbox value="{!records.check}" onclick="CheckSize(this);" id="productCountproRowCheckbox" disabled="{!!records.canSelect}"/>
                                 <apex:inputCheckbox value="{!records.oldCheck}" id="proRowOldCheckbox" style="display:none" />
                                 <!-- style="display:none" -->
                             </td>
                             </apex:variable>
                            <td class="dataCell">
                                <apex:outputText value="{!records.Prod.Name}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputText value="{!records.Prod.ProductCode_Ext__c}" /> 
                            </td> 
                            <apex:variable var="type" value="" rendered="{!IF(RecordTypeName='GuranteePrice',true,false)}"> 
                            <td class="dataCell">
                                <apex:outputText value="{!records.Prod.GuranteeType__c }" /> 
                            </td> 
                            </apex:variable>                        
                            <apex:repeat value="{!columns}" var="c" id="theRepeat" >
                                <td style="{!IF(editAble,'','background:rgb(207,238,248)')}">
                                    <apex:variable var="v" value="" rendered="{!editAble}" id="variable">
                                        <apex:outputPanel rendered="{!(c.size==1)}" layout="none">
                                            <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,c[0]))||RecordTypeName != 'GuranteeMain',true , false)}">
                                            <div style="position: relative;">
                                                <apex:InputField value="{!records.mpdrdd[c[0]]}"  id="theValue"  onblur="isChecked(this)" style="max-width: 120px; "/> 
                                            </div>
                                            </apex:outputPanel>
                                            <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,c[0]))||RecordTypeName != 'GuranteeMain',false , true)}">
                                                <apex:outputField value="{!records.mpdrdd[c[0]]}"/>
                                            </apex:outputPanel>
                                        </apex:outputPanel>
                                    </apex:variable>
                                </td>
                            </apex:repeat>
                        </tr>
                        </apex:repeat>
                    </table>
                    </div>
                    </apex:variable>
                </apex:pageBlock>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
    <apex:pageBlock title="附件" id="mpdataSection" rendered="{!!editAble}">
        <apex:pageBlockTable value="{!AttachmentRecoeds}" var="a" >
        <apex:column headerValue="标题" style="width: 33%">
        <apex:outputLink value="/{!a.Concc.Id}?retURL={!URLENCODE('/apex/MaintenanceProductData?id='+id)}" target="_self">
            {!a.Concc.name}
        </apex:outputLink>
        </apex:column>
        <apex:column headerValue="创建人">
            <apex:outputField value="{!a.Concc.OwnerId}"/>
        </apex:column>
        </apex:pageBlockTable> 
    </apex:pageBlock>
    <apex:relatedList list="ProcessSteps" rendered="{!!editAble}" ></apex:relatedList>
    
</apex:page>