KKbes
2023-08-07 492f744d9d84289e27b2ddac9a9b4a2137fd11d6
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
public with sharing class LexOPDSupplementaryController {
    @AuraEnabled
    public static OPDPlan__c init(String recordId){
        try{
            OPDPlan__c res = [SELECT id,OPDPlan_ImplementDate__c,Status__c,
            OriginalOpdPlanRental__c,Rental_Apply2__c,Account_Laboratory__c,Related_Opportunity1_ID__c,
            PlanProdDetail__c,Cnt_OPD_LastYear__c,Cnt_OPD_ThisYear__c,Cnt_Rentals__c,
            lastMonth_Plan__c,SalesManager__c,OPDType__c,OriginalOpdPlanApplication__c,
            BuchangApprovalManagerSales__c,SalesManager_Txt__c,
            Name,supplementaryApplication__c 
                FROM OPDPlan__c
                    Where Id = : recordId];
            return res;
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return null;
    }
 
    @AuraEnabled
    public static OPDPlan__c getTheOPDPlan(String Id){
        try{
            OPDPlan__c res = [Select Id, Name,supplementaryApplication__c 
                FROM OPDPlan__c 
                    WHERE supplementaryApplication__c = true 
                    AND OriginalOpdPlanApplication__c = :Id];
            return res;
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return null;
    }
 
 
    @AuraEnabled
    public static OPDPlan__c init2(String recordId){
        try{
            OPDPlan__c res = [SELECT id,Status__c,RentalReson__c,AttachmentCertificate__c,
            NeedReport__c,PlanProdDetail__c,Related_Opportunity1_ID__c,Related_Opportunity2_ID__c
                FROM OPDPlan__c
                    Where Id = : recordId];
            return res;
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return null;       
 
    }
 
    @AuraEnabled
    public static String NewAndUpdateOPDStatus(String Id){
    try{
        OPDPlan__c res =new OPDPlan__c();
        res.Id = Id;
        res.Status__c='提交';
        update res;
        return 'success';
    }
    catch (Exception e) {
        System.debug(LoggingLevel.INFO, '*** e: ' + e);
        return e.getMessage();
    }
    }
 
    @AuraEnabled
    public static OPDPlan__c init3(String recordId){
        OPDPlan__c res = new OPDPlan__c();
        try{ 
            res = [SELECT Id,Name,Status__c,DelayCancel_Reason__c
            ,Account_Laboratory__c,OPDType__c,RentalReson__c,
            Related_Opportunity1_ID__c,
            CorrespondingRepairNo__c,AdditionalSupport__c,Campaign__c,
            NoOpp_Reason__c,ModelLending__c,ModelLendingProduct__c,
            PlanProdDetail__c 
                FROM  OPDPlan__c  WHERE Id = :recordId];
 
        }
        catch(Exception e){
        System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
 
    }
 
    @AuraEnabled
    public static OPDPlan__c reapplyFindOPD(String Id){
        OPDPlan__c res =new OPDPlan__c();
        try{
            res =[SELECT Id, Name,Reapply__c 
                    FROM OPDPlan__c 
                        WHERE Reapply__c = true AND OriginalOpdPlan__c = :Id];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    //新建OPD计划(科室)  客户上的按钮
    @AuraEnabled
    public static Account  initNewOPDButton(String recordId){
        Account res = new Account();
        try{
            res = [SELECT Id,Is_Active__c 
                FROM Account 
                    WHERE Id=:recordId];
            return res;
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            return null;
        }
    }
        //新建OPD计划(询价)  询价上的按钮
    @AuraEnabled
    public static Opportunity  initNewOPDButton2(String recordId){
        Opportunity res = new Opportunity();
        try{
            res = [SELECT Id,AccountId,Name ,StageName
                FROM Opportunity 
                    WHERE Id=:recordId];
            return res;
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            return null;
        }
    }
}