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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
public with sharing class buttonRepairQuotationCtl {
    public buttonRepairQuotationCtl() {
 
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
             //20231117 李文涛 DB202309328763
            Repair_Quotation__c report =  [SELECT Repair__c,Loaner_repair_sys__c,Rental_Apply_Discount_Status__c,Id,CutPriceStatus_Service__c,Discount_matter__c,Dealer__c,Request_amount_after_discount__c FROM Repair_Quotation__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.RepairC = report.Repair__c;
            res.LoanerRepairSysC = report.Loaner_repair_sys__c;
            res.Id = report.Id;
            res.CutPriceStatusServiceC = report.CutPriceStatus_Service__c;
            res.RentalApplyDiscountStatusC = report.Rental_Apply_Discount_Status__c;
            res.profileId = UserInfo.getProfileId();
             //20231117 李文涛 DB202309328763 start
            res.DiscountMatterC= report.Discount_matter__c;
            res.DealerC=report.Dealer__c;
            res.RequestAmountAfterDiscountC=report.Request_amount_after_discount__c;
             //20231117 李文涛 DB202309328763 end
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }   
 
     // 根据ID修理报价
     @AuraEnabled
     public static String updateRepairQuotation(String recordId){
        String res ='';
         try {
            Repair_Quotation__c repair = new Repair_Quotation__c();
             repair.Id = recordid;
             update repair;
         } catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
             if (e.getMessage().contains(':')){
                String eMessage = e.getMessage();
                Integer left = eMessage .indexof(',')+1 ;
                Integer right = eMessage.indexof('[')-2;
                res =  eMessage.substring(left,right);
            }else {
                res  = e.getMessage();
            }
         }
         return res;
     }
 
    // 根据ID修理报价提交
    @AuraEnabled
    public static String updateRepairQuotation02(String recordId){
        String res ='';
        try {
            Repair_Quotation__c repair = new Repair_Quotation__c();
            repair.Id = recordId;
            repair.CutPriceStatus_Service__c = '已提交';
            update repair;
            return res;
        } catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
             res = e.getMessage();
             if (res.contains(':')) {
                 Integer left = res.indexOf(',')+1;
                 Integer right = res.lastindexOf(':');
                 return res.substring(left,right);
             }else{
                return res;
             }
         }
    }
 
    // 根据ID修理报价提交
    @AuraEnabled
    public static String updateRepairQuotation03(String recordId){
        String res ='';
        try {
            Repair_Quotation__c repair = new Repair_Quotation__c();
            repair.Id = recordId;
            repair.Rental_Apply_Discount_Status__c = '已提交';
            update repair;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            if (e.getMessage().contains(':')){
                String eMessage = e.getMessage();
                Integer left = eMessage .indexof(',')+1 ;
                Integer right = eMessage.indexof('[')-2;
                res =  eMessage.substring(left,right);
            }else {
                res  = e.getMessage();
            }
        }
        return res;
    }
 
     // 根据ID修理报价提交
     @AuraEnabled
     public static String updateRepairQuotation04(String recordId){
         String res ='';
         try {
             Repair_Quotation__c repair = new Repair_Quotation__c();
             repair.Id = recordid;
             repair.Repair_quotation_status__c = '减价申请填写完毕';
             update repair;
             return res;
         } catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
             res = e.getMessage();
             if (res.contains(':')) {
                 Integer left = res.indexOf(',')+1;
                 Integer right = res.lastindexOf(':');
                 return res.substring(left,right);
             }else{
                return res;
             }
         }
         // return res;
     }
 
    // 查找修理
    @AuraEnabled
    public static List<Repair__c> selectRepairC(String recordId){
        List<Repair__c> res = new List<Repair__c>();
        try{
            res = [SELECT Id, Return_Without_Repair__c, Return_Without_Repair_IF__c FROM Repair__c WHERE Id=: recordId ];
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
     // 查找简档
     @AuraEnabled
     public static List<Profile> initSelectProfile(String profileId){
         List<Profile> res = new List<Profile>();
         try{
             res = [SELECT Id,name FROM Profile WHERE Id=: profileId ];
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
         return res;
     }
 
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String CutPriceStatusServiceC;
        @AuraEnabled
        public String profileId;
        @AuraEnabled
        public String RentalApplyDiscountStatusC;
        @AuraEnabled
        public Boolean LoanerRepairSysC;
        @AuraEnabled
        public String RepairC;
        //20231117 李文涛 DB202309328763 start
        @AuraEnabled
        public String DiscountMatterC;
        @AuraEnabled
        public String DealerC;
        @AuraEnabled
        public Decimal RequestAmountAfterDiscountC;
        //20231117 李文涛 DB202309328763 end
     }
}