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
/**
 * *
    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 LexNewTransferApplyController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new InitData();
        try{
            List<Rental_Apply__c> raList = [SELECT Id, Name from Rental_Apply__c where id = :recordId];
            if(raList.size()>0){
 
                Rental_Apply__c ra = raList[0];
                res.raId = ra.Id;
                res.raName = ra.Name;
                List<Rental_Apply_Equipment_Set_Detail__c> raSet = [SELECT Id,Name,Lost_item_giveup__c,Arrival_in_wh__c,Arrival_wh_Result_Agency__c ,Rental_Apply_Equipment_Set__r.First_RAESD__r.Arrival_in_wh__c,
                                        Rental_Apply__r.RecordType.DeveloperName,Lost_Item_return__c,Is_Body__c,Asset__c,Rental_Apply__c,OneToOne_Flag__c,
                                        Rental_Apply_Equipment_Set__r.First_RAESD__r.Arrival_wh_Result_Agency__c,
                                        Rental_Apply_Equipment_Set__r.First_RAESD__r.Lost_item_giveup__c,
                                        Check_lost_Item__c,Check_lost_Item_Final__c,Rental_Apply_Equipment_Set__r.First_You_Xiao_Ku_Cun__c,
                                        Rental_Apply_Equipment_Set__r.First_RAESD__r.Arrival_wh_time__c,Arrival_wh_time__c
                                        FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = :recordId AND Cancel_Select__c = false
                                        ];
                
                res.rae = raSet;
            }
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '****e:' + e);
        }
        
        return res;
    }
 
    
    @AuraEnabled
    public static String getRecordId(){
        InitData res = new InitData();
        RecordType re = [SELECT Id, Name, DeveloperName, isActive FROM RecordType WHERE DeveloperName = 'AgencyToCenter' AND SobjectType = 'TransferApply__c' AND isActive = true];
        return re.Id;
    }
 
    @AuraEnabled
    public static InitData reportData(String recordId){
        InitData res =new InitData();
        try {
            String reportId = [select Id from Report where DeveloperName ='transfer_Rental_report'].Id;
            res.reportId = reportId;
            String mCEName = [select Name from Rental_Apply__c where Id = :recordId].Name;
            res.rentalApplyName = mCEName;
        }
        catch (Exception e) {
            System.debug('==LexNewTransferApplyController==='+e.getMessage());   
        }
        return res;
    }
 
    public class InitData{
        @AuraEnabled
        public String raId;        //借出申请Id
        @AuraEnabled
        public String raName;      //借出申请Name
        @AuraEnabled
        public List<Rental_Apply_Equipment_Set_Detail__c> rae;
        @AuraEnabled
        public String rentalApplyName;
        @AuraEnabled
        public String reportId;
    }
}