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
43
44
45
46
47
48
49
50
51
52
53
54
55
public with sharing class LexCancelConsumDetailsCtl {
    public LexCancelConsumDetailsCtl() {
 
    }
 
    @AuraEnabled
    public static List<Consum_Apply_Equipment_Set__c> splitApplyButton(String recordId){
 
        try{
            List<Consum_Apply_Equipment_Set__c> report=[select RAES_Status__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: recordId];
            if(report.size() > 0){
                return report;
            }
            return null;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO,'Consum_Apply_Equipment_Set__c Cancel Error : ' + e);
        }
        return null;
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try {
            List<Consum_Apply__c> repList = [select Id,Yi_loaner_arranged__c from Consum_Apply__c where Id =: recordId];
            if(repList.size() > 0){
                Consum_Apply__c rep = repList[0];
                res.consumApplyId = rep.Id;
                res.yiLoaner = rep.Yi_loaner_arranged__c;
                List<Consum_Apply_Equipment_Set__c> repSetList = [select Id,Yi_loaner_arranged__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: rep.Id];
                if(repSetList.size() > 0){
                    Consum_Apply_Equipment_Set__c repSet = repSetList[0];
                    res.equipmentyiLoaner = repSet.Yi_loaner_arranged__c;
                }else{
                    res.equipmentyiLoaner = -1;
                }
                return res;
            }
            return null;          
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String consumApplyId;
        @AuraEnabled
        public Decimal yiLoaner;
        @AuraEnabled
        public Decimal equipmentyiLoaner;
    }
 
 
 
}