Li Jun
2022-05-11 b776940205e893302f77d24c4285613f228b44c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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(&quot;/soap/ajax/30.0/connection.js&quot;)} 
{!RequireScript(&quot;/soap/ajax/30.0/apex.js&quot;)} 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)} 
var foo = function() {
 if (&apos;{!QIS_Report__c.QIS_Status__c}&apos; != &apos;RC检测中&apos;) {
 alert(&apos;已经提交审批&apos;);
 return;
 }
    var old_QIS_Status__c = &apos;{!QIS_Report__c.QIS_Status__c}&apos;;
    var qis = new sforce.SObject(&quot;QIS_Report__c&quot;);
    if ({!ISBLANK(TEXT(QIS_Report__c.Cancel_QIS_Reason__c))}) {
        if (&apos;{!QIS_Report__c.QIS_Status__c}&apos; == &apos;RC检测申请&apos;) {
    alert(&apos;需要先点击[OCM服务本部收到实物]&apos;);
       return;
    }
        if (&quot;{!QIS_Report__c.RC__c}&quot; == &quot;&quot;) {
            alert(&quot;判定担当必须填写&quot;);
            return;
        }
        if (&quot;{!QIS_Report__c.RC_inspection_date__c}&quot; == &quot;&quot;) {
            alert(&quot;OCM服务本部还没有检测完毕&quot;);
            return;
        }
        if ({!NOT(ISBLANK(QIS_Report__c.QIS_Reply_day__c))} &amp;&amp; &apos;{!QIS_Report__c.RC_problem_not_found__c}&apos;==&apos;1&apos;) { 
            alert(&quot;最终判定时,请取消[故障未发现留下继续观察]并选择[对应方法]&quot;);</description>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>提交待审批</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)}
{!RequireScript(&quot;/soap/ajax/51.0/apex.js&quot;)}
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)}
//2021-10-21 gwy 版本更改为51.0
var foo = function() {
if (&apos;{!QIS_Report__c.QIS_Status__c}&apos; != &apos;RC检测中&apos;) {
alert(&apos;已经提交审批&apos;);
return;
}
var old_QIS_Status__c = &apos;{!QIS_Report__c.QIS_Status__c}&apos;;
var qis = new sforce.SObject(&quot;QIS_Report__c&quot;);
if ({!ISBLANK(TEXT(QIS_Report__c.Cancel_QIS_Reason__c))}) {
if (&apos;{!QIS_Report__c.QIS_Status__c}&apos; == &apos;RC检测申请&apos;) {
alert(&apos;需要先点击[OCM服务本部收到实物]&apos;);
return;
}
if (&quot;{!QIS_Report__c.RC__c}&quot; == &quot;&quot;) {
alert(&quot;判定担当必须填写&quot;);
return;
}
if (&quot;{!QIS_Report__c.RC_inspection_date__c}&quot; == &quot;&quot;) {
alert(&quot;OCM服务本部还没有检测完毕&quot;);
return;
}
if ({!NOT(ISBLANK(QIS_Report__c.QIS_Reply_day__c))} &amp;&amp; &apos;{!QIS_Report__c.RC_problem_not_found__c}&apos;==&apos;1&apos;) {
alert(&quot;最终判定时,请取消[故障未发现留下继续观察]并选择[对应方法]&quot;);
return;
}
if (!confirm(&quot;一旦OCM提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?&quot;)) {
return;
}
qis.Id = &quot;{!QIS_Report__c.Id}&quot;;
qis.QIS_Status__c = &quot;RC填写完毕&quot;;
if (&apos;{!QIS_Report__c.RC_problem_not_found__c}&apos; == &apos;1&apos; &amp;&amp; &apos;{!QIS_Report__c.RC_FixedJudgement__c}&apos; == &apos;0&apos;) {
var resultSet = sforce.connection.query(&quot;SELECT Id, Reason_bloken__c, Special_follow__c, next_action__c, QIS_Reply_Comment__c, OCM_judgement__c FROM QIS_Report__c WHERE Id = &apos;{!QIS_Report__c.Id}&apos;&quot;);
var records = resultSet.getArray(&quot;records&quot;);
if (records != null &amp;&amp; records.length &gt; 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(&quot;一旦提交关闭此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?&quot;)) {
return;
}
qis.Id = &quot;{!QIS_Report__c.Id}&quot;;
qis.QIS_Status__c = &quot;取消申请&quot;;
var serverTimestamp = sforce.connection.getServerTimestamp();
qis.QIS_Cancel_Submit_day__c = serverTimestamp.timestamp;
}
var resultSet = sforce.connection.query(&quot;SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c, BuchangApprovalManagerSales__c, SalesManager__c FROM User WHERE Id = &apos;{!$User.Id}&apos;&quot;);
var records = resultSet.getArray(&quot;records&quot;);
if (records != null &amp;&amp; records.length &gt; 0 &amp;&amp; records[0].BuchangApprovalManagerSales__c!= null) {
qis.RC_Manager__c = records[0].BuchangApprovalManagerSales__c;
} else {
qis.RC_Manager__c = &quot;{!$User.Id}&quot;;
}
if (records != null &amp;&amp; records.length &gt; 0) {
    //wangweipeng         LJPH-C6V5XH            2021/09/22            start
    if (old_QIS_Status__c == &quot;RC检测中&quot;) {
        qis.RC__c = &quot;{!$User.Id}&quot;;
    }
    //wangweipeng         LJPH-C6V5XH            2021/09/22            end
if (records[0].SalesManager__c != null) {
qis.ApproveManager__c = records[0].SalesManager__c;
} else {
qis.ApproveManager__c = &apos;{!$User.Id}&apos;
}
if (records[0].BuchangApprovalManagerSales__c != null) {
qis.ApproveBuZhang__c = records[0].BuchangApprovalManagerSales__c;
} else {
qis.ApproveBuZhang__c = &apos;{!$User.Id}&apos;;
}
if (records[0].ZongjianApprovalManager__c != null) {
qis.AppeoveZongJian__c = records[0].ZongjianApprovalManager__c;
} else {
qis.AppeoveZongJian__c = &apos;{!$User.Id}&apos;;
}
}
var result = sforce.connection.update([qis]);
var messages = getConnectDMLErrorMessages(result);
if (messages.length &gt; 0) {
alert(messages.join(&quot;\n&quot;));
return;
}
 
window.location.reload();
}
foo();</url>
</WebLink>