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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
public with sharing class buttonOnCallCtl {
    public buttonOnCallCtl() {
 
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            On_Call__c report =  [SELECT Id,Name,Oncall_Equipment__r.Id,segment__r.Id,segment__c,HP__c,HospitalId__c,Salesdepartment_HP_ID__c,Salesdepartment_HP__c,Oncall_Equipment__c,Trable_occur_daY_collect_c__c FROM On_Call__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.Id = report.Id;
            res.Name = report.Name;
            res.SegmentC = report.segment__c;
            res.SegmentId = report.segment__r.Id;
            res.HPC = report.HP__c;
            res.HospitalIdC = report.HospitalId__c;
            res.SalesdepartmentHPIDC = report.Salesdepartment_HP_ID__c;
            res.SalesdepartmentHPC = report.Salesdepartment_HP__c;
            res.OncallEquipmentC = report.Oncall_Equipment__c;
            res.OncallEquipmentId = report.Oncall_Equipment__r.Id;
            res.TrableOccurdaYCollectC = report.Trable_occur_daY_collect_c__c;
 
            res.userID = UserInfo.getUserId();
 
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }   
 
    @AuraEnabled
    public static List<Account> selecctAccountBySegmentId(String segmentId){
        List<Account> accounts = new List<Account>();
        try {
            accounts = [SELECT ParentId,Parent.RecordTypeId,Parent.RecordType_DeveloperName__c ,Parent.Parent.FSE_GI_Main_Leader__c, Parent.Parent.FSE_GI_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__c FROM Account WHERE Id=: segmentId];
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e); 
        }
        return accounts;
     }
 
     @AuraEnabled
     public static List<Account> selecctAccountBySegmentId02(String segmentId){
        List<Account> accounts = new List<Account>();
        try {
            accounts = [SELECT id,ParentId,Parent.RecordTypeId,Parent.RecordType_DeveloperName__c, Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE Id=: segmentId];
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return accounts;
      }
 
       // 查找UserName
    @AuraEnabled
    public static List<User> initUserName(String userId){
        List<User> res = new List<User>();
        try{
            res = [SELECT Id,name,RepairSalesPoint_Province_China__c,Employee_No__c FROM User WHERE Id=: userId ];
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String SegmentC;
        @AuraEnabled
        public String HPC;
        @AuraEnabled
        public String HospitalIdC;
        @AuraEnabled
        public String SalesdepartmentHPIDC;
        @AuraEnabled
        public String SalesdepartmentHPC;
        @AuraEnabled
        public String OncallEquipmentC;
        @AuraEnabled
        public Date TrableOccurdaYCollectC;
        @AuraEnabled
        public String userID;
        @AuraEnabled
        public String SegmentId;
        @AuraEnabled
        public String OncallEquipmentId;
     }
}