binxie
2024-01-16 1b08402678deb31bba4a347bfd388eba8360cbc1
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
public with sharing class buttonMaintenanceContractEstimateCtl {
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            Maintenance_Contract_Estimate__c report =  [SELECT Process_Status__c,Id FROM Maintenance_Contract_Estimate__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.ProcessStatusC = report.Process_Status__c;         
            res.Id = report.Id;
            res.sessionId = UserInfo.getSessionId();
 
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }   
 
     // 根据ID修改维修合同
     @AuraEnabled
     public static void updateMaintenanceContract(String recordId){
         try {
            Maintenance_Contract_Estimate__c maintenanceContract = new Maintenance_Contract_Estimate__c();
            maintenanceContract.Id = recordId;
            maintenanceContract.Process_Status__c = '中止';
            update maintenanceContract;
         } catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
     }
 
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String ProcessStatusC;   
        @AuraEnabled
        public String sessionId;   
     }
}