19626
2023-04-13 8cb9ec8168351f3a1db37b16a037de9d00fb6025
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
public with sharing class ReturnDeliverySlipController {
    public ReturnDeliverySlipController() {
        
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new InitData();
        try {     
            Rental_Apply__c ra = [SELECT Id, Name, Rental_Apply_Equipment_Set_Cnt__c, Loaner_received_ng_num__c from Rental_Apply__c where Id = :recordId];
            res.raeSet = null;
            if(ra.Rental_Apply_Equipment_Set_Cnt__c > 0){
                List<Rental_Apply_Equipment_Set_Detail__c> raSet = [SELECT Id, Name from Rental_Apply_Equipment_Set_Detail__c WHERE Received_Confirm_F__c = 'NG' AND Cancel_Select__c = false AND Rental_Apply__c = :recordId];
                res.raeSet = raSet;
                system.debug('raeSet===='+res.raeSet);
            }
            res.Name = ra.Name;
            res.RentalApplyEquipmentSetCnt = Integer.valueOf(ra.Rental_Apply_Equipment_Set_Cnt__c);
            res.LoanerReceivedNgNum = Integer.valueOf(ra.Loaner_received_ng_num__c);   
        }
        catch (Exception e) {
            system.debug('INFO****' + e);
        }
        return res;
    }
 
    public class InitData{
        @AuraEnabled
        public Integer RentalApplyEquipmentSetCnt;
        @AuraEnabled
        public Integer LoanerReceivedNgNum;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public List<Rental_Apply_Equipment_Set_Detail__c> raeSet;
    }
}