| | |
| | | * @Author: chen jing wu |
| | | * @Date: 2023-04-12 11:16:07 |
| | | * @LastEditors: chen jing wu |
| | | * @LastEditTime: 2023-09-25 13:20:57 |
| | | * @LastEditTime: 2023-10-08 18:09:35 |
| | | */ |
| | | public with sharing class OpportunityLightingButtonController { |
| | | @AuraEnabled |
| | | public static List<Lost_cancel_report__c> queryForEditLostButton(String recordId){ |
| | | List<Lost_cancel_report__c> res = new List<Lost_cancel_report__c>(); |
| | | public static Map<String,Object> queryForEditLostButton(String recordId){ |
| | | Map<String,Object> objs = new Map<String,Object>(); |
| | | Report1 rep = new Report1(); |
| | | try { |
| | | List<Lost_cancel_report__c> re = [ |
| | | select id, |
| | | Report_Status__c, |
| | | RecordTypeId |
| | | from Lost_cancel_report__c where RecordTypeId != '01210000000R4hHAAS' and Opportunity__c =: recordId]; |
| | | res = re; |
| | | rep.lostReport = re; |
| | | objs.put('report',rep); |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | objs.put('error',e.getMessage()); |
| | | return objs; |
| | | } |
| | | return res; |
| | | return objs; |
| | | } |
| | | public class Report1{ |
| | | @AuraEnabled |
| | | public List<Lost_cancel_report__c> lostReport; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData initForPredictedDateChangeButton(String recordId){ |
| | |
| | | res.createdDay = opportunity.Created_Day__c; |
| | | res.directLossFLG = opportunity.DirectLossFLG__c; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.s62ProfileId = getProfileIdByName(lexLightingButtonConstant.S62_PROFILE_NAME); |
| | | res.m4ProfileId = getProfileIdByName(lexLightingButtonConstant.M4_PROFILE_NAME); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | ]; |
| | | res.ifOpenBid = opportunity.ifOpenBid__c; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | ]; |
| | | res.ifOpenBid = opportunity.ifOpenBid__c; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | from Opportunity where Id =: recordId]; |
| | | res.accountId = opportunity.AccountId; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.accountId = opportunity.AccountId; |
| | | res.userId = UserInfo.getUserId(); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.accountId = opportunity.AccountId; |
| | | res.userId = UserInfo.getUserId(); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.s4ProfileId = getProfileIdByName(lexLightingButtonConstant.S4_PROFILE_NAME); |
| | | res.recordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_AUTHORIZATION_REQUEST).getRecordTypeId(); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c; |
| | | res.recordTypeId = Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OPPO_CANCEL_REPORT).getRecordTypeId(); |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c; |
| | | res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.recordTypeId = opportunity.RecordTypeId; |
| | | res.estimationDecisionc = opportunity.Estimation_Decision__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.biddingProjectNameBidId = opportunity.Bidding_Project_Name_Bid__r.Id; |
| | | res.estimationId = opportunity.Estimation_Id__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.stockApplyStatus = opportunity.Stock_apply_status__c; |
| | | res.lastOpportunityFileId = opportunity.Last_opportunity_file__r.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.reportForCNYId = cnyReport.Id; |
| | | res.reportForUSDId = usdReport.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.sapSendOK = oppo.SAP_Send_OK__c; |
| | | res.isAuthorized = oppo.IsAuthorized__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.opportunityCategory = opp.Opportunity_Category__c; |
| | | res.agency1Name = opp.Agency1__r.Name; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.opportunityNo = oppo.Opportunity_No__c; |
| | | res.isAuthorized = oppo.IsAuthorized__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | ]; |
| | | res.accountId = opp.AccountId; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.name = opp.Name; |
| | | // res.recordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP).getRecordTypeId(); |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.sapSendOK = opp.SAP_Send_OK__c; |
| | | res.ifAuthorizingLock = opp.If_Authorizing_Lock__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.oppForecastStatus = opp.Forecast_this_month__c; |
| | | res.recordTypeId = Schema.SObjectType.OpportunitySpecialApply__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE).getRecordTypeId(); |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | res.oppForecastStatus = ach.Monthly_forecast_shipping__c; |
| | | res.recordTypeId = Schema.SObjectType.OpportunitySpecialApply__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE_ACH).getRecordTypeId(); |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | ]; |
| | | res.stockApplyStatus = opp.Stock_apply_status__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return res; |
| | | } |
| | |
| | | update opp; |
| | | return null; |
| | | } catch (Exception e) { |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | update opp; |
| | | return null; |
| | | } catch (Exception e) { |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | update opp; |
| | | return null; |
| | | } catch (Exception e) { |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | update opp; |
| | | return null; |
| | | } catch (Exception e) { |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | id |
| | | from InquiryPredictsDateChange__c where Predicted_Date_Status__c = :LightingButtonConstant.PREDICTED_DATE_STATUS and Opportunity__c =:recordId]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return rac; |
| | | } |
| | |
| | | taskStatus__c |
| | | from task__c where OpportunityId__c =: recordId and name like :obscureName]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return tasks; |
| | | } |
| | |
| | | taskStatus__c |
| | | from task__c where OpportunityId__c =: recordId and name like :obscureName]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return tasks; |
| | | } |
| | |
| | | where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL OR Tender_information__r.TerminateApprovalStatus__c= :lexLightingButtonConstant.SUB_INFO_TYPE_APPROVE) and Opportunity__c =: recordId |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return links; |
| | | } |
| | |
| | | from QuoteIrai__c where Note__c like :opportunityId and QuoteIrai_Status__c =:lexLightingButtonConstant.QUOTEIRAI_STATUS_DRAFT |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return quotes; |
| | | } |
| | |
| | | FROM Agency_Hospital_Link__c WHERE Agency__c =: agency1Id AND Hospital__c =: hospitalId |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return links; |
| | | } |
| | |
| | | Name FROM RecordType WHERE SobjectType =: sobjectType And developerName=: developerName And IsActive =: isActive |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return types; |
| | | } |
| | |
| | | DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName =: qualifiedApiName |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | |
| | | } |
| | | return fields; |
| | | } |
| | |
| | | processResults.add(Approval.process(request)); |
| | | return processResults[0].errors; |
| | | } catch (Exception e) { |
| | | String eMessage = e.getMessage(); |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | ]; |
| | | return user.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | ]; |
| | | return pro.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | return errorMessage(e); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | |
| | | Quote qu = [select Have_Virtual__c from Quote where Id =: estimationId]; |
| | | bo = qu.Have_Virtual__c; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | |
| | | } |
| | | return bo; |
| | | } |
| | |
| | | } |
| | | return s; |
| | | } catch (Exception e) { |
| | | System.debug(e.getMessage()); |
| | | |
| | | } |
| | | return s; |
| | | } |
| | |
| | | return '1'; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | return ex.getMessage() + ' | Line:' + ex.getLineNumber(); |
| | | return errorMessage(ex); |
| | | } |
| | | } |
| | | |
| | | public static string errorMessage(Exception e){ |
| | | if (e.getMessage().contains(',')) { |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | String exc = '' + e.getMessage(); |
| | | Integer left = exc.indexOf(':') + 1; |
| | | Integer right = exc.lastIndexOf(':'); |
| | | String str = exc.substring(left,right); |
| | | left = str.indexOf(',') + 1; |
| | | String newStr = str.substring(left); |
| | | return newStr; |
| | | }else { |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | } |
| | | public class InitData{ |
| | | @AuraEnabled |
| | | public Boolean directLossFLG; |