<?xml version="1.0" encoding="UTF-8"?> 
 | 
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> 
 | 
    <fullName>upload_To_Recognition_Model</fullName> 
 | 
    <availability>online</availability> 
 | 
    <displayType>button</displayType> 
 | 
    <linkType>javascript</linkType> 
 | 
    <masterLabel>上传认款合同</masterLabel> 
 | 
    <openType>onClickJavaScript</openType> 
 | 
    <protected>false</protected> 
 | 
    <url>{!RequireScript("/soap/ajax/51.0/connection.js")} 
 | 
{!RequireScript("/soap/ajax/51.0/apex.js")} 
 | 
{!RequireScript("/resource/CommonUtilJs")} 
 | 
//wanweipeng     2021/11/16    start 
 | 
var foo = function() { 
 | 
if('{!Maintenance_Contract__c.MaintanceContractPack__c}') { 
 | 
alert("当前服务合同属于打包合同,请在打包合同上上传认款合同。"); 
 | 
return; 
 | 
} 
 | 
    if('{!Maintenance_Contract__c.Contract_quotation_or_not__c}' == '还没做报价'){ 
 | 
        alert("您还没有做合同报价,不能上传认款合同。"); 
 | 
    }else if ('{!Maintenance_Contract__c.Maintenance_Contract_No__c}'=='') { 
 | 
        alert('合同号码为空,不能上传认款合同。'); 
 | 
    }else if ('{!Maintenance_Contract__c.upload_to_sap_time__c}' != '') { 
 | 
        alert('已经上传SAP,不能再次上传认款合同。'); 
 | 
    }else if('{!Maintenance_Contract__c.upload_to_RM_time__c}' != ''){ 
 | 
        alert('已经上传认款合同,不能再次上传认款合同。'); 
 | 
    }else{ 
 | 
        if(!{!Maintenance_Contract__c.old_Is_RecognitionModel__c}){ 
 | 
            alert('经销商为空或经销商不是先款对象,不需要上传认款合同。'); 
 | 
        }else if('{!Maintenance_Contract__c.Payment_Plan_Sum_First__c}' == ''){ 
 | 
            alert('第一次计划付款金额不能为空。'); 
 | 
        }else{ 
 | 
            if(!confirm('请确认是否要上传认款合同。')){ 
 | 
                return; 
 | 
            } 
 | 
            sforce.connection.sessionId = '{!$Api.Session_ID}'; 
 | 
            var mcid = '{!Maintenance_Contract__c.Id}'; 
 | 
            var result = sforce.apex.execute("MaintenanceContractSetColunmWebService","updateColunm",{mcid: mcid}); 
 | 
            if (result != '1'){ 
 | 
                alert('上传认款合同失败,因为 来年合同相关信息修改失败'); 
 | 
                location.href = "/{!Maintenance_Contract__c.Id}"; 
 | 
            } 
 | 
            //上传认款合同 
 | 
            var rtn = sforce.apex.execute("MaintenanceContractWebService", "up2sap", {mcid: mcid}); 
 | 
            if (rtn == '1') { 
 | 
                alert("上传认款合同成功"); 
 | 
                location.href = "/{!Maintenance_Contract__c.Id}"; 
 | 
            } else { 
 | 
                alert(rtn); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
} 
 | 
foo(); 
 | 
//wanweipeng     2021/11/16    end</url> 
 | 
</WebLink> 
 |