liangxiaozhen
2023-08-06 1d17c4022a928eacff7309016cde76f29ad257fb
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
public with sharing class HosipitalToDeptController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res  = new initData();
        try {
            Account report = [SELECT Id,
                                GI_Main__c,
                                BF_owner__c,
                                ET_owner__c,
                                SP_Main__c,
                                URO_owner_ID__c,
                                GYN_owner__c,
                                ENT_owner_ID__c,
                                Tender_information__c,
                                Is_upload_file__c,
                                Name,
                                Attribute_Type__c FROM Account WHERE Id = :recordId];
            res.GiMain = report.GI_Main__c;
            res.BFowner = report.BF_owner__c;
            res.ETowner = report.ET_owner__c;
            res.SPMain = report.SP_Main__c;
            res.UROownerID = report.URO_owner_ID__c;
            res.GYNowner = report.GYN_owner__c;
            res.ENTownerID = report.ENT_owner_ID__c;
            res.SoakupHPDeptTeam = System.Label.Confirm_SoakupHPDeptTeam;
            res.Tenderinformation = report.Tender_information__c;
            res.Isuploadfile = report.Is_upload_file__c;
            res.Name = report.Name;
            res.AttributeType = report.Attribute_Type__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static string updataAccount(String recordId,Boolean HosipitalToDept){
        Account a = new Account();
        try {
            a.Id = recordId;
            a.HosipitalToDept__c = HosipitalToDept;
            update a;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return 'ok';
    }
    @AuraEnabled
    public static string submitApproval(String recordId){
        try {
            Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
            psr.setObjectId(recordId);
            Approval.ProcessResult submitResult = Approval.process(psr);
            return 'ok';
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public string GiMain;
        @AuraEnabled
        public string BFowner;
        @AuraEnabled
        public string ETowner;
        @AuraEnabled
        public string SPMain;
        @AuraEnabled
        public string UROownerID;
        @AuraEnabled
        public string GYNowner;
        @AuraEnabled
        public string ENTownerID;
        @AuraEnabled
        public string SoakupHPDeptTeam;
        @AuraEnabled
        public string Tenderinformation;
        @AuraEnabled
        public Boolean Isuploadfile;
        @AuraEnabled
        public string Name;
        @AuraEnabled
        public string AttributeType;
    }
}