public with sharing class lexRentalApply_FromRepCtl { public lexRentalApply_FromRepCtl() { } @AuraEnabled public static List rentalApp(String recordId){ try { List 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; } }