| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>RC_Submit</fullName> | 
|     <availability>online</availability> | 
|     <description>RC提出用 | 
| 2019年6月12日以前: | 
| {!RequireScript("/soap/ajax/30.0/connection.js")}  | 
| {!RequireScript("/soap/ajax/30.0/apex.js")}  | 
| {!RequireScript("/resource/CommonUtilJs")}  | 
| var foo = function() { | 
|  if ('{!QIS_Report__c.QIS_Status__c}' != 'RC检测中') { | 
|  alert('已经提交审批'); | 
|  return; | 
|  } | 
|     var old_QIS_Status__c = '{!QIS_Report__c.QIS_Status__c}'; | 
|     var qis = new sforce.SObject("QIS_Report__c"); | 
|     if ({!ISBLANK(TEXT(QIS_Report__c.Cancel_QIS_Reason__c))}) { | 
|         if ('{!QIS_Report__c.QIS_Status__c}' == 'RC检测申请') { | 
|     alert('需要先点击[OCM服务本部收到实物]'); | 
|        return; | 
|     } | 
|         if ("{!QIS_Report__c.RC__c}" == "") { | 
|             alert("判定担当必须填写"); | 
|             return; | 
|         } | 
|         if ("{!QIS_Report__c.RC_inspection_date__c}" == "") { | 
|             alert("OCM服务本部还没有检测完毕"); | 
|             return; | 
|         } | 
|         if ({!NOT(ISBLANK(QIS_Report__c.QIS_Reply_day__c))} && '{!QIS_Report__c.RC_problem_not_found__c}'=='1') {  | 
|             alert("最终判定时,请取消[故障未发现留下继续观察]并选择[对应方法]");</description> | 
|     <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")} | 
| //2021-10-21 gwy 版本更改为51.0 | 
| var foo = function() { | 
| if ('{!QIS_Report__c.QIS_Status__c}' != 'RC检测中') { | 
| alert('已经提交审批'); | 
| return; | 
| } | 
| var old_QIS_Status__c = '{!QIS_Report__c.QIS_Status__c}'; | 
| var qis = new sforce.SObject("QIS_Report__c"); | 
| if ({!ISBLANK(TEXT(QIS_Report__c.Cancel_QIS_Reason__c))}) { | 
| if ('{!QIS_Report__c.QIS_Status__c}' == 'RC检测申请') { | 
| alert('需要先点击[OCM服务本部收到实物]'); | 
| return; | 
| } | 
| if ("{!QIS_Report__c.RC__c}" == "") { | 
| alert("判定担当必须填写"); | 
| return; | 
| } | 
| if ("{!QIS_Report__c.RC_inspection_date__c}" == "") { | 
| alert("OCM服务本部还没有检测完毕"); | 
| return; | 
| } | 
| if ({!NOT(ISBLANK(QIS_Report__c.QIS_Reply_day__c))} && '{!QIS_Report__c.RC_problem_not_found__c}'=='1') { | 
| alert("最终判定时,请取消[故障未发现留下继续观察]并选择[对应方法]"); | 
| return; | 
| } | 
| if (!confirm("一旦OCM提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { | 
| return; | 
| } | 
| qis.Id = "{!QIS_Report__c.Id}"; | 
| qis.QIS_Status__c = "RC填写完毕"; | 
| if ('{!QIS_Report__c.RC_problem_not_found__c}' == '1' && '{!QIS_Report__c.RC_FixedJudgement__c}' == '0') { | 
| var resultSet = sforce.connection.query("SELECT Id, Reason_bloken__c, Special_follow__c, next_action__c, QIS_Reply_Comment__c, OCM_judgement__c FROM QIS_Report__c WHERE Id = '{!QIS_Report__c.Id}'"); | 
| var records = resultSet.getArray("records"); | 
| if (records != null && records.length > 0) { | 
| qis.Reason_bloken1__c = records[0].Reason_bloken__c; | 
| qis.Special_follow1__c = records[0].Special_follow__c; | 
| qis.next_action1__c = records[0].next_action__c; | 
| qis.QIS_Reply_Comment1__c = records[0].QIS_Reply_Comment__c; | 
| qis.OCM_judgement1__c = records[0].OCM_judgement__c; | 
| } | 
| } | 
| } else { | 
| if (!confirm("一旦提交关闭此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { | 
| return; | 
| } | 
| qis.Id = "{!QIS_Report__c.Id}"; | 
| qis.QIS_Status__c = "取消申请"; | 
| var serverTimestamp = sforce.connection.getServerTimestamp(); | 
| qis.QIS_Cancel_Submit_day__c = serverTimestamp.timestamp; | 
| } | 
| var resultSet = sforce.connection.query("SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c, BuchangApprovalManagerSales__c, SalesManager__c FROM User WHERE Id = '{!$User.Id}'"); | 
| var records = resultSet.getArray("records"); | 
| if (records != null && records.length > 0 && records[0].BuchangApprovalManagerSales__c!= null) { | 
| qis.RC_Manager__c = records[0].BuchangApprovalManagerSales__c; | 
| } else { | 
| qis.RC_Manager__c = "{!$User.Id}"; | 
| } | 
| if (records != null && records.length > 0) { | 
|     //wangweipeng         LJPH-C6V5XH            2021/09/22            start | 
|     if (old_QIS_Status__c == "RC检测中") { | 
|         qis.RC__c = "{!$User.Id}"; | 
|     } | 
|     //wangweipeng         LJPH-C6V5XH            2021/09/22            end | 
| if (records[0].SalesManager__c != null) { | 
| qis.ApproveManager__c = records[0].SalesManager__c; | 
| } else { | 
| qis.ApproveManager__c = '{!$User.Id}' | 
| } | 
| if (records[0].BuchangApprovalManagerSales__c != null) { | 
| qis.ApproveBuZhang__c = records[0].BuchangApprovalManagerSales__c; | 
| } else { | 
| qis.ApproveBuZhang__c = '{!$User.Id}'; | 
| } | 
| if (records[0].ZongjianApprovalManager__c != null) { | 
| qis.AppeoveZongJian__c = records[0].ZongjianApprovalManager__c; | 
| } else { | 
| qis.AppeoveZongJian__c = '{!$User.Id}'; | 
| } | 
| } | 
| var result = sforce.connection.update([qis]); | 
| var messages = getConnectDMLErrorMessages(result); | 
| if (messages.length > 0) { | 
| alert(messages.join("\n")); | 
| return; | 
| } | 
|   | 
| window.location.reload(); | 
| } | 
| foo();</url> | 
| </WebLink> |