| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>all_Shippment</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")}  | 
| //2021-10-22 gwy 版本更改为51.0 | 
| sforce.connection.sessionId = "{!GETSESSIONID()}"; | 
| var hasError = '0'; | 
| var sql = "select Id from Equipment_Set_Detail__c where Equipment_Set__c = '{!Equipment_Set__c.Id}'"; | 
| var sqlResult = sforce.connection.query(sql); | 
| var records = sqlResult.getArray("records"); | 
| for (var i = 0; i < records.length; i++) { | 
|     var esd = records[i]; | 
|     esd["Inspection_result__c"] = '正常'; | 
| } | 
| var result = sforce.connection.update(records); | 
| for(var i=0;i<result.length;i++) { | 
| if (result[i].getBoolean("success")) { | 
|     // success | 
| } else { | 
|     alert("failed to update:" + result[i].errors.fields + " " + result[i].errors.message); | 
|     hasError = '1'; | 
|     break; | 
| } | 
| } | 
| if (hasError == '0') { | 
| var report1 = new sforce.SObject("Equipment_Set__c"); | 
| report1.Id = "{!Equipment_Set__c.Id}"; | 
| report1.Shippment_loaner_time__c = fixDate(new Date()); | 
| var result = sforce.connection.update([report1]); | 
| if (result[0].getBoolean("success")) { | 
|     // success | 
| var rtn = sforce.apex.execute("RentalApplyWebService", "eSetRefreshStatus", {eSetId: report1.Id});  | 
|     alert("备品已经出库"); | 
|     location.href = "/{!URLENCODE(Equipment_Set__c.Id)}"; | 
| } else { | 
|     alert("failed to update:" + result[0].errors.fields + " " + result[0].errors.message); | 
| } | 
| } | 
| function fixTime(time){  | 
|     if(time < 10) {time = "0" + time};  | 
|     return time;  | 
| }  | 
| function fixDate(date){  | 
|     var Month = fixTime(date.getMonth() + 1);  | 
|     var Day = fixTime(date.getDate());  | 
|     var UTC = date.toUTCString();  | 
|     var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);  | 
|     var Minutes = fixTime(date.getMinutes());  | 
|     var Seconds = fixTime(date.getSeconds());  | 
|     return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;  | 
| }</url> | 
| </WebLink> |