/**
 * *
    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(){
        RecordType re = [SELECT Id, Name, DeveloperName, isActive FROM RecordType WHERE DeveloperName = 'AgencyToCenter' AND SobjectType = 'TransferApply__c' AND isActive = true];
        return re.Id;
    }

    public class InitData{
        @AuraEnabled
        public String raId;        //借出申请Id
        @AuraEnabled
        public String raName;      //借出申请Name
        @AuraEnabled
        public List<Rental_Apply_Equipment_Set_Detail__c> rae;
    }
}