Li Jun
2022-04-24 fc8a8cea62e5d248834482a1ade9db6ab0758bf2
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>All_Delivery_btn</fullName>
    <availability>online</availability>
    <description>一键发货,有错就会滚</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-22 gwy 版本更改为51.0
var foo = function() {
    sforce.connection.sessionId = &apos;{!$Api.Session_ID}&apos;; 
var DeliveryGood = new Array(); 
if(&apos;{!Rental_Apply__c.Campaign__c}&apos; != &apos;&apos;) { 
DeliveryGood = sforce.connection.query(&quot;select Status, Rental_Apply_Flag__c from Campaign where id =&apos;{!Rental_Apply__c.CampaignId__c}&apos;&quot;); 
var records= DeliveryGood.getArray(&quot;records&quot;); 
var campaignStatus = records[0].Status; 
if(campaignStatus == &apos;取消&apos;){ 
alert(&quot;学会取消,不可发货&quot;); 
return; 
} }
if(&apos;{!Rental_Apply__c.Repair__c}&apos; != &apos;&apos;)  {
DeliveryGood = sforce.connection.query(&quot;select Repair_Final_Inspection_Date__c, Repair_Shipped_Date__c from Repair__c where id =&apos;{!Rental_Apply__c.RepairId__c}&apos;&quot;); 
var records= DeliveryGood.getArray(&quot;records&quot;); 
if(records[0].Repair_Final_Inspection_Date__c != null || records[0].Repair_Shipped_Date__c != null){ 
alert(&quot;修理有最终检测日或修理品返送日,不可发货&quot;); 
return;
} }
    var raid = &apos;{!Rental_Apply__c.Id}&apos;; 
    var rtn = sforce.apex.execute(&quot;RentalApplyWebService&quot;, &quot;DeliverAll&quot;, {raid: raid});
    if (rtn == &apos;Fin&apos;) { 
         alert(&quot;全部发货成功&quot;); 
         location.href = &quot;/{!Rental_Apply__c.Id}&quot;;
    } else {
         alert(rtn);
    }
}
foo();</url>
</WebLink>