buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
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
public with sharing class otherButtonMaintenanceContractCtl {
    public otherButtonMaintenanceContractCtl() {
 
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            Maintenance_Contract__c report =  [SELECT  URF_Contract__c,RecordTypeId,Is_RecognitionModel__c,Status__c,MC_approval_status__c,Payment_Plan_Sum_First__c,
            Contract_quotation_or_not__c,Name,notRenew__c,Contract_print_completed__c,Maintenance_Contract_No__c,
            upload_to_sap_time__c,old_Is_RecognitionModel__c,upload_to_RM_time__c,Is_Recognition_Model_True__c,
            Id,URF_Contract_F__c,RecordType_DeveloperName__c,Estimate_Target__c FROM Maintenance_Contract__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.StatusC = report.Status__c;
            res.IsRecognitionModelC = report.Is_RecognitionModel__c;
            res.RecordTypeId = report.RecordTypeId;
            res.URFContractC = report.URF_Contract__c;
            res.MCApprovalStatusC = report.MC_approval_status__c;
            res.MaintenanceContractNoC = report.Maintenance_Contract_No__c;
            res.uploadToSapTimeC = report.upload_to_sap_time__c;
            res.oldIsRecognitionModelC = report.old_Is_RecognitionModel__c;
            res.uploadToRMTimeC = report.upload_to_RM_time__c;
            res.IsRecognitionModelTrueC = report.Is_Recognition_Model_True__c;
            res.Id = report.Id;
            res.URFContractFC = report.URF_Contract_F__c;
            res.RecordTypeDeveloperNameC = report.RecordType_DeveloperName__c;
            res.EstimateTargetC = report.Estimate_Target__c;
            res.ContractprintCompletedC = report.Contract_print_completed__c;
            res.notRenewC = report.notRenew__c;
            res.Name = report.Name;
            res.ContractQuotationOrNotC = report.Contract_quotation_or_not__c;
            res.PaymentPlanSumFirstC = report.Payment_Plan_Sum_First__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }   
 
    // 维修合同失单报告
    @AuraEnabled
    public static List<Lost_Report__c> selectRecords(String mcId){
        List<Lost_Report__c> res = new List<Lost_Report__c>();
        try{
            res = [SELECT Id,Status__c,Other_Reasons__c,Other__c,Third_Party_Company__c,Third_Party_Contract_Price__c,To_Where__c,Specific_Reasons__c,Maintenance_Contract__c from Lost_Report__c where Maintenance_Contract__c =: mcId ];
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
    // 查找维修合同报价
    @AuraEnabled
    public static List<Maintenance_Contract_Estimate__c> selectMaintenanceContractEstimate(String recordId){
        List<Maintenance_Contract_Estimate__c> res = new List<Maintenance_Contract_Estimate__c>();
        try{
            res = [SELECT Id  from Maintenance_Contract_Estimate__c where Maintenance_Contract__c=:recordId];
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
    // 工作流状态
    @AuraEnabled
    public static void processResults(String recordId){
        Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
        psr.setobjectid(recordId);
        Approval.ProcessResult submitResult = Approval.process(psr);
    }
 
    public class InitData{
       @AuraEnabled
       public String MCApprovalStatusC;
       @AuraEnabled
       public String MaintenanceContractNoC;
       @AuraEnabled
       public Datetime uploadToSapTimeC;
       @AuraEnabled
       public Boolean oldIsRecognitionModelC;
       @AuraEnabled
       public Datetime uploadToRMTimeC;
       @AuraEnabled
       public Boolean IsRecognitionModelTrueC;
       @AuraEnabled
       public String Id;
       @AuraEnabled
       public String URFContractFC;
       @AuraEnabled
       public String RecordTypeDeveloperNameC;
       @AuraEnabled
       public String EstimateTargetC;
       @AuraEnabled
       public Datetime ContractprintCompletedC;  
       @AuraEnabled
       public Boolean notRenewC;   
       @AuraEnabled
       public String Name;  
       @AuraEnabled
       public String ContractQuotationOrNotC;   
       @AuraEnabled
       public Double PaymentPlanSumFirstC;   
       @AuraEnabled
       public String StatusC;   
       @AuraEnabled
       public Boolean IsRecognitionModelC;   
       @AuraEnabled
       public String RecordTypeId;   
       @AuraEnabled
       public Boolean URFContractC;  
       @AuraEnabled
       public ID RecordTypeId1; 
 
    }
}