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
public with sharing class lexRentalApply_FromRepCtl {
    public lexRentalApply_FromRepCtl() {
 
    }
    @AuraEnabled
    public static List<Rental_Apply__c> rentalApp(String recordId){
        try {
            List<Rental_Apply__c> rep = [select Id from Rental_Apply__c where Repair__c =: recordId and Status__c <> '取消' and Status__c <> '删除'];
            return rep;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static UserResult UserInfo_Owner() {
        UserResult result = new UserResult();
        ID myUserID = UserInfo.getUserId();
        try { 
            User tempUser =
                [select Id,isFormal_Stuff__c,FirstName,LastName from user where id = : myUserID ];
            result.id = tempUser.Id;
            result.isFormalStuff = tempUser.isFormal_Stuff__c;
            result.firstName = tempUser.FirstName == null ? '' : tempUser.FirstName;
            result.lastName = tempUser.LastName == null ? '' : tempUser.LastName;
        } catch (exception e) {
            
            result.result = e.getMessage();
        }
        return result;
    }
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try {
            Repair__c rep = [select Id,Name,Hospital__c,MAFINAL__c,MAINITIAL__c,Planned_Repair_Completed_Date__c,Repair_Estimated_date_formula__c,
                            Agreed_Date__c,Department_Class__c,Account__c,QIS_ID__c,Status1__c,Repair_Final_Inspection_Date__c,
                            Repair_Shipped_Date__c,NewProductGuaranteeObject__c,RepairSource__c,Maintenance_Contract__c,IfCheckFixture__c,
                            Delivered_Product__r.Product2.Family
                            // WYL 贸易合规2期 start
                            ,Hospital__r.IFTradeComplianceIntercept2__c
                            // WYL 贸易合规2期 end
                            from Repair__c where Id =: recordId];
            res.stauts1 = rep.Status1__c;
            res.repairName = rep.Name;
            res.repairId = rep.Id;
            res.inspectionDate = rep.Repair_Final_Inspection_Date__c;
            res.shippedDate = rep.Repair_Shipped_Date__c;
            res.newProductGuaranteeObject = rep.NewProductGuaranteeObject__c;
            res.repairSource = rep.RepairSource__c;
            res.maintenanceContract = rep.Maintenance_Contract__c;
            res.ifCheckFixture = rep.IfCheckFixture__c;
            res.hospital = rep.Hospital__c;
            res.repairDepartment = rep.Department_Class__c;
            res.repairAccount = rep.Account__c;
            res.qisId = rep.QIS_ID__c;
            res.maintial = rep.MAINITIAL__c; // 备品智能化FSE维保预判
            res.estimateDate = rep.Repair_Estimated_date_formula__c; // 报价日
            res.agreeDate = rep.Agreed_Date__c; // 用户同意报价日
            res.plannedRepairCompletedDate = rep.Planned_Repair_Completed_Date__c; //修理预计完成日
            res.mafinal = rep.MAFINAL__c; // 维保项目
            // 借用机会可视化 - 产品类型赋值 2024-01-17 zyh start
            if (String.isNotBlank(rep.Delivered_Product__r.Product2.Family)) {
                if (rep.Delivered_Product__r.Product2.Family == 'GI') {
                    res.family = 'GI';
                } else {
                    res.family = 'SP';
                }
            }
            // 借用机会可视化 - 产品类型赋值 2024-01-17 zyh end
             // WYL 贸易合规2期 start
            if (rep.Hospital__r.IFTradeComplianceIntercept2__c == 'intercept') {
                res.IFTradeComplianceIntercept2 = '1';
            }else if (rep.Hospital__r.IFTradeComplianceIntercept2__c == 'Freeze') {
                res.IFTradeComplianceIntercept2 = '2';
            }
             // WYL 贸易合规2期 end
            return res;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String stauts1;
        @AuraEnabled
        public String repairId;
        @AuraEnabled
        public String repairName;
        @AuraEnabled
        public Boolean maintial; // 备品智能化FSE维保预判
        @AuraEnabled
        public Date agreeDate; // 用户同意报价日
        @AuraEnabled
        public Date estimateDate; // 报价日
        @AuraEnabled
        public String hospital;
        @AuraEnabled
        public String repairDepartment;
        @AuraEnabled
        public String repairAccount;
        @AuraEnabled
        public String qisId;
        @AuraEnabled
        public Date inspectionDate;
        @AuraEnabled
        public Date shippedDate;
        @AuraEnabled
        public Boolean assetModelNo;
        @AuraEnabled
        public Boolean qisRepairId;
        @AuraEnabled
        public String qisRepairName;
        //  Agency_Opportunity__c
        @AuraEnabled
        public String repairSource;
        @AuraEnabled
        public String maintenanceContract;
        @AuraEnabled
        public String purpose2;
        @AuraEnabled
        public String mafinal; // 智能化-维保项目
        @AuraEnabled
        public Boolean ifCheckFixture;
        @AuraEnabled
        public String newProductGuaranteeObject;
        @AuraEnabled
        public Date plannedRepairCompletedDate;
        @AuraEnabled
        public String family; // 智能化-产品类型
        // @AuraEnabled
        // public String repairSource;
        // @AuraEnabled
        // public String maintenanceContract;
         // WYL 贸易合规2期 start
        @AuraEnabled
        public String IFTradeComplianceIntercept2;
         // WYL 贸易合规2期 end
    }
    public class UserResult {
        @AuraEnabled
        public string result;
        public UserResult( ) {
            result = 'Success';
        }
        @AuraEnabled
        public string id;
        @AuraEnabled
        public Boolean isFormalStuff;
        @AuraEnabled
        public string firstName;
        @AuraEnabled
        public string lastName;
    }
}