LiJinHuan
2023-04-24 627e79a671b9db3bc219a42f3d6c81f3ac3f7aee
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
public with sharing class AddSubmitApprovalProcessController {
    public AddSubmitApprovalProcessController() {
        
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new InitData();
 
        try {
            Rental_Apply__c ra = [SELECT Id, Request_shipping_day__c, Add_Approval_Status__c, Repair__c, 
                        Demo_purpose1__c, demo_purpose2__c, Repair__r.Repair_Estimated_date_formula__c,
                        Repair__r.Agreed_Date__c, Repair__r.NewProductGuaranteeObject__c,
                        Repair__r.Repair_Final_Inspection_Date__c, Repair__r.Repair_Shipped_Date__c,
                        Repair__r.Status1__c, Repair__r.ReRepairObject_F__c, Repair__r.Number_of_EffectiveContract__c,
                        Repair__r.Delivered_Product__r.Product2.Asset_Model_No__c, Campaign__c,
                        Campaign__r.Status, Campaign__r.Rental_Apply_Flag__c, QIS_number__c, QIS_number__r.next_action__c,
                        applyUser__r.Id, OwnerId, Status__c,RecordTypeId from Rental_Apply__c WHERE Id = :recordId];
            res.rentalApplyId = ra.Id;
            res.recordTypeId = ra.RecordTypeId;
            res.addApprovalStatus = ra.Add_Approval_Status__c;
            res.requestShippingDay = ra.Request_shipping_day__c;
            res.repairId = ra.Repair__c;
            res.demoPurpose1 = ra.Demo_purpose1__c;
            res.demoPurpose2 = ra.demo_purpose2__c;
            res.repairEstimatedDateFormula = ra.Repair__r.Repair_Estimated_date_formula__c;
            res.agreedDate = ra.Repair__r.Agreed_Date__c;
            res.newProductGuaranteeObject = ra.Repair__r.NewProductGuaranteeObject__c;
            res.repairFinalInspectionDate = ra.Repair__r.Repair_Final_Inspection_Date__c;
            res.repairShippedDate = ra.Repair__r.Repair_Shipped_Date__c;
            res.status1 = ra.Repair__r.Status1__c;
            res.reRepairObjectF = ra.Repair__r.ReRepairObject_F__c;
            res.numberOfEffectiveContract = ra.Repair__r.Number_of_EffectiveContract__c;
            res.assetModelNo = ra.Repair__r.Delivered_Product__r.Product2.Asset_Model_No__c;
            res.campaignId = ra.Campaign__c;
            res.campaignStatus = ra.Campaign__r.Status;
            res.rentalApplyFlag = Integer.valueOf(ra.Campaign__r.Rental_Apply_Flag__c);
            res.qISNumber = ra.QIS_number__c;
            res.nextAction = ra.QIS_number__r.next_action__c;
            res.applyUserId = ra.applyUser__r.Id;
            res.ownerId = ra.OwnerId;
            res.rentalApplyStatus = ra.Status__c;
 
            List<Rental_Apply_Equipment_Set_Detail__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = :recordId AND Draft_Appended__c=1];
            res.detailSize = raeSet.size();
        }
        catch (Exception e) {
            System.debug(LoggingLevel.INFO, '****e:' + e);  
        }   
        return res;
    }
 
 
    public Class InitData{
        @AuraEnabled
        public String rentalApplyId;        //备品借出申请Id
        @AuraEnabled
        public String recordTypeId;     
        @AuraEnabled
        public String addApprovalStatus;    //备品借出申请.追加备品审批状态
        @AuraEnabled
        public Integer detailSize;          //明细Size
        @AuraEnabled
        public Date requestShippingDay;     //备品借出申请.希望到货日
        @AuraEnabled
        public String repairId;             //修理Id
        @AuraEnabled
        public String demoPurpose1;         //备品借出申请.使用目的1
        @AuraEnabled
        public String demoPurpose2;         //备品借出申请.使用目的2
        @AuraEnabled
        public Date repairEstimatedDateFormula; //修理.6.报价日
        @AuraEnabled
        public Date agreedDate;             //修理.7.用户同意日
        @AuraEnabled
        public String newProductGuaranteeObject;    //修理.无偿区别标志
        @AuraEnabled
        public Date repairFinalInspectionDate;      //修理.10.最终检测日
        @AuraEnabled
        public Date repairShippedDate;          //修理.11.RC修理品返送日
        @AuraEnabled
        public String status1;                  //修理.状态1
        @AuraEnabled
        public Boolean reRepairObjectF;         //修理.再受理对象品参考
        @AuraEnabled
        public String numberOfEffectiveContract;    //修理.有无维修合同对象(SFDC)
        @AuraEnabled
        public String assetModelNo;                 //修理.资产.产品.产品型号(MDM)
        @AuraEnabled
        public String campaignId;                   //备品借出申请.学会
        @AuraEnabled
        public String campaignStatus;               //学会.状态
        @AuraEnabled
        public Integer rentalApplyFlag;              //学会.提交申请FLG
        @AuraEnabled
        public String qISNumber;                    //备品借出申请.QIS
        @AuraEnabled
        public String nextAction;                   //QIS.对应方法
        @AuraEnabled
        public String applyUserId;                  //备品借出申请.操作者Id
        @AuraEnabled
        public String ownerId;                      //备品借出申请.所有人Id
        @AuraEnabled
        public String rentalApplyStatus;            //备品借出申请.状态
    }
}