liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
/**
 * *
    ODescription:
    GAuthor: sun xia
    @Date: 2023-07-11 15:31:56
    GIastEditors: sun xia
    @IastEditTime: 2023-07-11 15:31:56
 * */
public with sharing class LexEquipmentRentalPicturePDFController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new InitData();
        try {
            List<Rental_Apply__c> raList = [SELECT Id, Shipment_requested_cnt__c from Rental_Apply__c where Id = :recordId];
            if(raList.size()>0){
                Rental_Apply__c ra = raList[0];
                if(ra.Shipment_requested_cnt__c > 0){
                    List<Rental_Apply_Equipment_Set__c> raeSet = [select Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '取消'];
                    Integer setLength = raeSet.size();
                    res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : (setLength/10) +1 ;
                    res.raesList = raeSet;
                } 
                res.shipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);   
            }
        }
        catch (Exception e) {
            System.debug(LoggingLevel.INFO, '****e:' + e);
        }
        return res;
    }
 
    public class InitData{
        @AuraEnabled
        public String id;
        @AuraEnabled
        public Integer pagelength;
        @AuraEnabled
        public Integer shipmentRequestedCnt;
        @AuraEnabled
        public List<Rental_Apply_Equipment_Set__c> raesList;
    }
}